@eintrek/erp-shell 0.1.61 → 0.1.62
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.d.ts +1 -0
- package/dist/index.esm.js +40 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/dist/navigation/nav-user.d.ts +4 -1
- package/dist/navigation/platform-url.d.ts +23 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { NavUser, type NavUserProps, type NavUserSystemLink } from "./navigation
|
|
|
17
17
|
export { useMyRoles, myRolesQueryKey } from "./navigation/use-my-roles";
|
|
18
18
|
export { parseMyRoles, roleSummary, OWNER_CHIP, type MyRole, type MyRoles, } from "./navigation/my-roles";
|
|
19
19
|
export { buildSystemLinks, type BuildSystemLinksOptions, type ErpAppId, } from "./navigation/app-registry";
|
|
20
|
+
export { accountSettingsHref, platformBaseUrl, type AccountSettingsHrefOptions, } from "./navigation/platform-url";
|
|
20
21
|
export { PLAN_FEATURES, hasPlanFeature, type PlanFeatureKey, } from "./lib/plan-features";
|
|
21
22
|
export { NavMain, type NavMainProps } from "./navigation/nav-main";
|
|
22
23
|
export { OrganizationSwitcher, type OrganizationSwitcherProps, type OrganizationLike, } from "./navigation/organization-switcher";
|
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useSession, signOut } from 'next-auth/react';
|
|
|
5
5
|
import { useQueryClient, useQuery, QueryClientContext, QueryClient, hashKey, MutationCache, QueryCache, QueryClientProvider } from '@tanstack/react-query';
|
|
6
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
7
7
|
import { cn, Button, Tooltip, TooltipTrigger, TooltipContent, Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbSeparator, BreadcrumbPage, Avatar, AvatarImage, AvatarFallback, Collapsible, CollapsibleTrigger, CollapsibleContent, Badge, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, Skeleton, Dialog, DialogContent, DialogHeader, DialogTitle, Label, Textarea, DialogFooter, Card, CardHeader, CardContent } from '@eintrek/erp-theme';
|
|
8
|
-
import { PanelLeftClose, Menu, ChevronRight, Building2, Palette, ChevronUp, Sun, Moon, Monitor, Globe,
|
|
8
|
+
import { PanelLeftClose, Menu, ChevronRight, Building2, Palette, ChevronUp, Sun, Moon, Monitor, Globe, UserCog, LayoutGrid, ExternalLink, CircleHelp, Loader2, LogOut, Calculator, Warehouse, FolderKanban, Users, Store, Headset, ChevronDown, Plus, ChevronsUpDown, ImagePlus, X, CircleCheck, ArrowLeft, Ban, Home, ArrowRight, Compass, ArrowUpRight, ContactRound, UserPlus } 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';
|
|
@@ -1713,7 +1713,7 @@ function platformApiBase(app) {
|
|
|
1713
1713
|
* This package's version, attached to help messages so the back office can
|
|
1714
1714
|
* tell which shell a report came from. Keep in step with package.json.
|
|
1715
1715
|
*/
|
|
1716
|
-
const SHELL_VERSION = "0.1.
|
|
1716
|
+
const SHELL_VERSION = "0.1.62";
|
|
1717
1717
|
|
|
1718
1718
|
const HELP_APP_LABEL = {
|
|
1719
1719
|
platform: "แพลตฟอร์ม",
|
|
@@ -2056,8 +2056,15 @@ function NavUser({ organization, avatarSrc, profileHref, selectOrganizationHref
|
|
|
2056
2056
|
};
|
|
2057
2057
|
const handleProfile = () => {
|
|
2058
2058
|
setIsOpen(false);
|
|
2059
|
-
if (profileHref)
|
|
2060
|
-
|
|
2059
|
+
if (!profileHref)
|
|
2060
|
+
return;
|
|
2061
|
+
// Account settings live on Platform, so from any other app this is a
|
|
2062
|
+
// full page load, the same as the apps menu.
|
|
2063
|
+
if (isExternalHref(profileHref)) {
|
|
2064
|
+
window.location.assign(profileHref);
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
router.push(profileHref);
|
|
2061
2068
|
};
|
|
2062
2069
|
const handleSystemLink = (href) => {
|
|
2063
2070
|
setIsOpen(false);
|
|
@@ -2124,7 +2131,7 @@ function NavUser({ organization, avatarSrc, profileHref, selectOrganizationHref
|
|
|
2124
2131
|
{ code: "en", label: "English" },
|
|
2125
2132
|
{ code: "zh", label: "中文" },
|
|
2126
2133
|
{ code: "ja", label: "日本語" },
|
|
2127
|
-
].map(({ code, label }) => (jsxs("button", { onClick: () => handleLanguageChange(code), className: "flex w-full items-center gap-3 px-3 py-2 text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-md transition-colors", children: [jsx("span", { className: "flex-1 text-left", children: label }), organization?.language === code && (jsx("div", { className: "h-2 w-2 rounded-full bg-primary" }))] }, code))) }))] })), profileHref && (jsxs("button", { onClick: handleProfile, className: "flex w-full items-center gap-3 px-3 py-2.5 text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-md transition-colors", children: [jsx(
|
|
2134
|
+
].map(({ code, label }) => (jsxs("button", { onClick: () => handleLanguageChange(code), className: "flex w-full items-center gap-3 px-3 py-2 text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-md transition-colors", children: [jsx("span", { className: "flex-1 text-left", children: label }), organization?.language === code && (jsx("div", { className: "h-2 w-2 rounded-full bg-primary" }))] }, code))) }))] })), profileHref && (jsxs("button", { onClick: handleProfile, className: "flex w-full items-center gap-3 px-3 py-2.5 text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-md transition-colors", children: [jsx(UserCog, { className: "h-4 w-4" }), jsx("span", { className: "flex-1 text-left", children: "\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E1A\u0E31\u0E0D\u0E0A\u0E35" })] })), showSelectOrganization && (jsxs("button", { onClick: handleSelectOrganization, className: "flex w-full items-center gap-3 px-3 py-2.5 text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-md transition-colors", children: [jsx(Building2, { className: "h-4 w-4" }), jsx("span", { className: "flex-1 text-left", children: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08" })] })), visibleSystemLinks.length > 0 && (jsxs("div", { className: "relative", children: [jsxs("button", { onClick: () => {
|
|
2128
2135
|
setShowAppsMenu(!showAppsMenu);
|
|
2129
2136
|
setShowThemeMenu(false);
|
|
2130
2137
|
setShowLanguageMenu(false);
|
|
@@ -2204,6 +2211,32 @@ function hasPlanFeature(features, feature) {
|
|
|
2204
2211
|
return false;
|
|
2205
2212
|
}
|
|
2206
2213
|
|
|
2214
|
+
/**
|
|
2215
|
+
* Where Platform lives, and the pages every app sends people to on it.
|
|
2216
|
+
*
|
|
2217
|
+
* Personal settings — profile, password, signature, LINE — exist once, on
|
|
2218
|
+
* Platform. Every other app links there instead of keeping its own copy.
|
|
2219
|
+
*
|
|
2220
|
+
* Plain .ts (no JSX) so node --test can import it; app-registry.tsx reads the
|
|
2221
|
+
* base from here too, so the app switcher and the account link never disagree.
|
|
2222
|
+
*/
|
|
2223
|
+
const DEFAULT_PLATFORM_URL = "https://platform.antniti.com";
|
|
2224
|
+
/** Read per call: Next inlines NEXT_PUBLIC_* at the consuming app's build. */
|
|
2225
|
+
function platformBaseUrl() {
|
|
2226
|
+
return (process.env.NEXT_PUBLIC_PLATFORM_URL || DEFAULT_PLATFORM_URL).replace(/\/+$/, "");
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* ตั้งค่าบัญชี for an organisation: `/{code}/account/settings` on Platform.
|
|
2230
|
+
* Undefined without an organisation code — there is no page to open then.
|
|
2231
|
+
*/
|
|
2232
|
+
function accountSettingsHref(orgCode, { activeApp } = {}) {
|
|
2233
|
+
const code = orgCode?.trim();
|
|
2234
|
+
if (!code)
|
|
2235
|
+
return undefined;
|
|
2236
|
+
const path = `/${encodeURIComponent(code)}/account/settings`;
|
|
2237
|
+
return activeApp === "platform" ? path : `${platformBaseUrl()}${path}`;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2207
2240
|
function normaliseBase(value, fallback) {
|
|
2208
2241
|
return (value ?? fallback).replace(/\/$/, "");
|
|
2209
2242
|
}
|
|
@@ -2220,7 +2253,7 @@ const APPS = [
|
|
|
2220
2253
|
label: "แพลตฟอร์ม",
|
|
2221
2254
|
icon: jsx(Building2, { className: "h-4 w-4 shrink-0" }),
|
|
2222
2255
|
features: null,
|
|
2223
|
-
baseUrl:
|
|
2256
|
+
baseUrl: platformBaseUrl,
|
|
2224
2257
|
},
|
|
2225
2258
|
{
|
|
2226
2259
|
id: "accounx",
|
|
@@ -4266,5 +4299,5 @@ const getAxiosErrorMessage = (error) => {
|
|
|
4266
4299
|
return String(error);
|
|
4267
4300
|
};
|
|
4268
4301
|
|
|
4269
|
-
export { AccessDenied, ApiError, AppBreadcrumb, AppLayoutShell, AppSidebar, EMPLOYEE_RECORD_OK_EVENT, EMPLOYEE_RECORD_REQUIRED, EMPLOYEE_RECORD_REQUIRED_EVENT, EmployeeRequiredGate, FOR_ORGANIZATION_FIELD, FeatureFlagsProvider, HeaderBackground, HelpButton, HelpDialogHost, NavMain, NavTools, NavUser, OWNER_CHIP, OrganizationSwitcher, PLAN_FEATURES, PermissionGateShell, PermissionProvider, PermissionRulesProvider, ReactQueryProvider, SHELL_VERSION, SessionBackedProfileCacheSeeder, SessionRefreshTrigger, SidebarContent, SidebarFooter, SidebarHeader, SidebarHelpCard, SidebarHelpLink, SidebarProvider, SidebarTrigger, TapMenu, ThemeProvider, WITHOUT_ORGANIZATION_FLAG, WORKSPACE_HEADER_VARS, WORKSPACE_LIGHT_HEADER_VARS, WorkspaceBrand, instance as axiosInstance, buildSystemLinks, buildUrlWithCode, canAccessNavPermissionRoute, clearAccessTokenCache, clearOrganizationId, clearStoredOrganization, closeHelp, decodeJWT, describeAttached, describeBrowser, detectHelpApp, filterNavigationModulesByPermission, filterNavigationToolsByPermission, findOrganizationForCode, getAccessToken, getActiveModule, getActiveSubModule, getAxiosErrorMessage, getOrganizationId, getQueryClientConfig, getRequestOrganizationId, getRequiredChildGroups, getStoredOrganizationIds, getTabOrganizationId, hasPlanFeature, isKnownStaleOrganizationId, isLikelyTransientNetworkError, isPathActive, myRolesQueryKey, normalizePathnameForPermissionRules, openHelp, organizationScopedQueryHash, parseMyRoles, resolveActiveNav, resolveSidebarNav, resolveStaleOrganization, resolveUiRoutePermission, resolveUrlOrgGate, retryWithStoredOrganizations, roleSummary, runGlobalRequestPrecheck, runWithTransientRetry, setKnownOrganizationIds, setOrganizationId, setTabOrganizationId, shouldRetryQuery, toApiError, unwrapApiResponse, updateOrganizationId, useClearOrgOnUserChange, useFeatureFlag, useFeatureFlags, useInvalidateQueriesOnOrgChange, useKeycloakRoles, useMyRoles, useOrganizationIdState, usePermissionRules, useSessionRefresh, useSidebar, useSidebarToggle, withoutOrganization };
|
|
4302
|
+
export { AccessDenied, ApiError, AppBreadcrumb, AppLayoutShell, AppSidebar, EMPLOYEE_RECORD_OK_EVENT, EMPLOYEE_RECORD_REQUIRED, EMPLOYEE_RECORD_REQUIRED_EVENT, EmployeeRequiredGate, FOR_ORGANIZATION_FIELD, FeatureFlagsProvider, HeaderBackground, HelpButton, HelpDialogHost, NavMain, NavTools, NavUser, OWNER_CHIP, OrganizationSwitcher, PLAN_FEATURES, PermissionGateShell, PermissionProvider, PermissionRulesProvider, ReactQueryProvider, SHELL_VERSION, SessionBackedProfileCacheSeeder, SessionRefreshTrigger, SidebarContent, SidebarFooter, SidebarHeader, SidebarHelpCard, SidebarHelpLink, SidebarProvider, SidebarTrigger, TapMenu, ThemeProvider, WITHOUT_ORGANIZATION_FLAG, WORKSPACE_HEADER_VARS, WORKSPACE_LIGHT_HEADER_VARS, WorkspaceBrand, accountSettingsHref, instance as axiosInstance, buildSystemLinks, buildUrlWithCode, canAccessNavPermissionRoute, clearAccessTokenCache, clearOrganizationId, clearStoredOrganization, closeHelp, decodeJWT, describeAttached, describeBrowser, detectHelpApp, filterNavigationModulesByPermission, filterNavigationToolsByPermission, findOrganizationForCode, getAccessToken, getActiveModule, getActiveSubModule, getAxiosErrorMessage, getOrganizationId, getQueryClientConfig, getRequestOrganizationId, getRequiredChildGroups, getStoredOrganizationIds, getTabOrganizationId, hasPlanFeature, isKnownStaleOrganizationId, isLikelyTransientNetworkError, isPathActive, myRolesQueryKey, normalizePathnameForPermissionRules, openHelp, organizationScopedQueryHash, parseMyRoles, platformBaseUrl, resolveActiveNav, resolveSidebarNav, resolveStaleOrganization, resolveUiRoutePermission, resolveUrlOrgGate, retryWithStoredOrganizations, roleSummary, runGlobalRequestPrecheck, runWithTransientRetry, setKnownOrganizationIds, setOrganizationId, setTabOrganizationId, shouldRetryQuery, toApiError, unwrapApiResponse, updateOrganizationId, useClearOrgOnUserChange, useFeatureFlag, useFeatureFlags, useInvalidateQueriesOnOrgChange, useKeycloakRoles, useMyRoles, useOrganizationIdState, usePermissionRules, useSessionRefresh, useSidebar, useSidebarToggle, withoutOrganization };
|
|
4270
4303
|
//# sourceMappingURL=index.esm.js.map
|