@luigi-project/core-modular 0.0.19 → 0.0.20-dev.202610210048

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.
@@ -11,7 +11,7 @@ export declare class Navigation {
11
11
  modalService: ModalService;
12
12
  options: NavigationOptions;
13
13
  constructor(luigi: Luigi);
14
- navigate: (path: string, preserveView?: string, modalSettings?: ModalSettings, splitViewSettings?: any, drawerSettings?: any) => Promise<void>;
14
+ navigate: (path: string, preserveView?: boolean, modalSettings?: ModalSettings, splitViewSettings?: any, drawerSettings?: any) => Promise<void>;
15
15
  /**
16
16
  * Offers an alternative way of navigating with intents. This involves specifying a semanticSlug and an object containing parameters.
17
17
  * @param {string} semanticSlug - concatenation of semantic object and action connected with a dash (-), i.e.: `<semanticObject>-<action>`
@@ -38,6 +38,19 @@ export declare class Navigation {
38
38
  * );
39
39
  */
40
40
  pathExists: (path: string) => Promise<boolean>;
41
+ /**
42
+ * Checks if there is one or more preserved views. You can use it to show a **back** button.
43
+ * @returns {boolean} indicating if there is a preserved view you can return to
44
+ */
45
+ hasBack: () => boolean;
46
+ /**
47
+ * Discards the active view and navigates back to the last visited view. Works with preserved views, and also acts as the substitute of the browser **back** button. **goBackContext** is only available when using preserved views.
48
+ * @param {any} goBackValue - data that is passed in the **goBackContext** field to the last visited view when using preserved views
49
+ * @example
50
+ * Luigi.navigation().goBack({ foo: 'bar' });
51
+ * Luigi.navigation().goBack(true);
52
+ */
53
+ goBack: (goBackValue?: any) => void;
41
54
  /**
42
55
  * Sets the current navigation base to the parent node that is defined as virtualTree. This method works only when the currently active micro frontend is inside a virtualTree.
43
56
  * @returns {Navigation} navigation instance
package/luigi-engine.d.ts CHANGED
@@ -13,11 +13,11 @@ export declare class LuigiEngine {
13
13
  drawerContainer: any;
14
14
  init: (luigi: import('./core-api/luigi').Luigi) => void;
15
15
  update: (scopes?: string[]) => Promise<void>;
16
- updateMainContent: (currentNode: import('./types/navigation').Node, luigi: import('./core-api/luigi').Luigi, luigiParams?: import('./types/routing').LuigiParams, withoutSync?: boolean, preventContextUpdate?: boolean) => Promise<void>;
16
+ updateMainContent: (currentNode: import('./types/navigation').Node, luigi: import('./core-api/luigi').Luigi, luigiParams?: import('./types/routing').LuigiParams, withoutSync?: boolean, preventContextUpdate?: boolean, preserveView?: boolean) => Promise<void>;
17
17
  openModal: (luigi: import('./core-api/luigi').Luigi, node: import('./types/navigation').Node, modalSettings: import('./types/navigation').ModalSettings, onCloseCallback?: (goBackValue?: any) => void, luigiParams?: import('./types/routing').LuigiParams) => Promise<void>;
18
18
  updateModalSettings: (modalSettings: import('./types/navigation').ModalSettings, addHistoryEntry: boolean, luigi: import('./core-api/luigi').Luigi) => void;
19
- openDrawer: (luigi: import('./core-api/luigi').Luigi, node: import('./types/navigation').Node, drawerSettings: import('./types/navigation').DrawerSettings, onCloseCallback?: () => void, luigiParams?: import('./types/routing').LuigiParams) => Promise<void>;
20
- openUserSettings: (userSettingsDialogSettings: import('./types/navigation').UserSettingsDialogSettings, userSettingData: any, previousUserSettings: any, luigi: import('./core-api/luigi').Luigi) => Promise<void>;
19
+ openDrawer: (luigi: import('./core-api/luigi').Luigi, node: import('./types/navigation').Node, drawerSettings: import('./types/navigation').DrawerSettings, onCloseCallback?: (goBackValue?: any) => void, luigiParams?: import('./types/routing').LuigiParams) => Promise<void>;
20
+ openUserSettings: (userSettingsDialogSettings: import('./types/navigation').UserSettingsDialogSettings, userSettingData: any, previousUserSettings: any, initialUserSettings: any, luigi: import('./core-api/luigi').Luigi) => Promise<void>;
21
21
  };
22
22
  _comm: {
23
23
  luigi: import('./core-api/luigi').Luigi;
package/luigi.js CHANGED
@@ -7481,6 +7481,15 @@ var fi = {
7481
7481
  let t = this.getQueryParam(`${this.getModalViewParamName(e)}Params`, e);
7482
7482
  return t && JSON.parse(t);
7483
7483
  },
7484
+ getBookmarkableModalParams(e) {
7485
+ let t = {
7486
+ size: e.size,
7487
+ width: e.width,
7488
+ height: e.height,
7489
+ title: e.title
7490
+ };
7491
+ return e.keepPrevious && (t.keepPrevious = e.keepPrevious), t;
7492
+ },
7484
7493
  getHashQueryParamSeparator() {
7485
7494
  return this.defaultQueryParamSeparator;
7486
7495
  },
@@ -7891,8 +7900,10 @@ var fi = {
7891
7900
  }
7892
7901
  }, yi = class {
7893
7902
  luigi;
7903
+ _preservedViews = [];
7894
7904
  modalService;
7895
7905
  nodeDataManagementService;
7906
+ goBackContext = null;
7896
7907
  previousBreadcrumbs = {};
7897
7908
  constructor(e) {
7898
7909
  this.luigi = e;
@@ -7903,6 +7914,61 @@ var fi = {
7903
7914
  getNodeDataManagementService() {
7904
7915
  return this.nodeDataManagementService ||= W.get(vi), this.nodeDataManagementService;
7905
7916
  }
7917
+ handleDialogContainer(e) {
7918
+ let t = a.getNodeList("luigi-container[lui_container]", !0);
7919
+ if (this.goBackContext = { goBackContext: e }, t?.length > 1) {
7920
+ let n = t.filter((e) => !e.parentNode.classList.contains("content")).at(-1);
7921
+ return n?.updateContext && n.updateContext({
7922
+ ...n.context,
7923
+ goBackContext: e
7924
+ }, { withoutSync: !1 }), !0;
7925
+ } else return !1;
7926
+ }
7927
+ prepareGoBackContextForNavigation(e) {
7928
+ (typeof e == "boolean" || e && typeof e == "object") && this.handleDialogContainer(e);
7929
+ }
7930
+ clearGoBackContext() {
7931
+ this.goBackContext = null;
7932
+ }
7933
+ getGoBackContext() {
7934
+ return this.goBackContext;
7935
+ }
7936
+ clearPreservedViews() {
7937
+ this._preservedViews.length = 0;
7938
+ }
7939
+ removeLastPreservedView() {
7940
+ this._preservedViews.length && this._preservedViews.pop();
7941
+ }
7942
+ getPreservedViewsLength() {
7943
+ return this._preservedViews.length;
7944
+ }
7945
+ isValidBackRoute(e) {
7946
+ if (this._preservedViews.length === 0) return !1;
7947
+ let t = e.startsWith("/") ? e : `/${e}`, n = [...this._preservedViews].pop(), r = (e) => e.split("?")[0];
7948
+ return [r(n.path), r(n.nextPath)].includes(r(t));
7949
+ }
7950
+ processGoBackContext(e) {
7951
+ let t = (e) => {
7952
+ let t = this.luigi.getEngine()._connector?.getContainerWrapper();
7953
+ if (!t) return;
7954
+ let n = [...t.childNodes].filter((e) => e.tagName?.indexOf("LUIGI-") === 0).find((e) => e.style?.display !== "none");
7955
+ n?.updateContext && n.updateContext({
7956
+ ...n.context,
7957
+ ...e
7958
+ }, { withoutSync: !1 });
7959
+ };
7960
+ typeof e == "boolean" || e && typeof e == "object" ? this.handleDialogContainer(e) || t({ goBackContext: e }) : (this.clearGoBackContext(), this.luigi.getConfigValue("routing.showModalPathInUrl") || t({}));
7961
+ }
7962
+ handleGoBackRequest(e) {
7963
+ let t = e && typeof e == "string" ? JSON.parse(e) : e;
7964
+ this.clearGoBackContext(), this.getPreservedViewsLength() > 0 ? W.get(gi).getUnsavedChangesModalPromise().then(() => {
7965
+ let e = this._preservedViews.pop();
7966
+ this.prepareGoBackContextForNavigation(t), e?.path && this.handleNavigationRequest({
7967
+ path: e.path,
7968
+ withoutSync: !1
7969
+ });
7970
+ }, () => {}) : (e && console.warn("Warning: goBack() does not support goBackContext value. This is available only when using the Luigi preserveView feature."), history.back());
7971
+ }
7906
7972
  async getPathData(e) {
7907
7973
  let t = this.luigi.getConfig(), n = e?.split("/");
7908
7974
  n?.length > 0 && n[0] === "" && (n = n.slice(1));
@@ -8368,6 +8434,14 @@ var fi = {
8368
8434
  }
8369
8435
  }
8370
8436
  let v = _.replace(/\/\/+/g, "/"), y = d ? "replaceState" : "pushState", { path: b, query: x } = U.getCurrentPath(this.luigi, p), S = b + (x ? "?" + x : "");
8437
+ if (i) {
8438
+ let e = await this.getPathData(b);
8439
+ this._preservedViews.push({
8440
+ context: e.context,
8441
+ nextPath: _.startsWith("/") ? _ : "/" + _,
8442
+ path: e?.pathParams ? a.replaceVars(b, e.pathParams, ":", !1) : b
8443
+ });
8444
+ }
8371
8445
  if (!(o || s) && a.trimLeadingSlash(S) === a.trimLeadingSlash(v)) {
8372
8446
  let e = this.luigi.getEngine()._connector?.getContainerWrapper();
8373
8447
  if (e?.childNodes) {
@@ -8386,6 +8460,7 @@ var fi = {
8386
8460
  }
8387
8461
  else {
8388
8462
  let e = { detail: {
8463
+ preserveView: !!i,
8389
8464
  preventContextUpdate: !!u,
8390
8465
  preventHistoryEntry: !!d,
8391
8466
  withoutSync: !!l
@@ -8403,7 +8478,7 @@ var fi = {
8403
8478
  let n = this.luigi.getConfigValue("routing.disableBrowserHistory") ? "replaceState" : y;
8404
8479
  if (p) {
8405
8480
  let t = a.addLeadingSlash(v);
8406
- if (!l && !u && n !== "replaceState") location.hash = t;
8481
+ if (!l && !i && !u && n !== "replaceState") location.hash = t;
8407
8482
  else {
8408
8483
  let r = new CustomEvent("hashchange", e);
8409
8484
  window.history[n]({ path: "/#" + t }, "", "/#" + t), window.dispatchEvent(r);
@@ -8637,15 +8712,15 @@ var fi = {
8637
8712
  }
8638
8713
  enableRouting() {
8639
8714
  this.luigi.getConfig().routing?.useHashRouting ? (xi.addEventListener("hashchange", (e) => {
8640
- let t = !!e?.detail?.preventContextUpdate, n = !!e?.detail?.withoutSync;
8641
- this.handleRouteChange(U.getCurrentPath(this.luigi, !0, !0), n, t);
8715
+ let t = !!e?.detail?.preserveView, n = !!e?.detail?.preventContextUpdate, r = !!e?.detail?.withoutSync;
8716
+ this.handleRouteChange(U.getCurrentPath(this.luigi, !0, !0), r, n, t);
8642
8717
  }), this.handleRouteChange(U.getCurrentPath(this.luigi, !0, !0))) : (xi.addEventListener("popstate", (e) => {
8643
- let t = !!e?.detail?.preventContextUpdate, n = !!e?.detail?.withoutSync;
8644
- this.handleRouteChange(U.getCurrentPath(this.luigi, !1, !0), n, t);
8718
+ let t = !!e?.detail?.preserveView, n = !!e?.detail?.preventContextUpdate, r = !!e?.detail?.withoutSync;
8719
+ this.handleRouteChange(U.getCurrentPath(this.luigi, !1, !0), r, n, t);
8645
8720
  }), this.handleRouteChange(U.getCurrentPath(this.luigi, !1, !0)));
8646
8721
  }
8647
- async handleRouteChange(e, t = !1, n = !1) {
8648
- let r = e.path, i = e.query, o = r + (i ? "?" + i : ""), s = new URLSearchParams(i), c = Object.create(null);
8722
+ async handleRouteChange(e, t = !1, n = !1, r = !1) {
8723
+ let i = e.path, o = e.query, s = i + (o ? "?" + o : ""), c = new URLSearchParams(o), l = Object.create(null);
8649
8724
  try {
8650
8725
  if (this.dirtyStatusService?.shouldShowUnsavedChangesModal()) {
8651
8726
  let e = this.dirtyStatusService.unsavedChanges.persistUrl;
@@ -8656,31 +8731,31 @@ var fi = {
8656
8731
  return;
8657
8732
  }
8658
8733
  if (this.shouldSkipRoutingForUrlPatterns()) return;
8659
- this.setFeatureToggle(o), await this.shouldShowModalPathInUrl(e), s.forEach((e, t) => {
8660
- c[t] = e;
8661
- }), this.checkInvalidateCache(this.previousPathData, r);
8662
- let l = await this.getNavigationService().getPathData(r), u = U.filterNodeParams(c, this.luigi), d = a.getPathWithoutHash(r) || "";
8734
+ this.getNavigationService().isValidBackRoute(i) || this.getNavigationService().clearPreservedViews(), this.setFeatureToggle(s), await this.shouldShowModalPathInUrl(e), c.forEach((e, t) => {
8735
+ l[t] = e;
8736
+ }), this.checkInvalidateCache(this.previousPathData, i);
8737
+ let u = await this.getNavigationService().getPathData(i), d = U.filterNodeParams(l, this.luigi), f = a.getPathWithoutHash(i) || "";
8663
8738
  this.currentRoute = {
8664
8739
  raw: window.location.href,
8665
- path: r,
8666
- nodeParams: u
8740
+ path: i,
8741
+ nodeParams: d
8667
8742
  };
8668
- let f = l?.selectedNode ?? await this.getNavigationService().getCurrentNode(r), p = f?.viewUrl || "";
8669
- if (f && await this.handleViewUrlMisconfigured(f, p, this.previousPathData, d) || await this.handlePageNotFound(f, p, l, r, d)) {
8743
+ let p = u?.selectedNode ?? await this.getNavigationService().getCurrentNode(i), m = p?.viewUrl || "";
8744
+ if (p && await this.handleViewUrlMisconfigured(p, m, this.previousPathData, f) || await this.handlePageNotFound(p, m, u, i, f)) {
8670
8745
  let e = this.luigi.getEngine()._connector;
8671
- e?.renderLeftNav(await this.getNavigationService().getLeftNavData(r, l)), e?.renderTabNav(await this.getNavigationService().getTabNavData(r, l));
8746
+ e?.renderLeftNav(await this.getNavigationService().getLeftNavData(i, u)), e?.renderTabNav(await this.getNavigationService().getTabNavData(i, u));
8672
8747
  return;
8673
8748
  }
8674
- let m = this.luigi.getEngine()._connector;
8675
- if (m?.renderTopNav(await this.getNavigationService().getTopNavData(r, l)), m?.renderLeftNav(await this.getNavigationService().getLeftNavData(r, l)), m?.renderTabNav(await this.getNavigationService().getTabNavData(r, l)), m?.renderBreadcrumbs(await this.getNavigationService().getBreadcrumbData(r, l, (e) => {
8676
- m?.renderBreadcrumbs(e);
8677
- })), f) {
8749
+ let h = this.luigi.getEngine()._connector;
8750
+ if (h?.renderTopNav(await this.getNavigationService().getTopNavData(i, u)), h?.renderLeftNav(await this.getNavigationService().getLeftNavData(i, u)), h?.renderTabNav(await this.getNavigationService().getTabNavData(i, u)), h?.renderBreadcrumbs(await this.getNavigationService().getBreadcrumbData(i, u, (e) => {
8751
+ h?.renderBreadcrumbs(e);
8752
+ })), p) {
8678
8753
  let e = {
8679
- nodeParams: u || {},
8680
- pathParams: l?.pathParams || {},
8681
- searchParams: U.prepareSearchParamsForClient(f, this.luigi)
8754
+ nodeParams: d || {},
8755
+ pathParams: u?.pathParams || {},
8756
+ searchParams: U.prepareSearchParamsForClient(p, this.luigi)
8682
8757
  };
8683
- this.currentRoute.node = f, this.getNavigationService().onNodeChange(this.previousNode, f), this.previousNode = f, await G.updateMainContent(f, this.luigi, e, t, n), this.previousPathData = l;
8758
+ this.currentRoute.node = p, this.getNavigationService().onNodeChange(this.previousNode, p), this.previousNode = p, await G.updateMainContent(p, this.luigi, e, t, n, r), this.previousPathData = u;
8684
8759
  }
8685
8760
  }
8686
8761
  getCurrentRoute() {
@@ -8708,7 +8783,9 @@ var fi = {
8708
8783
  l = e, u = U.getURLWithoutModalData(t, i), u && (l += "?" + u);
8709
8784
  } else l = o.pathname, u = U.getURLWithoutModalData(o.search, i), u && (l += "?" + U.getURLWithoutModalData(o.search, i));
8710
8785
  if (c = U.handleHistoryState(c, l), a !== e) {
8711
- if (r[i] = e, t && Object.keys(t).length && (r[`${i}Params`] = JSON.stringify(t)), s) {
8786
+ r[i] = e;
8787
+ let a = U.getBookmarkableModalParams(t);
8788
+ if (a && Object.keys(a).length && (r[`${i}Params`] = JSON.stringify(a)), s) {
8712
8789
  let e = location.hash.indexOf(n);
8713
8790
  e !== -1 && (o.hash = o.hash.slice(0, e)), o.hash = `${o.hash}${n}${U.encodeParams(r)}`;
8714
8791
  } else o.search = `?${U.encodeParams(r)}`;
@@ -8754,13 +8831,15 @@ var fi = {
8754
8831
  }
8755
8832
  updateModalDataInUrl(e, t, n) {
8756
8833
  let r = U.getHashQueryParamSeparator(), i = U.getQueryParams(this.luigi), a = U.getModalViewParamName(this.luigi);
8757
- i[a] = e, t && Object.keys(t).length && (i[`${a}Params`] = JSON.stringify(t));
8758
- let o = new URL(location.href);
8834
+ i[a] = e;
8835
+ let o = U.getBookmarkableModalParams(t);
8836
+ o && Object.keys(o).length && (i[`${a}Params`] = JSON.stringify(o));
8837
+ let s = new URL(location.href);
8759
8838
  if (this.luigi.getConfigValue("routing.useHashRouting")) {
8760
8839
  let e = location.hash.indexOf(r);
8761
- e !== -1 && (o.hash = o.hash.slice(0, e)), o.hash = `${o.hash}${r}${U.encodeParams(i)}`;
8762
- } else o.search = `?${U.encodeParams(i)}`;
8763
- n ? history.pushState(window.state, "", o.href) : history.replaceState(window.state, "", o.href);
8840
+ e !== -1 && (s.hash = s.hash.slice(0, e)), s.hash = `${s.hash}${r}${U.encodeParams(i)}`;
8841
+ } else s.search = `?${U.encodeParams(i)}`;
8842
+ n ? history.pushState(window.state, "", s.href) : history.replaceState(window.state, "", s.href);
8764
8843
  }
8765
8844
  checkInvalidateCache(e, t) {
8766
8845
  if (!e) return;
@@ -8940,40 +9019,55 @@ var fi = {
8940
9019
  }
8941
9020
  } else e.includes("settings.theming") && t.node && G.updateMainContent(t.node, G.luigi);
8942
9021
  },
8943
- updateMainContent: async (e, t, n, r, i) => {
8944
- let o = await t.readUserSettings(), s = e.userSettingsGroup && typeof o == "object" && o && e.userSettingsGroup ? o[e.userSettingsGroup] : null, c = t.getEngine()._connector?.getContainerWrapper();
8945
- t.getEngine()._connector?.hideLoadingIndicator(c);
8946
- let l = n?.nodeParams || {}, u = n?.pathParams || {}, d = n?.searchParams || {};
8947
- if (e && c) {
8948
- let o, f, p;
8949
- (e.virtualTree || e._virtualTree) && (p = H.findVirtualTreeRootNode(e));
8950
- let m = e.viewUrl ? W.get(Ci).applyDecorators(U.substituteViewUrl(e, u, l, t), e.decodeViewUrl ?? !1) : "";
8951
- if ([...c.childNodes].forEach((n) => {
8952
- if (n.tagName?.indexOf("LUIGI-") === 0) if (r && (o = n), n.viewGroup && e.viewGroup !== n.viewGroup) {
9022
+ updateMainContent: async (e, t, n, r, i, o) => {
9023
+ let s = await t.readUserSettings(), c = e.userSettingsGroup && typeof s == "object" && s && e.userSettingsGroup ? s[e.userSettingsGroup] : null, l = t.getEngine()._connector?.getContainerWrapper();
9024
+ t.getEngine()._connector?.hideLoadingIndicator(l);
9025
+ let u = n?.nodeParams || {}, d = n?.pathParams || {}, f = n?.searchParams || {};
9026
+ if (e && l) {
9027
+ let s, p, m;
9028
+ (e.virtualTree || e._virtualTree) && (m = H.findVirtualTreeRootNode(e));
9029
+ let h = !!G.navService.getGoBackContext(), g = G.navService.getPreservedViewsLength(), _ = e.viewUrl ? W.get(Ci).applyDecorators(U.substituteViewUrl(e, d, u, t), e.decodeViewUrl ?? !1) : "";
9030
+ if ([...l.childNodes].forEach((n) => {
9031
+ if (n.tagName?.indexOf("LUIGI-") === 0) if (r && (s = n), n.viewGroup && e.viewGroup !== n.viewGroup) {
8953
9032
  if (!r) {
8954
9033
  n.style.display = "none";
8955
9034
  let e = t.getConfigValue("navigation.viewGroupSettings")?.[n.viewGroup];
8956
9035
  e?.preloadUrl && (n.viewurl = e.preloadUrl, n.context = {}, n.nodeParams = {}, n.pathParams = {});
8957
9036
  }
8958
- } else r || n.viewGroup || n.virtualTree && p === n.virtualTreeRootNode || !e.viewGroup && !e.isolateView && !e.webcomponent && n.viewurl && (i || m && a.isSameUrl(n.viewurl, m)) ? f = n : r || n.remove();
8959
- }), f && f._luigiPreloading && (f._luigiPreloading = !1, W.get(bi).viewGroupLoaded(f)), f) {
8960
- let n = f.viewurl;
8961
- !r && !i && (f.style.display = "block", f.viewurl = m, f.nodeParams = l, f.pathParams = u, f.clientPermissions = e.clientPermissions, f.searchParams = d, f.locale = t.i18n().getCurrentLocale(), f.theme = t.theming().getCurrentTheme(), f.activeFeatureToggleList = t.featureToggles().getActiveFeatureToggleList(), f.userSettingsGroup = e.userSettingsGroup, f.userSettings = s, Ti(f, t), Ei(f, t)), r && !i && (f.nodeParams = l, f.pathParams = u, f.searchParams = d), i || (a.isSameUrl(n, m) && n !== m && !f.virtualTree && !r ? (f.context = e.context || {}, f.updateViewUrl(m)) : (f.updateContext(e.context || {}, { withoutSync: !!r }), await ki(e.context || {}, !!r, t)));
8962
- } else if (r) !i && o && (o.updateContext(e.context || {}, { withoutSync: r }), await ki(e.context || {}, !!r, t));
8963
- else {
8964
- let r = await wi(e, t, n, "main");
8965
- c?.appendChild(r);
8966
- let i = t.getEngine()._connector;
8967
- e.loadingIndicator?.enabled !== !1 && i?.showLoadingIndicator(c);
9037
+ } else r || n.viewGroup || n.virtualTree && m === n.virtualTreeRootNode ? o || n._luigiPreserved && g ? (n._luigiPreserved = !h, n.style.display = "none") : (n._luigiPreserved = h, n.style.display = "block", p = n) : !e.viewGroup && !e.isolateView && !e.webcomponent && n.viewurl && (i || _ && a.isSameUrl(n.viewurl, _)) ? (n._luigiPreserved = !1, n.style.display = "block", p = n) : o ? (n._luigiPreserved = !0, n.style.display = "none") : !r && !n._luigiPreserved && n.remove();
9038
+ }), p && p._luigiPreloading && (p._luigiPreloading = !1, W.get(bi).viewGroupLoaded(p)), p) {
9039
+ let n = p.viewurl;
9040
+ if (p.viewStackSize = g, !r && !i && (p.style.display = "block", p.viewurl = _, p.nodeParams = u, p.pathParams = d, p.clientPermissions = e.clientPermissions, p.searchParams = f, p.locale = t.i18n().getCurrentLocale(), p.theme = t.theming().getCurrentTheme(), p.activeFeatureToggleList = t.featureToggles().getActiveFeatureToggleList(), p.userSettingsGroup = e.userSettingsGroup, p.userSettings = c, Ti(p, t), Ei(p, t)), r && !i && (p.nodeParams = u, p.pathParams = d, p.searchParams = f), !i) {
9041
+ let i = a.isSameUrl(n, _) && n !== _, o = G.navService.getGoBackContext() || {}, s = {
9042
+ ...e.context,
9043
+ ...o
9044
+ };
9045
+ i && !p.virtualTree && !r ? (p.context = s, p.updateViewUrl(_)) : (p.updateContext(s, { withoutSync: !!r }), await ki(s, !!r, t));
9046
+ }
9047
+ } else if (r) {
9048
+ let n = G.navService.getGoBackContext() || {}, a = {
9049
+ ...e.context,
9050
+ ...n
9051
+ };
9052
+ s.viewStackSize = g, !i && s && (s.updateContext(a, { withoutSync: r }), await ki(a, !!r, t));
9053
+ } else {
9054
+ let r = await wi(e, t, n, "main"), i = t.getEngine()._connector;
9055
+ r.viewStackSize = g, l?.appendChild(r), e.loadingIndicator?.enabled !== !1 && i?.showLoadingIndicator(l);
8968
9056
  }
9057
+ let v = [...l.childNodes];
9058
+ if (h && !g && v.length > 1) {
9059
+ let e = v.at(-1);
9060
+ e && e.style.display === "none" && e.remove();
9061
+ }
9062
+ G.navService.clearGoBackContext();
8969
9063
  }
8970
9064
  },
8971
9065
  openModal: async (e, t, n, r, i) => {
8972
9066
  let a = await wi(t, e, i, "modal");
8973
9067
  G.modalContainer.push(a);
8974
9068
  let o = W.get(Si), s = W.get(_i), c = W.get(gi), l = !1, u, d, f = new Promise((t) => {
8975
- u = () => {
8976
- l || (l = !0, t(), s.removeLastModalFromStack());
9069
+ u = (e) => {
9070
+ l || (l = !0, t(), s.removeLastModalFromStack(), (typeof e == "boolean" || e && typeof e == "object") && (G.navService.removeLastPreservedView(), setTimeout(() => G.navService.processGoBackContext(e))));
8977
9071
  }, d = async () => {
8978
9072
  try {
8979
9073
  await c.getUnsavedChangesModalPromise(a);
@@ -8988,13 +9082,7 @@ var fi = {
8988
9082
  return;
8989
9083
  }
8990
9084
  let n = t?.detail || t?.payload;
8991
- if (r?.(n), u && u(), e.getConfigValue("routing.showModalPathInUrl") && s.getModalStackLength() === 0 && o.removeModalDataFromUrl(!0), n && Object.keys(n).length) {
8992
- let t = e.getEngine()._connector?.getContainerWrapper();
8993
- if (t) {
8994
- let e = [...t.childNodes].find((e) => e.tagName?.indexOf("LUIGI-") === 0 && e.style?.display !== "none");
8995
- e?.updateContext && e.updateContext({ goBackContext: n }, { withoutSync: !1 });
8996
- }
8997
- }
9085
+ r?.(n), u && u(n), e.getConfigValue("routing.showModalPathInUrl") && s.getModalStackLength() === 0 && o.removeModalDataFromUrl(!0);
8998
9086
  });
8999
9087
  }), p = {
9000
9088
  closePromise: f,
@@ -9037,8 +9125,8 @@ var fi = {
9037
9125
  let o = await wi(t, e, i, "drawer");
9038
9126
  G.drawerContainer = o;
9039
9127
  let s = !1, c, l = new Promise((e) => {
9040
- c = () => {
9041
- s || (s = !0, e());
9128
+ c = (t) => {
9129
+ s || (s = !0, e(), (typeof t == "boolean" || t && typeof t == "object") && (G.navService.removeLastPreservedView(), setTimeout(() => G.navService.processGoBackContext(t))));
9042
9130
  }, o.addEventListener(V.CLOSE_CURRENT_MODAL_REQUEST, async () => {
9043
9131
  try {
9044
9132
  await a.getUnsavedChangesModalPromise(o);
@@ -9046,6 +9134,14 @@ var fi = {
9046
9134
  return;
9047
9135
  }
9048
9136
  G.drawerContainer = void 0, a.clearDirtyState(o), c && c();
9137
+ }), o.addEventListener(V.GO_BACK_REQUEST, async (e) => {
9138
+ try {
9139
+ await a.getUnsavedChangesModalPromise(o);
9140
+ } catch {
9141
+ return;
9142
+ }
9143
+ let t = e?.detail || e?.payload;
9144
+ r?.(t), c && c(t);
9049
9145
  });
9050
9146
  });
9051
9147
  e.getEngine()._connector?.renderDrawer(o, n, async () => {
@@ -9059,29 +9155,29 @@ var fi = {
9059
9155
  let u = e.getEngine()._connector;
9060
9156
  t.loadingIndicator?.enabled !== !1 && u?.showLoadingIndicator(o.parentElement);
9061
9157
  },
9062
- openUserSettings: async (e, t, n, r) => {
9063
- let i = {};
9158
+ openUserSettings: async (e, t, n, r, i) => {
9159
+ let a = {};
9064
9160
  e.renderMicroFrontendContainer = async (e, t) => {
9065
- let a = e.viewUrl, o = e.webcomponent ?? !1, s = n?.[t] || {}, c = await wi({
9066
- viewUrl: a,
9161
+ let r = e.viewUrl, o = e.webcomponent ?? !1, s = n?.[t] || {}, c = await wi({
9162
+ viewUrl: r,
9067
9163
  userSettingsGroup: t,
9068
9164
  webcomponent: o,
9069
9165
  context: {
9070
9166
  ...e.context,
9071
9167
  userSettingsData: s
9072
9168
  }
9073
- }, r, void 0, "usersettings");
9169
+ }, i, void 0, "usersettings");
9074
9170
  return c.addEventListener(V.CUSTOM_MESSAGE, (e) => {
9075
9171
  let n = e.detail;
9076
- n?.id === "luigi.updateUserSettings" && (i[t] = n.data?.data ?? n.data);
9172
+ n?.id === "luigi.updateUserSettings" && (a[t] = n.data?.data ?? n.data);
9077
9173
  }), c;
9078
- }, e.onCloseCallback = async (e, t) => {
9079
- let n = {
9174
+ }, e.onCloseCallback = async (e) => {
9175
+ let t = {
9080
9176
  ...e,
9081
- ...i
9177
+ ...a
9082
9178
  };
9083
- await r.storeUserSettings(n, t);
9084
- }, r.getEngine()._connector?.openUserSettings(e, t, n);
9179
+ await i.storeUserSettings(t, n);
9180
+ }, i.getEngine()._connector?.openUserSettings(e, t, r);
9085
9181
  }
9086
9182
  }, Ai = new class {
9087
9183
  idpProviderInstance;
@@ -9537,8 +9633,7 @@ var fi = {
9537
9633
  let e = U.getContentViewParamPrefix(this.luigi), t = Object.entries(o).map(([t, n]) => e + encodeURIComponent(t) + "=" + encodeURIComponent(n)).join("&");
9538
9634
  s += (s.includes("?") ? "&" : "?") + t;
9539
9635
  }
9540
- let { nodeParams: c, ...l } = a;
9541
- this.luigi.getConfigValue("routing.showModalPathInUrl") && this.modalService.getModalStackLength() === 0 && this.routingService.appendModalDataToUrl(s, l), this.luigi.getEngine()._ui.openModal(this.luigi, i, a, n, {
9636
+ this.luigi.getConfigValue("routing.showModalPathInUrl") && this.modalService.getModalStackLength() === 0 && this.routingService.appendModalDataToUrl(s, a), this.luigi.getEngine()._ui.openModal(this.luigi, i, a, n, {
9542
9637
  nodeParams: o,
9543
9638
  pathParams: {},
9544
9639
  searchParams: {}
@@ -9567,6 +9662,10 @@ var fi = {
9567
9662
  n?.runTimeErrorHandler?.errorFn && a.isFunction(n?.runTimeErrorHandler?.errorFn) ? n.runTimeErrorHandler.errorFn(e, n) : r?.errorFn && a.isFunction(r.errorFn) && r.errorFn(e, n);
9568
9663
  };
9569
9664
  pathExists = async (e) => await U.pathExists(e, this.luigi);
9665
+ hasBack = () => this.modalService.getModalStackLength() > 0 || this.navService.getPreservedViewsLength() > 0;
9666
+ goBack = (e) => {
9667
+ this.navService.handleGoBackRequest(e && JSON.stringify(e));
9668
+ };
9570
9669
  fromVirtualTreeRoot() {
9571
9670
  return this.options.fromContext = null, this.options.fromClosestContext = !1, this.options.fromVirtualTreeRoot = !0, this.options.fromParent = !1, this;
9572
9671
  }
@@ -9715,6 +9814,20 @@ var fi = {
9715
9814
  }
9716
9815
  return n;
9717
9816
  }
9817
+ prepareUserSettingsObj(e, t) {
9818
+ let n = {}, r = t || {};
9819
+ return (Array.isArray(e) ? e : []).forEach((e) => {
9820
+ Object.keys(e || {}).forEach((t) => {
9821
+ let i = e[t] || {}, a = {};
9822
+ i.settings && Object.keys(i.settings).forEach((e) => {
9823
+ a[e] = "";
9824
+ }), n[t] = {
9825
+ ...a,
9826
+ ...r[t] || {}
9827
+ };
9828
+ });
9829
+ }), n;
9830
+ }
9718
9831
  getUserSettingsIframesInDom() {
9719
9832
  let e = document.querySelector(".iframeUserSettingsCtn");
9720
9833
  return e ? [...e.children] : [];
@@ -9779,12 +9892,12 @@ var fi = {
9779
9892
  openUserSettings = async () => {
9780
9893
  let e = this.luigi.getConfigValue("userSettings");
9781
9894
  if (!e) return;
9782
- let t = this.luigi.getConfigValue("settings"), n = await this.luigi.readUserSettings(), r = Hi.processUserSettingGroups(e, t), i = e.userSettingsDialog || {}, a = i.dialogHeader || hi.userSettingsDialog.dialogHeader, o = i.saveBtn || hi.userSettingsDialog.saveBtn, s = i.dismissBtn || hi.userSettingsDialog.dismissBtn, c = {
9783
- dialogHeader: this.luigi.i18n().getTranslation(a),
9784
- saveBtn: this.luigi.i18n().getTranslation(o),
9785
- dismissBtn: this.luigi.i18n().getTranslation(s)
9895
+ let t = this.luigi.getConfigValue("settings"), n = await this.luigi.readUserSettings(), r = Hi.processUserSettingGroups(e, t), i = Hi.prepareUserSettingsObj(r, n), a = e.userSettingsDialog || {}, o = a.dialogHeader || hi.userSettingsDialog.dialogHeader, s = a.saveBtn || hi.userSettingsDialog.saveBtn, c = a.dismissBtn || hi.userSettingsDialog.dismissBtn, l = {
9896
+ dialogHeader: this.luigi.i18n().getTranslation(o),
9897
+ saveBtn: this.luigi.i18n().getTranslation(s),
9898
+ dismissBtn: this.luigi.i18n().getTranslation(c)
9786
9899
  };
9787
- this.luigi.getEngine()._ui?.openUserSettings(c, r, n, this.luigi);
9900
+ this.luigi.getEngine()._ui?.openUserSettings(l, r, n, i, this.luigi);
9788
9901
  };
9789
9902
  closeUserSettings = () => {
9790
9903
  this.luigi.getEngine()._connector?.closeUserSettings();
@@ -11502,6 +11615,8 @@ var sc = {
11502
11615
  }), e.addEventListener(V.SET_VIEW_GROUP_DATA_REQUEST, (n) => {
11503
11616
  let r = e.viewGroup;
11504
11617
  r && oc(r, n.detail, t);
11618
+ }), e.addEventListener(V.GO_BACK_REQUEST, (t) => {
11619
+ e.parentNode?.classList?.contains("content") && W.get(yi).handleGoBackRequest(t.payload);
11505
11620
  });
11506
11621
  }
11507
11622
  };