@veloceapps/api 11.0.0-0 → 11.0.0-2
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/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/salesforce-api.service.mjs +1 -8
- package/esm2020/lib/types/attachment.types.mjs +2 -0
- package/esm2020/lib/types/org-info.types.mjs +1 -1
- package/fesm2015/veloceapps-api.mjs +312 -644
- package/fesm2015/veloceapps-api.mjs.map +1 -1
- package/fesm2020/veloceapps-api.mjs +308 -653
- package/fesm2020/veloceapps-api.mjs.map +1 -1
- package/index.d.ts +0 -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/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, of,
|
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, of, map as map$1, from, catchError as catchError$1, forkJoin, switchMap } 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) {
|
@@ -779,399 +776,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
779
776
|
type: Injectable
|
780
777
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
|
781
778
|
|
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
779
|
class EndpointsApiService {
|
1176
780
|
constructor(baseHttpService) {
|
1177
781
|
this.baseHttpService = baseHttpService;
|
@@ -1400,7 +1004,9 @@ class FlowsApiService {
|
|
1400
1004
|
}));
|
1401
1005
|
}
|
1402
1006
|
fetchFlows() {
|
1403
|
-
return this.configurationSettingsApiService
|
1007
|
+
return this.configurationSettingsApiService
|
1008
|
+
.fetchSetting(this.flowsKey)
|
1009
|
+
.pipe(map((setting) => (setting?.value ? JSON.parse(setting.value) : [])));
|
1404
1010
|
}
|
1405
1011
|
}
|
1406
1012
|
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 +1785,6 @@ class ProductModelApiService {
|
|
2179
1785
|
return linkedModels;
|
2180
1786
|
}));
|
2181
1787
|
}
|
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
1788
|
getPML(modelId, version) {
|
2196
1789
|
let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
|
2197
1790
|
if (version) {
|
@@ -2378,18 +1971,7 @@ class QuoteApiService {
|
|
2378
1971
|
this.SERVICE_URL = '/quotes';
|
2379
1972
|
}
|
2380
1973
|
/**
|
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
|
1974
|
+
* This endpoint doesn't include orders and assets
|
2393
1975
|
* @param objectId quoteId | accountId | opportunityId | orderId
|
2394
1976
|
* @param params Query params
|
2395
1977
|
* @param options Request options
|
@@ -2590,58 +2172,142 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2590
2172
|
type: Injectable
|
2591
2173
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2592
2174
|
|
2593
|
-
class
|
2175
|
+
class RlmApiService {
|
2594
2176
|
constructor(baseHttpService) {
|
2595
2177
|
this.baseHttpService = baseHttpService;
|
2596
|
-
this.serviceUrl = '/
|
2597
|
-
this.fetchRuleGroups$ = () => {
|
2598
|
-
return this.searchRuleGroups$(new Expression(), 0, 100);
|
2599
|
-
};
|
2600
|
-
this.searchRuleGroups$ = (expression, skip, count) => {
|
2601
|
-
let params = new HttpParams();
|
2602
|
-
params = params.set('skip', '' + skip);
|
2603
|
-
params = params.set('count', '' + count);
|
2604
|
-
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
2605
|
-
};
|
2606
|
-
this.createRuleGroup$ = (ruleGroup) => {
|
2607
|
-
return this.baseHttpService.api({
|
2608
|
-
url: `${this.serviceUrl}`,
|
2609
|
-
method: 'post',
|
2610
|
-
body: ruleGroup,
|
2611
|
-
});
|
2612
|
-
};
|
2613
|
-
this.updateRuleGroup$ = (ruleGroup) => {
|
2614
|
-
return this.baseHttpService.api({
|
2615
|
-
url: `${this.serviceUrl}/${ruleGroup.id}`,
|
2616
|
-
method: 'post',
|
2617
|
-
body: ruleGroup,
|
2618
|
-
});
|
2619
|
-
};
|
2620
|
-
this.duplicateRuleGroup$ = (body) => {
|
2621
|
-
return this.baseHttpService
|
2622
|
-
.api({
|
2623
|
-
url: `${this.serviceUrl}/${body.id}/clone`,
|
2624
|
-
method: 'post',
|
2625
|
-
body,
|
2626
|
-
})
|
2627
|
-
.pipe(map$1(response => response.clonedRecordId));
|
2628
|
-
};
|
2629
|
-
this.removeRuleGroup$ = (id) => {
|
2630
|
-
return this.baseHttpService.api({
|
2631
|
-
url: `${this.serviceUrl}/${id}`,
|
2632
|
-
method: 'delete',
|
2633
|
-
});
|
2634
|
-
};
|
2635
|
-
this.restoreRuleGroup$ = (id) => {
|
2636
|
-
return this.baseHttpService.api({
|
2637
|
-
url: `${this.serviceUrl}/${id}/restore`,
|
2638
|
-
method: 'patch',
|
2639
|
-
});
|
2640
|
-
};
|
2178
|
+
this.serviceUrl = '/rlm';
|
2641
2179
|
}
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2180
|
+
// TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
|
2181
|
+
fetchContextDefinitions$() {
|
2182
|
+
return this.baseHttpService
|
2183
|
+
.api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
|
2184
|
+
.pipe(catchError(() => {
|
2185
|
+
return of([]);
|
2186
|
+
}));
|
2187
|
+
}
|
2188
|
+
fetchContextMappings$(id) {
|
2189
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
|
2190
|
+
}
|
2191
|
+
fetchContextDefinitionStructure$(id) {
|
2192
|
+
return this.baseHttpService
|
2193
|
+
.api({
|
2194
|
+
url: `${this.serviceUrl}/context/${id}/structure/details`,
|
2195
|
+
skipErrorHandler: true,
|
2196
|
+
})
|
2197
|
+
.pipe(catchError(() => {
|
2198
|
+
return of([]);
|
2199
|
+
}), map(objects => {
|
2200
|
+
return objects.map(object => {
|
2201
|
+
const tag = object.tags?.[0]?.title;
|
2202
|
+
const objectAttributes = object.attributes || [];
|
2203
|
+
return {
|
2204
|
+
id: object.id,
|
2205
|
+
title: tag || object.title,
|
2206
|
+
attributes: objectAttributes.map(attribute => {
|
2207
|
+
const tag = attribute.tags?.[0]?.title;
|
2208
|
+
return {
|
2209
|
+
title: tag || attribute.title,
|
2210
|
+
fieldType: attribute.fieldType,
|
2211
|
+
dataType: attribute.dataType,
|
2212
|
+
};
|
2213
|
+
}),
|
2214
|
+
};
|
2215
|
+
});
|
2216
|
+
}));
|
2217
|
+
}
|
2218
|
+
fetchRlmProcedures(contextDefinitionId) {
|
2219
|
+
const params = {};
|
2220
|
+
if (contextDefinitionId) {
|
2221
|
+
params['contextDefinitionId'] = contextDefinitionId;
|
2222
|
+
}
|
2223
|
+
return this.baseHttpService.api({
|
2224
|
+
url: `${this.serviceUrl}/procedures`,
|
2225
|
+
params,
|
2226
|
+
});
|
2227
|
+
}
|
2228
|
+
}
|
2229
|
+
RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2230
|
+
RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
|
2231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
|
2232
|
+
type: Injectable
|
2233
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2234
|
+
|
2235
|
+
class RlmQuoteApiService {
|
2236
|
+
constructor(httpService) {
|
2237
|
+
this.httpService = httpService;
|
2238
|
+
this.SERVICE_URL = '/quotes/rlm';
|
2239
|
+
}
|
2240
|
+
getQuote(mappingType, objectId, contextMappingId, options) {
|
2241
|
+
const params = { mappingType };
|
2242
|
+
if (contextMappingId) {
|
2243
|
+
params['contextMappingId'] = contextMappingId;
|
2244
|
+
}
|
2245
|
+
return this.httpService.api({
|
2246
|
+
method: 'get',
|
2247
|
+
url: `${this.SERVICE_URL}/${objectId}`,
|
2248
|
+
params,
|
2249
|
+
...options,
|
2250
|
+
});
|
2251
|
+
}
|
2252
|
+
}
|
2253
|
+
RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2254
|
+
RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
|
2255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
|
2256
|
+
type: Injectable
|
2257
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2258
|
+
|
2259
|
+
class RuleGroupsApiService {
|
2260
|
+
constructor(baseHttpService) {
|
2261
|
+
this.baseHttpService = baseHttpService;
|
2262
|
+
this.serviceUrl = '/admin/rule-groups';
|
2263
|
+
this.fetchRuleGroups$ = () => {
|
2264
|
+
return this.searchRuleGroups$(new Expression(), 0, 100);
|
2265
|
+
};
|
2266
|
+
this.searchRuleGroups$ = (expression, skip, count) => {
|
2267
|
+
let params = new HttpParams();
|
2268
|
+
params = params.set('skip', '' + skip);
|
2269
|
+
params = params.set('count', '' + count);
|
2270
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
2271
|
+
};
|
2272
|
+
this.createRuleGroup$ = (ruleGroup) => {
|
2273
|
+
return this.baseHttpService.api({
|
2274
|
+
url: `${this.serviceUrl}`,
|
2275
|
+
method: 'post',
|
2276
|
+
body: ruleGroup,
|
2277
|
+
});
|
2278
|
+
};
|
2279
|
+
this.updateRuleGroup$ = (ruleGroup) => {
|
2280
|
+
return this.baseHttpService.api({
|
2281
|
+
url: `${this.serviceUrl}/${ruleGroup.id}`,
|
2282
|
+
method: 'post',
|
2283
|
+
body: ruleGroup,
|
2284
|
+
});
|
2285
|
+
};
|
2286
|
+
this.duplicateRuleGroup$ = (body) => {
|
2287
|
+
return this.baseHttpService
|
2288
|
+
.api({
|
2289
|
+
url: `${this.serviceUrl}/${body.id}/clone`,
|
2290
|
+
method: 'post',
|
2291
|
+
body,
|
2292
|
+
})
|
2293
|
+
.pipe(map$1(response => response.clonedRecordId));
|
2294
|
+
};
|
2295
|
+
this.removeRuleGroup$ = (id) => {
|
2296
|
+
return this.baseHttpService.api({
|
2297
|
+
url: `${this.serviceUrl}/${id}`,
|
2298
|
+
method: 'delete',
|
2299
|
+
});
|
2300
|
+
};
|
2301
|
+
this.restoreRuleGroup$ = (id) => {
|
2302
|
+
return this.baseHttpService.api({
|
2303
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
2304
|
+
method: 'patch',
|
2305
|
+
});
|
2306
|
+
};
|
2307
|
+
}
|
2308
|
+
}
|
2309
|
+
RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2310
|
+
RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService });
|
2645
2311
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, decorators: [{
|
2646
2312
|
type: Injectable
|
2647
2313
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
@@ -2738,6 +2404,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2738
2404
|
type: Injectable
|
2739
2405
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2740
2406
|
|
2407
|
+
class SalesforceApiService {
|
2408
|
+
constructor(httpService) {
|
2409
|
+
this.httpService = httpService;
|
2410
|
+
this.SERVICE_URL = '/proxy';
|
2411
|
+
}
|
2412
|
+
query(searchRequest, objectName, options) {
|
2413
|
+
return this.httpService.api({
|
2414
|
+
method: 'post',
|
2415
|
+
body: { ...searchRequest, count: searchRequest.count || 100 },
|
2416
|
+
url: `${this.SERVICE_URL}/query/${objectName}`,
|
2417
|
+
...options,
|
2418
|
+
});
|
2419
|
+
}
|
2420
|
+
queryObjects(search, options) {
|
2421
|
+
let params = new HttpParams();
|
2422
|
+
if (search) {
|
2423
|
+
params = params.append('search', search);
|
2424
|
+
}
|
2425
|
+
return this.httpService.api({
|
2426
|
+
url: `${this.SERVICE_URL}/query`,
|
2427
|
+
params,
|
2428
|
+
...options,
|
2429
|
+
});
|
2430
|
+
}
|
2431
|
+
search(req, options) {
|
2432
|
+
return this.httpService.api({
|
2433
|
+
url: `${this.SERVICE_URL}/rest/search`,
|
2434
|
+
params: { q: req.searchString },
|
2435
|
+
...options,
|
2436
|
+
});
|
2437
|
+
}
|
2438
|
+
describeObject(objectName, options) {
|
2439
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
2440
|
+
return this.httpService.api({ url: methodUrl, ...options });
|
2441
|
+
}
|
2442
|
+
describeField(objectName, fieldName, options) {
|
2443
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
|
2444
|
+
return this.httpService.api({ url: methodUrl, ...options });
|
2445
|
+
}
|
2446
|
+
describe2(objectName, fields, options) {
|
2447
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
2448
|
+
return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
|
2449
|
+
}
|
2450
|
+
apexGetRequest(path, params, options) {
|
2451
|
+
// this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
|
2452
|
+
const httpParams = new HttpParams({ fromString: params.toString() });
|
2453
|
+
return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
|
2454
|
+
}
|
2455
|
+
apexPostRequest(path, body, options) {
|
2456
|
+
return this.httpService.api({
|
2457
|
+
method: 'post',
|
2458
|
+
body,
|
2459
|
+
url: `${this.SERVICE_URL}/apex${path}`,
|
2460
|
+
...options,
|
2461
|
+
});
|
2462
|
+
}
|
2463
|
+
getGlobalPicklists() {
|
2464
|
+
return this.httpService.api({
|
2465
|
+
method: 'get',
|
2466
|
+
url: `${this.SERVICE_URL}/globalvalueset`,
|
2467
|
+
});
|
2468
|
+
}
|
2469
|
+
getGlobalPicklistValues(id) {
|
2470
|
+
return this.httpService.api({
|
2471
|
+
method: 'get',
|
2472
|
+
url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
|
2473
|
+
});
|
2474
|
+
}
|
2475
|
+
}
|
2476
|
+
SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2477
|
+
SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
|
2478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
|
2479
|
+
type: Injectable
|
2480
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2481
|
+
|
2482
|
+
class SandboxManagerApiService {
|
2483
|
+
constructor(messageService) {
|
2484
|
+
this.messageService = messageService;
|
2485
|
+
/**
|
2486
|
+
* Shows an error message using the message service.
|
2487
|
+
*
|
2488
|
+
* @param {string} message - the error message to be published.
|
2489
|
+
*/
|
2490
|
+
this.publishErrorMessage = (message) => {
|
2491
|
+
this.messageService.add({ severity: 'error', summary: message, sticky: true });
|
2492
|
+
};
|
2493
|
+
}
|
2494
|
+
getSalesforceOrganizations$() {
|
2495
|
+
try {
|
2496
|
+
return window.doSandboxCall
|
2497
|
+
? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
|
2498
|
+
: of([]);
|
2499
|
+
}
|
2500
|
+
catch {
|
2501
|
+
return of([]);
|
2502
|
+
}
|
2503
|
+
}
|
2504
|
+
getAvailableSalesforceOrganizationSizes$() {
|
2505
|
+
try {
|
2506
|
+
return window.doSandboxCall
|
2507
|
+
? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
|
2508
|
+
: of({});
|
2509
|
+
}
|
2510
|
+
catch {
|
2511
|
+
return of({});
|
2512
|
+
}
|
2513
|
+
}
|
2514
|
+
createSalesforceOrganization$(payload) {
|
2515
|
+
try {
|
2516
|
+
return window.doSandboxCall
|
2517
|
+
? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2518
|
+
: of(undefined);
|
2519
|
+
}
|
2520
|
+
catch (err) {
|
2521
|
+
return of(undefined);
|
2522
|
+
}
|
2523
|
+
}
|
2524
|
+
updateSalesforceOrganization$(payload) {
|
2525
|
+
try {
|
2526
|
+
return window.doSandboxCall
|
2527
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2528
|
+
: of(undefined);
|
2529
|
+
}
|
2530
|
+
catch {
|
2531
|
+
return of(undefined);
|
2532
|
+
}
|
2533
|
+
}
|
2534
|
+
deleteSalesforceOrganization$(payload) {
|
2535
|
+
try {
|
2536
|
+
return window.doSandboxCall
|
2537
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2538
|
+
: of(undefined);
|
2539
|
+
}
|
2540
|
+
catch {
|
2541
|
+
return of(undefined);
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
activateSalesforceOrganization$(payload) {
|
2545
|
+
try {
|
2546
|
+
return window.doSandboxCall
|
2547
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2548
|
+
: of(undefined);
|
2549
|
+
}
|
2550
|
+
catch {
|
2551
|
+
return of(undefined);
|
2552
|
+
}
|
2553
|
+
}
|
2554
|
+
deactivateSalesforceOrganization$(payload) {
|
2555
|
+
try {
|
2556
|
+
return window.doSandboxCall
|
2557
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
2558
|
+
: of(undefined);
|
2559
|
+
}
|
2560
|
+
catch {
|
2561
|
+
return of(undefined);
|
2562
|
+
}
|
2563
|
+
}
|
2564
|
+
}
|
2565
|
+
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 });
|
2566
|
+
SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
|
2567
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
|
2568
|
+
type: Injectable
|
2569
|
+
}], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
|
2570
|
+
|
2741
2571
|
class ScriptsApiService {
|
2742
2572
|
constructor(baseHttpService) {
|
2743
2573
|
this.baseHttpService = baseHttpService;
|
@@ -3108,7 +2938,7 @@ class UITemplatesApiService {
|
|
3108
2938
|
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
|
3109
2939
|
params,
|
3110
2940
|
})
|
3111
|
-
.pipe(switchMap
|
2941
|
+
.pipe(switchMap(dtos => {
|
3112
2942
|
if (!dtos.length) {
|
3113
2943
|
return of([]);
|
3114
2944
|
}
|
@@ -3120,7 +2950,7 @@ class UITemplatesApiService {
|
|
3120
2950
|
.api({
|
3121
2951
|
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
|
3122
2952
|
})
|
3123
|
-
.pipe(switchMap
|
2953
|
+
.pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
|
3124
2954
|
};
|
3125
2955
|
this.createComponentStory$ = (templateId, story) => {
|
3126
2956
|
return this.baseHttpService.api({
|
@@ -3189,7 +3019,7 @@ class UITemplatesApiService {
|
|
3189
3019
|
]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
|
3190
3020
|
};
|
3191
3021
|
this.fetchComponentsAttachments$ = (templateId) => {
|
3192
|
-
return this.fetchComponents$(templateId).pipe(switchMap
|
3022
|
+
return this.fetchComponents$(templateId).pipe(switchMap(components => {
|
3193
3023
|
return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
|
3194
3024
|
}));
|
3195
3025
|
};
|
@@ -3334,179 +3164,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3334
3164
|
type: Injectable
|
3335
3165
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
3336
3166
|
|
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
3167
|
class ApiModule {
|
3511
3168
|
}
|
3512
3169
|
ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
@@ -3522,7 +3179,6 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
|
|
3522
3179
|
ProductModelApiService,
|
3523
3180
|
ProceduresApiService,
|
3524
3181
|
QuoteApiService,
|
3525
|
-
DocumentTemplatesApiService,
|
3526
3182
|
RampApiService,
|
3527
3183
|
SalesforceApiService,
|
3528
3184
|
UITemplatesApiService,
|
@@ -3572,7 +3228,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3572
3228
|
ProductModelApiService,
|
3573
3229
|
ProceduresApiService,
|
3574
3230
|
QuoteApiService,
|
3575
|
-
DocumentTemplatesApiService,
|
3576
3231
|
RampApiService,
|
3577
3232
|
SalesforceApiService,
|
3578
3233
|
UITemplatesApiService,
|
@@ -3614,5 +3269,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3614
3269
|
* Generated bundle index. Do not edit.
|
3615
3270
|
*/
|
3616
3271
|
|
3617
|
-
export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService,
|
3272
|
+
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
3273
|
//# sourceMappingURL=veloceapps-api.mjs.map
|