@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.
- package/esm2020/index.mjs +1 -2
- package/esm2020/lib/api.module.mjs +4 -7
- package/esm2020/lib/services/configuration-api.service.mjs +17 -4
- package/esm2020/lib/services/document-attachment-api.service.mjs +1 -1
- package/esm2020/lib/services/flows-api.service.mjs +4 -3
- package/esm2020/lib/services/product-model-api.service.mjs +2 -16
- package/esm2020/lib/services/quote-api.service.mjs +2 -13
- package/esm2020/lib/services/rlm-api.service.mjs +1 -2
- package/esm2020/lib/services/salesforce-api.service.mjs +1 -8
- package/esm2020/lib/services/ui-definitions-api.service.mjs +47 -1
- package/esm2020/lib/types/attachment.types.mjs +2 -0
- package/esm2020/lib/types/org-info.types.mjs +1 -1
- package/fesm2015/veloceapps-api.mjs +363 -641
- package/fesm2015/veloceapps-api.mjs.map +1 -1
- package/fesm2020/veloceapps-api.mjs +365 -652
- package/fesm2020/veloceapps-api.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/lib/services/configuration-api.service.d.ts +1 -1
- package/lib/services/document-attachment-api.service.d.ts +2 -1
- package/lib/services/product-model-api.service.d.ts +1 -7
- package/lib/services/quote-api.service.d.ts +1 -5
- package/lib/services/salesforce-api.service.d.ts +0 -4
- package/lib/services/ui-definitions-api.service.d.ts +6 -0
- package/lib/types/attachment.types.d.ts +4 -0
- package/lib/types/org-info.types.d.ts +0 -2
- package/package.json +1 -1
- package/esm2020/lib/services/document-templates-api.service.mjs +0 -323
- 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,
|
7
|
-
import { noop, throwError,
|
8
|
-
import { map, catchError, tap
|
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
|
|
15
12
|
class AccountApiService {
|
16
13
|
constructor(httpService) {
|
@@ -431,13 +428,26 @@ class ConfigurationApiService {
|
|
431
428
|
}
|
432
429
|
}));
|
433
430
|
}
|
434
|
-
getRuntimeDataByProductId(productId, offeringId) {
|
431
|
+
getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
|
435
432
|
return this.httpService
|
436
433
|
.api({
|
437
434
|
method: 'get',
|
438
435
|
url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
|
439
436
|
})
|
440
|
-
.pipe(
|
437
|
+
.pipe(switchMap(runtimeData => {
|
438
|
+
if (requiredUIDefinitionId) {
|
439
|
+
return this.httpService.api({ method: 'get', url: `/uidefinitions/${requiredUIDefinitionId}` }).pipe(map(uiDefinition => {
|
440
|
+
return { ...runtimeData, uiDefinitions: [uiDefinition] };
|
441
|
+
}));
|
442
|
+
}
|
443
|
+
const params = { productId };
|
444
|
+
if (defaultUIDefinitionId) {
|
445
|
+
params['defaultUIDefinitionId'] = defaultUIDefinitionId;
|
446
|
+
}
|
447
|
+
return this.httpService.api({ method: 'get', url: `/uidefinitions`, params }).pipe(map(uiDefinitions => {
|
448
|
+
return { ...runtimeData, uiDefinitions };
|
449
|
+
}));
|
450
|
+
}), map(runtimeData => {
|
441
451
|
return {
|
442
452
|
...runtimeData,
|
443
453
|
uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)),
|
@@ -779,399 +789,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
779
789
|
type: Injectable
|
780
790
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
|
781
791
|
|
782
|
-
class SalesforceApiService {
|
783
|
-
constructor(httpService) {
|
784
|
-
this.httpService = httpService;
|
785
|
-
this.SERVICE_URL = '/proxy';
|
786
|
-
}
|
787
|
-
query(searchRequest, objectName, options) {
|
788
|
-
return this.httpService.api({
|
789
|
-
method: 'post',
|
790
|
-
body: { ...searchRequest, count: searchRequest.count || 100 },
|
791
|
-
url: `${this.SERVICE_URL}/query/${objectName}`,
|
792
|
-
...options,
|
793
|
-
});
|
794
|
-
}
|
795
|
-
queryObjects(search, options) {
|
796
|
-
let params = new HttpParams();
|
797
|
-
if (search) {
|
798
|
-
params = params.append('search', search);
|
799
|
-
}
|
800
|
-
return this.httpService.api({
|
801
|
-
url: `${this.SERVICE_URL}/query`,
|
802
|
-
params,
|
803
|
-
...options,
|
804
|
-
});
|
805
|
-
}
|
806
|
-
search(req, options) {
|
807
|
-
return this.httpService.api({
|
808
|
-
url: `${this.SERVICE_URL}/rest/search`,
|
809
|
-
params: { q: req.searchString },
|
810
|
-
...options,
|
811
|
-
});
|
812
|
-
}
|
813
|
-
/**
|
814
|
-
* @deprecated
|
815
|
-
*/
|
816
|
-
describe(objectName, fieldName, options) {
|
817
|
-
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
|
818
|
-
return this.httpService.api({ url: methodUrl, ...options });
|
819
|
-
}
|
820
|
-
describeObject(objectName, options) {
|
821
|
-
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
822
|
-
return this.httpService.api({ url: methodUrl, ...options });
|
823
|
-
}
|
824
|
-
describeField(objectName, fieldName, options) {
|
825
|
-
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
|
826
|
-
return this.httpService.api({ url: methodUrl, ...options });
|
827
|
-
}
|
828
|
-
describe2(objectName, fields, options) {
|
829
|
-
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
830
|
-
return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
|
831
|
-
}
|
832
|
-
apexGetRequest(path, params, options) {
|
833
|
-
// this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
|
834
|
-
const httpParams = new HttpParams({ fromString: params.toString() });
|
835
|
-
return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
|
836
|
-
}
|
837
|
-
apexPostRequest(path, body, options) {
|
838
|
-
return this.httpService.api({
|
839
|
-
method: 'post',
|
840
|
-
body,
|
841
|
-
url: `${this.SERVICE_URL}/apex${path}`,
|
842
|
-
...options,
|
843
|
-
});
|
844
|
-
}
|
845
|
-
getGlobalPicklists() {
|
846
|
-
return this.httpService.api({
|
847
|
-
method: 'get',
|
848
|
-
url: `${this.SERVICE_URL}/globalvalueset`,
|
849
|
-
});
|
850
|
-
}
|
851
|
-
getGlobalPicklistValues(id) {
|
852
|
-
return this.httpService.api({
|
853
|
-
method: 'get',
|
854
|
-
url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
|
855
|
-
});
|
856
|
-
}
|
857
|
-
}
|
858
|
-
SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
859
|
-
SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
|
860
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
|
861
|
-
type: Injectable
|
862
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
863
|
-
|
864
|
-
class DocumentTemplatesApiService {
|
865
|
-
constructor(service, salesforceApiService, fileDownloadService, documentAttachmentService, http) {
|
866
|
-
this.service = service;
|
867
|
-
this.salesforceApiService = salesforceApiService;
|
868
|
-
this.fileDownloadService = fileDownloadService;
|
869
|
-
this.documentAttachmentService = documentAttachmentService;
|
870
|
-
this.http = http;
|
871
|
-
this.SERVICE_URL = '/templates';
|
872
|
-
this.DOCGEN_TAG = 'docgen';
|
873
|
-
this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
|
874
|
-
this.mapSfQueryResult = (limit) => map((records) => {
|
875
|
-
if (!records.length) {
|
876
|
-
return { _result: 'No Records Found' };
|
877
|
-
}
|
878
|
-
if (limit === 1) {
|
879
|
-
return records[0];
|
880
|
-
}
|
881
|
-
return records;
|
882
|
-
});
|
883
|
-
this.mapBooleanIfAplicable = (value) => {
|
884
|
-
if (value === 'true') {
|
885
|
-
return true;
|
886
|
-
}
|
887
|
-
if (value === 'false') {
|
888
|
-
return false;
|
889
|
-
}
|
890
|
-
return value;
|
891
|
-
};
|
892
|
-
if (window.VELO_DOCGEN_API) {
|
893
|
-
this.DOC_GEN_URL = window.VELO_DOCGEN_API;
|
894
|
-
}
|
895
|
-
else {
|
896
|
-
console.log(`window.VELO_DOCGEN_API not set, will use fallback "${this.DOC_GEN_URL_FALLBACK}"`);
|
897
|
-
this.DOC_GEN_URL = this.DOC_GEN_URL_FALLBACK;
|
898
|
-
}
|
899
|
-
}
|
900
|
-
getTemplates(tag) {
|
901
|
-
return this.service.api({
|
902
|
-
url: `${this.SERVICE_URL}`,
|
903
|
-
method: 'get',
|
904
|
-
params: {
|
905
|
-
...(tag && { tag }),
|
906
|
-
},
|
907
|
-
});
|
908
|
-
}
|
909
|
-
getTemplate(id) {
|
910
|
-
return this.service.api({
|
911
|
-
url: `${this.SERVICE_URL}/${id}`,
|
912
|
-
method: 'get',
|
913
|
-
});
|
914
|
-
}
|
915
|
-
upsertTemplate(template, file, reportProgress) {
|
916
|
-
const formData = new FormData();
|
917
|
-
if (file) {
|
918
|
-
formData.append('file', file, file.name);
|
919
|
-
}
|
920
|
-
formData.append('template', new Blob([JSON.stringify(template)], {
|
921
|
-
type: 'application/json',
|
922
|
-
}));
|
923
|
-
let url = `${this.SERVICE_URL}`;
|
924
|
-
if (template.id) {
|
925
|
-
url += `/${template.id}`;
|
926
|
-
}
|
927
|
-
return this.service.upload({
|
928
|
-
url,
|
929
|
-
body: formData,
|
930
|
-
method: template.id ? 'put' : 'post',
|
931
|
-
reportProgress,
|
932
|
-
});
|
933
|
-
}
|
934
|
-
removeTemplate(id) {
|
935
|
-
return this.service.api({
|
936
|
-
url: `${this.SERVICE_URL}/${id}`,
|
937
|
-
method: 'delete',
|
938
|
-
});
|
939
|
-
}
|
940
|
-
restoreTemplate(id) {
|
941
|
-
return this.service.api({
|
942
|
-
url: `${this.SERVICE_URL}/${id}/restore`,
|
943
|
-
method: 'patch',
|
944
|
-
});
|
945
|
-
}
|
946
|
-
cloneTemplate(id, propertiesToOverride = {}) {
|
947
|
-
return this.service.api({
|
948
|
-
url: `${this.SERVICE_URL}/clone/${id}`,
|
949
|
-
method: 'post',
|
950
|
-
body: {
|
951
|
-
id,
|
952
|
-
propertiesToOverride,
|
953
|
-
},
|
954
|
-
});
|
955
|
-
}
|
956
|
-
getTemplateFile(id) {
|
957
|
-
return this.service.api({
|
958
|
-
method: 'get',
|
959
|
-
url: `${this.SERVICE_URL}/${id}/file`,
|
960
|
-
responseType: 'arraybuffer',
|
961
|
-
});
|
962
|
-
}
|
963
|
-
downloadTemplateFile(id) {
|
964
|
-
return this.service
|
965
|
-
.api({
|
966
|
-
url: `${this.SERVICE_URL}/${id}/file`,
|
967
|
-
responseType: 'blob',
|
968
|
-
observe: 'response',
|
969
|
-
})
|
970
|
-
.pipe(tap(response => {
|
971
|
-
this.fileDownloadService.processDownload(response);
|
972
|
-
}), map(response => response.body || response));
|
973
|
-
}
|
974
|
-
mergeDocuments(document, attachments) {
|
975
|
-
const body = new FormData();
|
976
|
-
attachments.forEach(attachment => {
|
977
|
-
body.append('attachments', new Blob([attachment]));
|
978
|
-
});
|
979
|
-
body.append('orderform', document);
|
980
|
-
return this.http.post(`${this.DOC_GEN_URL}/documents/merge`, body, {
|
981
|
-
responseType: 'arraybuffer',
|
982
|
-
});
|
983
|
-
}
|
984
|
-
generateDocumentV2(body, quoteId, isAsync) {
|
985
|
-
body['docgenURL'] = window.VELO_DOCGEN_API ?? '';
|
986
|
-
const params = {};
|
987
|
-
if (isAsync) {
|
988
|
-
params['async'] = 'true';
|
989
|
-
}
|
990
|
-
return this.service
|
991
|
-
.api({
|
992
|
-
method: 'post',
|
993
|
-
url: `/docgen/${quoteId}/generate`,
|
994
|
-
body,
|
995
|
-
params,
|
996
|
-
responseType: 'arraybuffer',
|
997
|
-
})
|
998
|
-
.pipe(map(pdf => {
|
999
|
-
const blob = new Blob([pdf]);
|
1000
|
-
const documentName = body.parameters['documentName'] ?? 'Veloce Proposal';
|
1001
|
-
if (!isAsync) {
|
1002
|
-
this.fileDownloadService.processDownload(blob, `${documentName}.${body.documentFormat.toLowerCase()}`);
|
1003
|
-
}
|
1004
|
-
return blob;
|
1005
|
-
}));
|
1006
|
-
}
|
1007
|
-
getAttachments(searchRequest) {
|
1008
|
-
return this.documentAttachmentService.getAttachments(searchRequest);
|
1009
|
-
}
|
1010
|
-
getAttachmentFile(id) {
|
1011
|
-
return this.documentAttachmentService.getAttachmentFile(id);
|
1012
|
-
}
|
1013
|
-
createAttachment(attachment, file, reportProgress) {
|
1014
|
-
return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
|
1015
|
-
}
|
1016
|
-
removeAttachment(id) {
|
1017
|
-
return this.documentAttachmentService.removeAttachment(id);
|
1018
|
-
}
|
1019
|
-
generateDocumentData(template, object, params = {}) {
|
1020
|
-
if (isLegacyDocumentTemplate(template)) {
|
1021
|
-
return this.generateDocumentDataLegacy(template, object, params);
|
1022
|
-
}
|
1023
|
-
const templateProperties = template.properties?.reduce((acc, { name, value }) => ({ ...acc, [name]: this.mapBooleanIfAplicable(value) }), {});
|
1024
|
-
/*
|
1025
|
-
Resolve quote and template properties for now
|
1026
|
-
When procedures are ready, whey will replace template scripts.
|
1027
|
-
|
1028
|
-
TODO: run procedure to resolve document data
|
1029
|
-
*/
|
1030
|
-
return of({
|
1031
|
-
...(typeof object === 'object' ? object : { object }),
|
1032
|
-
...templateProperties,
|
1033
|
-
});
|
1034
|
-
}
|
1035
|
-
generateDocument(template, object, params = {}) {
|
1036
|
-
const documentData$ = this.generateDocumentData(template, object, { ...params, shouldPreventDownload: true });
|
1037
|
-
return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
|
1038
|
-
const document = DocxTemplater.generate(templateFile, data);
|
1039
|
-
const properties = object?.context?.properties ?? object?.properties ?? {};
|
1040
|
-
const documentName = template.properties?.find(({ name }) => name === 'documentName')?.value ||
|
1041
|
-
properties['Name'] ||
|
1042
|
-
template.name;
|
1043
|
-
const documentFormat = params.documentFormat ?? template.properties?.find(p => p.name === 'documentFormat')?.value;
|
1044
|
-
if (documentFormat === 'DOCX') {
|
1045
|
-
this.fileDownloadService.processDownload(document, documentName);
|
1046
|
-
return of(document);
|
1047
|
-
}
|
1048
|
-
return this.mergeDocuments(document, attachments).pipe(switchMap(pdf => {
|
1049
|
-
if (params.attachToQuote && QuoteDraft.isQuote(object)) {
|
1050
|
-
const file = new File([pdf], `${documentName}.pdf`);
|
1051
|
-
return this.documentAttachmentService
|
1052
|
-
.createAttachment({
|
1053
|
-
linkedEntityId: object.quoteId,
|
1054
|
-
fileName: documentName,
|
1055
|
-
fileExtension: 'pdf',
|
1056
|
-
tags: this.DOCGEN_TAG,
|
1057
|
-
}, file)
|
1058
|
-
.pipe(map(() => pdf));
|
1059
|
-
}
|
1060
|
-
return of(pdf);
|
1061
|
-
}), map(pdf => {
|
1062
|
-
const blob = new Blob([pdf]);
|
1063
|
-
if (!params.shouldPreventDownload) {
|
1064
|
-
this.fileDownloadService.processDownload(blob, `${documentName}.pdf`);
|
1065
|
-
}
|
1066
|
-
return blob;
|
1067
|
-
}));
|
1068
|
-
}));
|
1069
|
-
}
|
1070
|
-
generateDocumentDataLegacy(template, object, params = {}) {
|
1071
|
-
const shouldPreventDownload = params.shouldPreventDownload;
|
1072
|
-
const allQueries = [...(template?.queries ?? [])];
|
1073
|
-
const properties = object?.context?.properties ?? object?.properties ?? {};
|
1074
|
-
const accountId = properties?.['AccountId'];
|
1075
|
-
const userId = properties?.['UserId'];
|
1076
|
-
if (accountId) {
|
1077
|
-
allQueries.push({
|
1078
|
-
queryName: 'QuoteAccountQuery',
|
1079
|
-
objectName: 'Account',
|
1080
|
-
resultObjectName: 'account',
|
1081
|
-
statement: `Id ='${accountId}'`,
|
1082
|
-
fields: [],
|
1083
|
-
});
|
1084
|
-
}
|
1085
|
-
if (userId) {
|
1086
|
-
allQueries.push({
|
1087
|
-
queryName: 'QuoteUserQuery',
|
1088
|
-
objectName: 'User',
|
1089
|
-
resultObjectName: 'agent',
|
1090
|
-
statement: `Id ='${userId}'`,
|
1091
|
-
fields: [],
|
1092
|
-
});
|
1093
|
-
}
|
1094
|
-
const queries = allQueries.map(query => this.queryObject(query, { properties })) || [];
|
1095
|
-
return forkJoin([...queries]).pipe(defaultIfEmpty([]), map(results => {
|
1096
|
-
const queriesResult = _.chain(results)
|
1097
|
-
.reduce((acc, r) => {
|
1098
|
-
if (r) {
|
1099
|
-
return { ...acc, ...r };
|
1100
|
-
}
|
1101
|
-
return acc;
|
1102
|
-
}, {})
|
1103
|
-
.value();
|
1104
|
-
const templateProperties = (template?.properties || []).reduce((trunk, { name, value }) => {
|
1105
|
-
return {
|
1106
|
-
...trunk,
|
1107
|
-
[name]: this.mapBooleanIfAplicable(value),
|
1108
|
-
};
|
1109
|
-
}, {});
|
1110
|
-
const data = {
|
1111
|
-
...(typeof object === 'object' ? object : { object }),
|
1112
|
-
...queriesResult,
|
1113
|
-
...templateProperties,
|
1114
|
-
};
|
1115
|
-
if (template.script && template.script.trim().length) {
|
1116
|
-
const currencyFormat = template.properties?.find(({ name }) => name === 'currencyFormat')?.value || '1.2-2';
|
1117
|
-
const dateFormat = template.properties?.find(({ name }) => name === 'dateFormat')?.value || 'D/MMM/YYYY';
|
1118
|
-
const formatDate = (value) => {
|
1119
|
-
return value ? moment(value).format(dateFormat) : value;
|
1120
|
-
};
|
1121
|
-
const transform = new Function(`return ${template.script}`)();
|
1122
|
-
const transformedData = transform({
|
1123
|
-
...data,
|
1124
|
-
utils: {
|
1125
|
-
lodash: _,
|
1126
|
-
currency: (value) => new CurrencyPipe('en-US').transform(value, 'USD', 'symbol', currencyFormat),
|
1127
|
-
date: formatDate,
|
1128
|
-
},
|
1129
|
-
ToDay: formatDate(Date.now()),
|
1130
|
-
});
|
1131
|
-
if (!shouldPreventDownload) {
|
1132
|
-
const blob = new Blob([JSON.stringify(transformedData)]);
|
1133
|
-
this.fileDownloadService.processDownload(blob, 'data.json');
|
1134
|
-
}
|
1135
|
-
return transformedData;
|
1136
|
-
}
|
1137
|
-
return data;
|
1138
|
-
}));
|
1139
|
-
}
|
1140
|
-
resolveAttachments$(template) {
|
1141
|
-
const attachmentIds = template.attachments?.map(({ id }) => id).filter(Boolean) ?? [];
|
1142
|
-
if (!attachmentIds.length) {
|
1143
|
-
return of([]);
|
1144
|
-
}
|
1145
|
-
return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
|
1146
|
-
}
|
1147
|
-
queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
|
1148
|
-
const patternLimit = /(\s*limit\s\d*)/i;
|
1149
|
-
let limit = 1;
|
1150
|
-
if (statement && patternLimit.test(statement)) {
|
1151
|
-
const limitStr = statement?.match(patternLimit)?.[1]?.trim().substring(5).trim();
|
1152
|
-
if (limitStr) {
|
1153
|
-
limit = Number.parseInt(limitStr, 10);
|
1154
|
-
}
|
1155
|
-
statement = statement.replace(patternLimit, '');
|
1156
|
-
}
|
1157
|
-
const resolvedStatement = statement
|
1158
|
-
? StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i)
|
1159
|
-
: undefined;
|
1160
|
-
const searchRequest = {
|
1161
|
-
skip: 0,
|
1162
|
-
count: limit,
|
1163
|
-
rawCondition: resolvedStatement,
|
1164
|
-
...(fields?.length && !!fields[0] && { fields }),
|
1165
|
-
};
|
1166
|
-
return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
|
1167
|
-
}
|
1168
|
-
}
|
1169
|
-
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 });
|
1170
|
-
DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService });
|
1171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
|
1172
|
-
type: Injectable
|
1173
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i1$1.HttpClient }]; } });
|
1174
|
-
|
1175
792
|
class EndpointsApiService {
|
1176
793
|
constructor(baseHttpService) {
|
1177
794
|
this.baseHttpService = baseHttpService;
|
@@ -1400,7 +1017,9 @@ class FlowsApiService {
|
|
1400
1017
|
}));
|
1401
1018
|
}
|
1402
1019
|
fetchFlows() {
|
1403
|
-
return this.configurationSettingsApiService
|
1020
|
+
return this.configurationSettingsApiService
|
1021
|
+
.fetchSetting(this.flowsKey)
|
1022
|
+
.pipe(map((setting) => (setting?.value ? JSON.parse(setting.value) : [])));
|
1404
1023
|
}
|
1405
1024
|
}
|
1406
1025
|
FlowsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
@@ -2179,19 +1798,6 @@ class ProductModelApiService {
|
|
2179
1798
|
return linkedModels;
|
2180
1799
|
}));
|
2181
1800
|
}
|
2182
|
-
/**
|
2183
|
-
*
|
2184
|
-
* @deprecated
|
2185
|
-
* Will be removed in next major release
|
2186
|
-
*/
|
2187
|
-
load(id, version) {
|
2188
|
-
return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
|
2189
|
-
const container = new ProductModelsContainer(model, linkedModels ?? []);
|
2190
|
-
ModelUtils.override(container.main, container.linked);
|
2191
|
-
ModelTranslatorUtils.toLocalModel(container.main, container.linked);
|
2192
|
-
return container;
|
2193
|
-
}));
|
2194
|
-
}
|
2195
1801
|
getPML(modelId, version) {
|
2196
1802
|
let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
|
2197
1803
|
if (version) {
|
@@ -2378,18 +1984,7 @@ class QuoteApiService {
|
|
2378
1984
|
this.SERVICE_URL = '/quotes';
|
2379
1985
|
}
|
2380
1986
|
/**
|
2381
|
-
*
|
2382
|
-
*/
|
2383
|
-
getQuoteDraft(objectId, params, errorHandler) {
|
2384
|
-
return this.httpService.api({
|
2385
|
-
method: 'get',
|
2386
|
-
url: `${this.SERVICE_URL}/${objectId}`,
|
2387
|
-
params,
|
2388
|
-
errorHandler,
|
2389
|
-
});
|
2390
|
-
}
|
2391
|
-
/**
|
2392
|
-
* Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
|
1987
|
+
* This endpoint doesn't include orders and assets
|
2393
1988
|
* @param objectId quoteId | accountId | opportunityId | orderId
|
2394
1989
|
* @param params Query params
|
2395
1990
|
* @param options Request options
|
@@ -2590,54 +2185,137 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2590
2185
|
type: Injectable
|
2591
2186
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2592
2187
|
|
2593
|
-
class
|
2188
|
+
class RlmApiService {
|
2594
2189
|
constructor(baseHttpService) {
|
2595
2190
|
this.baseHttpService = baseHttpService;
|
2596
|
-
this.serviceUrl = '/
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
this.
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
}
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2191
|
+
this.serviceUrl = '/rlm';
|
2192
|
+
}
|
2193
|
+
fetchContextDefinitions$() {
|
2194
|
+
return this.baseHttpService
|
2195
|
+
.api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
|
2196
|
+
.pipe(catchError(() => {
|
2197
|
+
return of([]);
|
2198
|
+
}));
|
2199
|
+
}
|
2200
|
+
fetchContextMappings$(id) {
|
2201
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
|
2202
|
+
}
|
2203
|
+
fetchContextDefinitionStructure$(id) {
|
2204
|
+
return this.baseHttpService
|
2205
|
+
.api({
|
2206
|
+
url: `${this.serviceUrl}/context/${id}/structure/details`,
|
2207
|
+
skipErrorHandler: true,
|
2208
|
+
})
|
2209
|
+
.pipe(catchError(() => {
|
2210
|
+
return of([]);
|
2211
|
+
}), map(objects => {
|
2212
|
+
return objects.map(object => {
|
2213
|
+
const tag = object.tags?.[0]?.title;
|
2214
|
+
const objectAttributes = object.attributes || [];
|
2215
|
+
return {
|
2216
|
+
id: object.id,
|
2217
|
+
title: tag || object.title,
|
2218
|
+
attributes: objectAttributes.map(attribute => {
|
2219
|
+
const tag = attribute.tags?.[0]?.title;
|
2220
|
+
return {
|
2221
|
+
title: tag || attribute.title,
|
2222
|
+
fieldType: attribute.fieldType,
|
2223
|
+
dataType: attribute.dataType,
|
2224
|
+
};
|
2225
|
+
}),
|
2226
|
+
};
|
2227
|
+
});
|
2228
|
+
}));
|
2229
|
+
}
|
2230
|
+
fetchRlmProcedures(contextDefinitionId) {
|
2231
|
+
const params = {};
|
2232
|
+
if (contextDefinitionId) {
|
2233
|
+
params['contextDefinitionId'] = contextDefinitionId;
|
2234
|
+
}
|
2235
|
+
return this.baseHttpService.api({
|
2236
|
+
url: `${this.serviceUrl}/procedures`,
|
2237
|
+
params,
|
2238
|
+
});
|
2239
|
+
}
|
2240
|
+
}
|
2241
|
+
RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2242
|
+
RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
|
2243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
|
2244
|
+
type: Injectable
|
2245
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2246
|
+
|
2247
|
+
class RlmQuoteApiService {
|
2248
|
+
constructor(httpService) {
|
2249
|
+
this.httpService = httpService;
|
2250
|
+
this.SERVICE_URL = '/quotes/rlm';
|
2251
|
+
}
|
2252
|
+
getQuote(mappingType, objectId, contextMappingId, options) {
|
2253
|
+
const params = { mappingType };
|
2254
|
+
if (contextMappingId) {
|
2255
|
+
params['contextMappingId'] = contextMappingId;
|
2256
|
+
}
|
2257
|
+
return this.httpService.api({
|
2258
|
+
method: 'get',
|
2259
|
+
url: `${this.SERVICE_URL}/${objectId}`,
|
2260
|
+
params,
|
2261
|
+
...options,
|
2262
|
+
});
|
2263
|
+
}
|
2264
|
+
}
|
2265
|
+
RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2266
|
+
RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
|
2267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
|
2268
|
+
type: Injectable
|
2269
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2270
|
+
|
2271
|
+
class RuleGroupsApiService {
|
2272
|
+
constructor(baseHttpService) {
|
2273
|
+
this.baseHttpService = baseHttpService;
|
2274
|
+
this.serviceUrl = '/admin/rule-groups';
|
2275
|
+
this.fetchRuleGroups$ = () => {
|
2276
|
+
return this.searchRuleGroups$(new Expression(), 0, 100);
|
2277
|
+
};
|
2278
|
+
this.searchRuleGroups$ = (expression, skip, count) => {
|
2279
|
+
let params = new HttpParams();
|
2280
|
+
params = params.set('skip', '' + skip);
|
2281
|
+
params = params.set('count', '' + count);
|
2282
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
2283
|
+
};
|
2284
|
+
this.createRuleGroup$ = (ruleGroup) => {
|
2285
|
+
return this.baseHttpService.api({
|
2286
|
+
url: `${this.serviceUrl}`,
|
2287
|
+
method: 'post',
|
2288
|
+
body: ruleGroup,
|
2289
|
+
});
|
2290
|
+
};
|
2291
|
+
this.updateRuleGroup$ = (ruleGroup) => {
|
2292
|
+
return this.baseHttpService.api({
|
2293
|
+
url: `${this.serviceUrl}/${ruleGroup.id}`,
|
2294
|
+
method: 'post',
|
2295
|
+
body: ruleGroup,
|
2296
|
+
});
|
2297
|
+
};
|
2298
|
+
this.duplicateRuleGroup$ = (body) => {
|
2299
|
+
return this.baseHttpService
|
2300
|
+
.api({
|
2301
|
+
url: `${this.serviceUrl}/${body.id}/clone`,
|
2302
|
+
method: 'post',
|
2303
|
+
body,
|
2304
|
+
})
|
2305
|
+
.pipe(map$1(response => response.clonedRecordId));
|
2306
|
+
};
|
2307
|
+
this.removeRuleGroup$ = (id) => {
|
2308
|
+
return this.baseHttpService.api({
|
2309
|
+
url: `${this.serviceUrl}/${id}`,
|
2310
|
+
method: 'delete',
|
2311
|
+
});
|
2312
|
+
};
|
2313
|
+
this.restoreRuleGroup$ = (id) => {
|
2314
|
+
return this.baseHttpService.api({
|
2315
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
2316
|
+
method: 'patch',
|
2317
|
+
});
|
2318
|
+
};
|
2641
2319
|
}
|
2642
2320
|
}
|
2643
2321
|
RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
@@ -2738,6 +2416,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2738
2416
|
type: Injectable
|
2739
2417
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2740
2418
|
|
2419
|
+
class SalesforceApiService {
|
2420
|
+
constructor(httpService) {
|
2421
|
+
this.httpService = httpService;
|
2422
|
+
this.SERVICE_URL = '/proxy';
|
2423
|
+
}
|
2424
|
+
query(searchRequest, objectName, options) {
|
2425
|
+
return this.httpService.api({
|
2426
|
+
method: 'post',
|
2427
|
+
body: { ...searchRequest, count: searchRequest.count || 100 },
|
2428
|
+
url: `${this.SERVICE_URL}/query/${objectName}`,
|
2429
|
+
...options,
|
2430
|
+
});
|
2431
|
+
}
|
2432
|
+
queryObjects(search, options) {
|
2433
|
+
let params = new HttpParams();
|
2434
|
+
if (search) {
|
2435
|
+
params = params.append('search', search);
|
2436
|
+
}
|
2437
|
+
return this.httpService.api({
|
2438
|
+
url: `${this.SERVICE_URL}/query`,
|
2439
|
+
params,
|
2440
|
+
...options,
|
2441
|
+
});
|
2442
|
+
}
|
2443
|
+
search(req, options) {
|
2444
|
+
return this.httpService.api({
|
2445
|
+
url: `${this.SERVICE_URL}/rest/search`,
|
2446
|
+
params: { q: req.searchString },
|
2447
|
+
...options,
|
2448
|
+
});
|
2449
|
+
}
|
2450
|
+
describeObject(objectName, options) {
|
2451
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
2452
|
+
return this.httpService.api({ url: methodUrl, ...options });
|
2453
|
+
}
|
2454
|
+
describeField(objectName, fieldName, options) {
|
2455
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
|
2456
|
+
return this.httpService.api({ url: methodUrl, ...options });
|
2457
|
+
}
|
2458
|
+
describe2(objectName, fields, options) {
|
2459
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
2460
|
+
return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
|
2461
|
+
}
|
2462
|
+
apexGetRequest(path, params, options) {
|
2463
|
+
// this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
|
2464
|
+
const httpParams = new HttpParams({ fromString: params.toString() });
|
2465
|
+
return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
|
2466
|
+
}
|
2467
|
+
apexPostRequest(path, body, options) {
|
2468
|
+
return this.httpService.api({
|
2469
|
+
method: 'post',
|
2470
|
+
body,
|
2471
|
+
url: `${this.SERVICE_URL}/apex${path}`,
|
2472
|
+
...options,
|
2473
|
+
});
|
2474
|
+
}
|
2475
|
+
getGlobalPicklists() {
|
2476
|
+
return this.httpService.api({
|
2477
|
+
method: 'get',
|
2478
|
+
url: `${this.SERVICE_URL}/globalvalueset`,
|
2479
|
+
});
|
2480
|
+
}
|
2481
|
+
getGlobalPicklistValues(id) {
|
2482
|
+
return this.httpService.api({
|
2483
|
+
method: 'get',
|
2484
|
+
url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
|
2485
|
+
});
|
2486
|
+
}
|
2487
|
+
}
|
2488
|
+
SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2489
|
+
SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
|
2490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
|
2491
|
+
type: Injectable
|
2492
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2493
|
+
|
2494
|
+
class SandboxManagerApiService {
|
2495
|
+
constructor(messageService) {
|
2496
|
+
this.messageService = messageService;
|
2497
|
+
/**
|
2498
|
+
* Shows an error message using the message service.
|
2499
|
+
*
|
2500
|
+
* @param {string} message - the error message to be published.
|
2501
|
+
*/
|
2502
|
+
this.publishErrorMessage = (message) => {
|
2503
|
+
this.messageService.add({ severity: 'error', summary: message, sticky: true });
|
2504
|
+
};
|
2505
|
+
}
|
2506
|
+
getSalesforceOrganizations$() {
|
2507
|
+
try {
|
2508
|
+
return window.doSandboxCall
|
2509
|
+
? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
|
2510
|
+
: of([]);
|
2511
|
+
}
|
2512
|
+
catch {
|
2513
|
+
return of([]);
|
2514
|
+
}
|
2515
|
+
}
|
2516
|
+
getAvailableSalesforceOrganizationSizes$() {
|
2517
|
+
try {
|
2518
|
+
return window.doSandboxCall
|
2519
|
+
? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
|
2520
|
+
: of({});
|
2521
|
+
}
|
2522
|
+
catch {
|
2523
|
+
return of({});
|
2524
|
+
}
|
2525
|
+
}
|
2526
|
+
createSalesforceOrganization$(payload) {
|
2527
|
+
try {
|
2528
|
+
return window.doSandboxCall
|
2529
|
+
? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2530
|
+
: of(undefined);
|
2531
|
+
}
|
2532
|
+
catch (err) {
|
2533
|
+
return of(undefined);
|
2534
|
+
}
|
2535
|
+
}
|
2536
|
+
updateSalesforceOrganization$(payload) {
|
2537
|
+
try {
|
2538
|
+
return window.doSandboxCall
|
2539
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2540
|
+
: of(undefined);
|
2541
|
+
}
|
2542
|
+
catch {
|
2543
|
+
return of(undefined);
|
2544
|
+
}
|
2545
|
+
}
|
2546
|
+
deleteSalesforceOrganization$(payload) {
|
2547
|
+
try {
|
2548
|
+
return window.doSandboxCall
|
2549
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2550
|
+
: of(undefined);
|
2551
|
+
}
|
2552
|
+
catch {
|
2553
|
+
return of(undefined);
|
2554
|
+
}
|
2555
|
+
}
|
2556
|
+
activateSalesforceOrganization$(payload) {
|
2557
|
+
try {
|
2558
|
+
return window.doSandboxCall
|
2559
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2560
|
+
: of(undefined);
|
2561
|
+
}
|
2562
|
+
catch {
|
2563
|
+
return of(undefined);
|
2564
|
+
}
|
2565
|
+
}
|
2566
|
+
deactivateSalesforceOrganization$(payload) {
|
2567
|
+
try {
|
2568
|
+
return window.doSandboxCall
|
2569
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2570
|
+
: of(undefined);
|
2571
|
+
}
|
2572
|
+
catch {
|
2573
|
+
return of(undefined);
|
2574
|
+
}
|
2575
|
+
}
|
2576
|
+
}
|
2577
|
+
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 });
|
2578
|
+
SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
|
2579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
|
2580
|
+
type: Injectable
|
2581
|
+
}], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
|
2582
|
+
|
2741
2583
|
class ScriptsApiService {
|
2742
2584
|
constructor(baseHttpService) {
|
2743
2585
|
this.baseHttpService = baseHttpService;
|
@@ -2890,6 +2732,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2890
2732
|
class UIDefinitionsApiService {
|
2891
2733
|
constructor(baseHttpService) {
|
2892
2734
|
this.baseHttpService = baseHttpService;
|
2735
|
+
this.serviceUrl = '/uidefinitions';
|
2893
2736
|
}
|
2894
2737
|
fetch$(modelId, version) {
|
2895
2738
|
const serviceUrl = this.getServiceUrl(modelId);
|
@@ -2909,6 +2752,11 @@ class UIDefinitionsApiService {
|
|
2909
2752
|
const serviceUrl = this.getServiceUrl(modelId);
|
2910
2753
|
const dto = {
|
2911
2754
|
...omit(uiDefinitionContainer, 'source'),
|
2755
|
+
name: uiDefinitionContainer.source.name,
|
2756
|
+
modelId: uiDefinitionContainer.source.modelId,
|
2757
|
+
templateName: uiDefinitionContainer.source.uiTemplateData?.TEMPLATE_NAME,
|
2758
|
+
rootType: uiDefinitionContainer.source.uiTemplateData?.ROOT_TYPE,
|
2759
|
+
defaultFlag: uiDefinitionContainer.source.primary,
|
2912
2760
|
sourceBlob: JSON.stringify(uiDefinitionContainer.source),
|
2913
2761
|
};
|
2914
2762
|
return this.baseHttpService
|
@@ -2949,6 +2797,46 @@ class UIDefinitionsApiService {
|
|
2949
2797
|
getServiceUrl(modelId) {
|
2950
2798
|
return `/models/${modelId}/uidefinitions`;
|
2951
2799
|
}
|
2800
|
+
fetchUIDefinitions$() {
|
2801
|
+
return this.baseHttpService.api({
|
2802
|
+
method: 'get',
|
2803
|
+
url: this.serviceUrl,
|
2804
|
+
});
|
2805
|
+
}
|
2806
|
+
fetchUIDefinition$(id) {
|
2807
|
+
return this.baseHttpService
|
2808
|
+
.api({
|
2809
|
+
method: 'get',
|
2810
|
+
url: `${this.serviceUrl}/${id}`,
|
2811
|
+
})
|
2812
|
+
.pipe(map$1(container => uiDefinitionFromDTO({ ...container, id })), map$1(uiDefinition => {
|
2813
|
+
const result = uiDefinition;
|
2814
|
+
if (!uiDefinition.modelId && uiDefinition.source.modelId) {
|
2815
|
+
result['modelId'] = uiDefinition.source.modelId;
|
2816
|
+
}
|
2817
|
+
return result;
|
2818
|
+
}));
|
2819
|
+
}
|
2820
|
+
createUIDefinition$(body) {
|
2821
|
+
return this.baseHttpService.api({
|
2822
|
+
method: 'post',
|
2823
|
+
url: this.serviceUrl,
|
2824
|
+
body,
|
2825
|
+
});
|
2826
|
+
}
|
2827
|
+
updateUIDefinition$(uiDefinition) {
|
2828
|
+
return this.baseHttpService.api({
|
2829
|
+
method: 'put',
|
2830
|
+
url: `${this.serviceUrl}/${uiDefinition.id}`,
|
2831
|
+
body: uiDefinition,
|
2832
|
+
});
|
2833
|
+
}
|
2834
|
+
deleteUIDefinition$(id) {
|
2835
|
+
return this.baseHttpService.api({
|
2836
|
+
method: 'delete',
|
2837
|
+
url: `${this.serviceUrl}/${id}`,
|
2838
|
+
});
|
2839
|
+
}
|
2952
2840
|
}
|
2953
2841
|
UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2954
2842
|
UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
|
@@ -3108,7 +2996,7 @@ class UITemplatesApiService {
|
|
3108
2996
|
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
|
3109
2997
|
params,
|
3110
2998
|
})
|
3111
|
-
.pipe(switchMap
|
2999
|
+
.pipe(switchMap(dtos => {
|
3112
3000
|
if (!dtos.length) {
|
3113
3001
|
return of([]);
|
3114
3002
|
}
|
@@ -3120,7 +3008,7 @@ class UITemplatesApiService {
|
|
3120
3008
|
.api({
|
3121
3009
|
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
|
3122
3010
|
})
|
3123
|
-
.pipe(switchMap
|
3011
|
+
.pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
|
3124
3012
|
};
|
3125
3013
|
this.createComponentStory$ = (templateId, story) => {
|
3126
3014
|
return this.baseHttpService.api({
|
@@ -3189,7 +3077,7 @@ class UITemplatesApiService {
|
|
3189
3077
|
]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
|
3190
3078
|
};
|
3191
3079
|
this.fetchComponentsAttachments$ = (templateId) => {
|
3192
|
-
return this.fetchComponents$(templateId).pipe(switchMap
|
3080
|
+
return this.fetchComponents$(templateId).pipe(switchMap(components => {
|
3193
3081
|
return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
|
3194
3082
|
}));
|
3195
3083
|
};
|
@@ -3334,179 +3222,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3334
3222
|
type: Injectable
|
3335
3223
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
3336
3224
|
|
3337
|
-
class SandboxManagerApiService {
|
3338
|
-
constructor(messageService) {
|
3339
|
-
this.messageService = messageService;
|
3340
|
-
/**
|
3341
|
-
* Shows an error message using the message service.
|
3342
|
-
*
|
3343
|
-
* @param {string} message - the error message to be published.
|
3344
|
-
*/
|
3345
|
-
this.publishErrorMessage = (message) => {
|
3346
|
-
this.messageService.add({ severity: 'error', summary: message, sticky: true });
|
3347
|
-
};
|
3348
|
-
}
|
3349
|
-
getSalesforceOrganizations$() {
|
3350
|
-
try {
|
3351
|
-
return window.doSandboxCall
|
3352
|
-
? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
|
3353
|
-
: of([]);
|
3354
|
-
}
|
3355
|
-
catch {
|
3356
|
-
return of([]);
|
3357
|
-
}
|
3358
|
-
}
|
3359
|
-
getAvailableSalesforceOrganizationSizes$() {
|
3360
|
-
try {
|
3361
|
-
return window.doSandboxCall
|
3362
|
-
? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
|
3363
|
-
: of({});
|
3364
|
-
}
|
3365
|
-
catch {
|
3366
|
-
return of({});
|
3367
|
-
}
|
3368
|
-
}
|
3369
|
-
createSalesforceOrganization$(payload) {
|
3370
|
-
try {
|
3371
|
-
return window.doSandboxCall
|
3372
|
-
? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3373
|
-
: of(undefined);
|
3374
|
-
}
|
3375
|
-
catch (err) {
|
3376
|
-
return of(undefined);
|
3377
|
-
}
|
3378
|
-
}
|
3379
|
-
updateSalesforceOrganization$(payload) {
|
3380
|
-
try {
|
3381
|
-
return window.doSandboxCall
|
3382
|
-
? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3383
|
-
: of(undefined);
|
3384
|
-
}
|
3385
|
-
catch {
|
3386
|
-
return of(undefined);
|
3387
|
-
}
|
3388
|
-
}
|
3389
|
-
deleteSalesforceOrganization$(payload) {
|
3390
|
-
try {
|
3391
|
-
return window.doSandboxCall
|
3392
|
-
? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3393
|
-
: of(undefined);
|
3394
|
-
}
|
3395
|
-
catch {
|
3396
|
-
return of(undefined);
|
3397
|
-
}
|
3398
|
-
}
|
3399
|
-
activateSalesforceOrganization$(payload) {
|
3400
|
-
try {
|
3401
|
-
return window.doSandboxCall
|
3402
|
-
? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3403
|
-
: of(undefined);
|
3404
|
-
}
|
3405
|
-
catch {
|
3406
|
-
return of(undefined);
|
3407
|
-
}
|
3408
|
-
}
|
3409
|
-
deactivateSalesforceOrganization$(payload) {
|
3410
|
-
try {
|
3411
|
-
return window.doSandboxCall
|
3412
|
-
? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3413
|
-
: of(undefined);
|
3414
|
-
}
|
3415
|
-
catch {
|
3416
|
-
return of(undefined);
|
3417
|
-
}
|
3418
|
-
}
|
3419
|
-
}
|
3420
|
-
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 });
|
3421
|
-
SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
|
3422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
|
3423
|
-
type: Injectable
|
3424
|
-
}], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
|
3425
|
-
|
3426
|
-
class RlmApiService {
|
3427
|
-
constructor(baseHttpService) {
|
3428
|
-
this.baseHttpService = baseHttpService;
|
3429
|
-
this.serviceUrl = '/rlm';
|
3430
|
-
}
|
3431
|
-
// TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
|
3432
|
-
fetchContextDefinitions$() {
|
3433
|
-
return this.baseHttpService
|
3434
|
-
.api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
|
3435
|
-
.pipe(catchError(() => {
|
3436
|
-
return of([]);
|
3437
|
-
}));
|
3438
|
-
}
|
3439
|
-
fetchContextMappings$(id) {
|
3440
|
-
return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
|
3441
|
-
}
|
3442
|
-
fetchContextDefinitionStructure$(id) {
|
3443
|
-
return this.baseHttpService
|
3444
|
-
.api({
|
3445
|
-
url: `${this.serviceUrl}/context/${id}/structure/details`,
|
3446
|
-
skipErrorHandler: true,
|
3447
|
-
})
|
3448
|
-
.pipe(catchError(() => {
|
3449
|
-
return of([]);
|
3450
|
-
}), map(objects => {
|
3451
|
-
return objects.map(object => {
|
3452
|
-
const tag = object.tags?.[0]?.title;
|
3453
|
-
const objectAttributes = object.attributes || [];
|
3454
|
-
return {
|
3455
|
-
id: object.id,
|
3456
|
-
title: tag || object.title,
|
3457
|
-
attributes: objectAttributes.map(attribute => {
|
3458
|
-
const tag = attribute.tags?.[0]?.title;
|
3459
|
-
return {
|
3460
|
-
title: tag || attribute.title,
|
3461
|
-
fieldType: attribute.fieldType,
|
3462
|
-
dataType: attribute.dataType,
|
3463
|
-
};
|
3464
|
-
}),
|
3465
|
-
};
|
3466
|
-
});
|
3467
|
-
}));
|
3468
|
-
}
|
3469
|
-
fetchRlmProcedures(contextDefinitionId) {
|
3470
|
-
const params = {};
|
3471
|
-
if (contextDefinitionId) {
|
3472
|
-
params['contextDefinitionId'] = contextDefinitionId;
|
3473
|
-
}
|
3474
|
-
return this.baseHttpService.api({
|
3475
|
-
url: `${this.serviceUrl}/procedures`,
|
3476
|
-
params,
|
3477
|
-
});
|
3478
|
-
}
|
3479
|
-
}
|
3480
|
-
RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
3481
|
-
RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
|
3482
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
|
3483
|
-
type: Injectable
|
3484
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
3485
|
-
|
3486
|
-
class RlmQuoteApiService {
|
3487
|
-
constructor(httpService) {
|
3488
|
-
this.httpService = httpService;
|
3489
|
-
this.SERVICE_URL = '/quotes/rlm';
|
3490
|
-
}
|
3491
|
-
getQuote(mappingType, objectId, contextMappingId, options) {
|
3492
|
-
const params = { mappingType };
|
3493
|
-
if (contextMappingId) {
|
3494
|
-
params['contextMappingId'] = contextMappingId;
|
3495
|
-
}
|
3496
|
-
return this.httpService.api({
|
3497
|
-
method: 'get',
|
3498
|
-
url: `${this.SERVICE_URL}/${objectId}`,
|
3499
|
-
params,
|
3500
|
-
...options,
|
3501
|
-
});
|
3502
|
-
}
|
3503
|
-
}
|
3504
|
-
RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
3505
|
-
RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
|
3506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
|
3507
|
-
type: Injectable
|
3508
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
3509
|
-
|
3510
3225
|
class ApiModule {
|
3511
3226
|
}
|
3512
3227
|
ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
@@ -3522,7 +3237,6 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
|
|
3522
3237
|
ProductModelApiService,
|
3523
3238
|
ProceduresApiService,
|
3524
3239
|
QuoteApiService,
|
3525
|
-
DocumentTemplatesApiService,
|
3526
3240
|
RampApiService,
|
3527
3241
|
SalesforceApiService,
|
3528
3242
|
UITemplatesApiService,
|
@@ -3572,7 +3286,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3572
3286
|
ProductModelApiService,
|
3573
3287
|
ProceduresApiService,
|
3574
3288
|
QuoteApiService,
|
3575
|
-
DocumentTemplatesApiService,
|
3576
3289
|
RampApiService,
|
3577
3290
|
SalesforceApiService,
|
3578
3291
|
UITemplatesApiService,
|
@@ -3614,5 +3327,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3614
3327
|
* Generated bundle index. Do not edit.
|
3615
3328
|
*/
|
3616
3329
|
|
3617
|
-
export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService,
|
3330
|
+
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 };
|
3618
3331
|
//# sourceMappingURL=veloceapps-api.mjs.map
|