autosolutions-os 0.2.1 → 0.2.3

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 CHANGED
@@ -1,5 +1,91 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 - 2026-10-01
4
+
5
+ With `autosolutions-design-system` 6.3.4, whose frame fixes this release
6
+ wires up. The design-system peer range is now `>=6.3.4 <7`: the Hub's rail
7
+ rule below tells Back to hub from the rail's Hub by 6.3.4's `back` flag,
8
+ and an older design system does not send it.
9
+
10
+ - **The rail's Hub, in the Hub, reopens its menu where the person is.**
11
+ After browsing another function's menu, the rail's Hub left any Hub page
12
+ that was not Smart Comms (an Agent thread, Brand Voice, the Signature
13
+ Generator) for `/comms/overview`: the thread or the form was gone, a
14
+ history entry was added, the Hub menu stayed closed, and from the
15
+ launcher focus fell to the page as the shell changed, all from a control
16
+ announced as "Hub, collapsed". `osFrame().targetFor` now answers the hub
17
+ function with no row with nothing (no navigation) when the URL is already
18
+ in that function and it has a menu, so the frame reopens the Hub menu on
19
+ the current page, expanded, focus kept, as it already did on the
20
+ Overview. From another place (Admin, or an app's own Settings) it still
21
+ lands on the Hub's landing, and Back to hub (`back: true`, design system
22
+ 6.3.4) lands there from anywhere, as before. Other apps are unchanged:
23
+ their rail Hub goes to the Hub.
24
+ - **A company with no artwork has its name on the plate.** With 6.3.4 the
25
+ plate shows the acting company's name when `markFor(tenant, "plain")`
26
+ does not load (a company outside the brand bucket's eight with no stored
27
+ logo, such as one created in Admin), where it showed a broken image.
28
+ `OsWorkspaceFrame` passes the name it always passed. In the company menu,
29
+ a company whose mark does not load keeps its name and drops the image.
30
+ - **Tab order** and **the bar on a phone** come with 6.3.4 and need nothing
31
+ here: an open menu is next in Tab order after its function, and at 767px
32
+ and below the bar fits the screen with the plate whole.
33
+ - **A direct caller of `targetFor` that means Back to hub passes
34
+ `back: true`.** In the Hub (`appKey: "hub"`), `targetFor` with the hub
35
+ function and no row, and no flag, now means the rail's Hub: from a Hub
36
+ page outside the landing (an Agent thread, Brand Voice, the Signature
37
+ Generator) it answers `null`, where 0.2.2 answered the landing. Back to
38
+ hub is `{ fn: { id: "hub" }, item: null, tab: null, back: true }`, which
39
+ still lands on the landing from anywhere. `OsWorkspaceFrame` passes the
40
+ frame's state whole, so an app that renders it changes nothing but the
41
+ two versions; so does an app that wires the design system's
42
+ `WorkspaceFrame` to `osFrame` itself and passes the state to `targetFor`
43
+ whole, `back` included. Outside the Hub nothing changes: the hub function
44
+ with no row goes to the Hub either way.
45
+ - **The Hub's adoption commit also updates one test.** Its
46
+ `src/launcher/nav.test.ts` models Back to hub ("lands Back to hub on the
47
+ Overview from anywhere off it") as the hub function with no row and no
48
+ flag, which fails on 0.2.3 for `/comms/agent/abc` and
49
+ `/launcher?section=brandvoice`. It builds the state with `back: true`
50
+ instead:
51
+
52
+ ```ts
53
+ const back: OsFrameState = { fn: { id: "hub" }, item: null, tab: null, back: true };
54
+ expect(frame(everyone, { location: from }).targetFor(back, from), from)
55
+ .toEqual({ href: "/comms/overview", external: false });
56
+ ```
57
+
58
+ ## 0.2.2 - 2026-09-30
59
+
60
+ With `autosolutions-design-system` 6.3.3, whose frame fixes this release
61
+ wires up. The design-system peer range is now `>=6.3.3 <7`: the company
62
+ menu below is marked up with 6.3.3's `ActionList` menu roles, which an
63
+ older design system would put on a list of plain buttons.
64
+
65
+ - **Settings on its own page stays put.** `OsWorkspaceFrame` now returns
66
+ `false` to the frame when `targetFor` finds nowhere to go. In the Hub,
67
+ Settings clicked on Configuration (`/comms/settings`, filed under Smart
68
+ Comms, no `settingsPath`) no longer moves the frame onto Settings: it
69
+ stays on Hub and Smart Comms, adds no history entry and keeps the tab
70
+ icon. The same holds for any rail item with no menu whose page is the
71
+ URL already.
72
+ - **The company menu is a menu.** It is an `ActionList` with `role="menu"`,
73
+ named "Switch company", with the acting company as the checked radio
74
+ item. With 6.3.3 the plate and chevron are one button that opens it, the
75
+ arrow keys move through it, and Escape or a pick gives focus back to the
76
+ button.
77
+ - As before, and now as links: the rows for other apps carry the catalogue
78
+ address with `?tenant=`, and the design system draws them as `<a href>`,
79
+ so a middle-click or a modified click opens them where the browser does,
80
+ while a plain click still opens them in the same tab.
81
+ - Back from another app out of the browser's back/forward cache, the frame
82
+ is where the URL is (6.3.3 re-syncs on `pageshow`).
83
+ - Apps change nothing but the two versions, in one commit. An app that
84
+ wires the design system's `WorkspaceFrame` to `osFrame` itself (Key
85
+ Accounts) gets the Settings fix by returning `false` from `onNavigate`
86
+ when `targetFor` returns null:
87
+ `onNavigate={(state) => { const t = FRAME.targetFor(state, here); if (!t) return false; ... }}`.
88
+
3
89
  ## 0.2.1 - 2026-09-29
