autosolutions-os 0.3.12 → 0.3.14

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,73 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.14 - 2026-11-04
4
+
5
+ Operations > Forecast accuracy opened its sample page in the Hub, marked
6
+ " (*)", while Ops Hub has a real Forecast accuracy page since 4 November 2026
7
+ (frankhub #214). The owner said yes to linking it.
8
+
9
+ ### autosolutions-os/nav
10
+
11
+ - `OS_TOOL_LINKS["forecast-accuracy"]` is Ops Hub's `/forecast-accuracy`
12
+ (its Accuracy view; By item and Forecast vs actual are views of the same
13
+ page). Like Ops Hub's other rows: linked for someone who holds Ops Hub,
14
+ locked for someone who does not, and the fixed address in `staticLinks()`.
15
+ - The row loses the sample mark and gets no other: the page scores the
16
+ forecasts against what NetSuite says sold, and Ops Hub has a page for every
17
+ view the map gives it (Accuracy, By item, Forecast vs actual). So
18
+ `OS_TOOL_DATA` is unchanged: Retailer sell out (POS) is still the one
19
+ incomplete row.
20
+ - Someone who does not hold Ops Hub sees the row locked, where it opened the
21
+ Hub's sample page before, as Ops Hub's other rows are. Ops Hub now serves
22
+ fourteen rows.
23
+ - The core makes it an Ops Hub row too (migration
24
+ `hub_permissions_forecast_accuracy`): open only in a company that owns Ops
25
+ Hub, and holding it holds Ops Hub, as for Customers and Customer OTIF.
26
+ - Unchanged: every id, tab, route and other link.
27
+ - Apps take this release with a lockfile bump. An app whose tests list the
28
+ sample rows, or the rows that open Ops Hub, adds this one. Ops Hub lists it
29
+ as its own tool today (`ADOPTED_TOOLS` in its `ops-nav.ts`): when it takes
30
+ this release it empties that list, since its test asks for exactly the rows
31
+ that open Ops Hub, and the row would count twice.
32
+
33
+ ## 0.3.13 - 2026-11-04
34
+
35
+ The Hub's permissions in every menu. The core now keeps one setting per
36
+ person, per company, per item of the menu (core migration hub_permissions,
37
+ 4 Nov 2026: View for a dashboard, Member or Admin for a tool), and
38
+ `os_context()` returns the items the person holds in the acting company.
39
+
40
+ ### autosolutions-os
41
+
42
+ - `OsContext.items` (optional): menu id to level (`OsItemLevel`, "view",
43
+ "member" or "admin"). Absent from a core older than the permissions.
44
+
45
+ ### autosolutions-os/nav
46
+
47
+ - `itemLocks(items)`: every row of the menu map the items do not name, with
48
+ "Ask your company admin to switch this on for you". Nothing while the core
49
+ has not answered (`null`) or for a core without items (`undefined`): the
50
+ rows stay as before, and the pages and the server check again.
51
+ - `withItemLocks(catalogueLinks(...), items)`: the catalogue's links and
52
+ locks with those applied. A row the person may not open is locked and never
53
+ a link, even when its app is held: Ops Hub serves thirteen rows, and holding
54
+ one of them holds the app. A reason the catalogue gave stays.
55
+
56
+ - `OS_HUB_ROW_ITEMS` and `hubPanelLocks(items)`: the default Hub panel's
57
+ rows the person may not open (the seven Smart Comms views need Smart Comms
58
+ Hub, each tool its own item, Configuration none), for osFrame's new
59
+ `hubLocked` option, used when no `hubItems` are passed: a locked panel row
60
+ is shown, disabled, and never a link.
61
+
62
+ ### autosolutions-os/frame and autosolutions-os/core-view
63
+
64
+ - `OsWorkspaceFrame` applies them, so a sample page, a Finance report, an
65
+ Ops Hub row or a Hub tool the person may not open is greyed in every app's
66
+ menu, with the reason, and does not open. `useCoreFrame` (Ops Hub, Asset
67
+ Portal) does the same from the Hub's session: its `frameOptions` carry
68
+ `hubLocked` and the item locks. An app needs no code change. The Hub's own
69
+ panel still comes from the Hub (`hubItems`).
70
+
3
71
  ## 0.3.12 - 2026-11-04
4
72
 
5
73
  A review of every tab after 0.3.11 found two rows that opened sample pages in
package/README.md CHANGED
@@ -134,6 +134,17 @@ import { OsWorkspaceFrame } from "autosolutions-os/frame";
134
134
  With no `search` the bar's field is the OS menu search. An app with a search
135
135
  of its own passes it: `search={{ placeholder: "Search", value: query, onChange: setQuery }}`.
136
136
 
137
+ Since 0.3.13 the frame greys every row the person may not open: the core's
138
+ `os_context()` returns `items`, the items of the menu they hold in the acting
139
+ company (the Hub's permissions: View for a dashboard, Member or Admin for a
140
+ tool), and every row it does not name is locked with "Ask your company admin
141
+ to switch this on for you", even when its app is held (Ops Hub serves fourteen
142
+ rows since 0.3.14). Until the core answers, and with a core without `items`,
143
+ nothing new is locked (the pages and the server check again). `itemLocks(items)` and
144
+ `withItemLocks(catalogueLinks(...), items)` (`autosolutions-os/nav`) do the
145
+ same for a frame of your own, and `hubPanelLocks(items)` (osFrame's
146
+ `hubLocked`) greys the default Hub panel's rows the same way.
147
+
137
148
  It works with any router: it reads `location` and calls `onNavigate(href)` for
