@esfaenza/extensions 15.2.35 → 15.2.37

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.
@@ -859,29 +859,13 @@ class MessageService {
859
859
  return providerOverride;
860
860
  return "swal";
861
861
  }
862
- /**
863
- * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
864
- *
865
- * @param {string} title Titolo del messaggio
866
- * @param {string} text Contenuto del messaggio
867
- * @param {Function} onsuccess Callback da chimare su conferma
868
- * @param {Function} onerror Callback da chimare su errori
869
- */
870
- _simpleWarningWithChoice(title, text, onsuccess = null, onerror = null) {
871
- this.warningSwalWithCancel.fire(title, text).then((result) => {
872
- if (result.value && onsuccess)
873
- onsuccess();
874
- else if (onerror)
875
- onerror();
876
- });
877
- }
878
- simpleWarningWithChoice(title, text, onsuccess, onerror) {
879
- this.withChoiceBase("warning", title, text, onsuccess, onerror);
862
+ simpleWarningWithChoice(title, text, onsuccess, onerror, confirmtext = "", aborttext = '') {
863
+ this.withChoiceBase("warning", title, text, onsuccess, onerror, confirmtext, aborttext);
880
864
  }
881
- simpleSuccessWithChoice(title, text, onsuccess, onerror) {
882
- this.withChoiceBase("success", title, text, onsuccess, onerror);
865
+ simpleSuccessWithChoice(title, text, onsuccess, onerror, confirmtext = "", aborttext = '') {
866
+ this.withChoiceBase("success", title, text, onsuccess, onerror, confirmtext, aborttext);
883
867
  }
884
- withChoiceBase(level, title, text, onsuccess, onerror) {
868
+ withChoiceBase(level, title, text, onsuccess, onerror, confirmtext = "", aborttext = '') {
885
869
  if (this.Embedded) {
886
870
  let guid = this.hash.getGUID();
887
871
  this.GuidRepsonseFunctionsMap[guid] = { onsuccess, onerror };
@@ -897,7 +881,18 @@ class MessageService {
897
881
  });
898
882
  }
899
883
  else
900
- (level == "warning" ? this._simpleWarningWithChoice.bind(this) : this._simpleSuccessWithChoice.bind(this))(title, text, onsuccess, onerror);
884
+ (level == "warning" ? this._simpleWarningWithChoice.bind(this) : this._simpleSuccessWithChoice.bind(this))(title, text, onsuccess, onerror, confirmtext, aborttext);
885
+ }
886
+ /**
887
+ * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
888
+ *
889
+ * @param {string} title Titolo del messaggio
890
+ * @param {string} text Contenuto del messaggio
891
+ * @param {Function} onsuccess Callback da chimare su conferma
892
+ * @param {Function} onerror Callback da chimare su errori
893
+ */
894
+ _simpleWarningWithChoice(title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
895
+ this._simpleWithChoice(this.warningSwalWithCancel, title, text, onconfirm, onabort, confirmtext, aborttext);
901
896
  }
902
897
  /**
903
898
  * Mostra un messaggio di success con richiesta di conferma e gestisce il risultato chiamato i callback **onconfirm** o **onabort**
@@ -910,6 +905,20 @@ class MessageService {
910
905
  * @param {string} aborttext Testo del pulsante di annullamento
911
906
  */
912
907
  _simpleSuccessWithChoice(title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
908
+ this._simpleWithChoice(this.successSwalWithCancel, title, text, onconfirm, onabort, confirmtext, aborttext);
909
+ }
910
+ /**
911
+ * Metodo base per richiedere una scelta all'utente
912
+ *
913
+ * @param {any} swal Swal mixin da utilizzare per visualizzare il messaggio di choice
914
+ * @param {string} title Titolo del messaggio
915
+ * @param {string} text Contenuto del messaggio
916
+ * @param {Function} onconfirm Callback da chimare su conferma
917
+ * @param {Function} onabort Callback da chimare su annullamento
918
+ * @param {string} confirmtext Testo del pulsante di azione
919
+ * @param {string} aborttext Testo del pulsante di annullamento
920
+ */
921
+ _simpleWithChoice(swal, title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
913
922
  var configuration = {
914
923
  title: title,
915
924
  html: text
@@ -918,7 +927,7 @@ class MessageService {
918
927
  configuration["confirmButtonText"] = confirmtext;
919
928
  if (aborttext)
920
929
  configuration["cancelButtonText"] = aborttext;
921
- this.successSwalWithCancel.fire(configuration).then((result) => {
930
+ swal.fire(configuration).then((result) => {
922
931
  if (result.value && onconfirm)
923
932
  onconfirm();
924
933
  else if (onabort)
@@ -1115,7 +1124,9 @@ class AppEmbeddingExtensions {
1115
1124
  console.log(`Window message - navigate -> ${event?.data?.url}`);
1116
1125
  var newTab = event?.data?.newTab;
1117
1126
  var replaceState = event?.data?.replaceState;
1118
- if (!window.location.href.includes(this.router.url)) {
1127
+ // Controllo se il router sta seguendo la chiamata attuale. Escludo i query params che sono gli unici che possono essere seccati dai replaceState
1128
+ // e che potrebbero fare del casino
1129
+ if (!window.location.href.includes(this.router.url.split("?")[0])) {
1119
1130
  console.warn("Doppia chiamata di navigazione, ignoro il secondo evento scoordinato dal router");
1120
1131
  return;
1121
1132
  }