@caido/sdk-frontend 0.51.2-beta.14 → 0.51.2-beta.16
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
package/src/types/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkfl
|
|
|
16
16
|
export type { ListenerHandle } from "./types/utils";
|
|
17
17
|
export type { AIProvider } from "./types/ai";
|
|
18
18
|
export type { API } from "./sdks";
|
|
19
|
+
export { Routes } from "./types/navigation";
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
+
import { type PageChangeEvent, type Routes } from "../types/navigation";
|
|
2
|
+
import { type ListenerHandle } from "../types/utils";
|
|
1
3
|
/**
|
|
2
4
|
* Utilities to interact with navigation.
|
|
3
5
|
* @category Navigation
|
|
4
6
|
*/
|
|
5
7
|
export type NavigationSDK = {
|
|
6
8
|
/**
|
|
7
|
-
* Navigate to a path.
|
|
8
|
-
* @param
|
|
9
|
+
* Navigate to a route or path.
|
|
10
|
+
* @param route The route to navigate to. Can be a route ID object or a custom path string.
|
|
9
11
|
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```ts
|
|
14
|
+
* sdk.navigation.goTo({ id: Routes.Replay });
|
|
15
|
+
* sdk.navigation.goTo({ id: Routes.Projects });
|
|
12
16
|
* sdk.navigation.goTo("/my-plugin-page");
|
|
13
17
|
* ```
|
|
14
18
|
*/
|
|
15
|
-
goTo: (
|
|
19
|
+
goTo: (route: string | {
|
|
20
|
+
id: Routes;
|
|
21
|
+
}) => void;
|
|
16
22
|
/**
|
|
17
23
|
* Add a page to the navigation.
|
|
18
24
|
* @param path The path of the page.
|
|
@@ -26,4 +32,21 @@ export type NavigationSDK = {
|
|
|
26
32
|
topbar?: HTMLElement;
|
|
27
33
|
onEnter?: () => void;
|
|
28
34
|
}) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe to page changes.
|
|
37
|
+
* @param callback The callback to call when the page changes.
|
|
38
|
+
* @returns An object with a `stop` method that can be called to stop listening to page changes.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const handler = sdk.navigation.onPageChange((event) => {
|
|
43
|
+
* console.log('Page changed to:', event.routeId);
|
|
44
|
+
* console.log('- path:', event.path);
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Later, stop listening
|
|
48
|
+
* handler.stop();
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
onPageChange: (callback: (route: PageChangeEvent) => void) => ListenerHandle;
|
|
29
52
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const Routes: {
|
|
2
|
+
readonly Sitemap: "Sitemap";
|
|
3
|
+
readonly Intercept: "Intercept";
|
|
4
|
+
readonly Search: "Search";
|
|
5
|
+
readonly HTTPHistory: "HTTPHistory";
|
|
6
|
+
readonly Websockets: "Websockets";
|
|
7
|
+
readonly Workflows: "Workflows";
|
|
8
|
+
readonly Replay: "Replay";
|
|
9
|
+
readonly Automate: "Automate";
|
|
10
|
+
readonly Projects: "Projects";
|
|
11
|
+
readonly Backups: "Backups";
|
|
12
|
+
readonly MatchReplace: "Tamper";
|
|
13
|
+
readonly Assistant: "Assistant";
|
|
14
|
+
readonly Environment: "Environment";
|
|
15
|
+
readonly Scope: "Scope";
|
|
16
|
+
readonly Filter: "Filter";
|
|
17
|
+
readonly Exports: "Exports";
|
|
18
|
+
readonly Findings: "Findings";
|
|
19
|
+
readonly Files: "Files";
|
|
20
|
+
readonly Plugins: "Plugins";
|
|
21
|
+
readonly Certificate: "Certificate";
|
|
22
|
+
readonly About: "About";
|
|
23
|
+
readonly Settings: "Settings";
|
|
24
|
+
};
|
|
25
|
+
export type Routes = (typeof Routes)[keyof typeof Routes];
|
|
26
|
+
export type PageChangeEvent = {
|
|
27
|
+
type: "Core";
|
|
28
|
+
routeId: Routes;
|
|
29
|
+
path: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "Plugin";
|
|
32
|
+
path: string;
|
|
33
|
+
};
|