feat(ext/sw): org_add_config message + handler (device-local org config write)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3b8DA2mXmLWkd4zDbHXHg
This commit is contained in:
adlee-was-taken
2026-06-27 12:23:57 -04:00
parent e370b06f85
commit 11e3aa41d1
5 changed files with 104 additions and 4 deletions

View File

@@ -101,6 +101,10 @@ export const ERROR_COPY: Record<string, ErrorCopy> = {
cta: { label: 'Open setup', action: 'open_setup' },
},
// --- Org (enterprise) context errors (v0.9.0 Plan B) ---
org_already_configured: {
title: 'Already added',
body: 'That organization is already configured on this device.',
},
org_not_configured: {
title: 'Org not set up here',
body: 'This organization is not configured on this device yet. Add it from the vault switcher before browsing its items.',

View File

@@ -1,7 +1,7 @@
import type {
Item, ItemId, Manifest, ManifestEntry, VaultConfig, SetupState,
DeviceSettings, GeneratorRequest, VaultSettings, AttachmentRef, Device,
FieldHistoryView, OrgConfigSummary, OrgManifestEntry, Collection,
FieldHistoryView, OrgConfig, OrgConfigSummary, OrgManifestEntry, Collection,
} from './types';
// --- Session timeout config ---
@@ -70,6 +70,7 @@ export type PopupMessage =
referenceImageBytes: ArrayBuffer; deviceName: string }
| { type: 'get_vault_status' }
| { type: 'org_list_configs' }
| { type: 'org_add_config'; config: OrgConfig }
| { type: 'org_switch'; context: string }
| { type: 'org_list_items' }
| { type: 'org_get_item'; id: string }
@@ -187,7 +188,7 @@ export const POPUP_ONLY_TYPES: ReadonlySet<PopupMessage['type']> = new Set([
'preview_totp_from_secret',
'generate_recovery_qr', 'unwrap_recovery_qr',
'create_vault', 'attach_vault', 'get_vault_status',
'org_list_configs',
'org_list_configs', 'org_add_config',
'org_switch', 'org_list_items', 'org_get_item', 'org_list_collections',
] as PopupMessage['type'][]);