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

translation-chat-sdk

v0.2.7

Published

React SDK for the Translation Studio chat/patch experience.

Readme

Translation Chat SDK (React)

React-first SDK for the Translation Studio chat/patch experience. Ships as a Vite-built library (ESM + CJS + UMD) with type-safe hooks, a provider, and a ready-to-use ChatWidget.

Features

  • React Provider + useChat hook, no window listeners.
  • Socket.io transport with token provider + context provider.
  • Patch offer accumulation with callback and state exposure.
  • Simple ChatWidget UI with streaming indicators.
  • Build outputs for npm + CDN (jsDelivr-ready translation-chat-sdk.umd.js).

Usage

npm install
npm run build

Add to a React app:

import { ChatProvider, ChatWidget } from 'translation-chat-sdk';

<ChatProvider
  config={{
    websocketUrl: process.env.NEXT_PUBLIC_WEBSOCKET_URL!,
    contextProvider: () => ({
      trans_doc_id: currentDocId,
      page_num: currentPage,
      highlighted_region: selection
    }),
    tokenProvider: () => fetch('/api/auth/token', { credentials: 'include' })
      .then(res => res.ok ? res.json() : null)
      .then(data => data?.access_token ?? null),
    onPatchOffer: (offer) => console.log('patch ready', offer)
  }}
>
  <ChatWidget />
</ChatProvider>

Local linking to sarvam-studio-frontend

  1. From this repo: npm install && npm run build.
  2. In sarvam-studio-frontend/package.json, set "translation-chat-sdk": "file:../translation-chat-sdk".
  3. Run npm install in sarvam-studio-frontend.
  4. npm run dev and import from translation-chat-sdk.

CDN build

After npm run build, publish dist/translation-chat-sdk.umd.js to a CDN (e.g., jsDelivr from a git tag). Consumers can import('https://cdn.../translation-chat-sdk.umd.js').

Translation Chat SDK (React)

React-first SDK for embedding Translation Studio chat in web apps. Ships ESM/CJS/UMD bundles, types, and a minimal widget.

Install (local)

npm install
npm run build

Add to a consumer app (local path):

npm install ../translation-chat-sdk

Usage

import { ChatProvider, ChatWidget } from 'translation-chat-sdk';

function App() {
  return (
    <ChatProvider
      config={{
        websocketUrl: process.env.NEXT_PUBLIC_WEBSOCKET_URL!,
        contextProvider: () => ({
          trans_doc_id: 'doc-123',
          page_num: 1
        }),
        tokenProvider: async () => {
          const res = await fetch('/api/auth/token', { credentials: 'include' });
          if (!res.ok) return null;
          const { access_token } = await res.json();
          return access_token;
        }
      }}
    >
      <ChatWidget height={520} />
    </ChatProvider>
  );
}

CDN / jsDelivr

Build generates dist/translation-chat-sdk.umd.js. Publish to npm and load via:

<script src="https://cdn.jsdelivr.net/npm/translation-chat-sdk/dist/translation-chat-sdk.umd.js"></script>

Globals exposed: TranslationChatSDK.ChatProvider, TranslationChatSDK.ChatWidget, TranslationChatSDK.useChat.

Scripts

  • npm run dev — local playground via Vite
  • npm run build — library build (ESM/CJS/UMD + d.ts)
  • npm run preview — preview build