@veloceapps/api 11.0.0-0 → 11.0.0-10

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 (28) hide show
  1. package/esm2020/index.mjs +1 -2
  2. package/esm2020/lib/api.module.mjs +4 -7
  3. package/esm2020/lib/services/configuration-api.service.mjs +17 -4
  4. package/esm2020/lib/services/document-attachment-api.service.mjs +1 -1
  5. package/esm2020/lib/services/flows-api.service.mjs +4 -3
  6. package/esm2020/lib/services/product-model-api.service.mjs +2 -16
  7. package/esm2020/lib/services/quote-api.service.mjs +2 -13
  8. package/esm2020/lib/services/rlm-api.service.mjs +1 -2
  9. package/esm2020/lib/services/salesforce-api.service.mjs +1 -8
  10. package/esm2020/lib/services/ui-definitions-api.service.mjs +47 -1
  11. package/esm2020/lib/types/attachment.types.mjs +2 -0
  12. package/esm2020/lib/types/org-info.types.mjs +1 -1
  13. package/fesm2015/veloceapps-api.mjs +363 -641
  14. package/fesm2015/veloceapps-api.mjs.map +1 -1
  15. package/fesm2020/veloceapps-api.mjs +365 -652
  16. package/fesm2020/veloceapps-api.mjs.map +1 -1
  17. package/index.d.ts +0 -1
  18. package/lib/services/configuration-api.service.d.ts +1 -1
  19. package/lib/services/document-attachment-api.service.d.ts +2 -1
  20. package/lib/services/product-model-api.service.d.ts +1 -7
  21. package/lib/services/quote-api.service.d.ts +1 -5
  22. package/lib/services/salesforce-api.service.d.ts +0 -4
  23. package/lib/services/ui-definitions-api.service.d.ts +6 -0
  24. package/lib/types/attachment.types.d.ts +4 -0
  25. package/lib/types/org-info.types.d.ts +0 -2
  26. package/package.json +1 -1
  27. package/esm2020/lib/services/document-templates-api.service.mjs +0 -323
  28. package/lib/services/document-templates-api.service.d.ts +0 -48
@@ -3,14 +3,11 @@ 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, DomainComputation, 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
- import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
6
+ import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
+ import { noop, throwError, switchMap, of, map as map$1, from, catchError as catchError$1, forkJoin } from 'rxjs';
8
+ import { map, catchError, tap } from 'rxjs/operators';
9
9
  import * as i1$2 from 'primeng/api';
10
- import { CurrencyPipe } from '@angular/common';
11
- import * as _ from 'lodash';
12
10
  import { isArray, omit } from 'lodash';
13
- import moment from 'moment';
14
11
  import { __rest } from 'tslib';
15
12
 
16
13
  class AccountApiService {
@@ -392,13 +389,26 @@ class ConfigurationApiService {
392
389
  }
393
390
  }));
394
391
  }
395
- getRuntimeDataByProductId(productId, offeringId) {
392
+ getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
396
393
  return this.httpService
397
394
  .api({
398
395
  method: 'get',
399
396
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
400
397
  })
401
- .pipe(map(runtimeData => {
398
+ .pipe(switchMap(runtimeData => {
399
+ if (requiredUIDefinitionId) {
400
+ return this.httpService.api({ method: 'get', url: `/uidefinitions/${requiredUIDefinitionId}` }).pipe(map(uiDefinition => {
401
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: [uiDefinition] });
402
+ }));
403
+ }
404
+ const params = { productId };
405
+ if (defaultUIDefinitionId) {
406
+ params['defaultUIDefinitionId'] = defaultUIDefinitionId;
407
+ }
408
+ return this.httpService.api({ method: 'get', url: `/uidefinitions`, params }).pipe(map(uiDefinitions => {
409
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions });
410
+ }));
411
+ }), map(runtimeData => {
402
412
  return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)) });
403
413
  }));
404
414
  }
@@ -699,368 +709,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
699
709
  type: Injectable
700
710
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
701
711
 
