@arsedizioni/ars-utils 18.2.365 → 18.2.371

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/clipper.common/common/services/clipper.service.d.ts +1 -1
  2. package/clipper.ui/ui/document-menu/document-menu.component.d.ts +1 -1
  3. package/esm2022/clipper.common/common/common.module.mjs +4 -4
  4. package/esm2022/clipper.common/common/definitions.mjs +11 -11
  5. package/esm2022/clipper.common/common/interceptors/auth.interceptor.mjs +3 -3
  6. package/esm2022/clipper.common/common/services/clipper.service.mjs +24 -18
  7. package/esm2022/clipper.ui/ui/browser-dialog/browser-dialog.component.mjs +5 -5
  8. package/esm2022/clipper.ui/ui/document/document.component.mjs +3 -3
  9. package/esm2022/clipper.ui/ui/document-index/document-index.component.mjs +3 -3
  10. package/esm2022/clipper.ui/ui/document-manager/document-manager.mjs +3 -3
  11. package/esm2022/clipper.ui/ui/document-menu/document-menu.component.mjs +3 -3
  12. package/esm2022/clipper.ui/ui/references/references.component.mjs +5 -5
  13. package/esm2022/clipper.ui/ui/search-calendar/search-calendar.component.mjs +3 -3
  14. package/esm2022/clipper.ui/ui/search-dialog/search-dialog.component.mjs +5 -5
  15. package/esm2022/clipper.ui/ui/search-facets/search-facets.component.mjs +3 -3
  16. package/esm2022/clipper.ui/ui/search-free-text-help/search-free-text-help.component.mjs +3 -3
  17. package/esm2022/clipper.ui/ui/search-free-text-query-builder/search-free-text-query-builder.component.mjs +3 -3
  18. package/esm2022/clipper.ui/ui/search-result-item/search-result-item.component.mjs +4 -4
  19. package/esm2022/clipper.ui/ui/search-result-manager/search-result-manager.mjs +3 -3
  20. package/esm2022/core/core.module.mjs +8 -8
  21. package/esm2022/core/dateFnsAdapter.mjs +3 -3
  22. package/esm2022/core/directives/autoFocusDirective.mjs +3 -3
  23. package/esm2022/core/directives/changeDateIntervalDirective.mjs +3 -3
  24. package/esm2022/core/directives/copyClipboardDirective.mjs +4 -4
  25. package/esm2022/core/directives/validators.mjs +33 -33
  26. package/esm2022/core/pipes/format.pipe.mjs +4 -4
  27. package/esm2022/core/pipes/replace.pipe.mjs +4 -4
  28. package/esm2022/core/pipes/safe-html.pipe.mjs +4 -4
  29. package/esm2022/core/pipes/safe-url.pipe.mjs +4 -4
  30. package/esm2022/core/pipes/search-callback.pipe.mjs +3 -3
  31. package/esm2022/core/pipes/search-filter.pipe.mjs +4 -4
  32. package/esm2022/core/services/broadcast.service.mjs +3 -3
  33. package/esm2022/core/services/environment.service.mjs +3 -3
  34. package/esm2022/core/services/screen.service.mjs +3 -3
  35. package/esm2022/core/services/theme.service.mjs +3 -3
  36. package/esm2022/evolution.common/arsedizioni-ars-utils-evolution.common.mjs +5 -0
  37. package/esm2022/evolution.common/common/common.module.mjs +16 -0
  38. package/esm2022/evolution.common/common/definitions.mjs +358 -0
  39. package/esm2022/evolution.common/common/interceptors/auth.interceptor.mjs +83 -0
  40. package/esm2022/evolution.common/common/messages.mjs +8 -0
  41. package/esm2022/evolution.common/common/services/evolution.service.mjs +357 -0
  42. package/esm2022/evolution.common/public_api.mjs +5 -0
  43. package/esm2022/help/components/help-viewer/help-viewer.component.mjs +7 -7
  44. package/esm2022/help/help.module.mjs +4 -4
  45. package/esm2022/help/services/help.service.mjs +3 -3
  46. package/esm2022/public_api.mjs +2 -1
  47. package/esm2022/support.common/common/common.module.mjs +4 -4
  48. package/esm2022/support.common/common/interceptors/auth.interceptor.mjs +41 -35
  49. package/esm2022/support.common/common/messages.mjs +2 -1
  50. package/esm2022/support.common/common/services/support.service.mjs +37 -70
  51. package/esm2022/support.ui/ui/notifications-browser/notification/notification.component.mjs +3 -3
  52. package/esm2022/support.ui/ui/notifications-browser/notifications-browser.component.mjs +4 -4
  53. package/esm2022/tinymce/full-screen-editor/full-screen-editor.component.mjs +3 -3
  54. package/esm2022/tinymce/tinymce.module.mjs +4 -4
  55. package/esm2022/ui/ui/dialogs/busy/busy-dialog.component.mjs +3 -3
  56. package/esm2022/ui/ui/dialogs/confirm/confirm-dialog.component.mjs +4 -4
  57. package/esm2022/ui/ui/dialogs/credentials/credentials-dialog.component.mjs +4 -4
  58. package/esm2022/ui/ui/dialogs/info/info-dialog.component.mjs +3 -3
  59. package/esm2022/ui/ui/dialogs/recover-password/recover-password-dialog.component.mjs +3 -3
  60. package/esm2022/ui/ui/dialogs/reset-password/reset-password-dialog.component.mjs +3 -3
  61. package/esm2022/ui/ui/dialogs/toast/toast.component.mjs +3 -3
  62. package/esm2022/ui/ui/paginatorIntl.mjs +3 -3
  63. package/esm2022/ui/ui/services/dialog.service.mjs +3 -3
  64. package/esm2022/ui/ui/services/ui.service.mjs +3 -3
  65. package/esm2022/ui/ui/ui.module.mjs +4 -4
  66. package/esm2022/ui.application/ui/components/button-selector/button-selector.component.mjs +3 -3
  67. package/esm2022/ui.application/ui/components/button-toggle/button-toggle.component.mjs +3 -3
  68. package/esm2022/ui.application/ui/components/calendar-empty-header/calendar-empy-header.component.mjs +3 -3
  69. package/esm2022/ui.application/ui/components/chips-selector/chips-selector.component.mjs +3 -3
  70. package/esm2022/ui.application/ui/components/file-input/file-input.component.mjs +3 -3
  71. package/esm2022/ui.application/ui/components/file-preview/file-preview.component.mjs +3 -3
  72. package/esm2022/ui.application/ui/components/filter-bar/filter-bar.component.mjs +3 -3
  73. package/esm2022/ui.application/ui/dialogs/prompt/prompt-dialog.component.mjs +4 -4
  74. package/esm2022/ui.application/ui/dialogs/prompt-date/prompt-date-dialog.component.mjs +4 -4
  75. package/esm2022/ui.application/ui/dialogs/prompt-time/prompt-time-dialog.component.mjs +3 -3
  76. package/esm2022/ui.application/ui/dialogs/select/select-dialog.component.mjs +4 -4
  77. package/esm2022/ui.application/ui/dialogs/select-file/select-file-dialog.component.mjs +4 -4
  78. package/esm2022/ui.application/ui/dialogs/select-picture/select-picture-dialog.component.mjs +4 -4
  79. package/esm2022/ui.application/ui/dialogs/select-tree/select-tree-dialog.component.mjs +7 -7
  80. package/esm2022/ui.application/ui/dialogs/send-to/send-to-dialog.component.mjs +4 -4
  81. package/esm2022/ui.application/ui/directives/resize-table-column.directive.mjs +3 -3
  82. package/esm2022/ui.application/ui/services/applicationDialog.service.mjs +3 -3
  83. package/esm2022/ui.application/ui/ui.module.mjs +4 -4
  84. package/esm2022/ui.oauth/ui/components/login/login-oauth.component.mjs +3 -3
  85. package/esm2022/ui.oauth/ui/ui.module.mjs +4 -4
  86. package/evolution.common/common/common.module.d.ts +10 -0
  87. package/evolution.common/common/definitions.d.ts +166 -0
  88. package/evolution.common/common/interceptors/auth.interceptor.d.ts +24 -0
  89. package/evolution.common/common/messages.d.ts +6 -0
  90. package/evolution.common/common/services/evolution.service.d.ts +123 -0
  91. package/evolution.common/index.d.ts +5 -0
  92. package/evolution.common/public_api.d.ts +1 -0
  93. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +40 -34
  94. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  95. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +42 -42
  96. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  97. package/fesm2022/arsedizioni-ars-utils-core.mjs +89 -89
  98. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +817 -0
  99. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -0
  100. package/fesm2022/arsedizioni-ars-utils-help.mjs +13 -13
  101. package/fesm2022/arsedizioni-ars-utils-help.mjs.map +1 -1
  102. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +78 -107
  103. package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
  104. package/fesm2022/arsedizioni-ars-utils-support.ui.mjs +6 -6
  105. package/fesm2022/arsedizioni-ars-utils-support.ui.mjs.map +1 -1
  106. package/fesm2022/arsedizioni-ars-utils-tinymce.mjs +7 -7
  107. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +58 -58
  108. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs.map +1 -1
  109. package/fesm2022/arsedizioni-ars-utils-ui.mjs +34 -34
  110. package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
  111. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +7 -7
  112. package/fesm2022/arsedizioni-ars-utils.mjs +1 -0
  113. package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
  114. package/package.json +18 -12
  115. package/public_api.d.ts +1 -0
  116. package/support.common/common/interceptors/auth.interceptor.d.ts +8 -0
  117. package/support.common/common/messages.d.ts +1 -0
  118. package/support.common/common/services/support.service.d.ts +15 -26
