@veloceapps/sdk 8.0.0-144 → 8.0.0-146

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.
@@ -16,7 +16,7 @@ import * as i1 from 'primeng/dynamicdialog';
16
16
  import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest, forkJoin, throwError } from 'rxjs';
17
17
  import * as i1$2 from '@angular/router';
18
18
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
19
- import { mapShoppingCartSettings, getMaxRenewalTermsValue, UITemplateType, SalesforceIdUtils, ConfigurationContextMode, UUID } from '@veloceapps/core';
19
+ import { mapShoppingCartSettings, getMaxRenewalTermsValue, UITemplateType, SalesforceIdUtils, ConfigurationContextMode, isVeloceError, extractErrorDetails, UUID } from '@veloceapps/core';
20
20
  import { HttpErrorResponse, HttpParams } from '@angular/common/http';
21
21
  import * as i5$1 from '@angular/forms';
22
22
  import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -704,10 +704,13 @@ class FlowRouterService {
704
704
  const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
705
705
  this.router.navigate([flowRouteUrl, 'assets'], { queryParams: routeSnapshot.queryParams });
706
706
  }
707
- showErrorPage$(message) {
707
+ showErrorPage$(message, details) {
708
708
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
709
709
  const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
710
- return from(this.router.navigate([flowRouteUrl, '404'], { state: { message }, replaceUrl: true })).pipe(map(() => false));
710
+ return from(this.router.navigate([flowRouteUrl, '404'], {
711
+ state: { message, type: 'error', ...(details && { details }) },
712
+ replaceUrl: true,
713
+ })).pipe(map(() => false));
711
714
  }
712
715
  switchObject(id) {
713
716
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
@@ -959,7 +962,8 @@ class ContextGuard {
959
962
  this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
960
963
  }), map(() => true), catchError(e => {
961
964
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
962
- return this.routerService.showErrorPage$(message);
965
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
966
+ return this.routerService.showErrorPage$(message, errorDetails);
963
967
  }));
964
968
  }
965
969
  canActivate(route) {
@@ -1023,7 +1027,11 @@ const keepFlowInitialized = (route) => {
1023
1027
  return true;
1024
1028
  }
1025
1029
  const params = { ...route.queryParams, ...flow?.properties.queryParams };
1026
- return flowInfoService.init$(flowId, params).pipe(map(() => true), catchError(e => routerService.showErrorPage$(e)));
1030
+ return flowInfoService.init$(flowId, params).pipe(map(() => true), catchError(e => {
1031
+ const message = e instanceof HttpErrorResponse ? e.error.message : e;
1032
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1033
+ return routerService.showErrorPage$(message, errorDetails);
1034
+ }));
1027
1035
  };
1028
1036
 
1029
1037
  class ProductUnloadGuard {
@@ -1530,19 +1538,22 @@ class RecordNotFoundComponent {
1530
1538
  this.router = router;
1531
1539
  this.route = route;
1532
1540
  this.subMessage = '';
1541
+ this.type = '';
1533
1542
  const navigation = this.router.getCurrentNavigation();
1534
1543
  const { state } = navigation?.extras || {};
1535
1544
  this.message = state?.['message'];
1545
+ this.type = state?.['type'] || '';
1546
+ this.details = state?.['details'];
1536
1547
  if (typeof this.message === 'string') {
1537
1548
  this.subMessage = this.message.includes('/describe') ? 'A potential problem with permissions' : '';
1538
1549
  }
1539
1550
  }
1540
1551
  }
1541
1552
  RecordNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
1542
- RecordNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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 });
1553
+ RecordNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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 });
1543
1554
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
1544
1555
  type: Component,
1545
- 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"] }]
1556
+ 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"] }]
1546
1557
  }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1547
1558
 
1548
1559
  const routes = [{ path: '', component: RecordNotFoundComponent }];
@@ -2044,7 +2055,8 @@ class FlowResolver {
2044
2055
  replaceUrl: true,
2045
2056
  })).pipe(catchError$1(e => {
2046
2057
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2047
- return this.routerService.showErrorPage$(message);
2058
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2059
+ return this.routerService.showErrorPage$(message, errorDetails);
2048
2060
  }));
2049
2061
  }
2050
2062
  }
@@ -2073,7 +2085,8 @@ class QuoteResolver {
2073
2085
  }
2074
2086
  return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
2075
2087
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2076
- return this.routerService.showErrorPage$(message);
2088
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2089
+ return this.routerService.showErrorPage$(message, errorDetails);
2077
2090
  }));
2078
2091
  }
2079
2092
  checkDynamicNavigation$(route) {