702
- class SalesforceApiService {
703
- constructor(httpService) {
704
- this.httpService = httpService;
705
- this.SERVICE_URL = '/proxy';
706
- }
707
- query(searchRequest, objectName, options) {
708
- return this.httpService.api(Object.assign({ method: 'post', body: Object.assign(Object.assign({}, searchRequest), { count: searchRequest.count || 100 }), url: `${this.SERVICE_URL}/query/${objectName}` }, options));
709
- }
710
- queryObjects(search, options) {
711
- let params = new HttpParams();
712
- if (search) {
713
- params = params.append('search', search);
714
- }
715
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/query`, params }, options));
716
- }
717
- search(req, options) {
718
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/rest/search`, params: { q: req.searchString } }, options));
719
- }
720
- /**
721
- * @deprecated
722
- */
723
- describe(objectName, fieldName, options) {
724
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
725
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
726
- }
727
- describeObject(objectName, options) {
728
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
729
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
730
- }
731
- describeField(objectName, fieldName, options) {
732
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
733
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
734
- }
735
- describe2(objectName, fields, options) {
736
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
737
- return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
738
- }
739
- apexGetRequest(path, params, options) {
740
- // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
741
- const httpParams = new HttpParams({ fromString: params.toString() });
742
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
743
- }
744
- apexPostRequest(path, body, options) {
745
- return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
746
- }
747
- getGlobalPicklists() {
748
- return this.httpService.api({
749
- method: 'get',
750
- url: `${this.SERVICE_URL}/globalvalueset`,
751
- });
752
- }
753
- getGlobalPicklistValues(id) {
754
- return this.httpService.api({
755
- method: 'get',
756
- url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
757
- });
758
- }
759
- }
760
- SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
761
- SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
763
- type: Injectable
764
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
765
-
766
- class DocumentTemplatesApiService {
767
- constructor(service, salesforceApiService, fileDownloadService, documentAttachmentService, http) {
768
- this.service = service;
769
- this.salesforceApiService = salesforceApiService;
770
- this.fileDownloadService = fileDownloadService;
771
- this.documentAttachmentService = documentAttachmentService;
772
- this.http = http;
773
- this.SERVICE_URL = '/templates';
774
- this.DOCGEN_TAG = 'docgen';
775
- this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
776
- this.mapSfQueryResult = (limit) => map((records) => {
777
- if (!records.length) {
778
- return { _result: 'No Records Found' };
779
- }
780
- if (limit === 1) {
781
- return records[0];
782
- }
783
- return records;
784
- });
785
- this.mapBooleanIfAplicable = (value) => {
786
- if (value === 'true') {
787
- return true;
788
- }
789
- if (value === 'false') {
790
- return false;
791
- }
792
- return value;
793
- };
794
- if (window.VELO_DOCGEN_API) {
795
- this.DOC_GEN_URL = window.VELO_DOCGEN_API;
796
- }
797
- else {
798
- console.log(`window.VELO_DOCGEN_API not set, will use fallback "${this.DOC_GEN_URL_FALLBACK}"`);
799
- this.DOC_GEN_URL = this.DOC_GEN_URL_FALLBACK;
800
- }
801
- }
802
- getTemplates(tag) {
803
- return this.service.api({
804
- url: `${this.SERVICE_URL}`,
805
- method: 'get',
806
- params: Object.assign({}, (tag && { tag })),
807
- });
808
- }
809
- getTemplate(id) {
810
- return this.service.api({
811
- url: `${this.SERVICE_URL}/${id}`,
812
- method: 'get',
813
- });
814
- }
815
- upsertTemplate(template, file, reportProgress) {
816
- const formData = new FormData();
817
- if (file) {
818
- formData.append('file', file, file.name);
819
- }
820
- formData.append('template', new Blob([JSON.stringify(template)], {
821
- type: 'application/json',
822
- }));
823
- let url = `${this.SERVICE_URL}`;
824
- if (template.id) {
825
- url += `/${template.id}`;
826
- }
827
- return this.service.upload({
828
- url,
829
- body: formData,
830
- method: template.id ? 'put' : 'post',
831
- reportProgress,
832
- });
833
- }
834
- removeTemplate(id) {
835
- return this.service.api({
836
- url: `${this.SERVICE_URL}/${id}`,
837
- method: 'delete',
838
- });
839
- }
840
- restoreTemplate(id) {
841
- return this.service.api({
842
- url: `${this.SERVICE_URL}/${id}/restore`,
843
- method: 'patch',
844
- });
845
- }
846
- cloneTemplate(id, propertiesToOverride = {}) {
847
- return this.service.api({
848
- url: `${this.SERVICE_URL}/clone/${id}`,
849
- method: 'post',
850
- body: {
851
- id,
852
- propertiesToOverride,
853
- },
854
- });
855
- }
856
- getTemplateFile(id) {
857
- return this.service.api({
858
- method: 'get',
859
- url: `${this.SERVICE_URL}/${id}/file`,
860
- responseType: 'arraybuffer',
861
- });
862
- }
863
- downloadTemplateFile(id) {
864
- return this.service
865
- .api({
866
- url: `${this.SERVICE_URL}/${id}/file`,
867
- responseType: 'blob',
868
- observe: 'response',
869
- })
870
- .pipe(tap(response => {
871
- this.fileDownloadService.processDownload(response);
872
- }), map(response => response.body || response));
873
- }
874
- mergeDocuments(document, attachments) {
875
- const body = new FormData();
876
- attachments.forEach(attachment => {
877
- body.append('attachments', new Blob([attachment]));
878
- });
879
- body.append('orderform', document);
880
- return this.http.post(`${this.DOC_GEN_URL}/documents/merge`, body, {
881
- responseType: 'arraybuffer',
882
- });
883
- }
884
- generateDocumentV2(body, quoteId, isAsync) {
885
- var _a;
886
- body['docgenURL'] = (_a = window.VELO_DOCGEN_API) !== null && _a !== void 0 ? _a : '';
887
- const params = {};
888
- if (isAsync) {
889
- params['async'] = 'true';
890
- }
891
- return this.service
892
- .api({
893
- method: 'post',
894
- url: `/docgen/${quoteId}/generate`,
895
- body,
896
- params,
897
- responseType: 'arraybuffer',
898
- })
899
- .pipe(map(pdf => {
900
- var _a;
901
- const blob = new Blob([pdf]);
902
- const documentName = (_a = body.parameters['documentName']) !== null && _a !== void 0 ? _a : 'Veloce Proposal';
903
- if (!isAsync) {
904
- this.fileDownloadService.processDownload(blob, `${documentName}.${body.documentFormat.toLowerCase()}`);
905
- }
906
- return blob;
907
- }));
908
- }
909
- getAttachments(searchRequest) {
910
- return this.documentAttachmentService.getAttachments(searchRequest);
911
- }
912
- getAttachmentFile(id) {
913
- return this.documentAttachmentService.getAttachmentFile(id);
914
- }
915
- createAttachment(attachment, file, reportProgress) {
916
- return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
917
- }
918
- removeAttachment(id) {
919
- return this.documentAttachmentService.removeAttachment(id);
920
- }
921
- generateDocumentData(template, object, params = {}) {
922
- var _a;
923
- if (isLegacyDocumentTemplate(template)) {
924
- return this.generateDocumentDataLegacy(template, object, params);
925
- }
926
- const templateProperties = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: this.mapBooleanIfAplicable(value) })), {});
927
- /*
928
- Resolve quote and template properties for now
929
- When procedures are ready, whey will replace template scripts.
930
-
931
- TODO: run procedure to resolve document data
932
- */
933
- return of(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), templateProperties));
934
- }
935
- generateDocument(template, object, params = {}) {
936
- const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
937
- return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
938
- var _a, _b, _c, _d, _e, _f, _g, _h;
939
- const document = DocxTemplater.generate(templateFile, data);
940
- 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 : {};
941
- 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) ||
942
- properties['Name'] ||
943
- template.name;
944
- 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;
945
- if (documentFormat === 'DOCX') {
946
- this.fileDownloadService.processDownload(document, documentName);
947
- return of(document);
948
- }
949
- return this.mergeDocuments(document, attachments).pipe(switchMap(pdf => {
950
- if (params.attachToQuote && QuoteDraft.isQuote(object)) {
951
- const file = new File([pdf], `${documentName}.pdf`);
952
- return this.documentAttachmentService
953
- .createAttachment({
954
- linkedEntityId: object.quoteId,
955
- fileName: documentName,
956
- fileExtension: 'pdf',
957
- tags: this.DOCGEN_TAG,
958
- }, file)
959
- .pipe(map(() => pdf));
960
- }
961
- return of(pdf);
962
- }), map(pdf => {
963
- const blob = new Blob([pdf]);
964
- if (!params.shouldPreventDownload) {
965
- this.fileDownloadService.processDownload(blob, `${documentName}.pdf`);
966
- }
967
- return blob;
968
- }));
969
- }));
970
- }
971
- generateDocumentDataLegacy(template, object, params = {}) {
972
- var _a, _b, _c, _d;
973
- const shouldPreventDownload = params.shouldPreventDownload;
974
- const allQueries = [...((_a = template === null || template === void 0 ? void 0 : template.queries) !== null && _a !== void 0 ? _a : [])];
975
- const properties = (_d = (_c = (_b = object === null || object === void 0 ? void 0 : object.context) === null || _b === void 0 ? void 0 : _b.properties) !== null && _c !== void 0 ? _c : object === null || object === void 0 ? void 0 : object.properties) !== null && _d !== void 0 ? _d : {};
976
- const accountId = properties === null || properties === void 0 ? void 0 : properties['AccountId'];
977
- const userId = properties === null || properties === void 0 ? void 0 : properties['UserId'];
978
- if (accountId) {
979
- allQueries.push({
980
- queryName: 'QuoteAccountQuery',
981
- objectName: 'Account',
982
- resultObjectName: 'account',
983
- statement: `Id ='${accountId}'`,
984
- fields: [],
985
- });
986
- }
987
- if (userId) {
988
- allQueries.push({
989
- queryName: 'QuoteUserQuery',
990
- objectName: 'User',
991
- resultObjectName: 'agent',
992
- statement: `Id ='${userId}'`,
993
- fields: [],
994
- });
995
- }
996
- const queries = allQueries.map(query => this.queryObject(query, { properties })) || [];
997
- return forkJoin([...queries]).pipe(defaultIfEmpty([]), map(results => {
998
- var _a, _b, _c, _d;
999
- const queriesResult = _.chain(results)
1000
- .reduce((acc, r) => {
1001
- if (r) {
1002
- return Object.assign(Object.assign({}, acc), r);
1003
- }
1004
- return acc;
1005
- }, {})
1006
- .value();
1007
- const templateProperties = ((template === null || template === void 0 ? void 0 : template.properties) || []).reduce((trunk, { name, value }) => {
1008
- return Object.assign(Object.assign({}, trunk), { [name]: this.mapBooleanIfAplicable(value) });
1009
- }, {});
1010
- const data = Object.assign(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), queriesResult), templateProperties);
1011
- if (template.script && template.script.trim().length) {
1012
- const currencyFormat = ((_b = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.find(({ name }) => name === 'currencyFormat')) === null || _b === void 0 ? void 0 : _b.value) || '1.2-2';
1013
- const dateFormat = ((_d = (_c = template.properties) === null || _c === void 0 ? void 0 : _c.find(({ name }) => name === 'dateFormat')) === null || _d === void 0 ? void 0 : _d.value) || 'D/MMM/YYYY';
1014
- const formatDate = (value) => {
1015
- return value ? moment(value).format(dateFormat) : value;
1016
- };
1017
- const transform = new Function(`return ${template.script}`)();
1018
- const transformedData = transform(Object.assign(Object.assign({}, data), { utils: {
1019
- lodash: _,
1020
- currency: (value) => new CurrencyPipe('en-US').transform(value, 'USD', 'symbol', currencyFormat),
1021
- date: formatDate,
1022
- }, ToDay: formatDate(Date.now()) }));
1023
- if (!shouldPreventDownload) {
1024
- const blob = new Blob([JSON.stringify(transformedData)]);
1025
- this.fileDownloadService.processDownload(blob, 'data.json');
1026
- }
1027
- return transformedData;
1028
- }
1029
- return data;
1030
- }));
1031
- }
1032
- resolveAttachments$(template) {
1033
- var _a, _b;
1034
- const attachmentIds = (_b = (_a = template.attachments) === null || _a === void 0 ? void 0 : _a.map(({ id }) => id).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
1035
- if (!attachmentIds.length) {
1036
- return of([]);
1037
- }
1038
- return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
1039
- }
1040
- queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
1041
- var _a, _b;
1042
- const patternLimit = /(\s*limit\s\d*)/i;
1043
- let limit = 1;
1044
- if (statement && patternLimit.test(statement)) {
1045
- 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();
1046
- if (limitStr) {
1047
- limit = Number.parseInt(limitStr, 10);
1048
- }
1049
- statement = statement.replace(patternLimit, '');
1050
- }
1051
- const resolvedStatement = statement
1052
- ? StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i)
1053
- : undefined;
1054
- const searchRequest = Object.assign({ skip: 0, count: limit, rawCondition: resolvedStatement }, ((fields === null || fields === void 0 ? void 0 : fields.length) && !!fields[0] && { fields }));
1055
- return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
1056
- }
1057
- }
1058
- 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 });
1059
- DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService });
1060
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
1061
- type: Injectable
1062
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i1$1.HttpClient }]; } });
1063
-
1064
712
  class EndpointsApiService {
1065
713
  constructor(baseHttpService) {
1066
714
  this.baseHttpService = baseHttpService;
@@ -1289,7 +937,9 @@ class FlowsApiService {
1289
937
  }));
