@lavitre/apps 1.49.2 → 1.52.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.
Files changed (36) hide show
  1. package/README.md +38 -0
  2. package/dist/Common/Common.Model.d.ts +32 -2
  3. package/dist/Common/Common.Model.js.map +1 -1
  4. package/dist/Common/PreviewScaling.d.ts +62 -0
  5. package/dist/Common/PreviewScaling.js +132 -0
  6. package/dist/Common/PreviewScaling.js.map +1 -0
  7. package/dist/Common/index.d.ts +1 -0
  8. package/dist/Common/index.js +1 -0
  9. package/dist/Common/index.js.map +1 -1
  10. package/dist/CompanionFrame/CompanionFrame.d.ts +1 -1
  11. package/dist/CompanionFrame/CompanionFrame.js.map +1 -1
  12. package/dist/Connector/Connector.Model.d.ts +45 -2
  13. package/dist/Connector/Connector.Model.js.map +1 -1
  14. package/dist/Connector/Connector.js +6 -3
  15. package/dist/Connector/Connector.js.map +1 -1
  16. package/dist/Connector/SettingsSchema.d.ts +7 -0
  17. package/dist/Connector/SettingsSchema.js +19 -0
  18. package/dist/Connector/SettingsSchema.js.map +1 -0
  19. package/dist/Frame/Frame.Model.d.ts +10 -1
  20. package/dist/Frame/Frame.Model.js.map +1 -1
  21. package/dist/Frame/Frame.d.ts +31 -1
  22. package/dist/Frame/Frame.js +87 -2
  23. package/dist/Frame/Frame.js.map +1 -1
  24. package/dist/Frame/LocalPreview.d.ts +133 -0
  25. package/dist/Frame/LocalPreview.js +823 -0
  26. package/dist/Frame/LocalPreview.js.map +1 -0
  27. package/dist/Frame/ScaledStreamWorker.d.ts +9 -0
  28. package/dist/Frame/ScaledStreamWorker.js +34 -0
  29. package/dist/Frame/ScaledStreamWorker.js.map +1 -0
  30. package/dist/Frame/index.d.ts +1 -0
  31. package/dist/Frame/index.js +1 -0
  32. package/dist/Frame/index.js.map +1 -1
  33. package/dist/Version.d.ts +1 -1
  34. package/dist/Version.js +1 -1
  35. package/dist/Version.js.map +1 -1
  36. package/package.json +2 -1
@@ -82,10 +82,52 @@ export type ConnectorOptions = {
82
82
  * provided, this supersedes the deprecated singular `shareTarget`.
83
83
  */
84
84
  shareTargets?: ShareTargetOptions[];
85
- settingsSchema?: any;
85
+ /**
86
+ * The app's settings, rendered by the la Vitre settings form and read back from
87
+ * `hostInformation.settings`.
88
+ *
89
+ * This is a **map of fields**, NOT a full JSON schema: one key per setting, the
90
+ * same keys as `hostInformation.settings`. The host builds the enclosing
91
+ * `{ type: 'object', title: <app name>, properties: … }` itself.
92
+ *
93
+ * ```ts
94
+ * // RIGHT
95
+ * settingsSchema: {
96
+ * city: { type: 'string', title: 'City', default: 'Paris' },
97
+ * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },
98
+ * }
99
+ * // WRONG — a full JSON schema
100
+ * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }
101
+ * ```
102
+ */
103
+ settingsSchema?: SettingsSchemaProperties;
104
+ /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */
86
105
  settingsSchemaUI?: any;
87
106
  voiceActions?: VoiceAction[];
88
107
  };
108
+ /**
109
+ * One setting: the JSON-Schema subset the la Vitre settings form renders
110
+ * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with
111
+ * `properties`). Every nested `properties` value and `items` is itself a
112
+ * `SettingsFieldSchema` object, never a bare string; `required` is a list of key
113
+ * names on the enclosing object, never `required: true` on a field.
114
+ */
115
+ export type SettingsFieldSchema = {
116
+ type?: string;
117
+ title?: string;
118
+ description?: string;
119
+ default?: unknown;
120
+ enum?: unknown[];
121
+ enumNames?: string[];
122
+ items?: SettingsFieldSchema | SettingsFieldSchema[];
123
+ properties?: SettingsSchemaProperties;
124
+ required?: string[];
125
+ [keyword: string]: unknown;
126
+ };
127
+ /** A map of fields — see `ConnectorOptions.settingsSchema`. */
128
+ export type SettingsSchemaProperties = {
129
+ [field: string]: SettingsFieldSchema;
130
+ };
89
131
  export type ConnectorInitialized = {
90
132
  options: ConnectorOptions;
91
133
  };
@@ -140,7 +182,8 @@ export type SetRootMenu = {
140
182
  menu: RootMenuEntry[];
141
183
  };
142
184
  export type SettingsSchema = {
143
- schema: any;
185
+ /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */
186
+ schema: SettingsSchemaProperties;
144
187
  schemaUI: any;
145
188
  };
