@esfaenza/core 15.2.75 → 15.2.76

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.
@@ -2,10 +2,10 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Optional, Inject } from '@angular/core';
3
3
  import { JaceIdentity, USE_FAKE_ACCESS_TOKEN } from '@esfaenza/core/domain';
4
4
  import * as i1 from 'ngx-cookie-service';
5
- import { of, Subject } from 'rxjs';
5
+ import { of, Subject, filter } from 'rxjs';
6
6
  import * as i2 from '@angular/common/http';
7
7
  import { HttpErrorResponse, HttpHeaders } from '@angular/common/http';
8
- import * as i5 from '@angular/router';
8
+ import * as i4$1 from '@angular/router';
9
9
  import { Router } from '@angular/router';
10
10
  import * as i1$1 from '@esfaenza/localizations';
11
11
  import { LocalizationService } from '@esfaenza/localizations';
@@ -20,9 +20,9 @@ import * as duration from 'dayjs/plugin/duration';
20
20
  import * as minMax from 'dayjs/plugin/minMax';
21
21
  import * as utc from 'dayjs/plugin/utc';
22
22
  import * as i3 from '@esfaenza/signalr-notifications';
23
- import * as i5$1 from '@esfaenza/access-control';
23
+ import * as i5 from '@esfaenza/access-control';
24
24
  import { AccessControlRouteGuard } from '@esfaenza/access-control';
25
- import * as i4$1 from '@esfaenza/preferences';
25
+ import * as i4$2 from '@esfaenza/preferences';
26
26
  import { CachePersistor, PreferencesPersistor } from '@esfaenza/preferences';
27
27
  import { catchError, map } from 'rxjs/operators';
28
28
 
@@ -1161,14 +1161,12 @@ class AppState {
1161
1161
  this.notifyDataChanged("modules.Retrieved", this._modules);
1162
1162
  }
1163
1163
  get Modules() { return this._modules; }
