{{ result }}
+Lorem ipsum.
+Paragraph.
+Footer text.
+
-
-### Creating a Well
-
-```ts
-const well = sdk.ui.well({
- header: title,
- body: paragraph,
- footer: advisory,
-});
-```
-
-A **well** is a layout component. Wells are similar to cards in that they consist of `header`, `body` and `footer` properties.
-
-All properties are optional. The value of each property is a defined HTML element.
-
-### Creating a Request Editor
-```ts
-const reqEditor = sdk.ui.httpRequestEditor();
-const reqEditorPane = reqEditor.getElement();
-```
-
-### Creating a Response Editor
-
-```ts
-const respEditor = sdk.ui.httpResponseEditor();
-const respEditorPane = respEditor.getElement();
-```
-
-::: tip
-For an example of a page with request and response editors, expand the following:
-
-Lorem ipsum.
+Paragraph.
+Footer text.
+
+
## Interacting with Windows and Editors
@@ -318,80 +230,83 @@ All message properties are optional and include:
- `variant` - Specifies the message type and can have a value of `"success"`, `"error"`, `"warning"` or `"info"`.
- `duration` - Specifies the amount of time a message will be displayed in milliseconds.
-::: tip
-For an example of how to trigger Toast messages on button clicks, expand the following:
+## Examples
-Lorem ipsum.
+Paragraph.
+
diff --git a/src/guides/replay.md b/src/guides/replay.md
index 7dcdfe3..549e663 100644
--- a/src/guides/replay.md
+++ b/src/guides/replay.md
@@ -50,6 +50,10 @@ To create a new collection:
const collection = await sdk.replay.createCollection("My Collection");
```
+::: tip
+Use collections to organize related replay sessions, making it easier to manage and find specific sessions for testing scenarios.
+:::
+
### Getting Collections
To retrieve all collections:
@@ -129,6 +133,10 @@ const handler = sdk.replay.onCurrentSessionChange((event) => {
handler.stop();
```
+::: info
+Sessions and collections are persisted across Caido restarts, so programmatically created items will remain available.
+:::
+
## Examples
### Session Manager Plugin
@@ -136,147 +144,154 @@ handler.stop();
This example creates a comprehensive session and collection management interface. It displays all replay sessions and collections, allows opening sessions in tabs, creating new collections, and deleting items. It also subscribes to session change events.
```ts
+import { Classic } from "@caido/primevue";
+import PrimeVue from "primevue/config";
+import { createApp } from "vue";
+
import type { Caido } from "@caido/sdk-frontend";
+import App from "./views/App.vue";
+
export type CaidoSDK = Caido;
-const createPage = (sdk: CaidoSDK) => {
- const container = document.createElement("div");
- container.style.padding = "20px";
- container.style.display = "flex";
- container.style.flexDirection = "column";
- container.style.gap = "16px";
+export const init = (sdk: CaidoSDK) => {
+ const app = createApp(App);
+
+ app.provide("sdk", sdk);
+
+ app.use(PrimeVue, {
+ unstyled: true,
+ pt: Classic,
+ });
- // Sessions list
- const sessionsList = document.createElement("div");
- sessionsList.id = "sessions-list";
+ const root = document.createElement("div");
+ Object.assign(root.style, {
+ height: "100%",
+ width: "100%",
+ });
- const refreshSessions = () => {
- sessionsList.innerHTML = "";
- const sessions = sdk.replay.getSessions();
+ app.mount(root);
- if (sessions.length === 0) {
- sessionsList.textContent = "No sessions found";
- return;
- }
+ sdk.navigation.addPage("/replay-manager", {
+ body: root,
+ });
- sessions.forEach((session) => {
- const sessionItem = document.createElement("div");
- sessionItem.style.padding = "8px";
- sessionItem.style.border = "1px solid #ccc";
- sessionItem.style.marginBottom = "8px";
-
- const name = document.createElement("h3");
- name.textContent = session.name || `Session ${session.id}`;
- sessionItem.appendChild(name);
-
- const openButton = sdk.ui.button({
- variant: "primary",
- label: "Open",
- size: "small",
- });
- openButton.addEventListener("click", () => {
- sdk.replay.openTab(session.id);
- sdk.navigation.goTo({ id: "replay" });
- });
- sessionItem.appendChild(openButton);
-
- const deleteButton = sdk.ui.button({
- variant: "secondary",
- label: "Delete",
- size: "small",
- });
- deleteButton.addEventListener("click", async () => {
- await sdk.replay.deleteSessions([session.id]);
- refreshSessions();
- sdk.window.showToast("Session deleted", { variant: "success" });
- });
- sessionItem.appendChild(deleteButton);
-
- sessionsList.appendChild(sessionItem);
- });
- };
+ // Listen for session changes
+ sdk.replay.onCurrentSessionChange((event) => {
+ sdk.log.info("Current session changed to:", event.sessionId);
+ });
+};
+```
- // Collections list
- const collectionsList = document.createElement("div");
- collectionsList.id = "collections-list";
+```vue
+
+
+
+ {{ collection.sessionIds.length }} sessions
+ +{{ result }}
+
diff --git a/src/guides/runtime.md b/src/guides/runtime.md
index b34b5ec..7105a25 100644
--- a/src/guides/runtime.md
+++ b/src/guides/runtime.md
@@ -43,130 +43,30 @@ export const init = (sdk: CaidoSDK) => {
### Version Display
-This example creates a page that displays the current Caido version and plugin compatibility status. It shows the version information in a formatted card with styling.
-
-```ts
-import type { Caido } from "@caido/sdk-frontend";
-
-export type CaidoSDK = Caido;
-
-const createPage = (sdk: CaidoSDK) => {
- const container = document.createElement("div");
- container.style.padding = "20px";
- container.style.display = "flex";
- container.style.flexDirection = "column";
- container.style.gap = "16px";
-
- const versionInfo = document.createElement("div");
- versionInfo.style.padding = "16px";
- versionInfo.style.backgroundColor = "#f5f5f5";
- versionInfo.style.borderRadius = "4px";
-
- const version = sdk.runtime.version;
- versionInfo.innerHTML = `
- Version: ${version}
-Plugin Compatibility: ✓ Compatible
- `; - - container.appendChild(versionInfo); - - const card = sdk.ui.card({ - body: container, - }); - - sdk.navigation.addPage("/version-info", { - body: card, - }); -}; - -export const init = (sdk: CaidoSDK) => { - createPage(sdk); -}; -``` - -### Feature Detection - -This example implements a feature availability checker that determines if specific features are available based on the Caido version. It checks version requirements for features like "advanced-filters" and "ai-integration" and enables or disables features accordingly. - -```ts -import type { Caido } from "@caido/sdk-frontend"; - -export type CaidoSDK = Caido; - -const checkFeatureAvailability = (sdk: CaidoSDK, feature: string): boolean => { - const version = sdk.runtime.version; - const [major, minor] = version.split(".").map(Number); - - // Feature availability based on version - const features: RecordVersion: {{ version }}
+Plugin Compatibility: ✓ Compatible
+Allowlist: {{ scope.allowlist.join(", ") }}
+Denylist: {{ scope.denylist.join(", ") }}
+ +