146
189
  export type SetFramePosition = {
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n FramePrivacy,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n MenuVisibility,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n OpenFrameOptions,\n PendingDevicesInfo,\n PositionType,\n PositionUpdated,\n PrivacyChanged,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n UpdateState,\n ViewMode,\n Visibility,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\n\nexport type InitializeConnector = {\n hostInfo: HostInformation\n appId?: string\n state?: Record<string, any>\n}\n\nexport type RegExpDefinition = {\n pattern: string\n options: string\n}\n\nexport type ShareTargetOptions = {\n name?: string\n urlDomains?: string[]\n urlRegex?: string[]\n urlRegexWithOptions?: RegExpDefinition[]\n files?: FileShareTarget[]\n /**\n * Icon shown for this share target in the companion import picker. A bitmap\n * (full colour). May be a path relative to the connector URL — the host\n * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are\n * set, the companion prefers `maskIconUrl`. When neither is set the picker\n * falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this share target, tinted by the companion theme\n * (CSS `mask`). May be relative to the connector URL — resolved absolute by\n * the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n}\n\nexport type FileShareTarget = {\n fileExtension?: string\n fileExtensionRegex?: RegExpDefinition\n binaryHeader?: ArrayBufferLike\n mimeTypes?: string[]\n tag?: any\n id: string\n}\n\nexport type MenuCategoryInfo = {\n type: 'mainMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type SettingsMenuCategoryInfo = {\n type: 'settingsMenu'\n label?: string\n description?: string\n}\n\nexport type MainMenuQuickActions = {\n type: 'mainMenuQuickActions'\n label?: string\n description?: string\n order?: number\n}\n\nexport type ExportMenuCategory = {\n type: 'exportMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type RootMenuCategory =\n | { type: 'desktopIcons' }\n | MainMenuQuickActions\n | MenuCategoryInfo\n | SettingsMenuCategoryInfo\n | ExportMenuCategory\n\nexport type RootMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: RootMenuCategory\n}\n\nexport type ConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n /**\n * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it\n * and ignores this field. Kept on the wire for older Vitres that only read a\n * single share target — the SDK mirrors `shareTargets[0]` here automatically.\n */\n shareTarget?: ShareTargetOptions\n /**\n * Share targets advertised by this app. Several may be declared so an app can\n * receive distinct kinds of content (each with its own `name`/matchers). When\n * provided, this supersedes the deprecated singular `shareTarget`.\n */\n shareTargets?: ShareTargetOptions[]\n settingsSchema?: any\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n}\n\nexport type ConnectorInitialized = {\n options: ConnectorOptions\n}\n\nexport type OpenFrame = {\n options: OpenFrameOptions\n}\n\nexport type OpenLocalFrame = {\n options: OpenFrameOptions\n}\n\nexport type EnumerateMediaDevices = {\n requestId: string\n}\n\nexport type OpenStream = {\n requestId: string\n streamId: string\n constraints: MediaStreamConstraints\n}\n\nexport type OpenStreamFrame = {\n constraints?: MediaStreamConstraints\n streamSourceUrl?: string\n requestId: string\n frameConnectorId: string\n name: string\n url: string\n allowFullscreen?: boolean\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n interaction?: Interaction\n resizeMode?: ResizeMode\n mode?: ViewMode\n data?: any\n file?: FileData\n privacy?: FramePrivacy\n mirrorInitiatorStream?: boolean\n size?: Size\n minSize?: Size\n maxSize?: Size\n startInteractive?: boolean\n border?: BorderOptions\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n visibility?: Visibility\n menuVisibility?: MenuVisibility\n closable?: boolean\n closeLabel?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n schema: any\n schemaUI: any\n}\n\nexport type SetFramePosition = {\n frameConnectorId: string\n position: LayoutPosition\n}\n\nexport type CloseFrame = {\n frameConnectorId: string\n}\n\nexport type SetFrameOwner = {\n frameConnectorId: string\n /** Device id of the new owner (HostInformation.devicesInSpace[].id). */\n owner: string\n}\n\n/// Live update of an already-open frame's shared-content style (background /\n/// box-shadow / drop-shadow surface, and companion icon). Emitted by\n/// `connector.setChromeStyle`. Only the provided fields are changed; the others\n/// keep their current value.\nexport type SetChromeStyle = {\n frameConnectorId: string\n} & ChromeStyle\n\n/// Host→app notification that an already-open shared frame's owner was\n/// reassigned via `setFrameOwner`, INCLUDING changes initiated by another\n/// device in the space. Surfaced on the SDK `Connector` as\n/// `onFrameOwnerChanged`. `owner` is the new owner's device id\n/// (HostInformation.devicesInSpace[].id).\nexport type FrameOwnerChanged = {\n frameConnectorId: string\n owner: string\n}\n\n/**\n * @deprecated Use `SetShareTargets` (`setShareTargets`).\n */\nexport type SetShareTarget = {\n shareTarget: ShareTargetOptions\n}\n\nexport type SetShareTargets = {\n shareTargets: ShareTargetOptions[]\n}\n\nexport type FrameUnloaded = {\n frameConnectorId: string\n}\n\nexport type FrameInfo = {\n frameConnectorId: string\n zIndex: number\n}\n\nexport type ShareDataReceived = {\n data: ShareData\n}\n\nexport type FileShareDataReceived = {\n data: FileData\n}\n\nexport type ShareData = {\n url: string\n}\n\nexport type TrackKind = 'audio' | 'video'\n\nexport type MediaTrackInfo = {\n id: string\n kind: TrackKind\n deviceName: string\n capabilities: MediaTrackCapabilities\n settings: MediaTrackSettings\n}\n\nexport type OpenStreamCompleted = {\n requestId: string\n streamId: string\n error?: string\n tracks?: MediaTrackInfo[]\n}\n\n/// One track of an app-provided shared stream. `readable` is the transferable\n/// output of a `MediaStreamTrackProcessor` (breakout box) — the host rebuilds a\n/// live `MediaStreamTrack` from it via `MediaStreamTrackGenerator`. Listed in\n/// the postMessage transfer list, so the host receives the SAME stream\n/// zero-copy (no re-encode) — works only when app and host are same-site\n/// (e.g. `*.apps.lavit.re` ↔ `app.lavit.re`) and Chromium.\nexport type ShareStreamTrack = {\n kind: TrackKind\n readable: ReadableStream\n settings?: MediaTrackSettings\n}\n\nexport type ShareStreamOptions = {\n /** Display label for the share (defaults to the app name). */\n name?: string\n /** Source resolution hint, used by the host to size the share. */\n width?: number\n height?: number\n /**\n * Controls how remote peers render this shared stream.\n *\n * - `'appFrame'` (default when absent): receivers load the app iframe, exactly\n * as before this field existed. N-1 receivers that do not know this field\n * will behave as `'appFrame'` automatically (backward-compatible).\n * - `'standard'`: receivers render a classic shared-video languette without\n * loading the app iframe. Use when the app provides raw video/audio and the\n * frame UI is not meaningful on the receiver side (e.g. a camera feed).\n */\n receiverDisplay?: 'standard' | 'appFrame'\n}\n\nexport type ShareStream = {\n requestId: string\n sharedStreamId: string\n options?: ShareStreamOptions\n tracks: ShareStreamTrack[]\n}\n\n/// Swap the source track(s) of an already-open app share WITHOUT closing it.\n/// The host swaps the underlying track in place (sender.replaceTrack on the\n/// vitre→peer side, no renegotiation), so peers see continuity.\nexport type ReplaceShareStream = {\n requestId: string\n sharedStreamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type StopShareStream = {\n sharedStreamId: string\n}\n\nexport type ShareStreamCompleted = {\n requestId: string\n sharedStreamId: string\n error?: string\n}\n\nexport type OpenStreamFrameCompleted = {\n requestId: string\n error?: string\n tracks?: MediaTrackInfo[]\n streamSourceUrl?: string\n}\n\nexport type EnumerateMediaDevicesCompleted = {\n requestId: string\n devices: ConnectedMediaDevice[]\n}\n\nexport type FramePositionUpdated = {\n frameConnectorId: string\n} & PositionUpdated\n\nexport type ExternalMessageReceived = {\n requestId: string\n appId: string\n message: any\n apiKeyId: string\n apiKeyName: string\n}\n\nexport type ExternalMessageResponseData = {\n requestId: string\n response?: any\n}\n\nexport type RequestAppTokenData = {\n requestId: string\n}\n\nexport type AppTokenReceivedData = {\n requestId: string\n token?: string\n error?: string\n}\n\nexport type ExecuteInFrameData = {\n requestId: string\n /** Must match the `name` attribute of the <iframe> embedded in frame.html. */\n frameName: string\n /** Runs as a function body — use `return <expr>` to yield a value. */\n code: string\n}\n\nexport type ExecuteInFrameResultData = {\n requestId: string\n /** JSON string of the injected code's return value; absent on error. */\n result?: string\n error?: string\n}\n\nexport type SetFrameSize = {\n frameId: string\n size: Size\n}\n\n/// Inbound to a Vitre `Connector` from a companion-side\n/// `CompanionConnector` (same `appId`). `fromCompanionId` is the\n/// connection-id of the sending companion so the Vitre connector can reply\n/// targeted-back via `sendMessageToCompanionConnector`.\nexport type MessageFromCompanionConnector = {\n fromCompanionId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a companion FRAME sent a message via\n/// `CompanionFrame.sendMessageToVitreConnector` (works for a local companion\n/// frame with no paired Vitre frame). Carries the `frameConnectorId` of the\n/// companion frame that spoke, on top of the connector-message shape.\nexport type MessageFromCompanionFrame = {\n fromCompanionId: string\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a connected companion clicks a\n/// menu entry that lives on a frame's options menu AND was declared with\n/// `availability: 'companion'` (or `'companionAdmin'`). The click did NOT\n/// fire on the Vitre — it fired on the companion-side render of the\n/// frame's options. The Vitre-side connector receives this so the app\n/// can react (typically: call `openCompanionFrame` from the companion's\n/// main connector, or push state into the frame). Distinct from\n/// `menuClicked` so apps that only care about Vitre-side menu clicks\n/// don't get woken up by companion clicks.\n///\n/// `frameConnectorId` is the id of the frame whose options menu was\n/// clicked; `fromCompanionId` is the connection-id of the clicker so\n/// targeted reactions are possible.\nexport type FrameMenuClickedOnCompanion = {\n frameConnectorId: string\n fromCompanionId: string\n menuId: string\n isChecked: boolean\n tag?: any\n}\n\n/// Target for `sendMessageToCompanionConnector` — broadcast to every\n/// companion currently connected to the Vitre, or address a single\n/// companion by id. Discriminated on `kind` so the union is unambiguous\n/// for callers and for the host that routes on this shape (a structural\n/// `{ all: true } | { companionId }` would let `{ all: true, companionId }`\n/// slip past the type system via an intermediate variable).\nexport type CompanionConnectorTarget =\n | { kind: 'all' }\n | { kind: 'one'; companionId: string }\n\n/// Payload emitted by a Vitre `Connector` when it wants to talk to the\n/// companion-side `CompanionConnector` for the same `appId`.\nexport type SendMessageToCompanionConnector = {\n target: CompanionConnectorTarget\n message: string\n fileData?: FileData\n}\n\nexport type ConnectorApiMessagesIn =\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'initialize' } & InitializeConnector)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'shareDataReceived' } & ShareDataReceived)\n | ({ type: 'fileShareDataReceived' } & FileShareDataReceived)\n | ({ type: 'frameLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoading' } & OpenFrame)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'frameUnloaded' } & FrameUnloaded)\n | ({\n type: 'enumerateMediaDevicesCompleted'\n } & EnumerateMediaDevicesCompleted)\n | ({ type: 'openStreamCompleted' } & OpenStreamCompleted)\n | ({ type: 'openStreamFrameCompleted' } & OpenStreamFrameCompleted)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'frameZIndexChanged' } & FrameInfo)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | ({ type: 'framePositionUpdated' } & FramePositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'statsResponse' } & StatsResponse)\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'externalMessageReceived' } & ExternalMessageReceived)\n | ({ type: 'appTokenReceived' } & AppTokenReceivedData)\n | ({ type: 'executeInFrameResult' } & ExecuteInFrameResultData)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'messageFromCompanionConnector'\n } & MessageFromCompanionConnector)\n | ({\n type: 'messageFromCompanionFrame'\n } & MessageFromCompanionFrame)\n | ({\n type: 'frameMenuClickedOnCompanion'\n } & FrameMenuClickedOnCompanion)\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\nexport type ConnectorApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'connectorInitialized' } & ConnectorInitialized)\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'openLocalFrame' } & OpenLocalFrame)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'enumerateMediaDevices' } & EnumerateMediaDevices)\n | ({ type: 'openStream' } & OpenStream)\n | ({ type: 'openStreamFrame' } & OpenStreamFrame)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | ({ type: 'setRootMenu' } & SetRootMenu)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setShareTarget' } & SetShareTarget)\n | ({ type: 'setShareTargets' } & SetShareTargets)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'appMessage' } & AppMessage)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setSettingsSchema' } & SettingsSchema)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n | ({ type: 'setChromeStyle' } & SetChromeStyle)\n | ({ type: 'setFramePosition' } & SetFramePosition)\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'externalMessageResponse' } & ExternalMessageResponseData)\n | ({ type: 'requestAppToken' } & RequestAppTokenData)\n | ({ type: 'executeInFrame' } & ExecuteInFrameData)\n | ({ type: 'setFrameSize' } & SetFrameSize)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'sendMessageToCompanionConnector'\n } & SendMessageToCompanionConnector)\n"]}
1
+ {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n FramePrivacy,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n MenuVisibility,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n OpenFrameOptions,\n PendingDevicesInfo,\n PositionType,\n PositionUpdated,\n PrivacyChanged,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n UpdateState,\n ViewMode,\n Visibility,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\n\nexport type InitializeConnector = {\n hostInfo: HostInformation\n appId?: string\n state?: Record<string, any>\n}\n\nexport type RegExpDefinition = {\n pattern: string\n options: string\n}\n\nexport type ShareTargetOptions = {\n name?: string\n urlDomains?: string[]\n urlRegex?: string[]\n urlRegexWithOptions?: RegExpDefinition[]\n files?: FileShareTarget[]\n /**\n * Icon shown for this share target in the companion import picker. A bitmap\n * (full colour). May be a path relative to the connector URL — the host\n * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are\n * set, the companion prefers `maskIconUrl`. When neither is set the picker\n * falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this share target, tinted by the companion theme\n * (CSS `mask`). May be relative to the connector URL — resolved absolute by\n * the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n}\n\nexport type FileShareTarget = {\n fileExtension?: string\n fileExtensionRegex?: RegExpDefinition\n binaryHeader?: ArrayBufferLike\n mimeTypes?: string[]\n tag?: any\n id: string\n}\n\nexport type MenuCategoryInfo = {\n type: 'mainMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type SettingsMenuCategoryInfo = {\n type: 'settingsMenu'\n label?: string\n description?: string\n}\n\nexport type MainMenuQuickActions = {\n type: 'mainMenuQuickActions'\n label?: string\n description?: string\n order?: number\n}\n\nexport type ExportMenuCategory = {\n type: 'exportMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type RootMenuCategory =\n | { type: 'desktopIcons' }\n | MainMenuQuickActions\n | MenuCategoryInfo\n | SettingsMenuCategoryInfo\n | ExportMenuCategory\n\nexport type RootMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: RootMenuCategory\n}\n\nexport type ConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n /**\n * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it\n * and ignores this field. Kept on the wire for older Vitres that only read a\n * single share target — the SDK mirrors `shareTargets[0]` here automatically.\n */\n shareTarget?: ShareTargetOptions\n /**\n * Share targets advertised by this app. Several may be declared so an app can\n * receive distinct kinds of content (each with its own `name`/matchers). When\n * provided, this supersedes the deprecated singular `shareTarget`.\n */\n shareTargets?: ShareTargetOptions[]\n /**\n * The app's settings, rendered by the la Vitre settings form and read back from\n * `hostInformation.settings`.\n *\n * This is a **map of fields**, NOT a full JSON schema: one key per setting, the\n * same keys as `hostInformation.settings`. The host builds the enclosing\n * `{ type: 'object', title: <app name>, properties: … }` itself.\n *\n * ```ts\n * // RIGHT\n * settingsSchema: {\n * city: { type: 'string', title: 'City', default: 'Paris' },\n * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },\n * }\n * // WRONG — a full JSON schema\n * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }\n * ```\n */\n settingsSchema?: SettingsSchemaProperties\n /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n}\n\n/**\n * One setting: the JSON-Schema subset the la Vitre settings form renders\n * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with\n * `properties`). Every nested `properties` value and `items` is itself a\n * `SettingsFieldSchema` object, never a bare string; `required` is a list of key\n * names on the enclosing object, never `required: true` on a field.\n */\nexport type SettingsFieldSchema = {\n type?: string\n title?: string\n description?: string\n default?: unknown\n enum?: unknown[]\n enumNames?: string[]\n items?: SettingsFieldSchema | SettingsFieldSchema[]\n properties?: SettingsSchemaProperties\n required?: string[]\n [keyword: string]: unknown\n}\n\n/** A map of fields — see `ConnectorOptions.settingsSchema`. */\nexport type SettingsSchemaProperties = { [field: string]: SettingsFieldSchema }\n\nexport type ConnectorInitialized = {\n options: ConnectorOptions\n}\n\nexport type OpenFrame = {\n options: OpenFrameOptions\n}\n\nexport type OpenLocalFrame = {\n options: OpenFrameOptions\n}\n\nexport type EnumerateMediaDevices = {\n requestId: string\n}\n\nexport type OpenStream = {\n requestId: string\n streamId: string\n constraints: MediaStreamConstraints\n}\n\nexport type OpenStreamFrame = {\n constraints?: MediaStreamConstraints\n streamSourceUrl?: string\n requestId: string\n frameConnectorId: string\n name: string\n url: string\n allowFullscreen?: boolean\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n interaction?: Interaction\n resizeMode?: ResizeMode\n mode?: ViewMode\n data?: any\n file?: FileData\n privacy?: FramePrivacy\n mirrorInitiatorStream?: boolean\n size?: Size\n minSize?: Size\n maxSize?: Size\n startInteractive?: boolean\n border?: BorderOptions\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n visibility?: Visibility\n menuVisibility?: MenuVisibility\n closable?: boolean\n closeLabel?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */\n schema: SettingsSchemaProperties\n schemaUI: any\n}\n\nexport type SetFramePosition = {\n frameConnectorId: string\n position: LayoutPosition\n}\n\nexport type CloseFrame = {\n frameConnectorId: string\n}\n\nexport type SetFrameOwner = {\n frameConnectorId: string\n /** Device id of the new owner (HostInformation.devicesInSpace[].id). */\n owner: string\n}\n\n/// Live update of an already-open frame's shared-content style (background /\n/// box-shadow / drop-shadow surface, and companion icon). Emitted by\n/// `connector.setChromeStyle`. Only the provided fields are changed; the others\n/// keep their current value.\nexport type SetChromeStyle = {\n frameConnectorId: string\n} & ChromeStyle\n\n/// Host→app notification that an already-open shared frame's owner was\n/// reassigned via `setFrameOwner`, INCLUDING changes initiated by another\n/// device in the space. Surfaced on the SDK `Connector` as\n/// `onFrameOwnerChanged`. `owner` is the new owner's device id\n/// (HostInformation.devicesInSpace[].id).\nexport type FrameOwnerChanged = {\n frameConnectorId: string\n owner: string\n}\n\n/**\n * @deprecated Use `SetShareTargets` (`setShareTargets`).\n */\nexport type SetShareTarget = {\n shareTarget: ShareTargetOptions\n}\n\nexport type SetShareTargets = {\n shareTargets: ShareTargetOptions[]\n}\n\nexport type FrameUnloaded = {\n frameConnectorId: string\n}\n\nexport type FrameInfo = {\n frameConnectorId: string\n zIndex: number\n}\n\nexport type ShareDataReceived = {\n data: ShareData\n}\n\nexport type FileShareDataReceived = {\n data: FileData\n}\n\nexport type ShareData = {\n url: string\n}\n\nexport type TrackKind = 'audio' | 'video'\n\nexport type MediaTrackInfo = {\n id: string\n kind: TrackKind\n deviceName: string\n capabilities: MediaTrackCapabilities\n settings: MediaTrackSettings\n}\n\nexport type OpenStreamCompleted = {\n requestId: string\n streamId: string\n error?: string\n tracks?: MediaTrackInfo[]\n}\n\n/// One track of an app-provided shared stream. `readable` is the transferable\n/// output of a `MediaStreamTrackProcessor` (breakout box) — the host rebuilds a\n/// live `MediaStreamTrack` from it via `MediaStreamTrackGenerator`. Listed in\n/// the postMessage transfer list, so the host receives the SAME stream\n/// zero-copy (no re-encode) — works only when app and host are same-site\n/// (e.g. `*.apps.lavit.re` ↔ `app.lavit.re`) and Chromium.\nexport type ShareStreamTrack = {\n kind: TrackKind\n readable: ReadableStream\n settings?: MediaTrackSettings\n}\n\nexport type ShareStreamOptions = {\n /** Display label for the share (defaults to the app name). */\n name?: string\n /** Source resolution hint, used by the host to size the share. */\n width?: number\n height?: number\n /**\n * Controls how remote peers render this shared stream.\n *\n * - `'appFrame'` (default when absent): receivers load the app iframe, exactly\n * as before this field existed. N-1 receivers that do not know this field\n * will behave as `'appFrame'` automatically (backward-compatible).\n * - `'standard'`: receivers render a classic shared-video languette without\n * loading the app iframe. Use when the app provides raw video/audio and the\n * frame UI is not meaningful on the receiver side (e.g. a camera feed).\n */\n receiverDisplay?: 'standard' | 'appFrame'\n}\n\nexport type ShareStream = {\n requestId: string\n sharedStreamId: string\n options?: ShareStreamOptions\n tracks: ShareStreamTrack[]\n}\n\n/// Swap the source track(s) of an already-open app share WITHOUT closing it.\n/// The host swaps the underlying track in place (sender.replaceTrack on the\n/// vitre→peer side, no renegotiation), so peers see continuity.\nexport type ReplaceShareStream = {\n requestId: string\n sharedStreamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type StopShareStream = {\n sharedStreamId: string\n}\n\nexport type ShareStreamCompleted = {\n requestId: string\n sharedStreamId: string\n error?: string\n}\n\nexport type OpenStreamFrameCompleted = {\n requestId: string\n error?: string\n tracks?: MediaTrackInfo[]\n streamSourceUrl?: string\n}\n\nexport type EnumerateMediaDevicesCompleted = {\n requestId: string\n devices: ConnectedMediaDevice[]\n}\n\nexport type FramePositionUpdated = {\n frameConnectorId: string\n} & PositionUpdated\n\nexport type ExternalMessageReceived = {\n requestId: string\n appId: string\n message: any\n apiKeyId: string\n apiKeyName: string\n}\n\nexport type ExternalMessageResponseData = {\n requestId: string\n response?: any\n}\n\nexport type RequestAppTokenData = {\n requestId: string\n}\n\nexport type AppTokenReceivedData = {\n requestId: string\n token?: string\n error?: string\n}\n\nexport type ExecuteInFrameData = {\n requestId: string\n /** Must match the `name` attribute of the <iframe> embedded in frame.html. */\n frameName: string\n /** Runs as a function body — use `return <expr>` to yield a value. */\n code: string\n}\n\nexport type ExecuteInFrameResultData = {\n requestId: string\n /** JSON string of the injected code's return value; absent on error. */\n result?: string\n error?: string\n}\n\nexport type SetFrameSize = {\n frameId: string\n size: Size\n}\n\n/// Inbound to a Vitre `Connector` from a companion-side\n/// `CompanionConnector` (same `appId`). `fromCompanionId` is the\n/// connection-id of the sending companion so the Vitre connector can reply\n/// targeted-back via `sendMessageToCompanionConnector`.\nexport type MessageFromCompanionConnector = {\n fromCompanionId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a companion FRAME sent a message via\n/// `CompanionFrame.sendMessageToVitreConnector` (works for a local companion\n/// frame with no paired Vitre frame). Carries the `frameConnectorId` of the\n/// companion frame that spoke, on top of the connector-message shape.\nexport type MessageFromCompanionFrame = {\n fromCompanionId: string\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a connected companion clicks a\n/// menu entry that lives on a frame's options menu AND was declared with\n/// `availability: 'companion'` (or `'companionAdmin'`). The click did NOT\n/// fire on the Vitre — it fired on the companion-side render of the\n/// frame's options. The Vitre-side connector receives this so the app\n/// can react (typically: call `openCompanionFrame` from the companion's\n/// main connector, or push state into the frame). Distinct from\n/// `menuClicked` so apps that only care about Vitre-side menu clicks\n/// don't get woken up by companion clicks.\n///\n/// `frameConnectorId` is the id of the frame whose options menu was\n/// clicked; `fromCompanionId` is the connection-id of the clicker so\n/// targeted reactions are possible.\nexport type FrameMenuClickedOnCompanion = {\n frameConnectorId: string\n fromCompanionId: string\n menuId: string\n isChecked: boolean\n tag?: any\n}\n\n/// Target for `sendMessageToCompanionConnector` — broadcast to every\n/// companion currently connected to the Vitre, or address a single\n/// companion by id. Discriminated on `kind` so the union is unambiguous\n/// for callers and for the host that routes on this shape (a structural\n/// `{ all: true } | { companionId }` would let `{ all: true, companionId }`\n/// slip past the type system via an intermediate variable).\nexport type CompanionConnectorTarget =\n | { kind: 'all' }\n | { kind: 'one'; companionId: string }\n\n/// Payload emitted by a Vitre `Connector` when it wants to talk to the\n/// companion-side `CompanionConnector` for the same `appId`.\nexport type SendMessageToCompanionConnector = {\n target: CompanionConnectorTarget\n message: string\n fileData?: FileData\n}\n\nexport type ConnectorApiMessagesIn =\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'initialize' } & InitializeConnector)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'shareDataReceived' } & ShareDataReceived)\n | ({ type: 'fileShareDataReceived' } & FileShareDataReceived)\n | ({ type: 'frameLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoading' } & OpenFrame)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'frameUnloaded' } & FrameUnloaded)\n | ({\n type: 'enumerateMediaDevicesCompleted'\n } & EnumerateMediaDevicesCompleted)\n | ({ type: 'openStreamCompleted' } & OpenStreamCompleted)\n | ({ type: 'openStreamFrameCompleted' } & OpenStreamFrameCompleted)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'frameZIndexChanged' } & FrameInfo)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | ({ type: 'framePositionUpdated' } & FramePositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'statsResponse' } & StatsResponse)\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'externalMessageReceived' } & ExternalMessageReceived)\n | ({ type: 'appTokenReceived' } & AppTokenReceivedData)\n | ({ type: 'executeInFrameResult' } & ExecuteInFrameResultData)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'messageFromCompanionConnector'\n } & MessageFromCompanionConnector)\n | ({\n type: 'messageFromCompanionFrame'\n } & MessageFromCompanionFrame)\n | ({\n type: 'frameMenuClickedOnCompanion'\n } & FrameMenuClickedOnCompanion)\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\nexport type ConnectorApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'connectorInitialized' } & ConnectorInitialized)\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'openLocalFrame' } & OpenLocalFrame)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'enumerateMediaDevices' } & EnumerateMediaDevices)\n | ({ type: 'openStream' } & OpenStream)\n | ({ type: 'openStreamFrame' } & OpenStreamFrame)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | ({ type: 'setRootMenu' } & SetRootMenu)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setShareTarget' } & SetShareTarget)\n | ({ type: 'setShareTargets' } & SetShareTargets)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'appMessage' } & AppMessage)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setSettingsSchema' } & SettingsSchema)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n | ({ type: 'setChromeStyle' } & SetChromeStyle)\n | ({ type: 'setFramePosition' } & SetFramePosition)\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'externalMessageResponse' } & ExternalMessageResponseData)\n | ({ type: 'requestAppToken' } & RequestAppTokenData)\n | ({ type: 'executeInFrame' } & ExecuteInFrameData)\n | ({ type: 'setFrameSize' } & SetFrameSize)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'sendMessageToCompanionConnector'\n } & SendMessageToCompanionConnector)\n"]}
@@ -4,6 +4,7 @@ import { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js';
4
4
  import { BlobStore } from '../Common/BlobStore.js';
5
5
  import { isMinVersion } from '../Common/index.js';
6
6
  import { apiVersion } from '../Version.js';
7
+ import { normalizeSettingsSchema } from './SettingsSchema.js';
7
8
  export class Connector {
8
9
  /** @deprecated Use `crdt.doc`. The setter forwards to `crdt.attach(doc)`
9
10
  * so legacy callers that ever assigned `connector.yjsDoc = myDoc` keep
@@ -392,6 +393,7 @@ export class Connector {
392
393
  // New hosts prefer `shareTargets` and ignore the mirrored singular.
393
394
  this.options = {
394
395
  ...options,
396
+ settingsSchema: normalizeSettingsSchema(options.settingsSchema),
395
397
  shareTarget: options.shareTarget ??
396
398
  (options.shareTargets?.length ? options.shareTargets[0] : undefined),
397
399
  };
@@ -1143,14 +1145,15 @@ export class Connector {
1143
1145
  });
1144
1146
  }
1145
1147
  setSettingsSchema(schema) {
1148
+ const normalized = { ...schema, schema: normalizeSettingsSchema(schema.schema) };
1146
1149
  this.options = {
1147
1150
  ...this.options,
1148
- settingsSchema: schema.schema,
1149
- settingsSchemaUI: schema.schemaUI,
1151
+ settingsSchema: normalized.schema,
1152
+ settingsSchemaUI: normalized.schemaUI,
1150
1153
  };
1151
1154
  this.postMessage({
1152
1155
  type: 'setSettingsSchema',
1153
- ...schema,
1156
+ ...normalized,
1154
1157
  });
1155
1158
  }
1156
1159
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.js","sourceRoot":"","sources":["../../Connector/Connector.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,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AA;QAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,cAAc,CACZ,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"./insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { isMinVersion } from '../Common/index.js'\nimport type {\n AppId,\n AppMessage,\n ChromeStyle,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n OpenFrameOptions,\n Privacy,\n ReplacedBy,\n RequestSerialPortAccess,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n Size,\n StateReplaced,\n StatsResponse,\n UpdatedStateEntry,\n UpdateStateEntry,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type { Frame } from '../Frame/index.js'\nimport { apiVersion } from '../Version.js'\nimport type {\n AppTokenReceivedData,\n ExecuteInFrameResultData,\n CompanionConnectorTarget,\n ExternalMessageReceived,\n ConnectorApiMessagesIn,\n ConnectorApiMessagesOut,\n ConnectorOptions,\n FrameInfo,\n FramePositionUpdated,\n InitializeConnector,\n MediaTrackInfo,\n OpenStreamFrame,\n RootMenuEntry,\n SettingsSchema,\n ShareData,\n ShareStreamOptions,\n ShareStreamTrack,\n ShareTargetOptions,\n} from './Connector.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: ConnectorApiMessagesIn) => boolean\n}\n\nexport class Connector {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onFrameConnectorLoading?: (options: OpenFrameOptions) => void\n public onShareDataReceived?: (shareData: ShareData) => void\n public onShareFileReceived?: (shareData: FileData) => void\n public onFrameLoaded?: (frameConnectorId: string) => void\n public onFrameConnectorLoaded?: (frameConnectorId: string) => void\n public onFrameUnloaded?: (frameConnectorId: string) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n /** @deprecated Use onEmbedMessage */\n public onExtensionMessage?: (extensionMessage: AppMessage) => void\n /** @deprecated Use onEmbedMessage */\n public onAppMessage?: (appMessage: AppMessage) => void\n public onEmbedMessage?: (embedMessage: AppMessage) => void\n public onKnockKnockReceived?: (knockKnock: KnockKnock) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n public onSettingsUpdated?: (settings: any) => void\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onFrameZIndexChanged?: (frameInfo: FrameInfo) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: ConnectorApiMessagesIn) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onDeviceFullscreenUpdated?: (msg: DeviceFullscreenUpdated) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onFramePositionUpdated?: (msg: FramePositionUpdated) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onExternalMessageReceived?: (msg: ExternalMessageReceived) => any | Promise<any> | void\n public onAppTokenRefreshed?: (token: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n /// Called when an already-open shared frame's owner is reassigned via\n /// `setFrameOwner` — INCLUDING a change initiated by another device in the\n /// space (every vitre/companion running this app is notified). The owner\n /// drives the languette colour and (when a Vitre) hosting/survival, and is\n /// what an app should key its per-frame stored state on. `owner` is the new\n /// owner's device id (`HostInformation.devicesInSpace[].id`). Not fired for\n /// the initial open: a frame opened with `OpenFrameOptions.owner` is created\n /// already-owned, so the opener already knows its owner.\n public onFrameOwnerChanged?: (frameConnectorId: string, owner: string) => void\n /// Called when the companion-side `CompanionConnector` for the same\n /// `appId` sent a message via `sendMessageToVitreConnector`. The\n /// `fromCompanionId` identifies which companion sent it so the Vitre\n /// connector can reply targeted-back via `sendMessageToCompanionConnector`.\n public onMessageFromCompanionConnector?: (\n fromCompanionId: string,\n message: string,\n fileData?: FileData,\n ) => void\n /// Called when a companion FRAME of this app sent a message via\n /// `CompanionFrame.sendMessageToVitreConnector` — including a local\n /// companion frame with no paired Vitre frame. `frameConnectorId` is the\n /// companion frame that spoke; `fromCompanionId` is the companion. Reply\n /// targeted-back via `sendMessageToCompanionConnector`.\n public onMessageFromCompanionFrame?: (\n fromCompanionId: string,\n frameConnectorId: string,\n message: string,\n fileData?: FileData,\n ) => void\n /// Called when a companion clicked a menu entry that lives on one of\n /// THIS app's frames' options menu AND was declared with\n /// `availability: 'companion'` (or `'companionAdmin'`). The click never\n /// reaches the Vitre-side UI — it is intercepted on the companion and\n /// routed here so the app can decide what to do (typically: dispatch\n /// the companion's main connector to call `openCompanionFrame` for the\n /// matching frame).\n ///\n /// `frameConnectorId` is the frame whose menu entry was clicked.\n /// `fromCompanionId` is the connection-id of the clicker so the app\n /// can target a targeted reply back. The remaining fields mirror the\n /// regular `onMenuClicked` shape.\n public onFrameMenuClickedOnCompanion?: (\n frameConnectorId: string,\n fromCompanionId: string,\n menuId: string,\n isChecked: boolean,\n tag: any,\n ) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n\n public appId: string\n public hostInformation: HostInformation\n public openedFrames: FrameInfo[] = []\n public state: Record<string, any> = {}\n public appToken: string | null = null\n private appTokenRefreshTimer: ReturnType<typeof setInterval> | null = null\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc`. `put` / `get` /\n * `list` / `onProgress` for heavy binaries (images, PDFs, 3D, …) that\n * must be retrievable by anyone joining the doc, even late. Opinionated\n * but bare — see BlobStore.\n */\n public readonly blobs: BlobStore\n\n /** @deprecated Use `crdt.doc`. The setter forwards to `crdt.attach(doc)`\n * so legacy callers that ever assigned `connector.yjsDoc = myDoc` keep\n * working — without it, getter-only would throw `TypeError: Cannot set\n * property yjsDoc which has only a getter` under strict mode / ESM. */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n constructor(\n private readonly postMessage: (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[],\n ) => void,\n initMessage: InitializeConnector,\n public options: ConnectorOptions,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.appId = initMessage.appId ?? ''\n this.state = initMessage.state ?? {}\n // Mirror the first of `shareTargets` onto the deprecated singular `shareTarget`\n // so older Vitres (which only read `shareTarget`) still get the primary target.\n // New hosts prefer `shareTargets` and ignore the mirrored singular.\n this.options = {\n ...options,\n shareTarget:\n options.shareTarget ??\n (options.shareTargets?.length ? options.shareTargets[0] : undefined),\n }\n this.postMessage({\n type: 'connectorInitialized',\n options: this.options,\n })\n\n // Older Vitres reject unknown message types and fail the whole parse,\n // so never emit `crdt*` toward a host below the supported version. The\n // channel still constructs and works locally; emission is just dropped\n // (graceful degradation — onSynced never fires on old hosts, by design).\n const crdtSupported = isMinVersion(\n this.hostInformation.version,\n MIN_CRDT_HOST_VERSION,\n )\n this.crdt = new CrdtChannel((message, transfer) => {\n // No cast: `ConnectorApiMessagesOut` already includes the four `crdt*`\n // arms (Connector.Model.ts), so the union narrows naturally and TS\n // will flag any drift between the two definitions.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n }\n\n private resolveRequest(msg: ConnectorApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: ConnectorApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'frameConnectorLoading':\n this.onFrameConnectorLoading?.(msg.options)\n break\n case 'shareDataReceived':\n this.onShareDataReceived?.(msg.data)\n break\n case 'fileShareDataReceived':\n this.onShareFileReceived?.(msg.data)\n break\n case 'frameLoaded':\n this.openedFrames.push(msg)\n this.onFrameLoaded?.(msg.frameConnectorId)\n break\n case 'frameConnectorLoaded':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames[idx] = msg\n }\n this.onFrameConnectorLoaded?.(msg.frameConnectorId)\n }\n break\n case 'frameUnloaded':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames.splice(idx, 1)\n }\n this.onFrameUnloaded?.(msg.frameConnectorId)\n }\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'extensionMessage':\n this.onExtensionMessage?.(msg)\n this.onAppMessage?.(msg)\n this.onEmbedMessage?.(msg)\n break\n case 'appMessage':\n this.onAppMessage?.(msg)\n this.onEmbedMessage?.(msg)\n break\n\n case 'knockKnockReceived':\n this.onKnockKnockReceived?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n break\n case 'frameZIndexChanged':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames[idx] = msg\n }\n this.onFrameZIndexChanged?.(msg)\n }\n break\n\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n\n case 'deviceFullscreenUpdated':\n this.onDeviceFullscreenUpdated?.(msg)\n break\n case 'framePositionUpdated':\n this.onFramePositionUpdated?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'externalMessageReceived':\n this._onExternalMessageReceived(msg)\n break\n case 'appTokenReceived':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'frameOwnerChanged':\n this.onFrameOwnerChanged?.(msg.frameConnectorId, msg.owner)\n break\n case 'messageFromCompanionConnector':\n this.onMessageFromCompanionConnector?.(\n msg.fromCompanionId,\n msg.message,\n msg.fileData,\n )\n break\n case 'messageFromCompanionFrame':\n this.onMessageFromCompanionFrame?.(\n msg.fromCompanionId,\n msg.frameConnectorId,\n msg.message,\n msg.fileData,\n )\n break\n case 'frameMenuClickedOnCompanion':\n this.onFrameMenuClickedOnCompanion?.(\n msg.frameConnectorId,\n msg.fromCompanionId,\n msg.menuId,\n msg.isChecked,\n msg.tag,\n )\n break\n }\n this.onMessageReceived?.(msg)\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n private _onExternalMessageReceived(msg: ExternalMessageReceived) {\n if (this.onExternalMessageReceived) {\n const result = this.onExternalMessageReceived(msg)\n\n // If handler returns a value (sync or Promise), automatically send response\n if (result !== undefined && result !== null) {\n const sendResponse = (response: any) => {\n this.postMessage({\n type: 'externalMessageResponse',\n requestId: msg.requestId,\n response,\n })\n }\n\n if (result instanceof Promise || (result && typeof result.then === 'function')) {\n ;(result as Promise<any>).then(sendResponse).catch(() => {\n sendResponse(null)\n })\n } else {\n sendResponse(result)\n }\n }\n }\n }\n\n public async requestAppToken(): Promise<string> {\n const requestId = randomUuid()\n const token = await this.postRequest<string>(\n { type: 'requestAppToken', requestId },\n (msg, resolve, reject) => {\n if (msg.type === 'appTokenReceived' && (msg as AppTokenReceivedData).requestId === requestId) {\n const tokenMsg = msg as AppTokenReceivedData\n if (tokenMsg.token) {\n resolve(tokenMsg.token)\n } else {\n reject(tokenMsg.error ?? 'Failed to get app token')\n }\n }\n },\n )\n this.appToken = token\n return token\n }\n\n /**\n * Run JavaScript inside a (cross-origin) child iframe this app embeds in its\n * frame.html, and resolve with the JSON-parsed return value.\n *\n * The iframe must carry a `name` attribute (e.g. `<iframe name=\"my-target\">`)\n * matching `frameName`. `code` runs as a function body — use `return <expr>` to\n * produce a value (any JSON-serializable value round-trips; `undefined` → `null`).\n *\n * Requires the `injectScriptIntoFrame` app authorization and the native (CEF)\n * host (rejects on a web host). The host also restricts the target to this app's\n * own frame subtree.\n */\n public async executeInFrame<T = unknown>(frameName: string, code: string): Promise<T> {\n const requestId = randomUuid()\n const json = await this.postRequest<string | undefined>(\n { type: 'executeInFrame', requestId, frameName, code },\n (msg, resolve, reject) => {\n if (\n msg.type === 'executeInFrameResult' &&\n (msg as ExecuteInFrameResultData).requestId === requestId\n ) {\n const resultMsg = msg as ExecuteInFrameResultData\n if (resultMsg.error) {\n reject(resultMsg.error)\n } else {\n resolve(resultMsg.result)\n }\n }\n },\n )\n return (json === undefined ? undefined : JSON.parse(json)) as T\n }\n\n public startAppTokenRefresh(intervalMs = 3600000): void {\n this.stopAppTokenRefresh()\n // Request initial token\n this.requestAppToken().catch(() => {})\n // Refresh periodically\n this.appTokenRefreshTimer = setInterval(async () => {\n try {\n const token = await this.requestAppToken()\n this.onAppTokenRefreshed?.(token)\n } catch (_error) {\n // Will retry on next interval\n }\n }, intervalMs)\n }\n\n public stopAppTokenRefresh(): void {\n if (this.appTokenRefreshTimer) {\n clearInterval(this.appTokenRefreshTimer)\n this.appTokenRefreshTimer = null\n }\n }\n\n /** Release the resources owned by this connector. Stops the app-token\n * refresh timer and tears the CRDT channel down (unbinds doc/awareness\n * listeners, destroys the default Y.Doc + Awareness). Safe to call\n * multiple times. */\n public destroy(): void {\n this.stopAppTokenRefresh()\n this.crdt.destroy()\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: ConnectorApiMessagesOut,\n handler: (\n msg: ConnectorApiMessagesIn,\n resolve: (data: Data) => void,\n reject: (error: string) => void,\n ) => void,\n transfer?: Transferable[],\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n const handleAndResolve = (data: Data) => {\n isHandled = true\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: ConnectorApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n this.postMessage(data, transfer)\n })\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public async requestEnumerateDevices() {\n const requestId = randomUuid()\n return await this.postRequest<ConnectedMediaDevice[]>(\n { type: 'enumerateMediaDevices', requestId },\n async (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateMediaDevicesCompleted' &&\n msg.requestId === requestId\n ) {\n const localDevices = await navigator.mediaDevices.enumerateDevices()\n\n const cleanName = (name: string) => {\n if (!name) return name\n return name.replace(/\\s*\\([0-9a-f]{4}:[0-9a-f]{4}\\)\\s*$/gi, '')\n }\n\n const mappedDevices = msg.devices.map((d) => {\n const localDevice = localDevices.find(\n (ld) =>\n cleanName(ld.label) === cleanName(d.label) &&\n ld.kind === d.kind,\n )\n if (localDevice) {\n return {\n ...d,\n deviceId: localDevice.deviceId,\n groupId: localDevice.groupId,\n vitreId: d.deviceId,\n vitreGroupId: d.groupId,\n }\n }\n return d\n })\n\n resolve(mappedDevices)\n }\n },\n )\n }\n\n public async requestOpenStream(\n streamId: string,\n constraints: MediaStreamConstraints,\n ) {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'openStream', requestId, streamId, constraints },\n (msg, resolve, reject) => {\n if (msg.type === 'openStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'openStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n private async convertConstraintsToVitreConstraints(\n constraints: MediaStreamConstraints,\n ): Promise<MediaStreamConstraints> {\n const vitreDevices = await this.requestEnumerateDevices()\n\n const videoConstraint = (typeof constraints.video === 'object' &&\n constraints.video) as MediaTrackConstraints | null\n const audioConstraint = (typeof constraints.audio === 'object' &&\n constraints.audio) as MediaTrackConstraints | null\n const videoDeviceId = videoConstraint?.deviceId\n const audioDeviceId = audioConstraint?.deviceId\n\n const mappedVideoDevice = vitreDevices.find(\n (d) => d.deviceId === videoDeviceId && d.kind === 'videoinput',\n ) as any\n const mappedVideoDeviceId =\n mappedVideoDevice?.vitreId ?? mappedVideoDevice?.deviceId\n const mappedAudioDevice = vitreDevices.find(\n (d) => d.deviceId === audioDeviceId && d.kind === 'audioinput',\n ) as any\n const mappedAudioDeviceId =\n mappedAudioDevice?.vitreId ?? mappedAudioDevice?.deviceId\n\n let mappedConstraint = videoDeviceId\n ? {\n ...constraints,\n video: { ...videoConstraint, deviceId: mappedVideoDeviceId },\n }\n : constraints\n mappedConstraint = audioDeviceId\n ? {\n ...mappedConstraint,\n audio: { ...audioConstraint, deviceId: mappedAudioDeviceId },\n }\n : mappedConstraint\n return mappedConstraint\n }\n\n public async requestOpenStreamFrame(\n openStreamFrame: Omit<OpenStreamFrame, 'requestId'>,\n ) {\n const requestId = randomUuid()\n\n const constraints = openStreamFrame.constraints\n ? await this.convertConstraintsToVitreConstraints(\n openStreamFrame.constraints,\n )\n : undefined\n\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'openStreamFrame', requestId, ...openStreamFrame, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'openStreamFrameCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'openStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime. Requires the\n * MediaStreamTrack Insertable Streams API (Chromium-only) and the app being\n * served same-site as the Vitre host (so the transferred stream survives the\n * iframe boundary zero-copy). Apps should feature-detect before offering a\n * share action.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a camera/microphone (or any) `MediaStream` the app controls TO the\n * Vitre, which forwards it to the other peers in the space like a regular\n * shared stream. The stream is handed over zero-copy (no re-encode) via the\n * breakout box; the app keeps ownership of its tracks and can stop them\n * independently.\n *\n * Returns a `sharedStreamId` to pass to {@link replaceShareStream} /\n * {@link stopShareStream}. Throws if {@link canShareStream} is false.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open share WITHOUT closing it (e.g. switch camera,\n * or camera→screen). Peers keep receiving on the same slot with no\n * renegotiation blip. `sharedStreamId` is the value returned by\n * {@link shareStream}.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop an app share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n public getFrame(frameConnectorId: string): Window | null {\n try {\n const frameId = `${this.appId}|${frameConnectorId}`\n return (window.parent.frames as any)[frameId]\n } catch (_error) {\n return null\n }\n }\n\n public getFrameConnector(frameConnector: string): Frame | null {\n const frame = this.getFrame(frameConnector) as any\n return frame?.frameConnector as Frame\n }\n\n public async openFrame(frameOptions: OpenFrameOptions) {\n return await this.postRequest<FrameInfo>(\n {\n type: 'openFrame',\n options: frameOptions,\n },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'frameConnectorLoaded' &&\n msg.frameConnectorId === frameOptions.frameConnectorId\n ) {\n resolve(msg)\n }\n },\n )\n }\n\n public async openLocalFrame(frameOptions: OpenFrameOptions) {\n return await this.postRequest<FrameInfo>(\n {\n type: 'openLocalFrame',\n options: frameOptions,\n },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'frameConnectorLoaded' &&\n msg.frameConnectorId === frameOptions.frameConnectorId\n ) {\n resolve(msg)\n }\n },\n )\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({\n type: 'sendMessageToAll',\n ...message,\n })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public setMenu(menu: RootMenuEntry[]) {\n this.postMessage({\n type: 'setRootMenu',\n menu,\n })\n }\n\n /**\n * @deprecated Use sendAppMessage on vitre v18\n */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. The owner drives the languette\n * colour/info and the content appears already-owned on every vitre. When\n * omitted the share is owned by the opener (default).\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public setSettingsSchema(schema: SettingsSchema) {\n this.options = {\n ...this.options,\n settingsSchema: schema.schema,\n settingsSchemaUI: schema.schemaUI,\n }\n this.postMessage({\n type: 'setSettingsSchema',\n ...schema,\n })\n }\n\n /**\n * Update the app's share target at any time. The new share target replaces\n * the one provided at initialization (ConnectorOptions.shareTarget) and is\n * applied immediately by the host. Can be called repeatedly.\n *\n * @deprecated Use `setShareTargets` to advertise one or more share targets.\n */\n public setShareTarget(shareTarget: ShareTargetOptions) {\n this.options = {\n ...this.options,\n shareTarget,\n shareTargets: [shareTarget],\n }\n this.postMessage({\n type: 'setShareTarget',\n shareTarget,\n })\n }\n\n /**\n * Update the app's share targets at any time. The new array replaces the ones\n * provided at initialization (ConnectorOptions.shareTargets) and is applied\n * immediately by the host. Can be called repeatedly.\n */\n public setShareTargets(shareTargets: ShareTargetOptions[]) {\n this.options = {\n ...this.options,\n shareTargets,\n // Mirror the first target onto the deprecated singular for older Vitres.\n shareTarget: shareTargets[0],\n }\n // Emit the legacy singular first so older Vitres (which only handle\n // `setShareTarget`) still get the primary target at runtime, then the full\n // array which new hosts apply (and which supersedes the singular there).\n if (shareTargets[0]) {\n this.postMessage({\n type: 'setShareTarget',\n shareTarget: shareTargets[0],\n })\n }\n this.postMessage({\n type: 'setShareTargets',\n shareTargets,\n })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public setFramePosition(frameConnectorId: string, position: LayoutPosition) {\n this.postMessage({\n type: 'setFramePosition',\n frameConnectorId,\n position,\n })\n }\n\n public closeFrame(frameConnectorId: string) {\n this.postMessage({\n type: 'closeFrame',\n frameConnectorId,\n })\n }\n\n /**\n * Reassign the owner of an already-opened shared frame. `owner` is a\n * device id from `HostInformation.devicesInSpace[].id`. The new owner\n * drives the languette colour, and when it is a Vitre it takes over\n * hosting the frame so it survives the opener disconnecting.\n */\n public setFrameOwner(frameConnectorId: string, owner: string) {\n this.postMessage({\n type: 'setFrameOwner',\n frameConnectorId,\n owner,\n })\n }\n\n /**\n * Update the visual style of an already-open frame's shared content at any\n * time — the same surface styling and companion icon that\n * `OpenFrameOptions` sets at open time, but applied live. Only the fields you\n * pass change; omitted fields keep their current value. Pass an empty string\n * to clear an override back to the host default (e.g. `{ background: '' }`).\n * The host re-renders the surface on this Vitre, on peer Vitres / tableaux\n * showing the frame, and re-propagates the icon to connected companions.\n */\n public setChromeStyle(frameConnectorId: string, style: ChromeStyle) {\n this.postMessage({\n type: 'setChromeStyle',\n frameConnectorId,\n ...style,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public setFrameSize(frameId: string, size: Size) {\n this.postMessage({\n type: 'setFrameSize',\n frameId,\n size,\n })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port. Resolves with the granted port name\n /// (empty string if denied or cancelled).\n /// - `{ port }` given: the host pre-grants that port and resolves with it,\n /// so a following `navigator.serial.requestPort()` resolves to it with no\n /// picker.\n /// - no argument (or `{}`): the host shows its port-picker and resolves with\n /// the port the user chose (also pre-granted).\n /// Honoured only when the app holds the WebSerial authorization.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n /// Send an opaque message to the companion-side `CompanionConnector`\n /// for the same `appId`. `target` selects one or all companions\n /// currently connected to this Vitre — `{ kind: 'all' }` broadcasts to\n /// every connected companion, `{ kind: 'one', companionId }` addresses a\n /// single one. The message is forwarded unchanged; the receiving side\n /// gets it as `onMessageFromVitreConnector`.\n public sendMessageToCompanionConnector(\n target: CompanionConnectorTarget,\n message: string,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendMessageToCompanionConnector',\n target,\n message,\n fileData,\n })\n }\n}\n\ntype PostMessageConnectorApiOut = (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeConnector<T extends Connector>(\n init: (info: HostInformation) => ConnectorOptions,\n createConnector?: new (\n postMessage: (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[] | undefined,\n ) => void,\n initializeMessage: InitializeConnector,\n options: ConnectorOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let mainConnector: T | null = null\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageConnectorApiOut) =>\n (e: MessageEvent<ConnectorApiMessagesIn>): any => {\n switch (e.data.type) {\n case 'initialize':\n if (mainConnector == null) {\n const initializeMsg = e.data\n const options = init(initializeMsg.hostInfo)\n mainConnector = new (createConnector ?? Connector)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n ) as T\n const w = window as any\n w.mainConnector = mainConnector\n resolve(mainConnector)\n }\n break\n default:\n mainConnector?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
1
+ {"version":3,"file":"Connector.js","sourceRoot":"","sources":["../../Connector/Connector.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,E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e,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YAC1D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpD,CAAC,CACF,CAAA;QAED,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;YACE,IAAI,EAAE,gCAAgC;YACtC,OAAO,EAAE,UAAU;SACpB,EACD,GAAG,EACH,CAAC,OAAO,CAAC,KAAK,CAAC,CAChB,CAAA;QAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,cAAc,CACZ,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"./insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { isMinVersion } from '../Common/index.js'\nimport type {\n AppId,\n AppMessage,\n ChromeStyle,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n OpenFrameOptions,\n Privacy,\n ReplacedBy,\n RequestSerialPortAccess,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n Size,\n StateReplaced,\n StatsResponse,\n UpdatedStateEntry,\n UpdateStateEntry,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type { Frame } from '../Frame/index.js'\nimport { apiVersion } from '../Version.js'\nimport { normalizeSettingsSchema } from './SettingsSchema.js'\nimport type {\n AppTokenReceivedData,\n ExecuteInFrameResultData,\n CompanionConnectorTarget,\n ExternalMessageReceived,\n ConnectorApiMessagesIn,\n ConnectorApiMessagesOut,\n ConnectorOptions,\n FrameInfo,\n FramePositionUpdated,\n InitializeConnector,\n MediaTrackInfo,\n OpenStreamFrame,\n RootMenuEntry,\n SettingsSchema,\n ShareData,\n ShareStreamOptions,\n ShareStreamTrack,\n ShareTargetOptions,\n} from './Connector.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: ConnectorApiMessagesIn) => boolean\n}\n\nexport class Connector {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onFrameConnectorLoading?: (options: OpenFrameOptions) => void\n public onShareDataReceived?: (shareData: ShareData) => void\n public onShareFileReceived?: (shareData: FileData) => void\n public onFrameLoaded?: (frameConnectorId: string) => void\n public onFrameConnectorLoaded?: (frameConnectorId: string) => void\n public onFrameUnloaded?: (frameConnectorId: string) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n /** @deprecated Use onEmbedMessage */\n public onExtensionMessage?: (extensionMessage: AppMessage) => void\n /** @deprecated Use onEmbedMessage */\n public onAppMessage?: (appMessage: AppMessage) => void\n public onEmbedMessage?: (embedMessage: AppMessage) => void\n public onKnockKnockReceived?: (knockKnock: KnockKnock) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n public onSettingsUpdated?: (settings: any) => void\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onFrameZIndexChanged?: (frameInfo: FrameInfo) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: ConnectorApiMessagesIn) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onDeviceFullscreenUpdated?: (msg: DeviceFullscreenUpdated) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onFramePositionUpdated?: (msg: FramePositionUpdated) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onExternalMessageReceived?: (msg: ExternalMessageReceived) => any | Promise<any> | void\n public onAppTokenRefreshed?: (token: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n /// Called when an already-open shared frame's owner is reassigned via\n /// `setFrameOwner` — INCLUDING a change initiated by another device in the\n /// space (every vitre/companion running this app is notified). The owner\n /// drives the languette colour and (when a Vitre) hosting/survival, and is\n /// what an app should key its per-frame stored state on. `owner` is the new\n /// owner's device id (`HostInformation.devicesInSpace[].id`). Not fired for\n /// the initial open: a frame opened with `OpenFrameOptions.owner` is created\n /// already-owned, so the opener already knows its owner.\n public onFrameOwnerChanged?: (frameConnectorId: string, owner: string) => void\n /// Called when the companion-side `CompanionConnector` for the same\n /// `appId` sent a message via `sendMessageToVitreConnector`. The\n /// `fromCompanionId` identifies which companion sent it so the Vitre\n /// connector can reply targeted-back via `sendMessageToCompanionConnector`.\n public onMessageFromCompanionConnector?: (\n fromCompanionId: string,\n message: string,\n fileData?: FileData,\n ) => void\n /// Called when a companion FRAME of this app sent a message via\n /// `CompanionFrame.sendMessageToVitreConnector` — including a local\n /// companion frame with no paired Vitre frame. `frameConnectorId` is the\n /// companion frame that spoke; `fromCompanionId` is the companion. Reply\n /// targeted-back via `sendMessageToCompanionConnector`.\n public onMessageFromCompanionFrame?: (\n fromCompanionId: string,\n frameConnectorId: string,\n message: string,\n fileData?: FileData,\n ) => void\n /// Called when a companion clicked a menu entry that lives on one of\n /// THIS app's frames' options menu AND was declared with\n /// `availability: 'companion'` (or `'companionAdmin'`). The click never\n /// reaches the Vitre-side UI — it is intercepted on the companion and\n /// routed here so the app can decide what to do (typically: dispatch\n /// the companion's main connector to call `openCompanionFrame` for the\n /// matching frame).\n ///\n /// `frameConnectorId` is the frame whose menu entry was clicked.\n /// `fromCompanionId` is the connection-id of the clicker so the app\n /// can target a targeted reply back. The remaining fields mirror the\n /// regular `onMenuClicked` shape.\n public onFrameMenuClickedOnCompanion?: (\n frameConnectorId: string,\n fromCompanionId: string,\n menuId: string,\n isChecked: boolean,\n tag: any,\n ) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n\n public appId: string\n public hostInformation: HostInformation\n public openedFrames: FrameInfo[] = []\n public state: Record<string, any> = {}\n public appToken: string | null = null\n private appTokenRefreshTimer: ReturnType<typeof setInterval> | null = null\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc`. `put` / `get` /\n * `list` / `onProgress` for heavy binaries (images, PDFs, 3D, …) that\n * must be retrievable by anyone joining the doc, even late. Opinionated\n * but bare — see BlobStore.\n */\n public readonly blobs: BlobStore\n\n /** @deprecated Use `crdt.doc`. The setter forwards to `crdt.attach(doc)`\n * so legacy callers that ever assigned `connector.yjsDoc = myDoc` keep\n * working — without it, getter-only would throw `TypeError: Cannot set\n * property yjsDoc which has only a getter` under strict mode / ESM. */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n constructor(\n private readonly postMessage: (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[],\n ) => void,\n initMessage: InitializeConnector,\n public options: ConnectorOptions,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.appId = initMessage.appId ?? ''\n this.state = initMessage.state ?? {}\n // Mirror the first of `shareTargets` onto the deprecated singular `shareTarget`\n // so older Vitres (which only read `shareTarget`) still get the primary target.\n // New hosts prefer `shareTargets` and ignore the mirrored singular.\n this.options = {\n ...options,\n settingsSchema: normalizeSettingsSchema(options.settingsSchema),\n shareTarget:\n options.shareTarget ??\n (options.shareTargets?.length ? options.shareTargets[0] : undefined),\n }\n this.postMessage({\n type: 'connectorInitialized',\n options: this.options,\n })\n\n // Older Vitres reject unknown message types and fail the whole parse,\n // so never emit `crdt*` toward a host below the supported version. The\n // channel still constructs and works locally; emission is just dropped\n // (graceful degradation — onSynced never fires on old hosts, by design).\n const crdtSupported = isMinVersion(\n this.hostInformation.version,\n MIN_CRDT_HOST_VERSION,\n )\n this.crdt = new CrdtChannel((message, transfer) => {\n // No cast: `ConnectorApiMessagesOut` already includes the four `crdt*`\n // arms (Connector.Model.ts), so the union narrows naturally and TS\n // will flag any drift between the two definitions.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n }\n\n private resolveRequest(msg: ConnectorApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: ConnectorApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'frameConnectorLoading':\n this.onFrameConnectorLoading?.(msg.options)\n break\n case 'shareDataReceived':\n this.onShareDataReceived?.(msg.data)\n break\n case 'fileShareDataReceived':\n this.onShareFileReceived?.(msg.data)\n break\n case 'frameLoaded':\n this.openedFrames.push(msg)\n this.onFrameLoaded?.(msg.frameConnectorId)\n break\n case 'frameConnectorLoaded':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames[idx] = msg\n }\n this.onFrameConnectorLoaded?.(msg.frameConnectorId)\n }\n break\n case 'frameUnloaded':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames.splice(idx, 1)\n }\n this.onFrameUnloaded?.(msg.frameConnectorId)\n }\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'extensionMessage':\n this.onExtensionMessage?.(msg)\n this.onAppMessage?.(msg)\n this.onEmbedMessage?.(msg)\n break\n case 'appMessage':\n this.onAppMessage?.(msg)\n this.onEmbedMessage?.(msg)\n break\n\n case 'knockKnockReceived':\n this.onKnockKnockReceived?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n break\n case 'frameZIndexChanged':\n {\n const idx = this.openedFrames.findIndex(\n (f) => f.frameConnectorId === msg.frameConnectorId,\n )\n if (idx >= 0) {\n this.openedFrames[idx] = msg\n }\n this.onFrameZIndexChanged?.(msg)\n }\n break\n\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n\n case 'deviceFullscreenUpdated':\n this.onDeviceFullscreenUpdated?.(msg)\n break\n case 'framePositionUpdated':\n this.onFramePositionUpdated?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'externalMessageReceived':\n this._onExternalMessageReceived(msg)\n break\n case 'appTokenReceived':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'frameOwnerChanged':\n this.onFrameOwnerChanged?.(msg.frameConnectorId, msg.owner)\n break\n case 'messageFromCompanionConnector':\n this.onMessageFromCompanionConnector?.(\n msg.fromCompanionId,\n msg.message,\n msg.fileData,\n )\n break\n case 'messageFromCompanionFrame':\n this.onMessageFromCompanionFrame?.(\n msg.fromCompanionId,\n msg.frameConnectorId,\n msg.message,\n msg.fileData,\n )\n break\n case 'frameMenuClickedOnCompanion':\n this.onFrameMenuClickedOnCompanion?.(\n msg.frameConnectorId,\n msg.fromCompanionId,\n msg.menuId,\n msg.isChecked,\n msg.tag,\n )\n break\n }\n this.onMessageReceived?.(msg)\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n private _onExternalMessageReceived(msg: ExternalMessageReceived) {\n if (this.onExternalMessageReceived) {\n const result = this.onExternalMessageReceived(msg)\n\n // If handler returns a value (sync or Promise), automatically send response\n if (result !== undefined && result !== null) {\n const sendResponse = (response: any) => {\n this.postMessage({\n type: 'externalMessageResponse',\n requestId: msg.requestId,\n response,\n })\n }\n\n if (result instanceof Promise || (result && typeof result.then === 'function')) {\n ;(result as Promise<any>).then(sendResponse).catch(() => {\n sendResponse(null)\n })\n } else {\n sendResponse(result)\n }\n }\n }\n }\n\n public async requestAppToken(): Promise<string> {\n const requestId = randomUuid()\n const token = await this.postRequest<string>(\n { type: 'requestAppToken', requestId },\n (msg, resolve, reject) => {\n if (msg.type === 'appTokenReceived' && (msg as AppTokenReceivedData).requestId === requestId) {\n const tokenMsg = msg as AppTokenReceivedData\n if (tokenMsg.token) {\n resolve(tokenMsg.token)\n } else {\n reject(tokenMsg.error ?? 'Failed to get app token')\n }\n }\n },\n )\n this.appToken = token\n return token\n }\n\n /**\n * Run JavaScript inside a (cross-origin) child iframe this app embeds in its\n * frame.html, and resolve with the JSON-parsed return value.\n *\n * The iframe must carry a `name` attribute (e.g. `<iframe name=\"my-target\">`)\n * matching `frameName`. `code` runs as a function body — use `return <expr>` to\n * produce a value (any JSON-serializable value round-trips; `undefined` → `null`).\n *\n * Requires the `injectScriptIntoFrame` app authorization and the native (CEF)\n * host (rejects on a web host). The host also restricts the target to this app's\n * own frame subtree.\n */\n public async executeInFrame<T = unknown>(frameName: string, code: string): Promise<T> {\n const requestId = randomUuid()\n const json = await this.postRequest<string | undefined>(\n { type: 'executeInFrame', requestId, frameName, code },\n (msg, resolve, reject) => {\n if (\n msg.type === 'executeInFrameResult' &&\n (msg as ExecuteInFrameResultData).requestId === requestId\n ) {\n const resultMsg = msg as ExecuteInFrameResultData\n if (resultMsg.error) {\n reject(resultMsg.error)\n } else {\n resolve(resultMsg.result)\n }\n }\n },\n )\n return (json === undefined ? undefined : JSON.parse(json)) as T\n }\n\n public startAppTokenRefresh(intervalMs = 3600000): void {\n this.stopAppTokenRefresh()\n // Request initial token\n this.requestAppToken().catch(() => {})\n // Refresh periodically\n this.appTokenRefreshTimer = setInterval(async () => {\n try {\n const token = await this.requestAppToken()\n this.onAppTokenRefreshed?.(token)\n } catch (_error) {\n // Will retry on next interval\n }\n }, intervalMs)\n }\n\n public stopAppTokenRefresh(): void {\n if (this.appTokenRefreshTimer) {\n clearInterval(this.appTokenRefreshTimer)\n this.appTokenRefreshTimer = null\n }\n }\n\n /** Release the resources owned by this connector. Stops the app-token\n * refresh timer and tears the CRDT channel down (unbinds doc/awareness\n * listeners, destroys the default Y.Doc + Awareness). Safe to call\n * multiple times. */\n public destroy(): void {\n this.stopAppTokenRefresh()\n this.crdt.destroy()\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: ConnectorApiMessagesOut,\n handler: (\n msg: ConnectorApiMessagesIn,\n resolve: (data: Data) => void,\n reject: (error: string) => void,\n ) => void,\n transfer?: Transferable[],\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n const handleAndResolve = (data: Data) => {\n isHandled = true\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: ConnectorApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n this.postMessage(data, transfer)\n })\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public async requestEnumerateDevices() {\n const requestId = randomUuid()\n return await this.postRequest<ConnectedMediaDevice[]>(\n { type: 'enumerateMediaDevices', requestId },\n async (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateMediaDevicesCompleted' &&\n msg.requestId === requestId\n ) {\n const localDevices = await navigator.mediaDevices.enumerateDevices()\n\n const cleanName = (name: string) => {\n if (!name) return name\n return name.replace(/\\s*\\([0-9a-f]{4}:[0-9a-f]{4}\\)\\s*$/gi, '')\n }\n\n const mappedDevices = msg.devices.map((d) => {\n const localDevice = localDevices.find(\n (ld) =>\n cleanName(ld.label) === cleanName(d.label) &&\n ld.kind === d.kind,\n )\n if (localDevice) {\n return {\n ...d,\n deviceId: localDevice.deviceId,\n groupId: localDevice.groupId,\n vitreId: d.deviceId,\n vitreGroupId: d.groupId,\n }\n }\n return d\n })\n\n resolve(mappedDevices)\n }\n },\n )\n }\n\n public async requestOpenStream(\n streamId: string,\n constraints: MediaStreamConstraints,\n ) {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'openStream', requestId, streamId, constraints },\n (msg, resolve, reject) => {\n if (msg.type === 'openStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'openStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n private async convertConstraintsToVitreConstraints(\n constraints: MediaStreamConstraints,\n ): Promise<MediaStreamConstraints> {\n const vitreDevices = await this.requestEnumerateDevices()\n\n const videoConstraint = (typeof constraints.video === 'object' &&\n constraints.video) as MediaTrackConstraints | null\n const audioConstraint = (typeof constraints.audio === 'object' &&\n constraints.audio) as MediaTrackConstraints | null\n const videoDeviceId = videoConstraint?.deviceId\n const audioDeviceId = audioConstraint?.deviceId\n\n const mappedVideoDevice = vitreDevices.find(\n (d) => d.deviceId === videoDeviceId && d.kind === 'videoinput',\n ) as any\n const mappedVideoDeviceId =\n mappedVideoDevice?.vitreId ?? mappedVideoDevice?.deviceId\n const mappedAudioDevice = vitreDevices.find(\n (d) => d.deviceId === audioDeviceId && d.kind === 'audioinput',\n ) as any\n const mappedAudioDeviceId =\n mappedAudioDevice?.vitreId ?? mappedAudioDevice?.deviceId\n\n let mappedConstraint = videoDeviceId\n ? {\n ...constraints,\n video: { ...videoConstraint, deviceId: mappedVideoDeviceId },\n }\n : constraints\n mappedConstraint = audioDeviceId\n ? {\n ...mappedConstraint,\n audio: { ...audioConstraint, deviceId: mappedAudioDeviceId },\n }\n : mappedConstraint\n return mappedConstraint\n }\n\n public async requestOpenStreamFrame(\n openStreamFrame: Omit<OpenStreamFrame, 'requestId'>,\n ) {\n const requestId = randomUuid()\n\n const constraints = openStreamFrame.constraints\n ? await this.convertConstraintsToVitreConstraints(\n openStreamFrame.constraints,\n )\n : undefined\n\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'openStreamFrame', requestId, ...openStreamFrame, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'openStreamFrameCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'openStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime. Requires the\n * MediaStreamTrack Insertable Streams API (Chromium-only) and the app being\n * served same-site as the Vitre host (so the transferred stream survives the\n * iframe boundary zero-copy). Apps should feature-detect before offering a\n * share action.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a camera/microphone (or any) `MediaStream` the app controls TO the\n * Vitre, which forwards it to the other peers in the space like a regular\n * shared stream. The stream is handed over zero-copy (no re-encode) via the\n * breakout box; the app keeps ownership of its tracks and can stop them\n * independently.\n *\n * Returns a `sharedStreamId` to pass to {@link replaceShareStream} /\n * {@link stopShareStream}. Throws if {@link canShareStream} is false.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open share WITHOUT closing it (e.g. switch camera,\n * or camera→screen). Peers keep receiving on the same slot with no\n * renegotiation blip. `sharedStreamId` is the value returned by\n * {@link shareStream}.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop an app share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n public getFrame(frameConnectorId: string): Window | null {\n try {\n const frameId = `${this.appId}|${frameConnectorId}`\n return (window.parent.frames as any)[frameId]\n } catch (_error) {\n return null\n }\n }\n\n public getFrameConnector(frameConnector: string): Frame | null {\n const frame = this.getFrame(frameConnector) as any\n return frame?.frameConnector as Frame\n }\n\n public async openFrame(frameOptions: OpenFrameOptions) {\n return await this.postRequest<FrameInfo>(\n {\n type: 'openFrame',\n options: frameOptions,\n },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'frameConnectorLoaded' &&\n msg.frameConnectorId === frameOptions.frameConnectorId\n ) {\n resolve(msg)\n }\n },\n )\n }\n\n public async openLocalFrame(frameOptions: OpenFrameOptions) {\n return await this.postRequest<FrameInfo>(\n {\n type: 'openLocalFrame',\n options: frameOptions,\n },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'frameConnectorLoaded' &&\n msg.frameConnectorId === frameOptions.frameConnectorId\n ) {\n resolve(msg)\n }\n },\n )\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({\n type: 'sendMessageToAll',\n ...message,\n })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public setMenu(menu: RootMenuEntry[]) {\n this.postMessage({\n type: 'setRootMenu',\n menu,\n })\n }\n\n /**\n * @deprecated Use sendAppMessage on vitre v18\n */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. The owner drives the languette\n * colour/info and the content appears already-owned on every vitre. When\n * omitted the share is owned by the opener (default).\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public setSettingsSchema(schema: SettingsSchema) {\n const normalized = { ...schema, schema: normalizeSettingsSchema(schema.schema) }\n this.options = {\n ...this.options,\n settingsSchema: normalized.schema,\n settingsSchemaUI: normalized.schemaUI,\n }\n this.postMessage({\n type: 'setSettingsSchema',\n ...normalized,\n })\n }\n\n /**\n * Update the app's share target at any time. The new share target replaces\n * the one provided at initialization (ConnectorOptions.shareTarget) and is\n * applied immediately by the host. Can be called repeatedly.\n *\n * @deprecated Use `setShareTargets` to advertise one or more share targets.\n */\n public setShareTarget(shareTarget: ShareTargetOptions) {\n this.options = {\n ...this.options,\n shareTarget,\n shareTargets: [shareTarget],\n }\n this.postMessage({\n type: 'setShareTarget',\n shareTarget,\n })\n }\n\n /**\n * Update the app's share targets at any time. The new array replaces the ones\n * provided at initialization (ConnectorOptions.shareTargets) and is applied\n * immediately by the host. Can be called repeatedly.\n */\n public setShareTargets(shareTargets: ShareTargetOptions[]) {\n this.options = {\n ...this.options,\n shareTargets,\n // Mirror the first target onto the deprecated singular for older Vitres.\n shareTarget: shareTargets[0],\n }\n // Emit the legacy singular first so older Vitres (which only handle\n // `setShareTarget`) still get the primary target at runtime, then the full\n // array which new hosts apply (and which supersedes the singular there).\n if (shareTargets[0]) {\n this.postMessage({\n type: 'setShareTarget',\n shareTarget: shareTargets[0],\n })\n }\n this.postMessage({\n type: 'setShareTargets',\n shareTargets,\n })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public setFramePosition(frameConnectorId: string, position: LayoutPosition) {\n this.postMessage({\n type: 'setFramePosition',\n frameConnectorId,\n position,\n })\n }\n\n public closeFrame(frameConnectorId: string) {\n this.postMessage({\n type: 'closeFrame',\n frameConnectorId,\n })\n }\n\n /**\n * Reassign the owner of an already-opened shared frame. `owner` is a\n * device id from `HostInformation.devicesInSpace[].id`. The new owner\n * drives the languette colour, and when it is a Vitre it takes over\n * hosting the frame so it survives the opener disconnecting.\n */\n public setFrameOwner(frameConnectorId: string, owner: string) {\n this.postMessage({\n type: 'setFrameOwner',\n frameConnectorId,\n owner,\n })\n }\n\n /**\n * Update the visual style of an already-open frame's shared content at any\n * time — the same surface styling and companion icon that\n * `OpenFrameOptions` sets at open time, but applied live. Only the fields you\n * pass change; omitted fields keep their current value. Pass an empty string\n * to clear an override back to the host default (e.g. `{ background: '' }`).\n * The host re-renders the surface on this Vitre, on peer Vitres / tableaux\n * showing the frame, and re-propagates the icon to connected companions.\n */\n public setChromeStyle(frameConnectorId: string, style: ChromeStyle) {\n this.postMessage({\n type: 'setChromeStyle',\n frameConnectorId,\n ...style,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public setFrameSize(frameId: string, size: Size) {\n this.postMessage({\n type: 'setFrameSize',\n frameId,\n size,\n })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port. Resolves with the granted port name\n /// (empty string if denied or cancelled).\n /// - `{ port }` given: the host pre-grants that port and resolves with it,\n /// so a following `navigator.serial.requestPort()` resolves to it with no\n /// picker.\n /// - no argument (or `{}`): the host shows its port-picker and resolves with\n /// the port the user chose (also pre-granted).\n /// Honoured only when the app holds the WebSerial authorization.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n /// Send an opaque message to the companion-side `CompanionConnector`\n /// for the same `appId`. `target` selects one or all companions\n /// currently connected to this Vitre — `{ kind: 'all' }` broadcasts to\n /// every connected companion, `{ kind: 'one', companionId }` addresses a\n /// single one. The message is forwarded unchanged; the receiving side\n /// gets it as `onMessageFromVitreConnector`.\n public sendMessageToCompanionConnector(\n target: CompanionConnectorTarget,\n message: string,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendMessageToCompanionConnector',\n target,\n message,\n fileData,\n })\n }\n}\n\ntype PostMessageConnectorApiOut = (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeConnector<T extends Connector>(\n init: (info: HostInformation) => ConnectorOptions,\n createConnector?: new (\n postMessage: (\n message: ConnectorApiMessagesOut,\n transfer?: Transferable[] | undefined,\n ) => void,\n initializeMessage: InitializeConnector,\n options: ConnectorOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let mainConnector: T | null = null\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageConnectorApiOut) =>\n (e: MessageEvent<ConnectorApiMessagesIn>): any => {\n switch (e.data.type) {\n case 'initialize':\n if (mainConnector == null) {\n const initializeMsg = e.data\n const options = init(initializeMsg.hostInfo)\n mainConnector = new (createConnector ?? Connector)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n ) as T\n const w = window as any\n w.mainConnector = mainConnector\n resolve(mainConnector)\n }\n break\n default:\n mainConnector?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Apps written in plain JS get no help from the `SettingsSchemaProperties` type. The one mistake seen
3
+ * in the wild — a full JSON schema where the fields map is expected — used to
4
+ * crash the settings form of every vitre loading the app, and hosts already
5
+ * deployed do not defend against it: unwrap it here, loudly.
6
+ */
7
+ export declare function normalizeSettingsSchema<T>(schema: T): T;
@@ -0,0 +1,19 @@
1
+ const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
2
+ /**
3
+ * Apps written in plain JS get no help from the `SettingsSchemaProperties` type. The one mistake seen
4
+ * in the wild — a full JSON schema where the fields map is expected — used to
5
+ * crash the settings form of every vitre loading the app, and hosts already
6
+ * deployed do not defend against it: unwrap it here, loudly.
7
+ */
8
+ export function normalizeSettingsSchema(schema) {
9
+ let result = schema;
10
+ while (isPlainObject(result) &&
11
+ typeof result.type === 'string' &&
12
+ isPlainObject(result.properties)) {
13
+ console.error("[lavitre/apps] settingsSchema must be a map of fields ({ city: { type: 'string' } }), " +
14
+ "not a full JSON schema ({ type: 'object', properties: { … } }). Using its `properties`.");
15
+ result = result.properties;
16
+ }
17
+ return result;
18
+ }
19
+ //# sourceMappingURL=SettingsSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsSchema.js","sourceRoot":"","sources":["../../Connector/SettingsSchema.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,CAAC,KAAc,EAAoC,EAAE,CACzE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAI,MAAS;IAClD,IAAI,MAAM,GAAY,MAAM,CAAA;IAC5B,OACE,aAAa,CAAC,MAAM,CAAC;QACrB,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;QAC/B,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,EAChC,CAAC;QACD,OAAO,CAAC,KAAK,CACX,wFAAwF;YACtF,yFAAyF,CAC5F,CAAA;QACD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAA;IAC5B,CAAC;IACD,OAAO,MAAW,CAAA;AACpB,CAAC","sourcesContent":["const isPlainObject = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value)\n\n/**\n * Apps written in plain JS get no help from the `SettingsSchemaProperties` type. The one mistake seen\n * in the wild — a full JSON schema where the fields map is expected — used to\n * crash the settings form of every vitre loading the app, and hosts already\n * deployed do not defend against it: unwrap it here, loudly.\n */\nexport function normalizeSettingsSchema<T>(schema: T): T {\n let result: unknown = schema\n while (\n isPlainObject(result) &&\n typeof result.type === 'string' &&\n isPlainObject(result.properties)\n ) {\n console.error(\n \"[lavitre/apps] settingsSchema must be a map of fields ({ city: { type: 'string' } }), \" +\n \"not a full JSON schema ({ type: 'object', properties: { … } }). Using its `properties`.\",\n )\n result = result.properties\n }\n return result as T\n}\n"]}