procode-lowcode-core 1.0.9 → 1.0.10

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.
package/dist/index.esm.js CHANGED
@@ -19923,6 +19923,27 @@ const RouterElement = ({ NotificationElement, PageNotFoundElement, }) => {
19923
19923
  return (jsxs(Fragment, { children: [jsx(Provider, Object.assign({ store: store }, { children: jsx(ScreenInitializer, { eventService: eventService, NotificationElement: NotificationElement, uiMetaData: uiMetaData }) })), jsx(Outlet, {})] }));
19924
19924
  };
19925
19925
 
19926
+ /**
19927
+ * Resolves a relative app path by prepending the homePage prefix
19928
+ * extracted from the current URL.
19929
+ *
19930
+ * e.g. if env.homePage = "/:appCode" and current URL is "/VARSTAGRxxpPq0ECRMBbnHC/workflows",
19931
+ * resolveAppPath("/workflows") returns "/VARSTAGRxxpPq0ECRMBbnHC/workflows"
19932
+ */
19933
+ const resolveAppPath = (pathname) => {
19934
+ if (!env.homePage || !pathname)
19935
+ return pathname;
19936
+ const homePageSegmentCount = env.homePage.split("/").filter(Boolean).length;
19937
+ const currentSegments = window.location.pathname
19938
+ .split("/")
19939
+ .filter(Boolean);
19940
+ const prefix = "/" + currentSegments.slice(0, homePageSegmentCount).join("/");
19941
+ // Avoid double-prepending
19942
+ if (pathname.startsWith(prefix + "/") || pathname === prefix)
19943
+ return pathname;
19944
+ return prefix + pathname;
19945
+ };
19946
+
19926
19947
  const AppRouter = (appRouterProps) => {
19927
19948
  var _a;
19928
19949
  const loadSchema = (slug, params) => __awaiter(void 0, void 0, void 0, function* () { return yield loader({ commonStore, appRouterProps, slug, params }); });
@@ -19980,6 +20001,21 @@ const AppRouter = (appRouterProps) => {
19980
20001
  children: createParentRoutes(),
19981
20002
  },
19982
20003
  ]);
20004
+ // Middleware: auto-prepend homePage prefix to all navigation paths.
20005
+ // This intercepts useNavigate(), <Link>, <Navigate> — everything goes through router.navigate.
20006
+ const originalNavigate = router.navigate.bind(router);
20007
+ router.navigate = (to, opts) => {
20008
+ if (typeof to === "number" || to === null) {
20009
+ return originalNavigate(to, opts);
20010
+ }
20011
+ if (typeof to === "string") {
20012
+ return originalNavigate(resolveAppPath(to), opts);
20013
+ }
20014
+ if (to === null || to === void 0 ? void 0 : to.pathname) {
20015
+ return originalNavigate(Object.assign(Object.assign({}, to), { pathname: resolveAppPath(to.pathname) }), opts);
20016
+ }
20017
+ return originalNavigate(to, opts);
20018
+ };
19983
20019
  return jsx(RouterProvider, { router: router });
19984
20020
  };
19985
20021
 
@@ -20283,5 +20319,5 @@ const coreStyles = './Assets/styles/index.scss';
20283
20319
  // Utility function to get styles path
20284
20320
  const getCoreStylesPath = () => coreStyles;
20285
20321
 
20286
- export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath };
20322
+ export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath, resolveAppPath };
20287
20323
  //# sourceMappingURL=index.esm.js.map