autosolutions-os 0.2.4 → 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 +201 -0
- package/README.md +87 -55
- package/dist/client.js +4 -1
- package/dist/frame.d.ts +13 -7
- package/dist/frame.js +5 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/nav.d.ts +118 -53
- package/dist/nav.js +254 -140
- package/dist/session.d.ts +33 -6
- package/dist/session.js +443 -25
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,206 @@
|
|
|
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
|
+
|
|
109
|
+
## 0.2.5 - 2026-10-15
|
|
110
|
+
|
|
111
|
+
Single sign-on fix. Signed in at the Hub, people opening an app were asked to
|
|
112
|
+
sign in with Google again (reported on 2026-10-14 for Artificial Design
|
|
113
|
+
Studio), and the Hub itself was often signed out an hour later.
|
|
114
|
+
|
|
115
|
+
- **The newest session wins.** `adoptSharedSession` copied the shared session
|
|
116
|
+
in only when the app had none of its own; when both existed it wrote the
|
|
117
|
+
app's own copy over the shared cookie. Supabase rotates refresh tokens and
|
|
118
|
+
accepts a retired one only one step behind or within 10 seconds; anything
|
|
119
|
+
older ends the session for every app (`refresh_token_already_used`). An app
|
|
120
|
+
opened again after the Hub had refreshed twice therefore wrote its old copy
|
|
121
|
+
over the Hub's, refreshed with a retired token and was signed out, and the
|
|
122
|
+
Hub with it. Now, wherever the two copies meet, the one that expires later is
|
|
123
|
+
kept (on a tie, the shared one): on load, and with `followSharedSession`
|
|
124
|
+
(below) when a tab becomes visible or gets focus and whenever supabase-js
|
|
125
|
+
reads its session, which it does before every refresh. An auth event no
|
|
126
|
+
longer writes over a newer shared copy.
|
|
127
|
+
- **A refresh on the wire keeps its result.** supabase-js (2.112 and later)
|
|
128
|
+
reads its stored session before and after a token request and throws the
|
|
129
|
+
rotated tokens away when the copy changed in between. While the page's own
|
|
130
|
+
refresh is in flight, a newer copy of the same person shared by another app
|
|
131
|
+
therefore waits for the next read; taken at once, it made supabase-js
|
|
132
|
+
discard a valid refresh (on supabase-js 2.112.3 a `getSession()` that
|
|
133
|
+
refreshed answered once with no session, and an explicit `refreshSession()`
|
|
134
|
+
reported "Refresh result discarded"). A different person signing in
|
|
135
|
+
elsewhere is still taken at once (the page reloads), so the refreshing
|
|
136
|
+
page's copy of the previous person cannot replace that sign-in.
|
|
137
|
+
- **Only an explicit sign-out clears the shared session, and it clears it
|
|
138
|
+
everywhere.** `client.auth.signOut()` (any scope but `"others"`) now leaves
|
|
139
|
+
a note, `sb-<ref>-auth-token-signed-out`, then clears the cookie and signs
|
|
140
|
+
out as before. The note holds the expiry of the newest copy it knew and the
|
|
141
|
+
`session_id` of each session the sign-out ended (`<expiry>|<id>.<id>`, the
|
|
142
|
+
last 8), a claim every refresh of one sign-in keeps. Every app drops a copy
|
|
143
|
+
that expires at or before the note, or of a session it names, instead of
|
|
144
|
+
sharing it again; until now an app still holding a copy put it back, and the
|
|
145
|
+
Hub took it on its next load. A failed refresh, another tab's `SIGNED_OUT`,
|
|
146
|
+
a missing local copy or blocked storage no longer clear anything.
|
|
147
|
+
- **A sign-out after an idle hour, or during a refresh, stays signed out.**
|
|
148
|
+
supabase-js refreshes an expired copy inside `signOut`, and waits for a
|
|
149
|
+
refresh already in flight, so a rotated copy can be saved and announced
|
|
150
|
+
after the note. It expires later than the note, so without more the Hub and
|
|
151
|
+
every app would load a session the server had just ended (its access token
|
|
152
|
+
stays valid for about an hour). The note's session ids keep such a copy
|
|
153
|
+
out, and `client.auth.signOut()` also leaves the note and clears the cookie
|
|
154
|
+
again once supabase-js has finished, so the note covers it by its expiry as
|
|
155
|
+
well, including a copy whose access token names no session.
|
|
156
|
+
- **A sign-out that does not happen changes nothing.** When supabase-js
|
|
157
|
+
reports a failed sign-out and still holds the session,
|
|
158
|
+
`client.auth.signOut()` puts the note back as it was before (none, or an
|
|
159
|
+
earlier sign-out's) and shares this page's copy again, so the person stays
|
|
160
|
+
signed in everywhere and can sign out again. Left in place, the note made
|
|
161
|
+
the next focus drop this page's copy and every other app's without a
|
|
162
|
+
logout, a second sign-out found no session and called nothing, and the
|
|
163
|
+
session stayed live on the server. supabase-js 2.106 (Smart LeadGen CRM's)
|
|
164
|
+
keeps the session when the server's logout fails (a 500 or a network error;
|
|
165
|
+
a 401, 403 or 404 still signs out), and every version keeps it when the
|
|
166
|
+
refresh it makes first fails on the network. supabase-js 2.112 and later
|
|
167
|
+
remove the session even when the logout fails: that is a sign-out on this
|
|
168
|
+
device, and it stays one everywhere. Two sign-outs at once (a double click)
|
|
169
|
+
count as one: the note goes back only when neither signed out.
|
|
170
|
+
- **Someone else signing in elsewhere replaces the session.** An open page
|
|
171
|
+
that was showing another person reloads, and so does a page on its sign-in
|
|
172
|
+
screen when a session arrives, so it shows that person: when the window
|
|
173
|
+
only gets focus (a click back into a window already in view, with no tab
|
|
174
|
+
switch) nothing tells supabase-js, and such a page would keep asking for
|
|
175
|
+
Google with a valid session stored. A page that has had no auth event yet
|
|
176
|
+
takes the session without reloading (its own first read shows it), and a
|
|
177
|
+
page on its sign-in screen does not reload when a copy that a sign-out
|
|
178
|
+
ended is dropped.
|
|
179
|
+
- **Storage and cookie errors never break sign-in.** The auth callback is now
|
|
180
|
+
guarded too: with cookies blocked, signing in threw a `SecurityError` to the
|
|
181
|
+
caller. A shared cookie read halfway through another app's write is left
|
|
182
|
+
alone instead of being taken for no session.
|
|
183
|
+
- **New: `followSharedSession(client, projectRef)`.** `createOsClient` calls
|
|
184
|
+
it; an app that builds its own client calls it once, right after
|
|
185
|
+
`publishSessionChanges`. It listens for the tab coming back, guards the
|
|
186
|
+
client's session reads (`client.auth.storage`, an internal of supabase-js:
|
|
187
|
+
feature-detected, and the tests fail if a supabase-js update moves it) and
|
|
188
|
+
makes `client.auth.signOut()` the explicit sign-out. `adoptSharedSession`
|
|
189
|
+
and `publishSessionChanges` keep their signatures.
|
|
190
|
+
|
|
191
|
+
### Upgrading
|
|
192
|
+
|
|
193
|
+
- An app on `createOsClient` (the Hub) takes 0.2.5 and changes nothing else.
|
|
194
|
+
From 0.2.4 nothing else is needed: the design-system peer range stays
|
|
195
|
+
`>=6.4.0 <7`.
|
|
196
|
+
- An app with its own copy of the session code replaces it with the 0.2.5
|
|
197
|
+
copy and adds the one `followSharedSession` call where it creates its
|
|
198
|
+
client. Until then it can still sign everyone out with a stale refresh, so
|
|
199
|
+
every app on the core needs one or the other.
|
|
200
|
+
- The Hub takes 0.2.5 before, or together with, the first app that takes the
|
|
201
|
+
copy: a Hub on an older version still lets its own copy win, and its
|
|
202
|
+
sign-out leaves no note.
|
|
203
|
+
|
|
3
204
|
## 0.2.4 - 2026-10-14
|
|
4
205
|
|
|
5
206
|
Released with `autosolutions-design-system` 6.4.0: the workspace frame in the
|
package/README.md
CHANGED
|
@@ -29,26 +29,46 @@ export function App() {
|
|
|
29
29
|
`supabase` is bound to your schema, so `.from("your_table")` works unchanged.
|
|
30
30
|
`os` is the same connection bound to `public`, for the platform's own functions.
|
|
31
31
|
|
|
32
|
+
## One sign-in across the apps
|
|
33
|
+
|
|
34
|
+
`createOsClient` keeps every app on one session: Supabase stores it in each
|
|
35
|
+
origin's localStorage, and the package mirrors it into a cookie on
|
|
36
|
+
`.autosolutions.app`. The newest copy always wins (on load, when a tab comes
|
|
37
|
+
back, and before supabase-js refreshes), only `supabase.auth.signOut()` clears
|
|
38
|
+
it, and it clears it in every app. A sign-out that does not happen (supabase-js
|
|
39
|
+
reports a failure and keeps the session) clears nothing, so the person can sign
|
|
40
|
+
out again. An app that builds its own Supabase client wires the same three calls
|
|
41
|
+
itself, in this order, at module scope:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { createClient } from "@supabase/supabase-js";
|
|
45
|
+
import { adoptSharedSession, followSharedSession, publishSessionChanges, coreProjectRef } from "autosolutions-os";
|
|
46
|
+
|
|
47
|
+
const ref = coreProjectRef();
|
|
48
|
+
adoptSharedSession(ref); // before the client reads its storage
|
|
49
|
+
const supabase = createClient(url, key, { auth: { persistSession: true, autoRefreshToken: true } });
|
|
50
|
+
publishSessionChanges(supabase, ref);
|
|
51
|
+
followSharedSession(supabase, ref);
|
|
52
|
+
```
|
|
53
|
+
|
|
32
54
|
## The workspace frame
|
|
33
55
|
|
|
34
56
|
`OsWorkspaceFrame` is the frame every app on the core renders around its pages:
|
|
35
|
-
the top bar with the company's mark and switcher, the rail, the OS menu (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rail's Hub (see below). The Hub's adoption of 0.2.3 updates its one test that
|
|
51
|
-
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).
|
|
52
72
|
|
|
53
73
|
```tsx
|
|
54
74
|
import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
@@ -98,33 +118,38 @@ why).
|
|
|
98
118
|
- `tools` are this app's own rows, by menu-map id, with their routes. They are
|
|
99
119
|
live whatever the map says. A row the map does not have takes `fn`, `section`,
|
|
100
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.
|
|
101
125
|
- `tabs` is a flat list, or titled groups (`{ title, items }[]`) drawn with the
|
|
102
|
-
menu's own section headings.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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:
|
|
108
135
|
- held, with an address: the tool goes there (plus its `path`) with
|
|
109
|
-
`?tenant
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
A tool's fixed `url` is
|
|
118
|
-
|
|
119
|
-
Brand voice copywriter read "Live, not linked from the Hub yet", anything
|
|
120
|
-
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()`).
|
|
121
146
|
- os_context() is read once per page and person: another person signing in
|
|
122
147
|
on the same browser, without a reload, reads their own (pass `auth`, the
|
|
123
148
|
app's `supabase.auth`, to have sign-ins followed live in this tab too). A
|
|
124
149
|
read that fails is asked again (1, 3, 10, 30 and 60 seconds on, when the
|
|
125
150
|
window comes back, and when the location changes), and until it answers
|
|
126
|
-
|
|
127
|
-
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.
|
|
128
153
|
- The company plate is `markFor(tenant, "plain")`. A company with no artwork
|
|
129
154
|
there (one outside the brand bucket's eight, with no stored logo), or whose
|
|
130
155
|
artwork fails to load, has its name on the plate instead (its whole name
|
|
@@ -147,7 +172,7 @@ why).
|
|
|
147
172
|
`refreshOsContext(os)` reads the core again (asking again if that fails).
|
|
148
173
|
The function reports its own failures.
|
|
149
174
|
- `actions` go in the top bar before the plate (What's new, a notification
|
|
150
|
-
bell). `panelFooter` renders in the panel under
|
|
175
|
+
bell). `panelFooter` renders in the tool's panel under its tabs, in the
|
|
151
176
|
panel's padding, scrolling with them (Create Studio's sessions).
|
|
152
177
|
- Settings goes to `settingsPath` when the app has a settings page, and to the
|
|
153
178
|
Hub's settings when it has none.
|
|
@@ -163,26 +188,33 @@ why).
|
|
|
163
188
|
applies. `data-*` and `aria-*` props land on the frame's root.
|
|
164
189
|
- Admin appears when `my_admin_scope()` says the person manages something; pass
|
|
165
190
|
`admin` to decide it yourself.
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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.
|
|
174
204
|
|
|
175
205
|
### Off the core
|
|
176
206
|
|
|
177
207
|
`autosolutions-os/nav` is plain data and functions, with no React and no
|
|
178
|
-
Supabase: the rail (`OS_FUNCTIONS`), the menu map (`OS_MENU`),
|
|
179
|
-
`
|
|
180
|
-
`
|
|
181
|
-
(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
|
186
218
|
system, import `autosolutions-design-system/frame.css` instead of `styles.css`
|
|
187
219
|
(see the design system's README).
|
|
188
220
|
|
|
@@ -200,7 +232,7 @@ const here = pathname + search;
|
|
|
200
232
|
footerItems={frame.footerItems}
|
|
201
233
|
location={{ ...frame.locate(here), href: here }}
|
|
202
234
|
onNavigate={(state) => {
|
|
203
|
-
// The state whole: `reselect`
|
|
235
|
+
// The state whole: `reselect` changes where it goes.
|
|
204
236
|
const target = frame.targetFor(state, here);
|
|
205
237
|
if (!target) return false; // goes nowhere: the frame stays where `here` is
|
|
206
238
|
if (target.external) window.location.assign(target.href);
|
package/dist/client.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { createClient } from "@supabase/supabase-js";
|
|
9
9
|
import { coreProjectRef, corePublishableKey, coreUrl } from "./config.js";
|
|
10
|
-
import { adoptSharedSession, publishSessionChanges } from "./session.js";
|
|
10
|
+
import { adoptSharedSession, followSharedSession, publishSessionChanges } from "./session.js";
|
|
11
11
|
let cached;
|
|
12
12
|
export function createOsClient(options) {
|
|
13
13
|
// One client per page. A second would keep its own session state and the two
|
|
@@ -24,6 +24,9 @@ export function createOsClient(options) {
|
|
|
24
24
|
});
|
|
25
25
|
// Signing in or out here carries to every other AutoSolutions app.
|
|
26
26
|
publishSessionChanges(supabase, ref);
|
|
27
|
+
// While the page is open the newest session wins: when the tab comes back,
|
|
28
|
+
// and before supabase-js refreshes, so it never refreshes with an older token.
|
|
29
|
+
followSharedSession(supabase, ref);
|
|
27
30
|
const client = {
|
|
28
31
|
supabase,
|
|
29
32
|
// Always take the explicit `public` view, so the type is the same whether or
|
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/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { coreUrl, corePublishableKey, coreProjectRef, companyMarkUrl, appLabelUrl, HUB_URL, PARENT_DOMAIN } from "./config.js";
|
|
2
2
|
export { createOsClient, resetOsClient, type OsClient } from "./client.js";
|
|
3
|
-
export { adoptSharedSession, publishSessionChanges, sharedSessionCookieName, joinChunks } from "./session.js";
|
|
3
|
+
export { adoptSharedSession, followSharedSession, publishSessionChanges, sharedSessionCookieName, joinChunks } from "./session.js";
|
|
4
4
|
export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, watchOsAuth, useOsContext, useOsContextState, useTenant, useApps, groupApps, markFor, labelFor, withTenantHint, type OsContext, type OsContextStatus, type OsTenant, type OsApp, } from "./context.js";
|
|
5
5
|
export { isEntitled, isActiveMember, appRole, appVariant, currentTenant, toolAllowed, myAdminScope, canManageCurrentCompany, type AdminScope, } from "./identity.js";
|
|
6
6
|
export { OsAppSwitcher, OsAppSwitcherPlate, OsCompanySwitcher, OsBar, useCompanySwitch } from "./chrome.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { coreUrl, corePublishableKey, coreProjectRef, companyMarkUrl, appLabelUrl, HUB_URL, PARENT_DOMAIN } from "./config.js";
|
|
2
2
|
export { createOsClient, resetOsClient } from "./client.js";
|
|
3
|
-
export { adoptSharedSession, publishSessionChanges, sharedSessionCookieName, joinChunks } from "./session.js";
|
|
3
|
+
export { adoptSharedSession, followSharedSession, publishSessionChanges, sharedSessionCookieName, joinChunks } from "./session.js";
|
|
4
4
|
export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, watchOsAuth, useOsContext, useOsContextState, useTenant, useApps, groupApps, markFor, labelFor, withTenantHint, } from "./context.js";
|
|
5
5
|
export { isEntitled, isActiveMember, appRole, appVariant, currentTenant, toolAllowed, myAdminScope, canManageCurrentCompany, } from "./identity.js";
|
|
6
6
|
export { OsAppSwitcher, OsAppSwitcherPlate, OsCompanySwitcher, OsBar, useCompanySwitch } from "./chrome.js";
|