@esfaenza/core 15.2.0
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 +24 -0
- package/components/back-top/back-top.component.d.ts +12 -0
- package/components/breadcrumb/breadcrumb.component.d.ts +15 -0
- package/components/components.module.d.ts +25 -0
- package/components/error/404/pagenotfound.component.d.ts +13 -0
- package/components/error/500/servererror.component.d.ts +17 -0
- package/components/error/Angular/angularerror.component.d.ts +24 -0
- package/components/external-page/external_pages.component.d.ts +21 -0
- package/components/index.d.ts +5 -0
- package/components/jace-login/jace-login.component.d.ts +7 -0
- package/components/navbar/modules-board/jace-modules-board.component.d.ts +13 -0
- package/components/navbar/navbar.component.d.ts +60 -0
- package/components/navbar/navbar.component.loc.d.ts +8 -0
- package/components/page/pages.component.d.ts +23 -0
- package/components/public-api.d.ts +13 -0
- package/components/redirecter/redirecter.component.d.ts +19 -0
- package/components/sidebar/sidebar.component.d.ts +39 -0
- package/components/sidebar/sidebar.component.service.d.ts +27 -0
- package/directives/directives.module.d.ts +9 -0
- package/directives/draggable/draggable.directive.d.ts +13 -0
- package/directives/index.d.ts +5 -0
- package/directives/public-api.d.ts +4 -0
- package/directives/slim-scroll/slim-scroll.directive.d.ts +15 -0
- package/directives/widget/widget.directive.d.ts +9 -0
- package/domain/index.d.ts +5 -0
- package/domain/models/core/classes/ApplicationMenu.d.ts +16 -0
- package/domain/models/core/classes/EnvOptions.d.ts +14 -0
- package/domain/models/jace/classes/AccountScope.d.ts +9 -0
- package/domain/models/jace/classes/ActiveModuleView.d.ts +15 -0
- package/domain/models/jace/classes/JaceAccount.d.ts +26 -0
- package/domain/models/jace/classes/JaceIdentity.d.ts +17 -0
- package/domain/models/jace/classes/JaceModule.d.ts +6 -0
- package/domain/models/jace/classes/JacePermission.d.ts +9 -0
- package/domain/models/jace/classes/JaceRole.d.ts +11 -0
- package/domain/models/jace/classes/User.d.ts +4 -0
- package/domain/public-api.d.ts +11 -0
- package/domain/tokens.d.ts +16 -0
- package/esm2020/components/back-top/back-top.component.mjs +43 -0
- package/esm2020/components/breadcrumb/breadcrumb.component.mjs +55 -0
- package/esm2020/components/components.module.mjs +74 -0
- package/esm2020/components/error/404/pagenotfound.component.mjs +27 -0
- package/esm2020/components/error/500/servererror.component.mjs +35 -0
- package/esm2020/components/error/Angular/angularerror.component.mjs +50 -0
- package/esm2020/components/esfaenza-core-components.mjs +5 -0
- package/esm2020/components/external-page/external_pages.component.mjs +46 -0
- package/esm2020/components/jace-login/jace-login.component.mjs +17 -0
- package/esm2020/components/navbar/modules-board/jace-modules-board.component.mjs +40 -0
- package/esm2020/components/navbar/navbar.component.loc.mjs +36 -0
- package/esm2020/components/navbar/navbar.component.mjs +179 -0
- package/esm2020/components/page/pages.component.mjs +57 -0
- package/esm2020/components/public-api.mjs +14 -0
- package/esm2020/components/redirecter/redirecter.component.mjs +53 -0
- package/esm2020/components/sidebar/sidebar.component.mjs +179 -0
- package/esm2020/components/sidebar/sidebar.component.service.mjs +58 -0
- package/esm2020/directives/directives.module.mjs +18 -0
- package/esm2020/directives/draggable/draggable.directive.mjs +48 -0
- package/esm2020/directives/esfaenza-core-directives.mjs +5 -0
- package/esm2020/directives/public-api.mjs +5 -0
- package/esm2020/directives/slim-scroll/slim-scroll.directive.mjs +40 -0
- package/esm2020/directives/widget/widget.directive.mjs +36 -0
- package/esm2020/domain/esfaenza-core-domain.mjs +5 -0
- package/esm2020/domain/models/core/classes/ApplicationMenu.mjs +26 -0
- package/esm2020/domain/models/core/classes/EnvOptions.mjs +4 -0
- package/esm2020/domain/models/jace/classes/AccountScope.mjs +8 -0
- package/esm2020/domain/models/jace/classes/ActiveModuleView.mjs +9 -0
- package/esm2020/domain/models/jace/classes/JaceAccount.mjs +5 -0
- package/esm2020/domain/models/jace/classes/JaceIdentity.mjs +16 -0
- package/esm2020/domain/models/jace/classes/JaceModule.mjs +3 -0
- package/esm2020/domain/models/jace/classes/JacePermission.mjs +3 -0
- package/esm2020/domain/models/jace/classes/JaceRole.mjs +3 -0
- package/esm2020/domain/models/jace/classes/User.mjs +3 -0
- package/esm2020/domain/public-api.mjs +12 -0
- package/esm2020/domain/tokens.mjs +11 -0
- package/esm2020/esfaenza-core.mjs +5 -0
- package/esm2020/helpers/classes/ResizeListener.mjs +38 -0
- package/esm2020/helpers/esfaenza-core-helpers.mjs +5 -0
- package/esm2020/helpers/public-api.mjs +2 -0
- package/esm2020/lib/app.component.mjs +26 -0
- package/esm2020/lib/core.module.mjs +227 -0
- package/esm2020/modules/classes/_base.module.mjs +27 -0
- package/esm2020/modules/classes/t_c.module.mjs +85 -0
- package/esm2020/modules/esfaenza-core-modules.mjs +5 -0
- package/esm2020/modules/public-api.mjs +3 -0
- package/esm2020/pipes/esfaenza-core-pipes.mjs +5 -0
- package/esm2020/pipes/included_in/included_in.pipe.mjs +17 -0
- package/esm2020/pipes/pipes.module.mjs +20 -0
- package/esm2020/pipes/public-api.mjs +7 -0
- package/esm2020/pipes/safe_html/safe_html.pipe.mjs +18 -0
- package/esm2020/pipes/safe_script/safe_script.pipe.mjs +18 -0
- package/esm2020/pipes/safe_style/safe_style.pipe.mjs +18 -0
- package/esm2020/pipes/safe_url/safe_url.pipe.mjs +18 -0
- package/esm2020/public-api.mjs +4 -0
- package/esm2020/services/classes/app.accesstoken.mjs +51 -0
- package/esm2020/services/classes/app.errorhandler.mjs +41 -0
- package/esm2020/services/classes/app.event.mjs +27 -0
- package/esm2020/services/classes/app.httpextensions.loc.mjs +15 -0
- package/esm2020/services/classes/app.httpextensions.mjs +90 -0
- package/esm2020/services/classes/app.routeguard.mjs +22 -0
- package/esm2020/services/classes/app.session.mjs +33 -0
- package/esm2020/services/classes/app.state.mjs +172 -0
- package/esm2020/services/classes/preferences/app.cache.persistor.mjs +94 -0
- package/esm2020/services/classes/preferences/app.preference.persistor.mjs +94 -0
- package/esm2020/services/esfaenza-core-services.mjs +5 -0
- package/esm2020/services/public-api.mjs +10 -0
- package/fesm2015/esfaenza-core-components.mjs +870 -0
- package/fesm2015/esfaenza-core-components.mjs.map +1 -0
- package/fesm2015/esfaenza-core-directives.mjs +138 -0
- package/fesm2015/esfaenza-core-directives.mjs.map +1 -0
- package/fesm2015/esfaenza-core-domain.mjs +99 -0
- package/fesm2015/esfaenza-core-domain.mjs.map +1 -0
- package/fesm2015/esfaenza-core-helpers.mjs +44 -0
- package/fesm2015/esfaenza-core-helpers.mjs.map +1 -0
- package/fesm2015/esfaenza-core-modules.mjs +112 -0
- package/fesm2015/esfaenza-core-modules.mjs.map +1 -0
- package/fesm2015/esfaenza-core-pipes.mjs +97 -0
- package/fesm2015/esfaenza-core-pipes.mjs.map +1 -0
- package/fesm2015/esfaenza-core-services.mjs +598 -0
- package/fesm2015/esfaenza-core-services.mjs.map +1 -0
- package/fesm2015/esfaenza-core.mjs +251 -0
- package/fesm2015/esfaenza-core.mjs.map +1 -0
- package/fesm2020/esfaenza-core-components.mjs +863 -0
- package/fesm2020/esfaenza-core-components.mjs.map +1 -0
- package/fesm2020/esfaenza-core-directives.mjs +138 -0
- package/fesm2020/esfaenza-core-directives.mjs.map +1 -0
- package/fesm2020/esfaenza-core-domain.mjs +98 -0
- package/fesm2020/esfaenza-core-domain.mjs.map +1 -0
- package/fesm2020/esfaenza-core-helpers.mjs +44 -0
- package/fesm2020/esfaenza-core-helpers.mjs.map +1 -0
- package/fesm2020/esfaenza-core-modules.mjs +112 -0
- package/fesm2020/esfaenza-core-modules.mjs.map +1 -0
- package/fesm2020/esfaenza-core-pipes.mjs +97 -0
- package/fesm2020/esfaenza-core-pipes.mjs.map +1 -0
- package/fesm2020/esfaenza-core-services.mjs +595 -0
- package/fesm2020/esfaenza-core-services.mjs.map +1 -0
- package/fesm2020/esfaenza-core.mjs +251 -0
- package/fesm2020/esfaenza-core.mjs.map +1 -0
- package/helpers/classes/ResizeListener.d.ts +12 -0
- package/helpers/index.d.ts +5 -0
- package/helpers/public-api.d.ts +1 -0
- package/index.d.ts +5 -0
- package/lib/app.component.d.ts +12 -0
- package/lib/core.module.d.ts +82 -0
- package/modules/classes/_base.module.d.ts +4 -0
- package/modules/classes/t_c.module.d.ts +19 -0
- package/modules/index.d.ts +5 -0
- package/modules/public-api.d.ts +2 -0
- package/package.json +115 -0
- package/pipes/included_in/included_in.pipe.d.ts +7 -0
- package/pipes/index.d.ts +5 -0
- package/pipes/pipes.module.d.ts +11 -0
- package/pipes/public-api.d.ts +6 -0
- package/pipes/safe_html/safe_html.pipe.d.ts +10 -0
- package/pipes/safe_script/safe_script.pipe.d.ts +10 -0
- package/pipes/safe_style/safe_style.pipe.d.ts +10 -0
- package/pipes/safe_url/safe_url.pipe.d.ts +10 -0
- package/public-api.d.ts +3 -0
- package/services/classes/app.accesstoken.d.ts +15 -0
- package/services/classes/app.errorhandler.d.ts +11 -0
- package/services/classes/app.event.d.ts +10 -0
- package/services/classes/app.httpextensions.d.ts +34 -0
- package/services/classes/app.httpextensions.loc.d.ts +8 -0
- package/services/classes/app.routeguard.d.ts +10 -0
- package/services/classes/app.session.d.ts +14 -0
- package/services/classes/app.state.d.ts +59 -0
- package/services/classes/preferences/app.cache.persistor.d.ts +25 -0
- package/services/classes/preferences/app.preference.persistor.d.ts +25 -0
- package/services/index.d.ts +5 -0
- package/services/public-api.d.ts +9 -0
- package/theme/initial.scss +48 -0
- package/theme/styles/_base.scss +257 -0
- package/theme/styles/_bootstrap-override.scss +1624 -0
- package/theme/styles/_font.scss +86 -0
- package/theme/styles/_fullcalendar-override.scss +86 -0
- package/theme/styles/_libs-override.scss +97 -0
- package/theme/styles/_material-override.scss +231 -0
- package/theme/styles/_mixins.scss +50 -0
- package/theme/styles/_preloader.scss +119 -0
- package/theme/styles/_project-override.scss +2383 -0
- package/theme/styles/_variables.scss +52 -0
- package/theme/styles/skins/_blue.scss +16 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Optional, Inject } from '@angular/core';
|
|
3
|
+
import { JaceIdentity, USE_FAKE_ACCESS_TOKEN } from '@esfaenza/core/domain';
|
|
4
|
+
import * as i1 from 'ngx-cookie-service';
|
|
5
|
+
import * as i2 from '@angular/common/http';
|
|
6
|
+
import { HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
|
7
|
+
import * as i4$1 from '@angular/router';
|
|
8
|
+
import { Router } from '@angular/router';
|
|
9
|
+
import * as i1$1 from '@esfaenza/localizations';
|
|
10
|
+
import { LocalizationService } from '@esfaenza/localizations';
|
|
11
|
+
import * as i4 from '@esfaenza/extensions';
|
|
12
|
+
import { InboundMessageTypes } from '@esfaenza/extensions';
|
|
13
|
+
import { AdmMessageTypes, MK_ADM } from '@esfaenza/admin-module';
|
|
14
|
+
import * as customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
15
|
+
import * as isBetween from 'dayjs/plugin/isBetween';
|
|
16
|
+
import * as minMax from 'dayjs/plugin/minMax';
|
|
17
|
+
import * as utc from 'dayjs/plugin/utc';
|
|
18
|
+
import { Subject, of } from 'rxjs';
|
|
19
|
+
import * as i3 from '@esfaenza/signalr-notifications';
|
|
20
|
+
import * as i5 from '@esfaenza/access-control';
|
|
21
|
+
import { AccessControlRouteGuard } from '@esfaenza/access-control';
|
|
22
|
+
import * as i4$2 from '@esfaenza/preferences';
|
|
23
|
+
import { CachePersistor, PreferencesPersistor } from '@esfaenza/preferences';
|
|
24
|
+
import { map } from 'rxjs/operators';
|
|
25
|
+
|
|
26
|
+
// Angular
|
|
27
|
+
class TokenService {
|
|
28
|
+
constructor(cs, USE_FAKE_ACCESS_TOKEN) {
|
|
29
|
+
this.cs = cs;
|
|
30
|
+
this.USE_FAKE_ACCESS_TOKEN = USE_FAKE_ACCESS_TOKEN;
|
|
31
|
+
}
|
|
32
|
+
clearTokens() {
|
|
33
|
+
this.cs.delete("access_token");
|
|
34
|
+
}
|
|
35
|
+
getAccessToken() {
|
|
36
|
+
return this.USE_FAKE_ACCESS_TOKEN ? this.getFakeToken() : this.cs.get("accessToken");
|
|
37
|
+
}
|
|
38
|
+
getJaceIdentity() {
|
|
39
|
+
let token = this.USE_FAKE_ACCESS_TOKEN ? this.getFakeToken() : this.cs.get("accessToken");
|
|
40
|
+
if (!token)
|
|
41
|
+
return null;
|
|
42
|
+
let base64Url = token.split(".")[1];
|
|
43
|
+
let base64 = base64Url.replace("-", "+").replace("_", "/");
|
|
44
|
+
let tokenData = JSON.parse(decodeURIComponent(window.atob(base64).split("").map(c => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")));
|
|
45
|
+
let identity = new JaceIdentity(this.accountScope);
|
|
46
|
+
identity.IdAccount = tokenData.ACCOUNTID;
|
|
47
|
+
identity.IdUser = tokenData.USERID;
|
|
48
|
+
identity.DsUser = tokenData.USERNAME;
|
|
49
|
+
identity.FullName = tokenData.USERDESCRIPTION;
|
|
50
|
+
identity.Idtenant = tokenData.TENANT;
|
|
51
|
+
identity.TenantName = tokenData.TENANTNAME;
|
|
52
|
+
identity.ExpirationTime = new Date(tokenData.exp * 1000); //unix-epoch in secondi -> millisecondi
|
|
53
|
+
return identity;
|
|
54
|
+
}
|
|
55
|
+
//Accesstoken fittizio ma valido, per simulare la connession corretta col backend
|
|
56
|
+
getFakeToken() {
|
|
57
|
+
return "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYmYiOjE1OTA0MTU4NDYsImV4cCI6MTk5MDQyMDA2NSwiaXNzIjoiaHR0cDovL2F1dGhhcGlzdGFnaW5nYS5qYWNlLmVuZXJneXNvZnR3YXJlLnByaXYiLCJhdWQiOlsiaHR0cDovL2F1dGhhcGlzdGFnaW5nYS5qYWNlLmVuZXJneXNvZnR3YXJlLnByaXYvcmVzb3VyY2VzIiwiYXV0aGVudGljYXRpbyJdLCJjbGllbnRfaWQiOiJtZXRlcmluZ3N0YWdpbmciLCJzdWIiOiIxMDAzIiwiYXV0aF90aW1lIjoxNTkwNDE1ODQ2LCJpZHAiOiJsb2NhbCIsIkFDQ09VTlRJRCI6IjEwMDMiLCJVU0VSSUQiOiIyNTkiLCJVU0VSREVTQ1JJUFRJT04iOiJUZXN0IFVzZXIiLCJVU0VSTkFNRSI6IlRFU1QiLCJURU5BTlQiOiJGWCIsIlRFTkFOVE5BTUUiOiJGZW5peCBTcmwiLCJyb2xlIjpbIkJhY2tvZmZpY2UiLCJEYXRhIE1hbmFnZXIiLCJUcmFkaW5nIiwiUmVtaXQgTWFuYWdlciIsIlRlbmFudCBSZWFkZXIiLCJDb21wbC4gQVJFUkEgUmVhZGVyIiwiQ29tcGwuIEFSRVJBIFdyaXRlciBMMSIsIkNvbXBsLiBBUkVSQSBXcml0ZXIgTDIiLCJKYWNlIEFkbWluIl0sIk1PRFVMRSI6WyIzNiIsIjM3IiwiMTQiLCI1IiwiMzIiLCIxNSIsIjQyIiwiOCIsIjE3IiwiMTEiLCIyMSIsIjkiLCIzOCIsIjE4IiwiNyIsIjM0IiwiMTYiLCIyMCIsIjE5IiwiMSIsIjIiLCIzMSIsIjEyIiwiMTAiLCIzMyIsIjQwIiwiMjIiLCIxMyIsIjYiXSwiUEVSTUlTU0lPTiI6WyJleHRyYWN0X2RhdGEiLCJtZG1fcmVhZCIsIm1kbV9hZHZfb3AiLCJtZG1fY2ZnX2Jhc2UiLCJjcmVhdGVfdHJhZGUiLCJtZG1fbWFzc19kZWwiLCJzZW5kX2NvbW0iLCJtZG1fZmN0IiwibWRtX2NmZ19hZHYiLCJtZG1fY2ZnX3JlYWQiLCJtYW5hZ2VfZWxlIiwibWFuYWdlX2dhcyIsImNvbmZpcm1fdHJhZGUiLCJtZG1fY3VzdG9taXplIiwibmV3X2NvbW0iLCJtZG1fbWFzc19mY3QiLCJtZG1fb3AiLCJ2aWV3X2JpbGxpbmciLCJtZG1fbWFzc19vcCIsIm1kbV9hZHZfcmVhZCJdLCJqdGkiOiIwZTUzMDc1NjE2MDZlNDQ0ZTI4ODViMTFhMzE0NDQyMSIsInNjb3BlIjpbImF1dGgiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicGFzc3dvcmQiXSwiaWF0IjoxNTkwNDE2NDY1fQ.MNcphwkIwvLFDDpLaFDN3GK11lgT2aqvXa8s7bQJgdE";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
TokenService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenService, deps: [{ token: i1.CookieService }, { token: USE_FAKE_ACCESS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
61
|
+
TokenService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenService, providedIn: "root" });
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenService, decorators: [{
|
|
63
|
+
type: Injectable,
|
|
64
|
+
args: [{ providedIn: "root" }]
|
|
65
|
+
}], ctorParameters: function () {
|
|
66
|
+
return [{ type: i1.CookieService }, { type: undefined, decorators: [{
|
|
67
|
+
type: Optional
|
|
68
|
+
}, {
|
|
69
|
+
type: Inject,
|
|
70
|
+
args: [USE_FAKE_ACCESS_TOKEN]
|
|
71
|
+
}] }];
|
|
72
|
+
} });
|
|
73
|
+
|
|
74
|
+
// Angular
|
|
75
|
+
class APPErrorHandler {
|
|
76
|
+
constructor(injector) {
|
|
77
|
+
this.injector = injector;
|
|
78
|
+
}
|
|
79
|
+
handleError(error) {
|
|
80
|
+
if (this.router == null)
|
|
81
|
+
this.router = this.injector.get(Router);
|
|
82
|
+
//Ignoro eventuali errori di javascript quando il redirect è attivo
|
|
83
|
+
if (myconfig && myconfig.redirectInProgress) {
|
|
84
|
+
console.log("Javascript error on redirect in progress, ignoring this event");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
//In caso io abbia impostato succesresultmandatory nell'httprequest e questa abbia dato errore tiro fuori un exception che dev'essere mostrata come si deve
|
|
88
|
+
var newError = "";
|
|
89
|
+
if (!error.message && !error.stack)
|
|
90
|
+
newError = error;
|
|
91
|
+
else if (error instanceof HttpErrorResponse)
|
|
92
|
+
newError = error.message;
|
|
93
|
+
else
|
|
94
|
+
newError = error.stack && error.stack.length > 1000 ? error.stack.substring(0, 999) + "[...]" : error.stack;
|
|
95
|
+
var pars = { errorMessage: this.b64EncodeUnicode(newError), fromUrl: this.router.url };
|
|
96
|
+
this.router.navigate(["/anerr", pars]);
|
|
97
|
+
}
|
|
98
|
+
b64EncodeUnicode(str) {
|
|
99
|
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
|
100
|
+
// then we convert the percent encodings into raw bytes which
|
|
101
|
+
// can be fed into btoa.
|
|
102
|
+
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(("0x" + p1))));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
APPErrorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: APPErrorHandler, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
106
|
+
APPErrorHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: APPErrorHandler });
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: APPErrorHandler, decorators: [{
|
|
108
|
+
type: Injectable
|
|
109
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
110
|
+
|
|
111
|
+
// Angular
|
|
112
|
+
class OutZoneEventPlugin {
|
|
113
|
+
constructor(zone) {
|
|
114
|
+
this.zone = zone;
|
|
115
|
+
}
|
|
116
|
+
supports(eventName) {
|
|
117
|
+
return eventName.endsWith('out-zone');
|
|
118
|
+
}
|
|
119
|
+
addEventListener(element, eventName, originalHandler) {
|
|
120
|
+
let eventOriginalName = eventName.split('.')[0];
|
|
121
|
+
let standardHandler = (event) => originalHandler(event);
|
|
122
|
+
if (eventName.endsWith('out-zone'))
|
|
123
|
+
this.zone.runOutsideAngular(() => { element.addEventListener(eventOriginalName, standardHandler); });
|
|
124
|
+
else
|
|
125
|
+
element.addEventListener(eventOriginalName, standardHandler);
|
|
126
|
+
return () => element.removeEventListener(eventOriginalName, standardHandler);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
OutZoneEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OutZoneEventPlugin, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
130
|
+
OutZoneEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OutZoneEventPlugin, providedIn: 'root' });
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OutZoneEventPlugin, decorators: [{
|
|
132
|
+
type: Injectable,
|
|
133
|
+
args: [{ providedIn: 'root' }]
|
|
134
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
135
|
+
|
|
136
|
+
class HTTPServiceExtensionsLoc extends LocalizationService {
|
|
137
|
+
constructor(injector) {
|
|
138
|
+
super(injector);
|
|
139
|
+
super.set("it->en", "Il Server sembra essere offline, prova a ricaricare la pagina", ["Server seems to be offline, try to reload this page"]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
HTTPServiceExtensionsLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensionsLoc, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
143
|
+
HTTPServiceExtensionsLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensionsLoc });
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensionsLoc, decorators: [{
|
|
145
|
+
type: Injectable
|
|
146
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
147
|
+
|
|
148
|
+
class AppState {
|
|
149
|
+
constructor(lc, bts, notifications, MessageDef, intercom) {
|
|
150
|
+
this.lc = lc;
|
|
151
|
+
this.bts = bts;
|
|
152
|
+
this.notifications = notifications;
|
|
153
|
+
this.MessageDef = MessageDef;
|
|
154
|
+
this.intercom = intercom;
|
|
155
|
+
this.Embedded = false;
|
|
156
|
+
this.redirectingToLogin = false;
|
|
157
|
+
this.handlingError = false;
|
|
158
|
+
this.christmasTime = false;
|
|
159
|
+
this.halloweenTime = false;
|
|
160
|
+
this.jobsInProgress = 0;
|
|
161
|
+
this.allJobs = [];
|
|
162
|
+
this.jobWithIdsCache = {};
|
|
163
|
+
this.notifyOnCompletedJobs = true;
|
|
164
|
+
this._data = new Subject();
|
|
165
|
+
this._dataStream$ = this._data.asObservable();
|
|
166
|
+
this._subscriptions = new Map();
|
|
167
|
+
this.ModulesLocalizations = {};
|
|
168
|
+
this.setupDayjs();
|
|
169
|
+
this.setupSignalRJobListening();
|
|
170
|
+
this.JaceIdentity = null;
|
|
171
|
+
this._dataStream$.subscribe((data) => this._onEvent(data));
|
|
172
|
+
//Decide se siamo attorno a natale
|
|
173
|
+
var today = dayjs();
|
|
174
|
+
var lowerBound = dayjs("18/12/" + today.year(), "DD/MM/YYYY");
|
|
175
|
+
var upperBound = dayjs("07/01/" + (today.year() + 1), "DD/MM/YYYY");
|
|
176
|
+
this.christmasTime = today > lowerBound && today < upperBound;
|
|
177
|
+
//Decide se siamo attorno ad halloween
|
|
178
|
+
var lowerBound = dayjs("28/10/" + today.year(), "DD/MM/YYYY");
|
|
179
|
+
var upperBound = dayjs("05/11/" + today.year(), "DD/MM/YYYY");
|
|
180
|
+
this.halloweenTime = today > lowerBound && today < upperBound;
|
|
181
|
+
this.intercom.inbounds.subscribe((t) => { this.handleInboundMessage(t); });
|
|
182
|
+
}
|
|
183
|
+
registerNavigation(route) {
|
|
184
|
+
var _a, _b, _c;
|
|
185
|
+
let title = route.data["title"];
|
|
186
|
+
let internal = route.data["internalNavigation"];
|
|
187
|
+
/*
|
|
188
|
+
* Parent ({url: [{path: "{module}"}]})
|
|
189
|
+
* Parent ({url: [{path: ""}]}) (Root del modulo lazy)
|
|
190
|
+
* -> Navigazione attuale <-
|
|
191
|
+
*/
|
|
192
|
+
let module = (_c = (_b = (_a = route.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.url[0]) === null || _c === void 0 ? void 0 : _c.path;
|
|
193
|
+
let loc = module ? this.ModulesLocalizations[module] : null;
|
|
194
|
+
if (!module)
|
|
195
|
+
console.error("Impossibile estrapolare il modulo dalla navigazione (Atteso Modulo al secondo livello di parentela partendo dal componente attuale): " + route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/'));
|
|
196
|
+
this.notifyDataChanged(internal ? "menu.adjustSubNavigationTo" : "menu.adjustNavigationTo", loc ? loc.loc(title) : title);
|
|
197
|
+
}
|
|
198
|
+
handleInboundMessage(t) {
|
|
199
|
+
switch (t.type) {
|
|
200
|
+
case InboundMessageTypes.Navigation:
|
|
201
|
+
{
|
|
202
|
+
this.notifyDataChanged(t.message.sub ? "menu.adjustSubNavigationTo" : "menu.adjustNavigationTo", t.message.routeTitle);
|
|
203
|
+
this.intercom.send(AdmMessageTypes.Message, "Navigation Message Received", MK_ADM);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
setupDayjs() {
|
|
208
|
+
dayjs.extend(customParseFormat);
|
|
209
|
+
dayjs.extend(minMax);
|
|
210
|
+
dayjs.extend(isBetween);
|
|
211
|
+
dayjs.extend(utc);
|
|
212
|
+
// Require e collegamento con la localizzazione per dayjs
|
|
213
|
+
import("dayjs/locale/" + this.lc.SmallLocale + ".js").then(locale => {
|
|
214
|
+
dayjs.locale(locale);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
setupSignalRJobListening() {
|
|
218
|
+
this.notifications.observe(this.MessageDef.IN_JobProgressNotification).subscribe((ev) => {
|
|
219
|
+
var desc = ev.description + " (" + ev.user + ")";
|
|
220
|
+
let job = {
|
|
221
|
+
id: ev.instance,
|
|
222
|
+
description: desc,
|
|
223
|
+
smalldescription: desc.length > 35 ? desc.substring(0, 30) + "..." : desc,
|
|
224
|
+
percentage: this.roundToTwo(ev.progress),
|
|
225
|
+
completed: ev.type == 'Completed',
|
|
226
|
+
fileid: ev.resultfile,
|
|
227
|
+
reportid: ev.resultreport,
|
|
228
|
+
reportpars: ev.resultreportparams,
|
|
229
|
+
complexreportid: ev.resultcomplexreport
|
|
230
|
+
};
|
|
231
|
+
switch (ev.type) {
|
|
232
|
+
case "Started":
|
|
233
|
+
this.jobWithIdsCache[ev.instance] = job;
|
|
234
|
+
this.allJobs.splice(0, 0, job);
|
|
235
|
+
break;
|
|
236
|
+
case "Progress":
|
|
237
|
+
// Se mi arriva un progress di un job che non ho significa che mi sono loggato ora con dei Job in corso
|
|
238
|
+
// quindi per prima cosa devo metterlo in lista
|
|
239
|
+
if (!this.jobWithIdsCache[ev.instance]) {
|
|
240
|
+
this.jobWithIdsCache[ev.instance] = job;
|
|
241
|
+
this.allJobs.splice(0, 0, job);
|
|
242
|
+
}
|
|
243
|
+
this.jobWithIdsCache[ev.instance].percentage = this.roundToTwo(ev.progress);
|
|
244
|
+
break;
|
|
245
|
+
case "Completed":
|
|
246
|
+
if (!this.jobWithIdsCache[ev.instance]) {
|
|
247
|
+
this.jobWithIdsCache[ev.instance] = job;
|
|
248
|
+
this.allJobs.splice(0, 0, job);
|
|
249
|
+
}
|
|
250
|
+
var jobToUpdate = this.jobWithIdsCache[ev.instance];
|
|
251
|
+
jobToUpdate.percentage = 100;
|
|
252
|
+
jobToUpdate.fileid = ev.resultfile;
|
|
253
|
+
jobToUpdate.reportid = ev.resultreport;
|
|
254
|
+
jobToUpdate.reportpars = ev.resultreportparams;
|
|
255
|
+
jobToUpdate.completed = true;
|
|
256
|
+
if (this.notifyOnCompletedJobs)
|
|
257
|
+
this.notifyDataChanged("app.completedJob", jobToUpdate.description);
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
this.jobsInProgress = this.allJobs.filter(t => !t.completed).length;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
roundToTwo(num) {
|
|
264
|
+
return Math.round(num * 100) / 100;
|
|
265
|
+
}
|
|
266
|
+
getJaceIDentity() {
|
|
267
|
+
if (this.JaceIdentity)
|
|
268
|
+
return this.JaceIdentity;
|
|
269
|
+
this.JaceIdentity = this.bts.getJaceIdentity();
|
|
270
|
+
return this.JaceIdentity;
|
|
271
|
+
}
|
|
272
|
+
notifyDataChanged(event, value) {
|
|
273
|
+
this._data[event] = value;
|
|
274
|
+
this._data.next({
|
|
275
|
+
event: event,
|
|
276
|
+
data: this._data[event]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
subscribe(event, callback) {
|
|
280
|
+
var subscribers = this._subscriptions.get(event) || [];
|
|
281
|
+
subscribers.push(callback);
|
|
282
|
+
this._subscriptions.set(event, subscribers);
|
|
283
|
+
}
|
|
284
|
+
_onEvent(data) {
|
|
285
|
+
var subscribers = this._subscriptions.get(data["event"]) || [];
|
|
286
|
+
subscribers.forEach((callback) => {
|
|
287
|
+
callback.call(null, data["data"]);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
setSidebarWidth(width) {
|
|
291
|
+
this.sidebarWidth = width;
|
|
292
|
+
}
|
|
293
|
+
setHeaderHeight(height) {
|
|
294
|
+
this.headerHeight = height;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
AppState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: i3.NotificationsService }, { token: i3.BaseMessageService }, { token: i4.InterComService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
298
|
+
AppState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, providedIn: "root" });
|
|
299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, decorators: [{
|
|
300
|
+
type: Injectable,
|
|
301
|
+
args: [{ providedIn: "root" }]
|
|
302
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: i3.NotificationsService }, { type: i3.BaseMessageService }, { type: i4.InterComService }]; } });
|
|
303
|
+
class ApplicationJob {
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Angular
|
|
307
|
+
class HTTPServiceExtensions {
|
|
308
|
+
constructor(lc, tks, as, router, ac, msgs) {
|
|
309
|
+
this.lc = lc;
|
|
310
|
+
this.tks = tks;
|
|
311
|
+
this.as = as;
|
|
312
|
+
this.router = router;
|
|
313
|
+
this.ac = ac;
|
|
314
|
+
this.msgs = msgs;
|
|
315
|
+
this.lc = this.lc.generateFromType(HTTPServiceExtensionsLoc);
|
|
316
|
+
}
|
|
317
|
+
//Gestione Auth
|
|
318
|
+
retrieveAccessToken() {
|
|
319
|
+
return this.tks.getAccessToken().toString();
|
|
320
|
+
}
|
|
321
|
+
retrieveIdentity() {
|
|
322
|
+
return this.tks.getJaceIdentity();
|
|
323
|
+
}
|
|
324
|
+
//Gestione ridirezione al login / altre pagine
|
|
325
|
+
readRedirectingToLogin() {
|
|
326
|
+
return this.as.redirectingToLogin;
|
|
327
|
+
}
|
|
328
|
+
writeRedirectingToLogin(status) {
|
|
329
|
+
this.as.redirectingToLogin = status;
|
|
330
|
+
}
|
|
331
|
+
redirectToLogin() {
|
|
332
|
+
console.log("httpextensions: redirecting to login");
|
|
333
|
+
this.router.navigate(["login", { fromUrl: this.router.url }]);
|
|
334
|
+
}
|
|
335
|
+
readRedirectionStatus() {
|
|
336
|
+
return myconfig === null || myconfig === void 0 ? void 0 : myconfig.redirectInProgress;
|
|
337
|
+
}
|
|
338
|
+
writeRedirectionStatus(status) {
|
|
339
|
+
myconfig.redirectInProgress = status;
|
|
340
|
+
}
|
|
341
|
+
//Gestione error handling flag
|
|
342
|
+
readHandlingErrorStatus() {
|
|
343
|
+
return this.as.handlingError;
|
|
344
|
+
}
|
|
345
|
+
writeHandlingErrorStatus(status) {
|
|
346
|
+
this.as.handlingError = status;
|
|
347
|
+
}
|
|
348
|
+
// 444, se false passa a handleBlockingException
|
|
349
|
+
handleNotConfiguredException() {
|
|
350
|
+
if (this.ac.has("P:mdm_customize")) {
|
|
351
|
+
myconfig.redirectInProgress = true;
|
|
352
|
+
this.as.handlingError = false;
|
|
353
|
+
this.router.navigate(["pages/adm/tenantconfig"]);
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
// 400, 403, 404, 444
|
|
359
|
+
handleBlockingException(status, text) {
|
|
360
|
+
this.msgs.simpleError(status + ": " + text);
|
|
361
|
+
this.as.handlingError = false;
|
|
362
|
+
}
|
|
363
|
+
// Tutto quello che non è gestito da handleBlockingException
|
|
364
|
+
handleException(status, text) {
|
|
365
|
+
if (status == 503) {
|
|
366
|
+
this.msgs.simpleError(this.lc.loc("Il Server sembra essere offline, prova a ricaricare la pagina"));
|
|
367
|
+
this.as.handlingError = false;
|
|
368
|
+
}
|
|
369
|
+
else if (status == 542) {
|
|
370
|
+
this.msgs.simpleError(text);
|
|
371
|
+
this.as.handlingError = false;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
var st = btoa(encodeURIComponent(text).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(("0x" + p1))));
|
|
375
|
+
var pars = { statusCode: status, statusText: st, fromUrl: this.router.url };
|
|
376
|
+
this.router.navigate(["iserr", pars]);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
HTTPServiceExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: AppState }, { token: i4$1.Router }, { token: i5.AccessControlService }, { token: i4.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
381
|
+
HTTPServiceExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions });
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions, decorators: [{
|
|
383
|
+
type: Injectable
|
|
384
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: AppState }, { type: i4$1.Router }, { type: i5.AccessControlService }, { type: i4.MessageService }]; } });
|
|
385
|
+
|
|
386
|
+
// Angular
|
|
387
|
+
class SessionRetriever {
|
|
388
|
+
constructor(bts, router) {
|
|
389
|
+
this.bts = bts;
|
|
390
|
+
this.router = router;
|
|
391
|
+
}
|
|
392
|
+
/** Tenant§Account§User§ModuleId */
|
|
393
|
+
getSessionKey() {
|
|
394
|
+
if (this.SessionIdentity)
|
|
395
|
+
return this.SessionIdentity;
|
|
396
|
+
// Se non ho un id mi manca il login, quindi via di qua
|
|
397
|
+
var id = this.bts.getJaceIdentity();
|
|
398
|
+
if (!id) {
|
|
399
|
+
console.log("no identity, redirecting to login");
|
|
400
|
+
this.router.navigate(["login"]);
|
|
401
|
+
return "";
|
|
402
|
+
}
|
|
403
|
+
// TODO: FUCK THIS SHIT
|
|
404
|
+
this.SessionIdentity = "" + id.Idtenant + "§" + id.IdAccount + "§" + id.IdUser + "§" + "metering";
|
|
405
|
+
return this.SessionIdentity;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
SessionRetriever.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, deps: [{ token: TokenService }, { token: i4$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
409
|
+
SessionRetriever.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, providedIn: "root" });
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, decorators: [{
|
|
411
|
+
type: Injectable,
|
|
412
|
+
args: [{ providedIn: "root" }]
|
|
413
|
+
}], ctorParameters: function () { return [{ type: TokenService }, { type: i4$1.Router }]; } });
|
|
414
|
+
|
|
415
|
+
// Angular
|
|
416
|
+
// Chiamate ai Repository
|
|
417
|
+
const BASE_Cache_Sessions = "/api/Cache/sessions";
|
|
418
|
+
class ApplicationCachePersistor extends CachePersistor {
|
|
419
|
+
// Passo direttamente dall'HttpClient nativo in quanto non posso passare dall'HttpService dato che
|
|
420
|
+
// lui richiede il PreferencesService che richiede questa classe che richiede l'HttpService ecc ecc...
|
|
421
|
+
constructor(lc, http, tks, session) {
|
|
422
|
+
super(session);
|
|
423
|
+
this.lc = lc;
|
|
424
|
+
this.http = http;
|
|
425
|
+
this.tks = tks;
|
|
426
|
+
}
|
|
427
|
+
persist(key, item) {
|
|
428
|
+
let sk = this.session.getSessionKey();
|
|
429
|
+
if (!sk)
|
|
430
|
+
return of(false);
|
|
431
|
+
return this.http.post(this.getItemUrl(sk, key), JSON.stringify(item), { headers: this.getHeaders() });
|
|
432
|
+
}
|
|
433
|
+
recover(key) {
|
|
434
|
+
let sk = this.session.getSessionKey();
|
|
435
|
+
if (!sk)
|
|
436
|
+
return of(null);
|
|
437
|
+
return this.http.get(this.getItemUrl(sk, key), { headers: this.getHeaders() }).pipe(map((res) => {
|
|
438
|
+
var resProp = null;
|
|
439
|
+
try {
|
|
440
|
+
resProp = JSON.parse(res);
|
|
441
|
+
}
|
|
442
|
+
catch (_a) { }
|
|
443
|
+
return resProp;
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
recoverAll() {
|
|
447
|
+
let sk = this.session.getSessionKey();
|
|
448
|
+
if (!sk)
|
|
449
|
+
return of(null);
|
|
450
|
+
return this.http.get(this.getSessionUrl(sk), { headers: this.getHeaders() }).pipe(map((res) => {
|
|
451
|
+
for (var prop in res) {
|
|
452
|
+
var resProp = null;
|
|
453
|
+
try {
|
|
454
|
+
resProp = JSON.parse(res[prop]);
|
|
455
|
+
}
|
|
456
|
+
catch (_a) { }
|
|
457
|
+
res[prop] = resProp;
|
|
458
|
+
}
|
|
459
|
+
return res;
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
remove(key) {
|
|
463
|
+
let sk = this.session.getSessionKey();
|
|
464
|
+
if (!sk)
|
|
465
|
+
return of(false);
|
|
466
|
+
return this.http.delete(this.getItemUrl(sk, key), { headers: this.getHeaders() });
|
|
467
|
+
}
|
|
468
|
+
clear() {
|
|
469
|
+
let sk = this.session.getSessionKey();
|
|
470
|
+
if (!sk)
|
|
471
|
+
return of(false);
|
|
472
|
+
return this.http.delete(this.getItemsUrl(sk), { headers: this.getHeaders() });
|
|
473
|
+
}
|
|
474
|
+
getHeaders(contentType = 'application/json') {
|
|
475
|
+
return new HttpHeaders()
|
|
476
|
+
.append("Content-Type", contentType)
|
|
477
|
+
.append("Accept", "application/json")
|
|
478
|
+
.append("Authorization", "Bearer " + this.tks.getAccessToken())
|
|
479
|
+
.append("Accept-Language", this.lc.Locale);
|
|
480
|
+
}
|
|
481
|
+
getSessionUrl(sessionKey) {
|
|
482
|
+
return `${BASE_Cache_Sessions}/${sessionKey}`;
|
|
483
|
+
}
|
|
484
|
+
getItemsUrl(sessionKey) {
|
|
485
|
+
return `${this.getSessionUrl(sessionKey)}/items`;
|
|
486
|
+
}
|
|
487
|
+
getItemUrl(sessionKey, itemKey) {
|
|
488
|
+
return `${this.getItemsUrl(sessionKey)}/${itemKey}`;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
ApplicationCachePersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$2.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
492
|
+
ApplicationCachePersistor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor });
|
|
493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor, decorators: [{
|
|
494
|
+
type: Injectable
|
|
495
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$2.BaseSessionRetriever }]; } });
|
|
496
|
+
|
|
497
|
+
// Angular
|
|
498
|
+
// Chiamate ai Repository
|
|
499
|
+
const BASE_Preferences_Sessions = "/api/Preferences/sessions";
|
|
500
|
+
class ApplicationPreferencesPersistor extends PreferencesPersistor {
|
|
501
|
+
// Passo direttamente dall'HttpClient nativo in quanto non posso passare dall'HttpService dato che
|
|
502
|
+
// lui richiede il PreferencesService che richiede questa classe che richiede l'HttpService ecc ecc...
|
|
503
|
+
constructor(lc, http, tks, session) {
|
|
504
|
+
super(session);
|
|
505
|
+
this.lc = lc;
|
|
506
|
+
this.http = http;
|
|
507
|
+
this.tks = tks;
|
|
508
|
+
}
|
|
509
|
+
persist(key, item) {
|
|
510
|
+
let sk = this.session.getSessionKey();
|
|
511
|
+
if (!sk)
|
|
512
|
+
return of(false);
|
|
513
|
+
return this.http.post(this.getItemUrl(sk, key), JSON.stringify(item), { headers: this.getHeaders() });
|
|
514
|
+
}
|
|
515
|
+
recover(key) {
|
|
516
|
+
let sk = this.session.getSessionKey();
|
|
517
|
+
if (!sk)
|
|
518
|
+
return of(null);
|
|
519
|
+
return this.http.get(this.getItemUrl(sk, key), { headers: this.getHeaders() }).pipe(map((res) => {
|
|
520
|
+
var resProp = null;
|
|
521
|
+
try {
|
|
522
|
+
resProp = JSON.parse(res);
|
|
523
|
+
}
|
|
524
|
+
catch (_a) { }
|
|
525
|
+
return resProp;
|
|
526
|
+
}));
|
|
527
|
+
}
|
|
528
|
+
recoverAll() {
|
|
529
|
+
let sk = this.session.getSessionKey();
|
|
530
|
+
if (!sk)
|
|
531
|
+
return of(null);
|
|
532
|
+
return this.http.get(this.getSessionUrl(sk), { headers: this.getHeaders() }).pipe(map((res) => {
|
|
533
|
+
for (var prop in res) {
|
|
534
|
+
var resProp = null;
|
|
535
|
+
try {
|
|
536
|
+
resProp = JSON.parse(res[prop]);
|
|
537
|
+
}
|
|
538
|
+
catch (_a) { }
|
|
539
|
+
res[prop] = resProp;
|
|
540
|
+
}
|
|
541
|
+
return res;
|
|
542
|
+
}));
|
|
543
|
+
}
|
|
544
|
+
remove(key) {
|
|
545
|
+
let sk = this.session.getSessionKey();
|
|
546
|
+
if (!sk)
|
|
547
|
+
return of(false);
|
|
548
|
+
return this.http.delete(this.getItemUrl(sk, key), { headers: this.getHeaders() });
|
|
549
|
+
}
|
|
550
|
+
clear() {
|
|
551
|
+
let sk = this.session.getSessionKey();
|
|
552
|
+
if (!sk)
|
|
553
|
+
return of(false);
|
|
554
|
+
return this.http.delete(this.getItemsUrl(sk), { headers: this.getHeaders() });
|
|
555
|
+
}
|
|
556
|
+
getHeaders(contentType = 'application/json') {
|
|
557
|
+
return new HttpHeaders()
|
|
558
|
+
.append("Content-Type", contentType)
|
|
559
|
+
.append("Accept", "application/json")
|
|
560
|
+
.append("Authorization", "Bearer " + this.tks.getAccessToken())
|
|
561
|
+
.append("Accept-Language", this.lc.Locale);
|
|
562
|
+
}
|
|
563
|
+
getSessionUrl(sessionKey) {
|
|
564
|
+
return `${BASE_Preferences_Sessions}/${sessionKey}`;
|
|
565
|
+
}
|
|
566
|
+
getItemsUrl(sessionKey) {
|
|
567
|
+
return `${this.getSessionUrl(sessionKey)}/items`;
|
|
568
|
+
}
|
|
569
|
+
getItemUrl(sessionKey, itemKey) {
|
|
570
|
+
return `${this.getItemsUrl(sessionKey)}/${itemKey}`;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
ApplicationPreferencesPersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$2.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
574
|
+
ApplicationPreferencesPersistor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor });
|
|
575
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor, decorators: [{
|
|
576
|
+
type: Injectable
|
|
577
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$2.BaseSessionRetriever }]; } });
|
|
578
|
+
|
|
579
|
+
// Angular
|
|
580
|
+
class BaseRouterGuard extends AccessControlRouteGuard {
|
|
581
|
+
constructor(ms, acc, router, ts) {
|
|
582
|
+
super(ms, acc, router);
|
|
583
|
+
if (!acc.Initialized)
|
|
584
|
+
acc.initializeIdentity(ts.getJaceIdentity());
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
BaseRouterGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard, deps: [{ token: i4.MessageService }, { token: i5.AccessControlService }, { token: i4$1.Router }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
588
|
+
BaseRouterGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard });
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard, decorators: [{
|
|
590
|
+
type: Injectable
|
|
591
|
+
}], ctorParameters: function () { return [{ type: i4.MessageService }, { type: i5.AccessControlService }, { type: i4$1.Router }, { type: TokenService }]; } });
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Generated bundle index. Do not edit.
|
|
595
|
+
*/
|
|
596
|
+
|
|
597
|
+
export { APPErrorHandler, AppState, ApplicationCachePersistor, ApplicationJob, ApplicationPreferencesPersistor, BaseRouterGuard, HTTPServiceExtensions, OutZoneEventPlugin, SessionRetriever, TokenService };
|
|
598
|
+
//# sourceMappingURL=esfaenza-core-services.mjs.map
|