@arsedizioni/ars-utils 22.6.85 → 22.6.88
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/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +3158 -3344
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +7616 -4772
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs +321 -702
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs +445 -590
- package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs +1735 -2370
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +1280 -1470
- package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +1097 -1528
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs +198 -294
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.controls.date.mjs +115 -117
- package/fesm2022/arsedizioni-ars-utils-ui.controls.date.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +1607 -613
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.controls.tree.mjs +840 -367
- package/fesm2022/arsedizioni-ars-utils-ui.controls.tree.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +1634 -651
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +1255 -792
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +1410 -357
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +2401 -944
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +1553 -741
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs +901 -430
- package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.help.mjs +737 -530
- package/fesm2022/arsedizioni-ars-utils-ui.help.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.mjs +6638 -1755
- package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs +1479 -1207
- package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs +1003 -270
- package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +497 -278
- package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs +48 -52
- package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +464 -704
- package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs +724 -657
- package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils.mjs +3 -19
- package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/types/arsedizioni-ars-utils-clipper.common.d.ts +1151 -1163
- package/types/arsedizioni-ars-utils-clipper.ui.d.ts +1588 -1426
- package/types/arsedizioni-ars-utils-core.d.ts +1169 -1172
- package/types/arsedizioni-ars-utils-core.date.d.ts +204 -208
- package/types/arsedizioni-ars-utils-core.markdown.d.ts +128 -126
- package/types/arsedizioni-ars-utils-core.validators.d.ts +270 -236
- package/types/arsedizioni-ars-utils-evolution.common.d.ts +1054 -1067
- package/types/arsedizioni-ars-utils-support.common.d.ts +225 -234
- package/types/arsedizioni-ars-utils-ui.controls.d.ts +440 -278
- package/types/arsedizioni-ars-utils-ui.controls.date.d.ts +24 -28
- package/types/arsedizioni-ars-utils-ui.controls.tree.d.ts +172 -136
- package/types/arsedizioni-ars-utils-ui.d.ts +2035 -821
- package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +327 -322
- package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +343 -347
- package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +167 -167
- package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +373 -367
- package/types/arsedizioni-ars-utils-ui.files.d.ts +335 -283
- package/types/arsedizioni-ars-utils-ui.filters.d.ts +232 -160
- package/types/arsedizioni-ars-utils-ui.help.d.ts +204 -211
- package/types/arsedizioni-ars-utils-ui.navigation.d.ts +811 -646
- package/types/arsedizioni-ars-utils-ui.notifications.d.ts +74 -78
- package/types/arsedizioni-ars-utils-ui.oauth.d.ts +102 -62
- package/types/arsedizioni-ars-utils-ui.paginator.d.ts +19 -22
- package/types/arsedizioni-ars-utils-ui.shell.d.ts +376 -382
- package/types/arsedizioni-ars-utils-ui.tinymce.d.ts +244 -231
- package/types/arsedizioni-ars-utils.d.ts +1 -3
|
@@ -1,1604 +1,1173 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import { BroadcastService, SystemUtils } from
|
|
5
|
-
import {
|
|
6
|
-
import { takeUntilDestroyed } from
|
|
7
|
-
import { catchError as catchError$1,
|
|
8
|
-
|
|
1
|
+
import { HttpClient, HttpResponse } from "@angular/common/http";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { DestroyRef, Service, inject, signal } from "@angular/core";
|
|
4
|
+
import { BroadcastService, SystemUtils } from "@arsedizioni/ars-utils/core";
|
|
5
|
+
import { EMPTY, catchError, of, retry, tap, throwError, timer } from "rxjs";
|
|
6
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
7
|
+
import { catchError as catchError$1, finalize, map } from "rxjs/operators";
|
|
9
8
|
const EvolutionMessages = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* outage, however many requests were in flight, and re-armed on the first good response.
|
|
22
|
-
*
|
|
23
|
-
* Deliberately not an `ERROR`: a server being replaced is neither a failed operation to report
|
|
24
|
-
* in a dialog nor an expired session to sign out of, and the host application usually answers it
|
|
25
|
-
* with a banner that clears itself.
|
|
26
|
-
*/
|
|
27
|
-
ERROR_UNAVAILABLE: '§evo-error-unavailable',
|
|
28
|
-
SUCCESS: '§evo-success',
|
|
29
|
-
SUCCESS_TOAST: '§evo-success-toast',
|
|
30
|
-
// Login
|
|
31
|
-
LOGIN_CHANGED: '§evo-login-changed',
|
|
32
|
-
LOGIN_COMPLETED: '§evo-login-completed',
|
|
33
|
-
LOGOUT_COMPLETED: '§evo-logout-completed',
|
|
34
|
-
LOGIN_PENDING: '§evo-login-pending',
|
|
35
|
-
LOGIN_FAILED: '§evo-login-failed',
|
|
36
|
-
LOGOUT: '§evo-logout'
|
|
9
|
+
ERROR: "§evo-error",
|
|
10
|
+
ERROR_401: "§evo-error-401",
|
|
11
|
+
ERROR_UNAVAILABLE: "§evo-error-unavailable",
|
|
12
|
+
SUCCESS: "§evo-success",
|
|
13
|
+
SUCCESS_TOAST: "§evo-success-toast",
|
|
14
|
+
LOGIN_CHANGED: "§evo-login-changed",
|
|
15
|
+
LOGIN_COMPLETED: "§evo-login-completed",
|
|
16
|
+
LOGOUT_COMPLETED: "§evo-logout-completed",
|
|
17
|
+
LOGIN_PENDING: "§evo-login-pending",
|
|
18
|
+
LOGIN_FAILED: "§evo-login-failed",
|
|
19
|
+
LOGOUT: "§evo-logout"
|
|
37
20
|
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The `sessionStorage` key naming which account a tab is working as; its value travels on every
|
|
41
|
-
* request as `X-Evo-Account`.
|
|
42
|
-
*
|
|
43
|
-
* It lives here, and not on `CoreService`, so the auth interceptor can read it without importing a
|
|
44
|
-
* service: the interceptor is a factory precisely so that registering it does not pull the Evolution
|
|
45
|
-
* service graph into the eager bundle.
|
|
46
|
-
*/
|
|
47
|
-
const EVOLUTION_ACTIVE_ACCOUNT_KEY = 'evolution_account';
|
|
21
|
+
const EVOLUTION_ACTIVE_ACCOUNT_KEY = "evolution_account";
|
|
48
22
|
var EvolutionServiceFlags;
|
|
49
|
-
(function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
(function(EvolutionServiceFlags) {
|
|
24
|
+
EvolutionServiceFlags[EvolutionServiceFlags["None"] = 0] = "None";
|
|
25
|
+
EvolutionServiceFlags[EvolutionServiceFlags["NotifySystemErrors"] = 1] = "NotifySystemErrors";
|
|
26
|
+
EvolutionServiceFlags[EvolutionServiceFlags["DisplayConnectionStateMessages"] = 2] = "DisplayConnectionStateMessages";
|
|
27
|
+
EvolutionServiceFlags[EvolutionServiceFlags["Embedded"] = 4] = "Embedded";
|
|
54
28
|
})(EvolutionServiceFlags || (EvolutionServiceFlags = {}));
|
|
55
29
|
var ERPModule;
|
|
56
|
-
(function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
30
|
+
(function(ERPModule) {
|
|
31
|
+
ERPModule[ERPModule["Formazione"] = 1] = "Formazione";
|
|
32
|
+
ERPModule[ERPModule["DPI"] = 2] = "DPI";
|
|
33
|
+
ERPModule[ERPModule["SorveglianzaSanitaria"] = 4] = "SorveglianzaSanitaria";
|
|
34
|
+
ERPModule[ERPModule["RegistroEScadenzario"] = 8] = "RegistroEScadenzario";
|
|
35
|
+
ERPModule[ERPModule["AttrezzatureEImpianti"] = 16] = "AttrezzatureEImpianti";
|
|
36
|
+
ERPModule[ERPModule["Monitoraggio"] = 32] = "Monitoraggio";
|
|
37
|
+
ERPModule[ERPModule["Bollettino"] = 64] = "Bollettino";
|
|
38
|
+
ERPModule[ERPModule["Documenti"] = 128] = "Documenti";
|
|
65
39
|
})(ERPModule || (ERPModule = {}));
|
|
66
40
|
var ERPExportType;
|
|
67
|
-
(function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
41
|
+
(function(ERPExportType) {
|
|
42
|
+
ERPExportType[ERPExportType["Basic"] = 1] = "Basic";
|
|
43
|
+
ERPExportType[ERPExportType["Detailed"] = 8] = "Detailed";
|
|
44
|
+
ERPExportType[ERPExportType["Complete"] = 9] = "Complete";
|
|
45
|
+
ERPExportType[ERPExportType["Labels"] = 10] = "Labels";
|
|
46
|
+
ERPExportType[ERPExportType["EmployeesCoursesMatrix"] = 21] = "EmployeesCoursesMatrix";
|
|
47
|
+
ERPExportType[ERPExportType["EmployeesCoursesHoursMatrix"] = 22] = "EmployeesCoursesHoursMatrix";
|
|
48
|
+
ERPExportType[ERPExportType["EmployeesPPEsMatrix"] = 23] = "EmployeesPPEsMatrix";
|
|
49
|
+
ERPExportType[ERPExportType["EmployeesHealthChecksMatrix"] = 24] = "EmployeesHealthChecksMatrix";
|
|
50
|
+
ERPExportType[ERPExportType["TasksCoursesMatrix"] = 31] = "TasksCoursesMatrix";
|
|
51
|
+
ERPExportType[ERPExportType["Training"] = 101] = "Training";
|
|
52
|
+
ERPExportType[ERPExportType["TrainingExpired"] = 102] = "TrainingExpired";
|
|
53
|
+
ERPExportType[ERPExportType["TrainingExpiring"] = 103] = "TrainingExpiring";
|
|
54
|
+
ERPExportType[ERPExportType["TrainingAbsents"] = 104] = "TrainingAbsents";
|
|
55
|
+
ERPExportType[ERPExportType["TrainingClosed"] = 105] = "TrainingClosed";
|
|
56
|
+
ERPExportType[ERPExportType["TrainingCurrentYear"] = 108] = "TrainingCurrentYear";
|
|
57
|
+
ERPExportType[ERPExportType["TrainingNextYear"] = 109] = "TrainingNextYear";
|
|
58
|
+
ERPExportType[ERPExportType["TrainingAnnualPlannng"] = 110] = "TrainingAnnualPlannng";
|
|
59
|
+
ERPExportType[ERPExportType["EquipmentsActivitiesCompleted"] = 201] = "EquipmentsActivitiesCompleted";
|
|
60
|
+
ERPExportType[ERPExportType["EquipmentsChecksMatrix"] = 202] = "EquipmentsChecksMatrix";
|
|
61
|
+
ERPExportType[ERPExportType["RSNormsUsage"] = 301] = "RSNormsUsage";
|
|
62
|
+
ERPExportType[ERPExportType["RSNormsSitesMatrix"] = 302] = "RSNormsSitesMatrix";
|
|
63
|
+
ERPExportType[ERPExportType["RSNormsSummary"] = 303] = "RSNormsSummary";
|
|
64
|
+
ERPExportType[ERPExportType["MonitoringLaws"] = 401] = "MonitoringLaws";
|
|
65
|
+
ERPExportType[ERPExportType["MonitoringActivities"] = 402] = "MonitoringActivities";
|
|
66
|
+
ERPExportType[ERPExportType["MonitoringSummary"] = 403] = "MonitoringSummary";
|
|
67
|
+
ERPExportType[ERPExportType["PPEs"] = 501] = "PPEs";
|
|
68
|
+
ERPExportType[ERPExportType["ComplianceStatistics"] = 601] = "ComplianceStatistics";
|
|
69
|
+
ERPExportType[ERPExportType["HealthChecks"] = 701] = "HealthChecks";
|
|
96
70
|
})(ERPExportType || (ERPExportType = {}));
|
|
97
71
|
var ERPExportFormat;
|
|
98
|
-
(function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
72
|
+
(function(ERPExportFormat) {
|
|
73
|
+
ERPExportFormat[ERPExportFormat["Csv"] = 1] = "Csv";
|
|
74
|
+
ERPExportFormat[ERPExportFormat["Word"] = 2] = "Word";
|
|
75
|
+
ERPExportFormat[ERPExportFormat["Pdf"] = 3] = "Pdf";
|
|
102
76
|
})(ERPExportFormat || (ERPExportFormat = {}));
|
|
103
77
|
var ERPExportSource;
|
|
104
|
-
(function
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
78
|
+
(function(ERPExportSource) {
|
|
79
|
+
ERPExportSource[ERPExportSource["All"] = 1] = "All";
|
|
80
|
+
ERPExportSource[ERPExportSource["Query"] = 2] = "Query";
|
|
81
|
+
ERPExportSource[ERPExportSource["Selection"] = 3] = "Selection";
|
|
108
82
|
})(ERPExportSource || (ERPExportSource = {}));
|
|
109
83
|
var ERPExportPart;
|
|
110
|
-
(function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
84
|
+
(function(ERPExportPart) {
|
|
85
|
+
ERPExportPart[ERPExportPart["IncludeRisks"] = 101] = "IncludeRisks";
|
|
86
|
+
ERPExportPart[ERPExportPart["IncludeTasks"] = 102] = "IncludeTasks";
|
|
87
|
+
ERPExportPart[ERPExportPart["IncludeTaskHistory"] = 103] = "IncludeTaskHistory";
|
|
88
|
+
ERPExportPart[ERPExportPart["IncludeTrainingRequired"] = 111] = "IncludeTrainingRequired";
|
|
89
|
+
ERPExportPart[ERPExportPart["IncludeTrainingDone"] = 112] = "IncludeTrainingDone";
|
|
90
|
+
ERPExportPart[ERPExportPart["SelectedEmployeeCourses"] = 121] = "SelectedEmployeeCourses";
|
|
91
|
+
ERPExportPart[ERPExportPart["IncludeDisabledEmployees"] = 131] = "IncludeDisabledEmployees";
|
|
92
|
+
ERPExportPart[ERPExportPart["IncludeDismissedEmployees"] = 132] = "IncludeDismissedEmployees";
|
|
93
|
+
ERPExportPart[ERPExportPart["IncludeDocumentUpdates"] = 201] = "IncludeDocumentUpdates";
|
|
94
|
+
ERPExportPart[ERPExportPart["ExcludeNonApplicableOrAcknowledged"] = 202] = "ExcludeNonApplicableOrAcknowledged";
|
|
95
|
+
ERPExportPart[ERPExportPart["ExcluteAbblicabilityTable"] = 203] = "ExcluteAbblicabilityTable";
|
|
96
|
+
ERPExportPart[ERPExportPart["IncludeActivities"] = 204] = "IncludeActivities";
|
|
97
|
+
ERPExportPart[ERPExportPart["GroupLaws"] = 205] = "GroupLaws";
|
|
98
|
+
ERPExportPart[ERPExportPart["IncludeApplicableOrAcknowledgedOnly"] = 4301] = "IncludeApplicableOrAcknowledgedOnly";
|
|
99
|
+
ERPExportPart[ERPExportPart["IncludePPEs"] = 501] = "IncludePPEs";
|
|
100
|
+
ERPExportPart[ERPExportPart["IncludeHealthChecks"] = 601] = "IncludeHealthChecks";
|
|
127
101
|
})(ERPExportPart || (ERPExportPart = {}));
|
|
128
102
|
var ERPComplianceLawsSelectionType;
|
|
129
|
-
(function
|
|
130
|
-
|
|
131
|
-
|
|
103
|
+
(function(ERPComplianceLawsSelectionType) {
|
|
104
|
+
ERPComplianceLawsSelectionType[ERPComplianceLawsSelectionType["Analysis"] = 1] = "Analysis";
|
|
105
|
+
ERPComplianceLawsSelectionType[ERPComplianceLawsSelectionType["Activity"] = 2] = "Activity";
|
|
132
106
|
})(ERPComplianceLawsSelectionType || (ERPComplianceLawsSelectionType = {}));
|
|
133
107
|
var ERPComplianceProfileRole;
|
|
134
|
-
(function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
108
|
+
(function(ERPComplianceProfileRole) {
|
|
109
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["None"] = 0] = "None";
|
|
110
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["Analyst"] = 1] = "Analyst";
|
|
111
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["Planner"] = 2] = "Planner";
|
|
112
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["Validator"] = 4] = "Validator";
|
|
113
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["Executor"] = 8] = "Executor";
|
|
114
|
+
ERPComplianceProfileRole[ERPComplianceProfileRole["Observer"] = 16] = "Observer";
|
|
141
115
|
})(ERPComplianceProfileRole || (ERPComplianceProfileRole = {}));
|
|
142
116
|
var ERPComplianceProfileFlags;
|
|
143
|
-
(function
|
|
144
|
-
|
|
117
|
+
(function(ERPComplianceProfileFlags) {
|
|
118
|
+
ERPComplianceProfileFlags[ERPComplianceProfileFlags["OverrideNotificationRegisterSettings"] = 16] = "OverrideNotificationRegisterSettings";
|
|
145
119
|
})(ERPComplianceProfileFlags || (ERPComplianceProfileFlags = {}));
|
|
146
120
|
var ERPComplianceScope;
|
|
147
|
-
(function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
121
|
+
(function(ERPComplianceScope) {
|
|
122
|
+
ERPComplianceScope[ERPComplianceScope["None"] = 0] = "None";
|
|
123
|
+
ERPComplianceScope[ERPComplianceScope["Environment"] = 1] = "Environment";
|
|
124
|
+
ERPComplianceScope[ERPComplianceScope["Safety"] = 2] = "Safety";
|
|
125
|
+
ERPComplianceScope[ERPComplianceScope["FoodSafety"] = 4] = "FoodSafety";
|
|
126
|
+
ERPComplianceScope[ERPComplianceScope["Energy"] = 8] = "Energy";
|
|
127
|
+
ERPComplianceScope[ERPComplianceScope["Health"] = 16] = "Health";
|
|
128
|
+
ERPComplianceScope[ERPComplianceScope["Maintenance"] = 32] = "Maintenance";
|
|
129
|
+
ERPComplianceScope[ERPComplianceScope["Quality"] = 64] = "Quality";
|
|
130
|
+
ERPComplianceScope[ERPComplianceScope["Organization"] = 128] = "Organization";
|
|
131
|
+
ERPComplianceScope[ERPComplianceScope["Logistics"] = 256] = "Logistics";
|
|
132
|
+
ERPComplianceScope[ERPComplianceScope["Facility"] = 512] = "Facility";
|
|
133
|
+
ERPComplianceScope[ERPComplianceScope["Security"] = 1024] = "Security";
|
|
134
|
+
ERPComplianceScope[ERPComplianceScope["GenderEquality"] = 2048] = "GenderEquality";
|
|
135
|
+
ERPComplianceScope[ERPComplianceScope["AntiCorruption"] = 4096] = "AntiCorruption";
|
|
136
|
+
ERPComplianceScope[ERPComplianceScope["Sustainability"] = 8192] = "Sustainability";
|
|
137
|
+
ERPComplianceScope[ERPComplianceScope["InformationSecurity"] = 16384] = "InformationSecurity";
|
|
164
138
|
})(ERPComplianceScope || (ERPComplianceScope = {}));
|
|
165
139
|
var ERPComplianceNotificationLimit;
|
|
166
|
-
(function
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
140
|
+
(function(ERPComplianceNotificationLimit) {
|
|
141
|
+
ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["None"] = 0] = "None";
|
|
142
|
+
ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["PlannerOnly"] = 1] = "PlannerOnly";
|
|
143
|
+
ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["ExecutorOnly"] = 2] = "ExecutorOnly";
|
|
144
|
+
ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["Both"] = 3] = "Both";
|
|
171
145
|
})(ERPComplianceNotificationLimit || (ERPComplianceNotificationLimit = {}));
|
|
172
146
|
var ERPComplianceRegisterNotificationType;
|
|
173
|
-
(function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
//NonComplianceNoticePeriodStarted = 1 << 18,
|
|
194
|
-
//NonCompliancePeriodExpired = 1 << 19,
|
|
195
|
-
//NonComplianceCompleted = 1 << 20,
|
|
196
|
-
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["LawChanged"] = 2097152] = "LawChanged";
|
|
147
|
+
(function(ERPComplianceRegisterNotificationType) {
|
|
148
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["None"] = 0] = "None";
|
|
149
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewAnalysis"] = 1] = "NewAnalysis";
|
|
150
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisCompleted"] = 2] = "AnalysisCompleted";
|
|
151
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisNoticePeriodStarted"] = 4] = "AnalysisNoticePeriodStarted";
|
|
152
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisPeriodExpired"] = 8] = "AnalysisPeriodExpired";
|
|
153
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisLawChanged"] = 16384] = "AnalysisLawChanged";
|
|
154
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewPlanning"] = 8192] = "NewPlanning";
|
|
155
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningCompleted"] = 16] = "PlanningCompleted";
|
|
156
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningNoticePeriodStarted"] = 32] = "PlanningNoticePeriodStarted";
|
|
157
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningPeriodExpired"] = 64] = "PlanningPeriodExpired";
|
|
158
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewValidation"] = 32768] = "NewValidation";
|
|
159
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationCompleted"] = 128] = "ValidationCompleted";
|
|
160
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationNoticePeriodStarted"] = 256] = "ValidationNoticePeriodStarted";
|
|
161
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationPeriodExpired"] = 512] = "ValidationPeriodExpired";
|
|
162
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewDeadline"] = 65536] = "NewDeadline";
|
|
163
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["DeadlineNoticePeriodStarted"] = 1024] = "DeadlineNoticePeriodStarted";
|
|
164
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["DeadlineExpired"] = 2048] = "DeadlineExpired";
|
|
165
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ActivityCompleted"] = 4096] = "ActivityCompleted";
|
|
166
|
+
ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["LawChanged"] = 2097152] = "LawChanged";
|
|
197
167
|
})(ERPComplianceRegisterNotificationType || (ERPComplianceRegisterNotificationType = {}));
|
|
198
168
|
var ERPComplianceRegisterSiteImportOptions;
|
|
199
|
-
(function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
169
|
+
(function(ERPComplianceRegisterSiteImportOptions) {
|
|
170
|
+
ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["CopyAttachments"] = 1] = "CopyAttachments";
|
|
171
|
+
ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["KeepOriginalDates"] = 2] = "KeepOriginalDates";
|
|
172
|
+
ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["DuplicateLaws"] = 4] = "DuplicateLaws";
|
|
173
|
+
ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["DiscardNotApplicables"] = 8] = "DiscardNotApplicables";
|
|
204
174
|
})(ERPComplianceRegisterSiteImportOptions || (ERPComplianceRegisterSiteImportOptions = {}));
|
|
205
175
|
const EvolutionComplianceProfileRoles = [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
176
|
+
{
|
|
177
|
+
name: "Analista",
|
|
178
|
+
value: ERPComplianceProfileRole.Analyst
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "Gestore",
|
|
182
|
+
value: ERPComplianceProfileRole.Planner
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "Esecutore",
|
|
186
|
+
value: ERPComplianceProfileRole.Executor
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "Osservatore",
|
|
190
|
+
value: ERPComplianceProfileRole.Observer
|
|
191
|
+
}
|
|
218
192
|
];
|
|
193
|
+
const EvolutionComplianceProfileFlags = [{
|
|
194
|
+
name: "Deroghe e limitazioni",
|
|
195
|
+
divider: true
|
|
196
|
+
}, {
|
|
197
|
+
name: "Questo profilo riceve regolarmente le notifiche indipendentemente dalla configurazione generale del registro",
|
|
198
|
+
value: ERPComplianceProfileFlags.OverrideNotificationRegisterSettings
|
|
199
|
+
}];
|
|
219
200
|
const EvolutionComplianceScopes = [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
201
|
+
{
|
|
202
|
+
name: "Ambiente",
|
|
203
|
+
value: ERPComplianceScope.Environment
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "Salute e sicurezza",
|
|
207
|
+
value: ERPComplianceScope.Safety
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "Sicurezza alimentare",
|
|
211
|
+
value: ERPComplianceScope.FoodSafety
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "Energia",
|
|
215
|
+
value: ERPComplianceScope.Energy
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "Servizi generali",
|
|
219
|
+
value: ERPComplianceScope.Facility
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "Manutenzione",
|
|
223
|
+
value: ERPComplianceScope.Maintenance
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "Qualità",
|
|
227
|
+
value: ERPComplianceScope.Quality
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "Organizzazione",
|
|
231
|
+
value: ERPComplianceScope.Organization
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "Logistica",
|
|
235
|
+
value: ERPComplianceScope.Logistics
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "Security",
|
|
239
|
+
value: ERPComplianceScope.Security
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: "Anticorruzione",
|
|
243
|
+
value: ERPComplianceScope.AntiCorruption
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "Sostenibilità",
|
|
247
|
+
value: ERPComplianceScope.Sustainability
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "Parità di genere",
|
|
251
|
+
value: ERPComplianceScope.GenderEquality
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "Sicurezza dell'informazione",
|
|
255
|
+
value: ERPComplianceScope.InformationSecurity
|
|
256
|
+
}
|
|
237
257
|
];
|
|
238
258
|
const EvolutionComplianceNotificationLimits = [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
259
|
+
{
|
|
260
|
+
name: "Nessuna limitazione",
|
|
261
|
+
value: ERPComplianceNotificationLimit.None
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "Solo gestore che ha pianificato",
|
|
265
|
+
value: ERPComplianceNotificationLimit.PlannerOnly
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "Solo all'incaricato designato",
|
|
269
|
+
value: ERPComplianceNotificationLimit.ExecutorOnly
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "Solo a gestore e incaricato designato",
|
|
273
|
+
value: ERPComplianceNotificationLimit.Both
|
|
274
|
+
}
|
|
252
275
|
];
|
|
253
276
|
const EvolutionComplianceNotifications = [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
name: 'Approvazione concessa o negata',
|
|
327
|
-
value: ERPComplianceRegisterNotificationType.ValidationCompleted,
|
|
328
|
-
},*/
|
|
329
|
-
{ name: 'Scadenze', divider: true },
|
|
330
|
-
{
|
|
331
|
-
name: 'Preavviso: 1° promemoria sulla data di scadenza',
|
|
332
|
-
value: ERPComplianceRegisterNotificationType.NewValidation,
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'Avviso: 2° promemoria sulla data di scadenza',
|
|
336
|
-
value: ERPComplianceRegisterNotificationType.DeadlineNoticePeriodStarted,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
name: 'Allarme: è scaduto il termine',
|
|
340
|
-
value: ERPComplianceRegisterNotificationType.DeadlineExpired,
|
|
341
|
-
},
|
|
342
|
-
{ name: 'Norme collegate', divider: true },
|
|
343
|
-
{
|
|
344
|
-
name: 'Modifica o abrogazione',
|
|
345
|
-
value: ERPComplianceRegisterNotificationType.LawChanged,
|
|
346
|
-
},
|
|
277
|
+
{
|
|
278
|
+
name: "Verifica applicabilità e analisi",
|
|
279
|
+
divider: true
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "Richiesta analisi",
|
|
283
|
+
value: ERPComplianceRegisterNotificationType.NewAnalysis
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "Preavviso: sta per scadere il termine fissato per l'analisi",
|
|
287
|
+
value: ERPComplianceRegisterNotificationType.AnalysisNoticePeriodStarted
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "Allarme: è scaduto il termine fissato per l'analisi",
|
|
291
|
+
value: ERPComplianceRegisterNotificationType.AnalysisPeriodExpired
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "Analisi completata",
|
|
295
|
+
value: ERPComplianceRegisterNotificationType.AnalysisCompleted
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "Avviso norma modificata dal legislatore",
|
|
299
|
+
value: ERPComplianceRegisterNotificationType.AnalysisLawChanged
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "Pianificazioni",
|
|
303
|
+
divider: true
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "Richiesta gestione",
|
|
307
|
+
value: ERPComplianceRegisterNotificationType.NewPlanning
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "Preavviso: sta per scadere il termine fissato per la gestione",
|
|
311
|
+
value: ERPComplianceRegisterNotificationType.PlanningNoticePeriodStarted
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: "Allarme: è scaduto il termine fissato per la gestione",
|
|
315
|
+
value: ERPComplianceRegisterNotificationType.PlanningPeriodExpired
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "Gestione completata",
|
|
319
|
+
value: ERPComplianceRegisterNotificationType.PlanningCompleted
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "Attività completata",
|
|
323
|
+
value: ERPComplianceRegisterNotificationType.ActivityCompleted
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "Scadenze",
|
|
327
|
+
divider: true
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "Preavviso: 1° promemoria sulla data di scadenza",
|
|
331
|
+
value: ERPComplianceRegisterNotificationType.NewValidation
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: "Avviso: 2° promemoria sulla data di scadenza",
|
|
335
|
+
value: ERPComplianceRegisterNotificationType.DeadlineNoticePeriodStarted
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: "Allarme: è scaduto il termine",
|
|
339
|
+
value: ERPComplianceRegisterNotificationType.DeadlineExpired
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: "Norme collegate",
|
|
343
|
+
divider: true
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "Modifica o abrogazione",
|
|
347
|
+
value: ERPComplianceRegisterNotificationType.LawChanged
|
|
348
|
+
}
|
|
347
349
|
];
|
|
348
350
|
var ERPComplianceLawState;
|
|
349
|
-
(function
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
351
|
+
(function(ERPComplianceLawState) {
|
|
352
|
+
ERPComplianceLawState[ERPComplianceLawState["ApplicableOrAknowledged"] = 1] = "ApplicableOrAknowledged";
|
|
353
|
+
ERPComplianceLawState[ERPComplianceLawState["NotApplicable"] = 2] = "NotApplicable";
|
|
354
|
+
ERPComplianceLawState[ERPComplianceLawState["NotAnalyzed"] = 3] = "NotAnalyzed";
|
|
355
|
+
ERPComplianceLawState[ERPComplianceLawState["ExpiredAnalysis"] = 4] = "ExpiredAnalysis";
|
|
356
|
+
ERPComplianceLawState[ERPComplianceLawState["UpdatedLaws"] = 5] = "UpdatedLaws";
|
|
357
|
+
ERPComplianceLawState[ERPComplianceLawState["Analyzed"] = 6] = "Analyzed";
|
|
358
|
+
ERPComplianceLawState[ERPComplianceLawState["Abrogated"] = 7] = "Abrogated";
|
|
359
|
+
ERPComplianceLawState[ERPComplianceLawState["Applicable"] = 8] = "Applicable";
|
|
360
|
+
ERPComplianceLawState[ERPComplianceLawState["Aknowledged"] = 9] = "Aknowledged";
|
|
359
361
|
})(ERPComplianceLawState || (ERPComplianceLawState = {}));
|
|
360
362
|
var ERPComplianceLawOrigin;
|
|
361
|
-
(function
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
363
|
+
(function(ERPComplianceLawOrigin) {
|
|
364
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["National"] = 1] = "National";
|
|
365
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["EU"] = 2] = "EU";
|
|
366
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Regional"] = 3] = "Regional";
|
|
367
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Local"] = 4] = "Local";
|
|
368
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Technical"] = 5] = "Technical";
|
|
369
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Voulontary"] = 6] = "Voulontary";
|
|
370
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Internal"] = 7] = "Internal";
|
|
371
|
+
ERPComplianceLawOrigin[ERPComplianceLawOrigin["Other"] = 8] = "Other";
|
|
370
372
|
})(ERPComplianceLawOrigin || (ERPComplianceLawOrigin = {}));
|
|
371
373
|
const EvolutionComplianceLawStates = [
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
374
|
+
{
|
|
375
|
+
name: "Applicabile",
|
|
376
|
+
value: ERPComplianceLawState.Applicable
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: "Da conoscere",
|
|
380
|
+
value: ERPComplianceLawState.Aknowledged
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "Applicabile / da conoscere",
|
|
384
|
+
value: ERPComplianceLawState.ApplicableOrAknowledged
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: "Non applicabile",
|
|
388
|
+
value: ERPComplianceLawState.NotApplicable
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "Abrogata",
|
|
392
|
+
value: ERPComplianceLawState.Abrogated
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "Analizzata",
|
|
396
|
+
value: ERPComplianceLawState.Analyzed
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "Da definire",
|
|
400
|
+
value: ERPComplianceLawState.NotAnalyzed
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "In ritardo",
|
|
404
|
+
value: ERPComplianceLawState.ExpiredAnalysis
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "Con aggiornamenti pendenti",
|
|
408
|
+
value: ERPComplianceLawState.UpdatedLaws
|
|
409
|
+
}
|
|
387
410
|
];
|
|
388
411
|
const EvolutionComplianceLawOrigins = [
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
412
|
+
{
|
|
413
|
+
name: "Nazionale",
|
|
414
|
+
value: ERPComplianceLawOrigin.National
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: "Comunitaria",
|
|
418
|
+
value: ERPComplianceLawOrigin.EU
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
name: "Regionale",
|
|
422
|
+
value: ERPComplianceLawOrigin.Regional
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: "Locale",
|
|
426
|
+
value: ERPComplianceLawOrigin.Local
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: "Tecnica",
|
|
430
|
+
value: ERPComplianceLawOrigin.Technical
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: "Interna",
|
|
434
|
+
value: ERPComplianceLawOrigin.Internal
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: "Volontaria",
|
|
438
|
+
value: ERPComplianceLawOrigin.Voulontary
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: "Altro",
|
|
442
|
+
value: ERPComplianceLawOrigin.Other
|
|
443
|
+
}
|
|
401
444
|
];
|
|
445
|
+
const EvolutionComplianceLawChangeStates = [{
|
|
446
|
+
name: "Aperto",
|
|
447
|
+
value: 1
|
|
448
|
+
}, {
|
|
449
|
+
name: "Chiuso",
|
|
450
|
+
value: 2
|
|
451
|
+
}];
|
|
402
452
|
var ERPComplianceActivityState;
|
|
403
|
-
(function
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
453
|
+
(function(ERPComplianceActivityState) {
|
|
454
|
+
ERPComplianceActivityState[ERPComplianceActivityState["NotPlanned"] = 128] = "NotPlanned";
|
|
455
|
+
ERPComplianceActivityState[ERPComplianceActivityState["Closed"] = 4] = "Closed";
|
|
456
|
+
ERPComplianceActivityState[ERPComplianceActivityState["Expired"] = 8] = "Expired";
|
|
457
|
+
ERPComplianceActivityState[ERPComplianceActivityState["Planned"] = 256] = "Planned";
|
|
458
|
+
ERPComplianceActivityState[ERPComplianceActivityState["Cancelled"] = 512] = "Cancelled";
|
|
459
|
+
ERPComplianceActivityState[ERPComplianceActivityState["UpdatedLaws"] = 1024] = "UpdatedLaws";
|
|
460
|
+
ERPComplianceActivityState[ERPComplianceActivityState["AlreadyManaged"] = 2048] = "AlreadyManaged";
|
|
411
461
|
})(ERPComplianceActivityState || (ERPComplianceActivityState = {}));
|
|
412
462
|
const EvolutionComplianceActivityStates = [
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
463
|
+
{
|
|
464
|
+
name: "Da definire",
|
|
465
|
+
value: ERPComplianceActivityState.NotPlanned
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
name: "Pianificata",
|
|
469
|
+
value: ERPComplianceActivityState.Planned
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "Chiusa",
|
|
473
|
+
value: ERPComplianceActivityState.Closed
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: "In ritardo",
|
|
477
|
+
value: ERPComplianceActivityState.Expired
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
name: "Annullata",
|
|
481
|
+
value: ERPComplianceActivityState.Cancelled
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "Gestita separatamente",
|
|
485
|
+
value: ERPComplianceActivityState.AlreadyManaged
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
name: "Con aggiornamenti pendenti",
|
|
489
|
+
value: ERPComplianceActivityState.UpdatedLaws
|
|
490
|
+
}
|
|
441
491
|
];
|
|
442
492
|
const EvolutionComplianceObligationTypes = [
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
493
|
+
{
|
|
494
|
+
name: "Autorizzazione",
|
|
495
|
+
value: 1
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: "Verifiche periodiche manutentive",
|
|
499
|
+
value: 2
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: "Misure organizzative",
|
|
503
|
+
value: 3
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: "Controlli e misurazioni",
|
|
507
|
+
value: 4
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: "Entrata in vigore",
|
|
511
|
+
value: 5
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: "Documenti aziendali obbligatori",
|
|
515
|
+
value: 6
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "Altri adempimenti formali (comunicazioni, dichiarazioni, ecc...)",
|
|
519
|
+
value: 7
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
name: "Altro",
|
|
523
|
+
value: 99
|
|
524
|
+
}
|
|
454
525
|
];
|
|
455
526
|
const EvolutionComplianceObligationAuthorities = [
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
527
|
+
{
|
|
528
|
+
name: "Agenzia ECHA",
|
|
529
|
+
value: 1
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: "Albo Nazionale dei Gestori Ambientali",
|
|
533
|
+
value: 2
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
name: "ARPA",
|
|
537
|
+
value: 4
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "ASL",
|
|
541
|
+
value: 5
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: "Camera di Commercio",
|
|
545
|
+
value: 8
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "Comando provinciale dei Vigili del Fuoco",
|
|
549
|
+
value: 10
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: "Comune",
|
|
553
|
+
value: 13
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "Consorzi gestione rifiuti particolari",
|
|
557
|
+
value: 14
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: "Gestore del servizio",
|
|
561
|
+
value: 21
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
name: "Gestore della rete di trasmissione nazionale",
|
|
565
|
+
value: 22
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "INAIL - IPSEMA - ISPESL",
|
|
569
|
+
value: 23
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: "ISPRA",
|
|
573
|
+
value: 26
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: "Ministero",
|
|
577
|
+
value: 27
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: "Genio civile",
|
|
581
|
+
value: 30
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
name: "Organo di vigilanza competente",
|
|
585
|
+
value: 31
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "Provincia",
|
|
589
|
+
value: 33
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
name: "Regione",
|
|
593
|
+
value: 35
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: "Uffici tecnici di finanza",
|
|
597
|
+
value: 36
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "Ispettorato del lavoro",
|
|
601
|
+
value: 37
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: "Comitato Regionale Tecnico VF",
|
|
605
|
+
value: 38
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
name: "Prefetto",
|
|
609
|
+
value: 39
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "Organismo notificato",
|
|
613
|
+
value: 40
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: "Città Metropolitana",
|
|
617
|
+
value: 41
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: "Nessuna",
|
|
621
|
+
value: 28
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "Altro",
|
|
625
|
+
value: 3
|
|
626
|
+
}
|
|
481
627
|
];
|
|
482
628
|
var ERPRecurrenceFrequencyType;
|
|
483
|
-
(function
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
629
|
+
(function(ERPRecurrenceFrequencyType) {
|
|
630
|
+
ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Day"] = 1] = "Day";
|
|
631
|
+
ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Month"] = 2] = "Month";
|
|
632
|
+
ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Year"] = 3] = "Year";
|
|
487
633
|
})(ERPRecurrenceFrequencyType || (ERPRecurrenceFrequencyType = {}));
|
|
488
634
|
const EvolutionRecurrenceFrequencyTypes = [
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
635
|
+
{
|
|
636
|
+
name: "Anni",
|
|
637
|
+
value: ERPRecurrenceFrequencyType.Year
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: "Mesi",
|
|
641
|
+
value: ERPRecurrenceFrequencyType.Month
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "Giorni",
|
|
645
|
+
value: ERPRecurrenceFrequencyType.Day
|
|
646
|
+
}
|
|
492
647
|
];
|
|
493
648
|
var ERPPlacePermission;
|
|
494
|
-
(function
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
649
|
+
(function(ERPPlacePermission) {
|
|
650
|
+
ERPPlacePermission[ERPPlacePermission["None"] = 0] = "None";
|
|
651
|
+
ERPPlacePermission[ERPPlacePermission["Denied"] = 1] = "Denied";
|
|
652
|
+
ERPPlacePermission[ERPPlacePermission["Read"] = 2] = "Read";
|
|
653
|
+
ERPPlacePermission[ERPPlacePermission["Write"] = 3] = "Write";
|
|
499
654
|
})(ERPPlacePermission || (ERPPlacePermission = {}));
|
|
500
655
|
var ERPPlace;
|
|
501
|
-
(function
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
656
|
+
(function(ERPPlace) {
|
|
657
|
+
ERPPlace[ERPPlace["Subject"] = 1] = "Subject";
|
|
658
|
+
ERPPlace[ERPPlace["Site"] = 2] = "Site";
|
|
659
|
+
ERPPlace[ERPPlace["Department"] = 3] = "Department";
|
|
660
|
+
ERPPlace[ERPPlace["Area"] = 4] = "Area";
|
|
661
|
+
ERPPlace[ERPPlace["Line"] = 5] = "Line";
|
|
507
662
|
})(ERPPlace || (ERPPlace = {}));
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* HTML text helpers with no dependencies of their own.
|
|
513
|
-
*
|
|
514
|
-
* Not exported from `public_api`: it is an internal detail of this entry point, the twin of the one
|
|
515
|
-
* in `clipper.common`. The two entry points are independent, so neither imports the other's copy.
|
|
516
|
-
*/
|
|
663
|
+
var EvolutionComplianceContextInfo = class {};
|
|
517
664
|
function escapeHtml(value) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return String(value)
|
|
521
|
-
.replaceAll('&', '&')
|
|
522
|
-
.replaceAll('<', '<')
|
|
523
|
-
.replaceAll('>', '>')
|
|
524
|
-
.replaceAll('"', '"')
|
|
525
|
-
.replaceAll("'", "'");
|
|
665
|
+
if (value === void 0 || value === null) return void 0;
|
|
666
|
+
return String(value).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
526
667
|
}
|
|
527
|
-
|
|
528
|
-
/** Minimum milliseconds between consecutive generic error broadcasts (debounce guard). */
|
|
529
|
-
const ERROR_DEBOUNCE_MS = 5000;
|
|
530
|
-
/** How many more times a request is sent when the API is not there. */
|
|
668
|
+
const ERROR_DEBOUNCE_MS = 5e3;
|
|
531
669
|
const UNAVAILABLE_RETRIES = 2;
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
* wrapped in the usual `ApiResult` envelope, so it has been seen, parsed and acted upon: replaying
|
|
541
|
-
* it would run whatever it already ran a second time. A server that is being replaced answers with
|
|
542
|
-
* IIS's own HTML, or with nothing at all — no envelope — and that request never reached any
|
|
543
|
-
* handler. Only the second kind is retried, which is what makes it safe to retry a POST.
|
|
544
|
-
* @param error - The raw HTTP error object.
|
|
545
|
-
* @returns True when the request is worth sending again.
|
|
546
|
-
*/
|
|
670
|
+
const UNAVAILABLE_RETRY_DELAY = 5e3;
|
|
671
|
+
const UNAVAILABLE_STATUSES = [
|
|
672
|
+
0,
|
|
673
|
+
500,
|
|
674
|
+
502,
|
|
675
|
+
503,
|
|
676
|
+
504
|
|
677
|
+
];
|
|
547
678
|
function isServiceUnavailable(error) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const isApiEnvelope = !!body
|
|
552
|
-
&& typeof body === 'object'
|
|
553
|
-
&& !(body instanceof Blob)
|
|
554
|
-
&& ('success' in body || 'problem' in body);
|
|
555
|
-
return !isApiEnvelope;
|
|
679
|
+
if (!UNAVAILABLE_STATUSES.includes(parseInt(error?.status ?? "0"))) return false;
|
|
680
|
+
const body = error?.error;
|
|
681
|
+
return !(!!body && typeof body === "object" && !(body instanceof Blob) && ("success" in body || "problem" in body));
|
|
556
682
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Returns whether the failure means the session is gone rather than the request being wrong.
|
|
559
|
-
* @param errorStatus - The numeric HTTP status code.
|
|
560
|
-
* @param url - The request URL.
|
|
561
|
-
* @returns True when the link to Evolution has to be dropped.
|
|
562
|
-
*/
|
|
563
683
|
function isSessionExpired(errorStatus, url) {
|
|
564
|
-
|
|
684
|
+
return errorStatus === 401 && !isAuthEndpoint(url);
|
|
565
685
|
}
|
|
566
|
-
/**
|
|
567
|
-
* Returns whether the URL is an authentication endpoint, where a 401 is a normal outcome -- wrong
|
|
568
|
-
* credentials, a rejected code, a refused passkey -- rather than an expired or invalid session.
|
|
569
|
-
*
|
|
570
|
-
* They are called by a visitor who has no session by definition, so answering "la sessione non è
|
|
571
|
-
* più valida" would send them back to the page they are already standing on and hide the real
|
|
572
|
-
* reason they were refused.
|
|
573
|
-
*
|
|
574
|
-
* The list covers the whole Evolution sign-in surface, including the ways in that this library does
|
|
575
|
-
* not itself offer: a host application registers one interceptor for every call it makes to the
|
|
576
|
-
* API, its own passkey and provider flows included.
|
|
577
|
-
* @param url - The request URL.
|
|
578
|
-
* @returns True when the URL is a login / confirm / otp / oauth / passkey endpoint.
|
|
579
|
-
*/
|
|
580
686
|
function isAuthEndpoint(url) {
|
|
581
|
-
|
|
582
|
-
|| url.includes('/session/confirm')
|
|
583
|
-
|| url.includes('/session/otp')
|
|
584
|
-
|| url.includes('/session/oauth')
|
|
585
|
-
|| url.includes('/passkeys/request-options')
|
|
586
|
-
|| url.includes('/passkeys/login');
|
|
687
|
+
return url.includes("/session/login") || url.includes("/session/confirm") || url.includes("/session/otp") || url.includes("/session/oauth") || url.includes("/passkeys/request-options") || url.includes("/passkeys/login");
|
|
587
688
|
}
|
|
588
|
-
/**
|
|
589
|
-
* Returns whether the URL is the silent link probe, whose failures must never reach the user.
|
|
590
|
-
*
|
|
591
|
-
* `/session/status` runs unconditionally at every bootstrap, including for users who never linked
|
|
592
|
-
* Evolution at all. When the API is unreachable, reporting that failure would show "Evolution non è
|
|
593
|
-
* disponibile" to somebody who never asked Evolution for anything: the probe simply stays unanswered
|
|
594
|
-
* and the link state keeps whatever the stored hint says.
|
|
595
|
-
* @param url - The request URL.
|
|
596
|
-
* @returns True when the URL is the status probe.
|
|
597
|
-
*/
|
|
598
689
|
function isStatusProbe(url) {
|
|
599
|
-
|
|
690
|
+
return url.includes("/session/status");
|
|
600
691
|
}
|
|
601
|
-
/**
|
|
602
|
-
* Resolves the user-facing message for a failed request.
|
|
603
|
-
*
|
|
604
|
-
* There is no branch for status 0 any more, nor for the 5xx family: a request that got no answer,
|
|
605
|
-
* or an answer with no `ApiResult` envelope, never reaches here — it is retried and then reported
|
|
606
|
-
* as `ERROR_UNAVAILABLE`. What is left is the failures the API itself described.
|
|
607
|
-
*
|
|
608
|
-
* Whatever the API sends is escaped before anything else happens to it. The dialog that shows this
|
|
609
|
-
* string binds it with `[innerHTML]` through a pipe that calls `bypassSecurityTrustHtml`, so an
|
|
610
|
-
* error message echoing back something a user had typed would be rendered as markup rather than
|
|
611
|
-
* read as text. The paragraph breaks in the default branch are applied AFTER the escape, which is
|
|
612
|
-
* exactly why they survive it and nothing else does.
|
|
613
|
-
* @param error - The raw HTTP error object.
|
|
614
|
-
* @param errorStatus - The numeric HTTP status code.
|
|
615
|
-
* @returns A localised message, safe to render as HTML.
|
|
616
|
-
*/
|
|
617
692
|
function resolveErrorMessage(error, errorStatus) {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
return "Non hai i permessi necessari per eseguire l'operazione richiesta.";
|
|
626
|
-
case 429:
|
|
627
|
-
return message ?? "Troppe richieste consecutive. Aspetta qualche secondo.";
|
|
628
|
-
default:
|
|
629
|
-
return (message ?? "Impossibile eseguire l'operazione richiesta.")
|
|
630
|
-
.replaceAll('\r\n', '</p><p>');
|
|
631
|
-
}
|
|
693
|
+
const message = escapeHtml(error?.error?.message ?? error?.message);
|
|
694
|
+
switch (errorStatus) {
|
|
695
|
+
case 401: return message ?? "Credenziali non valide o accesso non abilitato.";
|
|
696
|
+
case 403: return "Non hai i permessi necessari per eseguire l'operazione richiesta.";
|
|
697
|
+
case 429: return message ?? "Troppe richieste consecutive. Aspetta qualche secondo.";
|
|
698
|
+
default: return (message ?? "Impossibile eseguire l'operazione richiesta.").replaceAll("\r\n", "</p><p>");
|
|
699
|
+
}
|
|
632
700
|
}
|
|
633
|
-
/**
|
|
634
|
-
* Builds the Evolution auth HTTP interceptor.
|
|
635
|
-
*
|
|
636
|
-
* Attaches the credentials, the service-worker bypass and the active-account header to every
|
|
637
|
-
* request aimed at the Evolution API, and turns HTTP failures into broadcast messages -- no UI
|
|
638
|
-
* dependency here.
|
|
639
|
-
*
|
|
640
|
-
* Takes the Evolution base URI and the service flags directly as arguments, captured in the
|
|
641
|
-
* closure, so it never injects `EvolutionService`: registering it does not pull the whole Evolution
|
|
642
|
-
* service into the eager bundle. The debounce and the expiry latch live in that same closure, so
|
|
643
|
-
* two applications registering two interceptors never share them.
|
|
644
|
-
*
|
|
645
|
-
* ## What the statuses mean
|
|
646
|
-
*
|
|
647
|
-
* Aligned with the Evolution API on 2026-08-25. The meaning of the status codes changed with it:
|
|
648
|
-
* failures used to arrive as `200 OK` with `success: false`, and a dead session had to be guessed
|
|
649
|
-
* from a 405, a 410 or any 5xx. Now the status is the truth -- a 401 on an already-authenticated
|
|
650
|
-
* request means the session is gone, a 403 means the permission is missing, a 5xx means the server
|
|
651
|
-
* broke, and those are three different things that used to be one.
|
|
652
|
-
*
|
|
653
|
-
* A dead session is broadcast as `EvolutionMessages.ERROR_401`, for the host application to handle
|
|
654
|
-
* centrally; every other failure stays an `EvolutionMessages.ERROR` carrying a message. The two are
|
|
655
|
-
* separate because they call for opposite things: one drops the link, the other shows a dialog and
|
|
656
|
-
* leaves the user where they are. It used to be an `ERROR` flagged `invalidateSession`, with a
|
|
657
|
-
* message of its own; `invalidateSession` is now always false.
|
|
658
|
-
*
|
|
659
|
-
* Between them sits a third case, which is neither: the API is being replaced. A deployment answers
|
|
660
|
-
* with a 5xx that has no `ApiResult` envelope, or does not answer at all, for the few seconds the
|
|
661
|
-
* process takes to come back. That is not worth a dialog and not worth a redirect either, so the
|
|
662
|
-
* request is simply sent again — twice, five seconds apart — and only if the third attempt fails
|
|
663
|
-
* too does it become `EvolutionMessages.ERROR_UNAVAILABLE`, once per outage.
|
|
664
|
-
*
|
|
665
|
-
* `EvolutionServiceFlags.NotifySystemErrors` therefore now governs one narrower case: a 5xx that
|
|
666
|
-
* DOES carry an envelope, i.e. a server error the API itself described. Without the flag it is
|
|
667
|
-
* swallowed, as it always was in this library.
|
|
668
|
-
*
|
|
669
|
-
* Errors are consumed, not re-thrown, exactly as `clipperAuthInterceptor` does: every failure is
|
|
670
|
-
* reported on the bus, and a subscriber to a failing request simply completes without emitting. A
|
|
671
|
-
* caller that must know how a request ended reads `ApiResult.success`; a busy dialog is cleared by
|
|
672
|
-
* `finalize`, which runs on completion as it ran on error. An `error` callback no longer fires for
|
|
673
|
-
* an HTTP failure.
|
|
674
|
-
*
|
|
675
|
-
* Register it with `withInterceptors`:
|
|
676
|
-
* @example
|
|
677
|
-
* provideHttpClient(withInterceptors([
|
|
678
|
-
* evolutionAuthInterceptor(environment.evolutionServiceUri,
|
|
679
|
-
* EvolutionServiceFlags.DisplayConnectionStateMessages | EvolutionServiceFlags.Embedded),
|
|
680
|
-
* ]))
|
|
681
|
-
*
|
|
682
|
-
* @param serviceUri - Base URI of the Evolution service; only requests starting with it are handled.
|
|
683
|
-
* @param flags - Service flags (e.g. NotifySystemErrors). Defaults to None.
|
|
684
|
-
* @returns An `HttpInterceptorFn` ready to register.
|
|
685
|
-
*/
|
|
686
701
|
function evolutionAuthInterceptor(serviceUri, flags = EvolutionServiceFlags.None) {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
// outgrew what the server accepts. Empty on a tab that has not signed in yet: the API then
|
|
738
|
-
// serves the active account.
|
|
739
|
-
'X-Evo-Account': sessionStorage.getItem(EVOLUTION_ACTIVE_ACCOUNT_KEY) ?? ''
|
|
740
|
-
}
|
|
741
|
-
});
|
|
742
|
-
return next(authenticatedRequest).pipe(
|
|
743
|
-
// An API that is being replaced is not an error to show, it is a wait: two more attempts,
|
|
744
|
-
// five seconds apart. Anything else is rethrown on the spot, so a request that genuinely
|
|
745
|
-
// failed still fails immediately.
|
|
746
|
-
retry({
|
|
747
|
-
count: UNAVAILABLE_RETRIES,
|
|
748
|
-
delay: error => isServiceUnavailable(error)
|
|
749
|
-
? timer(UNAVAILABLE_RETRY_DELAY)
|
|
750
|
-
: throwError(() => error)
|
|
751
|
-
}), tap(event => {
|
|
752
|
-
// A response means the session is valid again, and the API is back: re-arm both notifiers.
|
|
753
|
-
if (event instanceof HttpResponse) {
|
|
754
|
-
sessionExpiredNotified = false;
|
|
755
|
-
unavailableNotified = false;
|
|
756
|
-
}
|
|
757
|
-
}), catchError((error) => {
|
|
758
|
-
// Which request this was is read from the request, not from `error.url`: a failure with no
|
|
759
|
-
// response -- the browser refusing the connection while the API restarts -- carries no URL
|
|
760
|
-
// at all. Everything that gets here is an Evolution request anyway: the others returned
|
|
761
|
-
// before the pipe was built.
|
|
762
|
-
const errorStatus = parseInt(error?.status ?? '0');
|
|
763
|
-
if (isStatusProbe(authenticatedRequest.url)) {
|
|
764
|
-
// The silent probe stays silent: its caller reads the outcome from the stream, nobody
|
|
765
|
-
// else needs to hear about it.
|
|
766
|
-
}
|
|
767
|
-
else if (isServiceUnavailable(error)) {
|
|
768
|
-
// Three attempts over ten seconds and the API is still not answering. There is nothing
|
|
769
|
-
// left to retry, so the host application is told once, however many requests were in
|
|
770
|
-
// flight. Reported whatever the flags say: `NotifySystemErrors` governs a 5xx the API
|
|
771
|
-
// described itself, and a server that never answered described nothing.
|
|
772
|
-
if (!unavailableNotified) {
|
|
773
|
-
unavailableNotified = true;
|
|
774
|
-
broadcastService.sendMessage(EvolutionMessages.ERROR_UNAVAILABLE);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
else if (isSessionExpired(errorStatus, authenticatedRequest.url)) {
|
|
778
|
-
// Expired or invalidated session on an authenticated request. Notified once: several
|
|
779
|
-
// in-flight requests failing together is how a single expiry becomes a wall of dialogs.
|
|
780
|
-
if (!sessionExpiredNotified) {
|
|
781
|
-
sessionExpiredNotified = true;
|
|
782
|
-
broadcastService.sendMessage(EvolutionMessages.ERROR_401);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
else {
|
|
786
|
-
// Any other failure, including a 401 from a sign-in attempt.
|
|
787
|
-
notifyError(error, errorStatus, broadcastService);
|
|
788
|
-
}
|
|
789
|
-
// Consumed, not rethrown — as in `clipperAuthInterceptor`. The failure has been reported on
|
|
790
|
-
// the bus, and rethrowing it a second time only gave every subscriber its own chance to
|
|
791
|
-
// report it again: a wrong password used to end in two dialogs, the second one saying
|
|
792
|
-
// "Evolution non disponibile".
|
|
793
|
-
return EMPTY;
|
|
794
|
-
}));
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
/**
|
|
799
|
-
* @internal
|
|
800
|
-
* Private state container for the Evolution session.
|
|
801
|
-
*
|
|
802
|
-
* Intentionally NOT exported from the barrel: it must never be injected by
|
|
803
|
-
* application code. Its state and pure mutations are re-published through
|
|
804
|
-
* {@link EvolutionService} (and partly {@link LoginService}). The feature
|
|
805
|
-
* services inject it ONLY to read {@link serviceUri}.
|
|
806
|
-
*
|
|
807
|
-
* Owns the back-end URI, feature flags, persisted login info and the session
|
|
808
|
-
* signals. No HTTP, no auth orchestration.
|
|
809
|
-
*/
|
|
810
|
-
class CoreService {
|
|
811
|
-
constructor() {
|
|
812
|
-
this.broadcastService = inject(BroadcastService);
|
|
813
|
-
this._flags = EvolutionServiceFlags.None;
|
|
814
|
-
/**
|
|
815
|
-
* Seeded from the stored context, which means "this browser signed in at some point" and nothing
|
|
816
|
-
* more: the auth cookie is HttpOnly and may have expired while the stored context lived on.
|
|
817
|
-
* `LoginService.initialize` turns the hint into an answer by asking `/session/me`, and the hint
|
|
818
|
-
* is what keeps a visitor who never signed in from calling a route that would answer 401 and
|
|
819
|
-
* raise a dead-session error over the sign-in page.
|
|
820
|
-
*/
|
|
821
|
-
this._loggedIn = signal(localStorage.getItem('evolution_context') !== null, /* @ts-ignore */
|
|
822
|
-
...(ngDevMode ? [{ debugName: "_loggedIn" }] : /* istanbul ignore next */ []));
|
|
823
|
-
/** `true` when this browser has a session the API has accepted. */
|
|
824
|
-
this.loggedIn = this._loggedIn.asReadonly();
|
|
825
|
-
/** `true` while a login request is in flight. */
|
|
826
|
-
this.loggingIn = signal(false, /* @ts-ignore */
|
|
827
|
-
...(ngDevMode ? [{ debugName: "loggingIn" }] : /* istanbul ignore next */ []));
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Gets the base URI of the Evolution back-end service.
|
|
831
|
-
* @returns The configured service URI, or undefined before initialize().
|
|
832
|
-
*/
|
|
833
|
-
get serviceUri() {
|
|
834
|
-
return this._serviceUri;
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Sets the base URI of the Evolution back-end service.
|
|
838
|
-
* @param uri - The base URL.
|
|
839
|
-
* @returns void
|
|
840
|
-
*/
|
|
841
|
-
setServiceUri(uri) {
|
|
842
|
-
this._serviceUri = uri;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Gets the active feature flags.
|
|
846
|
-
* @returns The active {@link EvolutionServiceFlags} bitmask.
|
|
847
|
-
*/
|
|
848
|
-
get flags() {
|
|
849
|
-
return this._flags;
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Sets the active feature flags.
|
|
853
|
-
* @param flags - The flags bitmask to apply.
|
|
854
|
-
* @returns void
|
|
855
|
-
*/
|
|
856
|
-
setFlags(flags) {
|
|
857
|
-
this._flags = flags;
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Gets the current login info, hydrating it from `localStorage` on first
|
|
861
|
-
* access when no in-memory value is available.
|
|
862
|
-
* @returns The current {@link EvolutionLoginInfo}, or undefined.
|
|
863
|
-
*/
|
|
864
|
-
get loginInfo() {
|
|
865
|
-
if (!this._loginInfo) {
|
|
866
|
-
const raw = localStorage.getItem('evolution_context');
|
|
867
|
-
if (raw) {
|
|
868
|
-
try {
|
|
869
|
-
this._loginInfo = JSON.parse(raw);
|
|
870
|
-
}
|
|
871
|
-
catch { /* invalid JSON — ignore and leave undefined */ }
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
return this._loginInfo;
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Gets the signed-in account.
|
|
878
|
-
* @returns The current {@link EvolutionUserInfo}, or `undefined` when there is no session.
|
|
879
|
-
*/
|
|
880
|
-
get user() { return this.loginInfo?.context; }
|
|
881
|
-
/**
|
|
882
|
-
* Sets the logged-in state.
|
|
883
|
-
* @param value - The new logged-in value.
|
|
884
|
-
* @returns void
|
|
885
|
-
*/
|
|
886
|
-
setLoggedIn(value) {
|
|
887
|
-
this._loggedIn.set(value);
|
|
888
|
-
}
|
|
889
|
-
/** The `sessionStorage` key naming which account this tab is working as. */
|
|
890
|
-
static { this.activeAccountKey = EVOLUTION_ACTIVE_ACCOUNT_KEY; }
|
|
891
|
-
/**
|
|
892
|
-
* Records which account this tab is working as, so the interceptor can name it on every request.
|
|
893
|
-
*
|
|
894
|
-
* `sessionStorage` and not `localStorage`: the choice belongs to the tab. One cookie holds every
|
|
895
|
-
* account this browser has open, and two tabs may sit on two different licences while reading
|
|
896
|
-
* that same cookie -- which is what replaced the per-tab `X-Client-Id`, a random UUID that gave
|
|
897
|
-
* every tab ever opened a session cookie of its own until the header outgrew what the server
|
|
898
|
-
* accepts.
|
|
899
|
-
* @param userId - The account to work as, or `undefined` to stop naming one.
|
|
900
|
-
* @returns void
|
|
901
|
-
*/
|
|
902
|
-
setActiveAccount(userId) {
|
|
903
|
-
if (userId && userId > 0) {
|
|
904
|
-
sessionStorage.setItem(CoreService.activeAccountKey, String(userId));
|
|
905
|
-
}
|
|
906
|
-
else {
|
|
907
|
-
sessionStorage.removeItem(CoreService.activeAccountKey);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Persists the current login info to `localStorage`.
|
|
912
|
-
* @returns void
|
|
913
|
-
*/
|
|
914
|
-
storeContext() {
|
|
915
|
-
localStorage.setItem('evolution_context', JSON.stringify(this._loginInfo));
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* Merges a login result into the stored login info and persists it.
|
|
919
|
-
* @param result - The login result returned by the login endpoint.
|
|
920
|
-
* @returns void
|
|
921
|
-
*/
|
|
922
|
-
updateContext(result) {
|
|
923
|
-
if (!this._loginInfo) {
|
|
924
|
-
this._loginInfo = { context: undefined };
|
|
925
|
-
}
|
|
926
|
-
this._loginInfo.context = result.context;
|
|
927
|
-
this.storeContext();
|
|
928
|
-
}
|
|
929
|
-
/**
|
|
930
|
-
* Resets the in-memory login state and broadcasts a logout-completed event.
|
|
931
|
-
* Does NOT touch storage; call {@link clear} for a full cleanup.
|
|
932
|
-
* @returns void
|
|
933
|
-
*/
|
|
934
|
-
reset() {
|
|
935
|
-
this._loginInfo = undefined;
|
|
936
|
-
this._loggedIn.set(false);
|
|
937
|
-
this.broadcastService.sendMessage(EvolutionMessages.LOGOUT_COMPLETED);
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Clears every trace of the session on this device -- the stored context, the account this tab
|
|
941
|
-
* was working as and the leftovers of the token era -- and then calls {@link reset}. It asks the
|
|
942
|
-
* API nothing: use `LoginService.logout` for that.
|
|
943
|
-
*
|
|
944
|
-
* It takes no argument any more. `clearOAuthToken` decided whether to drop
|
|
945
|
-
* `evolution_oauth_token`, a provider access token this library no longer obtains, stores or
|
|
946
|
-
* sends: the whole exchange happens on the backend.
|
|
947
|
-
* @returns void
|
|
948
|
-
*/
|
|
949
|
-
clear() {
|
|
950
|
-
// The stored context goes with the session it describes. It used to be removed by `logout()`
|
|
951
|
-
// alone, so every other way of losing a session -- an expiry, a rejected restore -- left it
|
|
952
|
-
// behind for the next bootstrap to trust.
|
|
953
|
-
localStorage.removeItem('evolution_context');
|
|
954
|
-
// The account this tab was working as. Left behind, the next request would name an account no
|
|
955
|
-
// longer in the cookie: harmless, because the API falls back to the active one, but it would
|
|
956
|
-
// also survive a sign-in as somebody else until the next `completeLogin` overwrote it.
|
|
957
|
-
sessionStorage.removeItem(CoreService.activeAccountKey);
|
|
958
|
-
// Leftovers of the token era, when the session travelled in session storage instead of an
|
|
959
|
-
// HttpOnly cookie, and of the per-tab cookie era. Nothing writes them any more; they are
|
|
960
|
-
// removed so a browser upgrading from the previous version does not keep them for good.
|
|
961
|
-
sessionStorage.removeItem('evolution_auth');
|
|
962
|
-
sessionStorage.removeItem('evolution_refresh');
|
|
963
|
-
sessionStorage.removeItem('evolution_oauth');
|
|
964
|
-
sessionStorage.removeItem('evolution_auth_oauth');
|
|
965
|
-
sessionStorage.removeItem('evolution_oauth_token');
|
|
966
|
-
sessionStorage.removeItem('evolution_client_id');
|
|
967
|
-
this.reset();
|
|
968
|
-
}
|
|
969
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CoreService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
970
|
-
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.7", ngImport: i0, type: CoreService }); }
|
|
971
|
-
}
|
|
972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CoreService, decorators: [{
|
|
973
|
-
type: Service
|
|
974
|
-
}] });
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* Authentication for the Evolution back end: password login, e-mailed code confirmation, account
|
|
978
|
-
* switch, logout and session restore. All session state lives in the private {@link CoreService};
|
|
979
|
-
* this service orchestrates the HTTP flows and re-publishes the parts of core that consumers need.
|
|
980
|
-
*
|
|
981
|
-
* Aligned with the Evolution API on 2026-08-25. Everything goes through `/session/*` and an
|
|
982
|
-
* HttpOnly cookie now: there is no bearer token, no `remember` credential the API can replay, and
|
|
983
|
-
* no provider token acquired by the caller -- the external-provider flow is a full-page redirect
|
|
984
|
-
* handled server-side, and all that reaches this service is the `/session/me` call on the way back.
|
|
985
|
-
*
|
|
986
|
-
* ## What this service no longer offers, and why
|
|
987
|
-
*
|
|
988
|
-
* - **`autoLogin`.** It was `login(undefined, undefined, true)`: a credential-less sign-in that
|
|
989
|
-
* worked only because the API could decrypt a stored password from an `evolution_remember`
|
|
990
|
-
* cookie. `POST /session/login` takes a user and a password and nothing else.
|
|
991
|
-
* - **`autoLogout`.** It wrapped {@link logout} in toasts and a callback, and ran the callback
|
|
992
|
-
* from `complete` -- that is, before the request it was waiting for had said anything. A host
|
|
993
|
-
* that wants a callback subscribes: `logout().subscribe(() => …)`.
|
|
994
|
-
* - **re-login on `LOGIN_CHANGED`.** The handler used to answer that message with a silent
|
|
995
|
-
* `autoLogin`, which is the same replay by another name. The message is still broadcast by hosts
|
|
996
|
-
* that link and unlink Evolution, and it is theirs to act on; this library no longer signs
|
|
997
|
-
* anybody in without being asked.
|
|
998
|
-
* - **the OAuth `Authorization` header, and the per-tab `X-Client-Id`.** The first is server-side
|
|
999
|
-
* now; the second was a random UUID that gave every tab a session cookie of its own. A tab says
|
|
1000
|
-
* which of the accounts in the one cookie it is working as with `X-Evo-Account`, written by
|
|
1001
|
-
* {@link CoreService.setActiveAccount}.
|
|
1002
|
-
*
|
|
1003
|
-
* This is a deliberately reduced subset of what the Evolution application itself does: passkeys and
|
|
1004
|
-
* the provider redirect are not here. A library whose job is to let another application talk to
|
|
1005
|
-
* Evolution signs in with a password; an application that offers the other ways in owns them.
|
|
1006
|
-
*/
|
|
1007
|
-
class LoginService {
|
|
1008
|
-
constructor() {
|
|
1009
|
-
this.httpClient = inject(HttpClient);
|
|
1010
|
-
this.broadcastService = inject(BroadcastService);
|
|
1011
|
-
this.destroyRef = inject(DestroyRef);
|
|
1012
|
-
this.core = inject(CoreService);
|
|
1013
|
-
this.broadcastInitialized = false;
|
|
1014
|
-
}
|
|
1015
|
-
// ── Re-published core state (CoreService stays private) ─────────────────────
|
|
1016
|
-
/**
|
|
1017
|
-
* Gets the base URI of the Evolution back-end service.
|
|
1018
|
-
* @returns The configured service URI, or undefined before initialize().
|
|
1019
|
-
*/
|
|
1020
|
-
get serviceUri() { return this.core.serviceUri; }
|
|
1021
|
-
/**
|
|
1022
|
-
* Gets the active feature flags.
|
|
1023
|
-
* @returns The active {@link EvolutionServiceFlags} bitmask.
|
|
1024
|
-
*/
|
|
1025
|
-
get flags() { return this.core.flags; }
|
|
1026
|
-
/**
|
|
1027
|
-
* Gets the current login info.
|
|
1028
|
-
* @returns The current {@link EvolutionLoginInfo}, or undefined.
|
|
1029
|
-
*/
|
|
1030
|
-
get loginInfo() { return this.core.loginInfo; }
|
|
1031
|
-
/**
|
|
1032
|
-
* Gets the signed-in account with its licence context.
|
|
1033
|
-
* @returns The current {@link EvolutionUserInfo}, or undefined when there is no session.
|
|
1034
|
-
*/
|
|
1035
|
-
get user() { return this.core.user; }
|
|
1036
|
-
/** `true` when this browser has a session the API has accepted. */
|
|
1037
|
-
get loggedIn() { return this.core.loggedIn; }
|
|
1038
|
-
/** `true` while an authentication is in flight. */
|
|
1039
|
-
get loggingIn() { return this.core.loggingIn; }
|
|
1040
|
-
// ── Re-published core operations ────────────────────────────────────────────
|
|
1041
|
-
/**
|
|
1042
|
-
* Persists the current login info to `localStorage` (delegates to core).
|
|
1043
|
-
* @returns void
|
|
1044
|
-
*/
|
|
1045
|
-
storeContext() { this.core.storeContext(); }
|
|
1046
|
-
/**
|
|
1047
|
-
* Merges a login result into the stored login info (delegates to core).
|
|
1048
|
-
* @param result - The login result returned by the login endpoint.
|
|
1049
|
-
* @returns void
|
|
1050
|
-
*/
|
|
1051
|
-
updateContext(result) { this.core.updateContext(result); }
|
|
1052
|
-
/**
|
|
1053
|
-
* Resets the in-memory login state and broadcasts logout-completed (delegates to core).
|
|
1054
|
-
* @returns void
|
|
1055
|
-
*/
|
|
1056
|
-
reset() { this.core.reset(); }
|
|
1057
|
-
/**
|
|
1058
|
-
* Clears every trace of the session on this device without asking the API anything
|
|
1059
|
-
* (delegates to core). Use {@link logout} for a real sign-out.
|
|
1060
|
-
* @returns void
|
|
1061
|
-
*/
|
|
1062
|
-
clear() { this.core.clear(); }
|
|
1063
|
-
// ── Lifecycle ───────────────────────────────────────────────────────────────
|
|
1064
|
-
/**
|
|
1065
|
-
* Initialises the service with the back-end URI and optional feature flags, and asks the API — the
|
|
1066
|
-
* only party that can read the HttpOnly cookie — whether this browser still holds a session.
|
|
1067
|
-
*
|
|
1068
|
-
* Must be called once during application bootstrap, before any other method. What it used to do
|
|
1069
|
-
* on a refresh was announce `LOGIN_COMPLETED` on the strength of a value in local storage; the
|
|
1070
|
-
* auth cookie is HttpOnly and may have expired while that value lived on, so the claim was never
|
|
1071
|
-
* verified and the consumer met the inevitable 401 as "your session just expired" rather than as
|
|
1072
|
-
* a bootstrap that never got off the ground.
|
|
1073
|
-
* @param serviceUri - Base URL of the Evolution service.
|
|
1074
|
-
* @param flags - Bitmask of `EvolutionServiceFlags` (default: `None`).
|
|
1075
|
-
* @returns void
|
|
1076
|
-
*/
|
|
1077
|
-
initialize(serviceUri, flags = EvolutionServiceFlags.None) {
|
|
1078
|
-
this.core.setServiceUri(serviceUri);
|
|
1079
|
-
this.core.setFlags(flags);
|
|
1080
|
-
// Subscribe to broadcast messages (only once)
|
|
1081
|
-
if (!this.broadcastInitialized) {
|
|
1082
|
-
this.broadcastInitialized = true;
|
|
1083
|
-
this.broadcastService
|
|
1084
|
-
.getMessage()
|
|
1085
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1086
|
-
.subscribe((message) => {
|
|
1087
|
-
this.handleBroadcastMessage(message);
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
// The probe runs UNCONDITIONALLY, where it used to run only when a stored context existed. The
|
|
1091
|
-
// stored context is just a hint -- "this browser signed in at some point" -- and the cookie can
|
|
1092
|
-
// outlive it: local storage cleared while the month-long cookie stayed put made this library
|
|
1093
|
-
// declare "no link" with a perfectly valid session in the browser. The API is the only one that
|
|
1094
|
-
// knows, and it is asked every time.
|
|
1095
|
-
this.core.loggingIn.set(true);
|
|
1096
|
-
this.restoreSession();
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Dispatches an incoming broadcast message to the appropriate handler.
|
|
1100
|
-
* @param message - The message received from the broadcast channel.
|
|
1101
|
-
* @returns void
|
|
1102
|
-
*/
|
|
1103
|
-
handleBroadcastMessage(message) {
|
|
1104
|
-
if (message.id !== EvolutionMessages.LOGOUT)
|
|
1105
|
-
return;
|
|
1106
|
-
if (!this.core.loggedIn()) {
|
|
1107
|
-
// No session to close server-side, but the device must still be left clean.
|
|
1108
|
-
this.core.clear();
|
|
1109
|
-
return;
|
|
1110
|
-
}
|
|
1111
|
-
this.logout().subscribe(r => {
|
|
1112
|
-
if (!r.success) {
|
|
1113
|
-
if (r.message) {
|
|
1114
|
-
this.broadcastService.sendMessage(EvolutionMessages.ERROR,
|
|
1115
|
-
// The surrounding markup is ours; the server's message is escaped, because the dialog
|
|
1116
|
-
// renders this string as HTML.
|
|
1117
|
-
{ message: "<p>" + escapeHtml(r.message) + "</p><br><br><hr><p class='small'><i>Per eliminare la configurazione di Evolution accedere a:<br><b>menu > personalizza > collegamenti</b></i></p>" });
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
else if ((this.core.flags & EvolutionServiceFlags.DisplayConnectionStateMessages) > 0) {
|
|
1121
|
-
this.broadcastService.sendMessage(EvolutionMessages.SUCCESS_TOAST, { message: 'Disconnesso da Evolution', icon: 'power_off', duration: 1500 });
|
|
1122
|
-
}
|
|
1123
|
-
});
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Sends a one-shot ping to the back end to verify connectivity. Errors are swallowed.
|
|
1127
|
-
* @returns void
|
|
1128
|
-
*/
|
|
1129
|
-
ping() {
|
|
1130
|
-
this.httpClient
|
|
1131
|
-
.get(this.core.serviceUri + '/ping?nocache=' + SystemUtils.generateUUID())
|
|
1132
|
-
.pipe(catchError$1(() => EMPTY))
|
|
1133
|
-
.subscribe();
|
|
1134
|
-
}
|
|
1135
|
-
// ── Session ─────────────────────────────────────────────────────────────────
|
|
1136
|
-
/**
|
|
1137
|
-
* Authenticates the user with an e-mail address and a password, the only credentials
|
|
1138
|
-
* `POST /session/login` accepts.
|
|
1139
|
-
*
|
|
1140
|
-
* On success the session cookie is issued and the context stored, unless the API answers
|
|
1141
|
-
* `requiresMfa`: the device is not a trusted one, a six-digit code has been e-mailed and nothing
|
|
1142
|
-
* about the account is disclosed until {@link confirmIdentity} redeems it.
|
|
1143
|
-
*
|
|
1144
|
-
* A failure is no longer a `200 OK` carrying `success: false`. Wrong credentials come back as a
|
|
1145
|
-
* real 4xx with the message in the envelope, so the `next` branch of the caller is never reached.
|
|
1146
|
-
* @param email - The user's e-mail address.
|
|
1147
|
-
* @param password - The user's password.
|
|
1148
|
-
* @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
|
|
1149
|
-
*/
|
|
1150
|
-
login(email, password) {
|
|
1151
|
-
// Kept for the confirmation step, which has to name the account the code was issued to.
|
|
1152
|
-
this.pendingLoginEmail = email;
|
|
1153
|
-
return this.httpClient
|
|
1154
|
-
.post(this.core.serviceUri + '/session/login', { user: email ?? '', password: password ?? '' })
|
|
1155
|
-
.pipe(catchError$1(err => throwError(() => err)), map((r) => {
|
|
1156
|
-
if (r.success) {
|
|
1157
|
-
if (r.value?.requiresMfa) {
|
|
1158
|
-
// Notify the login is pending an e-mailed code.
|
|
1159
|
-
this.broadcastService.sendMessage(EvolutionMessages.LOGIN_PENDING, {});
|
|
1160
|
-
}
|
|
1161
|
-
else {
|
|
1162
|
-
this.completeLogin(r.value);
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
return r;
|
|
1166
|
-
}));
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* Confirms a pending e-mailed code challenge, which establishes the session and marks this device
|
|
1170
|
-
* as trusted: the next sign-in from it will not ask for a code again.
|
|
1171
|
-
*
|
|
1172
|
-
* The address travels with the code, in the body. The API stores each code under the account it
|
|
1173
|
-
* was issued to, so naming the account is part of redeeming it; and a code in the body is a code
|
|
1174
|
-
* that stays out of the URL, where `POST /login/confirm/{code}` left it for the access logs and
|
|
1175
|
-
* the browser history to keep.
|
|
1176
|
-
* @param code - The one-time confirmation code provided to the user.
|
|
1177
|
-
* @param email - The address the code was sent to; defaults to the one the pending login started with.
|
|
1178
|
-
* @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
|
|
1179
|
-
*/
|
|
1180
|
-
confirmIdentity(code, email) {
|
|
1181
|
-
return this.httpClient
|
|
1182
|
-
.post(this.core.serviceUri + '/session/confirm', { email: email ?? this.pendingLoginEmail, code: code })
|
|
1183
|
-
.pipe(catchError$1(err => throwError(() => err)), map((r) => {
|
|
1184
|
-
if (r.success) {
|
|
1185
|
-
this.completeLogin(r.value);
|
|
1186
|
-
}
|
|
1187
|
-
return r;
|
|
1188
|
-
}));
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Asks the API whether this browser holds a live session, without ever failing with a 401: the
|
|
1192
|
-
* route is anonymous and answers `connected: false` to a caller with no session. This is the one
|
|
1193
|
-
* honest way to know the link state -- the auth cookie is HttpOnly and belongs to the API's host,
|
|
1194
|
-
* so it cannot be read from here, and its presence would prove nothing anyway, since the session
|
|
1195
|
-
* also lives server-side and may have been revoked or evicted.
|
|
1196
|
-
* @returns An observable that emits the `ApiResult<EvolutionSessionStatus>`.
|
|
1197
|
-
*/
|
|
1198
|
-
status() {
|
|
1199
|
-
return this.httpClient
|
|
1200
|
-
.get(this.core.serviceUri + '/session/status');
|
|
1201
|
-
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Reads the current session from the server, which resolves it from the auth cookie's claims.
|
|
1204
|
-
* Used to restore the state after a page refresh instead of trusting what local storage holds.
|
|
1205
|
-
*
|
|
1206
|
-
* The route answers with the same `EvolutionLoginResult` a login answers with, built by the same
|
|
1207
|
-
* `ResolveSignInContextAsync`, so a restored session and a fresh one are identical by
|
|
1208
|
-
* construction.
|
|
1209
|
-
* @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
|
|
1210
|
-
*/
|
|
1211
|
-
me() {
|
|
1212
|
-
return this.httpClient
|
|
1213
|
-
.get(this.core.serviceUri + '/session/me')
|
|
1214
|
-
.pipe(map((r) => {
|
|
1215
|
-
if (r?.success) {
|
|
1216
|
-
// No LOGIN_COMPLETED from here: {@link restoreSession} announces it, so a consumer
|
|
1217
|
-
// hears it once whether the session was opened or recovered.
|
|
1218
|
-
this.completeLogin(r.value, false);
|
|
1219
|
-
}
|
|
1220
|
-
return r;
|
|
1221
|
-
}));
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Asks `/session/status` whether this browser holds a live session, and hydrates the context
|
|
1225
|
-
* through {@link me} when it does.
|
|
1226
|
-
*
|
|
1227
|
-
* The probe is silent by construction: `/session/status` never answers 401, so a visitor who
|
|
1228
|
-
* never signed in -- or a cookie whose session has died -- comes back as `connected: false` with
|
|
1229
|
-
* no error broadcast and no dialog. Only then is the stale stored context cleared, so the
|
|
1230
|
-
* `loggedIn` signal tells the truth at every bootstrap.
|
|
1231
|
-
*
|
|
1232
|
-
* Nothing is cleared on a transport failure, and that is deliberate: an unreachable API is not
|
|
1233
|
-
* proof of a dead session -- the proxy may have answered 502, the device may be offline -- and
|
|
1234
|
-
* clearing on any of those would sign the user out with a perfectly valid cookie.
|
|
1235
|
-
* @returns void
|
|
1236
|
-
*/
|
|
1237
|
-
restoreSession() {
|
|
1238
|
-
// Whether the probe handed over to `/session/me`, which then owns lowering `loggingIn`.
|
|
1239
|
-
let restoring = false;
|
|
1240
|
-
this.status()
|
|
1241
|
-
.pipe(finalize(() => { if (!restoring) {
|
|
1242
|
-
this.core.loggingIn.set(false);
|
|
1243
|
-
} }))
|
|
1244
|
-
.subscribe({
|
|
1245
|
-
next: r => {
|
|
1246
|
-
if (r?.success && r.value?.connected) {
|
|
1247
|
-
restoring = true;
|
|
1248
|
-
this.me()
|
|
1249
|
-
.pipe(finalize(() => this.core.loggingIn.set(false)))
|
|
1250
|
-
.subscribe({
|
|
1251
|
-
next: m => {
|
|
1252
|
-
if (m?.success) {
|
|
1253
|
-
this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
|
|
1254
|
-
}
|
|
1255
|
-
},
|
|
1256
|
-
// Consumed so the rethrown error is not reported a second time as an unhandled one.
|
|
1257
|
-
error: () => { }
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
else if (this.core.loggedIn()) {
|
|
1261
|
-
// The stored context outlived its session: drop it, or the next bootstrap would keep
|
|
1262
|
-
// claiming a session that is gone.
|
|
1263
|
-
this.core.clear();
|
|
1264
|
-
}
|
|
1265
|
-
},
|
|
1266
|
-
// Transport failure: keep the stored hint, the next bootstrap will ask again.
|
|
1267
|
-
error: () => { }
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Switches this tab to another account of the same person -- same address, same stored password
|
|
1272
|
-
* -- without re-entering credentials.
|
|
1273
|
-
*
|
|
1274
|
-
* The account being left stays open: a switch used to close its session, because each account had
|
|
1275
|
-
* a cookie of its own, and they now share one cookie holding several. What changes here is only
|
|
1276
|
-
* which account THIS tab names on its requests, which {@link completeLogin} records.
|
|
1277
|
-
* @param id - The user ID to switch to.
|
|
1278
|
-
* @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
|
|
1279
|
-
*/
|
|
1280
|
-
loginSwitch(id) {
|
|
1281
|
-
return this.httpClient
|
|
1282
|
-
.post(this.core.serviceUri + '/session/switch', { userId: id })
|
|
1283
|
-
.pipe(catchError$1(err => throwError(() => err)), map((r) => {
|
|
1284
|
-
if (r.success) {
|
|
1285
|
-
this.completeLogin(r.value, false);
|
|
1286
|
-
}
|
|
1287
|
-
return r;
|
|
1288
|
-
}));
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* Signs out: closes this browser's session on the API and clears the local state whatever the
|
|
1292
|
-
* answer, since there is nothing useful to do with a logout that failed.
|
|
1293
|
-
*
|
|
1294
|
-
* `forget` no longer means "drop the stored credentials" -- there are none to drop. It means
|
|
1295
|
-
* "stop trusting this device", that is clear the MFA cookie, so that the next sign-in from here
|
|
1296
|
-
* is challenged with an e-mailed code again. It also closes one session and not all of them: an
|
|
1297
|
-
* account may hold one per front end, and signing out of this browser must not sign the person
|
|
1298
|
-
* out of their phone.
|
|
1299
|
-
* @param forget - When `true`, the device stops being a trusted one. Defaults to `false`.
|
|
1300
|
-
* @returns An observable that emits `ApiResult<unknown>`.
|
|
1301
|
-
*/
|
|
1302
|
-
logout(forget = false) {
|
|
1303
|
-
return this.httpClient
|
|
1304
|
-
.post(this.core.serviceUri + '/session/logout?forget=' + forget, {})
|
|
1305
|
-
.pipe(finalize(() => this.core.clear()),
|
|
1306
|
-
// A logout that failed is still a logout as far as this device is concerned: the local
|
|
1307
|
-
// state has already been cleared by `finalize`, and there is nothing useful a caller could
|
|
1308
|
-
// do with the failure. `message` is empty rather than absent because `ApiResponse` declares
|
|
1309
|
-
// it as a string.
|
|
1310
|
-
catchError$1(() => of({ success: false, value: undefined, message: '' })));
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Finalises a login, a code confirmation, an account switch or a session restore: stores the
|
|
1314
|
-
* context, raises the logged-in signal, records which account this tab is working as and
|
|
1315
|
-
* optionally announces `LOGIN_COMPLETED`.
|
|
1316
|
-
*
|
|
1317
|
-
* `loggedIn` is raised unconditionally. It used to be `!result.context?.isTemporary`, and
|
|
1318
|
-
* `isTemporary` was always false -- it is `[NotMapped]` on the API and never filled -- so the
|
|
1319
|
-
* condition never did anything. An expired password is reported by `requiresPasswordChange` and
|
|
1320
|
-
* does not mean there is no session: the cookie has been issued, and it is what the password
|
|
1321
|
-
* change itself travels on.
|
|
1322
|
-
*
|
|
1323
|
-
* `loggingIn` is deliberately left alone. Whoever raised it lowers it -- {@link restoreSession}
|
|
1324
|
-
* for a refresh, the host application for its own sign-in flow -- because lowering it here would
|
|
1325
|
-
* drop the host's splash the instant the response arrived, before anything was on screen.
|
|
1326
|
-
* @param result - The login result payload from the server.
|
|
1327
|
-
* @param notify - Whether to broadcast `LOGIN_COMPLETED`. Defaults to `true`.
|
|
1328
|
-
* @returns void
|
|
1329
|
-
*/
|
|
1330
|
-
completeLogin(result, notify = true) {
|
|
1331
|
-
this.core.updateContext(result);
|
|
1332
|
-
this.core.setLoggedIn(true);
|
|
1333
|
-
// Which account THIS TAB is working as. Per tab on purpose: two tabs may sit on two different
|
|
1334
|
-
// licences, and they share the one cookie that holds both.
|
|
1335
|
-
this.core.setActiveAccount(result?.context?.userId);
|
|
1336
|
-
if (notify) {
|
|
1337
|
-
this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LoginService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
1341
|
-
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.7", ngImport: i0, type: LoginService }); }
|
|
1342
|
-
}
|
|
1343
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LoginService, decorators: [{
|
|
1344
|
-
type: Service
|
|
1345
|
-
}] });
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* Compliance endpoints: taxonomy & groups, context, registers, laws and
|
|
1349
|
-
* activities (the `Context` / `Registers` / `Laws` / `Activities` sections,
|
|
1350
|
-
* plus the general taxonomy/groups lookups). Pure HTTP; injects the private
|
|
1351
|
-
* {@link CoreService} only to read the back-end URI.
|
|
1352
|
-
*/
|
|
1353
|
-
class ComplianceService {
|
|
1354
|
-
constructor() {
|
|
1355
|
-
this.httpClient = inject(HttpClient);
|
|
1356
|
-
this.core = inject(CoreService);
|
|
1357
|
-
}
|
|
1358
|
-
// ── Taxonomy & groups ───────────────────────────────────────────────────────
|
|
1359
|
-
/**
|
|
1360
|
-
* Retrieves the taxonomy tree from the back end.
|
|
1361
|
-
* @returns An observable that emits `ApiResult<FolderTree>`.
|
|
1362
|
-
*/
|
|
1363
|
-
getTaxonomy() {
|
|
1364
|
-
return this.httpClient.get(this.core.serviceUri + '/taxonomy');
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* Retrieves the compliance groups for a register.
|
|
1368
|
-
* @param group - Group index to retrieve (default: `1`).
|
|
1369
|
-
* @param register - Optional register ID to scope the query.
|
|
1370
|
-
* @returns An observable that emits `ApiResult<string[]>`.
|
|
1371
|
-
*/
|
|
1372
|
-
getGroups(group = 1, register) {
|
|
1373
|
-
const path = register
|
|
1374
|
-
? `/compliance/groups/?group=${group}®ister=${register}`
|
|
1375
|
-
: `/compliance/groups/?group=${group}`;
|
|
1376
|
-
return this.httpClient.get(this.core.serviceUri + path);
|
|
1377
|
-
}
|
|
1378
|
-
// ── Context ──────────────────────────────────────────────────────────────────
|
|
1379
|
-
/**
|
|
1380
|
-
* Sends a context-change request to the back end.
|
|
1381
|
-
* @param params - The context model describing the desired switch.
|
|
1382
|
-
* @returns An observable that emits `ApiResult<EvolutionChangeContextResultModel>`.
|
|
1383
|
-
*/
|
|
1384
|
-
changeContext(params) {
|
|
1385
|
-
return this.httpClient.post(this.core.serviceUri + '/compliance/context', params);
|
|
1386
|
-
}
|
|
1387
|
-
// ── Registers ────────────────────────────────────────────────────────────────
|
|
1388
|
-
/**
|
|
1389
|
-
* Retrieves a single compliance register by ID.
|
|
1390
|
-
* @param id - The register ID.
|
|
1391
|
-
* @returns An observable that emits `ApiResult<EvolutionComplianceRegister>`.
|
|
1392
|
-
*/
|
|
1393
|
-
getRegister(id) {
|
|
1394
|
-
return this.httpClient.get(this.core.serviceUri + '/compliance/registers/' + id);
|
|
1395
|
-
}
|
|
1396
|
-
/**
|
|
1397
|
-
* Collects register profiles matching the given query parameters.
|
|
1398
|
-
* @param params - Query parameters defining the filter criteria.
|
|
1399
|
-
* @returns An observable that emits `ApiResult<EvolutionComplianceRegisterProfile[]>`.
|
|
1400
|
-
*/
|
|
1401
|
-
collectRegisterProfiles(params) {
|
|
1402
|
-
return this.httpClient.post(this.core.serviceUri + '/compliance/registers/profiles/collect', params);
|
|
1403
|
-
}
|
|
1404
|
-
// ── Laws ─────────────────────────────────────────────────────────────────────
|
|
1405
|
-
/**
|
|
1406
|
-
* Adds one or more compliance laws.
|
|
1407
|
-
* @param params - The laws to add.
|
|
1408
|
-
* @returns An observable that emits `ApiResult<EvolutionComplianceLaw[]>`.
|
|
1409
|
-
*/
|
|
1410
|
-
addLaws(params) {
|
|
1411
|
-
return this.httpClient.post(this.core.serviceUri + '/compliance/laws/add', params);
|
|
1412
|
-
}
|
|
1413
|
-
/**
|
|
1414
|
-
* Exports compliance laws in the format expected by the server.
|
|
1415
|
-
* @param params - Export parameters (model shape is server-defined).
|
|
1416
|
-
* @returns An observable that emits the binary blob response.
|
|
1417
|
-
*/
|
|
1418
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1419
|
-
exportLaws(params) {
|
|
1420
|
-
return this.httpClient.post(this.core.serviceUri + '/compliance/laws/export', params, { responseType: 'blob' });
|
|
1421
|
-
}
|
|
1422
|
-
// ── Activities ─────────────────────────────────────────────────────────────────
|
|
1423
|
-
/**
|
|
1424
|
-
* Adds one or more compliance activities.
|
|
1425
|
-
* @param params - The activities to add.
|
|
1426
|
-
* @returns An observable that emits `ApiResult<EvolutionComplianceActivity>`.
|
|
1427
|
-
*/
|
|
1428
|
-
addActivities(params) {
|
|
1429
|
-
return this.httpClient.post(this.core.serviceUri + '/compliance/activities/add', params);
|
|
1430
|
-
}
|
|
1431
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ComplianceService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
1432
|
-
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.7", ngImport: i0, type: ComplianceService }); }
|
|
702
|
+
let lastErrorTime = -1;
|
|
703
|
+
let sessionExpiredNotified = false;
|
|
704
|
+
let unavailableNotified = false;
|
|
705
|
+
function notifyError(error, errorStatus, broadcastService) {
|
|
706
|
+
if (errorStatus >= 500 && (flags & EvolutionServiceFlags.NotifySystemErrors) === 0) return;
|
|
707
|
+
const now = Date.now();
|
|
708
|
+
if (now - lastErrorTime <= ERROR_DEBOUNCE_MS) return;
|
|
709
|
+
lastErrorTime = now;
|
|
710
|
+
broadcastService.sendMessage(EvolutionMessages.ERROR, {
|
|
711
|
+
invalidateSession: false,
|
|
712
|
+
message: resolveErrorMessage(error, errorStatus),
|
|
713
|
+
title: "Errore in Evolution",
|
|
714
|
+
errorStatus,
|
|
715
|
+
service: serviceUri
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
return (request, next) => {
|
|
719
|
+
if (!serviceUri || !request.url.startsWith(serviceUri)) return next(request);
|
|
720
|
+
const broadcastService = inject(BroadcastService);
|
|
721
|
+
const authenticatedRequest = request.clone({
|
|
722
|
+
withCredentials: true,
|
|
723
|
+
setHeaders: {
|
|
724
|
+
"ngsw-bypass": "ngsw-bypass",
|
|
725
|
+
"X-Evo-Account": sessionStorage.getItem("evolution_account") ?? ""
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
return next(authenticatedRequest).pipe(retry({
|
|
729
|
+
count: UNAVAILABLE_RETRIES,
|
|
730
|
+
delay: (error) => isServiceUnavailable(error) ? timer(UNAVAILABLE_RETRY_DELAY) : throwError(() => error)
|
|
731
|
+
}), tap((event) => {
|
|
732
|
+
if (event instanceof HttpResponse) {
|
|
733
|
+
sessionExpiredNotified = false;
|
|
734
|
+
unavailableNotified = false;
|
|
735
|
+
}
|
|
736
|
+
}), catchError((error) => {
|
|
737
|
+
const errorStatus = parseInt(error?.status ?? "0");
|
|
738
|
+
if (isStatusProbe(authenticatedRequest.url)) {} else if (isServiceUnavailable(error)) {
|
|
739
|
+
if (!unavailableNotified) {
|
|
740
|
+
unavailableNotified = true;
|
|
741
|
+
broadcastService.sendMessage(EvolutionMessages.ERROR_UNAVAILABLE);
|
|
742
|
+
}
|
|
743
|
+
} else if (isSessionExpired(errorStatus, authenticatedRequest.url)) {
|
|
744
|
+
if (!sessionExpiredNotified) {
|
|
745
|
+
sessionExpiredNotified = true;
|
|
746
|
+
broadcastService.sendMessage(EvolutionMessages.ERROR_401);
|
|
747
|
+
}
|
|
748
|
+
} else notifyError(error, errorStatus, broadcastService);
|
|
749
|
+
return EMPTY;
|
|
750
|
+
}));
|
|
751
|
+
};
|
|
1433
752
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
i0.ɵɵ
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
753
|
+
var CoreService = class CoreService {
|
|
754
|
+
constructor() {
|
|
755
|
+
this.broadcastService = inject(BroadcastService);
|
|
756
|
+
this._flags = EvolutionServiceFlags.None;
|
|
757
|
+
this._loggedIn = signal(localStorage.getItem("evolution_context") !== null, ...ngDevMode ? [{ debugName: "_loggedIn" }] : /* istanbul ignore next */ []);
|
|
758
|
+
this.loggedIn = this._loggedIn.asReadonly();
|
|
759
|
+
this.loggingIn = signal(false, ...ngDevMode ? [{ debugName: "loggingIn" }] : /* istanbul ignore next */ []);
|
|
760
|
+
}
|
|
761
|
+
get serviceUri() {
|
|
762
|
+
return this._serviceUri;
|
|
763
|
+
}
|
|
764
|
+
setServiceUri(uri) {
|
|
765
|
+
this._serviceUri = uri;
|
|
766
|
+
}
|
|
767
|
+
get flags() {
|
|
768
|
+
return this._flags;
|
|
769
|
+
}
|
|
770
|
+
setFlags(flags) {
|
|
771
|
+
this._flags = flags;
|
|
772
|
+
}
|
|
773
|
+
get loginInfo() {
|
|
774
|
+
if (!this._loginInfo) {
|
|
775
|
+
const raw = localStorage.getItem("evolution_context");
|
|
776
|
+
if (raw) try {
|
|
777
|
+
this._loginInfo = JSON.parse(raw);
|
|
778
|
+
} catch {}
|
|
779
|
+
}
|
|
780
|
+
return this._loginInfo;
|
|
781
|
+
}
|
|
782
|
+
get user() {
|
|
783
|
+
return this.loginInfo?.context;
|
|
784
|
+
}
|
|
785
|
+
setLoggedIn(value) {
|
|
786
|
+
this._loggedIn.set(value);
|
|
787
|
+
}
|
|
788
|
+
static {
|
|
789
|
+
this.activeAccountKey = EVOLUTION_ACTIVE_ACCOUNT_KEY;
|
|
790
|
+
}
|
|
791
|
+
setActiveAccount(userId) {
|
|
792
|
+
if (userId && userId > 0) sessionStorage.setItem(CoreService.activeAccountKey, String(userId));
|
|
793
|
+
else sessionStorage.removeItem(CoreService.activeAccountKey);
|
|
794
|
+
}
|
|
795
|
+
storeContext() {
|
|
796
|
+
localStorage.setItem("evolution_context", JSON.stringify(this._loginInfo));
|
|
797
|
+
}
|
|
798
|
+
updateContext(result) {
|
|
799
|
+
if (!this._loginInfo) this._loginInfo = { context: void 0 };
|
|
800
|
+
this._loginInfo.context = result.context;
|
|
801
|
+
this.storeContext();
|
|
802
|
+
}
|
|
803
|
+
reset() {
|
|
804
|
+
this._loginInfo = void 0;
|
|
805
|
+
this._loggedIn.set(false);
|
|
806
|
+
this.broadcastService.sendMessage(EvolutionMessages.LOGOUT_COMPLETED);
|
|
807
|
+
}
|
|
808
|
+
clear() {
|
|
809
|
+
localStorage.removeItem("evolution_context");
|
|
810
|
+
sessionStorage.removeItem(CoreService.activeAccountKey);
|
|
811
|
+
sessionStorage.removeItem("evolution_auth");
|
|
812
|
+
sessionStorage.removeItem("evolution_refresh");
|
|
813
|
+
sessionStorage.removeItem("evolution_oauth");
|
|
814
|
+
sessionStorage.removeItem("evolution_auth_oauth");
|
|
815
|
+
sessionStorage.removeItem("evolution_oauth_token");
|
|
816
|
+
sessionStorage.removeItem("evolution_client_id");
|
|
817
|
+
this.reset();
|
|
818
|
+
}
|
|
819
|
+
static {
|
|
820
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
821
|
+
minVersion: "12.0.0",
|
|
822
|
+
version: "22.2.1",
|
|
823
|
+
ngImport: i0,
|
|
824
|
+
type: CoreService,
|
|
825
|
+
deps: [],
|
|
826
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
static {
|
|
830
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
831
|
+
minVersion: "22.0.0",
|
|
832
|
+
version: "22.2.1",
|
|
833
|
+
ngImport: i0,
|
|
834
|
+
type: CoreService
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
839
|
+
minVersion: "12.0.0",
|
|
840
|
+
version: "22.2.1",
|
|
841
|
+
ngImport: i0,
|
|
842
|
+
type: CoreService,
|
|
843
|
+
decorators: [{ type: Service }]
|
|
844
|
+
});
|
|
845
|
+
var LoginService = class LoginService {
|
|
846
|
+
constructor() {
|
|
847
|
+
this.httpClient = inject(HttpClient);
|
|
848
|
+
this.broadcastService = inject(BroadcastService);
|
|
849
|
+
this.destroyRef = inject(DestroyRef);
|
|
850
|
+
this.core = inject(CoreService);
|
|
851
|
+
this.broadcastInitialized = false;
|
|
852
|
+
}
|
|
853
|
+
get serviceUri() {
|
|
854
|
+
return this.core.serviceUri;
|
|
855
|
+
}
|
|
856
|
+
get flags() {
|
|
857
|
+
return this.core.flags;
|
|
858
|
+
}
|
|
859
|
+
get loginInfo() {
|
|
860
|
+
return this.core.loginInfo;
|
|
861
|
+
}
|
|
862
|
+
get user() {
|
|
863
|
+
return this.core.user;
|
|
864
|
+
}
|
|
865
|
+
get loggedIn() {
|
|
866
|
+
return this.core.loggedIn;
|
|
867
|
+
}
|
|
868
|
+
get loggingIn() {
|
|
869
|
+
return this.core.loggingIn;
|
|
870
|
+
}
|
|
871
|
+
storeContext() {
|
|
872
|
+
this.core.storeContext();
|
|
873
|
+
}
|
|
874
|
+
updateContext(result) {
|
|
875
|
+
this.core.updateContext(result);
|
|
876
|
+
}
|
|
877
|
+
reset() {
|
|
878
|
+
this.core.reset();
|
|
879
|
+
}
|
|
880
|
+
clear() {
|
|
881
|
+
this.core.clear();
|
|
882
|
+
}
|
|
883
|
+
initialize(serviceUri, flags = EvolutionServiceFlags.None) {
|
|
884
|
+
this.core.setServiceUri(serviceUri);
|
|
885
|
+
this.core.setFlags(flags);
|
|
886
|
+
if (!this.broadcastInitialized) {
|
|
887
|
+
this.broadcastInitialized = true;
|
|
888
|
+
this.broadcastService.getMessage().pipe(takeUntilDestroyed(this.destroyRef)).subscribe((message) => {
|
|
889
|
+
this.handleBroadcastMessage(message);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
this.core.loggingIn.set(true);
|
|
893
|
+
this.restoreSession();
|
|
894
|
+
}
|
|
895
|
+
handleBroadcastMessage(message) {
|
|
896
|
+
if (message.id !== EvolutionMessages.LOGOUT) return;
|
|
897
|
+
if (!this.core.loggedIn()) {
|
|
898
|
+
this.core.clear();
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
this.logout().subscribe((r) => {
|
|
902
|
+
if (!r.success) {
|
|
903
|
+
if (r.message) this.broadcastService.sendMessage(EvolutionMessages.ERROR, { message: "<p>" + escapeHtml(r.message) + "</p><br><br><hr><p class='small'><i>Per eliminare la configurazione di Evolution accedere a:<br><b>menu > personalizza > collegamenti</b></i></p>" });
|
|
904
|
+
} else if ((this.core.flags & EvolutionServiceFlags.DisplayConnectionStateMessages) > 0) this.broadcastService.sendMessage(EvolutionMessages.SUCCESS_TOAST, {
|
|
905
|
+
message: "Disconnesso da Evolution",
|
|
906
|
+
icon: "power_off",
|
|
907
|
+
duration: 1500
|
|
908
|
+
});
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
ping() {
|
|
912
|
+
this.httpClient.get(this.core.serviceUri + "/ping?nocache=" + SystemUtils.generateUUID()).pipe(catchError$1(() => EMPTY)).subscribe();
|
|
913
|
+
}
|
|
914
|
+
login(email, password) {
|
|
915
|
+
this.pendingLoginEmail = email;
|
|
916
|
+
return this.httpClient.post(this.core.serviceUri + "/session/login", {
|
|
917
|
+
user: email ?? "",
|
|
918
|
+
password: password ?? ""
|
|
919
|
+
}).pipe(catchError$1((err) => throwError(() => err)), map((r) => {
|
|
920
|
+
if (r.success) {
|
|
921
|
+
if (r.value?.requiresMfa) this.broadcastService.sendMessage(EvolutionMessages.LOGIN_PENDING, {});
|
|
922
|
+
else this.completeLogin(r.value);
|
|
923
|
+
}
|
|
924
|
+
return r;
|
|
925
|
+
}));
|
|
926
|
+
}
|
|
927
|
+
confirmIdentity(code, email) {
|
|
928
|
+
return this.httpClient.post(this.core.serviceUri + "/session/confirm", {
|
|
929
|
+
email: email ?? this.pendingLoginEmail,
|
|
930
|
+
code
|
|
931
|
+
}).pipe(catchError$1((err) => throwError(() => err)), map((r) => {
|
|
932
|
+
if (r.success) this.completeLogin(r.value);
|
|
933
|
+
return r;
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
status() {
|
|
937
|
+
return this.httpClient.get(this.core.serviceUri + "/session/status");
|
|
938
|
+
}
|
|
939
|
+
me() {
|
|
940
|
+
return this.httpClient.get(this.core.serviceUri + "/session/me").pipe(map((r) => {
|
|
941
|
+
if (r?.success) this.completeLogin(r.value, false);
|
|
942
|
+
return r;
|
|
943
|
+
}));
|
|
944
|
+
}
|
|
945
|
+
restoreSession() {
|
|
946
|
+
let restoring = false;
|
|
947
|
+
this.status().pipe(finalize(() => {
|
|
948
|
+
if (!restoring) this.core.loggingIn.set(false);
|
|
949
|
+
})).subscribe({
|
|
950
|
+
next: (r) => {
|
|
951
|
+
if (r?.success && r.value?.connected) {
|
|
952
|
+
restoring = true;
|
|
953
|
+
this.me().pipe(finalize(() => this.core.loggingIn.set(false))).subscribe({
|
|
954
|
+
next: (m) => {
|
|
955
|
+
if (m?.success) this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
|
|
956
|
+
},
|
|
957
|
+
error: () => {}
|
|
958
|
+
});
|
|
959
|
+
} else if (this.core.loggedIn()) this.core.clear();
|
|
960
|
+
},
|
|
961
|
+
error: () => {}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
loginSwitch(id) {
|
|
965
|
+
return this.httpClient.post(this.core.serviceUri + "/session/switch", { userId: id }).pipe(catchError$1((err) => throwError(() => err)), map((r) => {
|
|
966
|
+
if (r.success) this.completeLogin(r.value, false);
|
|
967
|
+
return r;
|
|
968
|
+
}));
|
|
969
|
+
}
|
|
970
|
+
logout(forget = false) {
|
|
971
|
+
return this.httpClient.post(this.core.serviceUri + "/session/logout?forget=" + forget, {}).pipe(finalize(() => this.core.clear()), catchError$1(() => of({
|
|
972
|
+
success: false,
|
|
973
|
+
value: void 0,
|
|
974
|
+
message: ""
|
|
975
|
+
})));
|
|
976
|
+
}
|
|
977
|
+
completeLogin(result, notify = true) {
|
|
978
|
+
this.core.updateContext(result);
|
|
979
|
+
this.core.setLoggedIn(true);
|
|
980
|
+
this.core.setActiveAccount(result?.context?.userId);
|
|
981
|
+
if (notify) this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
|
|
982
|
+
}
|
|
983
|
+
static {
|
|
984
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
985
|
+
minVersion: "12.0.0",
|
|
986
|
+
version: "22.2.1",
|
|
987
|
+
ngImport: i0,
|
|
988
|
+
type: LoginService,
|
|
989
|
+
deps: [],
|
|
990
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
static {
|
|
994
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
995
|
+
minVersion: "22.0.0",
|
|
996
|
+
version: "22.2.1",
|
|
997
|
+
ngImport: i0,
|
|
998
|
+
type: LoginService
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1003
|
+
minVersion: "12.0.0",
|
|
1004
|
+
version: "22.2.1",
|
|
1005
|
+
ngImport: i0,
|
|
1006
|
+
type: LoginService,
|
|
1007
|
+
decorators: [{ type: Service }]
|
|
1008
|
+
});
|
|
1009
|
+
var ComplianceService = class ComplianceService {
|
|
1010
|
+
constructor() {
|
|
1011
|
+
this.httpClient = inject(HttpClient);
|
|
1012
|
+
this.core = inject(CoreService);
|
|
1013
|
+
}
|
|
1014
|
+
getTaxonomy() {
|
|
1015
|
+
return this.httpClient.get(this.core.serviceUri + "/taxonomy");
|
|
1016
|
+
}
|
|
1017
|
+
getGroups(group = 1, register) {
|
|
1018
|
+
const path = register ? `/compliance/groups/?group=${group}®ister=${register}` : `/compliance/groups/?group=${group}`;
|
|
1019
|
+
return this.httpClient.get(this.core.serviceUri + path);
|
|
1020
|
+
}
|
|
1021
|
+
changeContext(params) {
|
|
1022
|
+
return this.httpClient.post(this.core.serviceUri + "/compliance/context", params);
|
|
1023
|
+
}
|
|
1024
|
+
getRegister(id) {
|
|
1025
|
+
return this.httpClient.get(this.core.serviceUri + "/compliance/registers/" + id);
|
|
1026
|
+
}
|
|
1027
|
+
collectRegisterProfiles(params) {
|
|
1028
|
+
return this.httpClient.post(this.core.serviceUri + "/compliance/registers/profiles/collect", params);
|
|
1029
|
+
}
|
|
1030
|
+
addLaws(params) {
|
|
1031
|
+
return this.httpClient.post(this.core.serviceUri + "/compliance/laws/add", params);
|
|
1032
|
+
}
|
|
1033
|
+
exportLaws(params) {
|
|
1034
|
+
return this.httpClient.post(this.core.serviceUri + "/compliance/laws/export", params, { responseType: "blob" });
|
|
1035
|
+
}
|
|
1036
|
+
addActivities(params) {
|
|
1037
|
+
return this.httpClient.post(this.core.serviceUri + "/compliance/activities/add", params);
|
|
1038
|
+
}
|
|
1039
|
+
static {
|
|
1040
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1041
|
+
minVersion: "12.0.0",
|
|
1042
|
+
version: "22.2.1",
|
|
1043
|
+
ngImport: i0,
|
|
1044
|
+
type: ComplianceService,
|
|
1045
|
+
deps: [],
|
|
1046
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
static {
|
|
1050
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
1051
|
+
minVersion: "22.0.0",
|
|
1052
|
+
version: "22.2.1",
|
|
1053
|
+
ngImport: i0,
|
|
1054
|
+
type: ComplianceService
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1059
|
+
minVersion: "12.0.0",
|
|
1060
|
+
version: "22.2.1",
|
|
1061
|
+
ngImport: i0,
|
|
1062
|
+
type: ComplianceService,
|
|
1063
|
+
decorators: [{ type: Service }]
|
|
1064
|
+
});
|
|
1065
|
+
var AccountService = class AccountService {
|
|
1066
|
+
constructor() {
|
|
1067
|
+
this.httpClient = inject(HttpClient);
|
|
1068
|
+
this.core = inject(CoreService);
|
|
1069
|
+
}
|
|
1070
|
+
saveLink(item) {
|
|
1071
|
+
return this.httpClient.post(this.core.serviceUri + "/account/links/save", item);
|
|
1072
|
+
}
|
|
1073
|
+
deleteLink(item) {
|
|
1074
|
+
return this.httpClient.post(this.core.serviceUri + "/account/links/delete", item);
|
|
1075
|
+
}
|
|
1076
|
+
updateSettings(params) {
|
|
1077
|
+
return this.httpClient.post(this.core.serviceUri + "/account/settings/save", params);
|
|
1078
|
+
}
|
|
1079
|
+
resetPassword(params) {
|
|
1080
|
+
return this.httpClient.post(this.core.serviceUri + "/account/password/reset", params);
|
|
1081
|
+
}
|
|
1082
|
+
recoverPassword(params) {
|
|
1083
|
+
return this.httpClient.post(this.core.serviceUri + "/account/password/recover", params);
|
|
1084
|
+
}
|
|
1085
|
+
refreshLicence() {
|
|
1086
|
+
return this.httpClient.get(this.core.serviceUri + "/account/licenses/refresh/" + (this.core.user?.userId ?? -1));
|
|
1087
|
+
}
|
|
1088
|
+
static {
|
|
1089
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1090
|
+
minVersion: "12.0.0",
|
|
1091
|
+
version: "22.2.1",
|
|
1092
|
+
ngImport: i0,
|
|
1093
|
+
type: AccountService,
|
|
1094
|
+
deps: [],
|
|
1095
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
static {
|
|
1099
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
1100
|
+
minVersion: "22.0.0",
|
|
1101
|
+
version: "22.2.1",
|
|
1102
|
+
ngImport: i0,
|
|
1103
|
+
type: AccountService
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1108
|
+
minVersion: "12.0.0",
|
|
1109
|
+
version: "22.2.1",
|
|
1110
|
+
ngImport: i0,
|
|
1111
|
+
type: AccountService,
|
|
1112
|
+
decorators: [{ type: Service }]
|
|
1113
|
+
});
|
|
1114
|
+
var EvolutionService = class EvolutionService {
|
|
1115
|
+
constructor() {
|
|
1116
|
+
this.core = inject(CoreService);
|
|
1117
|
+
this.session = inject(LoginService);
|
|
1118
|
+
this.compliance = inject(ComplianceService);
|
|
1119
|
+
this.account = inject(AccountService);
|
|
1120
|
+
}
|
|
1121
|
+
get serviceUri() {
|
|
1122
|
+
return this.core.serviceUri;
|
|
1123
|
+
}
|
|
1124
|
+
get flags() {
|
|
1125
|
+
return this.core.flags;
|
|
1126
|
+
}
|
|
1127
|
+
get loginInfo() {
|
|
1128
|
+
return this.core.loginInfo;
|
|
1129
|
+
}
|
|
1130
|
+
get user() {
|
|
1131
|
+
return this.core.user;
|
|
1132
|
+
}
|
|
1133
|
+
get loggedIn() {
|
|
1134
|
+
return this.core.loggedIn;
|
|
1135
|
+
}
|
|
1136
|
+
get loggingIn() {
|
|
1137
|
+
return this.core.loggingIn;
|
|
1138
|
+
}
|
|
1139
|
+
initialize(serviceUri, flags = EvolutionServiceFlags.None) {
|
|
1140
|
+
this.session.initialize(serviceUri, flags);
|
|
1141
|
+
}
|
|
1142
|
+
ping() {
|
|
1143
|
+
this.session.ping();
|
|
1144
|
+
}
|
|
1145
|
+
static {
|
|
1146
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1147
|
+
minVersion: "12.0.0",
|
|
1148
|
+
version: "22.2.1",
|
|
1149
|
+
ngImport: i0,
|
|
1150
|
+
type: EvolutionService,
|
|
1151
|
+
deps: [],
|
|
1152
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
static {
|
|
1156
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
1157
|
+
minVersion: "22.0.0",
|
|
1158
|
+
version: "22.2.1",
|
|
1159
|
+
ngImport: i0,
|
|
1160
|
+
type: EvolutionService
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1165
|
+
minVersion: "12.0.0",
|
|
1166
|
+
version: "22.2.1",
|
|
1167
|
+
ngImport: i0,
|
|
1168
|
+
type: EvolutionService,
|
|
1169
|
+
decorators: [{ type: Service }]
|
|
1170
|
+
});
|
|
1603
1171
|
export { AccountService, ComplianceService, ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPExportFormat, ERPExportPart, ERPExportSource, ERPExportType, ERPModule, ERPPlace, ERPPlacePermission, ERPRecurrenceFrequencyType, EVOLUTION_ACTIVE_ACCOUNT_KEY, EvolutionComplianceActivityStates, EvolutionComplianceContextInfo, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags, LoginService, evolutionAuthInterceptor };
|
|
1604
|
-
|
|
1172
|
+
|
|
1173
|
+
//# sourceMappingURL=arsedizioni-ars-utils-evolution.common.mjs.map
|