enso/app/gui2/env.d.ts
Paweł Grabarz 8edf49343f
Expose cloud event logging endpoint to GUI and render GUI editor as react component. (#9951)
fixes #9730

Added a `logEvent` method to remote backend implementation in dashboard. Added an always-present remote backend instance that can be used for logging even when running a local project (intentional behavior).

# Important Notes
Because the backend implementation requires access to always fresh session token, the logger needs to be periodically updated on GUI side, so it can continue to function. To accomplish that, I simplified the app loading logic to treat GUI as an ordinary react component, so its props can be updated with normal react rendering flow. That refactor also removed the dynamic GUI asset loading code that was only needed for Rust GUI.
2024-05-27 17:32:42 +00:00

38 lines
1.1 KiB
TypeScript

/// <reference types="vite/client" />
declare const PROJECT_MANAGER_URL: string
declare const YDOC_SERVER_URL: string
declare const RUNNING_VITEST: boolean
declare const IS_CLOUD_BUILD: boolean
interface Document {
caretPositionFromPoint(x: number, y: number): { offsetNode: Node; offset: number } | null
}
interface Window {
fileBrowserApi: FileBrowserApi
}
/** `window.fileBrowserApi` is a context bridge to the main process, when we're running in an
* Electron context.
*
* # Safety
*
* We're assuming that the main process has exposed the `fileBrowserApi` context bridge (see
* `app/ide-desktop/lib/client/src/preload.ts` for details), and that it contains the functions defined in this
* interface.
*/
interface FileBrowserApi {
/**
* Select path for local file or directory using the system file browser.
* 'filePath' is same as 'file', but allows picking non-existing files.
*/
readonly openFileBrowser: (
kind: 'file' | 'directory' | 'default' | 'filePath',
) => Promise<string[] | undefined>
}
interface LogEvent {
(message: string, projectId?: string | null, metadata?: object | null): void
}