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

@kern-di/prospect-tracker

v0.1.15

Published

React prospect engagement modal with scroll/idle tracking and notify events

Downloads

101

Readme

@kern-di/prospect-tracker

React component: scroll/idle engagement tracking, optional modal CTA, and visit / cta_click POSTs to your notify endpoint. The default URL is https://admin.<apex>/api/notify derived from window.location.hostname (e.g. on www.kern-di.dehttps://admin.kern-di.de/api/notify). Override with notifyUrl if your admin host does not match that pattern.

Styling is inline (no Tailwind in consumer apps). Colors and type styles match @kern/ui / globals.css via @kern/shared/lib/kernUiTokens, which is bundled into the published package (no extra npm dependency).

Install

pnpm add @kern-di/prospect-tracker

Peer dependencies: react ^18 and react-dom ^18 (portal + modal layer).

Local demo (develop UI & behavior)

From the monorepo root:

pnpm prospect-tracker:demo

Opens http://localhost:7080 — a five-section landing page plus footer, ProspectTracker wired to a mock POST /api/notify (logs payloads in the terminal). Imports the component from src/ so edits hot-reload without running tsup. On each full refresh, the demo clears kern_shown_* / kern_engaged_* so the modal can trigger again.

Usage

Backend requirement (fleet / recommended)

For fleet/customer sites, the recommended setup is:

  • Frontend posts to same-origin notifyUrl="/api/notify" (no CORS headaches)
  • Your site implements POST /api/notify (Vercel api/notify.ts) which forwards to KERN’s central API (bearer-protected)
  • Your site exposes the recipientId from a backend env var (not a Vite public env var) via a same-origin config route

For fleet/customer sites, implement a same-origin POST /api/notify route that forwards to KERN’s central API (bearer-protected).

Vercel one-liner:

import { createVercelHandler } from "@kern-di/prospect-tracker/server";

export default createVercelHandler({
	apiKey: process.env.KERN_API_KEY ?? "",
	// Optional; if omitted uses KERN_API_URL / VITE_KERN_API_URL / production default.
	apiUrl: process.env.KERN_API_URL,
});

Backend: provide recipientId via server env

Create api/prospect-tracker-config.ts (Vercel Node runtime) to expose the configured recipient id:

import type { VercelRequest, VercelResponse } from "@vercel/node";

export default function handler(req: VercelRequest, res: VercelResponse) {
	if (req.method !== "GET") {
		return res.status(405).json({ error: "Method not allowed" });
	}

	const recipientId = process.env.PROSPECT_RECIPIENT_ID?.trim() ?? "";
	if (!recipientId) {
		return res.status(503).json({ error: "PROSPECT_RECIPIENT_ID not configured" });
	}

	return res.status(200).json({ recipientId });
}

Set PROSPECT_RECIPIENT_ID on your Vercel project (server-side env var).

Frontend: mount once near app root

Fetch the recipient id and only render the tracker if it exists. Also set notifyUrl="/api/notify" so events hit your same-origin backend route.

import { useEffect, useState } from "react";
import { ProspectTracker } from "@kern-di/prospect-tracker";

export function App() {
  const [recipientId, setRecipientId] = useState<string | null>(null);

  useEffect(() => {
    fetch("/api/prospect-tracker-config")
      .then((r) => (r.ok ? r.json() : null))
      .then((data) => setRecipientId(data?.recipientId ?? null))
      .catch(() => setRecipientId(null));
  }, []);

  return (
    <>
      {/* Your page */}
      {recipientId ? (
        <ProspectTracker
          recipientId={recipientId}
          notifyUrl="/api/notify"
          engagementSectionId="leistungen"
        />
      ) : null}
    </>
  );
}

Props

| Prop | Description | |------|-------------| | recipientId | Required. Sent with notify events. | | notifyUrl | Optional. Override POST URL if it is not https://admin.<your-apex-domain>/api/notify. | | engagementSectionId | Optional. If the element exists, scrolling past it counts as engagement; otherwise depth/bottom heuristics apply. | | primaryColor | Optional. Primary button background (hex/CSS color). | | headline, description, ctaLabel | Optional. Override modal copy (defaults are warm, KERN-Di.–specific). | | thankYouTitle, thankYouMessage | Optional. Copy after the CTA is clicked. | | team photo | Always shown. The bundled Simon & Johannes photo is rendered in the modal. |

AI / coding-agent integration

Short copy-paste prompt: AGENT_PROMPT.md (also in node_modules/@kern-di/prospect-tracker/ after install).

Fleet integration instructions (backend route that forwards to the central API): CODING_AGENT.md (also in node_modules/@kern-di/prospect-tracker/ after install).

Your workflow (keep this)

1. While you edit the package

From the repo root:

pnpm prospect-tracker:watch

Leave it running. It rebuilds dist/ when src/ changes. Nothing is sent to npm.

2. One-time: make npm let you publish

Do this once per machine (or when a publish returns 403):

  1. On npmjs.comAccess TokensGenerate New TokenGranular Access Token.
  2. Allow read/write for @kern-di/prospect-tracker (or the whole @kern-di scope).
  3. Enable Bypass two-factor authentication (or the automation option npm shows). Without this, publish will keep failing with 403 if your account uses 2FA.
  4. Save the token somewhere safe (password manager). Do not commit it.

Put it on this computer:

npm config set //registry.npmjs.org/:_authToken "paste_token_here"

(If you ever paste a token in chat or a screenshot, revoke it on npm and make a new one.)

You also need permission to publish under the @kern-di org on npm.

3. When you want a new version on npm

From the repo root (patch bump + build + type-check + publish):

pnpm prospect-tracker:release

Or from packages/prospect-tracker:

pnpm release

That bumps the patch version (e.g. 0.1.20.1.3), runs scripts/publish.mjs (build → type-check → pnpm publish), then you commit package.json (and root pnpm-lock.yaml if it changed).

Publish the current version only (no version bump), e.g. after a failed publish:

pnpm prospect-tracker:publish
# or: pnpm --filter @kern-di/prospect-tracker publish:npm

Extra args are forwarded to pnpm publish (dry-run, OTP):

pnpm --filter @kern-di/prospect-tracker publish:npm -- --dry-run
pnpm --filter @kern-di/prospect-tracker publish:npm -- --otp=123456

4. If release failed after bumping the version

You’ll see 403 and package.json already has a new version that is not on npm yet. Do not run release again (you’d skip a version).

Fix the token (step 2), then publish this version only:

pnpm prospect-tracker:publish

If you don’t use a token and rely on OTP instead:

pnpm prospect-tracker:publish -- --otp=PASTE_6_DIGITS

Then commit as in step 3.