@apotech-os/ui-sdk 7.5.0 → 7.6.0

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.cjs CHANGED
@@ -50,6 +50,19 @@ function useAppContext() {
50
50
  if (!ctx) throw new Error("useAppContext must be used inside an app page mounted by the shell");
51
51
  return ctx;
52
52
  }
53
+ function useAppPageHref() {
54
+ const { appSlug, basePath } = useAppContext();
55
+ const base = basePath ?? `/espace/${appSlug}`;
56
+ return (pagePath, query) => {
57
+ const params = query instanceof URLSearchParams ? query : new URLSearchParams(
58
+ Object.entries(query ?? {}).flatMap(
59
+ ([key, value]) => value === null || value === void 0 ? [] : [[key, String(value)]]
60
+ )
61
+ );
62
+ const search = params.toString();
63
+ return `${base}/${pagePath}${search ? `?${search}` : ""}`;
64
+ };
65
+ }
53
66
  var AppInvokeError = class extends Error {
54
67
  constructor(status, message, code, invocationId) {
55
68
  super(message);
@@ -2710,6 +2723,7 @@ exports.relativeDelta = relativeDelta;
2710
2723
  exports.toCsv = toCsv;
2711
2724
  exports.useAppApi = useAppApi;
2712
2725
  exports.useAppContext = useAppContext;
2726
+ exports.useAppPageHref = useAppPageHref;
2713
2727
  exports.useAppRun = useAppRun;
2714
2728
  exports.useAppRuns = useAppRuns;
2715
2729
  exports.useAppSettings = useAppSettings;