@tailor-platform/app-shell 0.27.3 → 0.28.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.
@@ -318,6 +318,40 @@ export declare type ContextData = AppShellRegister extends {
318
318
  contextData: infer T;
319
319
  } ? T : Record<string, unknown>;
320
320
 
321
+ /**
322
+ * Create an enhanced authentication client.
323
+ *
324
+ * This wrapper around the original createAuthClient adds convenience methods
325
+ * to reduce duplication of the appUri across your application.
326
+ *
327
+ * @example
328
+ * ```tsx
329
+ * import { createAuthClient, AuthProvider } from '@tailor-platform/app-shell';
330
+ * import { createClient, Provider } from 'urql';
331
+ *
332
+ * // Create auth client at module level
333
+ * const authClient = createAuthClient({
334
+ * clientId: 'your-client-id',
335
+ * appUri: 'https://xyz.erp.dev',
336
+ * });
337
+ *
338
+ * // Create urql client using the auth client's fetch
339
+ * const urqlClient = createClient({
340
+ * url: `${authClient.getAppUri()}/query`,
341
+ * fetch: authClient.fetch,
342
+ * });
343
+ *
344
+ * function App() {
345
+ * return (
346
+ * <AuthProvider client={authClient}>
347
+ * <Provider value={urqlClient}>
348
+ * <YourAppComponents />
349
+ * </Provider>
350
+ * </AuthProvider>
351
+ * );
352
+ * }
353
+ * ```
354
+ */
321
355
  export declare function createAuthClient(config: AuthClientConfig): EnhancedAuthClient;
322
356
 
323
357
  /**
@@ -635,16 +669,10 @@ export declare interface EnhancedAuthClient extends AuthClient {
635
669
  */
636
670
  getAppUri(): string;
637
671
  /**
638
- * Get Authorization and DPoP headers for protected resource requests.
639
- * This version automatically uses the appUri for the /query endpoint.
640
- *
641
- * @param path - Optional path to append to appUri (default: "/query")
642
- * @param method - HTTP method (default: "POST")
672
+ * Authenticated fetch with built-in DPoP proof generation and token refresh.
673
+ * Same signature as the standard `fetch` API.
643
674
  */
644
- getAuthHeadersForQuery(path?: string, method?: string): Promise<{
645
- Authorization: string;
646
- DPoP: string;
647
- }>;
675
+ fetch: AuthClient["fetch"];
648
676
  }
649
677
 
650
678
  /**
package/dist/app-shell.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { jsx as a, jsxs as c, Fragment as S } from "react/jsx-runtime";
2
2
  import { capitalCase as D } from "change-case";
3
- import { useRouteError as ue, isRouteErrorResponse as we, redirect as me, Outlet as nt, NavLink as he, Navigate as pe, useRouteLoaderData as fe, createMemoryRouter as ge, createBrowserRouter as be, RouterProvider as xe, useLocation as Y, Link as $, Await as zt, useMatch as ve, useNavigate as ye } from "react-router";
3
+ import { useRouteError as ue, isRouteErrorResponse as we, redirect as me, Outlet as nt, NavLink as he, Navigate as pe, useRouteLoaderData as fe, createMemoryRouter as ge, createBrowserRouter as be, RouterProvider as xe, useLocation as Q, Link as $, Await as zt, useMatch as ve, useNavigate as ye } from "react-router";
4
4
  import { Link as er, useLocation as ar, useNavigate as sr, useParams as rr, useRouteError as nr, useSearchParams as or } from "react-router";
5
5
  import { cva as ot } from "class-variance-authority";
6
6
  import { useRender as j } from "@base-ui/react/use-render";
7
7
  import { clsx as Ne } from "clsx";
8
8
  import { twMerge as Se } from "tailwind-merge";
9
- import { AlertCircle as yt, Table as Ce, XIcon as _t, PanelLeftIcon as Te, ExternalLink as $t, ChevronRight as W, SunIcon as ke, SearchIcon as Re, Check as Pe, Copy as Ae } from "lucide-react";
9
+ import { AlertCircle as yt, Table as Ce, XIcon as _t, PanelLeftIcon as Te, ExternalLink as $t, ChevronRight as W, SunIcon as ke, SearchIcon as Re, Check as Pe, Copy as Ee } from "lucide-react";
10
10
  import * as f from "react";
11
11
  import { createContext as X, useContext as L, useState as H, useMemo as B, useEffect as F, useSyncExternalStore as Wt, Suspense as it, useRef as Ft, useCallback as M } from "react";
12
- import { Toaster as Ee, toast as Me } from "sonner";
12
+ import { Toaster as Ae, toast as Me } from "sonner";
13
13
  import { parsePath as Be } from "@tailor-platform/app-shell-vite-plugin/parser";
14
14
  import { Dialog as v } from "@base-ui/react/dialog";
15
- import { Tooltip as A } from "@base-ui/react/tooltip";
15
+ import { Tooltip as E } from "@base-ui/react/tooltip";
16
16
  import { Collapsible as lt } from "@base-ui/react/collapsible";
17
17
  import { createAuthClient as De } from "@tailor-platform/auth-public-client";
18
18
  function m(...t) {
@@ -202,8 +202,8 @@ const G = "en", Ie = () => {
202
202
  commandPaletteSearch: "ページを検索...",
203
203
  commandPaletteNoResults: "結果が見つかりません"
204
204
  }
205
- }), E = We.useT, _ = () => {
206
- const t = ue(), e = E(), s = {
205
+ }), A = We.useT, _ = () => {
206
+ const t = ue(), e = A(), s = {
207
207
  role: "alert",
208
208
  "aria-label": "default-error-boundary"
209
209
  };
@@ -322,16 +322,16 @@ function Ws(t) {
322
322
  };
323
323
  }
324
324
  const Oe = () => {
325
- const t = E();
325
+ const t = A();
326
326
  return /* @__PURE__ */ c(S, { children: [
327
327
  /* @__PURE__ */ a("p", { className: "astw:font-semibold astw:leading-none astw:tracking-tight", children: t("welcomeTitle") }),
328
328
  /* @__PURE__ */ a("p", { className: "pt-4", children: t("welcomeBody") })
329
329
  ] });
