feat(ext): PopupState org fields + context-aware message helper org branches
This commit is contained in:
@@ -4,11 +4,6 @@
|
|||||||
// the personal vault sends `list_items`/`get_item`; an org context sends the
|
// the personal vault sends `list_items`/`get_item`; an org context sends the
|
||||||
// org-scoped equivalents. The list + detail views consume these so neither has
|
// org-scoped equivalents. The list + detail views consume these so neither has
|
||||||
// to branch on context itself.
|
// to branch on context itself.
|
||||||
//
|
|
||||||
// SCAFFOLD STATE (HOLD until Dev-A merges): `currentContext()` is complete.
|
|
||||||
// `messageForList`/`messageForGet` return the PERSONAL message only; the org
|
|
||||||
// branch is held until Dev-A lands `org_list_items` / `org_get_item` in the
|
|
||||||
// `shared/messages.ts` Request union. Flip the two HOLD lines at integration.
|
|
||||||
|
|
||||||
import { getState } from './state';
|
import { getState } from './state';
|
||||||
import type { Request } from './messages';
|
import type { Request } from './messages';
|
||||||
@@ -18,11 +13,9 @@ export function currentContext(): 'personal' | string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function messageForList(): Request {
|
export function messageForList(): Request {
|
||||||
// HOLD(dev-a): in org context return { type: 'org_list_items' }.
|
return currentContext() === 'personal' ? { type: 'list_items' } : { type: 'org_list_items' };
|
||||||
return { type: 'list_items' };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function messageForGet(id: string): Request {
|
export function messageForGet(id: string): Request {
|
||||||
// HOLD(dev-a): in org context return { type: 'org_get_item', id }.
|
return currentContext() === 'personal' ? { type: 'get_item', id } : { type: 'org_get_item', id };
|
||||||
return { type: 'get_item', id };
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
// shared/state.ts can import without creating a popup→shared circular dep.
|
// shared/state.ts can import without creating a popup→shared circular dep.
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
Collection,
|
||||||
Item,
|
Item,
|
||||||
ItemId,
|
ItemId,
|
||||||
ItemType,
|
ItemType,
|
||||||
ManifestEntry,
|
ManifestEntry,
|
||||||
GeneratorRequest,
|
GeneratorRequest,
|
||||||
|
OrgConfigSummary,
|
||||||
VaultSettings,
|
VaultSettings,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
@@ -50,10 +52,11 @@ export interface PopupState {
|
|||||||
// Org (enterprise) context — Plan B (v0.9.0). `orgContext` is 'personal' or an
|
// Org (enterprise) context — Plan B (v0.9.0). `orgContext` is 'personal' or an
|
||||||
// orgId; `orgOffline` flags a degraded read-only org (set by org_switch). Optional
|
// orgId; `orgOffline` flags a degraded read-only org (set by org_switch). Optional
|
||||||
// so existing personal-only state constructions need no change; currentContext()
|
// so existing personal-only state constructions need no change; currentContext()
|
||||||
// (shared/org-context.ts) falls back to 'personal'. orgConfigs/orgCollections
|
// (shared/org-context.ts) falls back to 'personal'.
|
||||||
// (Dev-A's OrgConfigSummary[]/Collection[]) join at org-track integration.
|
|
||||||
orgContext?: 'personal' | string;
|
orgContext?: 'personal' | string;
|
||||||
orgOffline?: boolean;
|
orgOffline?: boolean;
|
||||||
|
orgConfigs?: OrgConfigSummary[];
|
||||||
|
orgCollections?: Collection[];
|
||||||
// Vault-tab-only fields. The popup surface leaves these at their defaults
|
// Vault-tab-only fields. The popup surface leaves these at their defaults
|
||||||
// (unlocked=false implicit via separate lock-screen view, drawer/panel false).
|
// (unlocked=false implicit via separate lock-screen view, drawer/panel false).
|
||||||
// Kept on the shared shape so VaultState satisfies StateHost.getState()
|
// Kept on the shared shape so VaultState satisfies StateHost.getState()
|
||||||
|
|||||||
Reference in New Issue
Block a user