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

p2pme-ai-support

v1.1.1

Published

Embeddable p2p.me support chat widget — a zero-dependency, Shadow-DOM web component backed by the commops agent API.

Downloads

322

Readme

p2pme-ai-support

An embeddable p2p.me AI support chat widget — a zero-dependency, Shadow-DOM web component backed by the commops agent API (@commops/server). Drop in one <script> tag, or import createChatWidget in any bundler. Styles are isolated in a Shadow Root so they never collide with the host page, and themable via CSS custom properties.

This is the only published package in the monorepo (npm, public).

browser  ──HTTP──►  @commops/server  ──►  @commops/agent
   ▲
p2pme-ai-support   (this package — talks to the server over fetch)

Install / embed

A. Plain <script> (IIFE auto-init) — fastest

<script
  src="https://unpkg.com/p2pme-ai-support/dist/p2pme-ai-support.global.js"
  data-commops-api="https://api.p2p.me"
  data-commops-country="INR"
  data-commops-title="p2p.me support"
  data-commops-open="false"
></script>

It reads data-commops-* off its own tag, mounts a launcher + panel on document.body, and also exposes window.CommopsWidget.create(opts) for manual control. Supported attributes: api (required), country, title, greeting, placeholder, footer, open, accent, accent-contrast, home (false to skip the home screen), home-title, home-subtitle, faqs (comma-separated), prompts, typewriter, sources, feedback.

B. ESM / bundler

npm i p2pme-ai-support    # or: bun add p2pme-ai-support
import { createChatWidget } from 'p2pme-ai-support'

const widget = createChatWidget({
  apiUrl: 'https://api.p2p.me',   // base URL or full /chat URL
  country: 'INR',
  title: 'p2p.me support',
  greeting: 'Hey! Ask me anything about p2p.me.',
  theme: { accent: '#2563eb' },
  // target: someElement,         // defaults to document.body
})

widget.open()      // open() / close() / toggle() / destroy()

API

| File | Export | Purpose | |------|--------|---------| | src/widget.ts | createChatWidget(opts) → WidgetHandle | builds the Shadow-DOM UI, wires ChatClient + session, manages transcript/typing/escalate | | src/client.ts | ChatClient, ChatApiError | typed fetch wrapper for POST /chat | | src/session.ts | getSessionId() | stable anonymous id (localStorage-persisted, fallback in-memory) | | src/styles.ts | styles | the Shadow-Root CSS string (--cw-* custom properties) | | src/index.ts | ESM public surface | re-exports the above | | src/embed.ts | IIFE entry | auto-init from data-* + window.CommopsWidget |

WidgetOptions: apiUrl (req), country, title, greeting, placeholder, footer, openOnLoad, theme, target, plus the home-screen + chat-feel options: homeScreen (def true — a Relay/Mintlify-style landing with a hero, search box, FAQ list and a "Chat with us" card), homeTitle, homeSubtitle, faqs (questions listed on home; tapping one opens chat and asks it), starterPrompts, typewriter, showSources, feedback. WidgetTheme: accent, accentContrast, bg, fg, muted, botBg, border, radius, font → mapped to --cw-* vars on the shadow host.

A turn calls POST /chat → { action, reply, escalated }. escalated shows the reply + a "human teammate notified" system line; silent/empty shows a soft "a teammate will follow up"; rate_limited shows a friendly slow-down message.


Build & publish

bun run --filter 'p2pme-ai-support' typecheck
bun run --filter 'p2pme-ai-support' build     # esm + iife + .d.ts → dist/

build runs three steps: build:esm (dist/index.js), build:iife (dist/p2pme-ai-support.global.js), build:types (tsc --emitDeclarationOnly). prepublishOnly runs the full build, and files: ["dist", "README.md"] ships only the artifacts. Publish with npm publish (publishConfig.access: public).


Testing in a real app

See TESTING-USER-APP.md for embedding + smoke-testing the widget inside the user-app-client (Vite + React) app against a local or staging @commops/server.