@gleanwork/web-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Glean Web SDK

This library contains the TypeScript definitions for embedding Glean UI components.

Installation

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

Usage

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)
})

Documentation

Details on usage can found on https://developers.glean.com/docs/browser_api/

Readme

Keywords

Package Sidebar

Install

npm i @gleanwork/web-sdk

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

32.7 kB

Total Files

6

Last publish

Collaborators

  • taozhou-glean
  • tonygentilcore
  • vardhman-singh