@veloceapps/api 10.0.0-9 → 11.0.0-1

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.
@@ -3,14 +3,11 @@ import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@a
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
5
  import * as i1 from '@veloceapps/core';
6
- import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { noop, throwError, of, zip, forkJoin, map as map$1, from, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
- import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
6
+ import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, 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) {
@@ -104,7 +101,7 @@ class VeloceAuthService {
104
101
  'Content-Type': 'application/json',
105
102
  Authorization: `Bearer ${accessToken}`,
106
103
  });
107
- return this.http.get(`${instanceUrl}/services/apexrest/VELOCPQ/veloce-auth`, { headers });
104
+ return this.http.get(`${instanceUrl}/services/apexrest/VELOCE_PRISM/veloce-auth`, { headers });
108
105
  }
109
106
  }
110
107
  VeloceAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -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.fetchSetting(this.flowsKey).pipe(map((setting) => (setting?.value ? JSON.parse(setting.value) : [])), map(anyFlows => anyFlows.map(toLatestFlow).filter(isDefined)));
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 });
@@ -1898,6 +1504,13 @@ class ProceduresApiService {
1898
1504
  body,
1899
1505
  });
1900
1506
  }
1507
+ rlmExecute$(body) {
1508
+ return this.baseHttpService.api({
1509
+ url: `${this.SERVICE_URL}/rlm/execute`,
1510
+ method: 'post',
1511
+ body,
1512
+ });
1513
+ }
1901
1514
  /**
1902
1515
  * Run active procedure against QuoteDraft
1903
1516
  * @param body
@@ -2583,6 +2196,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2583
2196
  type: Injectable
2584
2197
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2585
2198
 
2199
+ class RlmApiService {
2200
+ constructor(baseHttpService) {
2201
+ this.baseHttpService = baseHttpService;
2202
+ this.serviceUrl = '/rlm';
2203
+ }
2204
+ // TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
2205
+ fetchContextDefinitions$() {
2206
+ return this.baseHttpService
2207
+ .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
2208
+ .pipe(catchError(() => {
2209
+ return of([]);
2210
+ }));
2211
+ }
2212
+ fetchContextMappings$(id) {
2213
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
2214
+ }
2215
+ fetchContextDefinitionStructure$(id) {
2216
+ return this.baseHttpService
2217
+ .api({
2218
+ url: `${this.serviceUrl}/context/${id}/structure/details`,
2219
+ skipErrorHandler: true,
2220
+ })
2221
+ .pipe(catchError(() => {
2222
+ return of([]);
2223
+ }), map(objects => {
2224
+ return objects.map(object => {
2225
+ const tag = object.tags?.[0]?.title;
2226
+ const objectAttributes = object.attributes || [];
2227
+ return {
2228
+ id: object.id,
2229
+ title: tag || object.title,
2230
+ attributes: objectAttributes.map(attribute => {
2231
+ const tag = attribute.tags?.[0]?.title;
2232
+ return {
2233
+ title: tag || attribute.title,
2234
+ fieldType: attribute.fieldType,
2235
+ dataType: attribute.dataType,
2236
+ };
2237
+ }),
2238
+ };
2239
+ });
2240
+ }));
2241
+ }
2242
+ fetchRlmProcedures(contextDefinitionId) {
2243
+ const params = {};
2244
+ if (contextDefinitionId) {
2245
+ params['contextDefinitionId'] = contextDefinitionId;
2246
+ }
2247
+ return this.baseHttpService.api({
2248
+ url: `${this.serviceUrl}/procedures`,
2249
+ params,
2250
+ });
2251
+ }
2252
+ }
2253
+ RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2254
+ RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
2255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
2256
+ type: Injectable
2257
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2258
+
2259
+ class RlmQuoteApiService {
2260
+ constructor(httpService) {
2261
+ this.httpService = httpService;
2262
+ this.SERVICE_URL = '/quotes/rlm';
2263
+ }
2264
+ getQuote(mappingType, objectId, contextMappingId, options) {
2265
+ const params = { mappingType };
2266
+ if (contextMappingId) {
2267
+ params['contextMappingId'] = contextMappingId;
2268
+ }
2269
+ return this.httpService.api({
2270
+ method: 'get',
2271
+ url: `${this.SERVICE_URL}/${objectId}`,
2272
+ params,
2273
+ ...options,
2274
+ });
2275
+ }
2276
+ }
2277
+ RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2278
+ RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
2279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
2280
+ type: Injectable
2281
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2282
+
2586
2283
  class RuleGroupsApiService {
2587
2284
  constructor(baseHttpService) {
2588
2285
  this.baseHttpService = baseHttpService;
@@ -2719,6 +2416,9 @@ class RulesApiService {
2719
2416
  if (ruleGroupType === RuleGroupTypes.catalog) {
2720
2417
  return '/rules/catalog/execute';
2721
2418
  }
2419
+ if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
2420
+ return '/rules/rlm/execute';
2421
+ }
2722
2422
  return '/rules/execute';
2723
2423
  }
2724
2424
  }
@@ -2728,11 +2428,182 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2728
2428
  type: Injectable
2729
2429
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2730
2430
 
2731
- class ScriptsApiService {
2732
- constructor(baseHttpService) {
2733
- this.baseHttpService = baseHttpService;
2734
- this.serviceUrl = '/admin/scripts';
2735
- this.fetchScripts$ = () => {
2431
+ class SalesforceApiService {
2432
+ constructor(httpService) {
2433
+ this.httpService = httpService;
2434
+ this.SERVICE_URL = '/proxy';
2435
+ }
2436
+ query(searchRequest, objectName, options) {
2437
+ return this.httpService.api({
2438
+ method: 'post',
2439
+ body: { ...searchRequest, count: searchRequest.count || 100 },
2440
+ url: `${this.SERVICE_URL}/query/${objectName}`,
2441
+ ...options,
2442
+ });
2443
+ }
2444
+ queryObjects(search, options) {
2445
+ let params = new HttpParams();
2446
+ if (search) {
2447
+ params = params.append('search', search);
2448
+ }
2449
+ return this.httpService.api({
2450
+ url: `${this.SERVICE_URL}/query`,
2451
+ params,
2452
+ ...options,
2453
+ });
2454
+ }
2455
+ search(req, options) {
2456
+ return this.httpService.api({
2457
+ url: `${this.SERVICE_URL}/rest/search`,
2458
+ params: { q: req.searchString },
2459
+ ...options,
2460
+ });
2461
+ }
2462
+ /**
2463
+ * @deprecated
2464
+ */
2465
+ describe(objectName, fieldName, options) {
2466
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
2467
+ return this.httpService.api({ url: methodUrl, ...options });
2468
+ }
2469
+ describeObject(objectName, options) {
2470
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2471
+ return this.httpService.api({ url: methodUrl, ...options });
2472
+ }
2473
+ describeField(objectName, fieldName, options) {
2474
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
2475
+ return this.httpService.api({ url: methodUrl, ...options });
2476
+ }
2477
+ describe2(objectName, fields, options) {
2478
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2479
+ return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
2480
+ }
2481
+ apexGetRequest(path, params, options) {
2482
+ // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
2483
+ const httpParams = new HttpParams({ fromString: params.toString() });
2484
+ return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
2485
+ }
2486
+ apexPostRequest(path, body, options) {
2487
+ return this.httpService.api({
2488
+ method: 'post',
2489
+ body,
2490
+ url: `${this.SERVICE_URL}/apex${path}`,
2491
+ ...options,
2492
+ });
2493
+ }
2494
+ getGlobalPicklists() {
2495
+ return this.httpService.api({
2496
+ method: 'get',
2497
+ url: `${this.SERVICE_URL}/globalvalueset`,
2498
+ });
2499
+ }
2500
+ getGlobalPicklistValues(id) {
2501
+ return this.httpService.api({
2502
+ method: 'get',
2503
+ url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
2504
+ });
2505
+ }
2506
+ }
2507
+ SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2508
+ SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
2509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
2510
+ type: Injectable
2511
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2512
+
2513
+ class SandboxManagerApiService {
2514
+ constructor(messageService) {
2515
+ this.messageService = messageService;
2516
+ /**
2517
+ * Shows an error message using the message service.
2518
+ *
2519
+ * @param {string} message - the error message to be published.
2520
+ */
2521
+ this.publishErrorMessage = (message) => {
2522
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
2523
+ };
2524
+ }
2525
+ getSalesforceOrganizations$() {
2526
+ try {
2527
+ return window.doSandboxCall
2528
+ ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
2529
+ : of([]);
2530
+ }
2531
+ catch {
2532
+ return of([]);
2533
+ }
2534
+ }
2535
+ getAvailableSalesforceOrganizationSizes$() {
2536
+ try {
2537
+ return window.doSandboxCall
2538
+ ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
2539
+ : of({});
2540
+ }
2541
+ catch {
2542
+ return of({});
2543
+ }
2544
+ }
2545
+ createSalesforceOrganization$(payload) {
2546
+ try {
2547
+ return window.doSandboxCall
2548
+ ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2549
+ : of(undefined);
2550
+ }
2551
+ catch (err) {
2552
+ return of(undefined);
2553
+ }
2554
+ }
2555
+ updateSalesforceOrganization$(payload) {
2556
+ try {
2557
+ return window.doSandboxCall
2558
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2559
+ : of(undefined);
2560
+ }
2561
+ catch {
2562
+ return of(undefined);
2563
+ }
2564
+ }
2565
+ deleteSalesforceOrganization$(payload) {
2566
+ try {
2567
+ return window.doSandboxCall
2568
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2569
+ : of(undefined);
2570
+ }
2571
+ catch {
2572
+ return of(undefined);
2573
+ }
2574
+ }
2575
+ activateSalesforceOrganization$(payload) {
2576
+ try {
2577
+ return window.doSandboxCall
2578
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2579
+ : of(undefined);
2580
+ }
2581
+ catch {
2582
+ return of(undefined);
2583
+ }
2584
+ }
2585
+ deactivateSalesforceOrganization$(payload) {
2586
+ try {
2587
+ return window.doSandboxCall
2588
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2589
+ : of(undefined);
2590
+ }
2591
+ catch {
2592
+ return of(undefined);
2593
+ }
2594
+ }
2595
+ }
2596
+ 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 });
2597
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
2598
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
2599
+ type: Injectable
2600
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
2601
+
2602
+ class ScriptsApiService {
2603
+ constructor(baseHttpService) {
2604
+ this.baseHttpService = baseHttpService;
2605
+ this.serviceUrl = '/admin/scripts';
2606
+ this.fetchScripts$ = () => {
2736
2607
  return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2737
2608
  };
2738
2609
  this.searchScripts$ = (expression, skip, count) => {
@@ -3098,7 +2969,7 @@ class UITemplatesApiService {
3098
2969
  url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
3099
2970
  params,
3100
2971
  })
3101
- .pipe(switchMap$1(dtos => {
2972
+ .pipe(switchMap(dtos => {
3102
2973
  if (!dtos.length) {
3103
2974
  return of([]);
3104
2975
  }
@@ -3110,7 +2981,7 @@ class UITemplatesApiService {
3110
2981
  .api({
3111
2982
  url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
3112
2983
  })
3113
- .pipe(switchMap$1(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2984
+ .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
3114
2985
  };
3115
2986
  this.createComponentStory$ = (templateId, story) => {
3116
2987
  return this.baseHttpService.api({
@@ -3179,7 +3050,7 @@ class UITemplatesApiService {
3179
3050
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
3180
3051
  };
3181
3052
  this.fetchComponentsAttachments$ = (templateId) => {
3182
- return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
3053
+ return this.fetchComponents$(templateId).pipe(switchMap(components => {
3183
3054
  return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
3184
3055
  }));
3185
3056
  };
@@ -3324,120 +3195,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3324
3195
  type: Injectable
3325
3196
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3326
3197
 
3327
- class SandboxManagerApiService {
3328
- constructor(messageService) {
3329
- this.messageService = messageService;
3330
- /**
3331
- * Shows an error message using the message service.
3332
- *
3333
- * @param {string} message - the error message to be published.
3334
- */
3335
- this.publishErrorMessage = (message) => {
3336
- this.messageService.add({ severity: 'error', summary: message, sticky: true });
3337
- };
3338
- }
3339
- getSalesforceOrganizations$() {
3340
- try {
3341
- return window.doSandboxCall
3342
- ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
3343
- : of([]);
3344
- }
3345
- catch {
3346
- return of([]);
3347
- }
3348
- }
3349
- getAvailableSalesforceOrganizationSizes$() {
3350
- try {
3351
- return window.doSandboxCall
3352
- ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
3353
- : of({});
3354
- }
3355
- catch {
3356
- return of({});
3357
- }
3358
- }
3359
- createSalesforceOrganization$(payload) {
3360
- try {
3361
- return window.doSandboxCall
3362
- ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3363
- : of(undefined);
3364
- }
3365
- catch (err) {
3366
- return of(undefined);
3367
- }
3368
- }
3369
- updateSalesforceOrganization$(payload) {
3370
- try {
3371
- return window.doSandboxCall
3372
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3373
- : of(undefined);
3374
- }
3375
- catch {
3376
- return of(undefined);
3377
- }
3378
- }
3379
- deleteSalesforceOrganization$(payload) {
3380
- try {
3381
- return window.doSandboxCall
3382
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).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
- activateSalesforceOrganization$(payload) {
3390
- try {
3391
- return window.doSandboxCall
3392
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).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
- deactivateSalesforceOrganization$(payload) {
3400
- try {
3401
- return window.doSandboxCall
3402
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, 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
- }
3410
- 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 });
3411
- SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
3413
- type: Injectable
3414
- }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
3415
-
3416
- class RlmApiService {
3417
- constructor(baseHttpService) {
3418
- this.baseHttpService = baseHttpService;
3419
- this.serviceUrl = '/rlm';
3420
- }
3421
- fetchContextDefinitions$() {
3422
- return of([
3423
- { label: 'First', value: 'First' },
3424
- { label: 'Second', value: 'Second' },
3425
- ]);
3426
- // return this.baseHttpService.api<any[]>({ url: `${this.serviceUrl}/definitions` });
3427
- }
3428
- fetchContextMappings() {
3429
- return of([
3430
- { label: 'First', value: 'First' },
3431
- { label: 'Second', value: 'Second' },
3432
- ]);
3433
- }
3434
- }
3435
- RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3436
- RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
3437
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
3438
- type: Injectable
3439
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3440
-
3441
3198
  class ApiModule {
3442
3199
  }
3443
3200
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -3453,7 +3210,6 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3453
3210
  ProductModelApiService,
3454
3211
  ProceduresApiService,
3455
3212
  QuoteApiService,
3456
- DocumentTemplatesApiService,
3457
3213
  RampApiService,
3458
3214
  SalesforceApiService,
3459
3215
  UITemplatesApiService,
@@ -3486,6 +3242,7 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3486
3242
  FlowStateApiService,
3487
3243
  SandboxManagerApiService,
3488
3244
  RlmApiService,
3245
+ RlmQuoteApiService,
3489
3246
  ], imports: [HttpClientModule] });
3490
3247
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
3491
3248
  type: NgModule,
@@ -3502,7 +3259,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3502
3259
  ProductModelApiService,
3503
3260
  ProceduresApiService,
3504
3261
  QuoteApiService,
3505
- DocumentTemplatesApiService,
3506
3262
  RampApiService,
3507
3263
  SalesforceApiService,
3508
3264
  UITemplatesApiService,
@@ -3535,6 +3291,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3535
3291
  FlowStateApiService,
3536
3292
  SandboxManagerApiService,
3537
3293
  RlmApiService,
3294
+ RlmQuoteApiService,
3538
3295
  ],
3539
3296
  }]
3540
3297
  }] });
@@ -3543,5 +3300,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3543
3300
  * Generated bundle index. Do not edit.
3544
3301
  */
3545
3302
 
3546
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowStateApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PortalsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RlmApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, SandboxManagerApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService };
3303
+ 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 };
3547
3304
  //# sourceMappingURL=veloceapps-api.mjs.map