@corp-products/app-core 3.0.2 → 3.0.3
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.
- package/README.md +62 -2
- package/fesm2022/corp-products-app-core.mjs +93 -145
- package/fesm2022/corp-products-app-core.mjs.map +1 -1
- package/index.d.ts +462 -10
- package/package.json +4 -6
- package/esm2022/corp-products-app-core.mjs +0 -5
- package/esm2022/index.mjs +0 -11
- package/esm2022/lib/core/components/global-loader/global-loader.component.mjs +0 -20
- package/esm2022/lib/core/components/index.mjs +0 -2
- package/esm2022/lib/core/core-config.mjs +0 -4
- package/esm2022/lib/core/directives/index.mjs +0 -3
- package/esm2022/lib/core/directives/permissions.directive.mjs +0 -99
- package/esm2022/lib/core/directives/responsive-element.directive.mjs +0 -50
- package/esm2022/lib/core/enums/date-formatter.enum.mjs +0 -18
- package/esm2022/lib/core/enums/display-types.enum.mjs +0 -6
- package/esm2022/lib/core/enums/index.mjs +0 -5
- package/esm2022/lib/core/enums/localization.enum.mjs +0 -11
- package/esm2022/lib/core/enums/user-permissions.enum.mjs +0 -38
- package/esm2022/lib/core/guards/auth.guard.mjs +0 -14
- package/esm2022/lib/core/guards/index.mjs +0 -3
- package/esm2022/lib/core/guards/permissions.guard.mjs +0 -16
- package/esm2022/lib/core/handlers/http-context-handler.mjs +0 -12
- package/esm2022/lib/core/handlers/index.mjs +0 -4
- package/esm2022/lib/core/handlers/storage-handler.mjs +0 -33
- package/esm2022/lib/core/handlers/stortage.mjs +0 -9
- package/esm2022/lib/core/interceptors/app-http-config.mjs +0 -9
- package/esm2022/lib/core/interceptors/base-http.interceptor.mjs +0 -53
- package/esm2022/lib/core/interceptors/global-http-error.interceptor.mjs +0 -17
- package/esm2022/lib/core/interceptors/index.mjs +0 -4
- package/esm2022/lib/core/interfaces/index.mjs +0 -5
- package/esm2022/lib/core/interfaces/jwt-token-decoded.interface.mjs +0 -2
- package/esm2022/lib/core/interfaces/list-response.interface.mjs +0 -2
- package/esm2022/lib/core/interfaces/router-data.interface.mjs +0 -2
- package/esm2022/lib/core/interfaces/toaster.interface.mjs +0 -2
- package/esm2022/lib/core/interfaces/user-info.interface.mjs +0 -2
- package/esm2022/lib/core/interfaces/user-profile-data.mjs +0 -2
- package/esm2022/lib/core/services/auth.service.mjs +0 -64
- package/esm2022/lib/core/services/base-http-service/base-http-response.mjs +0 -2
- package/esm2022/lib/core/services/base-http-service/base-http-types.mjs +0 -2
- package/esm2022/lib/core/services/base-http-service/base-http-utils.mjs +0 -32
- package/esm2022/lib/core/services/base-http-service/base-http.service.mjs +0 -79
- package/esm2022/lib/core/services/base-http-service/index.mjs +0 -5
- package/esm2022/lib/core/services/base-pagination-service/base-pagination.service.mjs +0 -49
- package/esm2022/lib/core/services/base-pagination-service/index.mjs +0 -4
- package/esm2022/lib/core/services/base-pagination-service/list-options.interface.mjs +0 -2
- package/esm2022/lib/core/services/base-pagination-service/pagination.mjs +0 -8
- package/esm2022/lib/core/services/detect-device.service.mjs +0 -71
- package/esm2022/lib/core/services/error-handler.service.mjs +0 -60
- package/esm2022/lib/core/services/index.mjs +0 -10
- package/esm2022/lib/core/services/jwt-decoder.service.mjs +0 -25
- package/esm2022/lib/core/services/loader.service.mjs +0 -33
- package/esm2022/lib/core/services/lov.service.mjs +0 -26
- package/esm2022/lib/core/services/permissions.service.mjs +0 -64
- package/esm2022/lib/core/services/toaster.service.mjs +0 -67
- package/lib/core/components/global-loader/global-loader.component.d.ts +0 -9
- package/lib/core/components/index.d.ts +0 -1
- package/lib/core/core-config.d.ts +0 -17
- package/lib/core/directives/index.d.ts +0 -2
- package/lib/core/directives/permissions.directive.d.ts +0 -31
- package/lib/core/directives/responsive-element.directive.d.ts +0 -17
- package/lib/core/enums/date-formatter.enum.d.ts +0 -16
- package/lib/core/enums/display-types.enum.d.ts +0 -4
- package/lib/core/enums/index.d.ts +0 -4
- package/lib/core/enums/localization.enum.d.ts +0 -8
- package/lib/core/enums/user-permissions.enum.d.ts +0 -35
- package/lib/core/guards/auth.guard.d.ts +0 -2
- package/lib/core/guards/index.d.ts +0 -2
- package/lib/core/guards/permissions.guard.d.ts +0 -2
- package/lib/core/handlers/http-context-handler.d.ts +0 -7
- package/lib/core/handlers/index.d.ts +0 -3
- package/lib/core/handlers/storage-handler.d.ts +0 -16
- package/lib/core/handlers/stortage.d.ts +0 -7
- package/lib/core/interceptors/app-http-config.d.ts +0 -8
- package/lib/core/interceptors/base-http.interceptor.d.ts +0 -15
- package/lib/core/interceptors/global-http-error.interceptor.d.ts +0 -6
- package/lib/core/interceptors/index.d.ts +0 -3
- package/lib/core/interfaces/index.d.ts +0 -4
- package/lib/core/interfaces/jwt-token-decoded.interface.d.ts +0 -7
- package/lib/core/interfaces/list-response.interface.d.ts +0 -5
- package/lib/core/interfaces/router-data.interface.d.ts +0 -17
- package/lib/core/interfaces/toaster.interface.d.ts +0 -5
- package/lib/core/interfaces/user-info.interface.d.ts +0 -4
- package/lib/core/interfaces/user-profile-data.d.ts +0 -16
- package/lib/core/services/auth.service.d.ts +0 -19
- package/lib/core/services/base-http-service/base-http-response.d.ts +0 -14
- package/lib/core/services/base-http-service/base-http-types.d.ts +0 -37
- package/lib/core/services/base-http-service/base-http-utils.d.ts +0 -6
- package/lib/core/services/base-http-service/base-http.service.d.ts +0 -22
- package/lib/core/services/base-http-service/index.d.ts +0 -4
- package/lib/core/services/base-pagination-service/base-pagination.service.d.ts +0 -21
- package/lib/core/services/base-pagination-service/index.d.ts +0 -3
- package/lib/core/services/base-pagination-service/list-options.interface.d.ts +0 -8
- package/lib/core/services/base-pagination-service/pagination.d.ts +0 -6
- package/lib/core/services/detect-device.service.d.ts +0 -18
- package/lib/core/services/error-handler.service.d.ts +0 -13
- package/lib/core/services/index.d.ts +0 -9
- package/lib/core/services/jwt-decoder.service.d.ts +0 -11
- package/lib/core/services/loader.service.d.ts +0 -13
- package/lib/core/services/lov.service.d.ts +0 -9
- package/lib/core/services/permissions.service.d.ts +0 -20
- package/lib/core/services/toaster.service.d.ts +0 -15
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Core
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/core
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NgClass, AsyncPipe } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, InjectionToken, Inject, Injectable, Input, Component, Directive } from '@angular/core';
|
|
4
4
|
import * as i1 from '@ngx-translate/core';
|
|
@@ -7,7 +7,6 @@ import { jwtDecode } from 'jwt-decode';
|
|
|
7
7
|
import { BehaviorSubject, tap, finalize, timer, retry, Subject, fromEvent, distinctUntilChanged, debounceTime, startWith, Subscription } from 'rxjs';
|
|
8
8
|
import { map } from 'rxjs/operators';
|
|
9
9
|
import { HttpClient, HttpContextToken, HttpContext, HttpErrorResponse } from '@angular/common/http';
|
|
10
|
-
import * as i1$1 from 'primeng/api';
|
|
11
10
|
import { Router } from '@angular/router';
|
|
12
11
|
|
|
13
12
|
const PAGESIZE = 10;
|
|
@@ -19,40 +18,38 @@ var SortDirection;
|
|
|
19
18
|
})(SortDirection || (SortDirection = {}));
|
|
20
19
|
|
|
21
20
|
class BasePaginationService {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
}
|
|
21
|
+
totalRecords = 0;
|
|
22
|
+
totalPages = 0;
|
|
23
|
+
rowsChange = PAGESIZE;
|
|
24
|
+
pageSizes = PAGE_SIZE_OPTION;
|
|
25
|
+
defaultSortValue = 'createdAt';
|
|
26
|
+
defaultSortDirection = SortDirection.DESC;
|
|
27
|
+
first = 0;
|
|
28
|
+
listOptions = {
|
|
29
|
+
searchValue: '',
|
|
30
|
+
paginator: this.rowsChange,
|
|
31
|
+
page: 0,
|
|
32
|
+
direction: this.defaultSortDirection,
|
|
33
|
+
sortBy: this.defaultSortValue,
|
|
34
|
+
};
|
|
38
35
|
createListFilter(filters) {
|
|
39
36
|
this.listOptions = {
|
|
40
37
|
...this.listOptions,
|
|
41
|
-
...filters
|
|
38
|
+
...filters,
|
|
42
39
|
};
|
|
43
40
|
}
|
|
44
41
|
resetList() {
|
|
45
42
|
this.listOptions = {
|
|
46
|
-
searchValue:
|
|
43
|
+
searchValue: '',
|
|
47
44
|
paginator: this.rowsChange,
|
|
48
|
-
page: 0
|
|
45
|
+
page: 0,
|
|
49
46
|
};
|
|
50
47
|
}
|
|
51
48
|
resetPaginator() {
|
|
52
49
|
this.listOptions = {
|
|
53
50
|
...this.listOptions,
|
|
54
51
|
paginator: this.rowsChange,
|
|
55
|
-
page: 0
|
|
52
|
+
page: 0,
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
onPageChange(event) {
|
|
@@ -73,16 +70,16 @@ const setSessionStorage = (key, value) => sessionStorage.setItem(key, value);
|
|
|
73
70
|
const getSessionStorage = (key) => sessionStorage.getItem(key);
|
|
74
71
|
const clearSessionStorage = () => sessionStorage.clear();
|
|
75
72
|
class StorageHandler {
|
|
76
|
-
static
|
|
73
|
+
static local = {
|
|
77
74
|
set: (key, value) => this.setItem(key, value, setLocalStorage),
|
|
78
75
|
get: (key) => this.getItem(key, getLocalStorage),
|
|
79
76
|
clear: () => this.clearStorage(clearLocalStorage)
|
|
80
|
-
};
|
|
81
|
-
static
|
|
77
|
+
};
|
|
78
|
+
static session = {
|
|
82
79
|
set: (key, value) => this.setItem(key, value, setSessionStorage),
|
|
83
80
|
get: (key) => this.getItem(key, getSessionStorage),
|
|
84
81
|
clear: () => this.clearStorage(clearSessionStorage)
|
|
85
|
-
};
|
|
82
|
+
};
|
|
86
83
|
static setItem(key, value, set) {
|
|
87
84
|
if (!key)
|
|
88
85
|
return;
|
|
@@ -141,9 +138,7 @@ const mapResponse = (options) => map((res) => (options?.mapFn ? options.mapFn(re
|
|
|
141
138
|
const epmDefaultMapper = (res) => res.payload;
|
|
142
139
|
|
|
143
140
|
class BaseHttpService {
|
|
144
|
-
|
|
145
|
-
this.http = inject(HttpClient);
|
|
146
|
-
}
|
|
141
|
+
http = inject(HttpClient);
|
|
147
142
|
get url() {
|
|
148
143
|
const { apiUrl, microServiceUrl } = this.setApiConfig();
|
|
149
144
|
return `${microServiceUrl}${apiUrl ? `/${apiUrl}` : ''}`;
|
|
@@ -220,10 +215,11 @@ const CORE_CONFIG = new InjectionToken("CoreConfig");
|
|
|
220
215
|
const TOASTER_SERVICE = new InjectionToken("ToasterService");
|
|
221
216
|
|
|
222
217
|
class AuthService extends BaseHttpService {
|
|
218
|
+
appConfig;
|
|
219
|
+
isUserLoggedIn$ = new BehaviorSubject(this.isLoggedIn());
|
|
223
220
|
constructor(appConfig) {
|
|
224
221
|
super();
|
|
225
222
|
this.appConfig = appConfig;
|
|
226
|
-
this.isUserLoggedIn$ = new BehaviorSubject(this.isLoggedIn());
|
|
227
223
|
}
|
|
228
224
|
setApiConfig() {
|
|
229
225
|
return {
|
|
@@ -263,10 +259,10 @@ class AuthService extends BaseHttpService {
|
|
|
263
259
|
this.isUserLoggedIn$.next(false);
|
|
264
260
|
window.location.href = this.appConfig.loginUrl;
|
|
265
261
|
}
|
|
266
|
-
static
|
|
267
|
-
static
|
|
262
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AuthService, deps: [{ token: CORE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
263
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AuthService, providedIn: "root" });
|
|
268
264
|
}
|
|
269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AuthService, decorators: [{
|
|
270
266
|
type: Injectable,
|
|
271
267
|
args: [{
|
|
272
268
|
providedIn: "root"
|
|
@@ -277,8 +273,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
277
273
|
}] }] });
|
|
278
274
|
|
|
279
275
|
class JwtDecoderService {
|
|
276
|
+
authService = inject(AuthService);
|
|
277
|
+
decodedToken;
|
|
280
278
|
constructor() {
|
|
281
|
-
this.authService = inject(AuthService);
|
|
282
279
|
this.decodeToken();
|
|
283
280
|
}
|
|
284
281
|
decodeToken() {
|
|
@@ -287,10 +284,10 @@ class JwtDecoderService {
|
|
|
287
284
|
this.decodedToken = jwtDecode(token);
|
|
288
285
|
}
|
|
289
286
|
}
|
|
290
|
-
static
|
|
291
|
-
static
|
|
287
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: JwtDecoderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
288
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: JwtDecoderService, providedIn: "root" });
|
|
292
289
|
}
|
|
293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: JwtDecoderService, decorators: [{
|
|
294
291
|
type: Injectable,
|
|
295
292
|
args: [{
|
|
296
293
|
providedIn: "root"
|
|
@@ -318,10 +315,8 @@ class HttpContextHandler {
|
|
|
318
315
|
}
|
|
319
316
|
|
|
320
317
|
class LoaderService {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this.loadingMap = new Map();
|
|
324
|
-
}
|
|
318
|
+
isLoading$ = new BehaviorSubject({ show: false });
|
|
319
|
+
loadingMap = new Map();
|
|
325
320
|
setLoading(loading, isSystemLoader = true, url) {
|
|
326
321
|
if (!url) {
|
|
327
322
|
throw new Error("The request URL must be provided to the LoaderService.setLoading function");
|
|
@@ -337,10 +332,10 @@ class LoaderService {
|
|
|
337
332
|
this.isLoading$.next({ show: false });
|
|
338
333
|
}
|
|
339
334
|
}
|
|
340
|
-
static
|
|
341
|
-
static
|
|
335
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
336
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: LoaderService, providedIn: "root" });
|
|
342
337
|
}
|
|
343
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: LoaderService, decorators: [{
|
|
344
339
|
type: Injectable,
|
|
345
340
|
args: [{
|
|
346
341
|
providedIn: "root"
|
|
@@ -348,10 +343,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
348
343
|
}] });
|
|
349
344
|
|
|
350
345
|
class HttpBaseInterceptor {
|
|
346
|
+
appConfig;
|
|
347
|
+
authService = inject(AuthService);
|
|
348
|
+
loaderService = inject(LoaderService);
|
|
351
349
|
constructor(appConfig) {
|
|
352
350
|
this.appConfig = appConfig;
|
|
353
|
-
this.authService = inject(AuthService);
|
|
354
|
-
this.loaderService = inject(LoaderService);
|
|
355
351
|
}
|
|
356
352
|
intercept(request, next) {
|
|
357
353
|
console.log("interceptor", this.appConfig);
|
|
@@ -383,10 +379,10 @@ class HttpBaseInterceptor {
|
|
|
383
379
|
// }
|
|
384
380
|
}), finalize(() => this.loaderService.setLoading(false, IS_SYSTEM_LOADER_CHECK, request.url)));
|
|
385
381
|
}
|
|
386
|
-
static
|
|
387
|
-
static
|
|
382
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: HttpBaseInterceptor, deps: [{ token: CORE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
383
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: HttpBaseInterceptor });
|
|
388
384
|
}
|
|
389
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: HttpBaseInterceptor, decorators: [{
|
|
390
386
|
type: Injectable
|
|
391
387
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
392
388
|
type: Inject,
|
|
@@ -421,10 +417,10 @@ class ListOfValues extends BaseHttpService {
|
|
|
421
417
|
urlPostfix: group
|
|
422
418
|
});
|
|
423
419
|
}
|
|
424
|
-
static
|
|
425
|
-
static
|
|
420
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ListOfValues, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
421
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ListOfValues, providedIn: 'root' });
|
|
426
422
|
}
|
|
427
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ListOfValues, decorators: [{
|
|
428
424
|
type: Injectable,
|
|
429
425
|
args: [{
|
|
430
426
|
providedIn: 'root'
|
|
@@ -432,6 +428,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
432
428
|
}] });
|
|
433
429
|
|
|
434
430
|
class ErrorHandlerService {
|
|
431
|
+
injector;
|
|
432
|
+
translateService;
|
|
435
433
|
constructor(injector, translateService) {
|
|
436
434
|
this.injector = injector;
|
|
437
435
|
this.translateService = translateService;
|
|
@@ -475,87 +473,22 @@ class ErrorHandlerService {
|
|
|
475
473
|
message: this.translateService.instant(messageKey),
|
|
476
474
|
});
|
|
477
475
|
}
|
|
478
|
-
static
|
|
479
|
-
static
|
|
476
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ErrorHandlerService, deps: [{ token: i0.Injector }, { token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
477
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ErrorHandlerService, providedIn: "root" });
|
|
480
478
|
}
|
|
481
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ErrorHandlerService, decorators: [{
|
|
482
480
|
type: Injectable,
|
|
483
481
|
args: [{
|
|
484
482
|
providedIn: "root"
|
|
485
483
|
}]
|
|
486
484
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i1.TranslateService }] });
|
|
487
485
|
|
|
488
|
-
class ToasterService {
|
|
489
|
-
constructor(messageService) {
|
|
490
|
-
this.messageService = messageService;
|
|
491
|
-
this.mainKey = "main-toaster";
|
|
492
|
-
}
|
|
493
|
-
showMessage(options) {
|
|
494
|
-
this.messageService.add({
|
|
495
|
-
key: options?.key ? options?.key : this.mainKey,
|
|
496
|
-
severity: options?.severity,
|
|
497
|
-
summary: options?.summary,
|
|
498
|
-
detail: options?.detail,
|
|
499
|
-
life: options?.life ?? 5000
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
showSuccess(options) {
|
|
503
|
-
this.messageService.add({
|
|
504
|
-
key: this.mainKey,
|
|
505
|
-
severity: "success",
|
|
506
|
-
summary: options?.summary,
|
|
507
|
-
detail: options?.detail,
|
|
508
|
-
life: options?.life ?? 5000
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
showError(options) {
|
|
512
|
-
this.messageService.add({
|
|
513
|
-
key: this.mainKey,
|
|
514
|
-
severity: "error",
|
|
515
|
-
summary: options?.summary,
|
|
516
|
-
detail: options?.detail,
|
|
517
|
-
life: options?.life ?? 5000
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
showInfo(options) {
|
|
521
|
-
this.messageService.add({
|
|
522
|
-
key: this.mainKey,
|
|
523
|
-
severity: "info",
|
|
524
|
-
summary: options?.summary,
|
|
525
|
-
detail: options?.detail,
|
|
526
|
-
life: options?.life ?? 5000
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
showWarning(key, summary, detail, life = 5000) {
|
|
530
|
-
this.messageService.add({
|
|
531
|
-
key: this.mainKey,
|
|
532
|
-
severity: "warn",
|
|
533
|
-
summary,
|
|
534
|
-
detail,
|
|
535
|
-
life
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
clear() {
|
|
539
|
-
this.messageService.clear(this.mainKey);
|
|
540
|
-
}
|
|
541
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: ToasterService, deps: [{ token: i1$1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
542
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: ToasterService, providedIn: "root" }); }
|
|
543
|
-
}
|
|
544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: ToasterService, decorators: [{
|
|
545
|
-
type: Injectable,
|
|
546
|
-
args: [{
|
|
547
|
-
providedIn: "root"
|
|
548
|
-
}]
|
|
549
|
-
}], ctorParameters: () => [{ type: i1$1.MessageService }] });
|
|
550
|
-
|
|
551
486
|
class PermissionsService {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
this.domainPermissions$ = this.domainPermissionsSubject.asObservable();
|
|
558
|
-
}
|
|
487
|
+
jwtDecoderService = inject(JwtDecoderService);
|
|
488
|
+
decodedToken = this.jwtDecoderService.decodedToken;
|
|
489
|
+
tokenPermissions = this.decodedToken ? this.decodedToken.permissions : [];
|
|
490
|
+
domainPermissionsSubject = new BehaviorSubject([]);
|
|
491
|
+
domainPermissions$ = this.domainPermissionsSubject.asObservable();
|
|
559
492
|
getKeyName(action) {
|
|
560
493
|
const actionsArr = action.split("_");
|
|
561
494
|
return actionsArr.splice(1, actionsArr.length - 1).join("_");
|
|
@@ -598,10 +531,10 @@ class PermissionsService {
|
|
|
598
531
|
getDomainPermissions() {
|
|
599
532
|
return this.domainPermissionsSubject.getValue();
|
|
600
533
|
}
|
|
601
|
-
static
|
|
602
|
-
static
|
|
534
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: PermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
535
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: PermissionsService, providedIn: "root" });
|
|
603
536
|
}
|
|
604
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: PermissionsService, decorators: [{
|
|
605
538
|
type: Injectable,
|
|
606
539
|
args: [{
|
|
607
540
|
providedIn: "root"
|
|
@@ -609,9 +542,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
609
542
|
}] });
|
|
610
543
|
|
|
611
544
|
class DetectDeviceService {
|
|
545
|
+
currentWidth = window.innerWidth;
|
|
546
|
+
_width$ = new Subject();
|
|
547
|
+
_agent;
|
|
612
548
|
constructor() {
|
|
613
|
-
this.currentWidth = window.innerWidth;
|
|
614
|
-
this._width$ = new Subject();
|
|
615
549
|
fromEvent(window, "resize")
|
|
616
550
|
.pipe(distinctUntilChanged(), debounceTime(200))
|
|
617
551
|
.subscribe((event) => this._handelResize(event));
|
|
@@ -665,10 +599,10 @@ class DetectDeviceService {
|
|
|
665
599
|
isAndroid() {
|
|
666
600
|
return this.agent && this.agent.toLocaleLowerCase().includes("android");
|
|
667
601
|
}
|
|
668
|
-
static
|
|
669
|
-
static
|
|
602
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: DetectDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
603
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: DetectDeviceService, providedIn: "root" });
|
|
670
604
|
}
|
|
671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: DetectDeviceService, decorators: [{
|
|
672
606
|
type: Injectable,
|
|
673
607
|
args: [{
|
|
674
608
|
providedIn: "root"
|
|
@@ -676,13 +610,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
676
610
|
}], ctorParameters: () => [] });
|
|
677
611
|
|
|
678
612
|
class GlobalLoaderComponent {
|
|
613
|
+
loaderService;
|
|
614
|
+
color;
|
|
679
615
|
constructor(loaderService) {
|
|
680
616
|
this.loaderService = loaderService;
|
|
681
617
|
}
|
|
682
|
-
static
|
|
683
|
-
static
|
|
618
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: GlobalLoaderComponent, deps: [{ token: LoaderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
619
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: GlobalLoaderComponent, isStandalone: true, selector: "global-loader", inputs: { color: "color" }, ngImport: i0, template: "@if (loaderService.isLoading$ | async; as data) {\r\n @if (data.show) {\r\n <div\r\n class=\"fixed inset-0 z-[1111] flex justify-center items-center\"\r\n [ngClass]=\"{\r\n 'bg-white/75': data?.isSystemLoader,\r\n 'absolute': !data?.isSystemLoader\r\n }\"\r\n >\r\n <div class=\"text-center flex flex-col gap-5 items-center\">\r\n <div\r\n class=\"animate-spin inline-block w-12 h-12 border-[3px] border-current border-t-transparent text-gray-800 rounded-full\">\r\n </div>\r\n <span>{{ 'loading' | translate }}</span>\r\n </div>\r\n </div>\r\n }\r\n}\r\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
684
620
|
}
|
|
685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
621
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: GlobalLoaderComponent, decorators: [{
|
|
686
622
|
type: Component,
|
|
687
623
|
args: [{ selector: "global-loader", standalone: true, imports: [AsyncPipe, NgClass, TranslatePipe], template: "@if (loaderService.isLoading$ | async; as data) {\r\n @if (data.show) {\r\n <div\r\n class=\"fixed inset-0 z-[1111] flex justify-center items-center\"\r\n [ngClass]=\"{\r\n 'bg-white/75': data?.isSystemLoader,\r\n 'absolute': !data?.isSystemLoader\r\n }\"\r\n >\r\n <div class=\"text-center flex flex-col gap-5 items-center\">\r\n <div\r\n class=\"animate-spin inline-block w-12 h-12 border-[3px] border-current border-t-transparent text-gray-800 rounded-full\">\r\n </div>\r\n <span>{{ 'loading' | translate }}</span>\r\n </div>\r\n </div>\r\n }\r\n}\r\n" }]
|
|
688
624
|
}], ctorParameters: () => [{ type: LoaderService }], propDecorators: { color: [{
|
|
@@ -787,11 +723,19 @@ var AppDirection;
|
|
|
787
723
|
})(AppDirection || (AppDirection = {}));
|
|
788
724
|
|
|
789
725
|
class HasPermissionsDirective {
|
|
726
|
+
permissionsService;
|
|
727
|
+
viewContainer;
|
|
728
|
+
templateRef;
|
|
729
|
+
_actions;
|
|
730
|
+
_key;
|
|
731
|
+
_newPermissions;
|
|
732
|
+
_isDomain;
|
|
733
|
+
isViewCreated = false;
|
|
734
|
+
subscription;
|
|
790
735
|
constructor(permissionsService, viewContainer, templateRef) {
|
|
791
736
|
this.permissionsService = permissionsService;
|
|
792
737
|
this.viewContainer = viewContainer;
|
|
793
738
|
this.templateRef = templateRef;
|
|
794
|
-
this.isViewCreated = false;
|
|
795
739
|
}
|
|
796
740
|
/**
|
|
797
741
|
* make sure that the key value looks like the UserPermissionsEnum enum
|
|
@@ -860,10 +804,10 @@ class HasPermissionsDirective {
|
|
|
860
804
|
return true;
|
|
861
805
|
return a.some((v, i) => v !== b[i]);
|
|
862
806
|
}
|
|
863
|
-
static
|
|
864
|
-
static
|
|
807
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: HasPermissionsDirective, deps: [{ token: PermissionsService }, { token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
808
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: HasPermissionsDirective, isStandalone: true, selector: "[hasPermissions]", inputs: { hasPermissions: "hasPermissions", hasPermissionsKey: "hasPermissionsKey", hasPermissionsNewPermissions: "hasPermissionsNewPermissions", hasPermissionsIsDomain: "hasPermissionsIsDomain" }, ngImport: i0 });
|
|
865
809
|
}
|
|
866
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: HasPermissionsDirective, decorators: [{
|
|
867
811
|
type: Directive,
|
|
868
812
|
args: [{
|
|
869
813
|
selector: '[hasPermissions]',
|
|
@@ -887,13 +831,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
887
831
|
* <div *responsiveElement="DisplayTypes.MOBILE_ONLY">Mobile</div>
|
|
888
832
|
* */
|
|
889
833
|
class ResponsiveElementDirective {
|
|
834
|
+
templateRef;
|
|
835
|
+
viewContainer;
|
|
836
|
+
detectDeviceServiceService;
|
|
837
|
+
displayFor;
|
|
838
|
+
resizeSubscription = new Subscription();
|
|
890
839
|
constructor(
|
|
891
840
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
892
841
|
templateRef, viewContainer, detectDeviceServiceService) {
|
|
893
842
|
this.templateRef = templateRef;
|
|
894
843
|
this.viewContainer = viewContainer;
|
|
895
844
|
this.detectDeviceServiceService = detectDeviceServiceService;
|
|
896
|
-
this.resizeSubscription = new Subscription();
|
|
897
845
|
}
|
|
898
846
|
ngOnInit() {
|
|
899
847
|
this.resizeSubscription.add(this.detectDeviceServiceService.onResize$.subscribe(this.checkWidth.bind(this)));
|
|
@@ -911,10 +859,10 @@ class ResponsiveElementDirective {
|
|
|
911
859
|
this.viewContainer.clear();
|
|
912
860
|
}
|
|
913
861
|
}
|
|
914
|
-
static
|
|
915
|
-
static
|
|
862
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ResponsiveElementDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: DetectDeviceService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
863
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: ResponsiveElementDirective, isStandalone: true, selector: "[responsiveElement]", inputs: { displayFor: ["responsiveElement", "displayFor"] }, ngImport: i0 });
|
|
916
864
|
}
|
|
917
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: ResponsiveElementDirective, decorators: [{
|
|
918
866
|
type: Directive,
|
|
919
867
|
args: [{
|
|
920
868
|
selector: "[responsiveElement]",
|
|
@@ -929,5 +877,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
929
877
|
* Generated bundle index. Do not edit.
|
|
930
878
|
*/
|
|
931
879
|
|
|
932
|
-
export { APP_HTTP_CONFIG, AppDirection, AuthService, BaseHttpService, BasePaginationService, COMMON_BASE_URL, CORE_CONFIG, DateFormatter, DetectDeviceService, DisplayTypesEnum, ErrorHandlerService, GlobalHttpErrorInterceptor, GlobalLoaderComponent, HasPermissionsDirective, HttpBaseInterceptor, HttpContextHandler, HttpRequestOptionsKeys, IS_SYSTEM_LOADER, JwtDecoderService, Language, ListOfValues, LoaderService, LocalStorageKeys, PAGESIZE, PAGE_SIZE_OPTION, PermissionsActions, PermissionsService, ResponsiveElementDirective, SessionStorageKeys, SortDirection, StorageHandler, TOASTER_SERVICE,
|
|
880
|
+
export { APP_HTTP_CONFIG, AppDirection, AuthService, BaseHttpService, BasePaginationService, COMMON_BASE_URL, CORE_CONFIG, DateFormatter, DetectDeviceService, DisplayTypesEnum, ErrorHandlerService, GlobalHttpErrorInterceptor, GlobalLoaderComponent, HasPermissionsDirective, HttpBaseInterceptor, HttpContextHandler, HttpRequestOptionsKeys, IS_SYSTEM_LOADER, JwtDecoderService, Language, ListOfValues, LoaderService, LocalStorageKeys, PAGESIZE, PAGE_SIZE_OPTION, PermissionsActions, PermissionsService, ResponsiveElementDirective, SessionStorageKeys, SortDirection, StorageHandler, TOASTER_SERVICE, USE_API_PREFIX, UserPermissionsEnum, authGuard, epmDefaultMapper, extractRequestOptions, mapResponse, permissionsGuard, resolveUrl };
|
|
933
881
|
//# sourceMappingURL=corp-products-app-core.mjs.map
|