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

saastrialflow-sdk

v0.3.1

Published

JavaScript/TypeScript SDK for SaaS Trial Flow

Readme

SaaS Trial Flow SDK

JavaScript/TypeScript SDK for SaaS Trial Flow - the autonomous AI agent platform that nurtures your trial users to conversion.

Installation

npm install saastrialflow-sdk
# or
yarn add saastrialflow-sdk

Quick Start

import { initSaasTrialFlow } from 'saastrialflow-sdk';

// Initialize the SDK
const analytics = initSaasTrialFlow({
  apiKey: process.env.SAASTRIALFLOW_API_KEY
});

// Identify your user (after creating trial via API)
await analytics.identify("[email protected]");

// Track events
await analytics.track("feature_activated");

Features

  • 🚀 Simple Integration - Get started in minutes
  • 📊 Auto-Collection - Automatically collect browser, device, and session data
  • 💾 Offline Support - Queue events when offline, sync when back online
  • 🔄 Automatic Retry - Built-in retry logic with exponential backoff
  • 📦 Lightweight - < 25KB gzipped
  • 🔒 Type Safe - Full TypeScript support

API Reference

Initialization

const analytics = initSaasTrialFlow({
  apiKey: string;          // Required: Your API key
  baseUrl?: string;        // Optional: API endpoint (default: https://saastrialflow.com/api)
  autoCollect?: boolean;   // Optional: Auto-collect browser data (default: true)
  flushInterval?: number;  // Optional: Auto-flush interval in ms (default: 10000)
  debug?: boolean;         // Optional: Enable debug logging (default: false)
  onError?: Function;      // Optional: Error callback
});

Methods

identify(email: string, properties?: object): Promise<void>

Identify the current user. Must be called before tracking events.

await analytics.identify("[email protected]");

track(event: string, properties?: object): Promise<TrackResult>

Track a user event.

const result = await analytics.track("button_clicked");

if (!result.success) {
  console.error("Tracking failed:", result.error);
}

flush(): Promise<void>

Manually flush all queued events.

// Flush before important actions
await analytics.flush();

reset(): void

Clear user context and queued events.

// On user logout
analytics.reset();

on(event: 'error', callback: Function): void

Register error callbacks.

analytics.on('error', (error) => {
  console.error('Analytics error:', error);
});

Auto-Collected Data

When autoCollect is enabled, the SDK automatically collects:

  • Browser name and version
  • Device type (desktop/mobile/tablet)
  • Language preference
  • Page URL and title
  • Screen resolution
  • Session ID
  • User agent

Complete Example

import { initSaasTrialFlow } from 'saastrialflow-sdk';

// Initialize
const analytics = initSaasTrialFlow({
  apiKey: process.env.SAASTRIALFLOW_API_KEY,
  debug: true
});

// Error handling
analytics.on('error', (error) => {
  console.error('Analytics error:', error);
});

async function handleUserSignup(userData) {
  // 1. Create trial on your backend
  const response = await fetch('/api/trials', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.SAASTRIALFLOW_API_KEY}`
    },
    body: JSON.stringify(userData)
  });

  if (response.ok) {
    // 2. Identify user in SDK
    await analytics.identify(userData.email);

    // 3. Track registration
    await analytics.track('user_registered');
  }
}

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

import { initSaasTrialFlow, TrackResult, UserContext } from 'saastrialflow-sdk';

const analytics = initSaasTrialFlow({
  apiKey: process.env.SAASTRIALFLOW_API_KEY!
});

const result: TrackResult = await analytics.track("event_name");

License

MIT