1290
938
  }
1291
939
  fetchFlows() {
1292
- 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)));
940
+ return this.configurationSettingsApiService
941
+ .fetchSetting(this.flowsKey)
942
+ .pipe(map((setting) => ((setting === null || setting === void 0 ? void 0 : setting.value) ? JSON.parse(setting.value) : [])));
1293
943
  }
1294
944
  }
1295
945
  FlowsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2062,19 +1712,6 @@ class ProductModelApiService {
2062
1712
  return linkedModels;
2063
1713
  }));
2064
1714
  }
2065
- /**
2066
- *
2067
- * @deprecated
2068
- * Will be removed in next major release
2069
- */
2070
- load(id, version) {
2071
- return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
2072
- const container = new ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
2073
- ModelUtils.override(container.main, container.linked);
2074
- ModelTranslatorUtils.toLocalModel(container.main, container.linked);
2075
- return container;
2076
- }));
2077
- }
2078
1715
  getPML(modelId, version) {
2079
1716
  let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
2080
1717
  if (version) {
@@ -2261,18 +1898,7 @@ class QuoteApiService {
2261
1898
  this.SERVICE_URL = '/quotes';
2262
1899
  }
2263
1900
  /**
2264
- * @deprecated Use getQuoteState instead
2265
- */
2266
- getQuoteDraft(objectId, params, errorHandler) {
2267
- return this.httpService.api({
2268
- method: 'get',
2269
- url: `${this.SERVICE_URL}/${objectId}`,
2270
- params,
2271
- errorHandler,
2272
- });
2273
- }
2274
- /**
2275
- * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
1901
+ * This endpoint doesn't include orders and assets
2276
1902
  * @param objectId quoteId | accountId | opportunityId | orderId
2277
1903
  * @param params Query params
2278
1904
  * @param options Request options
@@ -2448,77 +2074,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2448
2074
  type: Injectable
2449
2075
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2450
2076
 
2451
- class RuleGroupsApiService {
2077
+ class RlmApiService {
2452
2078
  constructor(baseHttpService) {
2453
2079
  this.baseHttpService = baseHttpService;
2454
- this.serviceUrl = '/admin/rule-groups';
2455
- this.fetchRuleGroups$ = () => {
2456
- return this.searchRuleGroups$(new Expression(), 0, 100);
2457
- };
2458
- this.searchRuleGroups$ = (expression, skip, count) => {
2459
- let params = new HttpParams();
2460
- params = params.set('skip', '' + skip);
2461
- params = params.set('count', '' + count);
2462
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2463
- };
2464
- this.createRuleGroup$ = (ruleGroup) => {
2465
- return this.baseHttpService.api({
2466
- url: `${this.serviceUrl}`,
2467
- method: 'post',
2468
- body: ruleGroup,
2469
- });
2470
- };
2471
- this.updateRuleGroup$ = (ruleGroup) => {
2472
- return this.baseHttpService.api({
2473
- url: `${this.serviceUrl}/${ruleGroup.id}`,
2474
- method: 'post',
2475
- body: ruleGroup,
2476
- });
2477
- };
2478
- this.duplicateRuleGroup$ = (body) => {
2479
- return this.baseHttpService
2480
- .api({
2481
- url: `${this.serviceUrl}/${body.id}/clone`,
2482
- method: 'post',
2483
- body,
2484
- })
2485
- .pipe(map$1(response => response.clonedRecordId));
2486
- };
2487
- this.removeRuleGroup$ = (id) => {
2488
- return this.baseHttpService.api({
2489
- url: `${this.serviceUrl}/${id}`,
2490
- method: 'delete',
2491
- });
2492
- };
2493
- this.restoreRuleGroup$ = (id) => {
2494
- return this.baseHttpService.api({
2495
- url: `${this.serviceUrl}/${id}/restore`,
2496
- method: 'patch',
2497
- });
2498
- };
2080
+ this.serviceUrl = '/rlm';
2499
2081
  }
2500
- }
2501
- RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2502
- RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService });
2503
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, decorators: [{
2504
- type: Injectable
2505
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2506
-
2507
- class RulesApiService {
2508
- constructor(baseHttpService) {
2509
- this.baseHttpService = baseHttpService;
2510
- this.serviceUrl = '/admin/rules';
2511
- this.fetchRules$ = () => {
2512
- return this.searchRules$(new Expression(), 0, 100);
2513
- };
2514
- this.searchRules$ = (expression, skip, count) => {
2515
- let params = new HttpParams();
2516
- if (typeof skip === 'number') {
2517
- params = params.set('skip', '' + skip);
2518
- }
2519
- if (typeof count === 'number') {
2520
- params = params.set('count', '' + count);
2521
- }
2082
+ fetchContextDefinitions$() {
2083
+ return this.baseHttpService
2084
+ .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
2085
+ .pipe(catchError(() => {
2086
+ return of([]);
2087
+ }));
2088
+ }
2089
+ fetchContextMappings$(id) {
2090
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
2091
+ }
2092
+ fetchContextDefinitionStructure$(id) {
2093
+ return this.baseHttpService
2094
+ .api({
2095
+ url: `${this.serviceUrl}/context/${id}/structure/details`,
2096
+ skipErrorHandler: true,
2097
+ })
2098
+ .pipe(catchError(() => {
2099
+ return of([]);
2100
+ }), map(objects => {
2101
+ return objects.map(object => {
2102
+ var _a, _b;
2103
+ const tag = (_b = (_a = object.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
2104
+ const objectAttributes = object.attributes || [];
2105
+ return {
2106
+ id: object.id,
2107
+ title: tag || object.title,
2108
+ attributes: objectAttributes.map(attribute => {
2109
+ var _a, _b;
2110
+ const tag = (_b = (_a = attribute.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
2111
+ return {
2112
+ title: tag || attribute.title,
2113
+ fieldType: attribute.fieldType,
2114
+ dataType: attribute.dataType,
2115
+ };
2116
+ }),
2117
+ };
2118
+ });
2119
+ }));
2120
+ }
2121
+ fetchRlmProcedures(contextDefinitionId) {
2122
+ const params = {};
2123
+ if (contextDefinitionId) {
2124
+ params['contextDefinitionId'] = contextDefinitionId;
2125
+ }
2126
+ return this.baseHttpService.api({
2127
+ url: `${this.serviceUrl}/procedures`,
2128
+ params,
2129
+ });
2130
+ }
2131
+ }
2132
+ RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2133
+ RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
2134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
2135
+ type: Injectable
2136
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2137
+
2138
+ class RlmQuoteApiService {
2139
+ constructor(httpService) {
2140
+ this.httpService = httpService;
2141
+ this.SERVICE_URL = '/quotes/rlm';
2142
+ }
2143
+ getQuote(mappingType, objectId, contextMappingId, options) {
2144
+ const params = { mappingType };
2145
+ if (contextMappingId) {
2146
+ params['contextMappingId'] = contextMappingId;
2147
+ }
2148
+ return this.httpService.api(Object.assign({ method: 'get', url: `${this.SERVICE_URL}/${objectId}`, params }, options));
2149
+ }
2150
+ }
2151
+ RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2152
+ RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
2153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
2154
+ type: Injectable
2155
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2156
+
2157
+ class RuleGroupsApiService {
2158
+ constructor(baseHttpService) {
2159
+ this.baseHttpService = baseHttpService;
2160
+ this.serviceUrl = '/admin/rule-groups';
2161
+ this.fetchRuleGroups$ = () => {
2162
+ return this.searchRuleGroups$(new Expression(), 0, 100);
2163
+ };
2164
+ this.searchRuleGroups$ = (expression, skip, count) => {
2165
+ let params = new HttpParams();
2166
+ params = params.set('skip', '' + skip);
2167
+ params = params.set('count', '' + count);
2168
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2169
+ };
2170
+ this.createRuleGroup$ = (ruleGroup) => {
2171
+ return this.baseHttpService.api({
2172
+ url: `${this.serviceUrl}`,
2173
+ method: 'post',
2174
+ body: ruleGroup,
2175
+ });
2176
+ };
2177
+ this.updateRuleGroup$ = (ruleGroup) => {
2178
+ return this.baseHttpService.api({
2179
+ url: `${this.serviceUrl}/${ruleGroup.id}`,
2180
+ method: 'post',
2181
+ body: ruleGroup,
2182
+ });
2183
+ };
2184
+ this.duplicateRuleGroup$ = (body) => {
2185
+ return this.baseHttpService
2186
+ .api({
2187
+ url: `${this.serviceUrl}/${body.id}/clone`,
2188
+ method: 'post',
2189
+ body,
2190
+ })
2191
+ .pipe(map$1(response => response.clonedRecordId));
2192
+ };
2193
+ this.removeRuleGroup$ = (id) => {
2194
+ return this.baseHttpService.api({
2195
+ url: `${this.serviceUrl}/${id}`,
2196
+ method: 'delete',
2197
+ });
2198
+ };
2199
+ this.restoreRuleGroup$ = (id) => {
2200
+ return this.baseHttpService.api({
2201
+ url: `${this.serviceUrl}/${id}/restore`,
2202
+ method: 'patch',
2203
+ });
2204
+ };
2205
+ }
2206
+ }
2207
+ RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2208
+ RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService });
2209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, decorators: [{
2210
+ type: Injectable
2211
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2212
+
2213
+ class RulesApiService {
2214
+ constructor(baseHttpService) {
2215
+ this.baseHttpService = baseHttpService;
2216
+ this.serviceUrl = '/admin/rules';
2217
+ this.fetchRules$ = () => {
2218
+ return this.searchRules$(new Expression(), 0, 100);
2219
+ };
2220
+ this.searchRules$ = (expression, skip, count) => {
2221
+ let params = new HttpParams();
2222
+ if (typeof skip === 'number') {
2223
+ params = params.set('skip', '' + skip);
2224
+ }
2225
+ if (typeof count === 'number') {
2226
+ params = params.set('count', '' + count);
2227
+ }
2522
2228
  return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2523
2229
  };
2524
2230
  this.createRule$ = (rule) => {
@@ -2596,6 +2302,152 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2596
2302
  type: Injectable
2597
2303
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2598
2304
 
2305
+ class SalesforceApiService {
2306
+ constructor(httpService) {
2307
+ this.httpService = httpService;
2308
+ this.SERVICE_URL = '/proxy';
2309
+ }
2310
+ query(searchRequest, objectName, options) {
2311
+ return this.httpService.api(Object.assign({ method: 'post', body: Object.assign(Object.assign({}, searchRequest), { count: searchRequest.count || 100 }), url: `${this.SERVICE_URL}/query/${objectName}` }, options));
2312
+ }
2313
+ queryObjects(search, options) {
2314
+ let params = new HttpParams();
2315
+ if (search) {
2316
+ params = params.append('search', search);
2317
+ }
2318
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/query`, params }, options));
2319
+ }
2320
+ search(req, options) {
2321
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/rest/search`, params: { q: req.searchString } }, options));
2322
+ }
2323
+ describeObject(objectName, options) {
2324
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2325
+ return this.httpService.api(Object.assign({ url: methodUrl }, options));
2326
+ }
2327
+ describeField(objectName, fieldName, options) {
2328
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
2329
+ return this.httpService.api(Object.assign({ url: methodUrl }, options));
2330
+ }
2331
+ describe2(objectName, fields, options) {
2332
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2333
+ return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
2334
+ }
2335
+ apexGetRequest(path, params, options) {
2336
+ // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
2337
+ const httpParams = new HttpParams({ fromString: params.toString() });
2338
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
2339
+ }
2340
+ apexPostRequest(path, body, options) {
2341
+ return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
2342
+ }
2343
+ getGlobalPicklists() {
2344
+ return this.httpService.api({
2345
+ method: 'get',
2346
+ url: `${this.SERVICE_URL}/globalvalueset`,
2347
+ });
2348
+ }
2349
+ getGlobalPicklistValues(id) {
2350
+ return this.httpService.api({
2351
+ method: 'get',
2352
+ url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
2353
+ });
2354
+ }
2355
+ }
2356
+ SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2357
+ SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
2358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
2359
+ type: Injectable
2360
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2361
+
2362
+ class SandboxManagerApiService {
2363
+ constructor(messageService) {
2364
+ this.messageService = messageService;
2365
+ /**
2366
+ * Shows an error message using the message service.
2367
+ *
2368
+ * @param {string} message - the error message to be published.
2369
+ */
2370
+ this.publishErrorMessage = (message) => {
2371
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
2372
+ };
2373
+ }
2374
+ getSalesforceOrganizations$() {
2375
+ try {
2376
+ return window.doSandboxCall
2377
+ ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
2378
+ : of([]);
2379
+ }
2380
+ catch (_a) {
2381
+ return of([]);
2382
+ }
2383
+ }
2384
+ getAvailableSalesforceOrganizationSizes$() {
2385
+ try {
2386
+ return window.doSandboxCall
2387
+ ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
2388
+ : of({});
2389
+ }
2390
+ catch (_a) {
2391
+ return of({});
2392
+ }
2393
+ }
2394
+ createSalesforceOrganization$(payload) {
2395
+ try {
2396
+ return window.doSandboxCall
2397
+ ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2398
+ : of(undefined);
2399
+ }
2400
+ catch (err) {
2401
+ return of(undefined);
2402
+ }
2403
+ }
2404
+ updateSalesforceOrganization$(payload) {
2405
+ try {
2406
+ return window.doSandboxCall
2407
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2408
+ : of(undefined);
2409
+ }
2410
+ catch (_a) {
2411
+ return of(undefined);
2412
+ }
2413
+ }
2414
+ deleteSalesforceOrganization$(payload) {
2415
+ try {
2416
+ return window.doSandboxCall
2417
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2418
+ : of(undefined);
2419
+ }
2420
+ catch (_a) {
2421
+ return of(undefined);
2422
+ }
2423
+ }
2424
+ activateSalesforceOrganization$(payload) {
2425
+ try {
2426
+ return window.doSandboxCall
2427
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2428
+ : of(undefined);
2429
+ }
2430
+ catch (_a) {
2431
+ return of(undefined);
2432
+ }
2433
+ }
2434
+ deactivateSalesforceOrganization$(payload) {
2435
+ try {
2436
+ return window.doSandboxCall
2437
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2438
+ : of(undefined);
2439
+ }
2440
+ catch (_a) {
2441
+ return of(undefined);
2442
+ }
2443
+ }
2444
+ }
2445
+ 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 });
2446
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
2447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
2448
+ type: Injectable
2449
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
2450
+
2599
2451
  class ScriptsApiService {
2600
2452
  constructor(baseHttpService) {
2601
2453
  this.baseHttpService = baseHttpService;
@@ -2748,6 +2600,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2748
2600
  class UIDefinitionsApiService {
2749
2601
  constructor(baseHttpService) {
2750
2602
  this.baseHttpService = baseHttpService;
2603
+ this.serviceUrl = '/uidefinitions';
2751
2604
  }
2752
2605
  fetch$(modelId, version) {
2753
2606
  const serviceUrl = this.getServiceUrl(modelId);
@@ -2764,8 +2617,9 @@ class UIDefinitionsApiService {
2764
2617
  .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2765
2618
  }
2766
2619
  create$(modelId, uiDefinitionContainer) {
2620
+ var _a, _b;
2767
2621
  const serviceUrl = this.getServiceUrl(modelId);
2768
- const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2622
+ const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { name: uiDefinitionContainer.source.name, modelId: uiDefinitionContainer.source.modelId, templateName: (_a = uiDefinitionContainer.source.uiTemplateData) === null || _a === void 0 ? void 0 : _a.TEMPLATE_NAME, rootType: (_b = uiDefinitionContainer.source.uiTemplateData) === null || _b === void 0 ? void 0 : _b.ROOT_TYPE, defaultFlag: uiDefinitionContainer.source.primary, sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2769
2623
  return this.baseHttpService
2770
2624
  .api({
2771
2625
  method: 'post',
@@ -2804,6 +2658,46 @@ class UIDefinitionsApiService {
2804
2658
  getServiceUrl(modelId) {
2805
2659
  return `/models/${modelId}/uidefinitions`;
2806
2660
  }
2661
+ fetchUIDefinitions$() {
2662
+ return this.baseHttpService.api({
2663
+ method: 'get',
2664
+ url: this.serviceUrl,
2665
+ });
2666
+ }
2667
+ fetchUIDefinition$(id) {
2668
+ return this.baseHttpService
2669
+ .api({
2670
+ method: 'get',
2671
+ url: `${this.serviceUrl}/${id}`,
2672
+ })
2673
+ .pipe(map$1(container => uiDefinitionFromDTO(Object.assign(Object.assign({}, container), { id }))), map$1(uiDefinition => {
2674
+ const result = uiDefinition;
2675
+ if (!uiDefinition.modelId && uiDefinition.source.modelId) {
2676
+ result['modelId'] = uiDefinition.source.modelId;
2677
+ }
2678
+ return result;
2679
+ }));
2680
+ }
2681
+ createUIDefinition$(body) {
2682
+ return this.baseHttpService.api({
2683
+ method: 'post',
2684
+ url: this.serviceUrl,
2685
+ body,
2686
+ });
2687
+ }
2688
+ updateUIDefinition$(uiDefinition) {
2689
+ return this.baseHttpService.api({
2690
+ method: 'put',
2691
+ url: `${this.serviceUrl}/${uiDefinition.id}`,
2692
+ body: uiDefinition,
2693
+ });
2694
+ }
2695
+ deleteUIDefinition$(id) {
2696
+ return this.baseHttpService.api({
2697
+ method: 'delete',
2698
+ url: `${this.serviceUrl}/${id}`,
2699
+ });
2700
+ }
2807
2701
  }
2808
2702
  UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2809
2703
  UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
@@ -2963,7 +2857,7 @@ class UITemplatesApiService {
2963
2857
  url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
2964
2858
  params,
2965
2859
  })
2966
- .pipe(switchMap$1(dtos => {
2860
+ .pipe(switchMap(dtos => {
2967
2861
  if (!dtos.length) {
2968
2862
  return of([]);
2969
2863
  }
@@ -2975,7 +2869,7 @@ class UITemplatesApiService {
2975
2869
  .api({
2976
2870
  url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2977
2871
  })
2978
- .pipe(switchMap$1(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2872
+ .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2979
2873
  };
2980
2874
  this.createComponentStory$ = (templateId, story) => {
2981
2875
  return this.baseHttpService.api({
@@ -3044,7 +2938,7 @@ class UITemplatesApiService {
3044
2938
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
3045
2939
  };
3046
2940
  this.fetchComponentsAttachments$ = (templateId) => {
3047
- return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
2941
+ return this.fetchComponents$(templateId).pipe(switchMap(components => {
3048
2942
  return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
3049
2943
  }));
3050
2944
  };
@@ -3189,176 +3083,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3189
3083
  type: Injectable
3190
3084
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3191
3085
 
3192
- class SandboxManagerApiService {
3193
- constructor(messageService) {
3194
- this.messageService = messageService;
3195
- /**
3196
- * Shows an error message using the message service.
3197
- *
3198
- * @param {string} message - the error message to be published.
3199
- */
3200
- this.publishErrorMessage = (message) => {
3201
- this.messageService.add({ severity: 'error', summary: message, sticky: true });
3202
- };
3203
- }
3204
- getSalesforceOrganizations$() {
3205
- try {
3206
- return window.doSandboxCall
3207
- ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
3208
- : of([]);
3209
- }
3210
- catch (_a) {
3211
- return of([]);
3212
- }
3213
- }
3214
- getAvailableSalesforceOrganizationSizes$() {
3215
- try {
3216
- return window.doSandboxCall
3217
- ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
3218
- : of({});
3219
- }
3220
- catch (_a) {
3221
- return of({});
3222
- }
3223
- }
3224
- createSalesforceOrganization$(payload) {
3225
- try {
3226
- return window.doSandboxCall
3227
- ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3228
- : of(undefined);
3229
- }
3230
- catch (err) {
3231
- return of(undefined);
3232
- }
3233
- }
3234
- updateSalesforceOrganization$(payload) {
3235
- try {
3236
- return window.doSandboxCall
3237
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3238
- : of(undefined);
3239
- }
3240
- catch (_a) {
3241
- return of(undefined);
3242
- }
3243
- }
3244
- deleteSalesforceOrganization$(payload) {
3245
- try {
3246
- return window.doSandboxCall
3247
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3248
- : of(undefined);
3249
- }
3250
- catch (_a) {
3251
- return of(undefined);
3252
- }
3253
- }
3254
- activateSalesforceOrganization$(payload) {
3255
- try {
3256
- return window.doSandboxCall
3257
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3258
- : of(undefined);
3259
- }
3260
- catch (_a) {
3261
- return of(undefined);
3262
- }
3263
- }
3264
- deactivateSalesforceOrganization$(payload) {
3265
- try {
3266
- return window.doSandboxCall
3267
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3268
- : of(undefined);
3269
- }
3270
- catch (_a) {
3271
- return of(undefined);
3272
- }
3273
- }
3274
- }
3275
- 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 });
3276
- SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3277
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
3278
- type: Injectable
3279
- }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
3280
-
3281
- class RlmApiService {
3282
- constructor(baseHttpService) {
3283
- this.baseHttpService = baseHttpService;
3284
- this.serviceUrl = '/rlm';
3285
- }
3286
- // TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
3287
- fetchContextDefinitions$() {
3288
- return this.baseHttpService
3289
- .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
3290
- .pipe(catchError(() => {
3291
- return of([]);
3292
- }));
3293
- }
3294
- fetchContextMappings$(id) {
3295
- return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
3296
- }
3297
- fetchContextDefinitionStructure$(id) {
3298
- return this.baseHttpService
3299
- .api({
3300
- url: `${this.serviceUrl}/context/${id}/structure/details`,
3301
- skipErrorHandler: true,
3302
- })
3303
- .pipe(catchError(() => {
3304
- return of([]);
3305
- }), map(objects => {
3306
- return objects.map(object => {
3307
- var _a, _b;
3308
- const tag = (_b = (_a = object.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
3309
- const objectAttributes = object.attributes || [];
3310
- return {
3311
- id: object.id,
3312
- title: tag || object.title,
3313
- attributes: objectAttributes.map(attribute => {
3314
- var _a, _b;
3315
- const tag = (_b = (_a = attribute.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
3316
- return {
3317
- title: tag || attribute.title,
3318
- fieldType: attribute.fieldType,
3319
- dataType: attribute.dataType,
3320
- };
3321
- }),
3322
- };
3323
- });
3324
- }));
3325
- }
3326
- fetchRlmProcedures(contextDefinitionId) {
3327
- const params = {};
3328
- if (contextDefinitionId) {
3329
- params['contextDefinitionId'] = contextDefinitionId;
3330
- }
3331
- return this.baseHttpService.api({
3332
- url: `${this.serviceUrl}/procedures`,
3333
- params,
3334
- });
3335
- }
3336
- }
3337
- RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3338
- RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
3339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
3340
- type: Injectable
3341
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3342
-
3343
- class RlmQuoteApiService {
3344
- constructor(httpService) {
3345
- this.httpService = httpService;
3346
- this.SERVICE_URL = '/quotes/rlm';
3347
- }
3348
- getQuote(mappingType, objectId, contextMappingId, options) {
3349
- const params = { mappingType };
3350
- if (contextMappingId) {
3351
- params['contextMappingId'] = contextMappingId;
3352
- }
3353
- return this.httpService.api(Object.assign({ method: 'get', url: `${this.SERVICE_URL}/${objectId}`, params }, options));
3354
- }
3355
- }
3356
- RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3357
- RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
3358
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
3359
- type: Injectable
3360
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3361
-
3362
3086
  class ApiModule {
3363
3087
  }
3364
3088
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -3374,7 +3098,6 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3374
3098
  ProductModelApiService,
3375
3099
  ProceduresApiService,
3376
3100
  QuoteApiService,
3377
- DocumentTemplatesApiService,
3378
3101
  RampApiService,
3379
3102
  SalesforceApiService,
3380
3103
  UITemplatesApiService,
@@ -3424,7 +3147,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3424
3147
  ProductModelApiService,
3425
3148
  ProceduresApiService,
3426
3149
  QuoteApiService,
3427
- DocumentTemplatesApiService,
3428
3150
  RampApiService,
3429
3151
  SalesforceApiService,
3430
3152
  UITemplatesApiService,
@@ -3466,5 +3188,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3466
3188
  * Generated bundle index. Do not edit.
3467
3189
  */
3468
3190
 
3469
- 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, RlmApiService, RlmQuoteApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, SandboxManagerApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService, fromUIComponentStoryDTO, handleCanvasResponse };
3191
+ export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, EndpointsApiService, FlowStateApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PortalsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RlmApiService, RlmQuoteApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, SandboxManagerApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService, fromUIComponentStoryDTO, handleCanvasResponse };
3470
3192
  //# sourceMappingURL=veloceapps-api.mjs.map