@caido/sdk-frontend 0.51.2-beta.16 → 0.51.2-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.51.2-beta.16",
3
+ "version": "0.51.2-beta.17",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -15,5 +15,6 @@ export type { EnvironmentVariable } from "./types/environment";
15
15
  export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
16
16
  export type { ListenerHandle } from "./types/utils";
17
17
  export type { AIProvider } from "./types/ai";
18
+ export type { SelectedProjectChangeEvent } from "./types/projects";
18
19
  export type { API } from "./sdks";
19
20
  export { Routes } from "./types/navigation";
@@ -16,6 +16,7 @@ import type { InterceptSDK } from "./intercept";
16
16
  import type { MatchReplaceSDK } from "./matchReplace";
17
17
  import type { MenuSDK } from "./menu";
18
18
  import type { NavigationSDK } from "./navigation";
19
+ import type { ProjectsSDK } from "./projects";
19
20
  import type { ReplaySDK } from "./replay";
20
21
  import type { RuntimeSDK } from "./runtime";
21
22
  import type { ScopesSDK } from "./scopes";
@@ -68,6 +69,10 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
68
69
  * Utilities to interact with navigation.
69
70
  */
70
71
  navigation: NavigationSDK;
72
+ /**
73
+ * Utilities to interact with projects.
74
+ */
75
+ projects: ProjectsSDK;
71
76
  /**
72
77
  * Utilities to interact with the active page.
73
78
  */
@@ -0,0 +1,24 @@
1
+ import { type SelectedProjectChangeEvent } from "../types/projects";
2
+ import { type ListenerHandle } from "../types/utils";
3
+ /**
4
+ * Utilities to interact with projects.
5
+ * @category Projects
6
+ */
7
+ export type ProjectsSDK = {
8
+ /**
9
+ * Subscribe to selected project changes.
10
+ * @param callback The callback to call when the selected project changes.
11
+ * @returns An object with a `stop` method that can be called to stop listening to project changes.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const handler = sdk.projects.onCurrentProjectChange((event) => {
16
+ * console.log('Selected project changed to:', event.projectId);
17
+ * });
18
+ *
19
+ * // Later, stop listening
20
+ * handler.stop();
21
+ * ```
22
+ */
23
+ onCurrentProjectChange: (callback: (event: SelectedProjectChangeEvent) => void) => ListenerHandle;
24
+ };
@@ -0,0 +1,8 @@
1
+ import { type ID } from "./utils";
2
+ /**
3
+ * Event fired when the selected project changes.
4
+ * @category Projects
5
+ */
6
+ export type SelectedProjectChangeEvent = {
7
+ projectId: ID | undefined;
8
+ };