@veloceapps/api 9.0.0-9 → 10.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,7 +3,7 @@ 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, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } 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
7
  import { noop, throwError, of, zip, forkJoin, map as map$1, from, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
8
  import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
9
9
  import * as i1$2 from 'primeng/api';
@@ -456,7 +456,7 @@ class ConfigurationApiService {
456
456
  // loop through ports to look for 'None' type domain computations
457
457
  for (const port of component?.ports ?? []) {
458
458
  const portDomain = portDomains[port.name];
459
- if (portDomain?.properties?.['domainComputation'] === ('None')) {
459
+ if (portDomain?.properties?.['domainComputation'] === DomainComputation.NONE) {
460
460
  portDomain.domainTypes = port.domainTypes;
461
461
  }
462
462
  }
@@ -868,8 +868,8 @@ class DocumentTemplatesApiService {
868
868
  this.fileDownloadService = fileDownloadService;
869
869
  this.documentAttachmentService = documentAttachmentService;
870
870
  this.http = http;
871
- this.DOCGEN_TAG = 'docgen';
872
871
  this.SERVICE_URL = '/templates';
872
+ this.DOCGEN_TAG = 'docgen';
873
873
  this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
874
874
  this.mapSfQueryResult = (limit) => map((records) => {
875
875
  if (!records.length) {
@@ -981,6 +981,29 @@ class DocumentTemplatesApiService {
981
981
  responseType: 'arraybuffer',
982
982
  });
983
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
+ }
984
1007
  getAttachments(searchRequest) {
985
1008
  return this.documentAttachmentService.getAttachments(searchRequest);
986
1009
  }