@caido/sdk-frontend 0.48.2-beta.9 → 0.49.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.48.2-beta.9",
3
+ "version": "0.49.1-beta.0",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -0,0 +1,43 @@
1
+ import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent, type DefineAddToSlotFn } from "./slots";
2
+ export declare const FooterSlot: {
3
+ readonly FooterSlotPrimary: "footer-primary";
4
+ readonly FooterSlotSecondary: "footer-secondary";
5
+ };
6
+ export type FooterSlot = (typeof FooterSlot)[keyof typeof FooterSlot];
7
+ /**
8
+ * Utilities to interact with the footer.
9
+ * @category Footer
10
+ */
11
+ export type FooterSDK = {
12
+ /**
13
+ * Add a component to a slot.
14
+ * @param slot The slot to add the component to.
15
+ * @param content The content to add to the slot.
16
+ * @example
17
+ * ```ts
18
+ * addToSlot(FooterSlot.FooterSlotPrimary, {
19
+ * kind: "Command",
20
+ * commandId: "my-command",
21
+ * icon: "my-icon",
22
+ * });
23
+ *
24
+ * addToSlot(FooterSlot.FooterSlotPrimary, {
25
+ * kind: "Button",
26
+ * label: "My button",
27
+ * icon: "fas fa-rocket",
28
+ * onClick: () => {
29
+ * console.log("Button clicked");
30
+ * },
31
+ * });
32
+ *
33
+ * addToSlot(FooterSlot.FooterSlotSecondary, {
34
+ * kind: "Custom",
35
+ * component: MyComponent,
36
+ * });
37
+ * ```
38
+ */
39
+ addToSlot: DefineAddToSlotFn<{
40
+ [FooterSlot.FooterSlotPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
41
+ [FooterSlot.FooterSlotSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
42
+ }>;
43
+ };
@@ -7,6 +7,7 @@ import type { EnvironmentSDK } from "./environment";
7
7
  import type { FilesSDK } from "./files";
8
8
  import type { FiltersSDK } from "./filters";
9
9
  import type { FindingsSDK } from "./findings";
10
+ import type { FooterSDK } from "./footer";
10
11
  import type { HTTPHistorySDK } from "./httpHistory";
11
12
  import type { InterceptSDK } from "./intercept";
12
13
  import type { MatchReplaceSDK } from "./matchReplace";
@@ -23,6 +24,8 @@ import type { StorageSDK } from "./storage";
23
24
  import type { UISDK } from "./ui";
24
25
  import type { WindowSDK } from "./window";
25
26
  import type { WorkflowSDK } from "./workflows";
27
+ export { FooterSlot } from "./footer";
28
+ export type { DialogOptions } from "./window";
26
29
  export type { CommandContext } from "./commands";
27
30
  export type { MenuItem } from "./menu";
28
31
  export { type ReplayTab, type ReplaySession, type ReplayCollection, ReplaySlot, } from "./replay";
@@ -140,4 +143,8 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
140
143
  * Utilities to interact with workflows.
141
144
  */
142
145
  workflows: WorkflowSDK;
146
+ /**
147
+ * Utilities to interact with the footer.
148
+ */
149
+ footer: FooterSDK;
143
150
  };
@@ -1,4 +1,5 @@
1
1
  import type { Editor } from "./editor";
2
+ import type { CustomSlotContent } from "./slots";
2
3
  /**
3
4
  * Utilities to interact with the active page.
4
5
  * @category Window
@@ -20,4 +21,24 @@ export type WindowSDK = {
20
21
  variant?: "success" | "error" | "warning" | "info";
21
22
  duration?: number;
22
23
  }) => void;
24
+ /**
25
+ * Show a dialog component.
26
+ * @param component The custom slot content to display in the dialog.
27
+ * @param options Options for the dialog.
28
+ * @param options.title The title text for the dialog. Defaults to ""
29
+ * @param options.draggable Whether the dialog is draggable. Defaults to false
30
+ * @param options.closeOnEscape Whether the dialog closes when pressing Escape. Defaults to true
31
+ * @param options.modal Whether the dialog is modal. Defaults to true
32
+ * @param options.position The position of the dialog on the screen. Defaults to center
33
+ * @param options.closable Whether the close icon is hidden . Defaults to false
34
+ */
35
+ showDialog: (component: CustomSlotContent, options?: DialogOptions) => void;
36
+ };
37
+ export type DialogOptions = {
38
+ title?: string;
39
+ draggable?: boolean;
40
+ closeOnEscape?: boolean;
41
+ closable?: boolean;
42
+ modal?: boolean;
43
+ position?: "left" | "right" | "top" | "bottom" | "center" | "topleft" | "topright" | "bottomleft" | "bottomright";
23
44
  };