autosolutions-os 0.2.0 → 0.2.2
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 +78 -0
- package/README.md +27 -8
- package/dist/frame.d.ts +7 -5
- package/dist/frame.js +15 -8
- package/dist/nav.d.ts +12 -2
- package/dist/nav.js +23 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 - 2026-09-30
|
|
4
|
+
|
|
5
|
+
With `autosolutions-design-system` 6.3.3, whose frame fixes this release
|
|
6
|
+
wires up. The design-system peer range is now `>=6.3.3 <7`: the company
|
|
7
|
+
menu below is marked up with 6.3.3's `ActionList` menu roles, which an
|
|
8
|
+
older design system would put on a list of plain buttons.
|
|
9
|
+
|
|
10
|
+
- **Settings on its own page stays put.** `OsWorkspaceFrame` now returns
|
|
11
|
+
`false` to the frame when `targetFor` finds nowhere to go. In the Hub,
|
|
12
|
+
Settings clicked on Configuration (`/comms/settings`, filed under Smart
|
|
13
|
+
Comms, no `settingsPath`) no longer moves the frame onto Settings: it
|
|
14
|
+
stays on Hub and Smart Comms, adds no history entry and keeps the tab
|
|
15
|
+
icon. The same holds for any rail item with no menu whose page is the
|
|
16
|
+
URL already.
|
|
17
|
+
- **The company menu is a menu.** It is an `ActionList` with `role="menu"`,
|
|
18
|
+
named "Switch company", with the acting company as the checked radio
|
|
19
|
+
item. With 6.3.3 the plate and chevron are one button that opens it, the
|
|
20
|
+
arrow keys move through it, and Escape or a pick gives focus back to the
|
|
21
|
+
button.
|
|
22
|
+
- As before, and now as links: the rows for other apps carry the catalogue
|
|
23
|
+
address with `?tenant=`, and the design system draws them as `<a href>`,
|
|
24
|
+
so a middle-click or a modified click opens them where the browser does,
|
|
25
|
+
while a plain click still opens them in the same tab.
|
|
26
|
+
- Back from another app out of the browser's back/forward cache, the frame
|
|
27
|
+
is where the URL is (6.3.3 re-syncs on `pageshow`).
|
|
28
|
+
- Apps change nothing but the two versions, in one commit. An app that
|
|
29
|
+
wires the design system's `WorkspaceFrame` to `osFrame` itself (Key
|
|
30
|
+
Accounts) gets the Settings fix by returning `false` from `onNavigate`
|
|
31
|
+
when `targetFor` returns null:
|
|
32
|
+
`onNavigate={(state) => { const t = FRAME.targetFor(state, here); if (!t) return false; ... }}`.
|
|
33
|
+
|
|
34
|
+
## 0.2.1 - 2026-09-29
|
|
35
|
+
|
|
36
|
+
A fix, with `autosolutions-design-system` 6.3.2. A click on the tab or row
|
|
37
|
+
the frame already shows goes to that tab's or row's own page from a page
|
|
38
|
+
filed under it. In Key Accounts a draft (`/drafts/$id`) files under the
|
|
39
|
+
Requests tab (`match: ["/drafts"]`); on a draft, clicking Requests (or
|
|
40
|
+
stepping out to Commercial and clicking Key accounts again) now goes to `/`,
|
|
41
|
+
as the old sidebar link did, where 0.2.0 stayed on the draft. In the Hub,
|
|
42
|
+
Unmarked Agent on an Agent thread goes to `/comms/agent`.
|
|
43
|
+
|
|
44
|
+
- `osFrame().targetFor` reads the design system's `reselect` flag
|
|
45
|
+
(`OsFrameState.reselect`). A reselected tab or row goes to its own `path`
|
|
46
|
+
unless the URL is exactly that path (the same pathname and the same
|
|
47
|
+
query), and nowhere when it is, so a click on the page you are on adds no
|
|
48
|
+
history entry. Settings, and Admin in the Hub, go back to their page from
|
|
49
|
+
a page under them.
|
|
50
|
+
- A reselect goes to the tab's own path and drops the page's query. Exactly
|
|
51
|
+
includes the query, so on `/analytics?range=90` Analytics goes to
|
|
52
|
+
`/analytics`, as the old sidebar links did. Tell app owners: a page that
|
|
53
|
+
keeps its filters or sort in the query starts again from its defaults
|
|
54
|
+
after that click.
|
|
55
|
+
- As before: a tab with no `path` (page state) goes nowhere; a row that
|
|
56
|
+
carries its own tab row in the page (`menu: false`, the Hub's Smart Comms)
|
|
57
|
+
stays on any view of its own; links to other apps open as they did;
|
|
58
|
+
opening a function's menu is not a navigation.
|
|
59
|
+
- A locked row goes nowhere from `targetFor`, whatever state it is handed.
|
|
60
|
+
The frame never reports a click on one, but a locked Hub row keeps its
|
|
61
|
+
`path` for its hint, and `targetFor` used to return it.
|
|
62
|
+
- `OsWorkspaceFrame` passes the flag through, and so does an app off the
|
|
63
|
+
core that hands `targetFor` the frame's state whole (Key Accounts does).
|
|
64
|
+
Apps change nothing but the two versions.
|
|
65
|
+
- The design-system peer range stays `>=6.3.0 <7`. With 6.3.0 or 6.3.1 the
|
|
66
|
+
flag never comes and this release behaves exactly as 0.2.0: the consumer
|
|
67
|
+
check on design system 6.3.1 passes every test but the new reselect ones.
|
|
68
|
+
Raising it to `>=6.3.2` would not stop the pairing that goes wrong, which
|
|
69
|
+
is design system 6.3.2 with os 0.2.0 (0.2.0's own range allows it).
|
|
70
|
+
|
|
71
|
+
**Take both together.** Design system 6.3.2 with os 0.2.0 is the one pairing
|
|
72
|
+
that misbehaves: 6.3.2 reports the click on the selected tab and 0.2.0's
|
|
73
|
+
`targetFor` does not know the flag, so where a tab's path is also its tool's
|
|
74
|
+
(Key Accounts' Requests at `/`), that click on the page you are on pushes a
|
|
75
|
+
second history entry for it. 0.2.0's peer range and the apps' caret ranges
|
|
76
|
+
allow that pairing, so the release order has to prevent it: publish os
|
|
77
|
+
0.2.1 no later than design system 6.3.2, and have each app bump both
|
|
78
|
+
packages in one commit (Key Accounts, e-sales and the Hub pin `^6.3.1` and
|
|
79
|
+
`^0.2.0` with lockfiles).
|
|
80
|
+
|
|
3
81
|
## 0.2.0 - 2026-09-28
|
|
4
82
|
|
|
5
83
|
The OS menu and the workspace frame. Needs `autosolutions-design-system` 6.3
|
package/README.md
CHANGED
|
@@ -35,8 +35,9 @@ export function App() {
|
|
|
35
35
|
the top bar with the company's mark and switcher, the rail, the OS menu (the 53
|
|
36
36
|
tools of the menu map: the handoff's 49 plus Shelf simulator, Key accounts, PM
|
|
37
37
|
Copilot and Candidate hub), the footer with Admin for people who manage something, and the
|
|
38
|
-
browser-tab icon. It needs `autosolutions-design-system` 6.3 or later
|
|
39
|
-
(an optional peer: only this entry point uses it).
|
|
38
|
+
browser-tab icon. It needs `autosolutions-design-system` 6.3.3 or later
|
|
39
|
+
(an optional peer: only this entry point uses it). Take this package's 0.2.2
|
|
40
|
+
and the design system's 6.3.3 together, in one commit.
|
|
40
41
|
|
|
41
42
|
```tsx
|
|
42
43
|
import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
@@ -60,9 +61,22 @@ import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
It works with any router: it reads `location` and calls `onNavigate(href)` for
|
|
63
|
-
paths inside the app, and opens other apps itself, in the same tab.
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
paths inside the app, and opens other apps itself, in the same tab. The rows
|
|
65
|
+
for other apps are links (`<a href>` with `?tenant=`), so a middle-click, a
|
|
66
|
+
Cmd or Ctrl click and Copy link work as the browser does them. Browser Back
|
|
67
|
+
moves the menus because the frame follows `location`, and it calls
|
|
68
|
+
`onNavigate` only when someone clicks, so there is no loop. Back from another
|
|
69
|
+
app out of the browser's back/forward cache puts the frame where the URL is,
|
|
70
|
+
and Settings clicked on the page it goes to (the Hub's Configuration) goes
|
|
71
|
+
nowhere and leaves the frame where it was. A click on the tab
|
|
72
|
+
or row the frame already shows goes to that tab's or row's own path from a
|
|
73
|
+
page under it (a draft filed under Requests goes back to Requests), and
|
|
74
|
+
nowhere when the URL is exactly that path. It goes to the tab's own path and
|
|
75
|
+
drops the page's query: on `/analytics?range=90`, Analytics goes to
|
|
76
|
+
`/analytics`, as the old sidebar links did, so a page that keeps its filters in
|
|
77
|
+
the query starts again from its defaults. The design system reports that
|
|
78
|
+
click from 6.3.2, which this package's 0.2.1 first read (the CHANGELOG says
|
|
79
|
+
why).
|
|
66
80
|
|
|
67
81
|
- `tools` are this app's own rows, by menu-map id, with their routes. They are
|
|
68
82
|
live whatever the map says. A row the map does not have takes `fn`, `section`,
|
|
@@ -88,7 +102,10 @@ Back moves the menus because the frame follows `location`, and it calls
|
|
|
88
102
|
Brand voice copywriter read "Live, not linked from the Hub yet", anything
|
|
89
103
|
not Live shows its status.
|
|
90
104
|
- The company plate is `markFor(tenant, "plain")`. The chevron appears only for
|
|
91
|
-
someone with more than one company
|
|
105
|
+
someone with more than one company, and then the plate and the chevron are
|
|
106
|
+
one button that opens the company menu: a menu of the companies, the acting
|
|
107
|
+
one checked, with arrow keys, and focus back on the button when it closes.
|
|
108
|
+
`companySwitch` says what it does:
|
|
92
109
|
- `"os"` (the default) switches exactly as `OsCompanySwitcher` does, since
|
|
93
110
|
both use `useCompanySwitch(os, appKey)`: `switch_company_for_app`, then a
|
|
94
111
|
reload or that company's deployment of this app.
|
|
@@ -141,8 +158,10 @@ const here = pathname + search;
|
|
|
141
158
|
location={{ ...frame.locate(here), href: here }}
|
|
142
159
|
onNavigate={(state) => {
|
|
143
160
|
const target = frame.targetFor(state, here);
|
|
144
|
-
if (target
|
|
145
|
-
|
|
161
|
+
if (!target) return false; // goes nowhere: the frame stays where `here` is
|
|
162
|
+
if (target.external) window.location.assign(target.href);
|
|
163
|
+
else navigate(target.href);
|
|
164
|
+
return true;
|
|
146
165
|
}}
|
|
147
166
|
onSignOut={signOut}
|
|
148
167
|
>
|
package/dist/frame.d.ts
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
5
5
|
* the same 53-tool menu and the same footer in every app, marks this app's own
|
|
6
6
|
* tools live, links the others through the catalogue, and puts the acting
|
|
7
|
-
* company's mark on the top bar's plate
|
|
7
|
+
* company's mark on the top bar's plate, which opens the company menu.
|
|
8
8
|
*
|
|
9
9
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
10
|
-
* query) and an `onNavigate(href)` that pushes an in-app path
|
|
11
|
-
* apps it
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
|
11
|
+
* apps are links, which it follows itself in the same tab (a middle-click or
|
|
12
|
+
* a modified click opens them where the browser does). Browser Back and
|
|
13
|
+
* Forward move the menus because the frame follows `location`, and it only
|
|
14
|
+
* calls `onNavigate` when someone clicks. A click on the tab or row it already shows, from a page
|
|
15
|
+
* filed under it (a draft under Requests), goes to that tab's own page.
|
|
14
16
|
*/
|
|
15
17
|
import { type ReactNode } from "react";
|
|
16
18
|
import type { WorkspaceState } from "autosolutions-design-system";
|
package/dist/frame.js
CHANGED
|
@@ -5,13 +5,15 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
6
6
|
* the same 53-tool menu and the same footer in every app, marks this app's own
|
|
7
7
|
* tools live, links the others through the catalogue, and puts the acting
|
|
8
|
-
* company's mark on the top bar's plate
|
|
8
|
+
* company's mark on the top bar's plate, which opens the company menu.
|
|
9
9
|
*
|
|
10
10
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
11
|
-
* query) and an `onNavigate(href)` that pushes an in-app path
|
|
12
|
-
* apps it
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
|
12
|
+
* apps are links, which it follows itself in the same tab (a middle-click or
|
|
13
|
+
* a modified click opens them where the browser does). Browser Back and
|
|
14
|
+
* Forward move the menus because the frame follows `location`, and it only
|
|
15
|
+
* calls `onNavigate` when someone clicks. A click on the tab or row it already shows, from a page
|
|
16
|
+
* filed under it (a draft under Requests), goes to that tab's own page.
|
|
15
17
|
*/
|
|
16
18
|
import { useEffect, useMemo, useState } from "react";
|
|
17
19
|
import { ActionList, TopBar, WorkspaceFrame } from "autosolutions-design-system";
|
|
@@ -59,19 +61,23 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
|
|
|
59
61
|
...(homePath ? { homePath } : {}),
|
|
60
62
|
});
|
|
61
63
|
}, [appKey, apps, admin, manages, slug, tools, hubItems, settingsPath, homePath]);
|
|
64
|
+
/* `false` tells the frame a click went nowhere (Settings on the page
|
|
65
|
+
Settings goes to), so it stays where the location puts it. */
|
|
62
66
|
const navigate = (state) => {
|
|
63
67
|
const target = frame.targetFor(state, location);
|
|
64
68
|
if (!target)
|
|
65
|
-
return;
|
|
69
|
+
return false;
|
|
66
70
|
if (target.external)
|
|
67
71
|
window.location.assign(target.href);
|
|
68
72
|
else
|
|
69
73
|
onNavigate(target.href);
|
|
74
|
+
return true;
|
|
70
75
|
};
|
|
71
76
|
const signOut = onSignOut ?? (() => {
|
|
72
77
|
void auth?.signOut().then(() => window.location.reload());
|
|
73
78
|
});
|
|
74
|
-
/* The company menu, offered only when there is somewhere to switch to
|
|
79
|
+
/* The company menu, offered only when there is somewhere to switch to: a
|
|
80
|
+
menu of radio items, the acting company checked. */
|
|
75
81
|
const pick = (tenant) => {
|
|
76
82
|
if (typeof companySwitch !== "function") {
|
|
77
83
|
void choose(tenant.id, () => setMenuOpen(false));
|
|
@@ -89,11 +95,12 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
|
|
|
89
95
|
.finally(() => setOwnBusy(false));
|
|
90
96
|
};
|
|
91
97
|
const switchable = companySwitch !== "none" && Boolean(current) && tenants.length > 1;
|
|
92
|
-
const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { sections: [{
|
|
98
|
+
const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { role: "menu", "aria-label": "Switch company", sections: [{
|
|
93
99
|
title: "Your companies",
|
|
94
100
|
items: tenants.map((tenant) => ({
|
|
95
101
|
content: tenant.name,
|
|
96
102
|
active: tenant.id === current.id,
|
|
103
|
+
checked: tenant.id === current.id,
|
|
97
104
|
disabled: busy,
|
|
98
105
|
prefix: _jsx("img", { className: "as-ws__company-mark", src: markFor(tenant, "plain"), alt: "" }),
|
|
99
106
|
onAction: () => pick(tenant),
|
package/dist/nav.d.ts
CHANGED
|
@@ -185,7 +185,10 @@ export type OsTarget = {
|
|
|
185
185
|
href: string;
|
|
186
186
|
external: boolean;
|
|
187
187
|
};
|
|
188
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* The part of WorkspaceFrame's state a destination depends on. `reselect` is
|
|
190
|
+
* WorkspaceFrame's flag for a click on what it already shows.
|
|
191
|
+
*/
|
|
189
192
|
export type OsFrameState = {
|
|
190
193
|
fn: {
|
|
191
194
|
id: string;
|
|
@@ -196,6 +199,7 @@ export type OsFrameState = {
|
|
|
196
199
|
tab: {
|
|
197
200
|
id: string;
|
|
198
201
|
} | null;
|
|
202
|
+
reselect?: boolean | undefined;
|
|
199
203
|
};
|
|
200
204
|
export type OsFrameOptions = {
|
|
201
205
|
/** This app's catalogue key; "hub" for the Hub itself. */
|
|
@@ -224,7 +228,13 @@ export type OsFrame = {
|
|
|
224
228
|
homeFunction: "hub";
|
|
225
229
|
/** Where a location (pathname plus query) sits in the frame. */
|
|
226
230
|
locate: (location: string) => OsLocation;
|
|
227
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* Where a click from `location` goes; null when it goes nowhere (opening a
|
|
233
|
+
* menu, a locked row, or already there). A reselect (`state.reselect`, a
|
|
234
|
+
* click on the tab or row the frame already shows) goes to that tab's or
|
|
235
|
+
* row's own path unless `location` is exactly it, so a page filed under a
|
|
236
|
+
* tab (a draft under Requests) goes back to the tab's page.
|
|
237
|
+
*/
|
|
228
238
|
targetFor: (state: OsFrameState, location: string) => OsTarget | null;
|
|
229
239
|
};
|
|
230
240
|
/**
|
package/dist/nav.js
CHANGED
|
@@ -374,15 +374,21 @@ export function osFrame(options) {
|
|
|
374
374
|
const targetFor = (state, location) => {
|
|
375
375
|
const fn = state.fn.id;
|
|
376
376
|
const here = locate(location);
|
|
377
|
+
const again = state.reselect === true;
|
|
377
378
|
const internal = (href, spot) => (here.fn === spot.fn && here.item === spot.item && here.tab === spot.tab ? null : { href, external: false });
|
|
379
|
+
/* A path of this app, unless the URL is exactly there already. */
|
|
380
|
+
const goTo = (href) => (at(location, href) ? null : { href, external: false });
|
|
378
381
|
if (fn === "settings") {
|
|
379
382
|
const path = settingsPath ?? (isHub ? HUB_PATHS.settings : undefined);
|
|
380
383
|
if (!path)
|
|
381
384
|
return toHub(HUB_PATHS.settings);
|
|
382
|
-
return
|
|
385
|
+
return goTo(path);
|
|
386
|
+
}
|
|
387
|
+
if (fn === "admin") {
|
|
388
|
+
if (!isHub)
|
|
389
|
+
return toHub(HUB_PATHS.admin);
|
|
390
|
+
return again ? goTo(HUB_PATHS.admin) : internal(HUB_PATHS.admin, { fn, item: null, tab: null });
|
|
383
391
|
}
|
|
384
|
-
if (fn === "admin")
|
|
385
|
-
return isHub ? internal(HUB_PATHS.admin, { fn, item: null, tab: null }) : toHub(HUB_PATHS.admin);
|
|
386
392
|
const row = state.item ? (sections[fn] ?? []).flatMap((section) => section.items).find((r) => r.id === state.item?.id) : undefined;
|
|
387
393
|
if (!row) {
|
|
388
394
|
if (fn !== "hub")
|
|
@@ -393,7 +399,21 @@ export function osFrame(options) {
|
|
|
393
399
|
const landing = locate(homePath);
|
|
394
400
|
return here.fn === landing.fn && here.item === landing.item ? null : { href: homePath, external: false };
|
|
395
401
|
}
|
|
402
|
+
if (row.disabled)
|
|
403
|
+
return null; // locked: the frame never reports a click on it, and it goes nowhere
|
|
396
404
|
const tab = state.tab ? flatTabs(row.tabs).find((t) => t.id === state.tab?.id) : undefined;
|
|
405
|
+
/* A click on the tab or row the frame already shows: its own path, from
|
|
406
|
+
anywhere under it (a draft filed under Requests, the Agent's threads),
|
|
407
|
+
and nothing when the URL is exactly that path. A tab with no path is
|
|
408
|
+
page state, with no page to go back to. A row that carries its own tab
|
|
409
|
+
row in the page (`menu: false`, the Hub's Smart Comms) keeps the rule
|
|
410
|
+
below: its page's tabs are all its own ground. */
|
|
411
|
+
if (again && row.menu !== false) {
|
|
412
|
+
if (tab)
|
|
413
|
+
return tab.path ? goTo(tab.path) : null;
|
|
414
|
+
if (row.path)
|
|
415
|
+
return goTo(row.path);
|
|
416
|
+
}
|
|
397
417
|
if (tab?.path)
|
|
398
418
|
return internal(tab.path, { fn, item: row.id, tab: tab.id });
|
|
399
419
|
if (row.path)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosolutions-os",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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.3.
|
|
24
|
+
"autosolutions-design-system": ">=6.3.3 <7",
|
|
25
25
|
"react": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|