@luigi-project/core-modular 0.0.20-dev.202610200049 → 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,10 +13,10 @@ 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>;
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
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: {
package/luigi.js CHANGED
@@ -7900,8 +7900,10 @@ var fi = {
7900
7900
  }
7901
7901
  }, yi = class {
7902
7902
  luigi;
7903
+ _preservedViews = [];
7903
7904
  modalService;
7904
7905
  nodeDataManagementService;
7906
+ goBackContext = null;
7905
7907
  previousBreadcrumbs = {};
7906
7908
  constructor(e) {
7907
7909
  this.luigi = e;
@@ -7912,6 +7914,61 @@ var fi = {
7912
7914
  getNodeDataManagementService() {
7913
7915
  return this.nodeDataManagementService ||= W.get(vi), this.nodeDataManagementService;
7914
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
+ }
7915
7972
  async getPathData(e) {
7916
7973
  let t = this.luigi.getConfig(), n = e?.split("/");
7917
7974
  n?.length > 0 && n[0] === "" && (n = n.slice(1));
@@ -8377,6 +8434,14 @@ var fi = {
8377
8434
  }
8378
8435
  }
8379
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
+ }
8380
8445
  if (!(o || s) && a.trimLeadingSlash(S) === a.trimLeadingSlash(v)) {
8381
8446
  let e = this.luigi.getEngine()._connector?.getContainerWrapper();
8382
8447
  if (e?.childNodes) {
@@ -8395,6 +8460,7 @@ var fi = {
8395
8460
  }
8396
8461
  else {
8397
8462
  let e = { detail: {
8463
+ preserveView: !!i,
8398
8464
  preventContextUpdate: !!u,
8399
8465
  preventHistoryEntry: !!d,
8400
8466
  withoutSync: !!l
@@ -8412,7 +8478,7 @@ var fi = {
8412
8478
  let n = this.luigi.getConfigValue("routing.disableBrowserHistory") ? "replaceState" : y;
8413
8479
  if (p) {
8414
8480
  let t = a.addLeadingSlash(v);
8415
- if (!l && !u && n !== "replaceState") location.hash = t;
8481
+ if (!l && !i && !u && n !== "replaceState") location.hash = t;
8416
8482
  else {
8417
8483
  let r = new CustomEvent("hashchange", e);
8418
8484
  window.history[n]({ path: "/#" + t }, "", "/#" + t), window.dispatchEvent(r);
@@ -8646,15 +8712,15 @@ var fi = {
8646
8712
  }
8647
8713
  enableRouting() {
8648
8714
  this.luigi.getConfig().routing?.useHashRouting ? (xi.addEventListener("hashchange", (e) => {
8649
- let t = !!e?.detail?.preventContextUpdate, n = !!e?.detail?.withoutSync;
8650
- 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);
8651
8717
  }), this.handleRouteChange(U.getCurrentPath(this.luigi, !0, !0))) : (xi.addEventListener("popstate", (e) => {
8652
- let t = !!e?.detail?.preventContextUpdate, n = !!e?.detail?.withoutSync;
8653
- 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);
8654
8720
  }), this.handleRouteChange(U.getCurrentPath(this.luigi, !1, !0)));
8655
8721
  }
8656
- async handleRouteChange(e, t = !1, n = !1) {
8657
- 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);
8658
8724
  try {
8659
8725
  if (this.dirtyStatusService?.shouldShowUnsavedChangesModal()) {
8660
8726
  let e = this.dirtyStatusService.unsavedChanges.persistUrl;
@@ -8665,31 +8731,31 @@ var fi = {
8665
8731
  return;
8666
8732
  }
8667
8733
  if (this.shouldSkipRoutingForUrlPatterns()) return;
8668
- this.setFeatureToggle(o), await this.shouldShowModalPathInUrl(e), s.forEach((e, t) => {
8669
- c[t] = e;
8670
- }), this.checkInvalidateCache(this.previousPathData, r);
8671
- 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) || "";
8672
8738
  this.currentRoute = {
8673
8739
  raw: window.location.href,
8674
- path: r,
8675
- nodeParams: u
8740
+ path: i,
8741
+ nodeParams: d
8676
8742
  };
8677
- let f = l?.selectedNode ?? await this.getNavigationService().getCurrentNode(r), p = f?.viewUrl || "";
8678
- 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)) {
8679
8745
  let e = this.luigi.getEngine()._connector;
8680
- 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));
8681
8747
  return;
8682
8748
  }
8683
- let m = this.luigi.getEngine()._connector;
8684
- 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) => {
8685
- m?.renderBreadcrumbs(e);
8686
- })), 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) {
8687
8753
  let e = {
8688
- nodeParams: u || {},
8689
- pathParams: l?.pathParams || {},
8690
- searchParams: U.prepareSearchParamsForClient(f, this.luigi)
8754
+ nodeParams: d || {},
8755
+ pathParams: u?.pathParams || {},
8756
+ searchParams: U.prepareSearchParamsForClient(p, this.luigi)
8691
8757
  };
8692
- 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;
8693
8759
  }
8694
8760
  }
8695
8761
  getCurrentRoute() {
@@ -8953,40 +9019,55 @@ var fi = {
8953
9019
  }
8954
9020
  } else e.includes("settings.theming") && t.node && G.updateMainContent(t.node, G.luigi);
