@veloceapps/api 2.0.15 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/veloce-api.umd.js +227 -228
- package/bundles/veloce-api.umd.js.map +1 -1
- package/esm2015/lib/services/document-attachment-api.service.js +7 -6
- package/esm2015/lib/services/document-templates-api.service.js +143 -154
- package/esm2015/lib/services/quote-api.service.js +12 -1
- package/esm2015/lib/services/rules-api.service.js +2 -2
- package/fesm2015/veloce-api.js +190 -190
- package/fesm2015/veloce-api.js.map +1 -1
- package/lib/services/document-attachment-api.service.d.ts +1 -0
- package/lib/services/document-templates-api.service.d.ts +22 -16
- package/lib/services/quote-api.service.d.ts +1 -0
- package/package.json +1 -1
@@ -27,10 +27,21 @@ export class QuoteApiService {
|
|
27
27
|
body: request,
|
28
28
|
});
|
29
29
|
}
|
30
|
+
attachDocument(id, documentName, data) {
|
31
|
+
const formData = new FormData();
|
32
|
+
const blob = new Blob([data]);
|
33
|
+
formData.append('file', blob, documentName);
|
34
|
+
return this.httpService.upload({
|
35
|
+
url: `${this.SERVICE_URL}/${id}/attach-document`,
|
36
|
+
responseType: 'arraybuffer',
|
37
|
+
method: 'post',
|
38
|
+
body: formData,
|
39
|
+
});
|
40
|
+
}
|
30
41
|
}
|
31
42
|
QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
32
43
|
QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService });
|
33
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, decorators: [{
|
34
45
|
type: Injectable
|
35
46
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
36
|
-
//# sourceM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GEoKTtcbiAgICBjb25zdCBibG9iID0gbmV3IEJsb2IoW2RhdGFdKTtcbiAgICBmb3JtRGF0YS5hcHBlbmQoJ2ZpbGUnLCBibG9iLCBkb2N1bWVudE5hbWUpO1xuXG4gICAgcmV0dXJuIHRoaXMuaHR0cFNlcnZpY2UudXBsb2FkKHtcbiAgICAgIHVybDogYCR7dGhpcy5TRVJWSUNFX1VSTH0vJHtpZH0vYXR0YWNoLWRvY3VtZW50YCxcbiAgICAgIHJlc3BvbnNlVHlwZTogJ2FycmF5YnVmZmVyJyxcbiAgICAgIG1ldGhvZDogJ3Bvc3QnLFxuICAgICAgYm9keTogZm9ybURhdGEsXG4gICAgfSk7XG4gIH1cbn1cbiJdfQ==
|
@@ -1,6 +1,6 @@
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
1
2
|
import { Injectable } from '@angular/core';
|
2
3
|
import { Expression } from '@veloce/core';
|
3
|
-
import { HttpParams } from '@angular/common/http';
|
4
4
|
import { map } from 'rxjs/operators';
|
5
5
|
import * as i0 from "@angular/core";
|
6
6
|
import * as i1 from "@veloce/core";
|
@@ -65,4 +65,4 @@ RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", vers
|
|
65
65
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RulesApiService, decorators: [{
|
66
66
|
type: Injectable
|
67
67
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
68
|
-
//# sourceMappingURL=data:application/json;base64,
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVsZXMtYXBpLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2FwaS9zcmMvbGliL3NlcnZpY2VzL3J1bGVzLWFwaS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3M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ldHVybiB0aGlzLmJhc2VIdHRwU2VydmljZS5hcGk8c3RyaW5nPih7XG4gICAgICB1cmw6IGAke3RoaXMuc2VydmljZVVybH0vJHtpZH0vcmVzdG9yZWAsXG4gICAgICBtZXRob2Q6ICdwYXRjaCcsXG4gICAgfSk7XG4gIH07XG5cbiAgZmV0Y2hSdWxlJChpZDogc3RyaW5nKSB7XG4gICAgcmV0dXJuIHRoaXMuYmFzZUh0dHBTZXJ2aWNlLmFwaTxSdWxlPih7XG4gICAgICB1cmw6IGAke3RoaXMuc2VydmljZVVybH0vJHtpZH1gLFxuICAgICAgbWV0aG9kOiAnZ2V0JyxcbiAgICB9KTtcbiAgfVxufVxuIl19
|
package/fesm2015/veloce-api.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import * as
|
1
|
+
import * as i5 from '@angular/common/http';
|
2
2
|
import { HttpParams, HttpClientModule } from '@angular/common/http';
|
3
3
|
import * as i0 from '@angular/core';
|
4
4
|
import { Injectable, NgModule } from '@angular/core';
|
5
5
|
import * as i1 from '@veloce/core';
|
6
|
-
import { ModelTranslatorUtils, ConfigurationContextMode,
|
7
|
-
import { throwError,
|
8
|
-
import { map, tap,
|
6
|
+
import { ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, ProductModelsContainer, ModelUtils, EntityUtil, BaseHttpService, XrayService } from '@veloce/core';
|
7
|
+
import { throwError, of, zip, forkJoin, map as map$1, noop, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
|
8
|
+
import { map, tap, switchMap, defaultIfEmpty, catchError } from 'rxjs/operators';
|
9
9
|
import * as _ from 'lodash';
|
10
10
|
import { transform } from 'lodash';
|
11
11
|
import { CurrencyPipe } from '@angular/common';
|
@@ -541,10 +541,11 @@ class DocumentAttachmentApiService {
|
|
541
541
|
constructor(httpService, fileDownloadService) {
|
542
542
|
this.httpService = httpService;
|
543
543
|
this.fileDownloadService = fileDownloadService;
|
544
|
+
this.SERVICE_URL = '/attachments';
|
544
545
|
}
|
545
546
|
getAttachments(searchRequest) {
|
546
547
|
return this.httpService.api({
|
547
|
-
url:
|
548
|
+
url: `${this.SERVICE_URL}/search`,
|
548
549
|
method: 'post',
|
549
550
|
body: searchRequest,
|
550
551
|
});
|
@@ -558,7 +559,7 @@ class DocumentAttachmentApiService {
|
|
558
559
|
type: 'application/json',
|
559
560
|
}));
|
560
561
|
return this.httpService.upload({
|
561
|
-
url:
|
562
|
+
url: `${this.SERVICE_URL}`,
|
562
563
|
body: formData,
|
563
564
|
method: 'post',
|
564
565
|
observe: reportProgress ? 'events' : undefined,
|
@@ -567,7 +568,7 @@ class DocumentAttachmentApiService {
|
|
567
568
|
}
|
568
569
|
updateAttachment(id, attachment) {
|
569
570
|
return this.httpService.api({
|
570
|
-
url:
|
571
|
+
url: `${this.SERVICE_URL}/${id}`,
|
571
572
|
body: attachment,
|
572
573
|
method: 'put',
|
573
574
|
});
|
@@ -575,7 +576,7 @@ class DocumentAttachmentApiService {
|
|
575
576
|
getAttachmentFile(id, isPreventDownload) {
|
576
577
|
return this.httpService
|
577
578
|
.api({
|
578
|
-
url:
|
579
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
579
580
|
responseType: isPreventDownload ? 'arraybuffer' : 'blob',
|
580
581
|
observe: isPreventDownload ? 'body' : 'response',
|
581
582
|
})
|
@@ -587,7 +588,7 @@ class DocumentAttachmentApiService {
|
|
587
588
|
}
|
588
589
|
removeAttachment(id) {
|
589
590
|
return this.httpService.api({
|
590
|
-
url:
|
591
|
+
url: `${this.SERVICE_URL}/${id}`,
|
591
592
|
method: 'delete',
|
592
593
|
});
|
593
594
|
}
|
@@ -645,48 +646,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
645
646
|
type: Injectable
|
646
647
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
647
648
|
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
649
|
+
class QuoteApiService {
|
650
|
+
constructor(httpService) {
|
651
|
+
this.httpService = httpService;
|
652
|
+
this.SERVICE_URL = '/quotes';
|
652
653
|
}
|
653
|
-
|
654
|
-
return
|
654
|
+
getQuote(quoteId, params) {
|
655
|
+
return this.httpService.api({
|
656
|
+
method: 'get',
|
657
|
+
url: `${this.SERVICE_URL}/${quoteId}`,
|
658
|
+
params,
|
659
|
+
});
|
655
660
|
}
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
+
upsertQuote(request) {
|
662
|
+
return this.httpService.api({
|
663
|
+
method: 'post',
|
664
|
+
url: `${this.SERVICE_URL}`,
|
665
|
+
body: request,
|
666
|
+
});
|
667
|
+
}
|
668
|
+
submitQuote(request) {
|
669
|
+
return this.httpService.api({
|
670
|
+
method: 'post',
|
671
|
+
url: `${this.SERVICE_URL}/submit`,
|
672
|
+
body: request,
|
673
|
+
});
|
661
674
|
}
|
662
|
-
|
663
|
-
|
675
|
+
attachDocument(id, documentName, data) {
|
676
|
+
const formData = new FormData();
|
677
|
+
const blob = new Blob([data]);
|
678
|
+
formData.append('file', blob, documentName);
|
679
|
+
return this.httpService.upload({
|
680
|
+
url: `${this.SERVICE_URL}/${id}/attach-document`,
|
681
|
+
responseType: 'arraybuffer',
|
682
|
+
method: 'post',
|
683
|
+
body: formData,
|
684
|
+
});
|
664
685
|
}
|
665
|
-
|
666
|
-
};
|
686
|
+
}
|
687
|
+
QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
688
|
+
QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService });
|
689
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, decorators: [{
|
690
|
+
type: Injectable
|
691
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
692
|
+
|
693
|
+
const moment = moment_;
|
667
694
|
class DocumentTemplatesApiService {
|
668
|
-
constructor(service,
|
695
|
+
constructor(service, salesforceApiService, fileDownloadService, documentAttachmentService, quoteApiService, http) {
|
669
696
|
this.service = service;
|
670
|
-
this.
|
697
|
+
this.salesforceApiService = salesforceApiService;
|
671
698
|
this.fileDownloadService = fileDownloadService;
|
672
699
|
this.documentAttachmentService = documentAttachmentService;
|
700
|
+
this.quoteApiService = quoteApiService;
|
673
701
|
this.http = http;
|
674
|
-
this.
|
702
|
+
this.SERVICE_URL = '/templates';
|
703
|
+
this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
|
704
|
+
this.mapSfQueryResult = (limit) => map((records) => {
|
705
|
+
if (!records.length) {
|
706
|
+
return { _result: 'No Records Found' };
|
707
|
+
}
|
708
|
+
if (limit === 1) {
|
709
|
+
return records[0];
|
710
|
+
}
|
711
|
+
return records;
|
712
|
+
});
|
713
|
+
this.mapBooleanIfAplicable = (value) => {
|
714
|
+
if (value === 'true') {
|
715
|
+
return true;
|
716
|
+
}
|
717
|
+
if (value === 'false') {
|
718
|
+
return false;
|
719
|
+
}
|
720
|
+
return value;
|
721
|
+
};
|
675
722
|
if (window.VELO_DOCGEN_API) {
|
676
|
-
this.
|
723
|
+
this.DOC_GEN_URL = window.VELO_DOCGEN_API;
|
677
724
|
}
|
678
725
|
else {
|
679
|
-
console.log(`window.VELO_DOCGEN_API not set, will use fallback "${this.
|
680
|
-
this.
|
726
|
+
console.log(`window.VELO_DOCGEN_API not set, will use fallback "${this.DOC_GEN_URL_FALLBACK}"`);
|
727
|
+
this.DOC_GEN_URL = this.DOC_GEN_URL_FALLBACK;
|
681
728
|
}
|
682
729
|
}
|
683
730
|
getTemplates(tag) {
|
684
731
|
return this.service.api({
|
685
|
-
url:
|
732
|
+
url: `${this.SERVICE_URL}`,
|
686
733
|
method: 'get',
|
687
734
|
params: Object.assign({}, (tag && { tag })),
|
688
735
|
});
|
689
736
|
}
|
737
|
+
getTemplate(id) {
|
738
|
+
return this.service.api({
|
739
|
+
url: `${this.SERVICE_URL}/${id}`,
|
740
|
+
method: 'get',
|
741
|
+
});
|
742
|
+
}
|
690
743
|
upsertTemplate(template, file, reportProgress) {
|
691
744
|
const formData = new FormData();
|
692
745
|
if (file) {
|
@@ -695,8 +748,12 @@ class DocumentTemplatesApiService {
|
|
695
748
|
formData.append('template', new Blob([JSON.stringify(template)], {
|
696
749
|
type: 'application/json',
|
697
750
|
}));
|
751
|
+
let url = `${this.SERVICE_URL}`;
|
752
|
+
if (template.id) {
|
753
|
+
url += `/${template.id}`;
|
754
|
+
}
|
698
755
|
return this.service.upload({
|
699
|
-
url
|
756
|
+
url,
|
700
757
|
body: formData,
|
701
758
|
method: template.id ? 'put' : 'post',
|
702
759
|
reportProgress,
|
@@ -704,19 +761,19 @@ class DocumentTemplatesApiService {
|
|
704
761
|
}
|
705
762
|
removeTemplate(id) {
|
706
763
|
return this.service.api({
|
707
|
-
url:
|
764
|
+
url: `${this.SERVICE_URL}/${id}`,
|
708
765
|
method: 'delete',
|
709
766
|
});
|
710
767
|
}
|
711
768
|
restoreTemplate(id) {
|
712
769
|
return this.service.api({
|
713
|
-
url:
|
770
|
+
url: `${this.SERVICE_URL}/${id}/restore`,
|
714
771
|
method: 'patch',
|
715
772
|
});
|
716
773
|
}
|
717
774
|
cloneTemplate(id, propertiesToOverride = {}) {
|
718
775
|
return this.service.api({
|
719
|
-
url:
|
776
|
+
url: `${this.SERVICE_URL}/clone/${id}`,
|
720
777
|
method: 'post',
|
721
778
|
body: {
|
722
779
|
id,
|
@@ -724,15 +781,93 @@ class DocumentTemplatesApiService {
|
|
724
781
|
},
|
725
782
|
});
|
726
783
|
}
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
784
|
+
getTemplateFile(id) {
|
785
|
+
return this.service.api({
|
786
|
+
method: 'get',
|
787
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
788
|
+
responseType: 'arraybuffer',
|
789
|
+
});
|
790
|
+
}
|
791
|
+
downloadTemplateFile(id) {
|
792
|
+
return this.service
|
793
|
+
.api({
|
794
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
795
|
+
responseType: 'blob',
|
796
|
+
observe: 'response',
|
797
|
+
})
|
798
|
+
.pipe(tap(response => {
|
799
|
+
this.fileDownloadService.processDownload(response);
|
800
|
+
}), map(response => response.body || response));
|
801
|
+
}
|
802
|
+
mergeDocuments(document, attachments) {
|
803
|
+
const body = new FormData();
|
804
|
+
attachments.forEach(attachment => {
|
805
|
+
body.append('attachments', new Blob([attachment]));
|
806
|
+
});
|
807
|
+
body.append('orderform', document);
|
808
|
+
return this.http.post(`${this.DOC_GEN_URL}/documents/merge`, body, {
|
809
|
+
responseType: 'arraybuffer',
|
810
|
+
});
|
811
|
+
}
|
812
|
+
getAttachments(searchRequest) {
|
813
|
+
return this.documentAttachmentService.getAttachments(searchRequest);
|
814
|
+
}
|
815
|
+
getAttachmentFile(id) {
|
816
|
+
return this.documentAttachmentService.getAttachmentFile(id);
|
817
|
+
}
|
818
|
+
createAttachment(attachment, file, reportProgress) {
|
819
|
+
return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
|
820
|
+
}
|
821
|
+
removeAttachment(id) {
|
822
|
+
return this.documentAttachmentService.removeAttachment(id);
|
823
|
+
}
|
824
|
+
generateDocumentData(template, object, params = {}) {
|
825
|
+
var _a;
|
826
|
+
if (isLegacyDocumentTemplate(template)) {
|
827
|
+
return this.generateDocumentDataLegacy(template, object, params);
|
733
828
|
}
|
734
|
-
const
|
735
|
-
|
829
|
+
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) })), {});
|
830
|
+
/*
|
831
|
+
Resolve quote and template properties for now
|
832
|
+
When procedures are ready, whey will replace template scripts.
|
833
|
+
|
834
|
+
TODO: run procedure to resolve document data
|
835
|
+
*/
|
836
|
+
return of(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), templateProperties));
|
837
|
+
}
|
838
|
+
generateDocument(template, object, params = {}) {
|
839
|
+
const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
|
840
|
+
return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
|
841
|
+
var _a, _b, _c, _d, _e, _f;
|
842
|
+
const document = DocxTemplater.generate(templateFile, data);
|
843
|
+
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 : {};
|
844
|
+
const documentName = properties.Name || template.name;
|
845
|
+
const documentFormat = (_d = params.documentFormat) !== null && _d !== void 0 ? _d : (_f = (_e = template.properties) === null || _e === void 0 ? void 0 : _e.find(p => p.name === 'documentFormat')) === null || _f === void 0 ? void 0 : _f.value;
|
846
|
+
if (documentFormat === 'DOCX') {
|
847
|
+
this.fileDownloadService.processDownload(document, documentName);
|
848
|
+
return of(document);
|
849
|
+
}
|
850
|
+
return this.mergeDocuments(document, attachments).pipe(switchMap(pdf => {
|
851
|
+
if (params.attachToQuote && QuoteDraft.isQuote(object)) {
|
852
|
+
return this.quoteApiService
|
853
|
+
.attachDocument(object.quoteId, `${documentName}.pdf`, pdf)
|
854
|
+
.pipe(map(() => pdf));
|
855
|
+
}
|
856
|
+
return of(pdf);
|
857
|
+
}), map(pdf => {
|
858
|
+
const blob = new Blob([pdf]);
|
859
|
+
if (!params.shouldPreventDownload) {
|
860
|
+
this.fileDownloadService.processDownload(blob, `${documentName}.pdf`);
|
861
|
+
}
|
862
|
+
return blob;
|
863
|
+
}));
|
864
|
+
}));
|
865
|
+
}
|
866
|
+
generateDocumentDataLegacy(template, object, params = {}) {
|
867
|
+
var _a, _b, _c, _d;
|
868
|
+
const shouldPreventDownload = params.shouldPreventDownload;
|
869
|
+
const allQueries = [...((_a = template === null || template === void 0 ? void 0 : template.queries) !== null && _a !== void 0 ? _a : [])];
|
870
|
+
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 : {};
|
736
871
|
const accountId = properties === null || properties === void 0 ? void 0 : properties.AccountId;
|
737
872
|
const userId = properties === null || properties === void 0 ? void 0 : properties.UserId;
|
738
873
|
if (accountId) {
|
@@ -754,9 +889,7 @@ class DocumentTemplatesApiService {
|
|
754
889
|
});
|
755
890
|
}
|
756
891
|
const queries = allQueries.map(query => this.queryObject(query, { properties })) || [];
|
757
|
-
return forkJoin([...queries])
|
758
|
-
.pipe(defaultIfEmpty([]))
|
759
|
-
.pipe(map(results => {
|
892
|
+
return forkJoin([...queries]).pipe(defaultIfEmpty([]), map(results => {
|
760
893
|
var _a, _b, _c, _d;
|
761
894
|
const queriesResult = _.chain(results)
|
762
895
|
.reduce((acc, r) => {
|
@@ -767,7 +900,7 @@ class DocumentTemplatesApiService {
|
|
767
900
|
}, {})
|
768
901
|
.value();
|
769
902
|
const templateProperties = ((template === null || template === void 0 ? void 0 : template.properties) || []).reduce((trunk, { name, value }) => {
|
770
|
-
return Object.assign(Object.assign({}, trunk), { [name]: mapBooleanIfAplicable(value) });
|
903
|
+
return Object.assign(Object.assign({}, trunk), { [name]: this.mapBooleanIfAplicable(value) });
|
771
904
|
}, {});
|
772
905
|
const data = Object.assign(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), queriesResult), templateProperties);
|
773
906
|
if (template.script && template.script.trim().length) {
|
@@ -791,113 +924,13 @@ class DocumentTemplatesApiService {
|
|
791
924
|
return data;
|
792
925
|
}));
|
793
926
|
}
|
794
|
-
|
795
|
-
|
796
|
-
const {
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
generateDocumentNew(template, object, params = {}) {
|
802
|
-
const { attachToQuote, documentFormat, shouldPreventDownload } = params;
|
803
|
-
const file$ = this.service.api({
|
804
|
-
method: 'get',
|
805
|
-
url: `/templates/${template.id}/file`,
|
806
|
-
responseType: 'arraybuffer',
|
807
|
-
});
|
808
|
-
const attachmentIds = (template.attachments || []).map(({ id }) => id);
|
809
|
-
const attachments$ = attachmentIds.length
|
810
|
-
? attachmentIds.map(attachmentId => {
|
811
|
-
return this.documentAttachmentService.getAttachmentFile(attachmentId, true);
|
812
|
-
})
|
813
|
-
: [];
|
814
|
-
const data$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
|
815
|
-
return zip(file$, data$, ...attachments$).pipe(switchMap(([file, data, ...attachments]) => {
|
816
|
-
var _a;
|
817
|
-
const d = DocxTemplater.generate(file, data);
|
818
|
-
const body = new FormData();
|
819
|
-
const properties = ((_a = object === null || object === void 0 ? void 0 : object.context) === null || _a === void 0 ? void 0 : _a.properties) || (object === null || object === void 0 ? void 0 : object.properties) || {};
|
820
|
-
const documentName = (properties === null || properties === void 0 ? void 0 : properties.Name) || template.name;
|
821
|
-
// TODO: special CATO case. Refactor for a more generic approach
|
822
|
-
if (documentFormat === 'DOCX') {
|
823
|
-
this.fileDownloadService.processDownload(d, documentName);
|
824
|
-
return of(d);
|
825
|
-
}
|
826
|
-
attachments.forEach((attachment) => {
|
827
|
-
body.append('attachments', new Blob([attachment]));
|
828
|
-
});
|
829
|
-
body.append('orderform', d);
|
830
|
-
return this.http
|
831
|
-
.post(`${this.docGenHost}/documents/merge`, body, {
|
832
|
-
responseType: 'arraybuffer',
|
833
|
-
})
|
834
|
-
.pipe(switchMap((pdf) => {
|
835
|
-
const blob = new Blob([pdf]);
|
836
|
-
if (!shouldPreventDownload) {
|
837
|
-
this.fileDownloadService.processDownload(blob, `${documentName}.pdf`);
|
838
|
-
}
|
839
|
-
if (attachToQuote && object instanceof QuoteDraft) {
|
840
|
-
const formData = new FormData();
|
841
|
-
formData.append('file', blob, `${documentName}.pdf`);
|
842
|
-
return this.http.post(`${window['VELO_API']}/services/quotes/${object.quoteId}/attach-document`, formData, {
|
843
|
-
responseType: 'arraybuffer',
|
844
|
-
headers: {
|
845
|
-
Authorization: window['VELO_KEY'],
|
846
|
-
},
|
847
|
-
});
|
848
|
-
}
|
849
|
-
return of(blob);
|
850
|
-
}));
|
851
|
-
}));
|
852
|
-
}
|
853
|
-
getAttachments(searchRequest) {
|
854
|
-
return this.documentAttachmentService.getAttachments(searchRequest);
|
855
|
-
}
|
856
|
-
getAttachmentFile(id) {
|
857
|
-
return this.documentAttachmentService.getAttachmentFile(id);
|
858
|
-
}
|
859
|
-
createAttachment(attachment, file, reportProgress) {
|
860
|
-
return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
|
861
|
-
}
|
862
|
-
removeAttachment(id) {
|
863
|
-
return this.documentAttachmentService.removeAttachment(id);
|
864
|
-
}
|
865
|
-
downloadTemplateFile(id) {
|
866
|
-
return this.service
|
867
|
-
.api({
|
868
|
-
url: `/templates/${id}/file`,
|
869
|
-
responseType: 'blob',
|
870
|
-
observe: 'response',
|
871
|
-
})
|
872
|
-
.pipe(tap(response => {
|
873
|
-
this.fileDownloadService.processDownload(response);
|
874
|
-
}), map(response => response.body || response));
|
875
|
-
}
|
876
|
-
generateWithBackendDocxTemplater({ template, quote, attachmentIds, params, }) {
|
877
|
-
const { shouldPreventDownload } = params;
|
878
|
-
const nonEmptyParams = Object.keys(params || {})
|
879
|
-
.filter(k => params[k] !== undefined)
|
880
|
-
.reduce((obj, key) => {
|
881
|
-
obj[key] = params[key];
|
882
|
-
return obj;
|
883
|
-
}, {});
|
884
|
-
return this.generate(`/templates/${template.id}/generate`, { quote, attachments: attachmentIds }, Boolean(shouldPreventDownload), 'blob', nonEmptyParams, false);
|
885
|
-
}
|
886
|
-
generate(url, body, shouldPreventDownload, responseType, params, isUpload, reportProgress) {
|
887
|
-
const requestOptions = {
|
888
|
-
method: 'post',
|
889
|
-
url,
|
890
|
-
body,
|
891
|
-
reportProgress,
|
892
|
-
responseType,
|
893
|
-
observe: shouldPreventDownload ? 'body' : 'response',
|
894
|
-
params,
|
895
|
-
};
|
896
|
-
return (isUpload ? this.service.upload(requestOptions) : this.service.api(requestOptions)).pipe(tap(response => {
|
897
|
-
if (!shouldPreventDownload) {
|
898
|
-
this.fileDownloadService.processDownload(response);
|
899
|
-
}
|
900
|
-
}));
|
927
|
+
resolveAttachments$(template) {
|
928
|
+
var _a, _b;
|
929
|
+
const attachmentIds = (_b = (_a = template.attachments) === null || _a === void 0 ? void 0 : _a.map(({ id }) => id).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
930
|
+
if (!attachmentIds.length) {
|
931
|
+
return of([]);
|
932
|
+
}
|
933
|
+
return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
|
901
934
|
}
|
902
935
|
queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
|
903
936
|
var _a;
|
@@ -912,14 +945,14 @@ class DocumentTemplatesApiService {
|
|
912
945
|
}
|
913
946
|
const resolvedStatement = StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i);
|
914
947
|
const searchRequest = Object.assign({ skip: 0, count: limit, rawCondition: resolvedStatement }, ((fields === null || fields === void 0 ? void 0 : fields.length) && !!fields[0] && { fields }));
|
915
|
-
return this.
|
948
|
+
return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
|
916
949
|
}
|
917
950
|
}
|
918
|
-
DocumentTemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentTemplatesApiService, deps: [{ token: i1.BaseHttpService }, { token: SalesforceApiService }, { token: i1.FileDownloadService }, { token: DocumentAttachmentApiService }, { token:
|
951
|
+
DocumentTemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentTemplatesApiService, deps: [{ token: i1.BaseHttpService }, { token: SalesforceApiService }, { token: i1.FileDownloadService }, { token: DocumentAttachmentApiService }, { token: QuoteApiService }, { token: i5.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
919
952
|
DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentTemplatesApiService });
|
920
953
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
|
921
954
|
type: Injectable
|
922
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type:
|
955
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: QuoteApiService }, { type: i5.HttpClient }]; } });
|
923
956
|
|
924
957
|
class PriceApiService {
|
925
958
|
constructor(httpService) {
|
@@ -1292,39 +1325,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
1292
1325
|
type: Injectable
|
1293
1326
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1294
1327
|
|
1295
|
-
class QuoteApiService {
|
1296
|
-
constructor(httpService) {
|
1297
|
-
this.httpService = httpService;
|
1298
|
-
this.SERVICE_URL = '/quotes';
|
1299
|
-
}
|
1300
|
-
getQuote(quoteId, params) {
|
1301
|
-
return this.httpService.api({
|
1302
|
-
method: 'get',
|
1303
|
-
url: `${this.SERVICE_URL}/${quoteId}`,
|
1304
|
-
params,
|
1305
|
-
});
|
1306
|
-
}
|
1307
|
-
upsertQuote(request) {
|
1308
|
-
return this.httpService.api({
|
1309
|
-
method: 'post',
|
1310
|
-
url: `${this.SERVICE_URL}`,
|
1311
|
-
body: request,
|
1312
|
-
});
|
1313
|
-
}
|
1314
|
-
submitQuote(request) {
|
1315
|
-
return this.httpService.api({
|
1316
|
-
method: 'post',
|
1317
|
-
url: `${this.SERVICE_URL}/submit`,
|
1318
|
-
body: request,
|
1319
|
-
});
|
1320
|
-
}
|
1321
|
-
}
|
1322
|
-
QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1323
|
-
QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService });
|
1324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteApiService, decorators: [{
|
1325
|
-
type: Injectable
|
1326
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1327
|
-
|
1328
1328
|
class RampApiService {
|
1329
1329
|
constructor(httpService) {
|
1330
1330
|
this.httpService = httpService;
|