@sinequa/atomic-angular 1.0.19 → 1.0.20

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.
@@ -2880,7 +2880,7 @@ function withSavedSearchesFeatures() {
2880
2880
  return { ...state, savedSearches: [...savedSearches] };
2881
2881
  });
2882
2882
  },
2883
- getSavedSearch(search) {
2883
+ getSavedSearch(search, tab) {
2884
2884
  if (!search)
2885
2885
  return undefined;
2886
2886
  const savedSearches = store.savedSearches();
@@ -2889,7 +2889,15 @@ function withSavedSearchesFeatures() {
2889
2889
  if (!queryParams)
2890
2890
  return false;
2891
2891
  const q = queryParams.split('&').find(qp => qp.startsWith('q='));
2892
- return !!q && decodeURI(q.substring(2)) === search;
2892
+ const qMatch = !!q && decodeURI(q.substring(2)) === search;
2893
+ if (!qMatch)
2894
+ return false;
2895
+ // If tab is provided, check it; otherwise accept any tab
2896
+ if (tab) {
2897
+ const t = queryParams.split('&').find(qp => qp.startsWith('t='));
2898
+ return !!t && decodeURI(t.substring(2)) === tab;
2899
+ }
2900
+ return true;
2893
2901
  });
2894
2902
  }
2895
2903
  })));
@@ -4644,9 +4652,10 @@ class SavedSearchesService {
4644
4652
  *
4645
4653
  * @throws {Error} If saving an empty search is attempted.
4646
4654
  */
4647
- saveSearch(saveName) {
4648
- const { text } = getState(this.queryParamsStore);
4655
+ saveSearch(saveName, saveTab) {
4656
+ const { text, tab } = getState(this.queryParamsStore);
4649
4657
  const display = saveName || text;
4658
+ const tabName = saveTab || tab;
4650
4659
  if (!display) {
4651
4660
  console.error("Saving empty search is not allowed");
4652
4661
  return;
@@ -4654,6 +4663,7 @@ class SavedSearchesService {
4654
4663
  const savedSearch = {
4655
4664
  url: window.location.hash.substring(1),
4656
4665
  date: new Date().toISOString(),
4666
+ tab: tabName,
4657
4667
  display
4658
4668
  };
4659
4669
  const savedSearches = this.userSettingsStore.savedSearches();
@@ -15925,7 +15935,7 @@ class SavedSearchDialog {
15925
15935
  this.dialog()?.showModal();
15926
15936
  }
15927
15937
  async confirm() {
15928
- this.savedSearchesService.saveSearch(this.saveName());
15938
+ this.savedSearchesService.saveSearch(this.saveName(), this.queryParamsStore.tab?.());
15929
15939
  notify.success(this.transloco.translate("searches.saved.saved"), { duration: 2000 });
15930
15940
  // emit close output of the component
15931
15941
  this.dialog()?.close("dialog-confirm");