4
90
 
5
91
  A fix, with `autosolutions-design-system` 6.3.2. A click on the tab or row
package/README.md CHANGED
@@ -35,8 +35,14 @@ 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.4 or later
39
+ (an optional peer: only this entry point uses it). Take this package's 0.2.3
40
+ and the design system's 6.3.4 together, in one commit. An app that renders
41
+ `OsWorkspaceFrame` changes nothing else. Code that calls `osFrame().targetFor`
42
+ itself in the Hub (a test of the Hub's rows, say) and means Back to hub passes
43
+ `back: true`: since 0.2.3 the hub function with no row and no flag is the
44
+ rail's Hub (see below). The Hub's adoption of 0.2.3 updates its one test that
45
+ does this (the CHANGELOG has the change).
40
46
 
41
47
  ```tsx
42
48
  import { OsWorkspaceFrame } from "autosolutions-os/frame";
@@ -60,16 +66,21 @@ import { OsWorkspaceFrame } from "autosolutions-os/frame";
60
66
  ```
61
67
 
62
68
  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. Browser
64
- Back moves the menus because the frame follows `location`, and it calls
65
- `onNavigate` only when someone clicks, so there is no loop. A click on the tab
69
+ paths inside the app, and opens other apps itself, in the same tab. The rows
70
+ for other apps are links (`<a href>` with `?tenant=`), so a middle-click, a
71
+ Cmd or Ctrl click and Copy link work as the browser does them. Browser Back
72
+ moves the menus because the frame follows `location`, and it calls
73
+ `onNavigate` only when someone clicks, so there is no loop. Back from another
74
+ app out of the browser's back/forward cache puts the frame where the URL is,
75
+ and Settings clicked on the page it goes to (the Hub's Configuration) goes
76
+ nowhere and leaves the frame where it was. A click on the tab
66
77
  or row the frame already shows goes to that tab's or row's own path from a
67
78
  page under it (a draft filed under Requests goes back to Requests), and
68
79
  nowhere when the URL is exactly that path. It goes to the tab's own path and
69
80
  drops the page's query: on `/analytics?range=90`, Analytics goes to
70
81
  `/analytics`, as the old sidebar links did, so a page that keeps its filters in
71
- the query starts again from its defaults. Design system 6.3.2 is what reports
72
- that click: take it together with this package's 0.2.1 (the CHANGELOG says
82
+ the query starts again from its defaults. The design system reports that
83
+ click from 6.3.2, which this package's 0.2.1 first read (the CHANGELOG says
73
84
  why).
74
85
 
75
86
  - `tools` are this app's own rows, by menu-map id, with their routes. They are
@@ -95,8 +106,14 @@ why).
95
106
  (`staticLinks()`). Tools with no app follow the map: Pricing researcher and
