import type { Theme, ThemeVariant, ThemeVariantOrAuto } from './theme'; export interface EmbedderDetails { content?: DocumentContent; sdkVersion?: string; title?: string; url?: string; } export type MimeType = 'text/html' | 'text/markdown' | 'text/plain'; export interface DocumentContent { /** * Mime type of the document content. */ mimeType: MimeType; /** * Textual content/Body of the document, which can be either plain or formatted text. * The format is determined by the "mimeType" property. */ text: string; } /** * DocumentContext.url is used to fetch document info, if url missing or unindexed * content, id & title are used to create a fallback document */ export interface DocumentContext { /** * Content of the document to be used if document not indexed */ content?: DocumentContent; /** * Document title, used when `DocumentContext.url` is missing or url unindexed */ title?: string; /** * Glean indexed document URL */ url?: string; } /** * Style and other options which can be customized on the embedded search widget box. */ export interface BoxCustomizations { /** The CSS border of the widget box */ border?: string; /** The border radius of the widget box */ borderRadius?: number; /** The CSS box-shadow of the widget box */ boxShadow?: string; /** A CSS margin to the left and right of the widget box */ horizontalMargin?: number; /** A CSS margin above and below the widget box */ verticalMargin?: number; } export interface ChatCustomizations { /** * Controls where the autocomplete dropdown appears relative to the chat input box. * Only applies when `features.autocomplete` is enabled. * * - 'above' - Autocomplete results appear above the input box. * - 'below' - Autocomplete results appear below the input box. * * Default is 'above'. */ autocompletePosition?: 'above' | 'below'; /** * Customizations for the widget box. */ container?: BoxCustomizations; /** * Options to control which chat features or UI elements are displayed in the widget. */ features?: { /** * The entry point to the agents library. Default is true. */ agentLibrary?: boolean; /** * The element that shows metadata about an embedded agent. Default is true. */ agentMetadata?: boolean; /** * The entry point to the AI apps library. Default is true. */ applicationLibrary?: boolean; /** * Autocomplete suggestions shown in the chat input. Default is false. */ autocomplete?: boolean; /** * The menu which displays chat history and other advanced features. Default is true. */ chatMenu?: boolean; /** * The button that leads to the chat settings menu. Default is true. */ chatSettings?: boolean; /** * The button that clears the current chat session. Default is true when chat menu is disabled. */ clearChat?: boolean; /** * The button that opens prompt creation drawer. Default is true. */ createPrompt?: boolean; /** * The button that opens the feedback form. Default is true. */ feedback?: boolean; /** * The ability to start a new chat from the chat menu. Disabling this will remove the new chat button in the chat menu. Default is true. */ newChatButton?: boolean; /** * The entry point to the prompts library. Default is true. */ promptLibrary?: boolean; }; } export interface RecommendationsBoxCustomizations { /** The CSS border of the widget box */ border?: string; /** The border radius of the widget box */ borderRadius?: number; /** The CSS box-shadow of the widget box */ boxShadow?: string; /** A CSS margin to the left and right of the widget box */ horizontalMargin?: number; /** Optional style customizations for the search box */ searchBox?: Pick; /** Whether a hint should be displayed when no recommendations are present. * default: true */ showNoRecommendationsHint?: boolean; /** A CSS margin above and below the widget box */ verticalMargin?: number; } export interface SearchBoxCustomizations extends BoxCustomizations { /** The background color of the search box. Default: transparent. */ backgroundColor?: string; /** The size of the placeholder and query text. Default: 16px. */ fontSize?: number; /** Text to display in the search box before a query is entered */ placeholderText?: string; /** An https: or data: URL for an image to display instead of the default search icon (magnifying glass) */ searchIconUrl?: string; } /** * @export * @interface AuthTokenDetails */ export interface AuthTokenDetails { /** * Unix timestamp for when this token expires (in seconds since epoch UTC). * @type {number} * @memberof AuthTokenDetails */ expirationTime: number; /** * An authentication token that can be passed to any endpoint via Bearer Authentication * @type {string} * @memberof AuthTokenDetails */ token: string; } export type EmbedMode = 'chat' | 'search_results'; export interface FontFaceDetails { /** * The font-family of the FontFace. */ family: string; /** * The URL path of the font file. The file must be hosted by Glean. */ url: string; /** * The variation settings of the font file, e.g. "wght" for weight. */ variationSettings?: string; /** * The weight of the font file, e.g. 400 for a "regular" font or 700 for a "bold" font. */ weight?: string | number; } export interface FilterConfig { /** * The name of a glyph icon to display next to the filter name. Supported values are a subset * of those found at https://www.feathericons.com. Contact Glean to add support for new values. */ iconName: string; /** * The unique identifier of the filter. If the filter is based on a property of custom datasource * documents, the key should match the name of the custom property. */ key: string; /** * Placeholder text to show when no filter value is selected. */ placeholder: string; } export interface FilterValue { /** * The unique identifier of the filter. If the filter is based on a property of custom datasource * documents, the key should match the name of the custom property. */ key: string; /** * The value of the filter, e.g. "bug" or "document" for the "type" filter. */ value: string; } export interface Options { /** * The authentication method to use in the embedded widget. * * sso - Logged out users will see a login button in the embedded widget. Clicking * the button will open the SSO login flow in a new window. * * token - The embedding page obtains an auth token on behalf of the user and passes * it to the embedded widget. If this method is specified the {@link Options.authToken} and * {@link Options.onAuthTokenRequired} options must also be specified. */ authMethod?: 'sso' | 'token'; /** * An authentication token for the user. Providing this obviates the need for * the user to separately login to Glean. May be obtained via: * https://developers.glean.com/api/client-api/authentication/createauthtoken * * If an authToken is provided, {@link Options.onAuthTokenRequired} must also * be provided. */ authToken?: AuthTokenDetails; /** * Overrides the search backend server to use. * * Setting this explicitly is always recommended as it alleviates the user from * from having to manually enter their email address in order to route to the * backend instance to log into. * * It's also useful for routing users to a production vs staging server (if available). * * Example: `https://{your}-be.glean.com/` */ backend?: string; /** * If true, Glean will not collect client analytics or log activity for the embedded session. * * Analytics data is used to monitor and improve the product experience, so it's recommended * to leave data collection on unless the user has specifically requested otherwise. */ disableAnalytics?: boolean; /** * If true, Glean Assistant will not be enabled for the embedded session, including but not limited to * generated answers, summaries, chat, and other features. */ disableAssistant?: boolean; /** * Always open links from these domains in the current tab. * * Expects a list of one or more domain suffixes, e.g. `['example.com', 'foo.example.org']`. */ domainsToOpenInCurrentTab?: string[]; /** * Enable flow to request the user for access if third-party cookies are blocked. * If true, the user will be prompted to allow cookie access for glean.com when they * try to login. * * Default to true since api version >= 2025-06-19. * * Note: This flag will have no impact if third-party cookies are already allowed. Users will be able * to login as usual. * * Refer to [Guide to third-party cookies in Glean](https://developers.glean.com/docs/browser_api/third_party_cookies/) * for more details. */ enable3PCookieAccessRequest?: boolean; /** * Logs an activity event for each URL change of the embedding page. * * This improves search quality when embedded within a datasource for * which there are not other activity signals (e.g. Salesforce). * * Note: if disableAnalytics is true, activity logging will be disabled * regardless of the value of this option. */ enableActivityLogging?: boolean; /** * An external session identifier provided by the embedder. Included in all analytics * events so embedders can join Glean logs with their own session telemetry. */ externalSessionId?: string; /** * An external user identifier provided by the embedder. Included in all analytics * events so embedders can join Glean logs with their own user telemetry. */ externalUserId?: string; /** * A list of custom font-faces to include in the embedded page. When provided, the custom font-faces * can be selected via the fontFamily option. */ fontFaces?: FontFaceDetails[]; /** * The font-family used for text in the embedded widget. */ fontFamily?: string; /** * The base font size of the embedded app. * * Defaults to 'medium' which corresponds to the browser's default font size, typically 16px. * The actual font sizes of elements are relative to this value, some will be larger or smaller. */ fontSize?: 'medium' | 'large' | 'larger'; /** * Uniquely identify the widget. * Must be used if more than one Glean widget of the same type are rendered on the page * * Allowed characters: [a-z A-Z - _ . ; :] */ key?: string; /** * Overrides the default locale for the embedded widget users. * If 'auto' (default) is used, Glean will automatically detect the locale from user's browser. * If an unsupported locale is provided, Glean will fallback to use the closest supported locale. * * If user picked their locale for Glean, their choice will be respected. */ locale?: string; /** * A callback invoked when the user requires a new authentication token. * Only invoked if an {@link Options.authToken} is provided initially and is * nearing expiration. * * This option is required when {@link Options.authMethod} is 'token'. * * **Signatures:** * * 1. `() => Promise` - (Recommended) Return a Promise that * resolves to the new token details. The SDK will update the token internally * without requiring a re-render. * * @example * onAuthTokenRequired: async () => { * const token = await fetchNewToken() * return { token: token.value, expirationTime: token.expiresAt } * } * * 2. `() => void` - (Legacy) The callback must fetch a new token and call the * SDK's render method with updated options containing the new token. */ onAuthTokenRequired?: (() => Promise) | (() => void); /** * A theme applied throughout the embedded widget. If a theme variant (e.g. dark) isn't * supplied, the default Glean theme will be used when the user has applied that variant. * If any color is not supplied for a variant, the default Glean color will be used. */ theme?: Partial>; /** * Overrides the theme variant for the embedded widget (default: light) * If 'auto' is selected, Glean will automatically switch between light and dark * mode and remain in sync with the user device. */ themeVariant?: ThemeVariantOrAuto; /** * A message to display when the current session does not have valid authorization. * * The message only applies when {@link Options.authToken} is used ({@link Options.authMethod} is 'token'). * It can be used to instruct the user on how to get back to an authorized session, e,g, "Please refresh the page" * or "Sign in to [SSO provider]". */ unauthorizedMessage?: string; /** * Always open matching URLs in the current tab * * Should be an array of strings representing a regular expression. * For example: "^https:\\/\\/example\\.com.*$" will match any URL that starts with 'https://example.com'. * * Rules: * - Every regular expression MUST start with '^' to ensure it matches from the start of the URL. * - Regular expressions do not include search params when matching the URL. * - A maximum of 10 entries are allowed in the array. */ urlsToOpenInCurrentTab?: string[]; /** * The web page URL where users access Glean. For example: https://\.glean.com. * * Admins can find this value at https://app.glean.com/admin/about-glean in the `Web app URL` field. */ webAppUrl?: string; } export interface SearchOptions extends Options { /** * Select the search tab for the given datasource (e.g. `'confluence'`, `'gdrive'`, * `'people'`) instead of the all tab. Other datasource tabs will be shown if * results are available for the current query. See also {@link SearchOptions.datasourcesFilter}. */ datasource?: string; /** * Filter search results to only the given list of datasources (e.g. `['figma']`, `['jira', * 'zendesk']`). Results from other datasources will not be available. See also * {@link SearchOptions.datasource}. */ datasourcesFilter?: string[]; /** * Filters applied on all searches done by the user. Any filters in this list will override any manually * input filters from users or filters defined in {@link initialFilters} that share the same key. These filters are * non-modifiable by the user, and will not show up in the UI as being applied. * * For example, if a filter with some key `keyA` is specified here, then: * - Users will not be able to modify any filters corresponding to `keyA` in the UI in any way * - The filter dropdown for that key will not show up on the UI (nor in the overflow button) * - Search bar operators (i.e. `keyA:[value]`) with that key will be overridden and removed from the search bar query * - Any filters defined in {@link initialFilters} with `keyA` will be ignored. * * When specifying the list of filters the same `key` may be specified more than once, in which * case the `value`s for that key are combined via an 'OR' operation. The `value`s for different * `key`s are combined via 'AND'. For example, this set of filters will match all results that * were updated in the past week AND are of type "bug" OR "task": * * ``` * [{ key: "type", value: "bug" }, { key: "type", value: "task" }, { key: "updated", value: "past_week" }] * ``` */ filters?: FilterValue[]; /** * If true, search boxes will not render the autocomplete dropdown. */ hideAutocomplete?: boolean; /** * @deprecated Use {@link filters} instead. */ initialFilters?: FilterValue[]; /** * A callback invoked when the user tries to initiate a chat from search pages, like follow ups from AI Answer. * * If provided, we will allow and show follow ups on AI Answer for user to continue to chat from there, * typical usage can be: * 1. open the chat in a new page * 2. or open chat with `renderChat` method on the same page * * @param chatId An opaque id that stores the context of the current / new chat for the current session */ onChat?: (chatId?: string) => void; /** * A callback invoked when the user performs a search query. */ onSearch: (query: string) => void; /** * The initial query text to perform/display. */ query?: string; } export interface SearchBoxOptions extends SearchOptions { /** * Specifies whether the autocomplete box should automatically get focus when initially displayed. * Default value is false. * * Note: When using the autofocus prop, consider accessibility concerns as it can be disorienting for * visually-impaired users relying on screen readers and may cause unexpected scrolling and keyboard * display on touch devices. Check * [autofocus accessibility considerations](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus#accessibility_considerations) */ autofocus?: boolean; /** * Optional style customizations for the search box. */ searchBoxCustomizations?: SearchBoxCustomizations; } export interface TabbedSearchOptions extends SearchOptions { /** * If true, the search results frame will automatically expand its height to match * the content, removing the need for an internal scrollbar. The embedder is * responsible for providing a scrollable container around the widget. */ autoExpand?: boolean; /** * A list of result tabs to show by default. Other result tabs (if available) will be visible via the * filter selector button. */ defaultResultTabs?: string[]; /** * If true, hide the datasource filter in the righthand column of the * search results page. */ hideDatasourceFilter?: boolean; /** * If true, hides the righthand column of the search results page. */ hideFiltersColumn?: boolean; /** * If true, hide the top bar filters in the search results page. */ hideTopBarFilters?: boolean; /** * A callback invoked when the user changes search tabs to a different * datasource. If `undefined`, all datasources are shown. */ onDatasourceChange?: (datasource?: string) => void; /** * Optional style customizations for the search box, only used when `showInlineSearchBox` is true. */ searchBoxCustomizations?: SearchBoxCustomizations; /** * When the inline search box is visible, this option allows displaying autocomplete content * in place of search results when the search query is empty. * * Note that this option is mutually exclusive with 'showHomePageContent', * and if both are set, 'showHomePageContent' takes precedence. */ showAutocompleteContent?: boolean; /** * Whether to show home page content in place of search results when the * search query is empty. */ showHomePageContent?: boolean; /** * Whether or not to show the search box inline above the search results. */ showInlineSearchBox?: boolean; /** * If specified, these filters will be displayed in the top bar above the results pane instead * of the default filters, in the order specified. */ topBarFilterOverrides?: FilterConfig[]; } export interface RecommendationsSearchOptions extends Pick { } export interface RecommendationsResultsOptions extends Pick { } export interface RecommendationsOptions extends Options, RecommendationsSearchOptions, RecommendationsResultsOptions { /** * Optional styling of the widget box. When adding boxShadow, border provide * enough margin so they are visible */ customizations?: RecommendationsBoxCustomizations; /** * Determines the total height of the widget in the open state. If not * provided 650px is taken as default. */ height?: number; /** * Information about the current document for which Glean widget will show recommendations. If not provided, * the embedder page info is used. */ sourceDocument?: DocumentContext; } export interface ChatOptions extends Options { /** * Specifies the agent to use for chat responses: * - [deprecating] DEFAULT - Integrates with your company's knowledge. This will soon be deprecated in favor of the FAST and * ADVANCED `agent` values. * - [deprecating] GPT - Communicates directly with the LLM. This will soon be deprecated in favor of the FAST and ADVANCED * `agent` values. * - FAST - Uses an agent powered by the agentic engine that responds faster but may have lower quality results. * Requires the agentic engine to be enabled in the deployment. * - ADVANCED - Uses an agent powered by the agentic engine that thinks for longer and potentially makes more LLM * calls to return higher quality results. Requires the agentic engine to be enabled in the deployment. */ agent?: 'DEFAULT' | 'GPT' | 'FAST' | 'ADVANCED'; /** * The ID of the Agent that should be used in chat. */ agentId?: string; /** * The ID of the application used to determine the configuration of underlying chat processes. * This should match the Application ID for an application created with the AI App builder. */ applicationId?: string; /** * An opaque id that stores the context of the current / new chat for the current session. */ chatId?: string; /** * Optional style customizations. */ customizations?: ChatCustomizations; /** * Specifies the message sent by the user to initiate the chat. */ initialMessage?: string; /** * Specifies the landing page to show when the user first lands on the chat page. * The default is 'chat'. */ landingPage?: 'chat' | 'agentLibrary'; /** * The ID of the prompt that will open initially in the chat page. * This should match the ID for a prompt created in Glean. */ promptId?: string; /** * If true, the chat will be restricted to the application specified by `applicationId` or the application associated with `chatId`. * New Chat will only be available for the specified application. * Chat history will be filtered to only show the specified application. */ restrictToApplication?: boolean; /** * Specifies the source that initiated the chat. */ source?: string; } export interface ModalSearchOptions extends SearchOptions { /** * Listener invoked when the frame is detached and focus is reverted to the native search box. */ onDetach?: () => void; /** * Optional style customizations for the search box. */ searchBoxCustomizations?: SearchBoxCustomizations; /** * Specifies whether the user should see an option allowing them * to revert back to the native search experience. */ showNativeSearchToggle?: boolean; } export interface SettingsOptions extends Options { /** * Controls whether a user sees admin-managed data sources that they cannot configure. */ hideUnconfigurableDatasources?: boolean; } export interface WidgetHandle { /** * Focus on the attached Glean widget */ focus: () => void; } export type ChatLocation = 'agent' | 'chat'; /** * Chat events that can be emitted by the chat component * - chat:id_update and chat:location_update events may be sent multiple times for the same ID and the handler should be idempotent */ export type WebSdkChatEvent = { name: 'chat:page_view'; } | { /** chatId can be undefined if the chatId is not yet available in current chat session, for example when the current chat is cleared. */ chatId: string | undefined; /** Deprecated: Use chat:location_update instead */ name: 'chat:id_update'; } | { /** Can be undefined, for example when the current chat is cleared. */ id?: string; name: 'chat:location_update'; type: ChatLocation; } | { name: 'chat:action_click'; payload: string; }; export type WebSdkEvent = WebSdkChatEvent; export interface ChatHandle { off: (eventName: WebSdkChatEvent['name'], handler: (event: WebSdkChatEvent) => void) => void; on: (eventName: WebSdkChatEvent['name'], handler: (event: WebSdkChatEvent) => void) => void; } export interface ChatUrlParams { agent: string | undefined; initialMessage: string | undefined; source: string | undefined; } export interface GuestAuthProviderOptions { /** * The search backend server to use. Should match the backend URL for your Glean external search setup. * Example: `https://{your}-be.glean.com/` */ backend: string; } /** * Creates and manages auth tokens for guest users. * Used primarily in Glean external search deployments */ export declare abstract class GuestAuthProvider { /** * Retrieves a stored guest auth token if it exists. * If no token exists, a new guest auth token is created. */ getAuthToken: () => Promise; /** * Creates a new guest auth token and returns the same */ createAuthToken: () => Promise; } /** * Entry point for all Glean embedded widgets. * * The SDK will dispatch a `glean:ready` event when the GleanWebSDK is ready to use, * see below for examples of how to use the event. * * Note that you only need this if you are integrating Glean via a deferred script tag. * * @example * * // example via plain JS * let isGleanReady = !!window.GleanWebSDK * window.addEventListener("glean:ready", () => { * isGleanReady = true * }) * * if (isGleanReady) { * // ready to use window.GleanWebSDK. * } * * // example via react hook * const subscribe = (callback: () => void) => { * window.addEventListener("glean:ready", callback) * return window.removeEventListener("glean:ready", callback) * } * const useIsGleanReady = useSyncExternalStore(subscribe, () => !!window.GleanWebSDK) * * const YourComponent = () => { * const isGleanReady = useIsGleanReady() * * useEffect(() => { * if (isGleanReady) { * // ready to use window.GleanWebSDK. * } * }, [isGleanReady]) * } */ export interface GleanWebSDK { /** * Attaches a complete, modal Glean Search to the given input element. * * #### User interface * When the given input element is clicked, a modal dialog is immediately * presented over the center of the page. It displays a more prominent * search box and initial suggested documents and queries. As text is entered, * autocomplete is performed, refining the suggestions. Upon pressing enter, * the full search results are displayed in the modal. The modal is dismissed * by clicking outside of its boundaries or on the close button. External links * are opened in a new tab (`target=_blank`). If a non-empty query is passed in options the search modal will automatically * open and display results for the query. * * #### Usage * 1. Render a dummy search input box to the page with the desired styling. * 2. Pass a reference to it to this method along with appropriate options. This * method will handle all user interaction. * 3. Handle the {@link SearchOptions.onSearch} callback if desired * (e.g. for tracking purposes). * * @param element A focusable element such as a text `input` or `contenteditable`. * @param options Configuration options for the search modal. * @returns An imperative handle ({@link WidgetHandle}) for Glean modal search. */ attach: (element: HTMLElement, options?: ModalSearchOptions) => WidgetHandle; /** @deprecated Renamed `renderSearchBox`. */ attachAutocomplete: (element: HTMLElement, options: SearchBoxOptions) => WidgetHandle; /** * Creates an auth provider to generate auth tokens for guest users. * This is only supported if you are using Glean External Search. */ createGuestAuthProvider: (options: GuestAuthProviderOptions) => GuestAuthProvider; /** * Attempts to read some configuration options for the embedded chat widget from * the current URL of the embedding page. See {@link ChatOptions} for details. * * #### Usage * renderChat(containerRef.current, { * ...getChatOptionsFromUrl(), * chatId: searchParams.get("chatId") ?? "", * onChat: (chatId: string) => setSearchParams({ chatId }), * onSearch: (query: string) => navigate({ pathname: '/search', search: new URLSearchParams({ query }).toString() }), * }); */ getChatOptionsFromUrl: (deleteParams: boolean) => ChatUrlParams; /** * Opens a sidebar with a search box, recommendations and results. * * #### User interface * A sidebar with a search box slides in from the right of the page. * * If {@link SearchOptions.query} is given then search results * are displayed for the given query by default. * * When a search result is clicked, it is opened in a new * tab (`target=_blank`). The sidebar is closed when the close button * within the sidebar is clicked or the escape key is pressed. * * @param options Configuration options for the search results. * @deprecated will be removed in future versions. */ openSidebar: (options: SearchOptions) => Promise; /** * Renders Glean AI chat inside the given container element * * #### Usage * 1. Render a block level element in the page with the desired * dimensions in the viewport. * 2. Pass it to this method along with appropriate options. * * @param element A containing HTML element such as a `div` to render * the widget into. The container must be a block-level element with * a non static position such as 'relative'. * @param options Configuration options for the chat widget * @returns An imperative handle ({@link ChatHandle}) for Glean chat. */ renderChat: (element: HTMLElement, options: ChatOptions) => ChatHandle; /** * Renders Glean recommendations inside the given container element * * #### User Interface * The widget includes a Glean search box and shows contextual * recommendations based on the current page. * * On clicking the search box, autocomplete dropdown opens with suggestions * based on the query being typed in. This may extend beyond the container * bounds based on the suggestions. Upon pressing enter, the search results * are displayed responsively in the container along with datasources tabs * and facet filters. Search results, when clicked are opened in a new tab. * * On the search page, a back button is shown beside the search box which * can be used to navigate to the previous page. * * #### Usage * 1. Render a block level element in the page with the desired * dimensions in the viewport. Minimum height recommended is 600px. * 2. Pass it to this method along with appropriate options. * * @param element A containing HTML element such as a `div` to render * the recommendations widget into. The container must be a block-level * element with a non static position such as 'relative'. * @param options Configuration options for the recommendations widget */ renderRecommendations: (element: HTMLElement, options: RecommendationsOptions) => void; /** * Displays Glean Search autocomplete inside the given container element. * * #### User interface * A search box is rendered within the bounds of the provided container * element. The box will take up the full space of the container minus * any space required for the margins specified in the customization * options {@link SearchBoxOptions.searchBoxCustomizations}. For example, * if the search box should be 40px tall with a 5px margin on the top and * bottom, the container should be 50px tall with `verticalMargin: 5`. * If a `boxShadow` is specified, the margin should be large enough to * display it. * * #### Usage * 1. Render a container element to the page with the desired size. * 2. Pass it to this method along with appropriate options. * 3. Handle the {@link SearchBoxOptions.onSearch} callback as desired * (e.g. by calling {@link GleanWebSDK.renderSearchResults}) and * updating the page title/url. * * @param element A containing HTML element such as a `div` to render * the search box into. The container must have both `position:relative` * and `display:block` applied. * @param options Configuration options for the search box. * @returns An imperative handle ({@link WidgetHandle}) for Glean autocomplete. */ renderSearchBox: (element: HTMLElement, options: SearchBoxOptions) => WidgetHandle; /** * Renders Glean Search results into the given element. * * #### User interface * The search results, datasource tabs and facet filters are * displayed responsively to fill the entire element. The caller is * responsible for rendering a search input box and handling * callback events. * * When a link that results in a new query is clicked (such as a * spell correction), the {@link TabbedSearchOptions.onSearch} * callback is invoked but the query is not automatically changed. * When the user changes datasource tabs, the interface is updated * and the {@link TabbedSearchOptions.onDatasourceChange} callback is * invoked. When a search result is clicked, it is opened in a new * tab (`target=_blank`). * * #### Usage * 1. Render a block level element in the page with the desired * dimensions in the viewport. * 2. Pass it to this method along with appropriate options. * 3. Respond to the {@link TabbedSearchOptions.onSearch} callback * by invoking this render method with the same element and the new * query. At the same time, it's usually appropriate to update any * search box text, page title and URL. * 4. Optionally, respond to the {@link TabbedSearchOptions.onDatasourceChange} * callback by updating the URL to preserve state. * * @param element A containing HTML element such as a `div` to render * the search box into. The container must have both `position:relative` * and `display:block` applied. * @param options Configuration options for the search results. */ renderSearchResults: (element: HTMLElement, options: TabbedSearchOptions) => void; /** * Renders Glean settings inside the given container element * * #### Usage * 1. Render a block level element in the page with the desired * dimensions in the viewport. It is recommended that the width be at least 800px * and the height be at least 600px. * 2. Pass it to this method along with appropriate options. * * @param element A containing HTML element such as a `div` to render * the widget into. The container must be a block-level element with * a non static position such as 'relative'. * @param options Configuration options for the settings widget * * @beta This API is experimental and may change at any time. */ renderSettings: (element: HTMLElement, options: SettingsOptions) => void; }