@caido/sdk-frontend 0.48.2-beta.1 → 0.48.2-beta.11

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.
@@ -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,7 +1,10 @@
1
+ import { type Extension } from "@codemirror/state";
1
2
  import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent, type DefineAddToSlotFn } from "./slots";
2
3
  import type { ID } from "./utils";
3
4
  export declare const ReplaySlot: {
4
- readonly SessionToolbar: "session-toolbar";
5
+ readonly SessionToolbarPrimary: "session-toolbar-primary";
6
+ readonly SessionToolbarSecondary: "session-toolbar-secondary";
7
+ readonly Topbar: "topbar";
5
8
  };
6
9
  export type ReplaySlot = (typeof ReplaySlot)[keyof typeof ReplaySlot];
7
10
  /**
@@ -121,8 +124,37 @@ export type ReplaySDK = {
121
124
  * Add a component to a slot.
122
125
  * @param slot The slot to add the component to.
123
126
  * @param content The content to add to the slot.
127
+ * @example
128
+ * ```ts
129
+ * addToSlot(ReplaySlot.SessionToolbarPrimary, {
130
+ * kind: "Command",
131
+ * commandId: "my-command",
132
+ * icon: "my-icon",
133
+ * });
134
+ *
135
+ * addToSlot(ReplaySlot.SessionToolbarSecondary, {
136
+ * kind: "Custom",
137
+ * component: MyComponent,
138
+ * });
139
+ *
140
+ * addToSlot(ReplaySlot.Topbar, {
141
+ * kind: "Button",
142
+ * label: "My Button",
143
+ * icon: "my-icon",
144
+ * onClick: () => {
145
+ * console.log("Button clicked");
146
+ * },
147
+ * });
148
+ * ```
124
149
  */
125
150
  addToSlot: DefineAddToSlotFn<{
126
- [ReplaySlot.SessionToolbar]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
151
+ [ReplaySlot.SessionToolbarPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
152
+ [ReplaySlot.SessionToolbarSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
153
+ [ReplaySlot.Topbar]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
127
154
  }>;
155
+ /**
156
+ * Add an extension to the request editor.
157
+ * @param extension The extension to add.
158
+ */
159
+ addRequestEditorExtension: (extension: Extension) => void;
128
160
  };
@@ -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
  };