@eintrek/erp-shell 0.1.73 → 0.1.75
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/README.md +63 -0
- package/dist/chunks/{guide-runtime-CLVSNkTN.cjs → format-CVazK0hP.cjs} +1371 -59
- package/dist/chunks/format-CVazK0hP.cjs.map +1 -0
- package/dist/chunks/{guide-runtime-C7Z00QwM.esm.js → format-DCTuLpBU.esm.js} +1360 -61
- package/dist/chunks/format-DCTuLpBU.esm.js.map +1 -0
- package/dist/guide/core.d.ts +5 -3
- package/dist/guide/format.d.ts +26 -0
- package/dist/guide/guide-store.d.ts +72 -6
- package/dist/guide/guide-styles.d.ts +1 -1
- package/dist/guide/guide-ui.d.ts +38 -0
- package/dist/guide/machine.d.ts +139 -3
- package/dist/guide/pages.d.ts +79 -0
- package/dist/guide/progress-sync.d.ts +10 -1
- package/dist/guide/progress.d.ts +27 -0
- package/dist/guide/section-button.d.ts +12 -0
- package/dist/guide/types.d.ts +111 -0
- package/dist/guide-core.cjs +32 -19
- package/dist/guide-core.cjs.map +1 -1
- package/dist/guide-core.esm.js +1 -1
- package/dist/help/help-button.d.ts +6 -3
- package/dist/index.cjs +56 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.esm.js +22 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/guide-runtime-C7Z00QwM.esm.js.map +0 -1
- package/dist/chunks/guide-runtime-CLVSNkTN.cjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,12 +33,15 @@ export { HelpDialogHost, type HelpDialogHostProps } from "./help/help-dialog";
|
|
|
33
33
|
export { openHelp, closeHelp, type HelpAppId } from "./help/help-store";
|
|
34
34
|
export { describeBrowser, describeAttached, detectHelpApp, type HelpContext, } from "./help/help-context";
|
|
35
35
|
export { SHELL_VERSION } from "./version";
|
|
36
|
-
export type { GuideAbortAction, GuideAnchorKey, GuideApiFailure, GuideApiMatch, GuideAppId, GuideCaptureEvent, GuideConfig, GuideContext, GuideFacts, GuideGate, GuideMission, GuideNothingToSave, GuideOnMissing, GuideStep, GuideStepKind, GuideSuite, GuideText, GuideTrigger, } from "./guide/types";
|
|
36
|
+
export type { GuideAbortAction, GuideAnchorKey, GuideApiFailure, GuideApiMatch, GuideAppId, GuideCaptureEvent, GuideConfig, GuideContext, GuideFacts, GuideGate, GuideMission, GuideNothingToSave, GuideOnMissing, GuidePage, GuideSection, GuideStep, GuideStepKind, GuideSuite, GuideText, GuideTrigger, } from "./guide/types";
|
|
37
37
|
export { API_EVENT as GUIDE_API_EVENT, GUIDE_EVENT_PREFIX, GUIDE_LAYER_ATTRIBUTE, emitGuideEvent, guideAnchor, reportApiCall, reportApiEvent, type ApiCallReport, type ApiEventDetail, type GuideAnchorProps, } from "./guide/events";
|
|
38
|
-
export { guideMenuShown, openGuidePanel, useGuideEntry, type GuideEntry } from "./guide/guide-store";
|
|
38
|
+
export { guideMenuItems, guideMenuShown, openGuidePanel, openPageGuide, openPagesPanel, openSectionGuide, setSectionGuideValues, useGuideEntry, usePageGuideEntry, usePageGuides, useSectionGuideValues, type GuideEntry, type GuideMenuItem, type PageGuidesEntry, } from "./guide/guide-store";
|
|
39
|
+
export { SectionGuideButton, type SectionGuideButtonProps } from "./guide/section-button";
|
|
40
|
+
export { THAI_MONTHS_SHORT, formatBaht, thaiMonth, thaiMonthYear } from "./guide/format";
|
|
39
41
|
export { GuideHost, type GuideHostProps } from "./guide/guide-host";
|
|
40
42
|
export { GuideRuntime, type GuideMenu, type GuideRouting, type GuideRuntimeProps, } from "./guide/guide-runtime";
|
|
41
43
|
export { GuideProgressConflict, type GuideProgressAdapter, type GuideProgressRequest, type GuideProgressResponse, } from "./guide/progress-sync";
|
|
44
|
+
export type { GuideAudience, GuideMode, PagesMode } from "./guide/progress";
|
|
42
45
|
export { AccessDenied, type AccessDeniedProps } from "./auth/access-denied";
|
|
43
46
|
export { EmployeeRequiredGate, EMPLOYEE_RECORD_REQUIRED, EMPLOYEE_RECORD_REQUIRED_EVENT, EMPLOYEE_RECORD_OK_EVENT, } from "./auth/employee-required-gate";
|
|
44
47
|
export { PermissionGateShell, type PermissionGateShellProps, type PermissionGateSkeletonVariant, } from "./auth/permission-gate-shell";
|
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, UserCog, LayoutGrid, ExternalLink, CircleHelp, Loader2, LogOut, Calculator, Warehouse, FolderKanban, Users, Store, Headset, ChevronDown, Plus, ChevronsUpDown, Flag, MessageCircle, ImagePlus, X, CircleCheck, ArrowLeft, Ban, Home, ContactRound, UserPlus, ArrowRight, Compass, ArrowUpRight } from 'lucide-react';
|
|
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, BookOpen, Info, Flag, Library, MessageCircle, ImagePlus, X, CircleCheck, ArrowLeft, Ban, Home, ContactRound, UserPlus, ArrowRight, Compass, ArrowUpRight } from 'lucide-react';
|
|
9
9
|
import { create } from 'zustand';
|
|
10
10
|
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
11
11
|
import { useRouter, usePathname, useParams, useSearchParams } from 'next/navigation';
|
|
@@ -14,8 +14,8 @@ import { createPortal } from 'react-dom';
|
|
|
14
14
|
import { useTheme, ThemeProvider as ThemeProvider$1 } from 'next-themes';
|
|
15
15
|
import axios, { isAxiosError, AxiosHeaders } from 'axios';
|
|
16
16
|
export { isAxiosError } from 'axios';
|
|
17
|
-
import {
|
|
18
|
-
export { A as GUIDE_API_EVENT, G as GUIDE_EVENT_PREFIX, a as GUIDE_LAYER_ATTRIBUTE, c as GuideProgressConflict, f as emitGuideEvent,
|
|
17
|
+
import { t as reportApiEvent, i as guideAnchor, y as useGuideEntry, B as usePageGuides, j as guideMenuItems, p as openPageGuide, r as openSectionGuide, o as openGuidePanel, q as openPagesPanel, b as GuideErrorBoundary, d as GuideRuntime } from './chunks/format-DCTuLpBU.esm.js';
|
|
18
|
+
export { A as GUIDE_API_EVENT, G as GUIDE_EVENT_PREFIX, a as GUIDE_LAYER_ATTRIBUTE, c as GuideProgressConflict, S as SectionGuideButton, T as THAI_MONTHS_SHORT, f as emitGuideEvent, h as formatBaht, k as guideMenuShown, s as reportApiCall, u as setSectionGuideValues, w as thaiMonth, x as thaiMonthYear, z as usePageGuideEntry, C as useSectionGuideValues } from './chunks/format-DCTuLpBU.esm.js';
|
|
19
19
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
20
20
|
import '@floating-ui/dom';
|
|
21
21
|
|
|
@@ -1722,7 +1722,7 @@ function platformApiBase(app) {
|
|
|
1722
1722
|
* This package's version, attached to help messages so the back office can
|
|
1723
1723
|
* tell which shell a report came from. Keep in step with package.json.
|
|
1724
1724
|
*/
|
|
1725
|
-
const SHELL_VERSION = "0.1.
|
|
1725
|
+
const SHELL_VERSION = "0.1.75";
|
|
1726
1726
|
|
|
1727
1727
|
const HELP_APP_LABEL = {
|
|
1728
1728
|
platform: "แพลตฟอร์ม",
|
|
@@ -2554,15 +2554,25 @@ const BUTTON_CLASS = "grid size-[34px] shrink-0 place-items-center rounded-lg te
|
|
|
2554
2554
|
* The ช่วยเหลือ button in the top bar. Drawn in the header's ink (the
|
|
2555
2555
|
* --header-* variables of the workspace chrome, white on the brand chrome).
|
|
2556
2556
|
*
|
|
2557
|
-
* When this user has
|
|
2558
|
-
* "
|
|
2559
|
-
*
|
|
2557
|
+
* When this user has something to open here, it opens a small menu:
|
|
2558
|
+
* "คู่มือหน้านี้" (this page's guide), "อธิบายส่วนนี้ · <title>" for each
|
|
2559
|
+
* section guide on screen, "ไกด์เริ่มต้น n/N" (the quest
|
|
2560
|
+
* panel), "คู่มือทุกหน้า" (the panel's page guides) and "ติดต่อทีมช่วยเหลือ"
|
|
2561
|
+
* (the help dialog), each only when it has something. Otherwise one press
|
|
2562
|
+
* opens the help dialog, as before.
|
|
2560
2563
|
*/
|
|
2561
2564
|
function HelpButton({ className }) {
|
|
2562
2565
|
const guide = useGuideEntry();
|
|
2566
|
+
const pages = usePageGuides();
|
|
2563
2567
|
const toGuide = useRef(false);
|
|
2564
2568
|
const cls = BUTTON_CLASS + (className ? ` ${className}` : "");
|
|
2565
|
-
|
|
2569
|
+
const items = guideMenuItems(guide, pages);
|
|
2570
|
+
// The tour takes focus (a step, the panel); the button must not take it back.
|
|
2571
|
+
const toTour = (open) => () => {
|
|
2572
|
+
toGuide.current = true;
|
|
2573
|
+
setTimeout(open, 0);
|
|
2574
|
+
};
|
|
2575
|
+
if (!items.length) {
|
|
2566
2576
|
return (jsx("button", { type: "button", onClick: openHelp, "aria-label": "\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D", title: "\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D", className: cls, "data-guide": "shell.help", children: jsx(CircleHelp, { className: "size-5", strokeWidth: 1.65 }) }));
|
|
2567
2577
|
}
|
|
2568
2578
|
return (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx("button", { type: "button", "aria-label": "\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D", title: "\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D", className: cls, "data-guide": "shell.help", children: jsx(CircleHelp, { className: "size-5", strokeWidth: 1.65 }) }) }), jsxs(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-64", onCloseAutoFocus: e => {
|
|
@@ -2571,10 +2581,9 @@ function HelpButton({ className }) {
|
|
|
2571
2581
|
e.preventDefault();
|
|
2572
2582
|
toGuide.current = false;
|
|
2573
2583
|
}
|
|
2574
|
-
}, children: [jsxs(DropdownMenuItem, { onSelect: ()
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
}, className: "gap-2.5", children: [jsx(Flag, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E44\u0E01\u0E14\u0E4C\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19" }), jsxs("span", { className: "text-xs font-semibold text-primary tabular-nums", children: [guide.done, "/", guide.total] })] }), jsxs(DropdownMenuItem, { onSelect: () => setTimeout(openHelp, 0), className: "gap-2.5", children: [jsx(MessageCircle, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D\u0E17\u0E35\u0E21\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D" })] })] })] }));
|
|
2584
|
+
}, children: [items.includes("page") ? (jsxs(DropdownMenuItem, { onSelect: toTour(openPageGuide), className: "gap-2.5", children: [jsx(BookOpen, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E04\u0E39\u0E48\u0E21\u0E37\u0E2D\u0E2B\u0E19\u0E49\u0E32\u0E19\u0E35\u0E49" })] })) : null, items.includes("sections")
|
|
2585
|
+
? (pages.sections ?? []).map(sec => (jsxs(DropdownMenuItem, { onSelect: toTour(() => openSectionGuide(sec.key)), className: "gap-2.5", children: [jsx(Info, { className: "size-4" }), jsxs("span", { className: "flex-1", children: ["\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E2A\u0E48\u0E27\u0E19\u0E19\u0E35\u0E49 \u00B7 ", sec.title] })] }, sec.key)))
|
|
2586
|
+
: null, items.includes("missions") && guide ? (jsxs(DropdownMenuItem, { onSelect: toTour(openGuidePanel), className: "gap-2.5", children: [jsx(Flag, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E44\u0E01\u0E14\u0E4C\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19" }), jsxs("span", { className: "text-xs font-semibold text-primary tabular-nums", children: [guide.done, "/", guide.total] })] })) : null, items.includes("pages") ? (jsxs(DropdownMenuItem, { onSelect: toTour(openPagesPanel), className: "gap-2.5", children: [jsx(Library, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E04\u0E39\u0E48\u0E21\u0E37\u0E2D\u0E17\u0E38\u0E01\u0E2B\u0E19\u0E49\u0E32" })] })) : null, jsxs(DropdownMenuItem, { onSelect: () => setTimeout(openHelp, 0), className: "gap-2.5", children: [jsx(MessageCircle, { className: "size-4" }), jsx("span", { className: "flex-1", children: "\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D\u0E17\u0E35\u0E21\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D" })] })] })] }));
|
|
2578
2587
|
}
|
|
2579
2588
|
|
|
2580
2589
|
const hasPaginationShape = (payload) => {
|
|
@@ -4414,5 +4423,5 @@ const getAxiosErrorMessage = (error) => {
|
|
|
4414
4423
|
return String(error);
|
|
4415
4424
|
};
|
|
4416
4425
|
|
|
4417
|
-
export { AccessDenied, ApiError, AppBreadcrumb, AppLayoutShell, AppSidebar, EMPLOYEE_RECORD_OK_EVENT, EMPLOYEE_RECORD_REQUIRED, EMPLOYEE_RECORD_REQUIRED_EVENT, EmployeeRequiredGate, FOR_ORGANIZATION_FIELD, FeatureFlagsProvider, GuideHost, GuideRuntime, 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, guideAnchor,
|
|
4426
|
+
export { AccessDenied, ApiError, AppBreadcrumb, AppLayoutShell, AppSidebar, EMPLOYEE_RECORD_OK_EVENT, EMPLOYEE_RECORD_REQUIRED, EMPLOYEE_RECORD_REQUIRED_EVENT, EmployeeRequiredGate, FOR_ORGANIZATION_FIELD, FeatureFlagsProvider, GuideHost, GuideRuntime, 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, guideAnchor, guideMenuItems, hasPlanFeature, isKnownStaleOrganizationId, isLikelyTransientNetworkError, isPathActive, myRolesQueryKey, normalizePathnameForPermissionRules, openGuidePanel, openHelp, openPageGuide, openPagesPanel, openSectionGuide, organizationScopedQueryHash, parseMyRoles, platformBaseUrl, reportApiEvent, resolveActiveNav, resolveSidebarNav, resolveStaleOrganization, resolveUiRoutePermission, resolveUrlOrgGate, retryWithStoredOrganizations, roleSummary, runGlobalRequestPrecheck, runWithTransientRetry, setKnownOrganizationIds, setOrganizationId, setTabOrganizationId, shouldRetryQuery, toApiError, unwrapApiResponse, updateOrganizationId, useClearOrgOnUserChange, useFeatureFlag, useFeatureFlags, useGuideEntry, useInvalidateQueriesOnOrgChange, useKeycloakRoles, useMyRoles, useOrganizationIdState, usePageGuides, usePermissionRules, useSessionRefresh, useSidebar, useSidebarToggle, withoutOrganization };
|
|
4418
4427
|
//# sourceMappingURL=index.esm.js.map
|