8955
9021
  },
8956
- updateMainContent: async (e, t, n, r, i) => {
8957
- let o = await t.readUserSettings(), s = e.userSettingsGroup && typeof o == "object" && o && e.userSettingsGroup ? o[e.userSettingsGroup] : null, c = t.getEngine()._connector?.getContainerWrapper();
8958
- t.getEngine()._connector?.hideLoadingIndicator(c);
8959
- let l = n?.nodeParams || {}, u = n?.pathParams || {}, d = n?.searchParams || {};
8960
- if (e && c) {
8961
- let o, f, p;
8962
- (e.virtualTree || e._virtualTree) && (p = H.findVirtualTreeRootNode(e));
8963
- let m = e.viewUrl ? W.get(Ci).applyDecorators(U.substituteViewUrl(e, u, l, t), e.decodeViewUrl ?? !1) : "";
8964
- if ([...c.childNodes].forEach((n) => {
8965
- 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) {
8966
9032
  if (!r) {
8967
9033
  n.style.display = "none";
8968
9034
  let e = t.getConfigValue("navigation.viewGroupSettings")?.[n.viewGroup];
8969
9035
  e?.preloadUrl && (n.viewurl = e.preloadUrl, n.context = {}, n.nodeParams = {}, n.pathParams = {});
8970
9036
  }
8971
- } 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();
8972
- }), f && f._luigiPreloading && (f._luigiPreloading = !1, W.get(bi).viewGroupLoaded(f)), f) {
8973
- let n = f.viewurl;
8974
- !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)));
8975
- } else if (r) !i && o && (o.updateContext(e.context || {}, { withoutSync: r }), await ki(e.context || {}, !!r, t));
8976
- else {
8977
- let r = await wi(e, t, n, "main");
8978
- c?.appendChild(r);
8979
- let i = t.getEngine()._connector;
8980
- 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);
8981
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();
8982
9063
  }
8983
9064
  },
8984
9065
  openModal: async (e, t, n, r, i) => {
8985
9066
  let a = await wi(t, e, i, "modal");
8986
9067
  G.modalContainer.push(a);
8987
9068
  let o = W.get(Si), s = W.get(_i), c = W.get(gi), l = !1, u, d, f = new Promise((t) => {
8988
- u = () => {
8989
- 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))));
8990
9071
  }, d = async () => {
8991
9072
  try {
8992
9073
  await c.getUnsavedChangesModalPromise(a);
@@ -9001,13 +9082,7 @@ var fi = {
9001
9082
  return;
9002
9083
  }
9003
9084
  let n = t?.detail || t?.payload;
9004
- if (r?.(n), u && u(), e.getConfigValue("routing.showModalPathInUrl") && s.getModalStackLength() === 0 && o.removeModalDataFromUrl(!0), n && Object.keys(n).length) {
9005
- let t = e.getEngine()._connector?.getContainerWrapper();
9006
- if (t) {
9007
- let e = [...t.childNodes].find((e) => e.tagName?.indexOf("LUIGI-") === 0 && e.style?.display !== "none");
9008
- e?.updateContext && e.updateContext({ goBackContext: n }, { withoutSync: !1 });
9009
- }
9010
- }
9085
+ r?.(n), u && u(n), e.getConfigValue("routing.showModalPathInUrl") && s.getModalStackLength() === 0 && o.removeModalDataFromUrl(!0);
9011
9086
  });
9012
9087
  }), p = {
9013
9088
  closePromise: f,
@@ -9050,8 +9125,8 @@ var fi = {
9050
9125
  let o = await wi(t, e, i, "drawer");
9051
9126
  G.drawerContainer = o;
9052
9127
  let s = !1, c, l = new Promise((e) => {
9053
- c = () => {
9054
- 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))));
9055
9130
  }, o.addEventListener(V.CLOSE_CURRENT_MODAL_REQUEST, async () => {
9056
9131
  try {
9057
9132
  await a.getUnsavedChangesModalPromise(o);
@@ -9059,6 +9134,14 @@ var fi = {
9059
9134
  return;
9060
9135
  }
9061
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);
9062
9145
  });
9063
9146
  });
9064
9147
  e.getEngine()._connector?.renderDrawer(o, n, async () => {
@@ -9579,6 +9662,10 @@ var fi = {
9579
9662
  n?.runTimeErrorHandler?.errorFn && a.isFunction(n?.runTimeErrorHandler?.errorFn) ? n.runTimeErrorHandler.errorFn(e, n) : r?.errorFn && a.isFunction(r.errorFn) && r.errorFn(e, n);
9580
9663
  };
9581
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
+ };
9582
9669
  fromVirtualTreeRoot() {
9583
9670
  return this.options.fromContext = null, this.options.fromClosestContext = !1, this.options.fromVirtualTreeRoot = !0, this.options.fromParent = !1, this;
9584
9671
  }
@@ -11528,6 +11615,8 @@ var sc = {
11528
11615
  }), e.addEventListener(V.SET_VIEW_GROUP_DATA_REQUEST, (n) => {
11529
11616
  let r = e.viewGroup;
11530
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);
11531
11620
  });
11532
11621
  }
11533
11622
  };