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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@omnidapter/connect

v1.4.0

Published

Omnidapter Connect — embed a calendar authorization flow in your app

Downloads

538

Readme

@omnidapter/connect

JavaScript/TypeScript library for embedding the Omnidapter calendar authorization flow in your app. Opens a centered popup that guides the user through OAuth, then fires callbacks on completion.

Installation

npm install @omnidapter/connect

How it works

  1. Your backend creates a short-lived link token via POST /v1/link-tokens.
  2. You pass that token to connect.open().
  3. The library opens a popup pointed at your Omnidapter server's Connect UI.
  4. The popup communicates back to your page via postMessage, triggering your callbacks.
  5. On success you receive a connectionId to store and use for API calls.

Vanilla JS / TypeScript

import { OmnidapterConnect } from '@omnidapter/connect';

const connect = new OmnidapterConnect({
  baseUrl: 'https://your-omnidapter-server.example.com',
});

// Call from a user interaction (e.g. button click) to avoid popup blockers
button.addEventListener('click', async () => {
  const { token } = await fetch('/api/link-token').then(r => r.json());

  connect.open({
    token,
    onSuccess: ({ connectionId, provider }) => {
      console.log(`Connected ${provider} — connection ID: ${connectionId}`);
    },
    onError: ({ code, message }) => {
      console.error(`Connect error [${code}]: ${message}`);
    },
    onClose: () => {
      console.log('User closed the popup');
    },
  });
});

Closing programmatically

connect.close();

If a popup is already open when open() is called again, the existing popup is focused rather than opening a second one.

React

Import the hook from @omnidapter/connect/react. React 17+ is supported as a peer dependency.

import { useOmnidapterConnect } from '@omnidapter/connect/react';

function ConnectButton() {
  const { open, close, isOpen } = useOmnidapterConnect({
    baseUrl: 'https://your-omnidapter-server.example.com',
  });

  const handleClick = async () => {
    const { token } = await fetch('/api/link-token').then(r => r.json());

    open({
      token,
      onSuccess: ({ connectionId, provider }) => {
        console.log(`Connected ${provider}: ${connectionId}`);
      },
      onError: ({ code, message }) => {
        console.error(`[${code}] ${message}`);
      },
      onClose: () => {
        console.log('Popup closed');
      },
    });
  };

  return (
    <button onClick={handleClick} disabled={isOpen}>
      {isOpen ? 'Connecting…' : 'Connect Calendar'}
    </button>
  );
}

The hook creates one OmnidapterConnect instance per component mount and cleans it up on unmount. baseUrl is read only on mount — pass it as a stable value.

API

new OmnidapterConnect(options?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | https://omnidapter.heckerlabs.ai | Base URL of your Omnidapter server |

connect.open(options)

Opens (or focuses) the Connect popup.

| Option | Type | Required | Description | |--------|------|----------|-------------| | token | string | Yes | Link token from POST /v1/link-tokens | | onSuccess | (result: ConnectSuccessResult) => void | No | Called when the connection is created | | onError | (error: ConnectErrorResult) => void | No | Called when an error occurs in the popup | | onClose | () => void | No | Called when the user closes the popup | | width | number | No | Popup width in pixels (default: 520) | | height | number | No | Popup height in pixels (default: 640) |

connect.close()

Closes the popup and removes all event listeners.

ConnectSuccessResult

{ connectionId: string; provider: string }

ConnectErrorResult

{ code: string; message: string }

useOmnidapterConnect(options?) (React)

Returns { open, close, isOpen }. open and close have the same signatures as the class methods. isOpen is true while the popup is open.

Error codes

| Code | Cause | |------|-------| | popup_blocked | The browser prevented the popup from opening. Ensure open() is called directly from a user interaction. | | Any other code | Passed through from the Connect UI — check the message field for details. |

Popup blockers

Browsers block popups that are not opened synchronously from a user gesture. Always call connect.open() directly inside a click handler — do not await anything before calling it.

Security

Incoming postMessage events are validated against both the expected origin (derived from baseUrl) and the popup window reference, preventing spoofed messages from other tabs or origins.

License

MIT