@eintrek/erp-shell 0.1.57 → 0.1.59

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.
@@ -19,6 +19,10 @@ export declare const PLAN_FEATURES: {
19
19
  readonly MODULE_INVENTORY: "module.inventory";
20
20
  readonly MODULE_PROJECT: "module.project";
21
21
  readonly MODULE_SECRETARIAT: "module.secretariat";
22
+ /** Sellx add-on: POS, members and chat commerce. */
23
+ readonly MODULE_SELLX: "module.sellx";
24
+ /** Carex add-on: help desk, SLA and knowledge base. */
25
+ readonly MODULE_CAREX: "module.carex";
22
26
  /** AI pack (paid or trial): AI calls on AntNiti's key while credits remain. */
23
27
  readonly AI: "ai";
24
28
  };
@@ -1,6 +1,6 @@
1
1
  import type { NavUserSystemLink } from "./nav-user";
2
2
  /** The apps a signed-in user can jump between from the "แอปพลิเคชัน" menu. */
3
- export type ErpAppId = "platform" | "accounx" | "invenx" | "plannex" | "peoplx";
3
+ export type ErpAppId = "platform" | "accounx" | "invenx" | "plannex" | "peoplx" | "sellx" | "carex";
4
4
  export interface BuildSystemLinksOptions {
5
5
  /** Organisation code from the route. Without it there is nowhere to link to. */
6
6
  orgCode?: string | null;
@@ -27,7 +27,15 @@ export declare function filterNavigationModulesByPermission(modules: Module[], r
27
27
  * the trail and the tabs could disagree about where the user was.
28
28
  */
29
29
  export declare function getActiveModule(pathname: string, modules: Module[]): string | null;
30
- /** Find the active sub-module id from `pathname`, by the same rule. */
30
+ /**
31
+ * Find the active sub-module id from `pathname`: the page whose own URL — or
32
+ * one of whose listed `subPages` — is the path itself (below the org code,
33
+ * ignoring a trailing slash). A record, a create or an edit page below a page
34
+ * is no page of the menu, so it has no active sub-module (0.1.58); the module
35
+ * (`getActiveModule`) still says where it belongs.
36
+ *
37
+ * Equal URLs in two modules go to the active module's page.
38
+ */
31
39
  export declare function getActiveSubModule(pathname: string, modules: Module[]): string | null;
32
40
  /** Prepend `code` (org code) to a relative URL so `/sales` → `/O25.../sales`.
33
41
  * Absolute `http(s)://` URLs are left intact; optional `{code}` placeholder is replaced.
@@ -40,19 +48,37 @@ export declare function buildUrlWithCode(code: string | undefined, url: string):
40
48
  * `item` is the index of the top-level row. `sub` is the index of the
41
49
  * sub-item under it, or null when the row itself is the entry (a one-line
42
50
  * item, or a group on its own URL with no page of its own matching).
43
- * `subPage` is the index of the page inside a collapsible sub-item.
51
+ * `subPage` is the index of the page inside a sub-item's `subPages`.
44
52
  */
45
53
  export interface ActiveNavEntry {
46
54
  item: number;
47
55
  sub: number | null;
48
56
  subPage: number | null;
49
57
  }
58
+ /** Where the current page sits in the menu, lit or not. */
59
+ export interface SidebarNavState {
60
+ /**
61
+ * The entry lit for this page — only when the page is that entry's own
62
+ * page (its URL, or one of its `subPages`). Null on a record, a create or
63
+ * an edit page below a menu page.
64
+ */
65
+ active: ActiveNavEntry | null;
66
+ /**
67
+ * The group (and sub-item) holding the page: the lit entry's, or else the
68
+ * one with the deepest URL the path sits below. It opens so the user sees
69
+ * where they are, with nothing in it lit.
70
+ */
71
+ open: {
72
+ item: number;
73
+ sub: number | null;
74
+ } | null;
75
+ }
50
76
  export interface ResolveActiveNavOptions {
51
77
  /** Org code the relative URLs are prefixed with. */
52
78
  code?: string;
53
79
  /**
54
- * Workspace chrome: a row's own URL counts with or without a trailing
55
- * slash. The brand chrome has always compared it exactly.
80
+ * Kept for callers. Since 0.1.58 every chrome treats "/O1/x/" and "/O1/x"
81
+ * as the same page; this no longer changes anything.
56
82
  */
57
83
  workspace?: boolean;
58
84
  /** See NavMain: a one-line item is lit by `item.isActive` alone. */
@@ -61,13 +87,22 @@ export interface ResolveActiveNavOptions {
61
87
  /** "/O1/" and "/O1" are the same page; a query string never is. */
62
88
  export declare function samePage(pathname: string, url: string): boolean;
63
89
  /**
64
- * Pick the single sidebar entry for `pathname`: the longest URL that covers
65
- * the path, across every group. Before 0.1.57 the longest match was taken in
66
- * each group separately, so /project/schedule lit both "โครงการ" (/project,
67
- * under โครงการ) and "ภาพรวมแผน" (/project/schedule, under แผนงาน).
90
+ * Where `pathname` sits in the sidebar: the entry to light and the group to
91
+ * open.
92
+ *
93
+ * Lit (0.1.58): only the entry whose own page this is — its URL or one of its
94
+ * `subPages`, exactly. A record, a create or an edit page below a menu page
95
+ * (Plannex /project/detail/<id>/schedule under "โครงการ" /project) lights
96
+ * nothing; an app lists such a page in `subPages` when it should keep its
97
+ * entry lit. At most one entry across every group (0.1.57).
98
+ *
99
+ * Open: the lit entry's group, or else the group with the deepest URL the
100
+ * path sits below.
68
101
  *
69
102
  * Equal lengths go to the group the app marks active (`item.isActive`, from
70
103
  * its `activeModule`), then to a page over a group row, then to the first in
71
104
  * menu order.
72
105
  */
73
- export declare function resolveActiveNav(items: Module[], pathname: string | null | undefined, { code, workspace, highlightActiveModule }?: ResolveActiveNavOptions): ActiveNavEntry | null;
106
+ export declare function resolveSidebarNav(items: Module[], pathname: string | null | undefined, { code, highlightActiveModule }?: ResolveActiveNavOptions): SidebarNavState;
107
+ /** The entry lit for `pathname` — `resolveSidebarNav(...).active`. */
108
+ export declare function resolveActiveNav(items: Module[], pathname: string | null | undefined, options?: ResolveActiveNavOptions): ActiveNavEntry | null;
@@ -38,6 +38,12 @@ export interface SubModule {
38
38
  isActive?: boolean;
39
39
  icon?: IconType;
40
40
  isCollapsible?: boolean;
41
+ /**
42
+ * Pages that are this item's own: the sidebar lights the item on any of
43
+ * them, exactly as on its URL (0.1.58 lights nothing on other pages below
44
+ * it). A collapsible item also draws them as its children. Each needs a
45
+ * `permissionRouteKey` the user holds — the filter drops one without.
46
+ */
41
47
  subPages?: SubPage[];
42
48
  permissionRouteKey?: string;
43
49
  /**
package/dist/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * This package's version, attached to help messages so the back office can
3
3
  * tell which shell a report came from. Keep in step with package.json.
4
4
  */
5
- export declare const SHELL_VERSION = "0.1.57";
5
+ export declare const SHELL_VERSION = "0.1.59";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eintrek/erp-shell",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Shared frontend platform for ERP apps — HTTP client, providers, navigation, hooks.",