autosolutions-os 0.2.5 → 0.3.0
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/CHANGELOG.md +106 -0
- package/README.md +65 -55
- package/dist/frame.d.ts +13 -7
- package/dist/frame.js +5 -4
- package/dist/nav.d.ts +118 -53
- package/dist/nav.js +254 -140
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 - 2026-10-16
|
|
4
|
+
|
|
5
|
+
The OS menu becomes Cliff's menu map, every app shows the Hub panel, and
|
|
6
|
+
every row goes somewhere: to its app, or to its page in the Hub. Needs
|
|
7
|
+
`autosolutions-design-system` 6.5.0 (the peer range is now `>=6.5.0 <7`), whose
|
|
8
|
+
frame draws Cliff's newest design: take both in one commit.
|
|
9
|
+
|
|
10
|
+
### The menu is Cliff's map
|
|
11
|
+
|
|
12
|
+
- `OS_MENU` is the menu map of Cliff's design (its functions kit,
|
|
13
|
+
`dashboards/nav.js` and `data.js`, 16 October): his ids, labels, groups,
|
|
14
|
+
order and statuses, and each tool's views as `tabs` (every view's id and
|
|
15
|
+
label), which the tool's page in the Hub shows as tabs. Finance, Commercial
|
|
16
|
+
and Operations open with an Overview row (`finance-home`,
|
|
17
|
+
`commercial-home`, `operations-home`, marked `overview: true`, in a group
|
|
18
|
+
with no title, `""`). Commercial > Planning keeps the two rows the design
|
|
19
|
+
keeps from before its merge, Customer scorecard and Clearance list. Our four
|
|
20
|
+
Live apps stay, each at the end of its group: Shelf simulator, Key
|
|
21
|
+
accounts, PM Copilot, Candidate hub. 56 tools and three Overviews, 21 Live
|
|
22
|
+
as before. Every glyph is in the design system's `NAV_ICONS` (Board pack
|
|
23
|
+
has its own, `fin-board-pack`, new in 6.5.0).
|
|
24
|
+
- What moved. Finance: P&L vs LY (was P&L vs budget), Balance sheet v LY,
|
|
25
|
+
Inventory valuation (moved here from Operations, still `inventory-value`),
|
|
26
|
+
Working capital and Sales ratios (new). Commercial: Sales (was Live sales by
|
|
27
|
+
channel), Customers (was New customer acquisition and At risk / lapsed
|
|
28
|
+
customers), Customer forecast collaboration and Clearance list (new).
|
|
29
|
+
Operations: Order OTIF (was Customer OTIF). Marketing is as it was.
|
|
30
|
+
Statuses are the map's: most Finance tools, for example, are In progress
|
|
31
|
+
now.
|
|
32
|
+
- `OS_TOOL_ALIASES` and `osToolId(id)`: the five ids that changed
|
|
33
|
+
(`pl-vs-budget` is `pl-vs-ly`, `live-sales-by-channel` is `sales`,
|
|
34
|
+
`customer-otif` is `order-otif`, `new-customer-acquisition` and
|
|
35
|
+
`at-risk-customers` are `customers`). An app that still passes one, as a
|
|
36
|
+
tool of its own, a link or a lock, lands on the new row; an entry under the
|
|
37
|
+
new id wins over one under an old id. The frame reports the new id.
|
|
38
|
+
- `OS_TOOL_LINKS` keeps every Live tool's app link exactly, under the new
|
|
39
|
+
ids (`sales` for Ops Hub's sales dashboard).
|
|
40
|
+
|
|
41
|
+
### Every app shows the Hub panel
|
|
42
|
+
|
|
43
|
+
- `OS_HUB_MENU` is the design's Hub panel: "Smart Comms Hub" (Overview,
|
|
44
|
+
Inbox, Calendar, Tasks, Slack, Monday, Accounts, Configuration) and
|
|
45
|
+
"Assistants" (Unmarked Agent, Brand Voice Capture, Signature Generator),
|
|
46
|
+
each row with its route in the Hub (`/comms/overview` and the other comms
|
|
47
|
+
views, `/comms/settings` for Configuration, `/comms/agent`,
|
|
48
|
+
`/launcher?section=brandvoice`, `/launcher?section=signature`).
|
|
49
|
+
- `osFrame` draws it whenever `hubItems` is not given. In another app the
|
|
50
|
+
rail's Hub now opens it, as any function opens its menu (it went straight
|
|
51
|
+
to the Hub before), and each row is a link into the Hub with the company as
|
|
52
|
+
`?tenant=`. In the Hub its rows are the Hub's own routes. `hubItems` still
|
|
53
|
+
wins (the Hub passes its own rows, to lock what it gates); `hubItems: []`
|
|
54
|
+
draws no Hub menu, and the rail's Hub goes to the Hub as before.
|
|
55
|
+
|
|
56
|
+
### Every row goes somewhere
|
|
57
|
+
|
|
58
|
+
- A tool with no app of its own, and every Overview, opens its page in the
|
|
59
|
+
Hub, which the Hub builds from the design's sample dashboards:
|
|
60
|
+
`/os/<function>` for an Overview, `/os/<function>/<tool>` for a tool, and
|
|
61
|
+
`?tab=<view>` for one of its views (`osHubPath(fn, tool?, tab?)`). In another
|
|
62
|
+
app such a row is a link through `HUB_URL` (`hubUrl`), with `?tenant=`; in
|
|
63
|
+
the Hub it is the Hub's own route, which places the location on its row,
|
|
64
|
+
views included (a row that opens an app keeps the place of its page in the
|
|
65
|
+
Hub too). A frame off the core reaches them the same way.
|
|
66
|
+
- A row is locked only when its tool has an app the person does not hold
|
|
67
|
+
(`HINTS.locked`), and while os_context() is read (`HINTS.checking`, now for
|
|
68
|
+
every tool with an app, whatever its status). Nothing is locked for its
|
|
69
|
+
status any more. A tool whose app is held but not deployed, and an app's
|
|
70
|
+
tool that a frame off the core cannot reach (no fixed address), open their
|
|
71
|
+
page in the Hub, where the core decides. `HINTS.notBuilt` and
|
|
72
|
+
`HINTS.notLinked` stay exported; the frame no longer draws them.
|
|
73
|
+
- `catalogueLinks(apps)`: held with an address, a link, whatever the map's
|
|
74
|
+
status; held without one, neither (its page in the Hub); not held, locked.
|
|
75
|
+
|
|
76
|
+
### Kept
|
|
77
|
+
|
|
78
|
+
The routing rules are unchanged: `locate`, `targetFor`, the reselect rules,
|
|
79
|
+
a page filed under a tab, the Hub's own rows, Admin and Settings, a refused
|
|
80
|
+
navigation, the company switch. `targetFor` still honours `back: true` for a
|
|
81
|
+
caller that passes it; design system 6.5.0 no longer reports it, as its tool
|
|
82
|
+
panel has no Back to hub. `OsWorkspaceFrame` takes the same props.
|
|
83
|
+
|
|
84
|
+
### Upgrading
|
|
85
|
+
|
|
86
|
+
- Take 0.3.0 with design system 6.5.0, in one commit.
|
|
87
|
+
- Code that reads the menu's ids: `sales`, `pl-vs-ly`, `order-otif`,
|
|
88
|
+
`customers`, and Inventory valuation (`inventory-value`) is in Finance.
|
|
89
|
+
Ops Hub's own tests read `row("operations", "inventory-value")` and
|
|
90
|
+
`row("commercial", "live-sales-by-channel")` (src/shared/lib/ops-nav.test.ts,
|
|
91
|
+
and `/sales-dashboard` in OpsFrame.test.tsx): they are
|
|
92
|
+
`row("finance", "inventory-value")` and `row("commercial", "sales")`.
|
|
93
|
+
- Tests that count the menu (53 tools) or its groups, or expect a row to be
|
|
94
|
+
locked for its status ("Not built yet", "In progress", "To build", "Live,
|
|
95
|
+
not linked from the Hub yet"): those rows link to their page in the Hub
|
|
96
|
+
now. PM Copilot's `src/test/ops-frame-nav.test.ts` reads the Operations >
|
|
97
|
+
Planning group, which still ends with PM Copilot and Candidate hub.
|
|
98
|
+
- Tests that expect the rail's Hub to go to the Hub in an app other than the
|
|
99
|
+
Hub: it opens the Hub panel now (pass `hubItems: []` to keep the old
|
|
100
|
+
behaviour).
|
|
101
|
+
- The Hub: its own rows (`hubItems`) still win, so nothing changes until it
|
|
102
|
+
moves. To draw the design's panel it stops passing them, or builds them
|
|
103
|
+
from `OS_HUB_MENU` with its locks (Brand Voice Capture's id there is
|
|
104
|
+
`voice`), and it serves the `/os/...` pages. Its test "reads a held app
|
|
105
|
+
with no address yet as not linked" (src/launcher/nav.test.ts, Carton label
|
|
106
|
+
generator) now finds the row's page in the Hub, its own route
|
|
107
|
+
`/os/operations/carton-label-generator`, instead of `HINTS.notLinked`.
|
|
108
|
+
|
|
3
109
|
## 0.2.5 - 2026-10-15
|
|
4
110
|
|
|
5
111
|
Single sign-on fix. Signed in at the Hub, people opening an app were asked to
|
package/README.md
CHANGED
|
@@ -54,23 +54,21 @@ followSharedSession(supabase, ref);
|
|
|
54
54
|
## The workspace frame
|
|
55
55
|
|
|
56
56
|
`OsWorkspaceFrame` is the frame every app on the core renders around its pages:
|
|
57
|
-
the top bar with the company's mark and switcher, the rail, the OS menu (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
rail's Hub (see below). The Hub's adoption of 0.2.3 updates its one test that
|
|
73
|
-
does this (the CHANGELOG has the change).
|
|
57
|
+
the top bar with the company's mark and switcher, the rail, the OS menu (Cliff's
|
|
58
|
+
menu map, 0.3.0: 56 tools and an Overview first in Finance, Commercial and
|
|
59
|
+
Operations, our Shelf simulator, Key accounts, PM Copilot and Candidate hub
|
|
60
|
+
among them), the Hub panel, the footer with Admin for people who manage
|
|
61
|
+
something, and the browser-tab icon. It needs `autosolutions-design-system`
|
|
62
|
+
6.5.0 or later (an optional peer: only this entry point uses it). Take this
|
|
63
|
+
package's 0.3.0 and the design system's 6.5.0 together, in one commit: 0.3.0
|
|
64
|
+
brings the design's menu map, its Hub panel in every app and a page in the
|
|
65
|
+
Hub for every row with no app of its own; 6.5.0 brings Cliff's newest design
|
|
66
|
+
(the new logo, and a tool open in its own panel, its icon and name over its
|
|
67
|
+
tabs, with no Back to hub). An app that renders `OsWorkspaceFrame` changes
|
|
68
|
+
nothing in its code, but for the ids that changed (below) if it reads them.
|
|
69
|
+
Code that calls `osFrame().targetFor` itself in the Hub and means Back to hub
|
|
70
|
+
passes `back: true`, which the frame no longer reports (there is no Back to
|
|
71
|
+
hub since design system 6.5.0).
|
|
74
72
|
|
|
75
73
|
```tsx
|
|
76
74
|
import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
@@ -120,33 +118,38 @@ why).
|
|
|
120
118
|
- `tools` are this app's own rows, by menu-map id, with their routes. They are
|
|
121
119
|
live whatever the map says. A row the map does not have takes `fn`, `section`,
|
|
122
120
|
`label` and `icon`. A row can carry a `badge` (a count), and so can a tab.
|
|
121
|
+
An id the map had before 0.3.0 still works (`OS_TOOL_ALIASES`: `pl-vs-budget`
|
|
122
|
+
is `pl-vs-ly`, `live-sales-by-channel` is `sales`, `customer-otif` is
|
|
123
|
+
`order-otif`, `new-customer-acquisition` and `at-risk-customers` are
|
|
124
|
+
`customers`), and the frame reports the row by its new id.
|
|
123
125
|
- `tabs` is a flat list, or titled groups (`{ title, items }[]`) drawn with the
|
|
124
|
-
menu's own section headings.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
menu's own section headings. Opened, the panel shows the tool's icon and
|
|
127
|
+
name, then these (design system 6.5.0). A tab with a `path` navigates; one
|
|
128
|
+
without is page state, read from the frame's state (`children` as a
|
|
129
|
+
function).
|
|
130
|
+
- Every other row goes somewhere, in the same tab. A tool with an app of its
|
|
131
|
+
own opens that app only if the person holds it: the menu reaches every app
|
|
132
|
+
the app switcher offers (all but the Hub itself, which is the rail's Hub).
|
|
133
|
+
`OS_TOOL_LINKS` names each tool's app, and `os_context()` decides, whatever
|
|
134
|
+
status the map gives the tool:
|
|
130
135
|
- held, with an address: the tool goes there (plus its `path`) with
|
|
131
|
-
`?tenant
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
A tool's fixed `url` is
|
|
140
|
-
|
|
141
|
-
Brand voice copywriter read "Live, not linked from the Hub yet", anything
|
|
142
|
-
not Live shows its status.
|
|
136
|
+
`?tenant=`;
|
|
137
|
+
- held, not deployed yet: its page in the Hub (below);
|
|
138
|
+
- not held: locked ("Ask your company admin to switch this on for you"),
|
|
139
|
+
the one way a row is locked.
|
|
140
|
+
Every tool with no app of its own, and every Overview, opens its page in the
|
|
141
|
+
Hub (0.3.0): `/os/<function>` for an Overview, `/os/<function>/<tool>` for a
|
|
142
|
+
tool, with `?tab=<view>` for one of its views (`osHubPath`), which the Hub
|
|
143
|
+
builds from the design's sample dashboards. Here it is a link through
|
|
144
|
+
`HUB_URL` with `?tenant=`; in the Hub, its own route. A tool's fixed `url` is
|
|
145
|
+
never used here; it is for frames off the core (`staticLinks()`).
|
|
143
146
|
- os_context() is read once per page and person: another person signing in
|
|
144
147
|
on the same browser, without a reload, reads their own (pass `auth`, the
|
|
145
148
|
app's `supabase.auth`, to have sign-ins followed live in this tab too). A
|
|
146
149
|
read that fails is asked again (1, 3, 10, 30 and 60 seconds on, when the
|
|
147
150
|
window comes back, and when the location changes), and until it answers
|
|
148
|
-
|
|
149
|
-
kept, drawn as nothing.
|
|
151
|
+
every tool with an app reads "Checking your access…" and the plate's place
|
|
152
|
+
is kept, drawn as nothing.
|
|
150
153
|
- The company plate is `markFor(tenant, "plain")`. A company with no artwork
|
|
151
154
|
there (one outside the brand bucket's eight, with no stored logo), or whose
|
|
152
155
|
artwork fails to load, has its name on the plate instead (its whole name
|
|
@@ -169,7 +172,7 @@ why).
|
|
|
169
172
|
`refreshOsContext(os)` reads the core again (asking again if that fails).
|
|
170
173
|
The function reports its own failures.
|
|
171
174
|
- `actions` go in the top bar before the plate (What's new, a notification
|
|
172
|
-
bell). `panelFooter` renders in the panel under
|
|
175
|
+
bell). `panelFooter` renders in the tool's panel under its tabs, in the
|
|
173
176
|
panel's padding, scrolling with them (Create Studio's sessions).
|
|
174
177
|
- Settings goes to `settingsPath` when the app has a settings page, and to the
|
|
175
178
|
Hub's settings when it has none.
|
|
@@ -185,26 +188,33 @@ why).
|
|
|
185
188
|
applies. `data-*` and `aria-*` props land on the frame's root.
|
|
186
189
|
- Admin appears when `my_admin_scope()` says the person manages something; pass
|
|
187
190
|
`admin` to decide it yourself.
|
|
188
|
-
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
- Every app shows the Hub panel (0.3.0, `OS_HUB_MENU`, the design's): Smart
|
|
192
|
+
Comms Hub (Overview, Inbox, Calendar, Tasks, Slack, Monday, Accounts,
|
|
193
|
+
Configuration) and Assistants (Unmarked Agent, Brand Voice Capture,
|
|
194
|
+
Signature Generator). The rail's Hub opens it, as any function does, and
|
|
195
|
+
each row is a link into the Hub with `?tenant=`; Admin goes to the Hub. Pass
|
|
196
|
+
`hubItems` to draw other rows (the Hub passes its own, to lock what it
|
|
197
|
+
gates), or `hubItems={[]}` for none, and the rail's Hub then goes to the
|
|
198
|
+
Hub, as before 0.3.0. In the Hub the panel's rows are its own routes, and
|
|
199
|
+
the rail's Hub is its menu's control: pressed after browsing another
|
|
200
|
+
function's menu, it reopens the Hub menu on the page the person is on, with
|
|
201
|
+
no navigation; from another place (Admin, an app's Settings) it lands on the
|
|
202
|
+
Hub's landing. `targetFor` still honours the design system's `back` flag
|
|
203
|
+
for a caller that passes it.
|
|
196
204
|
|
|
197
205
|
### Off the core
|
|
198
206
|
|
|
199
207
|
`autosolutions-os/nav` is plain data and functions, with no React and no
|
|
200
|
-
Supabase: the rail (`OS_FUNCTIONS`), the menu map (`OS_MENU`),
|
|
201
|
-
`
|
|
202
|
-
`
|
|
203
|
-
(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
Supabase: the rail (`OS_FUNCTIONS`), the menu map (`OS_MENU`), the Hub panel
|
|
209
|
+
(`OS_HUB_MENU`), `OS_TOOL_LINKS`, `OS_TOOL_ALIASES` and `osToolId()`,
|
|
210
|
+
`osHubPath()`, `HUB_URL`, `HUB_PATHS`, `HINTS`, `osFooter()`, `staticLinks()`
|
|
211
|
+
and `osFrame()`, the routing rules the frame runs on. An app on its own
|
|
212
|
+
project (Ops Hub: see "Linked, not federated" in `docs/CONTRACT.md`) pairs it
|
|
213
|
+
with the design system's `WorkspaceFrame`, a static plate and no switcher.
|
|
214
|
+
`staticLinks()` are the fixed addresses (Ops Hub's tools, Label Maker, CRM, Key
|
|
215
|
+
accounts, PM Copilot), with no tenant hint; with no catalogue to ask, they are
|
|
216
|
+
all live, and each app's own sign-in decides. Every other row opens its page
|
|
217
|
+
in the Hub through `HUB_URL` (`hubUrl`), where the core decides. If the app's CSS is a fork of the design
|
|
208
218
|
system, import `autosolutions-design-system/frame.css` instead of `styles.css`
|
|
209
219
|
(see the design system's README).
|
|
210
220
|
|
|
@@ -222,7 +232,7 @@ const here = pathname + search;
|
|
|
222
232
|
footerItems={frame.footerItems}
|
|
223
233
|
location={{ ...frame.locate(here), href: here }}
|
|
224
234
|
onNavigate={(state) => {
|
|
225
|
-
// The state whole: `reselect`
|
|
235
|
+
// The state whole: `reselect` changes where it goes.
|
|
226
236
|
const target = frame.targetFor(state, here);
|
|
227
237
|
if (!target) return false; // goes nowhere: the frame stays where `here` is
|
|
228
238
|
if (target.external) window.location.assign(target.href);
|
package/dist/frame.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* OsWorkspaceFrame: the design system's WorkspaceFrame, wired to the core.
|
|
3
3
|
*
|
|
4
4
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
5
|
-
* the same
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
5
|
+
* the same menu map (Cliff's, 0.3.0), the same Hub panel and the same footer
|
|
6
|
+
* in every app, marks this app's own tools live, links the others through
|
|
7
|
+
* the catalogue (or, for a tool with no app, to its page in the Hub), and
|
|
8
|
+
* puts the acting company's mark on the top bar's plate (its name, when it
|
|
9
|
+
* has no artwork or the artwork fails to load), which opens the company menu.
|
|
9
10
|
*
|
|
10
11
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
11
12
|
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
|
@@ -52,7 +53,12 @@ export type OsWorkspaceFrameProps = {
|
|
|
52
53
|
appKey: string;
|
|
53
54
|
/** This app's own tools, with their routes: these rows are live whatever the map says. */
|
|
54
55
|
tools?: OsAppTool[];
|
|
55
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The Hub function's menu. Default: the design's Hub panel (OS_HUB_MENU,
|
|
58
|
+
* 0.3.0), every row a link into the Hub, so the rail's Hub opens it in any
|
|
59
|
+
* app. The Hub passes its own rows, to lock what it gates. `[]` for no Hub
|
|
60
|
+
* menu: the rail's Hub then goes to the Hub, as before 0.3.0.
|
|
61
|
+
*/
|
|
56
62
|
hubItems?: OsHubSection[];
|
|
57
63
|
/** Where the app is: pathname plus query. */
|
|
58
64
|
location: string;
|
|
@@ -87,13 +93,13 @@ export type OsWorkspaceFrameProps = {
|
|
|
87
93
|
actions?: ReactNode;
|
|
88
94
|
/** How the plate switches company. Default "os". */
|
|
89
95
|
companySwitch?: OsCompanySwitch;
|
|
90
|
-
/** Rendered in the panel under
|
|
96
|
+
/** Rendered in the tool's panel under its tabs, in the panel's padding (a session list, say). */
|
|
91
97
|
panelFooter?: ReactNode;
|
|
92
98
|
/** Sign out, in whatever order the app needs (clear caches first, and so on). */
|
|
93
99
|
onSignOut?: () => void;
|
|
94
100
|
/** This app's settings route. Default: the Hub's settings. */
|
|
95
101
|
settingsPath?: string;
|
|
96
|
-
/** This app's landing. In the Hub it is where
|
|
102
|
+
/** This app's landing. In the Hub it is where the rail's Hub lands from Admin or Settings. */
|
|
97
103
|
homePath?: string;
|
|
98
104
|
/** Show Admin in the footer. Default: asked of the core with my_admin_scope(). */
|
|
99
105
|
admin?: boolean;
|
package/dist/frame.js
CHANGED
|
@@ -3,10 +3,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
* OsWorkspaceFrame: the design system's WorkspaceFrame, wired to the core.
|
|
4
4
|
*
|
|
5
5
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
6
|
-
* the same
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the
|
|
6
|
+
* the same menu map (Cliff's, 0.3.0), the same Hub panel and the same footer
|
|
7
|
+
* in every app, marks this app's own tools live, links the others through
|
|
8
|
+
* the catalogue (or, for a tool with no app, to its page in the Hub), and
|
|
9
|
+
* puts the acting company's mark on the top bar's plate (its name, when it
|
|
10
|
+
* has no artwork or the artwork fails to load), which opens the company menu.
|
|
10
11
|
*
|
|
11
12
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
12
13
|
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
package/dist/nav.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The OS menu: the rail every app shows,
|
|
3
|
-
*
|
|
4
|
-
* place in the workspace frame and a click
|
|
2
|
+
* The OS menu: the rail every app shows, Cliff's menu map by function (the
|
|
3
|
+
* design of 16 October 2026), the Hub's own panel, and the one set of routing
|
|
4
|
+
* rules that turns a location into a place in the workspace frame and a click
|
|
5
|
+
* into a destination.
|
|
5
6
|
*
|
|
6
7
|
* Three levels, the same in every AutoSolutions webapp:
|
|
7
|
-
* 1 the rail
|
|
8
|
-
* 2 the menu
|
|
9
|
-
*
|
|
8
|
+
* 1 the rail Hub, Finance, Marketing, Commercial, Operations
|
|
9
|
+
* 2 the menu that function's tools, grouped Reporting / Planning
|
|
10
|
+
* (Performance / Planning / Creative in Marketing),
|
|
11
|
+
* an Overview first in Finance, Commercial and
|
|
12
|
+
* Operations; the Hub's is Smart Comms Hub and
|
|
13
|
+
* Assistants
|
|
14
|
+
* 3 the tool's panel an app's own tool, open: its icon and name, then its
|
|
15
|
+
* views as tabs (design system 6.5.0; no Back to hub)
|
|
16
|
+
*
|
|
17
|
+
* Every row goes somewhere: to the tool's app, when the person holds it, or
|
|
18
|
+
* else to the tool's page in the Hub (`osHubPath`), built from the design's
|
|
19
|
+
* sample dashboards. A row is locked only when its tool has an app the person
|
|
20
|
+
* does not hold, or while the catalogue is still being asked.
|
|
10
21
|
*
|
|
11
22
|
* Pure data and pure functions: no React, no Supabase. An app that is not on
|
|
12
23
|
* the core imports this beside the design system's WorkspaceFrame; an app on
|
|
@@ -26,12 +37,25 @@ export type OsNavItem = {
|
|
|
26
37
|
badge?: string | number;
|
|
27
38
|
};
|
|
28
39
|
export type OsToolStatus = "Live" | "In progress" | "To build" | "No status";
|
|
40
|
+
/**
|
|
41
|
+
* One of a tool's views, as the menu map names it (0.3.0). The tool's page in
|
|
42
|
+
* the Hub shows them as tabs under its header, and `?tab=<id>` opens one.
|
|
43
|
+
*/
|
|
44
|
+
export type OsToolTab = {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
};
|
|
29
48
|
export type OsTool = {
|
|
30
49
|
id: string;
|
|
31
50
|
label: string;
|
|
32
51
|
icon: string;
|
|
33
52
|
status: OsToolStatus;
|
|
53
|
+
/** The tool's views, as the menu map gives them (0.3.0). */
|
|
54
|
+
tabs?: OsToolTab[];
|
|
55
|
+
/** The function's own Overview row (0.3.0): its page in the Hub is the function's. */
|
|
56
|
+
overview?: boolean;
|
|
34
57
|
};
|
|
58
|
+
/** A group of the menu. The Overview row's group has no title (""). */
|
|
35
59
|
export type OsToolGroup = {
|
|
36
60
|
title: string;
|
|
37
61
|
items: OsTool[];
|
|
@@ -40,17 +64,39 @@ export type OsMenuFunction = "finance" | "marketing" | "commercial" | "operation
|
|
|
40
64
|
/** The rail: the Hub, then the four business functions. */
|
|
41
65
|
export declare const OS_FUNCTIONS: OsNavItem[];
|
|
42
66
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
67
|
+
* Cliff's menu map (the design's ui_kits/functions dashboards/nav.js and
|
|
68
|
+
* data.js, 16 October 2026): its ids, labels, groups, order, status and
|
|
69
|
+
* views, an Overview at the top of Finance, Commercial and Operations, and
|
|
70
|
+
* the two rows the design keeps from before its merge (Customer scorecard,
|
|
71
|
+
* Clearance list). Then our four Live apps the map does not have, at the end
|
|
72
|
+
* of their groups, so they stay reachable: Shelf simulator (Marketing >
|
|
45
73
|
* Planning), Key accounts (Commercial > Planning), PM Copilot and Candidate
|
|
46
|
-
* hub (Operations > Planning)
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
74
|
+
* hub (Operations > Planning); they borrow ops-inventory-value (a stocked
|
|
75
|
+
* shelf), com-customer-scorecard, hub-tasks and hub-accounts. Owner, source
|
|
76
|
+
* and cadence stay in the sheet. Icons are glyph ids from the design
|
|
77
|
+
* system's NAV_ICONS, which draws them inline. Ids renamed in 0.3.0 are in
|
|
78
|
+
* OS_TOOL_ALIASES.
|
|
50
79
|
*/
|
|
51
80
|
export declare const OS_MENU: Record<OsMenuFunction, OsToolGroup[]>;
|
|
52
81
|
/**
|
|
53
|
-
*
|
|
82
|
+
* Ids the menu map had before 0.3.0, and the row each is now: an app that
|
|
83
|
+
* still passes one (a tool of its own, a link, a reason it is locked) lands
|
|
84
|
+
* on the new row. Inventory value kept its id and moved to Finance, as
|
|
85
|
+
* Inventory valuation.
|
|
86
|
+
*/
|
|
87
|
+
export declare const OS_TOOL_ALIASES: Readonly<Record<string, string>>;
|
|
88
|
+
/** The menu map's id for `id`: itself, or the row an id from before 0.3.0 is now. */
|
|
89
|
+
export declare function osToolId(id: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* The page in the Hub where a row with no app of its own goes (0.3.0): the
|
|
92
|
+
* function's overview (`/os/finance`), a tool's page (`/os/finance/cash-forecast`)
|
|
93
|
+
* or one of its views (`/os/finance/cash-forecast?tab=cf-accuracy`). The Hub
|
|
94
|
+
* builds these pages from the design's sample dashboards. A path in the Hub:
|
|
95
|
+
* other apps reach it through HUB_URL.
|
|
96
|
+
*/
|
|
97
|
+
export declare function osHubPath(fn: string, toolId?: string | null, tab?: string | null): string;
|
|
98
|
+
/**
|
|
99
|
+
* Where a tool's app lives. `app` is its catalogue key: in a frame backed by
|
|
54
100
|
* the catalogue (OsWorkspaceFrame), the tool links to that app's address from
|
|
55
101
|
* os_context(), with the company as ?tenant=, only when the person holds the
|
|
56
102
|
* app, and is locked when they do not. `url` is a fixed address, used only by
|
|
@@ -63,13 +109,15 @@ export type OsToolLink = {
|
|
|
63
109
|
url?: string;
|
|
64
110
|
};
|
|
65
111
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
112
|
+
* The tools that have an app of their own: every Live tool's, unchanged in
|
|
113
|
+
* 0.3.0 but for the new ids (Sales was live-sales-by-channel; Inventory
|
|
114
|
+
* valuation, in Finance now, keeps inventory-value), and the tools whose app
|
|
115
|
+
* the catalogue already has whatever the map says of them (Influencer
|
|
116
|
+
* Manager, Marketing calendar, Paid media), so every app the app switcher
|
|
117
|
+
* offers is reachable from the menu too. Every link opens in the same tab.
|
|
118
|
+
* Pricing researcher and Brand voice copywriter have no app to open yet:
|
|
119
|
+
* like every tool with none, they open their page in the Hub. The Hub itself
|
|
120
|
+
* (smart_comms_hub) is the rail's Hub, not a row.
|
|
73
121
|
*/
|
|
74
122
|
export declare const OS_TOOL_LINKS: Record<string, OsToolLink>;
|
|
75
123
|
/** The Hub's own pages, for the rail's Hub, Admin and Settings rows in other apps. */
|
|
@@ -79,9 +127,11 @@ export declare const HUB_PATHS: {
|
|
|
79
127
|
readonly settings: "/comms/settings";
|
|
80
128
|
};
|
|
81
129
|
/**
|
|
82
|
-
* Why a row is locked.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
130
|
+
* Why a row is locked. Since 0.3.0 a row is locked only when its tool has an
|
|
131
|
+
* app the person does not hold (`locked`), or while os_context() has not
|
|
132
|
+
* answered yet, or failed and is being asked again (`checking`): every other
|
|
133
|
+
* row opens its app or its page in the Hub. `notBuilt` and `notLinked` are no
|
|
134
|
+
* longer drawn by the frame, and stay for code that reads them.
|
|
85
135
|
*/
|
|
86
136
|
export declare const HINTS: {
|
|
87
137
|
readonly locked: "Ask your company admin to switch this on for you";
|
|
@@ -95,30 +145,28 @@ export declare function osFooter({ admin }?: {
|
|
|
95
145
|
}): OsNavItem[];
|
|
96
146
|
/**
|
|
97
147
|
* Tool id to address, for the tools with a fixed `url`: what a frame off the
|
|
98
|
-
* core, which has no catalogue to ask, can link to. No tenant hint.
|
|
148
|
+
* core, which has no catalogue to ask, can link to. No tenant hint. Every
|
|
149
|
+
* other row of such a frame opens its page in the Hub, through HUB_URL.
|
|
99
150
|
*/
|
|
100
151
|
export declare function staticLinks(): Record<string, string>;
|
|
101
152
|
/**
|
|
102
153
|
* Tool id to address, and tool id to the reason a row is off, for
|
|
103
154
|
* OsWorkspaceFrame to pass to osFrame. `apps` is os_context().apps: the apps
|
|
104
155
|
* this person holds in the acting company, as the app switcher lists them.
|
|
105
|
-
* For a tool whose OS_TOOL_LINKS entry names an app
|
|
156
|
+
* For a tool whose OS_TOOL_LINKS entry names an app, whatever status the map
|
|
157
|
+
* gives the tool:
|
|
106
158
|
* - held, with an address: linked to it (plus `path`), with the company as
|
|
107
|
-
* ?tenant=,
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* - not held: a Live tool is locked ("Ask your company admin to switch this
|
|
112
|
-
* on for you"); any other keeps the map's own status (Not built yet, In
|
|
113
|
-
* progress, To build).
|
|
159
|
+
* ?tenant=, because the switcher already offers that app;
|
|
160
|
+
* - held, not deployed yet (no address): neither, so the frame opens the
|
|
161
|
+
* tool's page in the Hub, as it does for a tool with no app;
|
|
162
|
+
* - not held: locked ("Ask your company admin to switch this on for you").
|
|
114
163
|
* A fixed `url` is never consulted here: it is no way round the catalogue.
|
|
115
|
-
* Tools with no app
|
|
116
|
-
* nothing to them.
|
|
164
|
+
* Tools with no app open their page in the Hub (osFrame). Links are final:
|
|
165
|
+
* osFrame adds nothing to them.
|
|
117
166
|
*
|
|
118
167
|
* With `apps` null (the catalogue has not answered yet, or the read failed
|
|
119
|
-
* and is being asked again), nothing is linked, and
|
|
120
|
-
* reads "Checking your access…" rather than claiming it is
|
|
121
|
-
* held; any other keeps the map's own status.
|
|
168
|
+
* and is being asked again), nothing is linked, and every tool with an app
|
|
169
|
+
* reads "Checking your access…" rather than claiming it is held or not.
|
|
122
170
|
*/
|
|
123
171
|
export declare function catalogueLinks(apps: ReadonlyArray<{
|
|
124
172
|
key: string;
|
|
@@ -141,15 +189,17 @@ export type OsTabGroup = {
|
|
|
141
189
|
items: OsTab[];
|
|
142
190
|
};
|
|
143
191
|
/**
|
|
144
|
-
* One of this app's own tools. `id` is an OS_MENU tool id
|
|
145
|
-
*
|
|
146
|
-
*
|
|
192
|
+
* One of this app's own tools. `id` is an OS_MENU tool id (or one it had
|
|
193
|
+
* before 0.3.0, OS_TOOL_ALIASES), which places it in the menu and enables it
|
|
194
|
+
* however the map marks it; an id the map does not have needs `fn`,
|
|
195
|
+
* `section`, `label` and `icon` to be placed.
|
|
147
196
|
*/
|
|
148
197
|
export type OsAppTool = OsRoute & {
|
|
149
198
|
id: string;
|
|
150
199
|
/**
|
|
151
|
-
* The
|
|
152
|
-
*
|
|
200
|
+
* The tool's own views, flat or in titled groups: opened, the panel shows
|
|
201
|
+
* the tool's icon and name, then these (design system 6.5.0). Tabs with a
|
|
202
|
+
* `path` navigate; tabs without are page state, read from the frame's state.
|
|
153
203
|
*/
|
|
154
204
|
tabs?: OsTab[] | OsTabGroup[];
|
|
155
205
|
/** false for a tool that carries its own tab row in the page: opening it closes the menu. */
|
|
@@ -161,7 +211,7 @@ export type OsAppTool = OsRoute & {
|
|
|
161
211
|
label?: string;
|
|
162
212
|
icon?: string;
|
|
163
213
|
};
|
|
164
|
-
/** A row in the Hub function's menu.
|
|
214
|
+
/** A row in the Hub function's menu. */
|
|
165
215
|
export type OsHubItem = OsNavItem & Partial<OsRoute> & {
|
|
166
216
|
href?: string;
|
|
167
217
|
tabs?: OsTab[] | OsTabGroup[];
|
|
@@ -171,6 +221,14 @@ export type OsHubSection = {
|
|
|
171
221
|
title?: string;
|
|
172
222
|
items: OsHubItem[];
|
|
173
223
|
};
|
|
224
|
+
/**
|
|
225
|
+
* The Hub's panel (0.3.0), the design's: Smart Comms Hub, its eight views,
|
|
226
|
+
* then the Assistants. Every app shows it when the rail's Hub is selected,
|
|
227
|
+
* each row a link to its page in the Hub (in the Hub, its own route). The Hub
|
|
228
|
+
* may pass rows of its own instead (`hubItems`), to lock the Assistants it
|
|
229
|
+
* gates.
|
|
230
|
+
*/
|
|
231
|
+
export declare const OS_HUB_MENU: OsHubSection[];
|
|
174
232
|
/** A menu row as osFrame hands it to WorkspaceFrame. */
|
|
175
233
|
export type OsMenuRow = OsNavItem & {
|
|
176
234
|
path?: string;
|
|
@@ -197,8 +255,9 @@ export type OsTarget = {
|
|
|
197
255
|
};
|
|
198
256
|
/**
|
|
199
257
|
* The part of WorkspaceFrame's state a destination depends on. `reselect` is
|
|
200
|
-
* WorkspaceFrame's flag for a click on what it already shows
|
|
201
|
-
* for Back to hub (design system 6.3.4).
|
|
258
|
+
* WorkspaceFrame's flag for a click on what it already shows. `back` was its
|
|
259
|
+
* flag for Back to hub (design system 6.3.4), which 6.5.0 no longer draws:
|
|
260
|
+
* still honoured, for a caller that passes it.
|
|
202
261
|
*/
|
|
203
262
|
export type OsFrameState = {
|
|
204
263
|
fn: {
|
|
@@ -217,10 +276,16 @@ export type OsFrameOptions = {
|
|
|
217
276
|
/** This app's catalogue key; "hub" for the Hub itself. */
|
|
218
277
|
appKey: string;
|
|
219
278
|
tools?: OsAppTool[];
|
|
279
|
+
/**
|
|
280
|
+
* The Hub function's menu. Default OS_HUB_MENU, the design's Hub panel:
|
|
281
|
+
* links into the Hub (in the Hub, its own routes). The Hub passes its own
|
|
282
|
+
* rows to lock what it gates; `[]` for no Hub menu, and then the rail's Hub
|
|
283
|
+
* goes to the Hub, as before 0.3.0.
|
|
284
|
+
*/
|
|
220
285
|
hubItems?: OsHubSection[];
|
|
221
286
|
/** Tool id to address, for tools served by other apps (catalogueLinks or staticLinks). Used as given. */
|
|
222
287
|
links?: Record<string, string>;
|
|
223
|
-
/** Tool id to the reason its row is off (catalogueLinks): wins over the
|
|
288
|
+
/** Tool id to the reason its row is off (catalogueLinks): wins over the tool's page in the Hub. */
|
|
224
289
|
locked?: Record<string, string>;
|
|
225
290
|
/** Show Admin in the footer. */
|
|
226
291
|
admin?: boolean;
|
|
@@ -242,13 +307,13 @@ export type OsFrame = {
|
|
|
242
307
|
locate: (location: string) => OsLocation;
|
|
243
308
|
/**
|
|
244
309
|
* Where a click from `location` goes; null when it goes nowhere (opening a
|
|
245
|
-
* menu, the rail's Hub
|
|
246
|
-
* In the Hub the hub function with no row is the rail's Hub; Back
|
|
247
|
-
* is that state with `back: true
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* tab
|
|
310
|
+
* menu, the rail's Hub where it has a menu, a locked row, or already
|
|
311
|
+
* there). In the Hub the hub function with no row is the rail's Hub; Back
|
|
312
|
+
* to hub (design system 6.4 and before) is that state with `back: true`. A
|
|
313
|
+
* reselect (`state.reselect`, a click on the tab or row the frame already
|
|
314
|
+
* shows) goes to that tab's or row's own path unless `location` is exactly
|
|
315
|
+
* it, so a page filed under a tab (a draft under Requests) goes back to the
|
|
316
|
+
* tab's page.
|
|
252
317
|
*/
|
|
253
318
|
targetFor: (state: OsFrameState, location: string) => OsTarget | null;
|
|
254
319
|
};
|
package/dist/nav.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The OS menu: the rail every app shows,
|
|
3
|
-
*
|
|
4
|
-
* place in the workspace frame and a click
|
|
2
|
+
* The OS menu: the rail every app shows, Cliff's menu map by function (the
|
|
3
|
+
* design of 16 October 2026), the Hub's own panel, and the one set of routing
|
|
4
|
+
* rules that turns a location into a place in the workspace frame and a click
|
|
5
|
+
* into a destination.
|
|
5
6
|
*
|
|
6
7
|
* Three levels, the same in every AutoSolutions webapp:
|
|
7
|
-
* 1 the rail
|
|
8
|
-
* 2 the menu
|
|
9
|
-
*
|
|
8
|
+
* 1 the rail Hub, Finance, Marketing, Commercial, Operations
|
|
9
|
+
* 2 the menu that function's tools, grouped Reporting / Planning
|
|
10
|
+
* (Performance / Planning / Creative in Marketing),
|
|
11
|
+
* an Overview first in Finance, Commercial and
|
|
12
|
+
* Operations; the Hub's is Smart Comms Hub and
|
|
13
|
+
* Assistants
|
|
14
|
+
* 3 the tool's panel an app's own tool, open: its icon and name, then its
|
|
15
|
+
* views as tabs (design system 6.5.0; no Back to hub)
|
|
16
|
+
*
|
|
17
|
+
* Every row goes somewhere: to the tool's app, when the person holds it, or
|
|
18
|
+
* else to the tool's page in the Hub (`osHubPath`), built from the design's
|
|
19
|
+
* sample dashboards. A row is locked only when its tool has an app the person
|
|
20
|
+
* does not hold, or while the catalogue is still being asked.
|
|
10
21
|
*
|
|
11
22
|
* Pure data and pure functions: no React, no Supabase. An app that is not on
|
|
12
23
|
* the core imports this beside the design system's WorkspaceFrame; an app on
|
|
@@ -23,108 +34,158 @@ export const OS_FUNCTIONS = [
|
|
|
23
34
|
{ id: "commercial", label: "Commercial", icon: "commercial" },
|
|
24
35
|
{ id: "operations", label: "Operations", icon: "operations" },
|
|
25
36
|
];
|
|
37
|
+
const tool = (id, label, icon, status, tabs) => (tabs ? { id, label, icon, status, tabs: tabs.map(([tab, name]) => ({ id: tab, label: name })) } : { id, label, icon, status });
|
|
38
|
+
const overview = (fn) => ({
|
|
39
|
+
title: "",
|
|
40
|
+
items: [{ id: `${fn}-home`, label: "Overview", icon: "hub-overview", status: "No status", overview: true }],
|
|
41
|
+
});
|
|
26
42
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
43
|
+
* Cliff's menu map (the design's ui_kits/functions dashboards/nav.js and
|
|
44
|
+
* data.js, 16 October 2026): its ids, labels, groups, order, status and
|
|
45
|
+
* views, an Overview at the top of Finance, Commercial and Operations, and
|
|
46
|
+
* the two rows the design keeps from before its merge (Customer scorecard,
|
|
47
|
+
* Clearance list). Then our four Live apps the map does not have, at the end
|
|
48
|
+
* of their groups, so they stay reachable: Shelf simulator (Marketing >
|
|
29
49
|
* Planning), Key accounts (Commercial > Planning), PM Copilot and Candidate
|
|
30
|
-
* hub (Operations > Planning)
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
50
|
+
* hub (Operations > Planning); they borrow ops-inventory-value (a stocked
|
|
51
|
+
* shelf), com-customer-scorecard, hub-tasks and hub-accounts. Owner, source
|
|
52
|
+
* and cadence stay in the sheet. Icons are glyph ids from the design
|
|
53
|
+
* system's NAV_ICONS, which draws them inline. Ids renamed in 0.3.0 are in
|
|
54
|
+
* OS_TOOL_ALIASES.
|
|
34
55
|
*/
|
|
35
56
|
export const OS_MENU = {
|
|
36
57
|
finance: [
|
|
58
|
+
overview("finance"),
|
|
37
59
|
{ title: "Reporting", items: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
60
|
+
tool("cash-forecast", "Cash & forecast", "fin-cash", "In progress", [["cf-forecast", "13-week forecast"], ["cf-accuracy", "Forecast accuracy"], ["cf-manual", "Manual flows"]]),
|
|
61
|
+
tool("pl-vs-ly", "P&L vs LY", "fin-pl", "In progress", [["pl", "P&L"], ["pl-trend", "13-month trend"], ["pl-unmapped", "Unmapped accounts"]]),
|
|
62
|
+
tool("balance-sheet", "Balance sheet v LY", "fin-balance", "In progress", [["bs", "Balance sheet"], ["bs-ic", "Intercompany"]]),
|
|
63
|
+
tool("inventory-value", "Inventory valuation", "ops-inventory-value", "Live", [["val-summary", "Summary"], ["val-items", "By item"], ["val-gl", "GL reconciliation"]]),
|
|
64
|
+
tool("working-capital", "Working capital", "fin-capital", "In progress", [["wc-summary", "Actual & forecast"], ["wc-roi", "Inventory ROI"], ["wc-slow", "Aged & slow stock"]]),
|
|
65
|
+
tool("margin-by-channel", "Margin by channel", "fin-margin", "In progress", [["gm-channel", "By channel"], ["gm-bottom", "Bottom 20"], ["gm-recon", "Reconciliation"]]),
|
|
66
|
+
tool("debtors-creditors", "Debtors & creditors", "fin-debtors", "In progress", [["ar", "Debtors"], ["ap", "Creditors"], ["collect", "Collections"]]),
|
|
67
|
+
tool("sales-ratios", "Sales ratios", "fin-ratios", "In progress", [["ratios", "Scorecard"]]),
|
|
68
|
+
tool("board-pack", "Board pack", "fin-board-pack", "In progress", [["bp-summary", "Executive summary"], ["bp-build", "Build & sign off"]]),
|
|
44
69
|
] },
|
|
45
70
|
{ title: "Planning", items: [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
tool("month-end-close", "Month-end close", "fin-compliance", "No status"),
|
|
72
|
+
tool("budget-reforecast", "Budget & reforecast", "fin-capital", "No status"),
|
|
73
|
+
tool("cost-sheets", "Cost sheets", "fin-margin", "No status"),
|
|
74
|
+
tool("approvals-authority", "Approvals & authority", "fin-approvals", "No status"),
|
|
75
|
+
tool("compliance-calendar", "Compliance calendar", "fin-compliance", "No status"),
|
|
51
76
|
] },
|
|
52
77
|
],
|
|
53
78
|
marketing: [
|
|
54
79
|
{ title: "Performance", items: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
tool("live-ecomm-sales", "Live eComm sales by store", "mkt-live-ecomm-sales-by-store", "Live"),
|
|
81
|
+
tool("paid-media", "Paid media", "mkt-paid-media", "No status"),
|
|
82
|
+
tool("email-sms", "Email & SMS", "mkt-email-sms", "No status"),
|
|
83
|
+
tool("retention-ltv", "Retention & LTV", "mkt-retention-ltv", "No status"),
|
|
84
|
+
tool("social-influencer", "Social & influencer", "mkt-social-influencer", "No status"),
|
|
85
|
+
tool("spend-vs-budget", "Spend vs budget", "mkt-spend-vs-budget", "No status"),
|
|
61
86
|
] },
|
|
62
87
|
{ title: "Planning", items: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
tool("marketing-calendar", "Marketing calendar", "mkt-marketing-calendar", "No status"),
|
|
89
|
+
tool("social-content-planner", "Social media content planner", "mkt-media-content-planner", "No status"),
|
|
90
|
+
tool("influencer-crm", "Influencer CRM", "mkt-influencer-crm", "No status"),
|
|
91
|
+
tool("franks-kitchen", "Influencer Manager", "mkt-frank-s-kitchen", "In progress"),
|
|
92
|
+
tool("brand-guidelines", "Brand guidelines", "mkt-brand-guidelines", "In progress"),
|
|
93
|
+
tool("npd-validator", "NPD validator", "mkt-npd-validator", "Live"),
|
|
94
|
+
tool("pricing-researcher", "Pricing researcher", "mkt-pricing-researcher", "Live"),
|
|
95
|
+
tool("shelf-simulator", "Shelf simulator", "ops-inventory-value", "Live"),
|
|
71
96
|
] },
|
|
72
97
|
{ title: "Creative", items: [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
tool("image-generator", "Artificial Design Studio", "mkt-image-generator", "Live"),
|
|
99
|
+
tool("retail-image-library", "Asset Manager", "mkt-retail-ecom-image-library", "Live"),
|
|
100
|
+
tool("brand-voice-copywriter", "Brand voice copywriter", "mkt-brand-voice-copywriter", "Live"),
|
|
76
101
|
] },
|
|
77
102
|
],
|
|
78
103
|
commercial: [
|
|
104
|
+
overview("commercial"),
|
|
79
105
|
{ title: "Reporting", items: [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{ id: "at-risk-customers", label: "At risk / lapsed customers", icon: "com-at-risk-lapsed-customers", status: "To build" },
|
|
106
|
+
tool("sales", "Sales", "com-sales-by-channel", "Live", [["overview", "Overview"], ["customer", "By customer"], ["item", "By item"]]),
|
|
107
|
+
tool("open-orders", "Open orders", "com-open-so-s", "Live", [["open", "Open"], ["held", "Held"], ["due", "Due this week"]]),
|
|
108
|
+
tool("retailer-sell-out", "Retailer sell out (POS)", "com-retailer-sell-out-pos", "In progress", [["sell-through", "Sell in vs sell out"], ["cover", "Retailer stock cover"], ["ranging", "Ranging"]]),
|
|
109
|
+
tool("customers", "Customers", "com-customer-funnel", "In progress", [["new", "New"], ["at-risk", "At risk"], ["lapsed", "Lapsed"]]),
|
|
85
110
|
] },
|
|
86
111
|
{ title: "Planning", items: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
tool("customer-forecast", "Customer forecast collaboration", "ops-forecast-accuracy", "In progress", [["lines", "Lines to decide"], ["cycle", "This cycle"]]),
|
|
113
|
+
tool("pricelist-generator", "Pricelist generator", "com-pricelist-generator", "To build"),
|
|
114
|
+
tool("margin-calculator", "Margin calculator", "com-margin-calculator", "In progress"),
|
|
115
|
+
tool("trade-marketing-calendar", "Trade marketing calendar", "com-trade-marketing-calendar", "To build"),
|
|
116
|
+
tool("line-form-populator", "New line form populator", "com-line-form-populator", "In progress"),
|
|
117
|
+
tool("crm", "CRM", "com-crm", "Live"),
|
|
118
|
+
tool("customer-scorecard", "Customer scorecard", "com-customer-scorecard", "No status"),
|
|
119
|
+
tool("clearance-list", "Clearance list", "com-clearance-list", "No status"),
|
|
120
|
+
tool("key-accounts", "Key accounts", "com-customer-scorecard", "Live"),
|
|
94
121
|
] },
|
|
95
122
|
],
|
|
96
123
|
operations: [
|
|
124
|
+
overview("operations"),
|
|
97
125
|
{ title: "Reporting", items: [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{ id: "inventory-value", label: "Inventory value by item", icon: "ops-inventory-value", status: "Live" },
|
|
126
|
+
tool("inventory-health", "Inventory health", "ops-inventory-health", "Live", [["health", "Health"], ["aging", "Aging & clearance"], ["locations", "Stock by location"]]),
|
|
127
|
+
tool("out-of-stocks", "Out of stocks", "ops-oos", "Live", [["oos-now", "Out now"], ["oos-history", "History"]]),
|
|
128
|
+
tool("forecast-accuracy", "Forecast accuracy", "ops-forecast-accuracy", "In progress", [["fc-accuracy", "Accuracy"], ["fc-items", "By item"], ["fc-compare", "Forecast vs actual"]]),
|
|
129
|
+
tool("open-purchase-orders", "Open purchase orders", "ops-open-po-s", "Live", [["po-all", "Purchase orders"]]),
|
|
130
|
+
tool("shipment-tracker", "Shipment tracker", "ops-shipment-tracker", "Live", [["ship-all", "Shipments"]]),
|
|
131
|
+
tool("order-otif", "Order OTIF", "ops-customer-otif", "In progress", [["otif", "Order OTIF"]]),
|
|
105
132
|
] },
|
|
106
133
|
{ title: "Planning", items: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
134
|
+
tool("action-queue", "Action queue", "ops-action-queue", "Live", [["queue-mine", "My queue"], ["queue-team", "Team"]]),
|
|
135
|
+
tool("demand-planning", "Demand planning", "ops-demand-plan", "In progress", [["dp-plan", "Plan"], ["dp-cleanse", "Cleanse history"], ["dp-accuracy", "Accuracy"], ["dp-lifecycle", "New & EOL"], ["dp-versions", "Versions"]]),
|
|
136
|
+
tool("ordering-tool", "Ordering tool", "ops-order-planing", "Live", [["order-suggest", "Suggestions"], ["order-draft", "Draft"], ["order-approvals", "Approvals"]]),
|
|
137
|
+
tool("carton-label-generator", "Carton label generator", "ops-carton-label-generator", "Live"),
|
|
138
|
+
tool("pm-copilot", "PM Copilot", "hub-tasks", "Live"),
|
|
139
|
+
tool("candidate-hub", "Candidate hub", "hub-accounts", "Live"),
|
|
113
140
|
] },
|
|
114
141
|
],
|
|
115
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* Ids the menu map had before 0.3.0, and the row each is now: an app that
|
|
145
|
+
* still passes one (a tool of its own, a link, a reason it is locked) lands
|
|
146
|
+
* on the new row. Inventory value kept its id and moved to Finance, as
|
|
147
|
+
* Inventory valuation.
|
|
148
|
+
*/
|
|
149
|
+
export const OS_TOOL_ALIASES = {
|
|
150
|
+
"pl-vs-budget": "pl-vs-ly",
|
|
151
|
+
"live-sales-by-channel": "sales",
|
|
152
|
+
"customer-otif": "order-otif",
|
|
153
|
+
"new-customer-acquisition": "customers",
|
|
154
|
+
"at-risk-customers": "customers",
|
|
155
|
+
};
|
|
156
|
+
/** The menu map's id for `id`: itself, or the row an id from before 0.3.0 is now. */
|
|
157
|
+
export function osToolId(id) {
|
|
158
|
+
return Object.prototype.hasOwnProperty.call(OS_TOOL_ALIASES, id) ? OS_TOOL_ALIASES[id] : id;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The page in the Hub where a row with no app of its own goes (0.3.0): the
|
|
162
|
+
* function's overview (`/os/finance`), a tool's page (`/os/finance/cash-forecast`)
|
|
163
|
+
* or one of its views (`/os/finance/cash-forecast?tab=cf-accuracy`). The Hub
|
|
164
|
+
* builds these pages from the design's sample dashboards. A path in the Hub:
|
|
165
|
+
* other apps reach it through HUB_URL.
|
|
166
|
+
*/
|
|
167
|
+
export function osHubPath(fn, toolId, tab) {
|
|
168
|
+
let path = `/os/${encodeURIComponent(fn)}`;
|
|
169
|
+
if (toolId)
|
|
170
|
+
path += `/${encodeURIComponent(toolId)}`;
|
|
171
|
+
if (tab)
|
|
172
|
+
path += `?tab=${encodeURIComponent(tab)}`;
|
|
173
|
+
return path;
|
|
174
|
+
}
|
|
116
175
|
/* Ops Hub is linked, not federated (CONTRACT.md): its catalogue row decides
|
|
117
176
|
who sees its tools live; the fixed address serves frames off the core. */
|
|
118
177
|
const OPS_HUB = "https://frankhub.lovable.app";
|
|
119
178
|
const opsHub = (path) => ({ app: "ops_hub", url: OPS_HUB, path });
|
|
120
179
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
180
|
+
* The tools that have an app of their own: every Live tool's, unchanged in
|
|
181
|
+
* 0.3.0 but for the new ids (Sales was live-sales-by-channel; Inventory
|
|
182
|
+
* valuation, in Finance now, keeps inventory-value), and the tools whose app
|
|
183
|
+
* the catalogue already has whatever the map says of them (Influencer
|
|
184
|
+
* Manager, Marketing calendar, Paid media), so every app the app switcher
|
|
185
|
+
* offers is reachable from the menu too. Every link opens in the same tab.
|
|
186
|
+
* Pricing researcher and Brand voice copywriter have no app to open yet:
|
|
187
|
+
* like every tool with none, they open their page in the Hub. The Hub itself
|
|
188
|
+
* (smart_comms_hub) is the rail's Hub, not a row.
|
|
128
189
|
*/
|
|
129
190
|
export const OS_TOOL_LINKS = {
|
|
130
191
|
"live-ecomm-sales": { app: "alive_reporting" },
|
|
@@ -137,7 +198,7 @@ export const OS_TOOL_LINKS = {
|
|
|
137
198
|
"image-generator": { app: "frank_create" },
|
|
138
199
|
"retail-image-library": { app: "asset_portal" },
|
|
139
200
|
"brand-voice-copywriter": {},
|
|
140
|
-
"
|
|
201
|
+
"sales": opsHub("/sales-dashboard"),
|
|
141
202
|
"open-orders": opsHub("/customer-orders"),
|
|
142
203
|
"crm": { app: "enxgy_crm", url: "https://e-crm.autosolutions.app" },
|
|
143
204
|
"key-accounts": { app: "key_accounts", url: "https://key-accounts.lovable.app" },
|
|
@@ -152,8 +213,6 @@ export const OS_TOOL_LINKS = {
|
|
|
152
213
|
"pm-copilot": { app: "pm_copilot", url: "https://pm-copilot.autosolutions.app" },
|
|
153
214
|
"candidate-hub": { app: "candidate_hub" },
|
|
154
215
|
};
|
|
155
|
-
/* Each tool's status in the map, for catalogueLinks. */
|
|
156
|
-
const STATUS = new Map(Object.values(OS_MENU).flatMap((groups) => groups.flatMap((group) => group.items.map((tool) => [tool.id, tool.status]))));
|
|
157
216
|
/** The Hub's own pages, for the rail's Hub, Admin and Settings rows in other apps. */
|
|
158
217
|
export const HUB_PATHS = {
|
|
159
218
|
home: "/comms/overview",
|
|
@@ -161,9 +220,11 @@ export const HUB_PATHS = {
|
|
|
161
220
|
settings: "/comms/settings",
|
|
162
221
|
};
|
|
163
222
|
/**
|
|
164
|
-
* Why a row is locked.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
223
|
+
* Why a row is locked. Since 0.3.0 a row is locked only when its tool has an
|
|
224
|
+
* app the person does not hold (`locked`), or while os_context() has not
|
|
225
|
+
* answered yet, or failed and is being asked again (`checking`): every other
|
|
226
|
+
* row opens its app or its page in the Hub. `notBuilt` and `notLinked` are no
|
|
227
|
+
* longer drawn by the frame, and stay for code that reads them.
|
|
167
228
|
*/
|
|
168
229
|
export const HINTS = {
|
|
169
230
|
locked: "Ask your company admin to switch this on for you",
|
|
@@ -181,60 +242,77 @@ export function osFooter({ admin = false } = {}) {
|
|
|
181
242
|
}
|
|
182
243
|
/**
|
|
183
244
|
* Tool id to address, for the tools with a fixed `url`: what a frame off the
|
|
184
|
-
* core, which has no catalogue to ask, can link to. No tenant hint.
|
|
245
|
+
* core, which has no catalogue to ask, can link to. No tenant hint. Every
|
|
246
|
+
* other row of such a frame opens its page in the Hub, through HUB_URL.
|
|
185
247
|
*/
|
|
186
248
|
export function staticLinks() {
|
|
187
249
|
const out = {};
|
|
188
|
-
for (const [
|
|
250
|
+
for (const [id, link] of Object.entries(OS_TOOL_LINKS))
|
|
189
251
|
if (link.url)
|
|
190
|
-
out[
|
|
252
|
+
out[id] = joinPath(link.url, link.path);
|
|
191
253
|
return out;
|
|
192
254
|
}
|
|
193
255
|
/**
|
|
194
256
|
* Tool id to address, and tool id to the reason a row is off, for
|
|
195
257
|
* OsWorkspaceFrame to pass to osFrame. `apps` is os_context().apps: the apps
|
|
196
258
|
* this person holds in the acting company, as the app switcher lists them.
|
|
197
|
-
* For a tool whose OS_TOOL_LINKS entry names an app
|
|
259
|
+
* For a tool whose OS_TOOL_LINKS entry names an app, whatever status the map
|
|
260
|
+
* gives the tool:
|
|
198
261
|
* - held, with an address: linked to it (plus `path`), with the company as
|
|
199
|
-
* ?tenant=,
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* - not held: a Live tool is locked ("Ask your company admin to switch this
|
|
204
|
-
* on for you"); any other keeps the map's own status (Not built yet, In
|
|
205
|
-
* progress, To build).
|
|
262
|
+
* ?tenant=, because the switcher already offers that app;
|
|
263
|
+
* - held, not deployed yet (no address): neither, so the frame opens the
|
|
264
|
+
* tool's page in the Hub, as it does for a tool with no app;
|
|
265
|
+
* - not held: locked ("Ask your company admin to switch this on for you").
|
|
206
266
|
* A fixed `url` is never consulted here: it is no way round the catalogue.
|
|
207
|
-
* Tools with no app
|
|
208
|
-
* nothing to them.
|
|
267
|
+
* Tools with no app open their page in the Hub (osFrame). Links are final:
|
|
268
|
+
* osFrame adds nothing to them.
|
|
209
269
|
*
|
|
210
270
|
* With `apps` null (the catalogue has not answered yet, or the read failed
|
|
211
|
-
* and is being asked again), nothing is linked, and
|
|
212
|
-
* reads "Checking your access…" rather than claiming it is
|
|
213
|
-
* held; any other keeps the map's own status.
|
|
271
|
+
* and is being asked again), nothing is linked, and every tool with an app
|
|
272
|
+
* reads "Checking your access…" rather than claiming it is held or not.
|
|
214
273
|
*/
|
|
215
274
|
export function catalogueLinks(apps, tenantSlug = null) {
|
|
216
275
|
const links = {};
|
|
217
276
|
const locked = {};
|
|
218
|
-
for (const [
|
|
277
|
+
for (const [id, link] of Object.entries(OS_TOOL_LINKS)) {
|
|
219
278
|
if (!link.app)
|
|
220
279
|
continue;
|
|
221
280
|
if (apps === null) {
|
|
222
|
-
|
|
223
|
-
locked[tool] = HINTS.checking;
|
|
281
|
+
locked[id] = HINTS.checking;
|
|
224
282
|
continue;
|
|
225
283
|
}
|
|
226
284
|
const app = apps.find((candidate) => candidate.key === link.app);
|
|
227
285
|
if (app?.url)
|
|
228
|
-
links[
|
|
229
|
-
else if (
|
|
230
|
-
|
|
231
|
-
else if (app)
|
|
232
|
-
locked[tool] = HINTS.notLinked;
|
|
233
|
-
else
|
|
234
|
-
locked[tool] = HINTS.locked;
|
|
286
|
+
links[id] = withTenantHint(joinPath(app.url, link.path), tenantSlug);
|
|
287
|
+
else if (!app)
|
|
288
|
+
locked[id] = HINTS.locked;
|
|
235
289
|
}
|
|
236
290
|
return { links, locked };
|
|
237
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* The Hub's panel (0.3.0), the design's: Smart Comms Hub, its eight views,
|
|
294
|
+
* then the Assistants. Every app shows it when the rail's Hub is selected,
|
|
295
|
+
* each row a link to its page in the Hub (in the Hub, its own route). The Hub
|
|
296
|
+
* may pass rows of its own instead (`hubItems`), to lock the Assistants it
|
|
297
|
+
* gates.
|
|
298
|
+
*/
|
|
299
|
+
export const OS_HUB_MENU = [
|
|
300
|
+
{ title: "Smart Comms Hub", items: [
|
|
301
|
+
{ id: "overview", label: "Overview", icon: "hub-overview", path: "/comms/overview", match: ["/comms"] },
|
|
302
|
+
{ id: "inbox", label: "Inbox", icon: "hub-inbox", path: "/comms/inbox" },
|
|
303
|
+
{ id: "calendar", label: "Calendar", icon: "hub-calendar", path: "/comms/calendar" },
|
|
304
|
+
{ id: "tasks", label: "Tasks", icon: "hub-tasks", path: "/comms/tasks" },
|
|
305
|
+
{ id: "slack", label: "Slack", icon: "hub-slack", path: "/comms/slack" },
|
|
306
|
+
{ id: "monday", label: "Monday", icon: "hub-monday", path: "/comms/monday" },
|
|
307
|
+
{ id: "accounts", label: "Accounts", icon: "hub-accounts", path: "/comms/accounts" },
|
|
308
|
+
{ id: "configuration", label: "Configuration", icon: "hub-configuration", path: "/comms/settings" },
|
|
309
|
+
] },
|
|
310
|
+
{ title: "Assistants", items: [
|
|
311
|
+
{ id: "agent", label: "Unmarked Agent", icon: "agent", path: "/comms/agent" },
|
|
312
|
+
{ id: "voice", label: "Brand Voice Capture", icon: "brandvoice", path: "/launcher?section=brandvoice" },
|
|
313
|
+
{ id: "signature", label: "Signature Generator", icon: "mkt-brand-voice-copywriter", path: "/launcher?section=signature" },
|
|
314
|
+
] },
|
|
315
|
+
];
|
|
238
316
|
const ORIGIN = "http://os.invalid";
|
|
239
317
|
function joinPath(base, path) {
|
|
240
318
|
if (!path)
|
|
@@ -249,6 +327,21 @@ function joinPath(base, path) {
|
|
|
249
327
|
function trimmed(pathname) {
|
|
250
328
|
return pathname.replace(/\/+$/, "") || "/";
|
|
251
329
|
}
|
|
330
|
+
/* A map from an app keyed by tool id, under the menu's ids: an entry under an
|
|
331
|
+
id from before 0.3.0 lands on the row it is now, unless the new id has an
|
|
332
|
+
entry of its own. */
|
|
333
|
+
function underMenuIds(map) {
|
|
334
|
+
const out = {};
|
|
335
|
+
for (const [id, value] of Object.entries(map))
|
|
336
|
+
if (osToolId(id) === id)
|
|
337
|
+
out[id] = value;
|
|
338
|
+
for (const [id, value] of Object.entries(map)) {
|
|
339
|
+
const now = osToolId(id);
|
|
340
|
+
if (now !== id && !Object.prototype.hasOwnProperty.call(out, now))
|
|
341
|
+
out[now] = value;
|
|
342
|
+
}
|
|
343
|
+
return out;
|
|
344
|
+
}
|
|
252
345
|
/**
|
|
253
346
|
* How specifically `route` claims `location`: [path length, query params], or
|
|
254
347
|
* null when it does not. Paths compare without regard to case, as the routers
|
|
@@ -293,49 +386,66 @@ function best(routes, location, exact = false) {
|
|
|
293
386
|
* company, the footer, and the only routing logic the frame needs.
|
|
294
387
|
*/
|
|
295
388
|
export function osFrame(options) {
|
|
296
|
-
const { appKey, tools = [], hubItems,
|
|
389
|
+
const { appKey, tools = [], hubItems, admin = false, settingsPath, hubUrl = HUB_URL, tenantSlug = null, } = options;
|
|
390
|
+
const links = underMenuIds(options.links ?? {});
|
|
391
|
+
const locked = underMenuIds(options.locked ?? {});
|
|
297
392
|
const isHub = appKey === "hub";
|
|
298
393
|
const homePath = options.homePath ?? (isHub ? HUB_PATHS.home : "/");
|
|
299
|
-
const own = new Map(tools.map((
|
|
394
|
+
const own = new Map(tools.map((mine) => [osToolId(mine.id), mine]));
|
|
300
395
|
const toHub = (path) => ({ href: withTenantHint(`${hubUrl}${path}`, tenantSlug), external: true });
|
|
396
|
+
/* A path in the Hub: in the Hub one of its own routes, elsewhere a link. */
|
|
397
|
+
const inHub = (base, path, match) => (isHub
|
|
398
|
+
? { ...base, path, ...(match ? { match } : {}) }
|
|
399
|
+
: { ...base, href: withTenantHint(`${hubUrl}${path}`, tenantSlug) });
|
|
301
400
|
const sections = {};
|
|
302
|
-
|
|
303
|
-
|
|
401
|
+
const hubMenu = hubItems ?? OS_HUB_MENU;
|
|
402
|
+
if (hubMenu.length) {
|
|
403
|
+
sections["hub"] = hubItems
|
|
404
|
+
? hubItems.map((section) => ({ ...section, items: [...section.items] }))
|
|
405
|
+
: OS_HUB_MENU.map((section) => ({
|
|
406
|
+
...(section.title ? { title: section.title } : {}),
|
|
407
|
+
items: section.items.map((row) => inHub({ id: row.id, label: row.label, ...(row.icon ? { icon: row.icon } : {}) }, row.path ?? HUB_PATHS.home, row.match)),
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
304
410
|
for (const [fn, groups] of Object.entries(OS_MENU)) {
|
|
305
411
|
sections[fn] = groups.map((group) => ({
|
|
306
|
-
title: group.title,
|
|
307
|
-
items: group.items.map((
|
|
308
|
-
const
|
|
309
|
-
const
|
|
412
|
+
...(group.title ? { title: group.title } : {}),
|
|
413
|
+
items: group.items.map((entry) => {
|
|
414
|
+
const base = { id: entry.id, label: entry.label, icon: entry.icon };
|
|
415
|
+
const mine = own.get(entry.id);
|
|
310
416
|
if (mine)
|
|
311
417
|
return rowFor(base, mine);
|
|
312
|
-
/*
|
|
313
|
-
the
|
|
314
|
-
const
|
|
418
|
+
/* Its page in the Hub, which in the Hub also places a location there
|
|
419
|
+
on this row when the row itself opens an app. */
|
|
420
|
+
const page = osHubPath(fn, entry.overview ? null : entry.id);
|
|
421
|
+
/* A link or a reason from the catalogue comes first: the catalogue
|
|
422
|
+
knows what this person holds. */
|
|
423
|
+
const href = links[entry.id];
|
|
315
424
|
if (href)
|
|
316
|
-
return { ...base, href };
|
|
317
|
-
const reason = locked[
|
|
425
|
+
return { ...base, ...(isHub ? { match: [page] } : {}), href };
|
|
426
|
+
const reason = locked[entry.id];
|
|
318
427
|
if (reason)
|
|
319
428
|
return { ...base, disabled: true, title: reason };
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
429
|
+
/* No app of its own (or one this frame cannot reach: off the core
|
|
430
|
+
with no fixed address, or held and not deployed yet): its page in
|
|
431
|
+
the Hub. */
|
|
432
|
+
return inHub(base, page);
|
|
323
433
|
}),
|
|
324
434
|
}));
|
|
325
435
|
}
|
|
326
436
|
/* This app's tools the menu map does not have, placed where the app says. */
|
|
327
|
-
const mapped = new Set(Object.values(OS_MENU).flatMap((groups) => groups.flatMap((group) => group.items.map((
|
|
328
|
-
for (const
|
|
329
|
-
if (mapped.has(
|
|
437
|
+
const mapped = new Set(Object.values(OS_MENU).flatMap((groups) => groups.flatMap((group) => group.items.map((entry) => entry.id))));
|
|
438
|
+
for (const mine of tools) {
|
|
439
|
+
if (mapped.has(osToolId(mine.id)) || !mine.fn)
|
|
330
440
|
continue;
|
|
331
|
-
const list = sections[
|
|
332
|
-
const title =
|
|
441
|
+
const list = sections[mine.fn] ?? (sections[mine.fn] = []);
|
|
442
|
+
const title = mine.section;
|
|
333
443
|
let section = list.find((candidate) => candidate.title === title);
|
|
334
444
|
if (!section) {
|
|
335
445
|
section = title === undefined ? { items: [] } : { title, items: [] };
|
|
336
446
|
list.push(section);
|
|
337
447
|
}
|
|
338
|
-
section.items.push(rowFor({ id:
|
|
448
|
+
section.items.push(rowFor({ id: mine.id, label: mine.label ?? mine.id, ...(mine.icon ? { icon: mine.icon } : {}) }, mine));
|
|
339
449
|
}
|
|
340
450
|
const footerItems = osFooter({ admin });
|
|
341
451
|
/* Every place a location can land, most specific claim wins; on a tie, the
|
|
@@ -360,7 +470,7 @@ export function osFrame(options) {
|
|
|
360
470
|
}
|
|
361
471
|
}
|
|
362
472
|
}
|
|
363
|
-
const landingFn = tools.map((
|
|
473
|
+
const landingFn = tools.map((mine) => fnOf(sections, osToolId(mine.id))).find((fn) => fn !== undefined);
|
|
364
474
|
const locate = (location) => {
|
|
365
475
|
let url;
|
|
366
476
|
try {
|
|
@@ -418,8 +528,12 @@ export function osFrame(options) {
|
|
|
418
528
|
if (!row) {
|
|
419
529
|
if (fn !== "hub")
|
|
420
530
|
return null; // opening a function's menu is not a navigation
|
|
421
|
-
if (!isHub)
|
|
422
|
-
|
|
531
|
+
if (!isHub) {
|
|
532
|
+
/* The rail's Hub with a menu (the Hub panel, 0.3.0) opens it, as any
|
|
533
|
+
function does; with none (`hubItems: []`), and Back to hub, it
|
|
534
|
+
goes to the Hub. */
|
|
535
|
+
return !state.back && (sections[fn]?.length ?? 0) > 0 ? null : toHub(HUB_PATHS.home);
|
|
536
|
+
}
|
|
423
537
|
/* The rail's Hub where the person is already in the Hub (a thread, a
|
|
424
538
|
tool, the landing) reopens its menu on that page: it is the menu's
|
|
425
539
|
control, never a navigation. Back to hub, and the rail's Hub from
|
|
@@ -455,18 +569,18 @@ export function osFrame(options) {
|
|
|
455
569
|
};
|
|
456
570
|
return { functions: OS_FUNCTIONS, sections, footerItems, homeFunction: "hub", locate, targetFor };
|
|
457
571
|
}
|
|
458
|
-
function rowFor(base,
|
|
572
|
+
function rowFor(base, mine) {
|
|
459
573
|
const row = { ...base };
|
|
460
|
-
if (
|
|
461
|
-
row.path =
|
|
462
|
-
if (
|
|
463
|
-
row.match =
|
|
464
|
-
if (
|
|
465
|
-
row.tabs =
|
|
466
|
-
if (
|
|
467
|
-
row.menu =
|
|
468
|
-
if (
|
|
469
|
-
row.badge =
|
|
574
|
+
if (mine.path)
|
|
575
|
+
row.path = mine.path;
|
|
576
|
+
if (mine.match)
|
|
577
|
+
row.match = mine.match;
|
|
578
|
+
if (mine.tabs)
|
|
579
|
+
row.tabs = mine.tabs;
|
|
580
|
+
if (mine.menu !== undefined)
|
|
581
|
+
row.menu = mine.menu;
|
|
582
|
+
if (mine.badge !== undefined)
|
|
583
|
+
row.badge = mine.badge;
|
|
470
584
|
return row;
|
|
471
585
|
}
|
|
472
586
|
/** Tabs as one list, whether given flat or in groups. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosolutions-os",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "One sign-in, one company switcher, one app grid. What every AutoSolutions app imports instead of copying.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@supabase/supabase-js": ">=2.40.0",
|
|
24
|
-
"autosolutions-design-system": ">=6.
|
|
24
|
+
"autosolutions-design-system": ">=6.5.0 <7",
|
|
25
25
|
"react": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|