1164
- constructor(lc, bts, notifications, MessageDef, intercom, router, msgService, emb) {
1164
+ constructor(lc, bts, notifications, MessageDef, intercom, emb) {
1165
1165
  this.lc = lc;
1166
1166
  this.bts = bts;
1167
1167
  this.notifications = notifications;
1168
1168
  this.MessageDef = MessageDef;
1169
1169
  this.intercom = intercom;
1170
- this.router = router;
1171
- this.msgService = msgService;
1172
1170
  this.emb = emb;
1173
1171
  this.redirectingToLogin = false;
1174
1172
  this.handlingError = false;
@@ -1179,120 +1177,34 @@ class AppState {
1179
1177
  this.jobWithIdsCache = {};
1180
1178
  this.notifyOnCompletedJobs = true;
1181
1179
  this._data = new Subject();
1182
- this._dataStream$ = this._data.asObservable();
1183
1180
  this._subscriptions = new Map();
1184
1181
  this.ModulesLocalizations = {};
1185
- this.setupEmbeddability();
1182
+ this.hookEmbedding();
1186
1183
  this.setupDayjs();
1187
1184
  this.setupSignalRJobListening();
1188
1185
  this.JaceIdentity = null;
1189
- this._dataStream$.subscribe((data) => this._onEvent(data));
1186
+ this._data.subscribe((data) => this._onEvent(data));
1190
1187
  //Decide se siamo attorno a natale
1191
1188
  var today = dayjs();
1192
- var lowerBound = dayjs("18/12/" + today.year(), "DD/MM/YYYY");
1193
- var upperBound = dayjs("07/01/" + (today.year() + 1), "DD/MM/YYYY");
1189
+ var thisYear = today.year();
1190
+ var lowerBound = dayjs("18/12/" + thisYear, "DD/MM/YYYY");
1191
+ var upperBound = dayjs("07/01/" + (thisYear + 1), "DD/MM/YYYY");
1194
1192
  this.christmasTime = today > lowerBound && today < upperBound;
1195
1193
  //Decide se siamo attorno ad halloween
1196
- var lowerBound = dayjs("28/10/" + today.year(), "DD/MM/YYYY");
1197
- var upperBound = dayjs("05/11/" + today.year(), "DD/MM/YYYY");
1194
+ var lowerBound = dayjs("28/10/" + thisYear, "DD/MM/YYYY");
1195
+ var upperBound = dayjs("05/11/" + thisYear, "DD/MM/YYYY");
1198
1196
  this.halloweenTime = today > lowerBound && today < upperBound;
1199
1197
  this.intercom.inbounds.subscribe((t) => { this.handleInboundMessage(t); });
1200
1198
  }
1201
- setupEmbeddability() {
1202
- window.onmessage = (event) => {
1203
- // Ignoro i miei messaggi dato che mi interessano solo quelli degli altri iframe
1204
- if (event.source == window && event?.data?.type != "modal-open")
1205
- return;
1206
- if (event?.data?.type == "alert") {
1207
- console.log(`Window message - alert -> Level: ${event?.data?.level}, Message: ${event?.data?.msg}`);
1208
- switch (event?.data?.level) {
1209
- case "success":
1210
- this.msgService.simpleSuccess(event?.data?.msg);
1211
- break;
1212
- case "warning":
1213
- this.msgService.simpleWarning(event?.data?.msg);
1214
- break;
1215
- case "error":
1216
- this.msgService.simpleError(event?.data?.msg);
1217
- break;
1218
- case "info":
1219
- this.msgService.simpleInfo(event?.data?.msg);
1220
- break;
1221
- }
1222
- }
1223
- else if (event?.data?.type == "navigate") {
1224
- console.log(`Window message - navigate -> ${event?.data?.url}`);
1225
- this.router.navigate([event?.data?.url]);
1226
- }
1227
- else if (event?.data?.type == "redirect") {
1228
- console.log(`Window message - redirect -> ${event?.data?.url}`);
1229
- window.location.href = event?.data?.url;
1230
- }
1231
- else if (event?.data?.type == "navigation") {
1232
- console.log(`Window message - Navigation -> ${event?.data?.internalNavigation ? "[internal]" : ""} ${event?.data?.title}`);
1233
- if (event?.data?.internalNavigation)
1234
- this.notifyDataChanged("menu.adjustSubNavigationTo", event?.data?.title);
1235
- else
1236
- this.notifyDataChanged("menu.adjustNavigationTo", event?.data?.title);
1237
- }
1238
- else if (event?.data?.type == "modal-open") {
1239
- const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
1240
- let wrapperStyles = window.getComputedStyle(wrapper);
1241
- const wrapperPaddingLeft = parseInt(wrapperStyles.getPropertyValue("padding-left"));
1242
- const wrapperPaddingRight = parseInt(wrapperStyles.getPropertyValue("padding-right"));
1243
- console.log(`Window message - Modal Open -> Backdrop Height: ${event?.data?.backdropHeight}`);
1244
- var topHeight = 116; // valore fisso, distanza fra il top e l'inizio dell'iframe, non sarà mai diverso
1245
- var rightSpace = wrapperPaddingRight; // valore fisso, distanza fra la fine dell'iframe e il lato sinistro dello schermo, non sarà mai diverso
1246
- var leftSpace = this.sidebarWidth + wrapperPaddingLeft;
1247
- let commonStyles = "position: absolute; z-index: 9999; background-color: #000; opacity: 0.5; ";
1248
- wrapper.style.setProperty("overflow", "hidden", "important");
1249
- const top = document.createElement("div");
1250
- top.className = "embedded-modal-top";
1251
- top.style.cssText = commonStyles + `height: ${topHeight}px; top: 0; width: calc(100% - ${leftSpace}px); left: ${leftSpace}px`;
1252
- top.id = "top";
1253
- const left = document.createElement("div");
1254
- left.className = "embedded-modal-left";
1255
- left.style.cssText = commonStyles + `height: 100%; top: 0; width: ${leftSpace}px;`;
1256
- left.id = "left";
1257
- const right = document.createElement("div");
1258
- right.className = "embedded-modal-right";
1259
- right.style.cssText = commonStyles + `height: calc(100% - ${topHeight}px); top: ${topHeight}px; right: 0; width: ${rightSpace}px;`;
1260
- right.id = "right";
1261
- document.body.appendChild(top);
1262
- document.body.appendChild(left);
1263
- document.body.appendChild(right);
1264
- }
1265
- else if (event?.data?.type == "modal-close") {
1266
- console.log(`Window message - Modal Close`);
1267
- let wrapper = document.body.getElementsByClassName("main-wrapper")[0];
1268
- wrapper.style.removeProperty("overflow");
1269
- const top = document.getElementById("top");
1270
- const left = document.getElementById("left");
1271
- const right = document.getElementById("right");
1272
- if (top)
1273
- document.body.removeChild(top);
1274
- if (left)
1275
- document.body.removeChild(left);
1276
- if (right)
1277
- document.body.removeChild(right);
1278
- }
1279
- };
1280
- this.subscribe("menu.isCollapsed", () => {
1281
- const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
1282
- let wrapperStyles = window.getComputedStyle(wrapper);
1283
- const wrapperPaddingLeft = parseInt(wrapperStyles.getPropertyValue("padding-left"));
1284
- var leftSpace = this.sidebarWidth + wrapperPaddingLeft;
1285
- const left = document.getElementById("left");
1286
- const top = document.getElementById("top");
1287
- if (top) {
1288
- top.style.setProperty("left", (leftSpace) + "px");
1289
- top.style.setProperty("width", `calc(100% - ${leftSpace}px)`);
1290
- }
1291
- if (left)
1292
- left.style.setProperty("width", leftSpace + "px");
1199
+ // Collego le informazioni dell'embedding che devono appoggiarsi all'app state in modo che possano comunicare col resto dell'applicazione
1200
+ hookEmbedding() {
1201
+ this.emb.MessageObserver.pipe(filter(ev => ev.event == "navigation")).subscribe(event => {
1202
+ var navigationOp = event?.data?.internalNavigation ? "menu.adjustSubNavigationTo" : "menu.adjustNavigationTo";
1203
+ this.notifyDataChanged(navigationOp, event?.data?.title);
1204
+ });
1205
+ this._data.pipe(filter(e => e.event == "menu.isCollapsed")).subscribe(_ => {
1206
+ this.emb.refreshBoundariesOnMenuCollapse();
1293
1207
  });
1294
- if (this.emb.Embedded)
1295
- document.body.style.setProperty("overflow-y", "auto", "important");
1296
1208
  }
1297
1209
  registerNavigationIfMeaningful(route) {
1298
1210
  let title = route.data["title"];
@@ -1314,10 +1226,9 @@ class AppState {
1314
1226
  handleInboundMessage(t) {
1315
1227
  switch (t.type) {
1316
1228
  case InboundMessageTypes.Navigation:
1317
- {
1318
- this.notifyDataChanged(t.message.sub ? "menu.adjustSubNavigationTo" : "menu.adjustNavigationTo", t.message.routeTitle);
1319
- this.intercom.send(AdmMessageTypes.Message, "Navigation Message Received", MK_ADM);
1320
- }
1229
+ this.notifyDataChanged(t.message.sub ? "menu.adjustSubNavigationTo" : "menu.adjustNavigationTo", t.message.routeTitle);
1230
+ this.intercom.send(AdmMessageTypes.Message, "Navigation Message Received", MK_ADM);
1231
+ break;
1321
1232
  }
1322
1233
  }
1323
1234
  setupDayjs() {
@@ -1417,12 +1328,12 @@ class AppState {
1417
1328
  this.headerHeight = height;
1418
1329
  }
1419
1330
  }
1420
- AppState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: i3.NotificationsService }, { token: i3.BaseMessageService }, { token: i4.InterComService }, { token: i5.Router }, { token: i4.MessageService }, { token: i4.AppEmbeddingExtensions }], target: i0.ɵɵFactoryTarget.Injectable });
1331
+ AppState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: i3.NotificationsService }, { token: i3.BaseMessageService }, { token: i4.InterComService }, { token: i4.AppEmbeddingExtensions }], target: i0.ɵɵFactoryTarget.Injectable });
1421
1332
  AppState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, providedIn: "root" });