138
149
  paths inside the app, and opens other apps itself, in the same tab. The rows
139
150
  for other apps are links (`<a href>` with `?tenant=`), and so are this app's
@@ -260,10 +271,11 @@ why).
260
271
  for someone who holds it, and is locked for someone who does not, like
261
272
  Ops Hub's tools. In the Hub a locked row's page files under its function,
262
273
  with no row picked.
263
- - Three rows the map marks In progress open Ops Hub's real pages the same
264
- way: Commercial > Retailer sell out (POS) its POS dashboard (0.3.6), and
274
+ - Four rows the map marks In progress open Ops Hub's real pages the same
275
+ way: Commercial > Retailer sell out (POS) its POS dashboard (0.3.6),
265
276
  Commercial > Customers and Operations > Customer OTIF its Customers and
266
- Order OTIF pages (0.3.12).
277
+ Order OTIF pages (0.3.12), and Operations > Forecast accuracy its Forecast
278
+ accuracy page (0.3.14).
267
279
  - Admin appears when `my_admin_scope()` says the person manages something; pass
268
280
  `admin` to decide it yourself.
269
281
  - Every app shows the Hub panel (0.3.0, `OS_HUB_MENU`, the design's): Smart
package/dist/context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type OsApp, type OsContext, type OsContextStatus, type OsTenant } from "./contextCache.js";
2
- export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, watchOsAuth, type OsApp, type OsContext, type OsContextStatus, type OsTenant, } from "./contextCache.js";
2
+ export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, watchOsAuth, type OsApp, type OsContext, type OsContextStatus, type OsItemLevel, type OsTenant, } from "./contextCache.js";
3
3
  /** The context and where it stands, for a component that shows the difference. */
4
4
  export declare function useOsContextState(os: unknown): {
5
5
  context: OsContext | null;
@@ -19,10 +19,18 @@ export type OsApp = {
19
19
  designKey: string | null;
20
20
  labelUrl: string | null;
21
21
  };
22
+ /** A person's level on one item of the OS menu (core migration hub_permissions). */
23
+ export type OsItemLevel = "view" | "member" | "admin";
22
24
  export type OsContext = {
23
25
  tenant: OsTenant | null;
24
26
  tenants: OsTenant[];
25
27
  apps: OsApp[];
28
+ /**
29
+ * The items of the OS menu this person may open in the acting company, by
30
+ * menu id (0.3.13): a dashboard's level is "view", a tool's "member" or
31
+ * "admin". Absent from a core older than the Hub's permissions (4 Nov 2026).
32
+ */
33
+ items?: Record<string, OsItemLevel>;
26
34
  };
27
35
  /**
28
36
  * Where a reader's context stands: still being read, read, or failed (and
@@ -36,6 +36,8 @@ export type CoreFrameSource = "core" | "checking" | "static";
36
36
  export type CoreFrameOptionsForOsFrame = {
37
37
  links: Record<string, string>;
38
38
  locked: Record<string, string>;
39
+ /** The default Hub panel's rows the person may not open (0.3.13). */
40
+ hubLocked: Record<string, string>;
39
41
  admin: boolean;
40
42
  tenantSlug: string | null;
41
43
  };
