This library contains the TypeScript definitions for embedding Glean UI components.
Install the Glean Web SDK with the following command:
// npm
npm install @gleanwork/web-sdk
// yarn
yarn add @gleanwork/web-sdk
// pnpm
pnpm add @gleanwork/web-sdk
The type-only package assumes that the Glean embedded search library is separately included on the page via a
<script>
tag:
<script defer src="https://{GLEAN_APP_DOMAIN}/embedded-search-latest.min.js"></script>
Then the types can be included in your TypeScript code as follows:
import type { EmbeddedSearch, SearchBoxOptions } from '@gleanwork/web-sdk'
declare global {
interface Window {
EmbeddedSearch: EmbeddedSearch
}
}
window.addEventListener('DOMContentLoaded', () => {
const searchBoxOptions: SearchBoxOptions = { /* some required options */ }
window.EmbeddedSearch.renderSearchBox(document.getElementById('search-box'), searchBoxOptions)
})
Details on usage can found on https://developers.glean.com/docs/browser_api/