1422
1333
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppState, decorators: [{
1423
1334
  type: Injectable,
1424
1335
  args: [{ providedIn: "root" }]
1425
- }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: i3.NotificationsService }, { type: i3.BaseMessageService }, { type: i4.InterComService }, { type: i5.Router }, { type: i4.MessageService }, { type: i4.AppEmbeddingExtensions }]; } });
1336
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: i3.NotificationsService }, { type: i3.BaseMessageService }, { type: i4.InterComService }, { type: i4.AppEmbeddingExtensions }]; } });
1426
1337
 
1427
1338
  // Angular
1428
1339
  class HTTPServiceExtensions {
@@ -1498,11 +1409,11 @@ class HTTPServiceExtensions {
1498
1409
  }
1499
1410
  }
1500
1411
  }
1501
- HTTPServiceExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: AppState }, { token: i5.Router }, { token: i5$1.AccessControlService }, { token: i4.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
1412
+ HTTPServiceExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions, deps: [{ token: i1$1.LocalizationService }, { token: TokenService }, { token: AppState }, { token: i4$1.Router }, { token: i5.AccessControlService }, { token: i4.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
1502
1413
  HTTPServiceExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions });
1503
1414
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPServiceExtensions, decorators: [{
1504
1415
  type: Injectable
1505
- }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: AppState }, { type: i5.Router }, { type: i5$1.AccessControlService }, { type: i4.MessageService }]; } });
1416
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: TokenService }, { type: AppState }, { type: i4$1.Router }, { type: i5.AccessControlService }, { type: i4.MessageService }]; } });
1506
1417
 
