@eintrek/erp-shell 0.1.28 → 0.1.29
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/auth/access-denied.d.ts +4 -1
- package/dist/index.esm.js +9 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,10 @@ export interface AccessDeniedProps {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
/** Secondary explanation — pass the page-specific denied reason here. */
|
|
5
5
|
message?: string;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Where "กลับไปหน้าหลัก" navigates. Defaults to the current organization's
|
|
8
|
+
* home (`/{code}`), falling back to "/" outside an org route.
|
|
9
|
+
*/
|
|
7
10
|
homeHref?: string;
|
|
8
11
|
homeLabel?: string;
|
|
9
12
|
/** When set, shows the "ติดต่อฝ่ายสนับสนุน" button (URL or mailto:). */
|
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useSession, signOut } from 'next-auth/react';
|
|
|
5
5
|
import { useQueryClient, MutationCache, QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
6
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
7
7
|
import { cn, Button, Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbSeparator, BreadcrumbPage, Avatar, AvatarImage, AvatarFallback, Collapsible, CollapsibleTrigger, CollapsibleContent, Badge, Skeleton, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, Card, CardHeader, CardContent } from '@eintrek/erp-theme';
|
|
8
|
-
import { PanelLeftClose, Menu, ChevronRight, Building2, ExternalLink, Palette, ChevronUp, Sun, Moon, Monitor, Globe, User, Loader2, LogOut, ChevronDown, ChevronsUpDown, Plus,
|
|
8
|
+
import { PanelLeftClose, Menu, ChevronRight, Building2, ExternalLink, Palette, ChevronUp, Sun, Moon, Monitor, Globe, User, Loader2, LogOut, ChevronDown, ChevronsUpDown, Plus, Ban, Home, Headset } from 'lucide-react';
|
|
9
9
|
import { create } from 'zustand';
|
|
10
10
|
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
11
11
|
import { useRouter, usePathname, useParams } from 'next/navigation';
|
|
@@ -1167,7 +1167,13 @@ function cx(...parts) {
|
|
|
1167
1167
|
* an illustration, a 403 headline, the page-specific reason, and recovery
|
|
1168
1168
|
* actions.
|
|
1169
1169
|
*/
|
|
1170
|
-
function AccessDenied({ title = "ขออภัย, คุณไม่มีสิทธิ์เข้าถึงหน้านี้ (403)", message = "คุณไม่มีสิทธิ์เข้าถึงหน้านี้ ขออภัยในความไม่สะดวก", homeHref
|
|
1170
|
+
function AccessDenied({ title = "ขออภัย, คุณไม่มีสิทธิ์เข้าถึงหน้านี้ (403)", message = "คุณไม่มีสิทธิ์เข้าถึงหน้านี้ ขออภัยในความไม่สะดวก", homeHref, homeLabel = "กลับไปหน้าหลัก", supportHref, supportLabel = "ติดต่อฝ่ายสนับสนุน", fullScreen = true, className, }) {
|
|
1171
|
+
// "/" is not the home page inside an app — it bounces to organization
|
|
1172
|
+
// selection, so the button read "กลับไปหน้าหลัก" and dropped the user into a
|
|
1173
|
+
// picker for the org they were already in. Send them to that org's home.
|
|
1174
|
+
const params = useParams();
|
|
1175
|
+
const code = typeof params?.code === "string" ? params.code : "";
|
|
1176
|
+
const homeTarget = homeHref ?? (code ? `/${code}` : "/");
|
|
1171
1177
|
const go = (href) => {
|
|
1172
1178
|
if (typeof window !== "undefined")
|
|
1173
1179
|
window.location.href = href;
|
|
@@ -1179,7 +1185,7 @@ function AccessDenied({ title = "ขออภัย, คุณไม่มีส
|
|
|
1179
1185
|
]
|
|
1180
1186
|
.filter(Boolean)
|
|
1181
1187
|
.join(" ");
|
|
1182
|
-
return (jsx("div", { className: wrapperClass, children:
|
|
1188
|
+
return (jsx("div", { className: wrapperClass, children: jsx("div", { className: "relative w-full max-w-3xl overflow-hidden rounded-2xl border border-border/60 bg-card/60 p-8 shadow-sm backdrop-blur sm:p-10", children: jsxs("div", { className: "flex flex-col items-center gap-8 text-center sm:flex-row sm:text-left", children: [jsxs("div", { className: "relative shrink-0", children: [jsx("div", { className: "absolute inset-0 rounded-full bg-destructive/20 blur-2xl" }), jsx("div", { className: "relative flex h-28 w-28 items-center justify-center rounded-3xl border border-border/60 bg-gradient-to-br from-muted/40 to-background shadow-inner", children: jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full border border-destructive/40 bg-destructive/10", children: jsx(Ban, { className: "h-8 w-8 text-destructive", strokeWidth: 2.5 }) }) })] }), jsxs("div", { className: "min-w-0 flex-1", children: [jsx("h1", { className: "text-xl font-bold text-foreground sm:text-2xl", children: title }), message ? (jsx("p", { className: "mt-3 whitespace-pre-line text-sm leading-relaxed text-muted-foreground sm:text-base", children: message })) : null, jsxs("div", { className: "mt-6 flex flex-col gap-3 sm:flex-row", children: [jsxs(Button, { type: "button", onClick: () => go(homeTarget), className: "w-full sm:w-auto", children: [jsx(Home, { className: "mr-2 h-4 w-4" }), homeLabel] }), supportHref ? (jsxs(Button, { type: "button", variant: "outline", onClick: () => go(supportHref), className: "w-full sm:w-auto", children: [jsx(Headset, { className: "mr-2 h-4 w-4" }), supportLabel] })) : null] })] })] }) }) }));
|
|
1183
1189
|
}
|
|
1184
1190
|
|
|
1185
1191
|
const shellClassName = "flex min-w-0 flex-1 flex-col gap-6 overflow-x-hidden";
|