96
107
  Brand voice copywriter read "Live, not linked from the Hub yet", anything
97
108
  not Live shows its status.
98
- - The company plate is `markFor(tenant, "plain")`. The chevron appears only for
99
- someone with more than one company. `companySwitch` says what it does:
109
+ - The company plate is `markFor(tenant, "plain")`. A company with no artwork
110
+ there (one outside the brand bucket's eight, with no stored logo), or whose
111
+ artwork fails to load, has its name on the plate instead, and its row in
112
+ the company menu drops the broken mark. The chevron appears only for
113
+ someone with more than one company, and then the plate and the chevron are
114
+ one button that opens the company menu: a menu of the companies, the acting
115
+ one checked, with arrow keys, and focus back on the button when it closes.
116
+ `companySwitch` says what it does:
100
117
  - `"os"` (the default) switches exactly as `OsCompanySwitcher` does, since
101
118
  both use `useCompanySwitch(os, appKey)`: `switch_company_for_app`, then a
102
119
  reload or that company's deployment of this app.
@@ -118,7 +135,13 @@ why).
118
135
  - Admin appears when `my_admin_scope()` says the person manages something; pass
119
136
  `admin` to decide it yourself.
120
137
  - The Hub passes `hubItems`, its own rows. In any other app the rail's Hub, Back
121
- to hub and Admin go to the Hub.
138
+ to hub and Admin go to the Hub. In the Hub, the rail's Hub is its menu's
139
+ control: pressed after browsing another function's menu, it reopens the Hub
140
+ menu on the page the person is on (a thread, a tool, the Overview), with no
141
+ navigation. From another place (Admin, an app's Settings) it lands on the
142
+ Hub's landing, as Back to hub does from anywhere. `targetFor` tells the two
143
+ apart by the design system's `back` flag (6.3.4): the hub function with no
144
+ row is the rail's Hub, and with `back: true` it is Back to hub.
122
145
 
123
146
  ### Off the core
124
147
 
@@ -148,9 +171,12 @@ const here = pathname + search;
148
171
  footerItems={frame.footerItems}
149
172
  location={{ ...frame.locate(here), href: here }}
150
173
  onNavigate={(state) => {
174
+ // The state whole: `reselect` and `back` (Back to hub) change where it goes.
151
175
  const target = frame.targetFor(state, here);
152
- if (target?.external) window.location.assign(target.href);
153
- else if (target) navigate(target.href);
176
+ if (!target) return false; // goes nowhere: the frame stays where `here` is
177
+ if (target.external) window.location.assign(target.href);
178
+ else navigate(target.href);
179
+ return true;
154
180
  }}
155
181
  onSignOut={signOut}
156
182
  >
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 with the switcher behind its chevron.
7
+ * company's mark on the top bar's plate (its name, when it has no artwork or
8
+ * the artwork fails to load), which opens the company menu.
8
9
  *
9
10
  * It knows nothing about routers. Hand it the current location (pathname plus
10
- * query) and an `onNavigate(href)` that pushes an in-app path; links to other
11
- * apps it opens itself, in the same tab. Browser Back and Forward move the
12
- * menus because the frame follows `location`, and it only calls `onNavigate`
13
- * when someone clicks. A click on the tab or row it already shows, from a page
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
14
16
  * filed under it (a draft under Requests), goes to that tab's own page.
15
17
  */
16
18
  import { type ReactNode } from "react";
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 with the switcher behind its chevron.
8
+ * company's mark on the top bar's plate (its name, when it has no artwork or
9
+ * 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
- * query) and an `onNavigate(href)` that pushes an in-app path; links to other
12
- * apps it opens itself, in the same tab. Browser Back and Forward move the
13
- * menus because the frame follows `location`, and it only calls `onNavigate`
14
- * when someone clicks. A click on the tab or row it already shows, from a page
12
+ * query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
13
+ * apps are links, which it follows itself in the same tab (a middle-click or
14
+ * a modified click opens them where the browser does). Browser Back and
15
+ * Forward move the menus because the frame follows `location`, and it only
16
+ * calls `onNavigate` when someone clicks. A click on the tab or row it already shows, from a page
15
17
  * filed under it (a draft under Requests), goes to that tab's own page.
16
18
  */
17
19
  import { useEffect, useMemo, useState } from "react";
@@ -20,6 +22,15 @@ import { useCompanySwitch } from "./chrome.js";
20
22
  import { markFor, refreshOsContext } from "./context.js";
21
23
  import { myAdminScope } from "./identity.js";
22
24
  import { catalogueLinks, osFrame } from "./nav.js";
25
+ /* A company's mark in the company menu; nothing, never a broken image, when
26
+ its artwork does not load (the row already says the company's name). */
27
+ function CompanyMenuMark({ src }) {
28
+ const [failed, setFailed] = useState(null);
29
+ if (failed === src)
30
+ return null;
31
+ return _jsx("img", { className: "as-ws__company-mark", src: src, alt: "", onError: () => { if (failed !== src)
32
+ setFailed(src); } });
33
+ }
23
34
  export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location, onNavigate, search, actions, companySwitch = "os", panelFooter, onSignOut, settingsPath, homePath, admin, favicon = true, initialOpen, className, children, ...rest }) {
24
35
  /* Only data-* and aria-* reach the frame's root. */
25
36
  const attributes = Object.fromEntries(Object.entries(rest).filter(([key]) => /^(data|aria)-/.test(key)));
@@ -60,19 +71,23 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
60
71
  ...(homePath ? { homePath } : {}),
61
72
  });