330
330
  }, Nt = () => /* @__PURE__ */ c(S, { children: [
331
331
  /* @__PURE__ */ a(nt, {}),
332
- /* @__PURE__ */ a(Ee, {})
332
+ /* @__PURE__ */ a(Ae, {})
333
333
  ] }), je = () => {
334
- const { configurations: t } = jt(), e = E(), s = _e();
334
+ const { configurations: t } = jt(), e = A(), s = _e();
335
335
  return /* @__PURE__ */ c("div", { className: "astw:mx-auto astw:flex-col astw:flex astw:md:flex-row astw:max-w-5xl astw:gap-[10px] astw:w-full", children: [
336
336
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ c("nav", { className: "astw:bg-card astw:md:w-xs astw:rounded-md astw:border astw:p-3 astw:shadow-xs", children: [
337
337
  /* @__PURE__ */ a("h2", { className: "astw:text-sm astw:leading-[36px] astw:mb-2 astw:font-bold ", children: e("settings") }),
@@ -417,12 +417,12 @@ const Oe = () => {
417
417
  }, qt = "appshell-root-nav", Ve = (t) => ({
418
418
  loaderID: qt,
419
419
  loader: async () => ({ navItems: He(t) })
420
- }), Qt = () => fe(qt)?.navItems, He = async (t) => {
420
+ }), Yt = () => fe(qt)?.navItems, He = async (t) => {
421
421
  const e = Ot(t.locale);
422
422
  return (await Promise.all(
423
423
  t.modules.map(async (r) => {
424
424
  if (r.path.startsWith(":") || (await ut(r.guards)).type !== "pass") return null;
425
- const o = await Yt(
425
+ const o = await Qt(
426
426
  r.resources,
427
427
  r.path,
428
428
  e
@@ -435,10 +435,10 @@ const Oe = () => {
435
435
  icon: r.meta.icon || /* @__PURE__ */ a(Ce, {}),
436
436
  items: n
437
437
  }));
438
- }, Yt = async (t, e, s) => (await Promise.all(
438
+ }, Qt = async (t, e, s) => (await Promise.all(
439
439
  t.map(async (n) => {
440
440
  if (n.path.startsWith(":") || (await ut(n.guards)).type !== "pass") return null;
441
- const i = `${e}/${n.path}`, l = s(n.meta.title, n.path), u = n.subResources ? await Yt(n.subResources, i, s) : void 0;
441
+ const i = `${e}/${n.path}`, l = s(n.meta.title, n.path), u = n.subResources ? await Qt(n.subResources, i, s) : void 0;
442
442
  return {
443
443
  title: l,
444
444
  url: i,
@@ -483,7 +483,7 @@ const Oe = () => {
483
483
  theme: "system",
484
484
  setTheme: () => null
485
485
  }, Xt = X(qe);
486
- function Qe({
486
+ function Ye({
487
487
  children: t,
488
488
  storageKey: e,
489
489
  defaultTheme: s = "system",
@@ -505,7 +505,7 @@ function Qe({
505
505
  };
506
506
  return /* @__PURE__ */ a(Xt.Provider, { ...r, value: l, children: t });
507
507
  }
508
- const Ye = () => {
508
+ const Qe = () => {
509
509
  const t = L(Xt);
510
510
  if (t === void 0) throw new Error("useTheme must be used within a ThemeProvider");
511
511
  return t;
@@ -625,7 +625,7 @@ const te = (t) => {
625
625
  /* @__PURE__ */ a("p", { className: "astw:text-sm astw:text-muted-foreground", children: l })
626
626
  ] }) });
627
627
  }
628
- return e ? /* @__PURE__ */ a(ct.Provider, { value: o, children: /* @__PURE__ */ a(dt.Provider, { value: i, children: /* @__PURE__ */ a(Qe, { defaultTheme: "system", storageKey: "appshell-ui-theme", children: /* @__PURE__ */ a(Ge, { rootComponent: t.rootComponent, children: t.children }) }) }) }) : null;
628
+ return e ? /* @__PURE__ */ a(ct.Provider, { value: o, children: /* @__PURE__ */ a(dt.Provider, { value: i, children: /* @__PURE__ */ a(Ye, { defaultTheme: "system", storageKey: "appshell-ui-theme", children: /* @__PURE__ */ a(Ge, { rootComponent: t.rootComponent, children: t.children }) }) }) }) : null;
629
629
  };
630
630
  function sa(t) {
631
631
  const e = aa(t), s = e.find((o) => o.path === ""), r = e.filter((o) => o.path !== "");
@@ -792,13 +792,13 @@ function mt({
792
792
  children: e,
793
793
  ...s
794
794
  }) {
795
- return /* @__PURE__ */ a(A.Provider, { "data-slot": "tooltip-provider", delay: t, ...s, children: e });
795
+ return /* @__PURE__ */ a(E.Provider, { "data-slot": "tooltip-provider", delay: t, ...s, children: e });
796
796
  }
797
797
  function ht({ children: t, ...e }) {
798
- return /* @__PURE__ */ a(mt, { children: /* @__PURE__ */ a(A.Root, { "data-slot": "tooltip", ...e, children: t }) });
798
+ return /* @__PURE__ */ a(mt, { children: /* @__PURE__ */ a(E.Root, { "data-slot": "tooltip", ...e, children: t }) });
799
799
  }
800
800
  function pt({ ...t }) {
801
- return /* @__PURE__ */ a(A.Trigger, { "data-slot": "tooltip-trigger", ...t });
801
+ return /* @__PURE__ */ a(E.Trigger, { "data-slot": "tooltip-trigger", ...t });
802
802
  }
803
803
  function ft({
804
804
  className: t,
@@ -808,8 +808,8 @@ function ft({
808
808
  children: n,
809
809
  ...o
810
810
  }) {
811
- return /* @__PURE__ */ a(A.Portal, { children: /* @__PURE__ */ a(A.Positioner, { sideOffset: e, side: s, align: r, children: /* @__PURE__ */ c(
812
- A.Popup,
811
+ return /* @__PURE__ */ a(E.Portal, { children: /* @__PURE__ */ a(E.Positioner, { sideOffset: e, side: s, align: r, children: /* @__PURE__ */ c(
812
+ E.Popup,
813
813
  {
814
814
  "data-slot": "tooltip-content",
815
815
  className: m(
@@ -819,7 +819,7 @@ function ft({
819
819
  ...o,
820
820
  children: [
821
821
  n,
822
- /* @__PURE__ */ a(A.Arrow, { className: "astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]" })
822
+ /* @__PURE__ */ a(E.Arrow, { className: "astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]" })
823
823
  ]
824
824
  }
825
825
  ) }) });
@@ -1305,9 +1305,9 @@ const Na = (t) => {
1305
1305
  const { configurations: e } = C(), { modules: s, locale: r } = e;
1306
1306
  return Sa(t) ? null : Ca(t, s, r);
1307
1307
  }, Sa = (t) => t.startsWith("http://") || t.startsWith("https://"), Ca = (t, e, s) => {
1308
- const r = U(s), n = At(t);
1308
+ const r = U(s), n = Et(t);
1309
1309
  for (const o of e) {
1310
- const i = At(o.path);
1310
+ const i = Et(o.path);
1311
1311
  if (re(n, i))
1312
1312
  return {
1313
1313
  title: r(o.meta.title, o.path),
@@ -1322,7 +1322,7 @@ const Na = (t) => {
1322
1322
  if (t === e) return !0;
1323
1323
  const s = t.split("/"), r = e.split("/");
1324
1324
  return s.length !== r.length ? !1 : r.every((n, o) => n.startsWith(":") || n === s[o]);
1325
- }, At = (t) => {
1325
+ }, Et = (t) => {
1326
1326
  let e = t;
1327
1327
  return e.startsWith("/") || (e = `/${e}`), e.length > 1 && e.endsWith("/") && (e = e.slice(0, -1)), e;
1328
1328
  }, ne = (t, e, s, r) => {
@@ -1348,7 +1348,7 @@ const Na = (t) => {
1348
1348
  activeMatch: n = "prefix",
1349
1349
  title: o,
1350
1350
  icon: i
1351
- } = t, { pathname: l } = Y(), u = Na(e), w = n === "exact" ? l === e : l === e || l.startsWith(`${e}/`), d = o ?? u?.title ?? Ta(e), h = i ?? u?.icon, p = {
1351
+ } = t, { pathname: l } = Q(), u = Na(e), w = n === "exact" ? l === e : l === e || l.startsWith(`${e}/`), d = o ?? u?.title ?? Ta(e), h = i ?? u?.icon, p = {
1352
1352
  title: d,
1353
1353
  url: e,
1354
1354
  icon: h,
@@ -1357,14 +1357,17 @@ const Na = (t) => {
1357
1357
  return s || oe(e) ? /* @__PURE__ */ a(I, { children: /* @__PURE__ */ a(
1358
1358
  z,
1359
1359
  {
1360
- render: /* @__PURE__ */ a(
1361
- "a",
1362
- {
1363
- href: e,
1364
- target: "_blank",
1365
- rel: "noopener noreferrer",
1366
- className: w ? "astw:bg-sidebar-accent astw:font-medium" : void 0
1367
- }
1360
+ render: (
1361
+ // oxlint-disable-next-line jsx-a11y/anchor-has-content -- content is provided by SidebarMenuButton's children
1362
+ /* @__PURE__ */ a(
1363
+ "a",
1364
+ {
1365
+ href: e,
1366
+ target: "_blank",
1367
+ rel: "noopener noreferrer",
1368
+ className: w ? "astw:bg-sidebar-accent astw:font-medium" : void 0
1369
+ }
1370
+ )
1368
1371
  ),
1369
1372
  tooltip: d,
1370
1373
  children: r ? r(p) : /* @__PURE__ */ c(S, { children: [
@@ -1402,14 +1405,14 @@ const Na = (t) => {
1402
1405
  function st({ ...t }) {
1403
1406
  return /* @__PURE__ */ a(lt.Root, { "data-slot": "collapsible", ...t });
1404
1407
  }
1405
- function Q({ ...t }) {
1408
+ function Y({ ...t }) {
1406
1409
  return /* @__PURE__ */ a(lt.Trigger, { "data-slot": "collapsible-trigger", ...t });
1407
1410
  }
1408
1411
  function rt({ ...t }) {
1409
1412
  return /* @__PURE__ */ a(lt.Panel, { "data-slot": "collapsible-content", ...t });
1410
1413
  }
1411
1414
  const Os = (t) => {
1412
- const { title: e, icon: s, to: r, defaultOpen: n = !0, children: o } = t, { pathname: i } = Y(), { configurations: l } = C(), u = U(l.locale), w = E(), d = u(e, typeof e == "string" ? e : ""), h = r ? i === r : !1;
1415
+ const { title: e, icon: s, to: r, defaultOpen: n = !0, children: o } = t, { pathname: i } = Q(), { configurations: l } = C(), u = U(l.locale), w = A(), d = u(e, typeof e == "string" ? e : ""), h = r ? i === r : !1;
1413
1416
  return r ? /* @__PURE__ */ c(st, { render: /* @__PURE__ */ a(I, {}), defaultOpen: n, children: [
1414
1417
  /* @__PURE__ */ c(
1415
1418
  z,
@@ -1429,7 +1432,7 @@ const Os = (t) => {
1429
1432
  }
1430
1433
  ),
1431
1434
  /* @__PURE__ */ c(
1432
- Q,
1435
+ Y,
1433
1436
  {
1434
1437
  render: /* @__PURE__ */ a(q, { className: "astw:data-panel-open:rotate-90" }),
1435
1438
  children: [
@@ -1440,7 +1443,7 @@ const Os = (t) => {
1440
1443
  ),
1441
1444
  /* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(at, { children: o }) })
1442
1445
  ] }) : /* @__PURE__ */ c(st, { render: /* @__PURE__ */ a(I, {}), defaultOpen: n, children: [
1443
- /* @__PURE__ */ c(Q, { className: "astw:flex astw:w-full astw:[&[data-panel-open]_.astw-rotate-target]:rotate-90", children: [
1446
+ /* @__PURE__ */ c(Y, { className: "astw:flex astw:w-full astw:[&[data-panel-open]_.astw-rotate-target]:rotate-90", children: [
1444
1447
  /* @__PURE__ */ c(
1445
1448
  z,
1446
1449
  {
@@ -1460,7 +1463,7 @@ const Os = (t) => {
1460
1463
  /* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(at, { children: o }) })
1461
1464
  ] });
1462
1465
  }, js = () => /* @__PURE__ */ a(ga, {}), ka = (t) => {
1463
- const { title: e, icon: s } = C(), { pathname: r } = Y(), { isIconMode: n } = K(), o = /* @__PURE__ */ c(fa, { children: [
1466
+ const { title: e, icon: s } = C(), { pathname: r } = Q(), { isIconMode: n } = K(), o = /* @__PURE__ */ c(fa, { children: [
1464
1467
  s,
1465
1468
  /* @__PURE__ */ a("h1", { className: m("astw:text-sm astw:mb-2 astw:mt-2 astw:px-2", n && "astw:hidden"), children: e })
1466
1469
  ] });
@@ -1474,15 +1477,15 @@ const Os = (t) => {
1474
1477
  /* @__PURE__ */ a(gt, { children: /* @__PURE__ */ a(bt, { children: t.children }) })
1475
1478
  ) : (
1476
1479
  // Existing behavior: auto-generation from resources
1477
- /* @__PURE__ */ a(it, { fallback: /* @__PURE__ */ a(Ea, {}), children: /* @__PURE__ */ a(Ra, { currentPath: r }) })
1480
+ /* @__PURE__ */ a(it, { fallback: /* @__PURE__ */ a(Aa, {}), children: /* @__PURE__ */ a(Ra, { currentPath: r }) })
1478
1481
  ) }),
1479
1482
  t.footer ?? null
1480
1483
  ] });
1481
1484
  }, Ra = ({ currentPath: t }) => {
1482
- const e = Qt();
1485
+ const e = Yt();
1483
1486
  return /* @__PURE__ */ a(zt, { resolve: e, children: (s) => /* @__PURE__ */ a(Pa, { items: s ?? [], currentPath: t }) });
1484
1487
  }, Pa = (t) => {
1485
- const e = E();
1488
+ const e = A();
1486
1489
  return /* @__PURE__ */ a(gt, { children: /* @__PURE__ */ a(bt, { children: t.items.map((s) => /* @__PURE__ */ c(st, { render: /* @__PURE__ */ a(I, {}), defaultOpen: !0, children: [
1487
1490
  s.url ? /* @__PURE__ */ c(S, { children: [
1488
1491
  /* @__PURE__ */ c(
@@ -1503,7 +1506,7 @@ const Os = (t) => {
1503
1506
  }
1504
1507
  ),
1505
1508
  !!s.items?.length && /* @__PURE__ */ c(
1506
- Q,
1509
+ Y,
1507
1510
  {
1508
1511
  render: /* @__PURE__ */ a(q, { className: "astw:data-panel-open:rotate-90" }),
1509
1512
  children: [
@@ -1512,7 +1515,7 @@ const Os = (t) => {
1512
1515
  ]
1513
1516
  }
1514
1517
  )
1515
- ] }) : /* @__PURE__ */ a(S, { children: /* @__PURE__ */ c(Q, { className: "astw:flex astw:w-full astw:[&[data-panel-open]_.astw-rotate-target]:rotate-90", children: [
1518
+ ] }) : /* @__PURE__ */ a(S, { children: /* @__PURE__ */ c(Y, { className: "astw:flex astw:w-full astw:[&[data-panel-open]_.astw-rotate-target]:rotate-90", children: [
1516
1519
  /* @__PURE__ */ c(
1517
1520
  z,
1518
1521
  {
@@ -1543,7 +1546,7 @@ const Os = (t) => {
1543
1546
  }
1544
1547
  ) }, r.title)) }) })
1545
1548
  ] }, s.title)) }) });
1546
- }, Aa = [104, 80, 112, 88, 96, 100, 84, 92], Ea = () => /* @__PURE__ */ a(gt, { children: /* @__PURE__ */ a(bt, { className: "astw:px-2", children: Aa.map((t, e) => /* @__PURE__ */ a(I, { children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-center astw:gap-2 astw:py-1.5", children: [
1549
+ }, Ea = [104, 80, 112, 88, 96, 100, 84, 92], Aa = () => /* @__PURE__ */ a(gt, { children: /* @__PURE__ */ a(bt, { className: "astw:px-2", children: Ea.map((t, e) => /* @__PURE__ */ a(I, { children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-center astw:gap-2 astw:py-1.5", children: [
1547
1550
  /* @__PURE__ */ a("div", { className: "astw:h-4 astw:w-4 astw:rounded-md astw:bg-muted" }),
1548
1551
  /* @__PURE__ */ a(
1549
1552
  "div",
@@ -1553,7 +1556,7 @@ const Os = (t) => {
1553
1556
  }
1554
1557
  )
1555
1558
  ] }) }, e)) }) });
1556
- function Et({ ...t }) {
1559
+ function At({ ...t }) {
1557
1560
  return /* @__PURE__ */ a("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...t });
1558
1561
  }
1559
1562
  function Mt({ className: t, ...e }) {
@@ -1667,7 +1670,7 @@ function La(t, e, s, r) {
1667
1670
  };
1668
1671
  }
1669
1672
  const Ia = () => {
1670
- const { configurations: t } = C(), e = Y();
1673
+ const { configurations: t } = C(), e = Q();
1671
1674
  return La(
1672
1675
  e.pathname,
1673
1676
  t.basePath,
@@ -1675,8 +1678,8 @@ const Ia = () => {
1675
1678
  t.locale
1676
1679
  );
1677
1680
  }, za = () => {
1678
- const { segments: t } = Ia(), e = ve("/:prefix/settings/:suffix"), s = E();
1679
- return e ? /* @__PURE__ */ a(Et, { children: /* @__PURE__ */ a(Mt, { children: /* @__PURE__ */ a("div", { className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground", children: /* @__PURE__ */ a(Bt, { children: /* @__PURE__ */ a(Dt, { to: `/${e.params.prefix}/settings`, children: s("settings") }) }) }) }) }) : /* @__PURE__ */ a(Et, { children: /* @__PURE__ */ a(Mt, { children: t.map((r, n) => /* @__PURE__ */ c(
1681
+ const { segments: t } = Ia(), e = ve("/:prefix/settings/:suffix"), s = A();
1682
+ return e ? /* @__PURE__ */ a(At, { children: /* @__PURE__ */ a(Mt, { children: /* @__PURE__ */ a("div", { className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground", children: /* @__PURE__ */ a(Bt, { children: /* @__PURE__ */ a(Dt, { to: `/${e.params.prefix}/settings`, children: s("settings") }) }) }) }) }) : /* @__PURE__ */ a(At, { children: /* @__PURE__ */ a(Mt, { children: t.map((r, n) => /* @__PURE__ */ c(
1680
1683
  "div",
1681
1684
  {
1682
1685
  className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground",
@@ -1691,7 +1694,7 @@ const Ia = () => {
1691
1694
  const { open: t, isIconMode: e } = K();
1692
1695
  return /* @__PURE__ */ a("div", { className: t && !e ? "astw:md:hidden" : void 0, children: /* @__PURE__ */ a(se, { className: "astw:-ml-2.5" }) });
1693
1696
  }, Us = (t) => {
1694
- const e = t.children ? t.children({ Outlet: Nt }) : null, s = Ye(), r = () => {
1697
+ const e = t.children ? t.children({ Outlet: Nt }) : null, s = Qe(), r = () => {
1695
1698
  s.setTheme(s.theme === "dark" ? "light" : "dark");
1696
1699
  };
1697
1700
  return /* @__PURE__ */ a(ma, { className: "astw:flex astw:flex-col", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:flex-1", children: [
@@ -1836,7 +1839,7 @@ function Ka({ routes: t }) {
1836
1839
  };
1837
1840
  }
1838
1841
  function Va({ navItems: t }) {
1839
- const e = E(), s = B(() => Ua(t), [t]), {
1842
+ const e = A(), s = B(() => Ua(t), [t]), {
1840
1843
  open: r,
1841
1844
  handleOpenChange: n,
1842
1845
  search: o,
@@ -1892,12 +1895,12 @@ function Va({ navItems: t }) {
1892
1895
  ) });
1893
1896
  }
1894
1897
  function Ks() {
1895
- const t = Qt();
1898
+ const t = Yt();
1896
1899
  return /* @__PURE__ */ a(it, { fallback: null, children: /* @__PURE__ */ a(zt, { resolve: t, children: (e) => /* @__PURE__ */ a(Va, { navItems: e ?? [] }) }) });
1897
1900
  }
1898
1901
  function Ha(t, e, s) {
1899
1902
  if (s.current === null || s.current.contextData !== e || s.current.guards !== t) {
1900
- const r = Qa(t, e), n = {
1903
+ const r = Ya(t, e), n = {
1901
1904
  contextData: e,
1902
1905
  guards: t,
1903
1906
  promise: r,
@@ -1927,8 +1930,8 @@ function Ga(t) {
1927
1930
  }
1928
1931
  const Vs = (t) => {
1929
1932
  const { guards: e, children: s, fallback: r = null, loading: n = null } = t, { contextData: o } = jt(), i = Ft(null), l = Ha(e, o, i);
1930
- return /* @__PURE__ */ a(it, { fallback: n, children: /* @__PURE__ */ a(qa, { cache: l, children: s, fallback: r }) });
1931
- }, qa = (t) => Ga(t.cache).type === "pass" ? /* @__PURE__ */ a(S, { children: t.children }) : /* @__PURE__ */ a(S, { children: t.fallback }), Qa = async (t, e) => {
1933
+ return /* @__PURE__ */ a(it, { fallback: n, children: /* @__PURE__ */ a(qa, { cache: l, fallback: r, children: s }) });
1934
+ }, qa = (t) => Ga(t.cache).type === "pass" ? /* @__PURE__ */ a(S, { children: t.children }) : /* @__PURE__ */ a(S, { children: t.fallback }), Ya = async (t, e) => {
1932
1935
  const s = { context: e };
1933
1936
  for (const r of t) {
1934
1937
  const n = await r(s);
@@ -1937,25 +1940,21 @@ const Vs = (t) => {
1937
1940
  }
1938
1941
  return { type: "pass" };
1939
1942
  };
1940
- function Ya(t) {
1941
- const e = new URLSearchParams(t.search);
1942
- e.delete("code"), e.delete("state");
1943
- const s = e.toString();
1944
- return t.pathname + (s ? `?${s}` : "") + t.hash;
1945
- }
1946
1943
  function Hs(t) {
1947
1944
  const e = De(t), { appUri: s } = t;
1948
1945
  return {
1949
1946
  ...e,
1950
1947
  getAppUri() {
1951
1948
  return s;
1952
- },
1953
- async getAuthHeadersForQuery(n = "/query", o = "POST") {
1954
- const i = `${s}${n}`;
1955
- return e.getAuthHeaders(i, o);
1956
1949
  }
1957
1950
  };
1958
1951
  }
1952
+ function Qa(t) {
1953
+ const e = new URLSearchParams(t.search);
1954
+ e.delete("code"), e.delete("state");
1955
+ const s = e.toString();
1956
+ return t.pathname + (s ? `?${s}` : "") + t.hash;
1957
+ }
1959
1958
  const ie = X(null), Gs = (t) => {
1960
1959
  const e = t.client, s = M(
1961
1960
  (l) => e.addEventListener((u) => {
@@ -1968,7 +1967,7 @@ const ie = X(null), Gs = (t) => {
1968
1967
  if (new URLSearchParams(window.location.search).has("code"))
1969
1968
  try {
1970
1969
  await e.handleCallback();
1971
- const w = Ya(new URL(window.location.href));
1970
+ const w = Qa(new URL(window.location.href));
1972
1971
  window.history.replaceState({}, "", w);
1973
1972
  } catch (w) {
1974
1973
  console.error("Failed to handle callback:", w);
@@ -2008,7 +2007,7 @@ const ie = X(null), Gs = (t) => {
2008
2007
  logout: t.logout,
2009
2008
  checkAuthStatus: t.checkAuthStatus
2010
2009
  };
2011
- }, Qs = () => {
2010
+ }, Ys = () => {
2012
2011
  const t = le();
2013
2012
  if (!t.authState.isReady)
2014
2013
  throw t.ready();
@@ -2020,7 +2019,7 @@ const ie = X(null), Gs = (t) => {
2020
2019
  logout: t.logout,
2021
2020
  checkAuthStatus: t.checkAuthStatus
2022
2021
  };
2023
- }, Ys = () => Me, Xa = ot(
2022
+ }, Qs = () => Me, Xa = ot(
2024
2023
  "astw:inline-flex astw:items-center astw:rounded-md astw:border astw:px-2 astw:py-0.5 astw:text-xs astw:font-medium astw:transition-colors astw:focus:outline-none astw:focus:ring-2 astw:focus:ring-ring astw:focus:ring-offset-2",
2025
2024
  {
2026
2025
  variants: {
@@ -2154,7 +2153,7 @@ function ce({ value: t }) {
2154
2153
  className: "astw:ml-0.5 astw:inline-flex astw:items-center astw:justify-center astw:p-1 astw:rounded astw:hover:bg-muted astw:transition-colors astw:text-muted-foreground astw:hover:text-foreground"
2155
2154
  }
2156
2155
  ),
2157
- children: e ? /* @__PURE__ */ a(Pe, { className: "astw:h-3 astw:w-3", strokeWidth: 2.5 }) : /* @__PURE__ */ a(Ae, { className: "astw:h-3 astw:w-3", strokeWidth: 2.5 })
2156
+ children: e ? /* @__PURE__ */ a(Pe, { className: "astw:h-3 astw:w-3", strokeWidth: 2.5 }) : /* @__PURE__ */ a(Ee, { className: "astw:h-3 astw:w-3", strokeWidth: 2.5 })
2158
2157
  }
2159
2158
  ),
2160
2159
  /* @__PURE__ */ a(ft, { side: "top", children: e ? "Copied!" : "Copy" })
@@ -2475,13 +2474,13 @@ export {
2475
2474
  C as useAppShellConfig,
2476
2475
  Ls as useAppShellData,
2477
2476
  qs as useAuth,
2478
- Qs as useAuthSuspense,
2477
+ Ys as useAuthSuspense,
2479
2478
  ar as useLocation,
2480
2479
  sr as useNavigate,
2481
2480
  Na as usePageMeta,
2482
2481
  rr as useParams,
2483
2482
  nr as useRouteError,
2484
2483
  or as useSearchParams,
2485
- Ye as useTheme,
2486
- Ys as useToast
2484
+ Qe as useTheme,
2485
+ Qs as useToast
2487
2486
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/app-shell",
3
- "version": "0.27.3",
3
+ "version": "0.28.0",
4
4
  "description": "An opinionated React application framework for building ERP applications on Tailor Platform",
5
5
  "keywords": [
6
6
  "app-shell",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@base-ui/react": "^1.2.0",
45
- "@tailor-platform/auth-public-client": "^0.4.1",
45
+ "@tailor-platform/auth-public-client": "^0.5.0",
46
46
  "@tanstack/react-table": "^8.21.3",
47
47
  "change-case": "^5.4.4",
48
48
  "class-variance-authority": "^0.7.1",
@@ -51,7 +51,6 @@
51
51
  "graphql": "^16.13.0",
52
52
  "lucide-react": "^0.562.0",
53
53
  "next-themes": "^0.4.6",
54
- "oauth4webapi": "^3.8.5",
55
54
  "react": "^19.2.4",
56
55
  "react-dom": "^19.2.4",
57
56
  "react-hook-form": "^7.71.2",