@mdxui/auth 1.4.2 → 1.5.1

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/app/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <meta name="color-scheme" content="dark light" />
7
7
  <title>Auth</title>
8
8
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
9
- <script type="module" crossorigin src="/assets/index-C6xHcx9J.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-Dfkrf_Pt.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-DunLT2Gt.css">
11
11
  </head>
12
12
  <body>
package/dist/index.js CHANGED
@@ -192,7 +192,6 @@ function AuthGate({
192
192
  case "allow":
193
193
  return /* @__PURE__ */ jsx3(Fragment, { children });
194
194
  case "landing":
195
- default:
196
195
  return /* @__PURE__ */ jsx3(Fragment, { children: landingComponent ?? /* @__PURE__ */ jsx3(DefaultLandingPage, {}) });
197
196
  }
198
197
  }
@@ -1527,9 +1526,9 @@ var WidgetErrorBoundary = class extends Component {
1527
1526
  }
1528
1527
  };
1529
1528
 
1530
- // src/shell/pages/profile-page.tsx
1529
+ // src/shell/pages/api-keys-page.tsx
1531
1530
  import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1532
- function ProfilePage() {
1531
+ function ApiKeysPage() {
1533
1532
  const { user, getAccessToken, isLoading } = useAuth6();
1534
1533
  if (isLoading) {
1535
1534
  return /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
@@ -1537,24 +1536,24 @@ function ProfilePage() {
1537
1536
  if (!user) {
1538
1537
  return /* @__PURE__ */ jsxs13("div", { className: "container max-w-4xl py-8", children: [
1539
1538
  /* @__PURE__ */ jsxs13("div", { className: "mb-8", children: [
1540
- /* @__PURE__ */ jsx26("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
1541
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "Manage your account information" })
1539
+ /* @__PURE__ */ jsx26("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
1540
+ /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
1542
1541
  ] }),
1543
- /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your profile." }) })
1542
+ /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your API keys." }) })
1544
1543
  ] });
1545
1544
  }
1546
1545
  return /* @__PURE__ */ jsxs13("div", { className: "container max-w-4xl py-8", children: [
1547
1546
  /* @__PURE__ */ jsxs13("div", { className: "mb-8", children: [
1548
- /* @__PURE__ */ jsx26("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
1549
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "Manage your account information" })
1547
+ /* @__PURE__ */ jsx26("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
1548
+ /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
1550
1549
  ] }),
1551
- /* @__PURE__ */ jsx26(WidgetErrorBoundary, { widgetName: "profile", children: /* @__PURE__ */ jsx26(UserProfile, { authToken: getAccessToken }) })
1550
+ /* @__PURE__ */ jsx26(WidgetErrorBoundary, { widgetName: "api-keys", children: /* @__PURE__ */ jsx26(ApiKeys, { authToken: getAccessToken }) })
1552
1551
  ] });
1553
1552
  }
1554
1553
 
1555
- // src/shell/pages/security-page.tsx
1554
+ // src/shell/pages/integrations-page.tsx
1556
1555
  import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1557
- function SecurityPage() {
1556
+ function IntegrationsPage() {
1558
1557
  const { user, getAccessToken, isLoading } = useAuth6();
1559
1558
  if (isLoading) {
1560
1559
  return /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
@@ -1562,24 +1561,24 @@ function SecurityPage() {
1562
1561
  if (!user) {
1563
1562
  return /* @__PURE__ */ jsxs14("div", { className: "container max-w-4xl py-8", children: [
1564
1563
  /* @__PURE__ */ jsxs14("div", { className: "mb-8", children: [
1565
- /* @__PURE__ */ jsx27("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
1566
- /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
1564
+ /* @__PURE__ */ jsx27("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
1565
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
1567
1566
  ] }),
1568
- /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your security settings." }) })
1567
+ /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your integrations." }) })
1569
1568
  ] });
1570
1569
  }
1571
1570
  return /* @__PURE__ */ jsxs14("div", { className: "container max-w-4xl py-8", children: [
1572
1571
  /* @__PURE__ */ jsxs14("div", { className: "mb-8", children: [
1573
- /* @__PURE__ */ jsx27("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
1574
- /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
1572
+ /* @__PURE__ */ jsx27("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
1573
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
1575
1574
  ] }),
1576
- /* @__PURE__ */ jsx27(WidgetErrorBoundary, { widgetName: "security", children: /* @__PURE__ */ jsx27(UserSecurity, { authToken: getAccessToken }) })
1575
+ /* @__PURE__ */ jsx27(WidgetErrorBoundary, { widgetName: "integrations", children: /* @__PURE__ */ jsx27(Pipes, { authToken: getAccessToken }) })
1577
1576
  ] });
1578
1577
  }
1579
1578
 
1580
- // src/shell/pages/sessions-page.tsx
1579
+ // src/shell/pages/profile-page.tsx
1581
1580
  import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
1582
- function SessionsPage() {
1581
+ function ProfilePage() {
1583
1582
  const { user, getAccessToken, isLoading } = useAuth6();
1584
1583
  if (isLoading) {
1585
1584
  return /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
@@ -1587,24 +1586,24 @@ function SessionsPage() {
1587
1586
  if (!user) {
1588
1587
  return /* @__PURE__ */ jsxs15("div", { className: "container max-w-4xl py-8", children: [
1589
1588
  /* @__PURE__ */ jsxs15("div", { className: "mb-8", children: [
1590
- /* @__PURE__ */ jsx28("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
1591
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
1589
+ /* @__PURE__ */ jsx28("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
1590
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground", children: "Manage your account information" })
1592
1591
  ] }),
1593
- /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your sessions." }) })
1592
+ /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your profile." }) })
1594
1593
  ] });
1595
1594
  }
1596
1595
  return /* @__PURE__ */ jsxs15("div", { className: "container max-w-4xl py-8", children: [
1597
1596
  /* @__PURE__ */ jsxs15("div", { className: "mb-8", children: [
1598
- /* @__PURE__ */ jsx28("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
1599
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
1597
+ /* @__PURE__ */ jsx28("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
1598
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground", children: "Manage your account information" })
1600
1599
  ] }),
1601
- /* @__PURE__ */ jsx28(WidgetErrorBoundary, { widgetName: "sessions", children: /* @__PURE__ */ jsx28(UserSessions, { authToken: getAccessToken }) })
1600
+ /* @__PURE__ */ jsx28(WidgetErrorBoundary, { widgetName: "profile", children: /* @__PURE__ */ jsx28(UserProfile, { authToken: getAccessToken }) })
1602
1601
  ] });
1603
1602
  }
1604
1603
 
1605
- // src/shell/pages/api-keys-page.tsx
1604
+ // src/shell/pages/security-page.tsx
1606
1605
  import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
1607
- function ApiKeysPage() {
1606
+ function SecurityPage() {
1608
1607
  const { user, getAccessToken, isLoading } = useAuth6();
1609
1608
  if (isLoading) {
1610
1609
  return /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
@@ -1612,88 +1611,88 @@ function ApiKeysPage() {
1612
1611
  if (!user) {
1613
1612
  return /* @__PURE__ */ jsxs16("div", { className: "container max-w-4xl py-8", children: [
1614
1613
  /* @__PURE__ */ jsxs16("div", { className: "mb-8", children: [
1615
- /* @__PURE__ */ jsx29("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
1616
- /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
1614
+ /* @__PURE__ */ jsx29("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
1615
+ /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
1617
1616
  ] }),
1618
- /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your API keys." }) })
1617
+ /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your security settings." }) })
1619
1618
  ] });
1620
1619
  }
1621
1620
  return /* @__PURE__ */ jsxs16("div", { className: "container max-w-4xl py-8", children: [
1622
1621
  /* @__PURE__ */ jsxs16("div", { className: "mb-8", children: [
1623
- /* @__PURE__ */ jsx29("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
1624
- /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
1622
+ /* @__PURE__ */ jsx29("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
1623
+ /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
1625
1624
  ] }),
1626
- /* @__PURE__ */ jsx29(WidgetErrorBoundary, { widgetName: "api-keys", children: /* @__PURE__ */ jsx29(ApiKeys, { authToken: getAccessToken }) })
1625
+ /* @__PURE__ */ jsx29(WidgetErrorBoundary, { widgetName: "security", children: /* @__PURE__ */ jsx29(UserSecurity, { authToken: getAccessToken }) })
1627
1626
  ] });
1628
1627
  }
1629
1628
 
1630
- // src/shell/pages/team-page.tsx
1629
+ // src/shell/pages/sessions-page.tsx
1631
1630
  import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
1632
- function TeamPage() {
1633
- const { user, getAccessToken, isLoading, organizationId, permissions } = useAuth6();
1634
- const hasOrganization = !!organizationId;
1635
- const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
1631
+ function SessionsPage() {
1632
+ const { user, getAccessToken, isLoading } = useAuth6();
1636
1633
  if (isLoading) {
1637
1634
  return /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
1638
1635
  }
1639
1636
  if (!user) {
1640
1637
  return /* @__PURE__ */ jsxs17("div", { className: "container max-w-4xl py-8", children: [
1641
1638
  /* @__PURE__ */ jsxs17("div", { className: "mb-8", children: [
1642
- /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1643
- /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1644
- ] }),
1645
- /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your team." }) })
1646
- ] });
1647
- }
1648
- if (!hasOrganization) {
1649
- return /* @__PURE__ */ jsxs17("div", { className: "container max-w-4xl py-8", children: [
1650
- /* @__PURE__ */ jsxs17("div", { className: "mb-8", children: [
1651
- /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1652
- /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1653
- ] }),
1654
- /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-sm", children: "You need to be part of an organization to manage team members." }) })
1655
- ] });
1656
- }
1657
- if (!canManageTeam) {
1658
- return /* @__PURE__ */ jsxs17("div", { className: "container max-w-4xl py-8", children: [
1659
- /* @__PURE__ */ jsxs17("div", { className: "mb-8", children: [
1660
- /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1661
- /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1639
+ /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
1640
+ /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
1662
1641
  ] }),
1663
- /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-sm", children: "You need admin permissions to manage team members." }) })
1642
+ /* @__PURE__ */ jsx30("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your sessions." }) })
1664
1643
  ] });
1665
1644
  }
1666
1645
  return /* @__PURE__ */ jsxs17("div", { className: "container max-w-4xl py-8", children: [
1667
1646
  /* @__PURE__ */ jsxs17("div", { className: "mb-8", children: [
1668
- /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1669
- /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1647
+ /* @__PURE__ */ jsx30("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
1648
+ /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
1670
1649
  ] }),
1671
- /* @__PURE__ */ jsx30(WidgetErrorBoundary, { widgetName: "team", children: /* @__PURE__ */ jsx30(UsersManagement, { authToken: getAccessToken }) })
1650
+ /* @__PURE__ */ jsx30(WidgetErrorBoundary, { widgetName: "sessions", children: /* @__PURE__ */ jsx30(UserSessions, { authToken: getAccessToken }) })
1672
1651
  ] });
1673
1652
  }
1674
1653
 
1675
- // src/shell/pages/integrations-page.tsx
1654
+ // src/shell/pages/team-page.tsx
1676
1655
  import { jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
1677
- function IntegrationsPage() {
1678
- const { user, getAccessToken, isLoading } = useAuth6();
1656
+ function TeamPage() {
1657
+ const { user, getAccessToken, isLoading, organizationId, permissions } = useAuth6();
1658
+ const hasOrganization = !!organizationId;
1659
+ const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
1679
1660
  if (isLoading) {
1680
1661
  return /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
1681
1662
  }
1682
1663
  if (!user) {
1683
1664
  return /* @__PURE__ */ jsxs18("div", { className: "container max-w-4xl py-8", children: [
1684
1665
  /* @__PURE__ */ jsxs18("div", { className: "mb-8", children: [
1685
- /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
1686
- /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
1666
+ /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1667
+ /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1668
+ ] }),
1669
+ /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your team." }) })
1670
+ ] });
1671
+ }
1672
+ if (!hasOrganization) {
1673
+ return /* @__PURE__ */ jsxs18("div", { className: "container max-w-4xl py-8", children: [
1674
+ /* @__PURE__ */ jsxs18("div", { className: "mb-8", children: [
1675
+ /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1676
+ /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1687
1677
  ] }),
1688
- /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your integrations." }) })
1678
+ /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground text-sm", children: "You need to be part of an organization to manage team members." }) })
1679
+ ] });
1680
+ }
1681
+ if (!canManageTeam) {
1682
+ return /* @__PURE__ */ jsxs18("div", { className: "container max-w-4xl py-8", children: [
1683
+ /* @__PURE__ */ jsxs18("div", { className: "mb-8", children: [
1684
+ /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1685
+ /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1686
+ ] }),
1687
+ /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground text-sm", children: "You need admin permissions to manage team members." }) })
1689
1688
  ] });
1690
1689
  }
1691
1690
  return /* @__PURE__ */ jsxs18("div", { className: "container max-w-4xl py-8", children: [
1692
1691
  /* @__PURE__ */ jsxs18("div", { className: "mb-8", children: [
1693
- /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
1694
- /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
1692
+ /* @__PURE__ */ jsx31("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
1693
+ /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
1695
1694
  ] }),
1696
- /* @__PURE__ */ jsx31(WidgetErrorBoundary, { widgetName: "integrations", children: /* @__PURE__ */ jsx31(Pipes, { authToken: getAccessToken }) })
1695
+ /* @__PURE__ */ jsx31(WidgetErrorBoundary, { widgetName: "team", children: /* @__PURE__ */ jsx31(UsersManagement, { authToken: getAccessToken }) })
1697
1696
  ] });
1698
1697
  }
1699
1698
 
@@ -1757,7 +1756,9 @@ var adminRoutes = [
1757
1756
  icon: Users,
1758
1757
  component: TeamPage,
1759
1758
  enabled: true,
1760
- public: false
1759
+ public: false,
1760
+ requiresOrganization: true,
1761
+ requiredPermissions: ["widgets:users-table:manage"]
1761
1762
  }
1762
1763
  ];
1763
1764
  var integrationRoutes = [
@@ -1853,6 +1854,7 @@ import {
1853
1854
  import { Toaster } from "@mdxui/primitives/sonner";
1854
1855
 
1855
1856
  // src/shell/auth-shell-nav.tsx
1857
+ import { useMemo as useMemo5 } from "react";
1856
1858
  import { useAuth as useAuth7 } from "@workos-inc/authkit-react";
1857
1859
  import { useIsActive, WebLink as WebLink2 } from "@mdxui/navigation/web";
1858
1860
  import {
@@ -1870,6 +1872,27 @@ import {
1870
1872
  } from "@mdxui/primitives/sidebar";
1871
1873
  import { SidebarUser } from "@mdxui/primitives/sidebar-user";
1872
1874
  import { Fragment as Fragment4, jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
1875
+ function isRouteVisible(route, context) {
1876
+ const { organizationId, permissions = [], role } = context;
1877
+ if (route.requiresOrganization && !organizationId) {
1878
+ return false;
1879
+ }
1880
+ if (route.requiredPermissions && route.requiredPermissions.length > 0) {
1881
+ const hasAllPermissions = route.requiredPermissions.every(
1882
+ (p) => permissions.includes(p)
1883
+ );
1884
+ if (!hasAllPermissions) {
1885
+ return false;
1886
+ }
1887
+ }
1888
+ if (route.requiredRoles && route.requiredRoles.length > 0) {
1889
+ const hasRole = role && route.requiredRoles.includes(role);
1890
+ if (!hasRole) {
1891
+ return false;
1892
+ }
1893
+ }
1894
+ return true;
1895
+ }
1873
1896
  function NavItem({ route, getFullPath }) {
1874
1897
  const fullPath = getFullPath(route.path);
1875
1898
  const isActive = useIsActive(fullPath, { partial: fullPath !== "/" });
@@ -1911,10 +1934,26 @@ function DefaultUserMenu() {
1911
1934
  function AuthShellNav({ headerContent, userMenu, className }) {
1912
1935
  const { routesByGroup, groups } = useAuthShellRoutesByGroup();
1913
1936
  const getFullPath = useAuthShellFullPath();
1937
+ const { organizationId, permissions, role } = useAuth7();
1938
+ const filteredRoutesByGroup = useMemo5(() => {
1939
+ const context = {
1940
+ organizationId: organizationId ?? void 0,
1941
+ permissions: permissions ?? void 0,
1942
+ role: role ?? void 0
1943
+ };
1944
+ const filtered = /* @__PURE__ */ new Map();
1945
+ for (const [groupId, routes] of routesByGroup) {
1946
+ const visibleRoutes = routes.filter((route) => isRouteVisible(route, context));
1947
+ if (visibleRoutes.length > 0) {
1948
+ filtered.set(groupId, visibleRoutes);
1949
+ }
1950
+ }
1951
+ return filtered;
1952
+ }, [routesByGroup, organizationId, permissions, role]);
1914
1953
  return /* @__PURE__ */ jsxs19(Sidebar, { collapsible: "icon", className, children: [
1915
1954
  /* @__PURE__ */ jsx33(SidebarHeader, { children: /* @__PURE__ */ jsx33(BrandingHeader, { headerContent }) }),
1916
1955
  /* @__PURE__ */ jsx33(SidebarContent, { children: groups.map((group) => {
1917
- const routes = routesByGroup.get(group.id);
1956
+ const routes = filteredRoutesByGroup.get(group.id);
1918
1957
  if (!routes || routes.length === 0) return null;
1919
1958
  return /* @__PURE__ */ jsxs19(SidebarGroup, { children: [
1920
1959
  group.label && /* @__PURE__ */ jsx33(SidebarGroupLabel, { children: group.label }),
@@ -1971,9 +2010,9 @@ function AuthShell({
1971
2010
  }
1972
2011
 
1973
2012
  // src/shell/auth-app.tsx
1974
- import { useMemo as useMemo5 } from "react";
1975
- import { ThemeProvider } from "next-themes";
1976
2013
  import { createWebRouter, RouterProvider, WebOutlet } from "@mdxui/navigation/web";
2014
+ import { ThemeProvider } from "next-themes";
2015
+ import { useMemo as useMemo6 } from "react";
1977
2016
 
1978
2017
  // src/shell/env-config.ts
1979
2018
  function getEnvVar(key) {
@@ -2046,7 +2085,7 @@ function mergeWithEnvConfig(config) {
2046
2085
  // src/shell/auth-app.tsx
2047
2086
  import { jsx as jsx35 } from "react/jsx-runtime";
2048
2087
  function AuthAppProvider({ config, children }) {
2049
- const resolvedConfig = useMemo5(() => mergeWithEnvConfig(config), [config]);
2088
+ const resolvedConfig = useMemo6(() => mergeWithEnvConfig(config), [config]);
2050
2089
  const { identity, theme } = resolvedConfig;
2051
2090
  return /* @__PURE__ */ jsx35(
2052
2091
  ThemeProvider,
@@ -2095,14 +2134,14 @@ function createRootLayout(headerContent, sidebarHeaderContent) {
2095
2134
  };
2096
2135
  }
2097
2136
  function AuthApp({ config, headerContent, sidebarHeaderContent }) {
2098
- const mergedConfig = useMemo5(() => mergeWithEnvConfig(config), [config]);
2137
+ const mergedConfig = useMemo6(() => mergeWithEnvConfig(config), [config]);
2099
2138
  const routes = mergedConfig.routes ?? defaultRoutes;
2100
2139
  const groups = mergedConfig.groups ?? defaultGroups;
2101
- const resolvedConfig = useMemo5(
2140
+ const resolvedConfig = useMemo6(
2102
2141
  () => ({ ...mergedConfig, routes, groups }),
2103
2142
  [mergedConfig, routes, groups]
2104
2143
  );
2105
- const router = useMemo5(() => {
2144
+ const router = useMemo6(() => {
2106
2145
  const routeConfig = convertRoutesToConfig(routes, mergedConfig.basePath);
2107
2146
  const RootLayout = createRootLayout(headerContent, sidebarHeaderContent);
2108
2147
  return createWebRouter(routeConfig, {
@@ -2118,10 +2157,10 @@ function AuthAppWithChildren({
2118
2157
  sidebarHeaderContent,
2119
2158
  children
2120
2159
  }) {
2121
- const mergedConfig = useMemo5(() => mergeWithEnvConfig(config), [config]);
2160
+ const mergedConfig = useMemo6(() => mergeWithEnvConfig(config), [config]);
2122
2161
  const routes = mergedConfig.routes ?? defaultRoutes;
2123
2162
  const groups = mergedConfig.groups ?? defaultGroups;
2124
- const resolvedConfig = useMemo5(
2163
+ const resolvedConfig = useMemo6(
2125
2164
  () => ({ ...mergedConfig, routes, groups }),
2126
2165
  [mergedConfig, routes, groups]
2127
2166
  );