@veloceapps/sdk 8.0.0-145 → 8.0.0-147

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 { UITemplateType, SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue, ConfigurationContextMode, UUID } from '@veloceapps/core';
19
+ import { UITemplateType, SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue, 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';
@@ -585,10 +585,13 @@ class FlowRouterService {
585
585
  const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
586
586
  this.router.navigate([flowRouteUrl, 'assets'], { queryParams: routeSnapshot.queryParams });
587
587
  }
588
- showErrorPage$(message) {
588
+ showErrorPage$(message, details) {
589
589
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
590
590
  const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
591
- return from(this.router.navigate([flowRouteUrl, '404'], { state: { message }, replaceUrl: true })).pipe(map(() => false));
591
+ return from(this.router.navigate([flowRouteUrl, '404'], {
592
+ state: Object.assign({ message, type: 'error' }, (details && { details })),
593
+ replaceUrl: true,
594
+ })).pipe(map(() => false));
592
595
  }
593
596
  switchObject(id) {
594
597
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
@@ -968,7 +971,8 @@ class ContextGuard {
968
971
  this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
969
972
  }), map(() => true), catchError(e => {
970
973
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
971
- return this.routerService.showErrorPage$(message);
974
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
975
+ return this.routerService.showErrorPage$(message, errorDetails);
972
976
  }));
973
977
  }
974
978
  canActivate(route) {
@@ -1033,7 +1037,11 @@ const keepFlowInitialized = (route) => {
1033
1037
  return true;
1034
1038
  }
1035
1039
  const params = Object.assign(Object.assign({}, route.queryParams), flow === null || flow === void 0 ? void 0 : flow.properties.queryParams);
1036
- return flowInfoService.init$(flowId, params).pipe(map(() => true), catchError(e => routerService.showErrorPage$(e)));
1040
+ return flowInfoService.init$(flowId, params).pipe(map(() => true), catchError(e => {
1041
+ const message = e instanceof HttpErrorResponse ? e.error.message : e;
1042
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1043
+ return routerService.showErrorPage$(message, errorDetails);
1044
+ }));
1037
1045
  };
1038
1046
 
1039
1047
  class ProductUnloadGuard {
@@ -1551,19 +1559,22 @@ class RecordNotFoundComponent {
1551
1559
  this.router = router;
1552
1560
  this.route = route;
1553
1561
  this.subMessage = '';
1562
+ this.type = '';
1554
1563
  const navigation = this.router.getCurrentNavigation();
1555
1564
  const { state } = (navigation === null || navigation === void 0 ? void 0 : navigation.extras) || {};
1556
1565
  this.message = state === null || state === void 0 ? void 0 : state['message'];
1566
+ this.type = (state === null || state === void 0 ? void 0 : state['type']) || '';
1567
+ this.details = state === null || state === void 0 ? void 0 : state['details'];
1557
1568
  if (typeof this.message === 'string') {
1558
1569
  this.subMessage = this.message.includes('/describe') ? 'A potential problem with permissions' : '';
1559
1570
  }
1560
1571
  }
1561
1572
  }
1562
1573
  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 });
1563
- 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 });
1574
+ 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 });
1564
1575
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
1565
1576
  type: Component,
1566
- 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"] }]
1577
+ 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"] }]
1567
1578
  }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1568
1579
 
1569
1580
  const routes = [{ path: '', component: RecordNotFoundComponent }];
@@ -2071,7 +2082,8 @@ class FlowResolver {
2071
2082
  replaceUrl: true,
2072
2083
  })).pipe(catchError$1(e => {
2073
2084
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2074
- return this.routerService.showErrorPage$(message);
2085
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2086
+ return this.routerService.showErrorPage$(message, errorDetails);
2075
2087
  }));
2076
2088
  }
2077
2089
  }
@@ -2100,7 +2112,8 @@ class QuoteResolver {
2100
2112
  }
2101
2113
  return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
2102
2114
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
2103
- return this.routerService.showErrorPage$(message);
2115
+ const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
2116
+ return this.routerService.showErrorPage$(message, errorDetails);
2104
2117
  }));
2105
2118
  }
2106
2119
  checkDynamicNavigation$(route) {