@caido/sdk-frontend 0.49.1-beta.4 → 0.49.1-beta.6

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.49.1-beta.4",
3
+ "version": "0.49.1-beta.6",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  import { type Extension } from "@codemirror/state";
2
- import { type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab } from "../types/replay";
2
+ import { type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab } from "../types/replay";
3
3
  import { type DefineAddToSlotFn } from "../types/slots";
4
4
  import type { ID } from "../types/utils";
5
5
  /**
@@ -10,8 +10,9 @@ export type ReplaySDK = {
10
10
  /**
11
11
  * Open a replay tab for the given session.
12
12
  * @param sessionId The ID of the session to open.
13
+ * @param options The options for opening the tab.
13
14
  */
14
- openTab: (sessionId: ID) => void;
15
+ openTab: (sessionId: ID, options?: OpenTabOptions) => void;
15
16
  /**
16
17
  * Close a replay tab for the given session.
17
18
  * @param sessionId The ID of the session to close.
@@ -1,6 +1,6 @@
1
1
  import type { Editor } from "../types/editor";
2
2
  import type { ComponentDefinition } from "../types/utils";
3
- import { type DialogOptions } from "../types/window";
3
+ import { type Dialog, type DialogOptions } from "../types/window";
4
4
  /**
5
5
  * Utilities to interact with the active page.
6
6
  * @category Window
@@ -32,6 +32,7 @@ export type WindowSDK = {
32
32
  * @param options.modal Whether the dialog is modal. Defaults to true
33
33
  * @param options.position The position of the dialog on the screen. Defaults to center
34
34
  * @param options.closable Whether the close icon is hidden . Defaults to false
35
+ * @returns A dialog object that can be used to close the dialog.
35
36
  */
36
- showDialog: (component: ComponentDefinition, options?: DialogOptions) => void;
37
+ showDialog: (component: ComponentDefinition, options?: DialogOptions) => Dialog;
37
38
  };
@@ -11,6 +11,17 @@ export type ReplaySlotContent = {
11
11
  [ReplaySlot.SessionToolbarSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
12
12
  [ReplaySlot.Topbar]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
13
13
  };
14
+ /**
15
+ * Options for opening a tab.
16
+ * @category Replay
17
+ */
18
+ export type OpenTabOptions = {
19
+ /**
20
+ * Whether to select the tab after opening it.
21
+ * Defaults to true.
22
+ */
23
+ select?: boolean;
24
+ };
14
25
  /**
15
26
  * A replay tab.
16
27
  * @category Replay
@@ -6,3 +6,6 @@ export type DialogOptions = {
6
6
  modal?: boolean;
7
7
  position?: "left" | "right" | "top" | "bottom" | "center" | "topleft" | "topright" | "bottomleft" | "bottomright";
8
8
  };
9
+ export type Dialog = {
10
+ close: () => void;
11
+ };