Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/sandbox/src/EmbeddedSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import packageJSON from '../package.json';
import type { JSONObject } from './helpers/types';

type InitialState = {
/**
* optional. Set initial display options for sandbox
*/
displayOptions?: {
docsPanelState?: 'open' | 'closed'; // default to 'open',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};
/**
* optional. Set headers for every operation a user triggers from this Sandbox.
* Users can check and uncheck these headers, but not edit them.
Expand Down Expand Up @@ -139,7 +145,8 @@ export class EmbeddedSandbox {
let element: HTMLElement | null;
const { target, runTelemetry } = this.options;

const { includeCookies, sharedHeaders } = this.options.initialState || {};
const { includeCookies, sharedHeaders, displayOptions } =
this.options.initialState || {};

const queryParams = {
runtime: this.options.runtime,
Expand Down Expand Up @@ -185,6 +192,7 @@ export class EmbeddedSandbox {
shouldDefaultAutoupdateSchema:
this.options.initialState?.pollForSchemaUpdates ?? true,
endpointIsEditable: this.options.endpointIsEditable,
docsPanelState: displayOptions?.docsPanelState ?? 'open',
};

const queryString = Object.entries(queryParams)
Expand Down