@abp/ng.theme.shared 7.3.1 → 7.4.0-rc.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.
Files changed (51) hide show
  1. package/esm2022/extensions/lib/components/extensible-form/extensible-form-prop.component.mjs +4 -4
  2. package/esm2022/extensions/lib/components/extensible-table/extensible-table.component.mjs +4 -1
  3. package/esm2022/extensions/lib/components/grid-actions/grid-actions.component.mjs +3 -3
  4. package/esm2022/extensions/lib/models/actions.mjs +4 -2
  5. package/esm2022/extensions/lib/models/entity-actions.mjs +3 -1
  6. package/esm2022/lib/components/index.mjs +2 -1
  7. package/esm2022/lib/components/internet-connection-status/internet-connection-status.component.mjs +29 -0
  8. package/esm2022/lib/constants/default-errors.mjs +52 -0
  9. package/esm2022/lib/handlers/error.handler.mjs +39 -249
  10. package/esm2022/lib/models/common.mjs +1 -1
  11. package/esm2022/lib/models/nav-item.mjs +1 -1
  12. package/esm2022/lib/providers/error-handlers.provider.mjs +28 -0
  13. package/esm2022/lib/providers/index.mjs +2 -1
  14. package/esm2022/lib/services/abp-format-error-handler.service.mjs +46 -0
  15. package/esm2022/lib/services/create-error-component.service.mjs +77 -0
  16. package/esm2022/lib/services/index.mjs +7 -1
  17. package/esm2022/lib/services/router-error-handler.service.mjs +43 -0
  18. package/esm2022/lib/services/status-code-error-handler.service.mjs +85 -0
  19. package/esm2022/lib/services/tenant-resolve-error-handler.service.mjs +30 -0
  20. package/esm2022/lib/services/unknown-status-code-error-handler.service.mjs +37 -0
  21. package/esm2022/lib/theme-shared.module.mjs +5 -4
  22. package/esm2022/lib/tokens/http-error.token.mjs +2 -1
  23. package/esm2022/lib/utils/error.utils.mjs +25 -0
  24. package/esm2022/lib/utils/index.mjs +2 -1
  25. package/esm2022/public-api.mjs +2 -1
  26. package/extensions/lib/models/actions.d.ts +3 -1
  27. package/extensions/lib/models/entity-actions.d.ts +2 -0
  28. package/fesm2022/abp-ng.theme.shared-extensions.mjs +13 -6
  29. package/fesm2022/abp-ng.theme.shared-extensions.mjs.map +1 -1
  30. package/fesm2022/abp-ng.theme.shared.mjs +704 -515
  31. package/fesm2022/abp-ng.theme.shared.mjs.map +1 -1
  32. package/lib/components/index.d.ts +1 -0
  33. package/lib/components/internet-connection-status/internet-connection-status.component.d.ts +8 -0
  34. package/lib/constants/default-errors.d.ts +51 -0
  35. package/lib/handlers/error.handler.d.ts +11 -69
  36. package/lib/models/common.d.ts +7 -2
  37. package/lib/models/nav-item.d.ts +9 -0
  38. package/lib/providers/error-handlers.provider.d.ts +2 -0
  39. package/lib/providers/index.d.ts +1 -0
  40. package/lib/services/abp-format-error-handler.service.d.ts +13 -0
  41. package/lib/services/create-error-component.service.d.ts +20 -0
  42. package/lib/services/index.d.ts +6 -0
  43. package/lib/services/router-error-handler.service.d.ts +12 -0
  44. package/lib/services/status-code-error-handler.service.d.ts +21 -0
  45. package/lib/services/tenant-resolve-error-handler.service.d.ts +13 -0
  46. package/lib/services/unknown-status-code-error-handler.service.d.ts +16 -0
  47. package/lib/tokens/http-error.token.d.ts +2 -1
  48. package/lib/utils/error.utils.d.ts +8 -0
  49. package/lib/utils/index.d.ts +1 -0
  50. package/package.json +3 -3
  51. package/public-api.d.ts +1 -0
@@ -1,12 +1,12 @@
1
1
  import { animation, style, animate, keyframes, trigger, state, transition, useAnimation, query } from '@angular/animations';
2
2
  import * as i0 from '@angular/core';
3
- import { Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, ViewEncapsulation, Injectable, Optional, ContentChild, Directive, HostListener, forwardRef, HostBinding, NgModule, ComponentFactoryResolver, RendererFactory2, ApplicationRef, APP_INITIALIZER, inject, LOCALE_ID } from '@angular/core';
3
+ import { Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, ViewEncapsulation, Injectable, Optional, ContentChild, Directive, HostListener, forwardRef, HostBinding, NgModule, inject, RendererFactory2, ComponentFactoryResolver, Injector, ApplicationRef, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
4
4
  import * as i1 from '@angular/common';
5
- import { CommonModule, DOCUMENT, formatDate, DatePipe } from '@angular/common';
5
+ import { CommonModule, NgIf, DOCUMENT, formatDate, DatePipe } from '@angular/common';
6
6
  import * as i1$1 from '@angular/router';
7
7
  import { ResolveEnd } from '@angular/router';
8
8
  import * as i2 from '@abp/ng.core';
9
- import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, LocalizationService, getLocaleDirection, HttpErrorReporterService, RouterEvents, AuthService, SessionStateService, RoutesService, InternalStore, DomInsertionService, CONTENT_STRATEGY, CoreModule, noop, ConfigStateService } from '@abp/ng.core';
9
+ import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, InternetConnectionService, LocalizationModule, LocalizationService, getLocaleDirection, DomInsertionService, CONTENT_STRATEGY, InternalStore, RouterEvents, AuthService, SessionStateService, HttpErrorReporterService, RoutesService, CoreModule, noop, ConfigStateService } from '@abp/ng.core';
10
10
  import { startWith, map, debounceTime, filter, takeUntil, distinctUntilChanged, take, catchError, switchMap } from 'rxjs/operators';
11
11
  import { fromEvent, Subscription, combineLatest, timer, ReplaySubject, Subject, of, from, Observable, EMPTY, BehaviorSubject, throwError } from 'rxjs';
12
12
  import * as i3 from '@ng-bootstrap/ng-bootstrap';
@@ -1327,6 +1327,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
1327
1327
  type: Output
1328
1328
  }] } });
1329
1329
 
