@veloceapps/api 8.0.0-99 → 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
 
15
15
  class AccountApiService {
@@ -38,6 +38,13 @@ class AccountApiService {
38
38
  ...options,
39
39
  });
40
40
  }
41
+ getAssetsState(accountId, options) {
42
+ return this.httpService.api({
43
+ method: 'get',
44
+ url: `/v2${this.SERVICE_URL}/${accountId}/assets`,
45
+ ...options,
46
+ });
47
+ }
41
48
  getAssets(accountId, options) {
42
49
  return this.httpService.api({ url: `${this.SERVICE_URL}/${accountId}/assets`, ...options });
43
50
  }
@@ -446,10 +453,29 @@ class ConfigurationApiService {
446
453
  updatePortDomains(lineItem, runtimeModel) {
447
454
  const type = runtimeModel.components.get(lineItem.type);
448
455
  const portDomains = { ...lineItem.portDomains };
456
+ // loop through ports to look for 'None' type domain computations
449
457
  for (const port of type?.ports ?? []) {
450
- const portDomain = portDomains[port.name];
451
- if (portDomain?.properties?.['domainComputation'] === ('None')) {
452
- portDomain.domainTypes = port.domainTypes;
458
+ const { name: portName, type: typeName, min, max, domainTypes, properties } = port;
459
+ const portDomain = portDomains[portName];
460
+ if (portDomain) {
461
+ // there's a 'None' type domain computation
462
+ if (portDomain.properties?.['domainComputation'] === ('None')) {
463
+ portDomain.domainTypes = domainTypes;
464
+ }
465
+ }
466
+ else {
467
+ // there's no port domain so consider that as 'None' type domain computation
468
+ portDomains[portName] = {
469
+ name: portName,
470
+ type: typeName,
471
+ minCard: Number(min),
472
+ maxCard: Number(max),
473
+ domainTypes: domainTypes,
474
+ properties: {
475
+ ...properties,
476
+ domainComputation: 'None',
477
+ },
478
+ };
453
479
  }
454
480
  }
455
481
  return {
@@ -465,6 +491,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
465
491
  type: Injectable
466
492
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
467
493
 
494
+ class ConfigurationProcessorsApiService {
495
+ constructor(baseHttpService) {
496
+ this.baseHttpService = baseHttpService;
497
+ this.serviceUrl = '/configuration/processors/owners';
498
+ this.fetchConfigurationProcessors$ = (ownerId) => {
499
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
500
+ };
501
+ this.createConfigurationProcessors$ = (configurationProcessor) => {
502
+ return this.baseHttpService.api({
503
+ method: 'post',
504
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
505
+ body: configurationProcessor,
506
+ });
507
+ };
508
+ this.updateConfigurationProcessors$ = (configurationProcessor) => {
509
+ return this.baseHttpService.api({
510
+ method: 'put',
511
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
512
+ body: configurationProcessor,
513
+ });
514
+ };
515
+ this.deleteConfigurationProcessors$ = (configurationProcessor) => {
516
+ return this.baseHttpService.api({
517
+ method: 'delete',
518
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
519
+ });
520
+ };
521
+ }
522
+ }
523
+ ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
524
+ ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
526
+ type: Injectable
527
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
528
+
468
529
  class ConfigurationSettingsDTO {
469
530
  static fromDTO(dto, key) {
470
531
  return {
@@ -569,11 +630,11 @@ class ConfigurationSettingsApiService {
569
630
  });
570
631
  }
571
632
  }
572
- 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 });
633
+ 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 });
573
634
  ConfigurationSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService });
574
635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, decorators: [{
575
636
  type: Injectable
576
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i2.MessageService }]; } });
637
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1$2.MessageService }]; } });
577
638
 
578
639
  class ContextApiService {
579
640
  constructor(httpService) {
@@ -772,8 +833,8 @@ class SalesforceApiService {
772
833
  }
773
834
  apexGetRequest(path, params, options) {
774
835
  // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
775
- // const httpParams = new HttpParams({ fromString: params.toString() });
776
- return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params, ...options });
836
+ const httpParams = new HttpParams({ fromString: params.toString() });
837
+ return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
777
838
  }
