@veloceapps/api 9.0.0-8 → 10.0.0-0

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.
@@ -455,27 +455,9 @@ class ConfigurationApiService {
455
455
  const portDomains = { ...lineItem.portDomains };
456
456
  // loop through ports to look for 'None' type domain computations
457
457
  for (const port of component?.ports ?? []) {
458
- const { name: portName, type: typeName, min, max, domainTypes, properties } = port;
459
- const portDomain = portDomains[portName];
460
- if (portDomain) {
461
- // there's a 'None' type domain computation
462
- if (portDomain.properties?.['domainComputation'] === ('None')) {
463
- portDomain.domainTypes = domainTypes;
464
- }
465
- }
466
- else {
467
- // there's no port domain so consider that as 'None' type domain computation
468
- portDomains[portName] = {
469
- name: portName,
470
- type: typeName,
471
- minCard: Number(min),
472
- maxCard: Number(max),
473
- domainTypes: domainTypes,
474
- properties: {
475
- ...properties,
476
- domainComputation: 'None',
477
- },
478
- };
458
+ const portDomain = portDomains[port.name];
459
+ if (portDomain?.properties?.['domainComputation'] === ('None')) {
460
+ portDomain.domainTypes = port.domainTypes;
479
461
  }
480
462
  }
481
463
  const type = runtimeModel.types.find(({ name }) => {
@@ -886,8 +868,8 @@ class DocumentTemplatesApiService {
886
868
  this.fileDownloadService = fileDownloadService;
887
869
  this.documentAttachmentService = documentAttachmentService;
888
870
  this.http = http;
889
- this.DOCGEN_TAG = 'docgen';
890
871
  this.SERVICE_URL = '/templates';
872
+ this.DOCGEN_TAG = 'docgen';
891
873
  this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
892
874
  this.mapSfQueryResult = (limit) => map((records) => {
893
875
  if (!records.length) {
@@ -999,6 +981,29 @@ class DocumentTemplatesApiService {
999
981
  responseType: 'arraybuffer',
1000
982
  });
1001
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
+ }
1002
1007
  getAttachments(searchRequest) {
1003
1008
  return this.documentAttachmentService.getAttachments(searchRequest);
1004
1009
  }