1330
+ class InternetConnectionStatusComponent {
1331
+ constructor() {
1332
+ this.internetConnectionService = inject(InternetConnectionService);
1333
+ this.isOnline = this.internetConnectionService.networkStatus;
1334
+ }
1335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InternetConnectionStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1336
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.6", type: InternetConnectionStatusComponent, isStandalone: true, selector: "abp-internet-status", ngImport: i0, template: `
1337
+ <div class="status-icon" *ngIf="!isOnline()">
1338
+ <i data-toggle="tooltip" title="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}" data-placement="left" class="fa fa-circle text-blinking blink">
1339
+ </i>
1340
+ </div>
1341
+ `, isInline: true, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#dc3545}to{color:#dc3545}}.text-blinking{font-size:1.2rem}.status-icon{position:fixed;z-index:999999;top:10px;right:10px}@media (max-width: 767px){.status-icon{top:26px;right:134px}}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: LocalizationModule }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
1342
+ }
1343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: InternetConnectionStatusComponent, decorators: [{
1344
+ type: Component,
1345
+ args: [{ selector: 'abp-internet-status', standalone: true, imports: [NgIf, LocalizationModule], template: `
1346
+ <div class="status-icon" *ngIf="!isOnline()">
1347
+ <i data-toggle="tooltip" title="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}" data-placement="left" class="fa fa-circle text-blinking blink">
1348
+ </i>
1349
+ </div>
1350
+ `, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#dc3545}to{color:#dc3545}}.text-blinking{font-size:1.2rem}.status-icon{position:fixed;z-index:999999;top:10px;right:10px}@media (max-width: 767px){.status-icon{top:26px;right:134px}}\n"] }]
1351
+ }] });
1352
+
1330
1353
  const DEFAULT_VALIDATION_BLUEPRINTS = {
1331
1354
  creditCard: 'AbpValidation::ThisFieldIsNotAValidCreditCardNumber.',
1332
1355
  email: 'AbpValidation::ThisFieldIsNotAValidEmailAddress.',
@@ -1347,6 +1370,58 @@ const DEFAULT_VALIDATION_BLUEPRINTS = {
1347
1370
  usernamePattern: 'AbpIdentity::Volo.Abp.Identity:InvalidUserName[{{ actualValue }}]',
1348
1371
  };
1349
1372
 
1373
+ const DEFAULT_ERROR_MESSAGES = {
1374
+ defaultError: {
1375
+ title: 'An error has occurred!',
1376
+ details: 'Error detail not sent by server.',
1377
+ },
1378
+ defaultError401: {
1379
+ title: 'You are not authenticated!',
1380
+ details: 'You should be authenticated (sign in) in order to perform this operation.',
1381
+ },
1382
+ defaultError403: {
1383
+ title: 'You are not authorized!',
1384
+ details: 'You are not allowed to perform this operation.',
1385
+ },
1386
+ defaultError404: {
1387
+ title: 'Resource not found!',
1388
+ details: 'The resource requested could not found on the server.',
1389
+ },
1390
+ defaultError500: {
1391
+ title: 'Internal server error',
1392
+ details: 'Error detail not sent by server.',
1393
+ },
1394
+ };
1395
+ const DEFAULT_ERROR_LOCALIZATIONS = {
1396
+ defaultError: {
1397
+ title: 'AbpUi::DefaultErrorMessage',
1398
+ details: 'AbpUi::DefaultErrorMessageDetail',
1399
+ },
1400
+ defaultError401: {
1401
+ title: 'AbpUi::DefaultErrorMessage401',
1402
+ details: 'AbpUi::DefaultErrorMessage401Detail',
1403
+ },
1404
+ defaultError403: {
1405
+ title: 'AbpUi::DefaultErrorMessage403',
1406
+ details: 'AbpUi::DefaultErrorMessage403Detail',
1407
+ },
1408
+ defaultError404: {
1409
+ title: 'AbpUi::DefaultErrorMessage404',
1410
+ details: 'AbpUi::DefaultErrorMessage404Detail',
1411
+ },
1412
+ defaultError500: {
1413
+ title: 'AbpUi::500Message',
1414
+ details: 'AbpUi::DefaultErrorMessage',
1415
+ },
1416
+ };
1417
+ const CUSTOM_HTTP_ERROR_HANDLER_PRIORITY = Object.freeze({
1418
+ veryLow: -99,
1419
+ low: -9,
1420
+ normal: 0,
1421
+ high: 9,
1422
+ veryHigh: 99,
1423
+ });
1424
+
1350
1425
  class EllipsisDirective {
1351
1426
  get inlineClass() {
1352
1427
  return this.enabled && this.width;
@@ -1756,291 +1831,202 @@ function httpErrorConfigFactory(config = {}) {
1756
1831
  }
1757
1832
  const HTTP_ERROR_CONFIG = new InjectionToken('HTTP_ERROR_CONFIG');
1758
1833
  const HTTP_ERROR_HANDLER = new InjectionToken('HTTP_ERROR_HANDLER');
1834
+ const CUSTOM_ERROR_HANDLERS = new InjectionToken('CUSTOM_ERROR_HANDLERS');
1759
1835
 
1760
- const DEFAULT_ERROR_MESSAGES = {
1761
- defaultError: {
1762
- title: 'An error has occurred!',
1763
- details: 'Error detail not sent by server.',
1764
- },
1765
- defaultError401: {
1766
- title: 'You are not authenticated!',
1767
- details: 'You should be authenticated (sign in) in order to perform this operation.',
1836
+ var styles = `
1837
+ .is-invalid .form-control {
1838
+ border-color: #dc3545;
1839
+ border-style: solid !important;
1840
+ padding-right: calc(1.5em + .75rem);
1841
+ background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e);
1842
+ background-repeat: no-repeat;
1843
+ background-position: right calc(.375em + .1875rem) center;
1844
+ background-size: calc(.75em + .375rem) calc(.75em + .375rem);
1845
+ }
1846
+
1847
+ .is-invalid .invalid-feedback,
1848
+ .is-invalid + * .invalid-feedback {
1849
+ display: block;
1850
+ }
1851
+
1852
+ .data-tables-filter {
1853
+ text-align: right;
1854
+ }
1855
+
1856
+ [dir=rtl] .data-tables-filter {
1857
+ text-align: left;
1858
+ }
1859
+
1860
+ .pointer {
1861
+ cursor: pointer;
1862
+ }
1863
+
1864
+ .navbar .dropdown-submenu a::after {
1865
+ transform: rotate(-90deg);
1866
+ position: absolute;
1867
+ right: 16px;
1868
+ top: 18px;
1869
+ }
1870
+
1871
+ .navbar .dropdown-menu {
1872
+ min-width: 215px;
1873
+ }
1874
+
1875
+ .datatable-scroll {
1876
+ margin-bottom: 5px !important;
1877
+ width: unset !important;
1878
+ }
1879
+
1880
+ .ui-table-scrollable-body::-webkit-scrollbar {
1881
+ height: 5px !important;
1882
+ width: 5px !important;
1883
+ }
1884
+
1885
+ .ui-table-scrollable-body::-webkit-scrollbar-track {
1886
+ background: #ddd;
1887
+ }
1888
+
1889
+ .ui-table-scrollable-body::-webkit-scrollbar-thumb {
1890
+ background: #8a8686;
1891
+ }
1892
+
1893
+ .abp-ellipsis-inline {
1894
+ display: inline-block;
1895
+ overflow: hidden;
1896
+ text-overflow: ellipsis;
1897
+ white-space: nowrap;
1898
+ }
1899
+
1900
+ .abp-ellipsis {
1901
+ overflow: hidden !important;
1902
+ text-overflow: ellipsis;
1903
+ white-space: nowrap;
1904
+ }
1905
+
1906
+ .ui-widget-overlay {
1907
+ z-index: 1000;
1908
+ }
1909
+
1910
+ .color-white {
1911
+ color: #FFF !important;
1912
+ }
1913
+
1914
+ .custom-checkbox > label {
1915
+ cursor: pointer;
1916
+ }
1917
+
1918
+ /* <animations */
1919
+
1920
+ .fade-in-top {
1921
+ animation: fadeInTop 0.2s ease-in-out;
1922
+ }
1923
+
1924
+ .fade-out-top {
1925
+ animation: fadeOutTop 0.2s ease-in-out;
1926
+ }
1927
+
1928
+ .abp-collapsed-height {
1929
+ -moz-transition: max-height linear 0.35s;
1930
+ -ms-transition: max-height linear 0.35s;
1931
+ -o-transition: max-height linear 0.35s;
1932
+ -webkit-transition: max-height linear 0.35s;
1933
+ overflow:hidden;
1934
+ transition:max-height 0.35s linear;
1935
+ height:auto;
1936
+ max-height: 0;
1937
+ }
1938
+
1939
+ .abp-mh-25 {
1940
+ max-height: 25vh;
1941
+ }
1942
+
1943
+ .abp-mh-50 {
1944
+ transition:max-height 0.65s linear;
1945
+ max-height: 50vh;
1946
+ }
1947
+
1948
+ .abp-mh-75 {
1949
+ transition:max-height 0.85s linear;
1950
+ max-height: 75vh;
1951
+ }
1952
+
1953
+ .abp-mh-100 {
1954
+ transition:max-height 1s linear;
1955
+ max-height: 100vh;
1956
+ }
1957
+
1958
+ [class^="sorting"] {
1959
+ opacity: .3;
1960
+ cursor: pointer;
1961
+ }
1962
+ [class^="sorting"]:before {
1963
+ right: 0.5rem;
1964
+ content: "↑";
1965
+ }
1966
+ [class^="sorting"]:after {
1967
+ right: 0.5rem;
1968
+ content: "↓";
1969
+ }
1970
+
1971
+ .sorting_desc {
1972
+ opacity: 1;
1973
+ }
1974
+ .sorting_desc:before {
1975
+ opacity: .3;
1976
+ }
1977
+
1978
+ .sorting_asc {
1979
+ opacity: 1;
1980
+ }
1981
+ .sorting_asc:after {
1982
+ opacity: .3;
1983
+ }
1984
+ .ngx-datatable.material {
1985
+ box-shadow: none;
1986
+ }
1987
+ ngb-typeahead-window, ngb-typeahead-window.dropdown-menu {
1988
+ max-height: 25em;
1989
+ overflow-y: scroll !important;
1990
+ z-index: 1050;
1991
+ }
1992
+
1993
+ .abp-modal-header {
1994
+ word-break: break-word;
1995
+ }
1996
+
1997
+
1998
+ @keyframes fadeInTop {
1999
+ from {
2000
+ transform: translateY(-5px);
2001
+ opacity: 0;
2002
+ }
2003
+
2004
+ to {
2005
+ transform: translateY(0px);
2006
+ opacity: 1;
2007
+ }
2008
+ }
2009
+
2010
+ @keyframes fadeOutTop {
2011
+ to {
2012
+ transform: translateY(-5px);
2013
+ opacity: 0;
2014
+ }
2015
+ }
2016
+
2017
+ /* </animations */
2018
+ .ngb-dp-body {
2019
+ z-index: 1055 !important;
2020
+ }
2021
+ `;
2022
+
2023
+ const THEME_SHARED_APPEND_CONTENT = new InjectionToken('THEME_SHARED_APPEND_CONTENT', {
2024
+ providedIn: 'root',
2025
+ factory: () => {
2026
+ const domInsertion = inject(DomInsertionService);
2027
+ domInsertion.insertContent(CONTENT_STRATEGY.AppendStyleToHead(styles));
1768
2028
  },
1769
- defaultError403: {
1770
- title: 'You are not authorized!',
1771
- details: 'You are not allowed to perform this operation.',
1772
- },
1773
- defaultError404: {
1774
- title: 'Resource not found!',
1775
- details: 'The resource requested could not found on the server.',
1776
- },
1777
- defaultError500: {
1778
- title: 'Internal server error',
1779
- details: 'Error detail not sent by server.',
1780
- },
1781
- };
1782
- const DEFAULT_ERROR_LOCALIZATIONS = {
1783
- defaultError: {
1784
- title: 'AbpUi::DefaultErrorMessage',
1785
- details: 'AbpUi::DefaultErrorMessageDetail',
1786
- },
1787
- defaultError401: {
1788
- title: 'AbpUi::DefaultErrorMessage401',
1789
- details: 'AbpUi::DefaultErrorMessage401Detail',
1790
- },
1791
- defaultError403: {
1792
- title: 'AbpUi::DefaultErrorMessage403',
1793
- details: 'AbpUi::DefaultErrorMessage403Detail',
1794
- },
1795
- defaultError404: {
1796
- title: 'AbpUi::DefaultErrorMessage404',
1797
- details: 'AbpUi::DefaultErrorMessage404Detail',
1798
- },
1799
- defaultError500: {
1800
- title: 'AbpUi::500Message',
1801
- details: 'AbpUi::DefaultErrorMessage',
1802
- },
1803
- };
1804
- class ErrorHandler {
1805
- constructor(injector) {
1806
- this.injector = injector;
1807
- this.componentRef = null;
1808
- this.httpErrorHandler = this.injector.get(HTTP_ERROR_HANDLER, (_, err) => throwError(err));
1809
- this.executeErrorHandler = (error) => {
1810
- const errHandler = this.httpErrorHandler(this.injector, error);
1811
- const isObservable = errHandler instanceof Observable;
1812
- const response = isObservable ? errHandler : of(null);
1813
- return response.pipe(catchError(err => {
1814
- this.handleError(err);
1815
- return of(null);
1816
- }));
1817
- };
1818
- this.filterRestErrors = ({ status }) => {
1819
- if (typeof status !== 'number')
1820
- return false;
1821
- return (!!this.httpErrorConfig.skipHandledErrorCodes &&
1822
- this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === status) < 0);
1823
- };
1824
- this.filterRouteErrors = (navigationError) => {
1825
- return (navigationError.error?.message?.indexOf('Cannot match') > -1 &&
1826
- !!this.httpErrorConfig.skipHandledErrorCodes &&
1827
- this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === 404) < 0);
1828
- };
1829
- this.httpErrorReporter = injector.get(HttpErrorReporterService);
1830
- this.routerEvents = injector.get(RouterEvents);
1831
- this.confirmationService = injector.get(ConfirmationService);
1832
- this.cfRes = injector.get(ComponentFactoryResolver);
1833
- this.rendererFactory = injector.get(RendererFactory2);
1834
- this.httpErrorConfig = injector.get('HTTP_ERROR_CONFIG');
1835
- this.authService = this.injector.get(AuthService);
1836
- this.sessionStateService = this.injector.get(SessionStateService);
1837
- this.listenToRestError();
1838
- this.listenToRouterError();
1839
- this.listenToRouterDataResolved();
1840
- }
1841
- listenToRouterError() {
1842
- this.routerEvents
1843
- .getNavigationEvents('Error')
1844
- .pipe(filter(this.filterRouteErrors))
1845
- .subscribe(() => this.show404Page());
1846
- }
1847
- listenToRouterDataResolved() {
1848
- this.routerEvents
1849
- .getEvents(ResolveEnd)
1850
- .pipe(filter(() => !!this.componentRef))
1851
- .subscribe(() => {
1852
- this.componentRef?.destroy();
1853
- this.componentRef = null;
1854
- });
1855
- }
1856
- listenToRestError() {
1857
- this.httpErrorReporter.reporter$
1858
- .pipe(filter(this.filterRestErrors), switchMap(this.executeErrorHandler))
1859
- .subscribe();
1860
- }
1861
- handleError(err) {
1862
- const body = err?.error?.error || {
1863
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
1864
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
1865
- };
1866
- if (err instanceof HttpErrorResponse && err.headers.get('Abp-Tenant-Resolve-Error')) {
1867
- this.sessionStateService.setTenant(null);
1868
- this.authService.logout().subscribe();
1869
- return;
1870
- }
1871
- if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) {
1872
- const confirmation$ = this.showErrorWithRequestBody(body);
1873
- if (err.status === 401) {
1874
- confirmation$.subscribe(() => {
1875
- this.navigateToLogin();
1876
- });
1877
- }
1878
- }
1879
- else {
1880
- switch (err.status) {
1881
- case 401:
1882
- this.canCreateCustomError(401)
1883
- ? this.show401Page()
1884
- : this.showError({
1885
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title,
1886
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title,
1887
- }, {
1888
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.details,
1889
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details,
1890
- }).subscribe(() => this.navigateToLogin());
1891
- break;
1892
- case 403:
1893
- this.createErrorComponent({
1894
- title: {
1895
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.title,
1896
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.title,
1897
- },
1898
- details: {
1899
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.details,
1900
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.details,
1901
- },
1902
- status: 403,
1903
- });
1904
- break;
1905
- case 404:
1906
- this.canCreateCustomError(404)
1907
- ? this.show404Page()
1908
- : this.showError({
1909
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.details,
1910
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.details,
1911
- }, {
1912
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title,
1913
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title,
1914
- });
1915
- break;
1916
- case 500:
1917
- this.createErrorComponent({
1918
- title: {
1919
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.title,
1920
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.title,
1921
- },
1922
- details: {
1923
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.details,
1924
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.details,
1925
- },
1926
- status: 500,
1927
- });
1928
- break;
1929
- case 0:
1930
- if (err.statusText === 'Unknown Error') {
1931
- this.createErrorComponent({
1932
- title: {
1933
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
1934
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
1935
- },
1936
- details: err.message,
1937
- isHomeShow: false,
1938
- });
1939
- }
1940
- break;
1941
- default:
1942
- this.showError({
1943
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.details,
1944
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.details,
1945
- }, {
1946
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
1947
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
1948
- });
1949
- break;
1950
- }
1951
- }
1952
- }
1953
- show401Page() {
1954
- this.createErrorComponent({
1955
- title: {
1956
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title,
1957
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title,
1958
- },
1959
- status: 401,
1960
- });
1961
- }
1962
- show404Page() {
1963
- this.createErrorComponent({
1964
- title: {
1965
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title,
1966
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title,
1967
- },
1968
- status: 404,
1969
- });
1970
- }
1971
- showErrorWithRequestBody(body) {
1972
- let message;
1973
- let title;
1974
- if (body.details) {
1975
- message = body.details;
1976
- title = body.message;
1977
- }
1978
- else if (body.message) {
1979
- title = {
1980
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
1981
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
1982
- };
1983
- message = body.message;
1984
- }
1985
- else {
1986
- message = body.message || {
1987
- key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
1988
- defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
1989
- };
1990
- title = '';
1991
- }
1992
- return this.showError(message, title);
1993
- }
1994
- showError(message, title) {
1995
- return this.confirmationService.error(message, title, {
1996
- hideCancelBtn: true,
1997
- yesText: 'AbpAccount::Close',
1998
- });
1999
- }
2000
- navigateToLogin() {
2001
- this.authService.navigateToLogin();
2002
- }
2003
- createErrorComponent(instance) {
2004
- const renderer = this.rendererFactory.createRenderer(null, null);
2005
- const host = renderer.selectRootElement(document.body, true);
2006
- this.componentRef = this.cfRes
2007
- .resolveComponentFactory(HttpErrorWrapperComponent)
2008
- .create(this.injector);
2009
- for (const key in instance) {
2010
- /* istanbul ignore else */
2011
- if (Object.prototype.hasOwnProperty.call(this.componentRef.instance, key)) {
2012
- this.componentRef.instance[key] = instance[key];
2013
- }
2014
- }
2015
- this.componentRef.instance.hideCloseIcon = !!this.httpErrorConfig.errorScreen?.hideCloseIcon;
2016
- const appRef = this.injector.get(ApplicationRef);
2017
- if (this.canCreateCustomError(instance.status)) {
2018
- this.componentRef.instance.cfRes = this.cfRes;
2019
- this.componentRef.instance.appRef = appRef;
2020
- this.componentRef.instance.injector = this.injector;
2021
- this.componentRef.instance.customComponent = this.httpErrorConfig.errorScreen?.component;
2022
- }
2023
- appRef.attachView(this.componentRef.hostView);
2024
- renderer.appendChild(host, this.componentRef.hostView.rootNodes[0]);
2025
- const destroy$ = new Subject();
2026
- this.componentRef.instance.destroy$ = destroy$;
2027
- destroy$.subscribe(() => {
2028
- this.componentRef?.destroy();
2029
- this.componentRef = null;
2030
- });
2031
- }
2032
- canCreateCustomError(status) {
2033
- return !!(this.httpErrorConfig?.errorScreen?.component &&
2034
- this.httpErrorConfig?.errorScreen?.forWhichErrors &&
2035
- this.httpErrorConfig?.errorScreen?.forWhichErrors.indexOf(status) > -1);
2036
- }
2037
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2038
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, providedIn: 'root' }); }
2039
- }
2040
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, decorators: [{
2041
- type: Injectable,
2042
- args: [{ providedIn: 'root' }]
2043
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2029
+ });
2044
2030
 
2045
2031
  class NavItem {
2046
2032
  constructor(props) {
@@ -2048,40 +2034,6 @@ class NavItem {
2048
2034
  }
2049
2035
  }
2050
2036
 
2051
- class UserMenu extends NavItem {
2052
- }
2053
-
2054
- const NG_BOOTSTRAP_CONFIG_PROVIDERS = [
2055
- {
2056
- provide: APP_INITIALIZER,
2057
- useFactory: configureNgBootstrap,
2058
- deps: [NgbInputDatepickerConfig, NgbTypeaheadConfig],
2059
- multi: true,
2060
- },
2061
- ];
2062
- function configureNgBootstrap(datepicker, typeahead) {
2063
- return () => {
2064
- datepicker.container = 'body';
2065
- typeahead.container = 'body';
2066
- };
2067
- }
2068
-
2069
- const THEME_SHARED_ROUTE_PROVIDERS = [
2070
- { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },
2071
- ];
2072
- function configureRoutes(routesService) {
2073
- return () => {
2074
- routesService.add([
2075
- {
2076
- path: undefined,
2077
- name: "AbpUiNavigation::Menu:Administration" /* eThemeSharedRouteNames.Administration */,
2078
- iconClass: 'fa fa-wrench',
2079
- order: 100,
2080
- },
2081
- ]);
2082
- };
2083
- }
2084
-
2085
2037
  class AbstractMenuService {
2086
2038
  constructor() {
2087
2039
  this._items$ = new BehaviorSubject([]);
@@ -2266,6 +2218,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
2266
2218
  }]
2267
2219
  }], ctorParameters: function () { return [{ type: i2.ContentProjectionService }]; } });
2268
2220
 
2221
+ class UserMenu extends NavItem {
2222
+ }
2223
+
2269
2224
  class UserMenuService extends AbstractMenuService {
2270
2225
  constructor() {
2271
2226
  super(...arguments);
@@ -2279,200 +2234,433 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
2279
2234
  args: [{ providedIn: 'root' }]
2280
2235
  }] });
2281
2236
 
2282
- var styles = `
2283
- .is-invalid .form-control {
2284
- border-color: #dc3545;
2285
- border-style: solid !important;
2286
- padding-right: calc(1.5em + .75rem);
2287
- background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e);
2288
- background-repeat: no-repeat;
2289
- background-position: right calc(.375em + .1875rem) center;
2290
- background-size: calc(.75em + .375rem) calc(.75em + .375rem);
2291
- }
2292
-
2293
- .is-invalid .invalid-feedback,
2294
- .is-invalid + * .invalid-feedback {
2295
- display: block;
2296
- }
2297
-
2298
- .data-tables-filter {
2299
- text-align: right;
2300
- }
2301
-
2302
- [dir=rtl] .data-tables-filter {
2303
- text-align: left;
2304
- }
2305
-
2306
- .pointer {
2307
- cursor: pointer;
2308
- }
2309
-
2310
- .navbar .dropdown-submenu a::after {
2311
- transform: rotate(-90deg);
2312
- position: absolute;
2313
- right: 16px;
2314
- top: 18px;
2315
- }
2316
-
2317
- .navbar .dropdown-menu {
2318
- min-width: 215px;
2319
- }
2320
-
2321
- .datatable-scroll {
2322
- margin-bottom: 5px !important;
2323
- width: unset !important;
2324
- }
2325
-
2326
- .ui-table-scrollable-body::-webkit-scrollbar {
2327
- height: 5px !important;
2328
- width: 5px !important;
2329
- }
2330
-
2331
- .ui-table-scrollable-body::-webkit-scrollbar-track {
2332
- background: #ddd;
2333
- }
2334
-
2335
- .ui-table-scrollable-body::-webkit-scrollbar-thumb {
2336
- background: #8a8686;
2337
- }
2338
-
2339
- .abp-ellipsis-inline {
2340
- display: inline-block;
2341
- overflow: hidden;
2342
- text-overflow: ellipsis;
2343
- white-space: nowrap;
2344
- }
2345
-
2346
- .abp-ellipsis {
2347
- overflow: hidden !important;
2348
- text-overflow: ellipsis;
2349
- white-space: nowrap;
2350
- }
2351
-
2352
- .ui-widget-overlay {
2353
- z-index: 1000;
2354
- }
2355
-
2356
- .color-white {
2357
- color: #FFF !important;
2358
- }
2359
-
2360
- .custom-checkbox > label {
2361
- cursor: pointer;
2362
- }
2363
-
2364
- /* <animations */
2365
-
2366
- .fade-in-top {
2367
- animation: fadeInTop 0.2s ease-in-out;
2368
- }
2369
-
2370
- .fade-out-top {
2371
- animation: fadeOutTop 0.2s ease-in-out;
2372
- }
2373
-
2374
- .abp-collapsed-height {
2375
- -moz-transition: max-height linear 0.35s;
2376
- -ms-transition: max-height linear 0.35s;
2377
- -o-transition: max-height linear 0.35s;
2378
- -webkit-transition: max-height linear 0.35s;
2379
- overflow:hidden;
2380
- transition:max-height 0.35s linear;
2381
- height:auto;
2382
- max-height: 0;
2383
- }
2384
-
2385
- .abp-mh-25 {
2386
- max-height: 25vh;
2387
- }
2388
-
2389
- .abp-mh-50 {
2390
- transition:max-height 0.65s linear;
2391
- max-height: 50vh;
2392
- }
2393
-
2394
- .abp-mh-75 {
2395
- transition:max-height 0.85s linear;
2396
- max-height: 75vh;
2397
- }
2398
-
2399
- .abp-mh-100 {
2400
- transition:max-height 1s linear;
2401
- max-height: 100vh;
2402
- }
2403
-
2404
- [class^="sorting"] {
2405
- opacity: .3;
2406
- cursor: pointer;
2407
- }
2408
- [class^="sorting"]:before {
2409
- right: 0.5rem;
2410
- content: "↑";
2411
- }
2412
- [class^="sorting"]:after {
2413
- right: 0.5rem;
2414
- content: "↓";
2415
- }
2416
-
2417
- .sorting_desc {
2418
- opacity: 1;
2419
- }
2420
- .sorting_desc:before {
2421
- opacity: .3;
2422
- }
2423
-
2424
- .sorting_asc {
2425
- opacity: 1;
2426
- }
2427
- .sorting_asc:after {
2428
- opacity: .3;
2429
- }
2430
- .ngx-datatable.material {
2431
- box-shadow: none;
2432
- }
2433
- ngb-typeahead-window, ngb-typeahead-window.dropdown-menu {
2434
- max-height: 25em;
2435
- overflow-y: scroll !important;
2436
- z-index: 1050;
2437
- }
2438
-
2439
- .abp-modal-header {
2440
- word-break: break-word;
2441
- }
2442
-
2443
-
2444
- @keyframes fadeInTop {
2445
- from {
2446
- transform: translateY(-5px);
2447
- opacity: 0;
2448
- }
2449
-
2450
- to {
2451
- transform: translateY(0px);
2452
- opacity: 1;
2453
- }
2454
- }
2455
-
2456
- @keyframes fadeOutTop {
2457
- to {
2458
- transform: translateY(-5px);
2459
- opacity: 0;
2460
- }
2461
- }
2462
-
2463
- /* </animations */
2464
- .ngb-dp-body {
2465
- z-index: 1055 !important;
2466
- }
2467
- `;
2237
+ class CreateErrorComponentService {
2238
+ getErrorHostElement() {
2239
+ return document.body;
2240
+ }
2241
+ canCreateCustomError(status) {
2242
+ return !!(this.httpErrorConfig?.errorScreen?.component &&
2243
+ this.httpErrorConfig?.errorScreen?.forWhichErrors &&
2244
+ this.httpErrorConfig?.errorScreen?.forWhichErrors.indexOf(status) > -1);
2245
+ }
2246
+ constructor() {
2247
+ this.rendererFactory = inject(RendererFactory2);
2248
+ this.cfRes = inject(ComponentFactoryResolver);
2249
+ this.routerEvents = inject(RouterEvents);
2250
+ this.injector = inject(Injector);
2251
+ this.httpErrorConfig = inject(HTTP_ERROR_CONFIG);
2252
+ this.componentRef = null;
2253
+ this.listenToRouterDataResolved();
2254
+ }
2255
+ listenToRouterDataResolved() {
2256
+ this.routerEvents
2257
+ .getEvents(ResolveEnd)
2258
+ .pipe(filter(() => !!this.componentRef))
2259
+ .subscribe(() => {
2260
+ this.componentRef?.destroy();
2261
+ this.componentRef = null;
2262
+ });
2263
+ }
2264
+ isCloseIconHidden() {
2265
+ return !!this.httpErrorConfig.errorScreen?.hideCloseIcon;
2266
+ }
2267
+ execute(instance) {
2268
+ const renderer = this.rendererFactory.createRenderer(null, null);
2269
+ const hostElement = this.getErrorHostElement();
2270
+ const host = renderer.selectRootElement(hostElement, true);
2271
+ this.componentRef = this.cfRes
2272
+ .resolveComponentFactory(HttpErrorWrapperComponent)
2273
+ .create(this.injector);
2274
+ for (const key in instance) {
2275
+ /* istanbul ignore else */
2276
+ if (Object.prototype.hasOwnProperty.call(this.componentRef.instance, key)) {
2277
+ this.componentRef.instance[key] = instance[key];
2278
+ }
2279
+ }
2280
+ this.componentRef.instance.hideCloseIcon = this.isCloseIconHidden();
2281
+ const appRef = this.injector.get(ApplicationRef);
2282
+ if (this.canCreateCustomError(instance.status)) {
2283
+ this.componentRef.instance.cfRes = this.cfRes;
2284
+ this.componentRef.instance.appRef = appRef;
2285
+ this.componentRef.instance.injector = this.injector;
2286
+ this.componentRef.instance.customComponent = this.httpErrorConfig.errorScreen?.component;
2287
+ }
2288
+ appRef.attachView(this.componentRef.hostView);
2289
+ renderer.appendChild(host, this.componentRef.hostView.rootNodes[0]);
2290
+ const destroy$ = new Subject();
2291
+ this.componentRef.instance.destroy$ = destroy$;
2292
+ destroy$.subscribe(() => {
2293
+ this.componentRef?.destroy();
2294
+ this.componentRef = null;
2295
+ });
2296
+ }
2297
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: CreateErrorComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2298
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: CreateErrorComponentService, providedIn: 'root' }); }
2299
+ }
2300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: CreateErrorComponentService, decorators: [{
2301
+ type: Injectable,
2302
+ args: [{ providedIn: 'root' }]
2303
+ }], ctorParameters: function () { return []; } });
2468
2304
 
2469
- const THEME_SHARED_APPEND_CONTENT = new InjectionToken('THEME_SHARED_APPEND_CONTENT', {
2470
- providedIn: 'root',
2471
- factory: () => {
2472
- const domInsertion = inject(DomInsertionService);
2473
- domInsertion.insertContent(CONTENT_STRATEGY.AppendStyleToHead(styles));
2305
+ function getErrorFromRequestBody(body) {
2306
+ let message;
2307
+ let title;
2308
+ if (body.details) {
2309
+ message = body.details;
2310
+ title = body.message;
2311
+ }
2312
+ else if (body.message) {
2313
+ title = {
2314
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
2315
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
2316
+ };
2317
+ message = body.message;
2318
+ }
2319
+ else {
2320
+ message = {
2321
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
2322
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
2323
+ };
2324
+ title = '';
2325
+ }
2326
+ return { message, title };
2327
+ }
2328
+
2329
+ class AbpFormatErrorHandlerService {
2330
+ constructor() {
2331
+ this.priority = CUSTOM_HTTP_ERROR_HANDLER_PRIORITY.high;
2332
+ this.confirmationService = inject(ConfirmationService);
2333
+ this.authService = inject(AuthService);
2334
+ this.error = undefined;
2335
+ }
2336
+ navigateToLogin() {
2337
+ return this.authService.navigateToLogin();
2338
+ }
2339
+ canHandle(error) {
2340
+ if (error instanceof HttpErrorResponse && error.headers.get('_AbpErrorFormat')) {
2341
+ this.error = error;
2342
+ return true;
2343
+ }
2344
+ return false;
2345
+ }
2346
+ execute() {
2347
+ const { message, title } = getErrorFromRequestBody(this.error?.error?.error);
2348
+ this.confirmationService
2349
+ .error(message, title, {
2350
+ hideCancelBtn: true,
2351
+ yesText: 'AbpAccount::Close',
2352
+ })
2353
+ .subscribe(() => {
2354
+ if (this.error?.status === 401) {
2355
+ this.navigateToLogin();
2356
+ }
2357
+ });
2358
+ }
2359
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpFormatErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2360
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpFormatErrorHandlerService, providedIn: 'root' }); }
2361
+ }
2362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: AbpFormatErrorHandlerService, decorators: [{
2363
+ type: Injectable,
2364
+ args: [{ providedIn: 'root' }]
2365
+ }] });
2366
+
2367
+ class TenantResolveErrorHandlerService {
2368
+ constructor() {
2369
+ this.sessionService = inject(SessionStateService);
2370
+ this.priority = CUSTOM_HTTP_ERROR_HANDLER_PRIORITY.high;
2371
+ this.authService = inject(AuthService);
2372
+ }
2373
+ isTenantResolveError(error) {
2374
+ return error instanceof HttpErrorResponse && !!error.headers.get('Abp-Tenant-Resolve-Error');
2375
+ }
2376
+ canHandle(error) {
2377
+ return this.isTenantResolveError(error);
2378
+ }
2379
+ execute() {
2380
+ this.sessionService.setTenant(null);
2381
+ this.authService.logout().subscribe();
2382
+ }
2383
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TenantResolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2384
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TenantResolveErrorHandlerService, providedIn: 'root' }); }
2385
+ }
2386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: TenantResolveErrorHandlerService, decorators: [{
2387
+ type: Injectable,
2388
+ args: [{ providedIn: 'root' }]
2389
+ }] });
2390
+
2391
+ class StatusCodeErrorHandlerService {
2392
+ constructor() {
2393
+ this.confirmationService = inject(ConfirmationService);
2394
+ this.createErrorComponentService = inject(CreateErrorComponentService);
2395
+ this.authService = inject(AuthService);
2396
+ this.priority = CUSTOM_HTTP_ERROR_HANDLER_PRIORITY.normal;
2397
+ this.handledStatusCodes = [401, 403, 404, 500];
2398
+ }
2399
+ canHandle({ status }) {
2400
+ this.status = status;
2401
+ return this.handledStatusCodes.indexOf(status) > -1;
2402
+ }
2403
+ execute() {
2404
+ const key = `defaultError${this.status}`;
2405
+ const title = {
2406
+ key: DEFAULT_ERROR_LOCALIZATIONS[key]?.title,
2407
+ defaultValue: DEFAULT_ERROR_MESSAGES[key]?.title,
2408
+ };
2409
+ const message = {
2410
+ key: DEFAULT_ERROR_LOCALIZATIONS[key]?.details,
2411
+ defaultValue: DEFAULT_ERROR_MESSAGES[key]?.details,
2412
+ };
2413
+ const canCreateCustomError = this.createErrorComponentService.canCreateCustomError(this.status);
2414
+ switch (this.status) {
2415
+ case 401:
2416
+ case 404:
2417
+ if (canCreateCustomError) {
2418
+ this.showPage();
2419
+ break;
2420
+ }
2421
+ this.showConfirmation(title, message).subscribe(() => {
2422
+ if (this.status === 401) {
2423
+ this.navigateToLogin();
2424
+ }
2425
+ });
2426
+ break;
2427
+ case 403:
2428
+ case 500:
2429
+ this.showPage();
2430
+ break;
2431
+ }
2432
+ }
2433
+ navigateToLogin() {
2434
+ this.authService.navigateToLogin();
2435
+ }
2436
+ showConfirmation(message, title) {
2437
+ return this.confirmationService.error(message, title, {
2438
+ hideCancelBtn: true,
2439
+ yesText: 'AbpAccount::Close',
2440
+ });
2441
+ }
2442
+ showPage() {
2443
+ const key = `defaultError${this.status}`;
2444
+ const instance = {
2445
+ title: {
2446
+ key: DEFAULT_ERROR_LOCALIZATIONS[key]?.title,
2447
+ defaultValue: DEFAULT_ERROR_MESSAGES[key]?.title,
2448
+ },
2449
+ details: {
2450
+ key: DEFAULT_ERROR_LOCALIZATIONS[key]?.details,
2451
+ defaultValue: DEFAULT_ERROR_MESSAGES[key]?.details,
2452
+ },
2453
+ status: this.status,
2454
+ };
2455
+ const shouldRemoveDetail = [401, 404].indexOf(this.status) > -1;
2456
+ if (shouldRemoveDetail) {
2457
+ delete instance.details;
2458
+ }
2459
+ this.createErrorComponentService.execute(instance);
2460
+ }
2461
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StatusCodeErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2462
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StatusCodeErrorHandlerService, providedIn: 'root' }); }
2463
+ }
2464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: StatusCodeErrorHandlerService, decorators: [{
2465
+ type: Injectable,
2466
+ args: [{ providedIn: 'root' }]
2467
+ }] });
2468
+
2469
+ class UnknownStatusCodeErrorHandlerService {
2470
+ constructor() {
2471
+ this.priority = CUSTOM_HTTP_ERROR_HANDLER_PRIORITY.normal;
2472
+ this.statusText = 'Unknown Error';
2473
+ this.message = '';
2474
+ this.createErrorComponentService = inject(CreateErrorComponentService);
2475
+ }
2476
+ canHandle(error) {
2477
+ if (error && error.status === 0 && error.statusText === this.statusText) {
2478
+ this.message = error.message;
2479
+ return true;
2480
+ }
2481
+ return false;
2482
+ }
2483
+ execute() {
2484
+ this.createErrorComponentService.execute({
2485
+ title: {
2486
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
2487
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
2488
+ },
2489
+ details: this.message,
2490
+ isHomeShow: false,
2491
+ });
2492
+ }
2493
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: UnknownStatusCodeErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2494
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: UnknownStatusCodeErrorHandlerService, providedIn: 'root' }); }
2495
+ }
2496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: UnknownStatusCodeErrorHandlerService, decorators: [{
2497
+ type: Injectable,
2498
+ args: [{ providedIn: 'root' }]
2499
+ }] });
2500
+
2501
+ class RouterErrorHandlerService {
2502
+ constructor() {
2503
+ this.routerEvents = inject(RouterEvents);
2504
+ this.httpErrorConfig = inject(HTTP_ERROR_CONFIG);
2505
+ this.createErrorComponentService = inject(CreateErrorComponentService);
2506
+ this.filterRouteErrors = (navigationError) => {
2507
+ return (navigationError.error?.message?.indexOf('Cannot match') > -1 &&
2508
+ !!this.httpErrorConfig.skipHandledErrorCodes &&
2509
+ this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === 404) < 0);
2510
+ };
2511
+ }
2512
+ listen() {
2513
+ this.routerEvents
2514
+ .getNavigationEvents('Error')
2515
+ .pipe(filter(this.filterRouteErrors))
2516
+ .subscribe(() => this.show404Page());
2517
+ }
2518
+ show404Page() {
2519
+ const instance = {
2520
+ title: {
2521
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title,
2522
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title,
2523
+ },
2524
+ status: 404,
2525
+ };
2526
+ this.createErrorComponentService.execute(instance);
2527
+ }
2528
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2529
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterErrorHandlerService, providedIn: 'root' }); }
2530
+ }
2531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: RouterErrorHandlerService, decorators: [{
2532
+ type: Injectable,
2533
+ args: [{ providedIn: 'root' }]
2534
+ }] });
2535
+
2536
+ class ErrorHandler {
2537
+ constructor(injector) {
2538
+ this.injector = injector;
2539
+ this.httpErrorReporter = inject(HttpErrorReporterService);
2540
+ this.confirmationService = inject(ConfirmationService);
2541
+ this.routerErrorHandlerService = inject(RouterErrorHandlerService);
2542
+ this.httpErrorConfig = inject(HTTP_ERROR_CONFIG);
2543
+ this.customErrorHandlers = inject(CUSTOM_ERROR_HANDLERS);
2544
+ this.defaultHttpErrorHandler = (_, err) => throwError(() => err);
2545
+ this.httpErrorHandler = inject(HTTP_ERROR_HANDLER, { optional: true }) || this.defaultHttpErrorHandler;
2546
+ this.executeErrorHandler = (error) => {
2547
+ const errHandler = this.httpErrorHandler(this.injector, error);
2548
+ const isObservable = errHandler instanceof Observable;
2549
+ const response = isObservable ? errHandler : of(null);
2550
+ return response.pipe(catchError(err => {
2551
+ this.handleError(err);
2552
+ return of(null);
2553
+ }));
2554
+ };
2555
+ this.filterRestErrors = ({ status }) => {
2556
+ if (typeof status !== 'number')
2557
+ return false;
2558
+ return (!!this.httpErrorConfig.skipHandledErrorCodes &&
2559
+ this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === status) < 0);
2560
+ };
2561
+ this.listenToRestError();
2562
+ this.listenToRouterError();
2563
+ }
2564
+ listenToRouterError() {
2565
+ this.routerErrorHandlerService.listen();
2566
+ }
2567
+ listenToRestError() {
2568
+ this.httpErrorReporter.reporter$
2569
+ .pipe(filter(this.filterRestErrors), switchMap(this.executeErrorHandler))
2570
+ .subscribe(err => {
2571
+ this.handleError(err);
2572
+ });
2573
+ }
2574
+ sortHttpErrorHandlers(a, b) {
2575
+ return (b.priority || 0) - (a.priority || 0);
2576
+ }
2577
+ handleError(err) {
2578
+ if (this.customErrorHandlers && this.customErrorHandlers.length) {
2579
+ const canHandleService = this.customErrorHandlers
2580
+ .sort(this.sortHttpErrorHandlers)
2581
+ .find(service => service.canHandle(err));
2582
+ if (canHandleService) {
2583
+ canHandleService.execute();
2584
+ return;
2585
+ }
2586
+ }
2587
+ this.showError().subscribe();
2588
+ }
2589
+ showError() {
2590
+ const title = {
2591
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title,
2592
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title,
2593
+ };
2594
+ const message = {
2595
+ key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.details,
2596
+ defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.details,
2597
+ };
2598
+ return this.confirmationService.error(message, title, {
2599
+ hideCancelBtn: true,
2600
+ yesText: 'AbpAccount::Close',
2601
+ });
2602
+ }
2603
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
2604
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, providedIn: 'root' }); }
2605
+ }
2606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: ErrorHandler, decorators: [{
2607
+ type: Injectable,
2608
+ args: [{ providedIn: 'root' }]
2609
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2610
+
2611
+ const NG_BOOTSTRAP_CONFIG_PROVIDERS = [
2612
+ {
2613
+ provide: APP_INITIALIZER,
2614
+ useFactory: configureNgBootstrap,
2615
+ deps: [NgbInputDatepickerConfig, NgbTypeaheadConfig],
2616
+ multi: true,
2474
2617
  },
2475
- });
2618
+ ];
2619
+ function configureNgBootstrap(datepicker, typeahead) {
2620
+ return () => {
2621
+ datepicker.container = 'body';
2622
+ typeahead.container = 'body';
2623
+ };
2624
+ }
2625
+
2626
+ const THEME_SHARED_ROUTE_PROVIDERS = [
2627
+ { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },
2628
+ ];
2629
+ function configureRoutes(routesService) {
2630
+ return () => {
2631
+ routesService.add([
2632
+ {
2633
+ path: undefined,
2634
+ name: "AbpUiNavigation::Menu:Administration" /* eThemeSharedRouteNames.Administration */,
2635
+ iconClass: 'fa fa-wrench',
2636
+ order: 100,
2637
+ },
2638
+ ]);
2639
+ };
2640
+ }
2641
+
2642
+ const ERROR_HANDLERS_PROVIDERS = [
2643
+ {
2644
+ provide: CUSTOM_ERROR_HANDLERS,
2645
+ multi: true,
2646
+ useClass: TenantResolveErrorHandlerService,
2647
+ },
2648
+ {
2649
+ provide: CUSTOM_ERROR_HANDLERS,
2650
+ multi: true,
2651
+ useClass: AbpFormatErrorHandlerService,
2652
+ },
2653
+ {
2654
+ provide: CUSTOM_ERROR_HANDLERS,
2655
+ multi: true,
2656
+ useClass: StatusCodeErrorHandlerService,
2657
+ },
2658
+ {
2659
+ provide: CUSTOM_ERROR_HANDLERS,
2660
+ multi: true,
2661
+ useClass: UnknownStatusCodeErrorHandlerService,
2662
+ },
2663
+ ];
2476
2664
 
2477
2665
  function isNumber(value) {
2478
2666
  return !isNaN(toInteger(value));
@@ -2543,7 +2731,7 @@ const declarationsWithExports = [
2543
2731
  ModalCloseDirective,
2544
2732
  AbpVisibleDirective,
2545
2733
  FormInputComponent,
2546
- FormCheckboxComponent
2734
+ FormCheckboxComponent,
2547
2735
  ];
2548
2736
  class BaseThemeSharedModule {
2549
2737
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.6", ngImport: i0, type: BaseThemeSharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -2615,7 +2803,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.6", ngImpor
2615
2803
  EllipsisModule,
2616
2804
  NgxValidateCoreModule,
2617
2805
  CardModule,
2618
- ...declarationsWithExports
2806
+ ...declarationsWithExports,
2619
2807
  ],
2620
2808
  providers: [DatePipe],
2621
2809
  }]
@@ -2675,6 +2863,7 @@ class ThemeSharedModule {
2675
2863
  ...(confirmationIcons || {}),
2676
2864
  },
2677
2865
  },
2866
+ ERROR_HANDLERS_PROVIDERS,
2678
2867
  ],
2679
2868
  };
2680
2869
  }
@@ -2757,5 +2946,5 @@ function validatePassword(shouldContain) {
2757
2946
  * Generated bundle index. Do not edit.
2758
2947
  */
2759
2948
 
2760
- export { AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2949
+ export { AbpFormatErrorHandlerService, AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CUSTOM_ERROR_HANDLERS, CUSTOM_HTTP_ERROR_HANDLER_PRIORITY, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, CreateErrorComponentService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, ERROR_HANDLERS_PROVIDERS, EllipsisDirective, EllipsisModule, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, InternetConnectionStatusComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, RouterErrorHandlerService, SUPPRESS_UNSAVED_CHANGES_WARNING, StatusCodeErrorHandlerService, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, TenantResolveErrorHandlerService, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UnknownStatusCodeErrorHandlerService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getErrorFromRequestBody, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2761
2950
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map