@esfaenza/extensions 15.2.53 → 15.2.55

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.
@@ -3,7 +3,7 @@ import { InjectionToken, Injectable, Optional, Inject, Pipe, NgModule, Injector
3
3
  import * as i1 from '@esfaenza/localizations';
4
4
  import { LocalizationModule } from '@esfaenza/localizations';
5
5
  import { first, filter, take, map } from 'rxjs/operators';
6
- import { of, Subject, filter as filter$1 } from 'rxjs';
6
+ import { of, ReplaySubject, Subject, filter as filter$1 } from 'rxjs';
7
7
  import { ToastrService } from 'ngx-toastr';
8
8
  import swal from 'sweetalert2';
9
9
  import * as i2 from '@angular/router';
@@ -1057,7 +1057,7 @@ class AppEmbeddingExtensions {
1057
1057
  this.router = router;
1058
1058
  this.location = location;
1059
1059
  this.sidebarWidth = 230;
1060
- this.EmbeddingSource = "";
1060
+ this.EmbeddingSource = new ReplaySubject();
1061
1061
  this.Embedded = false;
1062
1062
  this.EmbeddingLevel = 0;
1063
1063
  this.MessageObserver = new Subject();
@@ -1070,7 +1070,6 @@ class AppEmbeddingExtensions {
1070
1070
  this.MainWindow = this.MainWindow.parent;
1071
1071
  this.EmbeddingLevel++;
1072
1072
  this.Embedded = true;
1073
- this.EmbeddingSource = this.MainWindow.__esfaenza_module;
1074
1073
  // Fallback per farlo funzionare forzatamente mentre lo testo
1075
1074
  this.EmbeddedModule = this.location.path().match(/module=([a-zA-Z_]+)/)?.[1];
1076
1075
  if (!this.EmbeddedModule)
@@ -1113,6 +1112,10 @@ class AppEmbeddingExtensions {
1113
1112
  return `${JSON.parse(JSON.stringify(event?.data))}`;
1114
1113
  }
1115
1114
  configureEmbeddability() {
1115
+ if (this.Embedded)
1116
+ this.MainWindow.postMessage({ type: "whois" }, "*");
1117
+ else
1118
+ this.EmbeddingSource.next("");
1116
1119
  window.onmessage = (event) => {
1117
1120
  // Ignoro i miei messaggi dato che mi interessano solo quelli degli altri iframe
1118
1121
  if (event.source == window && event?.data?.type != "modal-open")
@@ -1143,6 +1146,14 @@ class AppEmbeddingExtensions {
1143
1146
  break;
1144
1147
  }
1145
1148
  }
1149
+ else if (event?.data?.type == "whois") {
1150
+ console.log(`Window message - Whois?`);
1151
+ sourceWindow.postMessage({ type: "itsme", module: myconfig.AppData.ModuleId }, "*");
1152
+ }
1153
+ else if (event?.data?.type == "itsme") {
1154
+ console.log(`Window message - It'sme -> ` + event?.data?.module);
1155
+ this.EmbeddingSource.next(event?.data?.module);
1156
+ }
1146
1157
  else if (event?.data?.type == "replace-state") {
1147
1158
  console.log(`Window message - replace-state -> Url: ${event?.data?.url}`);
1148
1159
  this.location.replaceState(event?.data?.url);