62
73
  }, [appKey, apps, admin, manages, slug, tools, hubItems, settingsPath, homePath]);
74
+ /* `false` tells the frame a click went nowhere (Settings on the page
75
+ Settings goes to), so it stays where the location puts it. */
63
76
  const navigate = (state) => {
64
77
  const target = frame.targetFor(state, location);
65
78
  if (!target)
66
- return;
79
+ return false;
67
80
  if (target.external)
68
81
  window.location.assign(target.href);
69
82
  else
70
83
  onNavigate(target.href);
84
+ return true;
71
85
  };
72
86
  const signOut = onSignOut ?? (() => {
73
87
  void auth?.signOut().then(() => window.location.reload());
74
88
  });
75
- /* The company menu, offered only when there is somewhere to switch to. */
89
+ /* The company menu, offered only when there is somewhere to switch to: a
90
+ menu of radio items, the acting company checked. */
76
91
  const pick = (tenant) => {
77
92
  if (typeof companySwitch !== "function") {
78
93
  void choose(tenant.id, () => setMenuOpen(false));
@@ -90,16 +105,19 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
90
105
  .finally(() => setOwnBusy(false));
91
106
  };
92
107
  const switchable = companySwitch !== "none" && Boolean(current) && tenants.length > 1;
93
- const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { sections: [{
108
+ const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { role: "menu", "aria-label": "Switch company", sections: [{
94
109
  title: "Your companies",
95
110
  items: tenants.map((tenant) => ({
96
111
  content: tenant.name,
97
112
  active: tenant.id === current.id,
113
+ checked: tenant.id === current.id,
98
114
  disabled: busy,
99
- prefix: _jsx("img", { className: "as-ws__company-mark", src: markFor(tenant, "plain"), alt: "" }),
115
+ prefix: _jsx(CompanyMenuMark, { src: markFor(tenant, "plain") }),
100
116
  onAction: () => pick(tenant),
101
117
  })),
102
118
  }] }), busy && _jsx("div", { className: "as-ws__company-note", role: "status", children: "Switching\u2026" }), error && _jsx("div", { className: "as-ws__company-note as-ws__company-note--error", role: "alert", children: error })] })) : undefined;
