npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

obi-sdk

v0.19.49

Published

JavaScript SDK for Obi

Readme

Obi SDK

A JavaScript SDK with dynamic content capabilities for integrating Obi into your web applications.

Features

  • Assistant interacts through voice and screen share
  • DOM analysis allows the assistant to improve context
  • Framework-agnostic UI components using Web Components
  • Event-based API
  • TypeScript support
  • Session persistence across page reloads

Configuration Options

The loader accepts the following configuration options:

| Option | Type | Default | Description | | ---------------- | ------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | position | string | 'bottom-right' | Position of the widget on the page. Options: 'bottom-right', 'bottom-left', 'bottom-center', 'top-right', 'top-left', 'top-center', 'middle-left', 'middle-right' | | apiKey | string | - | Your Obi API key (required for production) | | user | object | - | User information with id (required), email, first_name, last_name, company (all optional), and metadata (optional) for additional custom fields | | isActive | boolean | true | Whether to show the widget. Set to false to disable the widget for specific users | | linkOnlyAccess | boolean | false | Hide the widget unless accessed via a session link. Perfect for trial periods where only customers with direct links should see the widget | | primaryColor | string | - | Custom primary color for the widget UI (CSS color value) |

Installation

For installation instructions, we recommend using the obi-loader package. This package provides a lightweight loader that will automatically fetch and initialize the full and latest SDK.

Please visit the obi-loader npm package for installation methods and documentation.

Widget Positioning

The widget can be positioned in one of eight positions on the page:

window.obiWidgetConfig = {
  position: "bottom-right", // Options: "bottom-right", "bottom-left", "bottom-center", "top-right", "top-left", "top-center", "middle-left", "middle-right"
  apiKey: "YOUR_API_KEY",
}

Trial Mode / Link-Only Access

The linkOnlyAccess option is perfect for trial periods where you want to control who can see and interact with the widget. When enabled, the widget remains hidden until a session is started via a direct link.

window.obiWidgetConfig = {
  apiKey: "YOUR_API_KEY",
  linkOnlyAccess: true, // Widget only visible when accessed via session link
}

This is ideal for:

  • Trial periods where only specific customers should see the widget
  • Beta testing with selected users
  • Controlled rollouts using session-specific links
  • Demo environments where widget access is link-based

When linkOnlyAccess is true:

  • Widget is invisible to regular website visitors
  • Widget becomes visible only when a session is started (e.g., via URL parameters)
  • Once a session ends, the widget returns to hidden state

Session Persistence

The SDK now supports session persistence across page reloads and navigation. If a user refreshes the page or navigates to another page on your site, the session with Obi will be automatically restored when they return, providing a seamless experience.

Key features of session persistence:

  • Sessions are stored locally in the browser using a namespaced localStorage implementation
  • Session data is automatically cleared after a configurable expiration time (default: 5 minutes)
  • When reconnecting, the previous session state is restored, including the current conversation
  • Users can manually end a session at any time by using the disconnect option

No additional configuration is required to enable this feature.

Engagement Sessions

The SDK also tracks lightweight engagement sessions per product + onboardee for analytics. A new engagement session starts after 30 minutes of inactivity and is stored in localStorage. You can subscribe to the engagementSessionStarted event and read current values via getEngagementInfo() on the SDK instance (available as window.obi when using the loader).

  • Event: engagementSessionStarted with { sessionCount, lastSessionStartAt, lastActivityAt, scopeKey }.
  • Accessor: sdk.getEngagementInfo() returns the latest stored info for the current scope.
  • Blacklist: URLs matching the product blacklist do not count toward engagement sessions.
  • Cross-tab: Duplicate suppression, if enabled, is best-effort within a small window.

See architecture details and examples in STRUCTURE.md under “Engagement Sessions”: STRUCTURE.md#engagement-sessions.

License

SEE LICENSE IN LICENSE.txt