778
839
  apexPostRequest(path, body, options) {
779
840
  return this.httpService.api({
@@ -811,7 +872,7 @@ class DocumentTemplatesApiService {
811
872
  this.http = http;
812
873
  this.DOCGEN_TAG = 'docgen';
813
874
  this.SERVICE_URL = '/templates';
814
- this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
875
+ this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
815
876
  this.mapSfQueryResult = (limit) => map((records) => {
816
877
  if (!records.length) {
817
878
  return { _result: 'No Records Found' };
@@ -955,7 +1016,9 @@ class DocumentTemplatesApiService {
955
1016
  return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
956
1017
  const document = DocxTemplater.generate(templateFile, data);
957
1018
  const properties = object?.context?.properties ?? object?.properties ?? {};
958
- const documentName = properties['Name'] || template.name;
1019
+ const documentName = template.properties?.find(({ name }) => name === 'documentName')?.value ||
1020
+ properties['Name'] ||
1021
+ template.name;
959
1022
  const documentFormat = params.documentFormat ?? template.properties?.find(p => p.name === 'documentFormat')?.value;
960
1023
  if (documentFormat === 'DOCX') {
961
1024
  this.fileDownloadService.processDownload(document, documentName);
@@ -1163,13 +1226,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1163
1226
  type: Injectable
1164
1227
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1165
1228
 
1229
+ class FlowStateApiService {
1230
+ constructor(httpService) {
1231
+ this.httpService = httpService;
1232
+ this.SERVICE_URL = '/configuration/states';
1233
+ }
1234
+ /**
1235
+ * Initialize flow state
1236
+ * @param request Request
1237
+ * @returns Flow initialization response, which contains session ID and result of selectors
1238
+ */
1239
+ init(request) {
1240
+ return this.httpService.api({
1241
+ method: 'post',
1242
+ url: `${this.SERVICE_URL}/quote/start`,
1243
+ body: request,
1244
+ });
1245
+ }
1246
+ /**
1247
+ * Get existing state by ID
1248
+ * @param id ID
1249
+ * @returns Flow State
1250
+ */
1251
+ get(id) {
1252
+ return this.httpService.api({
1253
+ url: `${this.SERVICE_URL}/${id}`,
1254
+ });
1255
+ }
1256
+ /**
1257
+ * Execute actions/selectors
1258
+ * @param id State ID
1259
+ * @param request Request
1260
+ * @returns Execute result
1261
+ */
1262
+ execute(id, request) {
1263
+ return this.httpService.api({
1264
+ method: 'post',
1265
+ url: `${this.SERVICE_URL}/quote/${id}/execute`,
1266
+ body: request,
1267
+ });
1268
+ }
1269
+ /**
1270
+ * Save Quote in the state
1271
+ * @param id State ID
1272
+ */
1273
+ save(id) {
1274
+ return this.httpService.api({
1275
+ method: 'post',
1276
+ url: `${this.SERVICE_URL}/quote/${id}/save`,
1277
+ });
1278
+ }
1279
+ /**
1280
+ * Submit Quote in the state
1281
+ * @param id State ID
1282
+ */
1283
+ submit(id) {
1284
+ return this.httpService.api({
1285
+ method: 'post',
1286
+ url: `${this.SERVICE_URL}/quote/${id}/submit`,
1287
+ });
1288
+ }
1289
+ /**
1290
+ * Close Flow state
1291
+ * @param id State ID
1292
+ */
1293
+ cancel(id) {
1294
+ return this.httpService.api({
1295
+ method: 'post',
1296
+ url: `${this.SERVICE_URL}/quote/${id}/cancel`,
1297
+ });
1298
+ }
1299
+ /**
1300
+ * Initialize stateful configuration
1301
+ * @param stateId string
1302
+ * @param request Request
1303
+ * @returns Flow initialization response, which contains session ID and result of selectors
1304
+ */
1305
+ newConfiguration(stateId, request) {
1306
+ return this.httpService.api({
1307
+ method: 'post',
1308
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
1309
+ body: request,
1310
+ });
1311
+ }
1312
+ /**
1313
+ * Start stateful configuration
1314
+ * @param stateId string
1315
+ * @param request Request
1316
+ * @returns Flow initialization response, which contains session ID and result of selectors
1317
+ */
1318
+ startConfiguration(stateId, request) {
1319
+ return this.httpService.api({
1320
+ method: 'post',
1321
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
1322
+ body: request,
1323
+ });
1324
+ }
1325
+ /**
1326
+ * Execute stateful configuration
1327
+ * @param stateId string
1328
+ * @param configurationId string
1329
+ * @param request Request
1330
+ * @returns Flow initialization response, which contains session ID and result of selectors
1331
+ */
1332
+ executeConfiguration(stateId, configurationId, request) {
1333
+ return this.httpService.api({
1334
+ method: 'post',
1335
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
1336
+ body: request,
1337
+ });
1338
+ }
1339
+ /**
1340
+ * Save stateful configuration
1341
+ * @param stateId string
1342
+ * @param configurationId string
1343
+ */
1344
+ saveConfiguration(stateId, configurationId) {
1345
+ return this.httpService.api({
1346
+ method: 'post',
1347
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
1348
+ });
1349
+ }
1350
+ /**
1351
+ * Cancel stateful configuration
1352
+ * @param stateId string
1353
+ * @param configurationId string
1354
+ */
1355
+ cancelConfiguration(stateId, configurationId) {
1356
+ return this.httpService.api({
1357
+ method: 'post',
1358
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
1359
+ });
1360
+ }
1361
+ }
1362
+ FlowStateApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1363
+ FlowStateApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService });
1364
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, decorators: [{
1365
+ type: Injectable
1366
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1367
+
1166
1368
  class FlowsApiService {
1167
1369
  constructor(configurationSettingsApiService) {
1168
1370
  this.configurationSettingsApiService = configurationSettingsApiService;
1169
1371
  this.flowsKey = 'flows';
1170
1372
  }
1171
1373
  getFlow(id) {
1172
- return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)));
1374
+ return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)), map(flow => {
1375
+ if (!flow) {
1376
+ throw new Error(`Flow with flowId=${id} is not defined`);
1377
+ }
1378
+ return flow;
1379
+ }));
1173
1380
  }
1174
1381
  fetchFlows() {
1175
1382
  return this.configurationSettingsApiService.fetchSetting(this.flowsKey).pipe(map((setting) => (setting?.value ? JSON.parse(setting.value) : [])), map(anyFlows => anyFlows.map(toLatestFlow).filter(isDefined)));
@@ -1345,21 +1552,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1345
1552
  type: Injectable
1346
1553
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1347
1554
 
1555
+ /**
1556
+ * Parses the response from Canvas and checks for errors.
1557
+ * - If an error is found, publishes an error message and returns the failover value.
1558
+ * - If no error is found, returns the parsed response.
1559
+ *
1560
+ * Note! The API call first goes to APEX before reaching the Canvas, so errors can originate from either APEX or Canvas.
1561
+ *
1562
+ * @param {string} response - The JSON string response from the Canvas call.
1563
+ * @param {T} failover - The value to return in case of error.
1564
+ * @returns {T | K} The parsed response or the failover value.
1565
+ *
1566
+ * @template T The expected type of the parsed response.
1567
+ * @template K The type of the failover value.
1568
+ *
1569
+ * @remarks If there's an Apex error, the response data can be an array.
1570
+ * In such cases, the function extracts the first element of the array.
1571
+ */
1572
+ const handleCanvasResponse = (response, failover, errorPublisher) => {
1573
+ const parsed = JSON.parse(response);
1574
+ const errorCandidate = isArray(parsed) ? parsed[0] : parsed;
1575
+ if (isApexError(errorCandidate)) {
1576
+ errorPublisher(errorCandidate.message);
1577
+ return failover;
1578
+ }
1579
+ if (isCanvasError(errorCandidate)) {
1580
+ errorPublisher(errorCandidate.error);
1581
+ return failover;
1582
+ }
1583
+ return parsed;
1584
+ };
1585
+
1348
1586
  class OrgInfoApiService {
1349
- constructor(http) {
1350
- this.http = http;
1351
- this.CANVAS_URL_FALLBACK = 'https://canvas.velocpq.com';
1352
- this.hostUrl = window.VELO_CANVAS_API ?? this.CANVAS_URL_FALLBACK;
1587
+ constructor(messageService) {
1588
+ this.messageService = messageService;
1589
+ /**
1590
+ * Shows an error message using the message service.
1591
+ *
1592
+ * @param {string} message - the error message to be published.
1593
+ */
1594
+ this.publishErrorMessage = (message) => {
1595
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
1596
+ };
1597
+ }
1598
+ getOrgInfo$() {
1599
+ try {
1600
+ return window.doCanvasCall && window.ORGANIZATION_ID
1601
+ ? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}`, null)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1602
+ : of(undefined);
1603
+ }
1604
+ catch {
1605
+ return of(undefined);
1606
+ }
1353
1607
  }
1354
- getOrgInfo$(organizationId) {
1355
- return this.http.get(`${this.hostUrl}/org-info/${organizationId}`);
1608
+ getAvailableVersionsInfo$() {
1609
+ try {
1610
+ return window.doCanvasCall && window.ORGANIZATION_ID
1611
+ ? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1612
+ : of(undefined);
1613
+ }
1614
+ catch {
1615
+ return of(undefined);
1616
+ }
1617
+ }
1618
+ upgradeVersion$(targetVersion) {
1619
+ try {
1620
+ return window.doCanvasCall && window.ORGANIZATION_ID
1621
+ ? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1622
+ : of(undefined);
1623
+ }
1624
+ catch {
1625
+ return of(undefined);
1626
+ }
1356
1627
  }
1357
1628
  }
1358
- 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 });
1629
+ 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 });
1359
1630
  OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
1360
1631
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
1361
1632
  type: Injectable
1362
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
1633
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
1363
1634
 
1364
1635
  class PicklistsApiService {
1365
1636
  constructor(baseHttpService) {
@@ -1399,6 +1670,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1399
1670
  type: Injectable
1400
1671
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1401
1672
 
1673
+ class PortalsApiService {
1674
+ constructor(baseHttpService) {
1675
+ this.baseHttpService = baseHttpService;
1676
+ this.serviceUrl = '/admin/portal';
1677
+ this.getPortals$ = (skip = 1, name = '') => {
1678
+ let params = new HttpParams();
1679
+ params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
1680
+ params = params.append('skip', '0');
1681
+ params = params.append('name', name);
1682
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1683
+ };
1684
+ this.searchPortals$ = (skip = 0, expression) => {
1685
+ let params = new HttpParams();
1686
+ params = params.set('skip', '' + skip);
1687
+ params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
1688
+ return this.baseHttpService.api({
1689
+ method: 'post',
1690
+ url: `${this.serviceUrl}/search`,
1691
+ params,
1692
+ body: expression || {},
1693
+ });
1694
+ };
1695
+ this.removePortal$ = (id) => {
1696
+ return this.baseHttpService.api({
1697
+ url: `${this.serviceUrl}/${id}`,
1698
+ method: 'delete',
1699
+ });
1700
+ };
1701
+ this.restore$ = (id) => {
1702
+ return this.baseHttpService.api({
1703
+ method: 'patch',
1704
+ url: `${this.serviceUrl}/${id}/restore`,
1705
+ });
1706
+ };
1707
+ this.duplicatePortal$ = (cloneRequest) => {
1708
+ return this.baseHttpService.api({
1709
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1710
+ method: 'post',
1711
+ body: cloneRequest,
1712
+ });
1713
+ };
1714
+ this.getPortal$ = (id) => {
1715
+ return this.baseHttpService.api({
1716
+ url: `${this.serviceUrl}/${id}`,
1717
+ });
1718
+ };
1719
+ }
1720
+ createNewPortal$(body) {
1721
+ return this.baseHttpService.api({
1722
+ url: `${this.serviceUrl}`,
1723
+ method: 'post',
1724
+ body,
1725
+ });
1726
+ }
1727
+ updatePortal$(portal, settings) {
1728
+ return this.baseHttpService.api({
1729
+ url: `${this.serviceUrl}/${portal.id}`,
1730
+ method: 'put',
1731
+ body: {
1732
+ ...portal,
1733
+ settings: JSON.stringify(settings),
1734
+ },
1735
+ });
1736
+ }
1737
+ }
1738
+ PortalsApiService.MAX_RESULTS = 60;
1739
+ PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1740
+ PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
1741
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
1742
+ type: Injectable
1743
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1744
+
1402
1745
  class PriceApiService {
1403
1746
  constructor(httpService) {
1404
1747
  this.httpService = httpService;
@@ -1546,6 +1889,12 @@ class ProceduresApiService {
1546
1889
  body,
1547
1890
  });
1548
1891
  }
1892
+ fetchDefaultPricingSteps$() {
1893
+ return this.baseHttpService.api({
1894
+ url: `${this.ADMIN_SERVICE_URL}/pricing-steps`,
1895
+ method: 'get',
1896
+ });
1897
+ }
1549
1898
  }
1550
1899
  ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1551
1900
  ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
@@ -2000,7 +2349,9 @@ class QuoteApiService {
2000
2349
  this.httpService = httpService;
2001
2350
  this.SERVICE_URL = '/quotes';
2002
2351
  }
2003
- // request quoteId | accountId | opportunityId | orderId
2352
+ /**
2353
+ * @deprecated Use getQuoteState instead
2354
+ */
2004
2355
  getQuoteDraft(objectId, params, errorHandler) {
2005
2356
  return this.httpService.api({
2006
2357
  method: 'get',
@@ -2009,6 +2360,20 @@ class QuoteApiService {
2009
2360
  errorHandler,
2010
2361
  });
2011
2362
  }
2363
+ /**
2364
+ * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
2365
+ * @param objectId quoteId | accountId | opportunityId | orderId
2366
+ * @param params Query params
2367
+ * @param options Request options
2368
+ */
2369
+ getQuoteState(objectId, params, options) {
2370
+ return this.httpService.api({
2371
+ method: 'get',
2372
+ url: `/v2${this.SERVICE_URL}/${objectId}`,
2373
+ params,
2374
+ ...options,
2375
+ });
2376
+ }
2012
2377
  upsertQuote(request, options) {
2013
2378
  return this.httpService.api({
2014
2379
  method: 'post',
@@ -2384,11 +2749,13 @@ class ScriptsApiService {
2384
2749
  });
2385
2750
  };
2386
2751
  this.cloneScript$ = (cloneRequest) => {
2387
- return this.baseHttpService.api({
2752
+ return this.baseHttpService
2753
+ .api({
2388
2754
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2389
2755
  method: 'post',
2390
2756
  body: cloneRequest,
2391
- });
2757
+ })
2758
+ .pipe(map(response => response.clonedRecordId));
2392
2759
  };
2393
2760
  this.removeScript$ = (id) => {
2394
2761
  return this.baseHttpService.api({
@@ -2790,6 +3157,11 @@ class UITemplatesApiService {
2790
3157
  this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2791
3158
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
2792
3159
  };
3160
+ this.fetchComponentsAttachments$ = (templateId) => {
3161
+ return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
3162
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
3163
+ }));
3164
+ };
2793
3165
  this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
2794
3166
  return this.baseHttpService
2795
3167
  .api({
@@ -2931,112 +3303,94 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2931
3303
  type: Injectable
2932
3304
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2933
3305
 
2934
- class PortalsApiService {
2935
- constructor(baseHttpService) {
2936
- this.baseHttpService = baseHttpService;
2937
- this.serviceUrl = '/admin/portal';
2938
- this.getPortals$ = (skip = 1, name = '') => {
2939
- let params = new HttpParams();
2940
- params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
2941
- params = params.append('skip', '0');
2942
- params = params.append('name', name);
2943
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
2944
- };
2945
- this.searchPortals$ = (skip = 0, expression) => {
2946
- let params = new HttpParams();
2947
- params = params.set('skip', '' + skip);
2948
- params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
2949
- return this.baseHttpService.api({
2950
- method: 'post',
2951
- url: `${this.serviceUrl}/search`,
2952
- params,
2953
- body: expression || {},
2954
- });
2955
- };
2956
- this.removePortal$ = (id) => {
2957
- return this.baseHttpService.api({
2958
- url: `${this.serviceUrl}/${id}`,
2959
- method: 'delete',
2960
- });
2961
- };
2962
- this.restore$ = (id) => {
2963
- return this.baseHttpService.api({
2964
- method: 'patch',
2965
- url: `${this.serviceUrl}/${id}/restore`,
2966
- });
2967
- };
2968
- this.duplicatePortal$ = (cloneRequest) => {
2969
- return this.baseHttpService.api({
2970
- url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2971
- method: 'post',
2972
- body: cloneRequest,
2973
- });
2974
- };
2975
- this.getPortal$ = (id) => {
2976
- return this.baseHttpService.api({
2977
- url: `${this.serviceUrl}/${id}`,
2978
- });
2979
- };
3306
+ class SandboxManagerApiService {
3307
+ constructor(messageService) {
3308
+ this.messageService = messageService;
3309
+ /**
3310
+ * Shows an error message using the message service.
3311
+ *
3312
+ * @param {string} message - the error message to be published.
3313
+ */
3314
+ this.publishErrorMessage = (message) => {
3315
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
3316
+ };
3317
+ }
3318
+ getSalesforceOrganizations$() {
3319
+ try {
3320
+ return window.doSandboxCall
3321
+ ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
3322
+ : of([]);
3323
+ }
3324
+ catch {
3325
+ return of([]);
3326
+ }
2980
3327
  }
2981
- createNewPortal$(body) {
2982
- return this.baseHttpService.api({
2983
- url: `${this.serviceUrl}`,
2984
- method: 'post',
2985
- body,
2986
- });
3328
+ getAvailableSalesforceOrganizationSizes$() {
3329
+ try {
3330
+ return window.doSandboxCall
3331
+ ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
3332
+ : of({});
3333
+ }
3334
+ catch {
3335
+ return of({});
3336
+ }
2987
3337
  }
2988
- updatePortal$(portal, settings) {
2989
- return this.baseHttpService.api({
2990
- url: `${this.serviceUrl}/${portal.id}`,
2991
- method: 'put',
2992
- body: {
2993
- ...portal,
2994
- settings: JSON.stringify(settings),
2995
- },
2996
- });
3338
+ createSalesforceOrganization$(payload) {
3339
+ try {
3340
+ return window.doSandboxCall
3341
+ ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3342
+ : of(undefined);
3343
+ }
3344
+ catch (err) {
3345
+ return of(undefined);
3346
+ }
2997
3347
  }
2998
- }
2999
- PortalsApiService.MAX_RESULTS = 60;
3000
- PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3001
- PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
3002
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
3003
- type: Injectable
3004
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3005
-
3006
- class ConfigurationProcessorsApiService {
3007
- constructor(baseHttpService) {
3008
- this.baseHttpService = baseHttpService;
3009
- this.serviceUrl = '/configuration/processors/owners';
3010
- this.fetchConfigurationProcessors$ = (ownerId) => {
3011
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
3012
- };
3013
- this.createConfigurationProcessors$ = (configurationProcessor) => {
3014
- return this.baseHttpService.api({
3015
- method: 'post',
3016
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
3017
- body: configurationProcessor,
3018
- });
3019
- };
3020
- this.updateConfigurationProcessors$ = (configurationProcessor) => {
3021
- return this.baseHttpService.api({
3022
- method: 'put',
3023
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
3024
- body: configurationProcessor,
3025
- });
3026
- };
3027
- this.deleteConfigurationProcessors$ = (configurationProcessor) => {
3028
- return this.baseHttpService.api({
3029
- method: 'delete',
3030
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
3031
- });
3032
- };
3348
+ updateSalesforceOrganization$(payload) {
3349
+ try {
3350
+ return window.doSandboxCall
3351
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3352
+ : of(undefined);
3353
+ }
3354
+ catch {
3355
+ return of(undefined);
3356
+ }
3357
+ }
3358
+ deleteSalesforceOrganization$(payload) {
3359
+ try {
3360
+ return window.doSandboxCall
3361
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3362
+ : of(undefined);
3363
+ }
3364
+ catch {
3365
+ return of(undefined);
3366
+ }
3367
+ }
3368
+ activateSalesforceOrganization$(payload) {
3369
+ try {
3370
+ return window.doSandboxCall
3371
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3372
+ : of(undefined);
3373
+ }
3374
+ catch {
3375
+ return of(undefined);
3376
+ }
3377
+ }
3378
+ deactivateSalesforceOrganization$(payload) {
3379
+ try {
3380
+ return window.doSandboxCall
3381
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3382
+ : of(undefined);
3383
+ }
3384
+ catch {
3385
+ return of(undefined);
3386
+ }
3033
3387
  }
3034
3388
  }
3035
- ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3036
- ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
3037
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
3389
+ 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 });
3390
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
3038
3392
  type: Injectable
3039
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3393
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
3040
3394
 
3041
3395
  class ApiModule {
3042
3396
  }
@@ -3083,6 +3437,8 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3083
3437
  ContractedPriceApiService,
3084
3438
  PortalsApiService,
3085
3439
  ConfigurationProcessorsApiService,
3440
+ FlowStateApiService,
3441
+ SandboxManagerApiService,
3086
3442
  ], imports: [HttpClientModule] });
3087
3443
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
3088
3444
  type: NgModule,
@@ -3129,6 +3485,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3129
3485
  ContractedPriceApiService,
3130
3486
  PortalsApiService,
3131
3487
  ConfigurationProcessorsApiService,
3488
+ FlowStateApiService,
3489
+ SandboxManagerApiService,
3132
3490
  ],
3133
3491
  }]
3134
3492
  }] });
@@ -3137,5 +3495,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3137
3495
  * Generated bundle index. Do not edit.
3138
3496
  */
3139
3497
 
3140
- 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 };
3498
+ 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 };
3141
3499
  //# sourceMappingURL=veloceapps-api.mjs.map