103
- const topBar = (_jsx(TopBar, { variant: "workspace", searchPlaceholder: search?.placeholder ?? "Search", searchValue: search?.value, onSearchChange: search?.onChange, actions: actions, company: current?.slug ?? null, companySrc: current ? markFor(current, "plain") : undefined, companyName: current?.name, onSwitchCompany: switchable ? () => setMenuOpen((open) => !open) : undefined, companyMenu: companyMenu, companyMenuOpen: menuOpen, onCompanyMenuClose: () => setMenuOpen(false) }));
119
+ const topBar = (_jsx(TopBar, { variant: "workspace", searchPlaceholder: search?.placeholder ?? "Search", searchValue: search?.value, onSearchChange: search?.onChange, actions: actions, company: current?.slug ?? null, companySrc: current ? markFor(current, "plain") : undefined,
120
+ /* Also what the plate shows when the company has no artwork, or it fails to load. */
121
+ companyName: current?.name, onSwitchCompany: switchable ? () => setMenuOpen((open) => !open) : undefined, companyMenu: companyMenu, companyMenuOpen: menuOpen, onCompanyMenuClose: () => setMenuOpen(false) }));
104
122
  return (_jsx(WorkspaceFrame, { className: className, topBar: topBar, functions: frame.functions, sections: frame.sections, footerItems: frame.footerItems, homeFunction: frame.homeFunction, location: { ...frame.locate(location), href: location }, onNavigate: navigate, onSignOut: signOut, favicon: favicon, panelFooter: panelFooter, ...(initialOpen === undefined ? {} : { initialOpen }), ...attributes, children: children }));
105
123
  }
package/dist/nav.d.ts CHANGED
@@ -187,7 +187,8 @@ export type OsTarget = {
187
187
  };
188
188
  /**
189
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.
190
+ * WorkspaceFrame's flag for a click on what it already shows, `back` its flag
191
+ * for Back to hub (design system 6.3.4).
191
192
  */
192
193
  export type OsFrameState = {
193
194
  fn: {
@@ -200,6 +201,7 @@ export type OsFrameState = {
200
201
  id: string;
201
202
  } | null;
202
203
  reselect?: boolean | undefined;
204
+ back?: boolean | undefined;
203
205
  };
204
206
  export type OsFrameOptions = {
205
207
  /** This app's catalogue key; "hub" for the Hub itself. */
@@ -230,7 +232,10 @@ export type OsFrame = {
230
232
  locate: (location: string) => OsLocation;
231
233
  /**
232
234
  * 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
235
+ * menu, the rail's Hub inside the Hub, a locked row, or already there).
236
+ * In the Hub the hub function with no row is the rail's Hub; Back to hub
237
+ * is that state with `back: true`, so a caller that means it passes the
238
+ * flag. A reselect (`state.reselect`, a
234
239
  * click on the tab or row the frame already shows) goes to that tab's or
235
240
  * row's own path unless `location` is exactly it, so a page filed under a
236
241
  * tab (a draft under Requests) goes back to the tab's page.
package/dist/nav.js CHANGED
@@ -395,6 +395,12 @@ export function osFrame(options) {
395
395
  return null; // opening a function's menu is not a navigation
396
396
  if (!isHub)
397
397
  return toHub(HUB_PATHS.home);
398
+ /* The rail's Hub where the person is already in the Hub (a thread, a
399
+ tool, the landing) reopens its menu on that page: it is the menu's
400
+ control, never a navigation. Back to hub, and the rail's Hub from
401
+ another place (Admin, an app's Settings), land on the landing. */
402
+ if (!state.back && here.fn === fn && (sections[fn]?.length ?? 0) > 0)
403
+ return null;
398
404
  /* The Hub: stay anywhere on the landing's own ground, else land on it. */
399
405
  const landing = locate(homePath);
400
406
  return here.fn === landing.fn && here.item === landing.item ? null : { href: homePath, external: false };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosolutions-os",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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.0 <7",
24
+ "autosolutions-design-system": ">=6.3.4 <7",
25
25
  "react": ">=18"
26
26
  },
27
27
  "peerDependenciesMeta": {