@veloceapps/sdk 7.0.2-94 → 7.0.2-96

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ import { isLineItemModified, getOriginParent, SdkPipesModule, RuntimeOperation,
13
13
  import * as i3 from 'primeng/button';
14
14
  import { ButtonModule } from 'primeng/button';
15
15
  import * as i1 from 'primeng/dynamicdialog';
16
- import { UITemplateComponentType, UITemplateType, SalesforceIdUtils, ConfigurationContextMode, EntityUtil, isLegacyUIDefinition, getUIDefinitionProperties, UUID } from '@veloceapps/core';
16
+ import { UITemplateComponentType, UITemplateType, SalesforceIdUtils, ConfigurationContextMode, isVeloceError, extractErrorDetails, EntityUtil, isLegacyUIDefinition, getUIDefinitionProperties, UUID } from '@veloceapps/core';
17
17
  import { BehaviorSubject, Subject, first, tap, takeUntil, catchError, of, map, switchMap, filter, shareReplay, startWith, distinctUntilChanged, combineLatest, finalize, noop, forkJoin, from, throwError } from 'rxjs';
18
18
  import * as i7 from 'primeng/overlaypanel';
19
19
  import { OverlayPanel, OverlayPanelModule } from 'primeng/overlaypanel';
@@ -1584,7 +1584,8 @@ class ContextGuard {
1584
1584
  this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
1585
1585
  }), map(() => true), catchError(e => {
1586
1586
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
1587
- return this.handleError(route, message);
1587
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1588
+ return this.handleError(route, message, errorDetails);
1588
1589
  }));
1589
1590
  }
1590
1591
  canActivate(route) {
@@ -1617,10 +1618,10 @@ class ContextGuard {
1617
1618
  }
1618
1619
  return;
1619
1620
  }
1620
- handleError(route, message) {
1621
+ handleError(route, message, details) {
1621
1622
  this.contextService.delete();
1622
1623
  const parentUrl = this.routerService.getFlowRootPath(route);
1623
- return from(this.router.navigate([parentUrl, '404'], { state: { message } })).pipe(map(() => false));
1624
+ return from(this.router.navigate([parentUrl, '404'], { state: { message, type: 'error', ...(details && { details }) } })).pipe(map(() => false));
1624
1625
  }
1625
1626
  }
1626
1627
  ContextGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextGuard, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i1$1.ContextService }, { token: i1$1.RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2261,19 +2262,22 @@ class RecordNotFoundComponent {
2261
2262
  this.router = router;
2262
2263
  this.route = route;
2263
2264
  this.subMessage = '';
2265
+ this.type = '';
2264
2266
  const navigation = this.router.getCurrentNavigation();
2265
2267
  const { state } = navigation?.extras || {};
2266
2268
  this.message = state?.['message'];
2269
+ this.type = state?.['type'] || '';
2270
+ this.details = state?.['details'];
2267
2271
  if (typeof this.message === 'string') {
2268
2272
  this.subMessage = this.message.includes('/describe') ? 'A potential problem with permissions' : '';
2269
2273
  }
2270
2274
  }
2271
2275
  }
2272
2276
  RecordNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RecordNotFoundComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
2273
- RecordNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: RecordNotFoundComponent, selector: "vl-flow-record-not-found", ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div class=\"msg\">\n <div *ngIf=\"message; else defaultMessage\" class=\"message-title\">\n <p>{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"message-title\">{{ subMessage }}</p>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2277
+ RecordNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: RecordNotFoundComponent, selector: "vl-flow-record-not-found", ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div *ngIf=\"message; else defaultMessage\">\n <p class=\"text message-text\" [class]=\"type\">{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"text\">{{ subMessage }}</p>\n\n <div *ngIf=\"details && details.length > 0\">\n <div *ngFor=\"let detail of details\" class=\"text\">{{ detail }}</div>\n </div>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}:host .text{white-space:pre-line;word-break:break-word}:host .message-text.error{color:var(--vl-error-text-color)}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2274
2278
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
2275
2279
  type: Component,
2276
- args: [{ selector: 'vl-flow-record-not-found', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div class=\"msg\">\n <div *ngIf=\"message; else defaultMessage\" class=\"message-title\">\n <p>{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"message-title\">{{ subMessage }}</p>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}\n"] }]
2280
+ args: [{ selector: 'vl-flow-record-not-found', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div *ngIf=\"message; else defaultMessage\">\n <p class=\"text message-text\" [class]=\"type\">{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"text\">{{ subMessage }}</p>\n\n <div *ngIf=\"details && details.length > 0\">\n <div *ngFor=\"let detail of details\" class=\"text\">{{ detail }}</div>\n </div>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}:host .text{white-space:pre-line;word-break:break-word}:host .message-text.error{color:var(--vl-error-text-color)}\n"] }]
2277
2281
  }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
2278
2282
 
2279
2283
  const routes = [{ path: '', component: RecordNotFoundComponent }];
@@ -2752,12 +2756,14 @@ class FlowResolver {
2752
2756
  this.routerService = routerService;
2753
2757
  this.contextService = contextService;
2754
2758
  }
2755
- handleError(route, message, queryParams) {
2759
+ handleError(route, message, details, queryParams) {
2756
2760
  const parentUrl = this.routerService.getFlowRootPath(route);
2757
2761
  return this.router.navigate([parentUrl, '404'], {
2758
2762
  queryParams,
2759
2763
  state: {
2760
- message: message,
2764
+ message,
2765
+ type: 'error',
2766
+ ...(details && { details }),
2761
2767
  },
2762
2768
  });
2763
2769
  }
@@ -2791,7 +2797,8 @@ class FlowResolver {
2791
2797
  })
2792
2798
  .catch(e => {
2793
2799
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2794
- return this.handleError(route, message, mergedParams);
2800
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2801
+ return this.handleError(route, message, errorDetails, mergedParams);
2795
2802
  });
2796
2803
  }));
2797
2804
  }
@@ -2811,9 +2818,9 @@ class QuoteResolver {
2811
2818
  this.flowConfiguration = flowConfiguration;
2812
2819
  this.integrationState = integrationState;
2813
2820
  }
2814
- handleError(route, message) {
2821
+ handleError(route, message, details) {
2815
2822
  const parentUrl = this.routerService.getFlowRootPath(route);
2816
- return from(this.router.navigate([parentUrl, '404'], { state: { message } }));
2823
+ return from(this.router.navigate([parentUrl, '404'], { state: { message, type: 'error', ...(details && { details }) } }));
2817
2824
  }
2818
2825
  calculate$() {
2819
2826
  const quoteDraft = this.quoteDraftService.quoteDraft;
@@ -2843,7 +2850,8 @@ class QuoteResolver {
2843
2850
  this.quoteDraftService.hasUnsavedChanges = false;
2844
2851
  }), catchError(e => {
2845
2852
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2846
- return this.handleError(route, message);
2853
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2854
+ return this.handleError(route, message, errorDetails);
2847
2855
  }));
2848
2856
  }
2849
2857
  changeNavigation(path, route) {
@@ -2855,7 +2863,8 @@ class QuoteResolver {
2855
2863
  })
2856
2864
  .catch(e => {
2857
2865
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2858
- return this.handleError(route, message);
2866
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2867
+ return this.handleError(route, message, errorDetails);
2859
2868
  });
2860
2869
  }
2861
2870
  shouldNavigateToAssets() {