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

@vigneshreddy/cms-sdk

v1.0.14

Published

Official TypeScript SDK for CutMeShort CMS API

Readme

@vigneshreddy/cms-sdk

Official TypeScript/JavaScript SDK for the CutMeShort CMS API.

Use this package to send:

  • lead tracking events (cms.trackLead)
  • sale tracking events (cms.trackSale)

Install

npm install @vigneshreddy/cms-sdk

Requirements

  • Node.js 18+ (recommended) or any runtime with global fetch
  • TypeScript 5+ (optional, for type safety)

If your runtime does not provide fetch, add a polyfill before creating the client.

import fetch, { Headers, Request, Response } from "cross-fetch";

(globalThis as any).fetch = fetch;
(globalThis as any).Headers = Headers;
(globalThis as any).Request = Request;
(globalThis as any).Response = Response;

Quick Start

import { CMS } from "@vigneshreddy/cms-sdk";

const cms = new CMS({
  apiKey: process.env.CMS_API_KEY!,
  timeout: 10_000,
});

const response = await cms.trackLead({
  clickId: "id_123",
  eventName: "signup_started",
  customerId: "user_42",
});

console.log(response);

API Methods

cms.trackLead(leadData, options?)

import { CMS } from "@vigneshreddy/cms-sdk";

const cms = new CMS({ apiKey: "sk_live_xxx" });

await cms.trackLead({
  clickId: "id_123",
  eventName: "signup_started",
  customerId: "user_42",
});

Lead payload fields:

  • clickId: string (optional in deferred follow-up calls)
  • eventName: string
  • customerId: string
  • timestamp?: string (ISO 8601, e.g. new Date().toISOString())
  • customerExternalId?: string
  • customerName?: string
  • customerEmail?: string
  • customerAvatar?: string

Deferred mode (two-step lead attribution)

If you can’t reliably send the clickId at the moment you want to record a lead event, you can use deferred mode:

import { CMS } from "@vigneshreddy/cms-sdk";

const cms = new CMS({ apiKey: "sk_live_xxx" });

// Step 1: store the clickId <-> customerId association
await cms.trackLead({
  clickId: "id_123",
  eventName: "signup_started",
  customerId: "user_42",
  mode: "deferred",
});

// Step 2: later, track using just customerId (no clickId)
await cms.trackLead({
  eventName: "email_verified",
  customerId: "user_42",
  mode: "deferred",
});

cms.trackSale(saleData, options?)

import { CMS } from "@vigneshreddy/cms-sdk";

const cms = new CMS({ apiKey: "sk_live_xxx" });

await cms.trackSale({
  clickId: "id_123",
  eventName: "purchase_completed",
  invoiceId: "inv_987",
  amount: 4999,
  currency: "USD",
});

Sale payload fields:

  • clickId: string
  • eventName: string
  • timestamp?: string (ISO 8601, e.g. new Date().toISOString())
  • customerExternalId?: string
  • customerName?: string
  • customerEmail?: string
  • customerAvatar?: string
  • invoiceId: string
  • amount: number (in cents)
  • currency: string (3-letter code, e.g. USD)

Configuration

new CMS(config) accepts:

type CMSConfig = {
  apiKey: string;
  baseUrl?: string;
  timeout?: number;
  maxRetries?: number;
  retryDelayMs?: number;
  retryMaxDelayMs?: number;
  retryOnStatuses?: number[];
  retryOnNetworkError?: boolean;
};

Defaults:

  • baseUrl: https://www.cutmeshort.com/sdk
  • timeout: 10000
  • maxRetries: 2
  • retryDelayMs: 500
  • retryMaxDelayMs: 10000
  • retryOnStatuses: [429, 500, 502, 503, 504]
  • retryOnNetworkError: true

Per-request Overrides

You can override retry/timeout settings for a specific call:

import { CMS } from "@vigneshreddy/cms-sdk";

const cms = new CMS({ apiKey: "sk_live_xxx" });

await cms.trackLead(
  {
    clickId: "id_123",
    eventName: "signup_started",
    customerId: "user_42",
  },
  {
    timeout: 5000,
    maxRetries: 1,
    retryDelayMs: 300,
  }
);

Error Handling

Class-based methods (cms.trackLead, cms.trackSale) throw CMSAPIError on failure.

import { CMS, CMSAPIError } from "@vigneshreddy/cms-sdk";

const cms = new CMS({ apiKey: "sk_live_xxx" });

try {
  await cms.trackSale({
    clickId: "id_123",
    eventName: "purchase_completed",
    invoiceId: "inv_987",
    amount: 4999,
    currency: "USD",
  });
} catch (error) {
  if (error instanceof CMSAPIError) {
    console.error("CMS API error", {
      statusCode: error.statusCode,
      type: error.type,
      message: error.message,
    });
  } else {
    console.error("Unexpected error", error);
  }
}

Public API

This package intentionally exposes only:

  • CMS (use cms.trackLead and cms.trackSale)
  • CMSAPIError (for instanceof checks)

Deep imports (example: @vigneshreddy/cms-sdk/client) are intentionally blocked.

Security Best Practice

Do not expose private API keys in public frontend code. Use this SDK from a trusted backend/server environment when using secret keys.