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