@@ -0,0 +1,817 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, signal, Injectable, NgModule } from '@angular/core';
3
+ import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
4
+ import { BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';
5
+ import { DialogService } from '@arsedizioni/ars-utils/ui';
6
+ import { throwError, of, catchError as catchError$1, switchMap } from 'rxjs';
7
+ import { catchError, map } from 'rxjs/operators';
8
+
9
+ const EvolutionMessages = {
10
+ // Login
11
+ LOGIN_CHANGED: '§evo-login-changed',
12
+ LOGIN_COMPLETED: '§evo-login-completed',
13
+ LOGOUT_COMPLETED: '§evo-logout-completed',
14
+ LOGOUT: '§evo-logout'
15
+ };
16
+
17
+ var ERPComplianceLawsSelectionType;
18
+ (function (ERPComplianceLawsSelectionType) {
19
+ ERPComplianceLawsSelectionType[ERPComplianceLawsSelectionType["Analysis"] = 1] = "Analysis";
20
+ ERPComplianceLawsSelectionType[ERPComplianceLawsSelectionType["Activity"] = 2] = "Activity";
21
+ })(ERPComplianceLawsSelectionType || (ERPComplianceLawsSelectionType = {}));
22
+ var ERPComplianceProfileRole;
23
+ (function (ERPComplianceProfileRole) {
24
+ ERPComplianceProfileRole[ERPComplianceProfileRole["None"] = 0] = "None";
25
+ ERPComplianceProfileRole[ERPComplianceProfileRole["Analyst"] = 1] = "Analyst";
26
+ ERPComplianceProfileRole[ERPComplianceProfileRole["Planner"] = 2] = "Planner";
27
+ ERPComplianceProfileRole[ERPComplianceProfileRole["Validator"] = 4] = "Validator";
28
+ ERPComplianceProfileRole[ERPComplianceProfileRole["Executor"] = 8] = "Executor";
29
+ ERPComplianceProfileRole[ERPComplianceProfileRole["Observer"] = 16] = "Observer";
30
+ })(ERPComplianceProfileRole || (ERPComplianceProfileRole = {}));
31
+ var ERPComplianceProfileFlags;
32
+ (function (ERPComplianceProfileFlags) {
33
+ ERPComplianceProfileFlags[ERPComplianceProfileFlags["OverrideNotificationRegisterSettings"] = 16] = "OverrideNotificationRegisterSettings";
34
+ })(ERPComplianceProfileFlags || (ERPComplianceProfileFlags = {}));
35
+ var ERPComplianceScope;
36
+ (function (ERPComplianceScope) {
37
+ ERPComplianceScope[ERPComplianceScope["None"] = 0] = "None";
38
+ ERPComplianceScope[ERPComplianceScope["Environment"] = 1] = "Environment";
39
+ ERPComplianceScope[ERPComplianceScope["Safety"] = 2] = "Safety";
40
+ ERPComplianceScope[ERPComplianceScope["FoodSafety"] = 4] = "FoodSafety";
41
+ ERPComplianceScope[ERPComplianceScope["Energy"] = 8] = "Energy";
42
+ ERPComplianceScope[ERPComplianceScope["Health"] = 16] = "Health";
43
+ ERPComplianceScope[ERPComplianceScope["Maintenance"] = 32] = "Maintenance";
44
+ ERPComplianceScope[ERPComplianceScope["Quality"] = 64] = "Quality";
45
+ ERPComplianceScope[ERPComplianceScope["Organization"] = 128] = "Organization";
46
+ ERPComplianceScope[ERPComplianceScope["Logistics"] = 256] = "Logistics";
47
+ ERPComplianceScope[ERPComplianceScope["Facility"] = 512] = "Facility";
48
+ ERPComplianceScope[ERPComplianceScope["Security"] = 1024] = "Security";
49
+ })(ERPComplianceScope || (ERPComplianceScope = {}));
50
+ var ERPComplianceNotificationLimit;
51
+ (function (ERPComplianceNotificationLimit) {
52
+ ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["None"] = 0] = "None";
53
+ ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["PlannerOnly"] = 1] = "PlannerOnly";
54
+ ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["ExecutorOnly"] = 2] = "ExecutorOnly";
55
+ ERPComplianceNotificationLimit[ERPComplianceNotificationLimit["Both"] = 3] = "Both";
56
+ })(ERPComplianceNotificationLimit || (ERPComplianceNotificationLimit = {}));
57
+ var ERPComplianceRegisterNotificationType;
58
+ (function (ERPComplianceRegisterNotificationType) {
59
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["None"] = 0] = "None";
60
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewAnalysis"] = 1] = "NewAnalysis";
61
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisCompleted"] = 2] = "AnalysisCompleted";
62
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisNoticePeriodStarted"] = 4] = "AnalysisNoticePeriodStarted";
63
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisPeriodExpired"] = 8] = "AnalysisPeriodExpired";
64
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["AnalysisLawChanged"] = 16384] = "AnalysisLawChanged";
65
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewPlanning"] = 8192] = "NewPlanning";
66
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningCompleted"] = 16] = "PlanningCompleted";
67
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningNoticePeriodStarted"] = 32] = "PlanningNoticePeriodStarted";
68
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["PlanningPeriodExpired"] = 64] = "PlanningPeriodExpired";
69
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewValidation"] = 32768] = "NewValidation";
70
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationCompleted"] = 128] = "ValidationCompleted";
71
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationNoticePeriodStarted"] = 256] = "ValidationNoticePeriodStarted";
72
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ValidationPeriodExpired"] = 512] = "ValidationPeriodExpired";
73
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["NewDeadline"] = 65536] = "NewDeadline";
74
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["DeadlineNoticePeriodStarted"] = 1024] = "DeadlineNoticePeriodStarted";
75
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["DeadlineExpired"] = 2048] = "DeadlineExpired";
76
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["ActivityCompleted"] = 4096] = "ActivityCompleted";
77
+ //NewNoncompliance = 1 << 17,
78
+ //NonComplianceNoticePeriodStarted = 1 << 18,
79
+ //NonCompliancePeriodExpired = 1 << 19,
80
+ //NonComplianceCompleted = 1 << 20,
81
+ ERPComplianceRegisterNotificationType[ERPComplianceRegisterNotificationType["LawChanged"] = 2097152] = "LawChanged";
82
+ })(ERPComplianceRegisterNotificationType || (ERPComplianceRegisterNotificationType = {}));
83
+ var ERPComplianceRegisterSiteImportOptions;
84
+ (function (ERPComplianceRegisterSiteImportOptions) {
85
+ ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["CopyAttachments"] = 1] = "CopyAttachments";
86
+ ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["KeepOriginalDates"] = 2] = "KeepOriginalDates";
87
+ ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["DuplicateLaws"] = 4] = "DuplicateLaws";
88
+ ERPComplianceRegisterSiteImportOptions[ERPComplianceRegisterSiteImportOptions["DiscardNotApplicables"] = 8] = "DiscardNotApplicables";
89
+ })(ERPComplianceRegisterSiteImportOptions || (ERPComplianceRegisterSiteImportOptions = {}));
90
+ const ProfileRoles = [
91
+ { name: 'Analista', value: ERPComplianceProfileRole.Analyst },
92
+ { name: 'Gestore', value: ERPComplianceProfileRole.Planner },
93
+ //{ name: 'Validatore', value: ERPComplianceProfileRole.Validator },
94
+ { name: 'Esecutore', value: ERPComplianceProfileRole.Executor },
95
+ { name: 'Osservatore', value: ERPComplianceProfileRole.Observer },
96
+ ];
97
+ const ProfileFlags = [
98
+ { name: 'Deroghe e limitazioni', divider: true },
99
+ {
100
+ name: 'Questo profilo riceve regolarmente le notifiche indipendentemente dalla configurazione generale del registro',
101
+ value: ERPComplianceProfileFlags.OverrideNotificationRegisterSettings,
102
+ },
103
+ ];
104
+ const Scopes = [
105
+ { name: 'Ambiente', value: ERPComplianceScope.Environment },
106
+ { name: 'Salute e sicurezza', value: ERPComplianceScope.Safety },
107
+ {
108
+ name: 'Sicurezza alimentare',
109
+ value: ERPComplianceScope.FoodSafety,
110
+ },
111
+ { name: 'Energia', value: ERPComplianceScope.Energy },
112
+ { name: 'Servizi generali', value: ERPComplianceScope.Facility },
113
+ { name: 'Manutenzione', value: ERPComplianceScope.Maintenance },
114
+ { name: 'Qualità', value: ERPComplianceScope.Quality },
115
+ { name: 'Organizzazione', value: ERPComplianceScope.Organization },
116
+ { name: 'Logistica', value: ERPComplianceScope.Logistics },
117
+ { name: 'Security', value: ERPComplianceScope.Security },
118
+ ];
119
+ const NotificationLimits = [
120
+ { name: 'Nessuna limitazione', value: ERPComplianceNotificationLimit.None },
121
+ {
122
+ name: 'Solo gestore che ha pianificato',
123
+ value: ERPComplianceNotificationLimit.PlannerOnly,
124
+ },
125
+ {
126
+ name: "Solo all'incaricato designato",
127
+ value: ERPComplianceNotificationLimit.ExecutorOnly,
128
+ },
129
+ {
130
+ name: 'Solo a gestore e incaricato designato',
131
+ value: ERPComplianceNotificationLimit.Both,
132
+ },
133
+ ];
134
+ const Notifications = [
135
+ { name: 'Verifica applicabilità e analisi', divider: true },
136
+ {
137
+ name: 'Richiesta analisi',
138
+ value: ERPComplianceRegisterNotificationType.NewAnalysis,
139
+ },
140
+ {
141
+ name: "Preavviso: sta per scadere il termine fissato per l'analisi",
142
+ value: ERPComplianceRegisterNotificationType.AnalysisNoticePeriodStarted,
143
+ },
144
+ {
145
+ name: "Allarme: è scaduto il termine fissato per l'analisi",
146
+ value: ERPComplianceRegisterNotificationType.AnalysisPeriodExpired,
147
+ },
148
+ {
149
+ name: 'Analisi completata',
150
+ value: ERPComplianceRegisterNotificationType.AnalysisCompleted,
151
+ },
152
+ {
153
+ name: 'Avviso norma modificata dal legislatore',
154
+ value: ERPComplianceRegisterNotificationType.AnalysisLawChanged,
155
+ },
156
+ { name: 'Pianificazioni', divider: true },
157
+ {
158
+ name: 'Richiesta gestione',
159
+ value: ERPComplianceRegisterNotificationType.NewPlanning,
160
+ },
161
+ {
162
+ name: 'Preavviso: sta per scadere il termine fissato per la gestione',
163
+ value: ERPComplianceRegisterNotificationType.PlanningNoticePeriodStarted,
164
+ },
165
+ {
166
+ name: 'Allarme: è scaduto il termine fissato per la gestione',
167
+ value: ERPComplianceRegisterNotificationType.PlanningPeriodExpired,
168
+ },
169
+ {
170
+ name: 'Gestione completata',
171
+ value: ERPComplianceRegisterNotificationType.PlanningCompleted,
172
+ },
173
+ {
174
+ name: 'Attività completata',
175
+ value: ERPComplianceRegisterNotificationType.ActivityCompleted,
176
+ },
177
+ /*{ name: 'Gestione non conformità', divider: true },
178
+ {
179
+ name: 'Apertura non comformità',
180
+ value: ERPComplianceRegisterNotificationType.NewNoncompliance,
181
+ },
182
+ {
183
+ name:
184
+ "Preavviso: sta per scadere il termine fissato per l'azione correttiva",
185
+ value:
186
+ ERPComplianceRegisterNotificationType.NonComplianceNoticePeriodStarted,
187
+ },
188
+ {
189
+ name: "Allarme: è scaduto il termine fissato per l'azione correttiva",
190
+ value: ERPComplianceRegisterNotificationType.NonCompliancePeriodExpired,
191
+ },
192
+ {
193
+ name: 'Chiusura non conformità',
194
+ value: ERPComplianceRegisterNotificationType.NonComplianceCompleted,
195
+ },*/
196
+ /*{ name: 'Approvazioni', divider: true },
197
+ { name: 'Richiesta approvazione', value: 1 << 14 },
198
+ {
199
+ name: "Preavviso: sta per scadere il termine fissato per l'approvazione",
200
+ value: ERPComplianceRegisterNotificationType.ValidationNoticePeriodStarted,
201
+ },
202
+ {
203
+ name: "Allarme: è scaduto il termine fissato per l'approvazione",
204
+ value: ERPComplianceRegisterNotificationType.ValidationPeriodExpired,
205
+ },
206
+ {
207
+ name: 'Approvazione concessa o negata',
208
+ value: ERPComplianceRegisterNotificationType.ValidationCompleted,
209
+ },*/
210
+ { name: 'Scadenze', divider: true },
211
+ {
212
+ name: 'Preavviso: 1° promemoria sulla data di scadenza',
213
+ value: ERPComplianceRegisterNotificationType.NewValidation,
214
+ },
215
+ {
216
+ name: 'Avviso: 2° promemoria sulla data di scadenza',
217
+ value: ERPComplianceRegisterNotificationType.DeadlineNoticePeriodStarted,
218
+ },
219
+ {
220
+ name: 'Allarme: è scaduto il termine',
221
+ value: ERPComplianceRegisterNotificationType.DeadlineExpired,
222
+ },
223
+ { name: 'Norme collegate', divider: true },
224
+ {
225
+ name: 'Modifica o abrogazione',
226
+ value: ERPComplianceRegisterNotificationType.LawChanged,
227
+ },
228
+ ];
229
+ var ERPComplianceLawState;
230
+ (function (ERPComplianceLawState) {
231
+ ERPComplianceLawState[ERPComplianceLawState["ApplicableOrAknowledged"] = 1] = "ApplicableOrAknowledged";
232
+ ERPComplianceLawState[ERPComplianceLawState["NotApplicable"] = 2] = "NotApplicable";
233
+ ERPComplianceLawState[ERPComplianceLawState["NotAnalyzed"] = 3] = "NotAnalyzed";
234
+ ERPComplianceLawState[ERPComplianceLawState["ExpiredAnalysis"] = 4] = "ExpiredAnalysis";
235
+ ERPComplianceLawState[ERPComplianceLawState["UpdatedLaws"] = 5] = "UpdatedLaws";
236
+ ERPComplianceLawState[ERPComplianceLawState["Analyzed"] = 6] = "Analyzed";
237
+ ERPComplianceLawState[ERPComplianceLawState["Abrogated"] = 7] = "Abrogated";
238
+ ERPComplianceLawState[ERPComplianceLawState["Applicable"] = 8] = "Applicable";
239
+ ERPComplianceLawState[ERPComplianceLawState["Aknowledged"] = 9] = "Aknowledged";
240
+ })(ERPComplianceLawState || (ERPComplianceLawState = {}));
241
+ var ERPComplianceLawOrigin;
242
+ (function (ERPComplianceLawOrigin) {
243
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["National"] = 1] = "National";
244
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["EU"] = 2] = "EU";
245
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Regional"] = 3] = "Regional";
246
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Local"] = 4] = "Local";
247
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Technical"] = 5] = "Technical";
248
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Voulontary"] = 6] = "Voulontary";
249
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Internal"] = 7] = "Internal";
250
+ ERPComplianceLawOrigin[ERPComplianceLawOrigin["Other"] = 8] = "Other";
251
+ })(ERPComplianceLawOrigin || (ERPComplianceLawOrigin = {}));
252
+ const LawStates = [
253
+ { name: 'Applicabile', value: ERPComplianceLawState.Applicable },
254
+ { name: 'Da conoscere', value: ERPComplianceLawState.Aknowledged },
255
+ {
256
+ name: 'Applicabile / da conoscere',
257
+ value: ERPComplianceLawState.ApplicableOrAknowledged,
258
+ },
259
+ { name: 'Non applicabile', value: ERPComplianceLawState.NotApplicable },
260
+ { name: 'Abrogata', value: ERPComplianceLawState.Abrogated },
261
+ { name: 'Analizzata', value: ERPComplianceLawState.Analyzed },
262
+ { name: 'Da definire', value: ERPComplianceLawState.NotAnalyzed },
263
+ { name: 'In ritardo', value: ERPComplianceLawState.ExpiredAnalysis },
264
+ {
265
+ name: 'Con aggiornamenti pendenti',
266
+ value: ERPComplianceLawState.UpdatedLaws,
267
+ },
268
+ ];
269
+ const LawOrigins = [
270
+ { name: 'Nazionale', value: ERPComplianceLawOrigin.National },
271
+ { name: 'Comunitaria', value: ERPComplianceLawOrigin.EU },
272
+ { name: 'Regionale', value: ERPComplianceLawOrigin.Regional },
273
+ { name: 'Locale', value: ERPComplianceLawOrigin.Local },
274
+ { name: 'Tecnica', value: ERPComplianceLawOrigin.Technical },
275
+ { name: 'Interna', value: ERPComplianceLawOrigin.Internal },
276
+ { name: 'Volontaria', value: ERPComplianceLawOrigin.Voulontary },
277
+ { name: 'Altro', value: ERPComplianceLawOrigin.Other },
278
+ ];
279
+ const LawChangeStates = [
280
+ { name: 'Aperto', value: 1 },
281
+ { name: 'Chiuso', value: 2 },
282
+ ];
283
+ var ERPComplianceActivityState;
284
+ (function (ERPComplianceActivityState) {
285
+ ERPComplianceActivityState[ERPComplianceActivityState["NotPlanned"] = 128] = "NotPlanned";
286
+ ERPComplianceActivityState[ERPComplianceActivityState["Closed"] = 4] = "Closed";
287
+ ERPComplianceActivityState[ERPComplianceActivityState["Expired"] = 8] = "Expired";
288
+ ERPComplianceActivityState[ERPComplianceActivityState["Planned"] = 256] = "Planned";
289
+ ERPComplianceActivityState[ERPComplianceActivityState["Cancelled"] = 512] = "Cancelled";
290
+ ERPComplianceActivityState[ERPComplianceActivityState["UpdatedLaws"] = 1024] = "UpdatedLaws";
291
+ ERPComplianceActivityState[ERPComplianceActivityState["AlreadyManaged"] = 2048] = "AlreadyManaged";
292
+ })(ERPComplianceActivityState || (ERPComplianceActivityState = {}));
293
+ const ActivityStates = [
294
+ {
295
+ name: 'Da definire',
296
+ value: ERPComplianceActivityState.NotPlanned,
297
+ },
298
+ {
299
+ name: 'Pianificata',
300
+ value: ERPComplianceActivityState.Planned,
301
+ },
302
+ {
303
+ name: 'Chiusa',
304
+ value: ERPComplianceActivityState.Closed,
305
+ },
306
+ {
307
+ name: 'In ritardo',
308
+ value: ERPComplianceActivityState.Expired,
309
+ },
310
+ {
311
+ name: 'Annullata',
312
+ value: ERPComplianceActivityState.Cancelled,
313
+ },
314
+ {
315
+ name: 'Gestita separatamente',
316
+ value: ERPComplianceActivityState.AlreadyManaged,
317
+ },
318
+ {
319
+ name: 'Con aggiornamenti pendenti',
320
+ value: ERPComplianceActivityState.UpdatedLaws,
321
+ },
322
+ ];
323
+ const ObligationTypes = [
324
+ { name: 'Autorizzazione', value: 1 },
325
+ { name: 'Verifiche periodiche manutentive', value: 2 },
326
+ { name: 'Misure organizzative', value: 3 },
327
+ { name: 'Controlli e misurazioni', value: 4 },
328
+ { name: 'Entrata in vigore', value: 5 },
329
+ { name: 'Documenti aziendali obbligatori', value: 6 },
330
+ {
331
+ name: 'Altri adempimenti formali (comunicazioni, dichiarazioni, ecc...)',
332
+ value: 7,
333
+ },
334
+ { name: 'Altro', value: 99 },
335
+ ];
336
+ const ObligationAuthorities = [
337
+ { name: 'Agenzia ECHA', value: 1 },
338
+ { name: 'Albo Nazionale dei Gestori Ambientali', value: 2 },
339
+ { name: 'ARPA', value: 4 },
340
+ { name: 'ASL', value: 5 },
341
+ { name: 'Camera di Commercio', value: 8 },
342
+ { name: 'Comando provinciale dei Vigili del Fuoco', value: 10 },
343
+ { name: 'Comune', value: 13 },
344
+ { name: 'Consorzi gestione rifiuti particolari', value: 14 },
345
+ { name: 'Gestore del servizio', value: 21 },
346
+ { name: 'Gestore della rete di trasmissione nazionale', value: 22 },
347
+ { name: 'INAIL - IPSEMA - ISPESL', value: 23 },
348
+ { name: 'ISPRA', value: 26 },
349
+ { name: 'Ministero', value: 27 },
350
+ { name: 'Genio civile', value: 30 },
351
+ { name: 'Organo di vigilanza competente', value: 31 },
352
+ { name: 'Provincia', value: 33 },
353
+ { name: 'Regione', value: 35 },
354
+ { name: 'Uffici tecnici di finanza', value: 36 },
355
+ { name: 'Ispettorato del lavoro', value: 37 },
356
+ { name: 'Comitato Regionale Tecnico VF', value: 38 },
357
+ { name: 'Prefetto', value: 39 },
358
+ { name: 'Organismo notificato', value: 40 },
359
+ { name: 'Città Metropolitana', value: 41 },
360
+ { name: 'Nessuna', value: 28 },
361
+ { name: 'Altro', value: 3 }
362
+ ];
363
+ var ERPRecurrenceFrequencyType;
364
+ (function (ERPRecurrenceFrequencyType) {
365
+ ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Day"] = 1] = "Day";
366
+ ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Month"] = 2] = "Month";
367
+ ERPRecurrenceFrequencyType[ERPRecurrenceFrequencyType["Year"] = 3] = "Year";
368
+ })(ERPRecurrenceFrequencyType || (ERPRecurrenceFrequencyType = {}));
369
+ const RecurrenceFrequencyTypes = [
370
+ { name: 'Anni', value: ERPRecurrenceFrequencyType.Year },
371
+ { name: 'Mesi', value: ERPRecurrenceFrequencyType.Month },
372
+ { name: 'Giorni', value: ERPRecurrenceFrequencyType.Day },
373
+ ];
374
+
375
+ class EvolutionService {
376
+ constructor() {
377
+ this.httpClient = inject(HttpClient);
378
+ this.broadcastService = inject(BroadcastService);
379
+ this.broadcastServiceSubscription = null;
380
+ this.dialogService = inject(DialogService);
381
+ this._serviceUri = null;
382
+ this._loginInfo = null;
383
+ this.loggedIn = signal(false);
384
+ this.loggingIn = signal(false);
385
+ }
386
+ get serviceUri() {
387
+ return this._serviceUri;
388
+ }
389
+ get loginInfo() {
390
+ if (!this._loginInfo) {
391
+ const loginInfo = localStorage.getItem('clipper_login_evolution');
392
+ if (loginInfo) {
393
+ try {
394
+ this._loginInfo = JSON.parse(loginInfo);
395
+ }
396
+ catch { }
397
+ }
398
+ }
399
+ return this._loginInfo;
400
+ }
401
+ ngOnDestroy() {
402
+ if (this.broadcastServiceSubscription) {
403
+ this.broadcastServiceSubscription.unsubscribe();
404
+ }
405
+ }
406
+ /**
407
+ * Initialize service
408
+ * @param serviceUri : the service uri
409
+ */
410
+ initialize(serviceUri) {
411
+ // Create unique client id
412
+ if (!localStorage.getItem('evolution_client_id')) {
413
+ localStorage.setItem('evolution_client_id', SystemUtils.generateUUID());
414
+ }
415
+ // Initialize
416
+ this._serviceUri = serviceUri;
417
+ // React to message broadcasting
418
+ if (!this.broadcastServiceSubscription) {
419
+ this.broadcastServiceSubscription = this.broadcastService.getMessage().subscribe((message) => {
420
+ if (message.id === EvolutionMessages.LOGIN_CHANGED) {
421
+ setTimeout(() => {
422
+ this.login(message.data.email, message.data.password, true, message.data.oauth, message.data.oauthAccessToken).subscribe((r) => {
423
+ if (!r.success)
424
+ this.dialogService.error(r.message, null, "Errore di Evolution");
425
+ else {
426
+ this.dialogService.toast('Connesso a Evolution', 1500, 'power');
427
+ }
428
+ });
429
+ }, 500);
430
+ }
431
+ else if (message.id === EvolutionMessages.LOGOUT_COMPLETED) {
432
+ if (this.loggedIn()) {
433
+ this.logout().subscribe((r) => {
434
+ if (!r.success) {
435
+ this.dialogService.error("<p>" + 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>", null, "Errore di Evolution");
436
+ }
437
+ else {
438
+ this.dialogService.toast('Disconnesso da Evolution', 1500, 'power_off');
439
+ }
440
+ });
441
+ }
442
+ }
443
+ });
444
+ }
445
+ // Eveluate current session storage in case of page refresh (F5)
446
+ if (!this.loggedIn() && this.getToken()) {
447
+ // Auto login
448
+ this.loggedIn.set(true);
449
+ // Notify
450
+ this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
451
+ }
452
+ }
453
+ /**
454
+ * Set JWT token
455
+ * @param value : the login result
456
+ */
457
+ setToken(value) {
458
+ sessionStorage.setItem('evolution_jwt', value.token);
459
+ sessionStorage.setItem('evolution_jwt_refresh', value.refreshToken ?? '');
460
+ }
461
+ /**
462
+ * Return current JWT token
463
+ * @param refresh: true to get the refresh token. Default is false.
464
+ */
465
+ getToken(refresh = false) {
466
+ let token = sessionStorage.getItem(refresh ? 'evolution_jwt_refresh' : 'evolution_jwt');
467
+ if (token && token[0] === '"') {
468
+ return token.substring(1, token.length - 1);
469
+ }
470
+ return token ?? '';
471
+ }
472
+ /**
473
+ * Perform login
474
+ * @param email: the optioanl email if using OAuth2
475
+ * @parma password: the optional password if using OAuth2
476
+ * @param remember: remember credentials
477
+ * @param oauth: the optional open authentication supported
478
+ * @param oauthAccessToken: the optional OAuth2 access token
479
+ * @returns: the login result
480
+ */
481
+ login(email = null, password = null, remember = false, oauth = null, oauthAccessToken = null) {
482
+ this.clear();
483
+ this.loggingIn.set(true);
484
+ return this.httpClient
485
+ .post(this._serviceUri + '/login2', {
486
+ user: oauth ? null : email,
487
+ password: oauth ? null : password,
488
+ clientId: localStorage.getItem("evolution_client_id"),
489
+ OAUTH: oauth
490
+ }, {
491
+ headers: !oauth
492
+ ? new HttpHeaders()
493
+ : new HttpHeaders()
494
+ .set("Authorization", oauthAccessToken ?? '')
495
+ })
496
+ .pipe(catchError(err => {
497
+ this.handleLoginError();
498
+ return throwError(() => err);
499
+ }), map((r) => {
500
+ this.loggingIn.set(false);
501
+ if (r.success) {
502
+ // Store access token
503
+ this.setToken(r.value);
504
+ const loginInfo = {
505
+ context: r.value.context,
506
+ OAUTH: oauth
507
+ };
508
+ if (!oauth) {
509
+ loginInfo.userCredentials =
510
+ SystemUtils.cipher(JSON.stringify({
511
+ email: email,
512
+ password: password,
513
+ remember: remember,
514
+ }), loginInfo.context.userId.toString());
515
+ }
516
+ // Update info
517
+ localStorage.setItem('evolution_login', JSON.stringify(loginInfo));
518
+ this._loginInfo = loginInfo;
519
+ this.loggedIn.set(true);
520
+ // Notify
521
+ this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
522
+ }
523
+ return r;
524
+ }));
525
+ }
526
+ /**
527
+ * Perform logout
528
+ */
529
+ logout() {
530
+ return this.httpClient.post(this._serviceUri + '/logout', {}).pipe(map(r => {
531
+ this.clear();
532
+ return r;
533
+ }), catchError((_e) => {
534
+ this.clear();
535
+ return of([]);
536
+ }));
537
+ }
538
+ /**
539
+ * Switch the current login to a new one with the same credentials except role possibly (context change)
540
+ * @param id : new user id
541
+ */
542
+ loginSwitch(id) {
543
+ return this.httpClient
544
+ .post(this._serviceUri + '/login-switch/', {
545
+ userId: id,
546
+ clientId: localStorage.getItem("evolution_client_id")
547
+ })
548
+ .pipe(catchError((err) => {
549
+ this.handleLoginError();
550
+ return throwError(() => err);
551
+ }), map((r) => {
552
+ this.loggingIn.set(false);
553
+ if (r.success) {
554
+ // Store access token
555
+ this.setToken(r.value);
556
+ this._loginInfo = r.value.context;
557
+ this.loggedIn.set(true);
558
+ // Notify
559
+ this.broadcastService.sendMessage(EvolutionMessages.LOGIN_COMPLETED);
560
+ }
561
+ return r;
562
+ }));
563
+ }
564
+ /**
565
+ * Handle login error
566
+ */
567
+ handleLoginError() {
568
+ this.loggingIn.set(false);
569
+ localStorage.removeItem('evolution_login');
570
+ }
571
+ /**
572
+ * Reset login refresh timer and login state
573
+ */
574
+ reset() {
575
+ // Clear login info
576
+ this._loginInfo = null;
577
+ // Logged out
578
+ this.loggedIn.set(false);
579
+ // Notify
580
+ this.broadcastService.sendMessage(EvolutionMessages.LOGOUT_COMPLETED);
581
+ }
582
+ /**
583
+ * Clear login data
584
+ */
585
+ clear() {
586
+ // Clear local storage
587
+ sessionStorage.removeItem('evolution_jwt');
588
+ sessionStorage.removeItem('evolution_jwt_refresh');
589
+ sessionStorage.removeItem('evolution_oauth');
590
+ localStorage.removeItem('evolution_login');
591
+ // Reset login
592
+ this.reset();
593
+ }
594
+ /**
595
+ * Perform token refresh
596
+ */
597
+ refresh() {
598
+ return this.httpClient.get(this._serviceUri + '/refresh2/?token=' + this.getToken(true)).pipe(map((r) => {
599
+ // Update token
600
+ this.setToken(r.value);
601
+ }));
602
+ }
603
+ /**
604
+ * Convert folders in a tree of Node object.
605
+ * @param folders : the subfolders group or null to root
606
+ */
607
+ toNodes(folders) {
608
+ return this._toNodes(folders, null);
609
+ }
610
+ /**
611
+ * Convert folders in a tree of Node object.
612
+ * @param folders : the children group or null to root
613
+ */
614
+ _toNodes(folders, parent) {
615
+ let nodes = [];
616
+ folders.forEach((n) => {
617
+ let node = {
618
+ id: n.id,
619
+ name: n.name,
620
+ count: n.count,
621
+ parent: parent,
622
+ children: null,
623
+ bag: n,
624
+ };
625
+ node.children =
626
+ n.children && n.children.length > 0
627
+ ? this._toNodes(n.children, node)
628
+ : [];
629
+ nodes.push(node);
630
+ });
631
+ return nodes;
632
+ }
633
+ /**
634
+ * Retrieve the taxonomy
635
+ */
636
+ getTaxonomy() {
637
+ return this.httpClient.get(this._serviceUri + '/taxonomy');
638
+ }
639
+ /**
640
+ * Retrieve authorities
641
+ */
642
+ getAuthorities() {
643
+ return this.httpClient.get(this._serviceUri + '/compliance/authorities');
644
+ }
645
+ ////
646
+ // CONTEXT
647
+ ////
648
+ /**
649
+ * Change context
650
+ */
651
+ changeContext(params) {
652
+ return this.httpClient.post(this._serviceUri + '/compliance/context', params);
653
+ }
654
+ ////
655
+ // REGISTERS
656
+ ////
657
+ /**
658
+ * Retrieve a register
659
+ * @param id the register id
660
+ */
661
+ getRegister(id) {
662
+ return this.httpClient.get(this._serviceUri +
663
+ '/compliance/registers/' + id);
664
+ }
665
+ /**
666
+ * Collect register profiles
667
+ * @param params parameters
668
+ */
669
+ collectRegisterProfiles(params) {
670
+ return this.httpClient.post(this._serviceUri +
671
+ '/compliance/registers/profiles/collect', params);
672
+ }
673
+ ////
674
+ // LAWS
675
+ ////
676
+ /**
677
+ * Add one or more laws
678
+ * @param params parameters
679
+ */
680
+ addLaws(params) {
681
+ return this.httpClient.post(this._serviceUri + '/compliance/laws/add', params);
682
+ }
683
+ ////
684
+ // ACTIVITIES
685
+ ////
686
+ /**
687
+ * Retrieve activity groups
688
+ * @param group the group number
689
+ * @param site the site id
690
+ */
691
+ getGroups(group = 1, site = null) {
692
+ return this.httpClient.get(this._serviceUri +
693
+ (site
694
+ ? '/compliance/groups/?group=' +
695
+ group +
696
+ '&site=' +
697
+ site
698
+ : '/compliance/groups/?group=' + group));
699
+ }
700
+ /**
701
+ * Add one or more activities
702
+ * @param params parameters
703
+ */
704
+ addActivities(params) {
705
+ return this.httpClient.post(this._serviceUri + '/compliance/activities/add', params);
706
+ }
707
+ /**
708
+ * Export laws
709
+ * @param params parameters
710
+ */
711
+ exportLaws(params) {
712
+ return this.httpClient.post(this._serviceUri + '/compliance/laws/export', params, { responseType: 'blob' });
713
+ }
714
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
715
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionService, providedIn: 'root' }); }
716
+ }
717
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionService, decorators: [{
718
+ type: Injectable,
719
+ args: [{
720
+ providedIn: 'root',
721
+ }]
722
+ }] });
723
+
724
+ class EvolutionAuthInterceptor {
725
+ constructor() {
726
+ this.evolutionService = inject(EvolutionService);
727
+ this.broadcastService = inject(BroadcastService);
728
+ this.dialogService = inject(DialogService);
729
+ this.lastErrorTime = -1;
730
+ }
731
+ intercept(request, next) {
732
+ if (request.url.startsWith(this.evolutionService.serviceUri)) {
733
+ request = request.clone({ withCredentials: true });
734
+ return next.handle(this.addTokenToRequest(request))
735
+ .pipe(catchError$1(error => {
736
+ this.dialogService.clearBusy();
737
+ if (error instanceof HttpErrorResponse &&
738
+ !request.url.includes("/login") &&
739
+ error.status === 401) {
740
+ return this.handle401Error(request, next);
741
+ }
742
+ const errorTime = new Date().getTime();
743
+ if (errorTime - this.lastErrorTime > 5000) {
744
+ this.lastErrorTime = errorTime;
745
+ const invalidSession = error.status == "403";
746
+ this.dialogService.error("<p>" + (error.error?.message ?? error.message ?? "Impossibile eseguire l'operazione richiesta.").replaceAll("\r\n", "</p><p>") + "</p>", null, "Errore in Clipper", undefined, undefined, invalidSession ? 5000 : 15000).afterClosed().subscribe(() => {
747
+ if (invalidSession) {
748
+ this.broadcastService.sendMessage(EvolutionMessages.LOGOUT);
749
+ }
750
+ });
751
+ }
752
+ return throwError(() => error);
753
+ }));
754
+ }
755
+ return next.handle(request);
756
+ }
757
+ /**
758
+ * Handle 401 error
759
+ * @param request : the request
760
+ * @param next : the http handler
761
+ */
762
+ handle401Error(request, next) {
763
+ if (this.evolutionService.loggedIn()) {
764
+ return this.evolutionService.refresh().pipe(switchMap(() => {
765
+ return next.handle(this.addTokenToRequest(request));
766
+ }), catchError$1(error => {
767
+ return throwError(() => error);
768
+ }));
769
+ }
770
+ return next.handle(request);
771
+ }
772
+ /**
773
+ * Add token to request
774
+ * @param request : the request
775
+ * @param token: the token or null to use curre3nt
776
+ */
777
+ addTokenToRequest(request, token = null) {
778
+ if (request.url.startsWith(this.evolutionService.serviceUri)) {
779
+ if (!token)
780
+ token = this.evolutionService.getToken();
781
+ if (token) {
782
+ return request.clone({
783
+ setHeaders: {
784
+ Authorization: 'Bearer ' + token,
785
+ 'ngsw-bypass': 'ngsw-bypass'
786
+ },
787
+ });
788
+ }
789
+ }
790
+ return request;
791
+ }
792
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionAuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
793
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionAuthInterceptor }); }
794
+ }
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionAuthInterceptor, decorators: [{
796
+ type: Injectable
797
+ }] });
798
+
799
+ class EvolutionCommonModule {
800
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
801
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: EvolutionCommonModule }); }
802
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionCommonModule }); }
803
+ }
804
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: EvolutionCommonModule, decorators: [{
805
+ type: NgModule
806
+ }] });
807
+
808
+ /*
809
+ * Public API Surface of ars-utils
810
+ */
811
+
812
+ /**
813
+ * Generated bundle index. Do not edit.
814
+ */
815
+
816
+ export { ActivityStates, ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPRecurrenceFrequencyType, EvolutionAuthInterceptor, EvolutionCommonModule, EvolutionMessages, EvolutionService, LawChangeStates, LawOrigins, LawStates, NotificationLimits, Notifications, ObligationAuthorities, ObligationTypes, ProfileFlags, ProfileRoles, RecurrenceFrequencyTypes, Scopes };
817
+ //# sourceMappingURL=arsedizioni-ars-utils-evolution.common.mjs.map