package/dist/coreView.js CHANGED
@@ -32,7 +32,7 @@ import { retryOsContext } from "./context.js";
32
32
  import { followOsPerson } from "./contextCache.js";
33
33
  import { createCoreViewClient, hubSession } from "./coreReader.js";
34
34
  import { myAdminScope } from "./identity.js";
35
- import { catalogueLinks, staticLinks } from "./nav.js";
35
+ import { catalogueLinks, hubPanelLocks, staticLinks, withItemLocks } from "./nav.js";
36
36
  import { useOsPlate } from "./plate.js";
37
37
  export { CORE_VIEW_FUNCTIONS, createCoreViewClient, hubSession, } from "./coreReader.js";
38
38
  /** How often a page that stays open looks at the shared cookie again, besides focus and coming back into view. */
@@ -118,12 +118,17 @@ export function useCoreFrame({ appKey, email, fallback, companySwitch = "os" })
118
118
  const slug = current?.slug ?? null;
119
119
  const frameOptions = useMemo(() => {
120
120
  if (source === "static") {
121
- return { links: staticLinks(fallback.tenantSlug), locked: {}, admin: false, tenantSlug: fallback.tenantSlug };
121
+ return { links: staticLinks(fallback.tenantSlug), locked: {}, hubLocked: {}, admin: false, tenantSlug: fallback.tenantSlug };
122
122
  }
123
- /* "checking": apps is null, so nothing is linked and other apps' rows read as being checked. */
124
- const { links, locked } = catalogueLinks(source === "core" ? apps ?? null : null, source === "core" ? slug : null);
125
- return { links, locked, admin: source === "core" && manages, tenantSlug: source === "core" ? slug : null };
126
- }, [source, apps, slug, manages, fallback.tenantSlug]);
123
+ /* "checking": apps is null, so nothing is linked and other apps' rows read as being checked.
124
+ The core's items then lock every row the person may not open (0.3.13). */
125
+ const items = source === "core" ? context?.items : undefined;
126
+ const { links, locked } = withItemLocks(catalogueLinks(source === "core" ? apps ?? null : null, source === "core" ? slug : null), items);
127
+ return {
128
+ links, locked, hubLocked: hubPanelLocks(items),
129
+ admin: source === "core" && manages, tenantSlug: source === "core" ? slug : null,
130
+ };
131
+ }, [source, apps, context?.items, slug, manages, fallback.tenantSlug]);
127
132
  const staticPlate = useMemo(() => ({
128
133
  ...(fallback.companySrc ? { companySrc: fallback.companySrc } : {}),
129
134
  ...(fallback.companyName ? { companyName: fallback.companyName } : {}),
package/dist/frame.js CHANGED
@@ -30,7 +30,7 @@ import { useCallback, useEffect, useId, useMemo, useState } from "react";
30
30
  import { TopBar, WorkspaceFrame } from "autosolutions-design-system";
31
31
  import { retryOsContext, watchOsAuth } from "./context.js";
32
32
  import { myAdminScope } from "./identity.js";
33
- import { catalogueLinks, osFrame } from "./nav.js";
33
+ import { catalogueLinks, hubPanelLocks, osFrame, withItemLocks } from "./nav.js";
34
34
  import { useOsPlate } from "./plate.js";
35
35
  import { useMenuSearch } from "./search.js";
36
36
  /* This app's own rows and tabs as links to their paths. Rows for other apps
@@ -92,19 +92,24 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
92
92
  void retryOsContext(os);
93
93
  }, [location]);
94
94
  const apps = context?.apps;
95
+ /* The items this person may open (0.3.13): null until the core answers,
96
+ undefined from a core older than the Hub's permissions. */
97
+ const items = context ? context.items : null;
95
98
  const slug = current?.slug ?? null;
96
99
  const frame = useMemo(() => {
97
100
  /* Only the catalogue says what this person holds. Until it arrives (or
98
101
  while a failed read is asked again) nothing is linked and nothing is
99
- "not held" or "not linked": other apps' tools read as being checked. */
100
- const { links, locked } = catalogueLinks(apps ?? null, slug);
102
+ "not held" or "not linked": other apps' tools read as being checked.
103
+ The items then lock every row the person may not open, whatever serves
104
+ it (0.3.13). */
105
+ const { links, locked } = withItemLocks(catalogueLinks(apps ?? null, slug), items);
101
106
  return osFrame({
102
107
  appKey, links, locked, admin: admin ?? manages, tenantSlug: slug,
103
108
  ...(tools ? { tools } : {}),
104
- ...(hubItems ? { hubItems } : {}),
109
+ ...(hubItems ? { hubItems } : { hubLocked: hubPanelLocks(items) }),
105
110
  ...(homePath ? { homePath } : {}),
106
111
  });
107
- }, [appKey, apps, admin, manages, slug, tools, hubItems, homePath]);
112
+ }, [appKey, apps, items, admin, manages, slug, tools, hubItems, homePath]);
108
113
  const linkTo = hrefFor === undefined ? (path) => path : hrefFor;
109
114
  const sections = useMemo(() => (linkTo ? linked(frame.sections, linkTo) : frame.sections), [frame, hrefFor]);
110
115
  /* `false` tells the frame a click went nowhere (Settings on the page
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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
3
  export { adoptSharedSession, followSharedSession, publishSessionChanges, sharedSessionCookieName, joinChunks } from "./session.js";
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";
4
+ export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, watchOsAuth, useOsContext, useOsContextState, useTenant, useApps, groupApps, markFor, labelFor, withTenantHint, type OsContext, type OsContextStatus, type OsItemLevel, 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";
7
7
  export { OsAuthGate, type OsAuthGateProps } from "./gate.js";
package/dist/nav.d.ts CHANGED
@@ -178,8 +178,9 @@ export type OsToolLink = {
178
178
  *
179
179
  * Since 0.3.6: Commercial > Retailer sell out (POS) opens Ops Hub's POS
180
180
  * dashboard (/pos-dashboard), real NetSuite data, not its sample page in the
181
- * Hub. Operations > Forecast accuracy stays in the Hub: Ops Hub's /forecast
182
- * is the issued forecast, not a measure of past forecasts against actuals.
181
+ * Hub. Operations > Forecast accuracy stayed in the Hub until 0.3.14: Ops
182
+ * Hub's /forecast is the issued forecast, not a measure of past forecasts
183
+ * against actuals.
183
184
  *
184
185
  * Since 0.3.10 Candidate Hub (candidate_hub) has no entry: it is a standalone
185
186
  * app, in no other app's menu. This map is the only way a catalogue app
@@ -194,6 +195,14 @@ export type OsToolLink = {
194
195
  * sample pages in the Hub. Ops Hub has a page for every view the map gives
195
196
  * them, so neither is in OS_TOOL_DATA: no mark. Ops Hub's own menu had them
196
197
  * already (its ADOPTED_TOOLS).
198
+ *
199
+ * Since 0.3.14 (the owner's yes of 4 November 2026): Operations > Forecast
200
+ * accuracy opens Ops Hub's Forecast accuracy page (/forecast-accuracy: how
201
+ * far a forecast made 1 to 3 months ahead was from what NetSuite says sold),
202
+ * real data, not its sample page in the Hub. Ops Hub has a page for every
203
+ * view the map gives it (Accuracy, By item, Forecast vs actual), so it is not
204
+ * in OS_TOOL_DATA: no mark. Ops Hub's own menu had it already (its
205
+ * ADOPTED_TOOLS).
197
206
  */
198
207
  export declare const OS_TOOL_LINKS: Record<string, OsToolLink>;
199
208
  /** The Hub's own pages, for the rail's Hub, Admin and Settings rows in other apps. */
@@ -334,6 +343,45 @@ export declare function catalogueLinks(apps: ReadonlyArray<{
334
343
  links: Record<string, string>;
335
344
  locked: Record<string, string>;
336
345
  };
346
+ /**
347
+ * The rows of the menu map a person may not open (0.3.13). Since the core's
348
+ * permissions (migration hub_permissions, 4 Nov 2026) os_context().items
349
+ * names every item of the map the person holds in the acting company, a
350
+ * dashboard or a tool, whatever serves it; every row it does not name is
351
+ * locked, sample pages and Finance included, with "Ask your company admin to
352
+ * switch this on for you". Until the core has answered (`null`, or a read
353
+ * that failed and is being asked again), and from a core older than the
354
+ * permissions (`undefined`), nothing is locked here: the rows stay as they
355
+ * were before 0.3.13, the catalogue's own "Checking your access…" rows
356
+ * included, and the pages and the server check again.
357
+ */
358
+ export declare function itemLocks(items: Readonly<Record<string, string>> | null | undefined): Record<string, string>;
359
+ /**
360
+ * catalogueLinks' answer with itemLocks applied (0.3.13): a row the person may
361
+ * not open is locked even when its app is held, and is never a link. Ops Hub
362
+ * serves fourteen rows (0.3.14), and holding one of them holds the app. A
363
+ * reason the catalogue gave already stays.
364
+ */
365
+ export declare function withItemLocks(base: {
366
+ links: Record<string, string>;
367
+ locked: Record<string, string>;
368
+ }, items: Readonly<Record<string, string>> | null | undefined): {
369
+ links: Record<string, string>;
370
+ locked: Record<string, string>;
371
+ };
372
+ /**
373
+ * The Hub panel's rows and the item each needs (0.3.13): the seven Smart Comms
374
+ * views share Smart Comms Hub, each tool has its own, and Configuration
375
+ * (everyone's settings) needs none.
376
+ */
377
+ export declare const OS_HUB_ROW_ITEMS: Readonly<Record<string, string>>;
378
+ /**
379
+ * The rows of the default Hub panel (OS_HUB_MENU) a person may not open, by
380
+ * row id (0.3.13), for osFrame's `hubLocked`. As itemLocks: nothing while
381
+ * the core has not answered or has no items. The Hub passes its own panel
382
+ * (`hubItems`) and decides these itself.
383
+ */
384
+ export declare function hubPanelLocks(items: Readonly<Record<string, string>> | null | undefined): Record<string, string>;
337
385
  /** A route inside this app. `path` may carry a query, e.g. "/launcher?section=signature". */
338
386
  export type OsRoute = {
339
387
  /** Where a click goes. */
@@ -444,6 +492,11 @@ export type OsFrameOptions = {
444
492
  * goes to the Hub, as before 0.3.0.
445
493
  */
446
494
  hubItems?: OsHubSection[];
495
+ /**
496
+ * Row id of the default Hub panel to the reason it is off (hubPanelLocks,
497
+ * 0.3.13). Used only when `hubItems` is not given.
498
+ */
499
+ hubLocked?: Record<string, string>;
447
500
  /** Tool id to address, for tools served by other apps (catalogueLinks or staticLinks). Used as given. */
448
501
  links?: Record<string, string>;
449
502
  /** Tool id to the reason its row is off (catalogueLinks): wins over the tool's page in the Hub. */
package/dist/nav.js CHANGED
@@ -245,8 +245,9 @@ const opsHub = (path) => ({ app: "ops_hub", url: OPS_HUB, path });
245
245
  *
246
246
  * Since 0.3.6: Commercial > Retailer sell out (POS) opens Ops Hub's POS
247
247
  * dashboard (/pos-dashboard), real NetSuite data, not its sample page in the
248
- * Hub. Operations > Forecast accuracy stays in the Hub: Ops Hub's /forecast
249
- * is the issued forecast, not a measure of past forecasts against actuals.
248
+ * Hub. Operations > Forecast accuracy stayed in the Hub until 0.3.14: Ops
249
+ * Hub's /forecast is the issued forecast, not a measure of past forecasts
250
+ * against actuals.
250
251
  *
251
252
  * Since 0.3.10 Candidate Hub (candidate_hub) has no entry: it is a standalone
252
253
  * app, in no other app's menu. This map is the only way a catalogue app
@@ -261,6 +262,14 @@ const opsHub = (path) => ({ app: "ops_hub", url: OPS_HUB, path });
261
262
  * sample pages in the Hub. Ops Hub has a page for every view the map gives
262
263
  * them, so neither is in OS_TOOL_DATA: no mark. Ops Hub's own menu had them
263
264
  * already (its ADOPTED_TOOLS).
265
+ *
266
+ * Since 0.3.14 (the owner's yes of 4 November 2026): Operations > Forecast
267
+ * accuracy opens Ops Hub's Forecast accuracy page (/forecast-accuracy: how
268
+ * far a forecast made 1 to 3 months ahead was from what NetSuite says sold),
269
+ * real data, not its sample page in the Hub. Ops Hub has a page for every
270
+ * view the map gives it (Accuracy, By item, Forecast vs actual), so it is not
271
+ * in OS_TOOL_DATA: no mark. Ops Hub's own menu had it already (its
272
+ * ADOPTED_TOOLS).
264
273
  */
265
274
  export const OS_TOOL_LINKS = {
266
275
  "live-ecomm-sales": { app: "alive_reporting", url: "https://e-sales.autosolutions.app" },
@@ -290,6 +299,8 @@ export const OS_TOOL_LINKS = {
290
299
  "inventory-value": opsHub("/inventory-health?view=valuation"),
291
300
  /* Ops Hub's Order OTIF page (0.3.12). */
292
301
  "order-otif": opsHub("/customer-otif"),
302
+ /* Ops Hub's Forecast accuracy page, on its Accuracy view (0.3.14). */
303
+ "forecast-accuracy": opsHub("/forecast-accuracy"),
293
304
  "action-queue": opsHub("/action-queue"),
294
305
  "ordering-tool": opsHub("/ordering"),
295
306
  "carton-label-generator": { app: "label_maker", url: "https://label-maker.autosolutions.app" },
@@ -483,6 +494,80 @@ export function catalogueLinks(apps, tenantSlug = null) {
483
494
  }
484
495
  return { links, locked };
485
496
  }
497
+ /**
498
+ * The rows of the menu map a person may not open (0.3.13). Since the core's
499
+ * permissions (migration hub_permissions, 4 Nov 2026) os_context().items
500
+ * names every item of the map the person holds in the acting company, a
501
+ * dashboard or a tool, whatever serves it; every row it does not name is
502
+ * locked, sample pages and Finance included, with "Ask your company admin to
503
+ * switch this on for you". Until the core has answered (`null`, or a read
504
+ * that failed and is being asked again), and from a core older than the
505
+ * permissions (`undefined`), nothing is locked here: the rows stay as they
506
+ * were before 0.3.13, the catalogue's own "Checking your access…" rows
507
+ * included, and the pages and the server check again.
508
+ */
509
+ export function itemLocks(items) {
510
+ const out = {};
511
+ if (!items)
512
+ return out;
513
+ for (const groups of Object.values(OS_MENU)) {
514
+ for (const group of groups) {
515
+ for (const tool of group.items) {
516
+ if (!Object.prototype.hasOwnProperty.call(items, tool.id))
517
+ out[tool.id] = HINTS.locked;
518
+ }
519
+ }
520
+ }
521
+ return out;
522
+ }
523
+ /**
524
+ * catalogueLinks' answer with itemLocks applied (0.3.13): a row the person may
525
+ * not open is locked even when its app is held, and is never a link. Ops Hub
526
+ * serves fourteen rows (0.3.14), and holding one of them holds the app. A
527
+ * reason the catalogue gave already stays.
528
+ */
529
+ export function withItemLocks(base, items) {
530
+ const links = { ...base.links };
531
+ const locked = { ...base.locked };
532
+ for (const [id, reason] of Object.entries(itemLocks(items))) {
533
+ delete links[id];
534
+ locked[id] = locked[id] ?? reason;
535
+ }
536
+ return { links, locked };
537
+ }
538
+ /**
539
+ * The Hub panel's rows and the item each needs (0.3.13): the seven Smart Comms
540
+ * views share Smart Comms Hub, each tool has its own, and Configuration
541
+ * (everyone's settings) needs none.
542
+ */
543
+ export const OS_HUB_ROW_ITEMS = {
544
+ overview: "hub-comms",
545
+ inbox: "hub-comms",
546
+ calendar: "hub-comms",
547
+ tasks: "hub-comms",
548
+ slack: "hub-comms",
549
+ monday: "hub-comms",
550
+ accounts: "hub-comms",
551
+ agent: "hub-agent",
552
+ voice: "hub-voice",
553
+ signature: "hub-signature",
554
+ };
555
+ /**
556
+ * The rows of the default Hub panel (OS_HUB_MENU) a person may not open, by
557
+ * row id (0.3.13), for osFrame's `hubLocked`. As itemLocks: nothing while
558
+ * the core has not answered or has no items. The Hub passes its own panel
559
+ * (`hubItems`) and decides these itself.
560
+ */
561
+ export function hubPanelLocks(items) {
562
+ const out = {};
563
+ if (!items)
564
+ return out;
565
+ for (const [row, item] of Object.entries(OS_HUB_ROW_ITEMS)) {
566
+ if (!Object.prototype.hasOwnProperty.call(items, item))
567
+ out[row] = HINTS.locked;
568
+ }
569
+ return out;
570
+ }
486
571
  /**
487
572
  * The Hub's panel (0.3.0), the design's: Smart Comms Hub, its eight views,
488
573
  * then Tools (the owner's name since 0.3.9; Assistants before). Every app
@@ -580,7 +665,7 @@ function best(routes, location, exact = false) {
580
665
  * company, the footer, and the only routing logic the frame needs.
581
666
  */
582
667
  export function osFrame(options) {
583
- const { appKey, tools = [], hubItems, admin = false, hubUrl = HUB_URL, tenantSlug = null, } = options;
668
+ const { appKey, tools = [], hubItems, hubLocked = {}, admin = false, hubUrl = HUB_URL, tenantSlug = null, } = options;
584
669
  const links = underMenuIds(options.links ?? {});
585
670
  const locked = underMenuIds(options.locked ?? {});
586
671
  const isHub = appKey === "hub";
@@ -600,7 +685,12 @@ export function osFrame(options) {
600
685
  ? hubItems.map((section) => ({ ...section, items: [...section.items] }))
601
686
  : OS_HUB_MENU.map((section) => ({
602
687
  ...(section.title ? { title: section.title } : {}),
603
- items: section.items.map((row) => inHub({ id: row.id, label: row.label, ...(row.icon ? { icon: row.icon } : {}) }, row.path ?? HUB_PATHS.home, row.match)),
688
+ items: section.items.map((row) => {
689
+ const base = { id: row.id, label: row.label, ...(row.icon ? { icon: row.icon } : {}) };
690
+ /* A row the person may not open (0.3.13): shown, locked, never a link. */
691
+ const reason = hubLocked[row.id];
692
+ return reason ? { ...base, disabled: true, title: reason } : inHub(base, row.path ?? HUB_PATHS.home, row.match);
693
+ }),
604
694
  }));
605
695
  }
606
696
  for (const [fn, groups] of Object.entries(OS_MENU)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosolutions-os",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
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",