1507
1418
  // Angular
1508
1419
  class MenuFilteringService {
@@ -1559,12 +1470,12 @@ class SessionRetriever {
1559
1470
  return this.SessionIdentity;
1560
1471
  }
1561
1472
  }
1562
- SessionRetriever.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, deps: [{ token: TokenService }, { token: i5.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1473
+ SessionRetriever.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, deps: [{ token: TokenService }, { token: i4$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1563
1474
  SessionRetriever.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, providedIn: "root" });
1564
1475
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionRetriever, decorators: [{
1565
1476
  type: Injectable,
1566
1477
  args: [{ providedIn: "root" }]
1567
- }], ctorParameters: function () { return [{ type: TokenService }, { type: i5.Router }]; } });
1478
+ }], ctorParameters: function () { return [{ type: TokenService }, { type: i4$1.Router }]; } });
1568
1479
 
1569
1480
  // Angular
1570
1481
  // Chiamate ai Repository
@@ -1642,11 +1553,11 @@ class ApplicationCachePersistor extends CachePersistor {
1642
1553
  return `${this.getItemsUrl(sessionKey)}/${itemKey}`;
1643
1554
  }
1644
1555
  }
1645
- ApplicationCachePersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$1.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
1556
+ ApplicationCachePersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$2.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
1646
1557
  ApplicationCachePersistor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor });
1647
1558
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationCachePersistor, decorators: [{
1648
1559
  type: Injectable
1649
- }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$1.BaseSessionRetriever }]; } });
1560
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$2.BaseSessionRetriever }]; } });
1650
1561
 
1651
1562
  // Angular
1652
1563
  // Chiamate ai Repository
@@ -1724,11 +1635,11 @@ class ApplicationPreferencesPersistor extends PreferencesPersistor {
1724
1635
  return `${this.getItemsUrl(sessionKey)}/${itemKey}`;
1725
1636
  }
1726
1637
  }
1727
- ApplicationPreferencesPersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$1.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
1638
+ ApplicationPreferencesPersistor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor, deps: [{ token: i1$1.LocalizationService }, { token: i2.HttpClient }, { token: TokenService }, { token: i4$2.BaseSessionRetriever }], target: i0.ɵɵFactoryTarget.Injectable });
1728
1639
  ApplicationPreferencesPersistor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor });
1729
1640
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApplicationPreferencesPersistor, decorators: [{
1730
1641
  type: Injectable
1731
- }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$1.BaseSessionRetriever }]; } });
1642
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i2.HttpClient }, { type: TokenService }, { type: i4$2.BaseSessionRetriever }]; } });
1732
1643
 
1733
1644
  // Angular
1734
1645
  class BaseRouterGuard extends AccessControlRouteGuard {
@@ -1738,11 +1649,11 @@ class BaseRouterGuard extends AccessControlRouteGuard {
1738
1649
  acc.initializeIdentity(ts.getJaceIdentity());
1739
1650
  }
1740
1651
  }
1741
- BaseRouterGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard, deps: [{ token: i4.MessageService }, { token: i5$1.AccessControlService }, { token: i5.Router }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable });
1652
+ BaseRouterGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard, deps: [{ token: i4.MessageService }, { token: i5.AccessControlService }, { token: i4$1.Router }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable });
1742
1653
  BaseRouterGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard });
1743
1654
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseRouterGuard, decorators: [{
1744
1655
  type: Injectable
1745
- }], ctorParameters: function () { return [{ type: i4.MessageService }, { type: i5$1.AccessControlService }, { type: i5.Router }, { type: TokenService }]; } });
1656
+ }], ctorParameters: function () { return [{ type: i4.MessageService }, { type: i5.AccessControlService }, { type: i4$1.Router }, { type: TokenService }]; } });
1746
1657
 
1747
1658
  /**
1748
1659
  * Generated bundle index. Do not edit.