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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@happypanda-ai/sdk

v1.1.0

Published

HappyPanda SDK - User feedback, onboarding, and analytics for TypeScript projects

Readme

@happypanda-ai/sdk

TypeScript SDK for HappyPanda - User feedback, onboarding, and analytics.

Installation

npm install @happypanda-ai/sdk
# or
pnpm add @happypanda-ai/sdk
# or
yarn add @happypanda-ai/sdk

Quick Start

import { HappyPandaAPI } from '@happypanda-ai/sdk';

// Create an API instance
const api = new HappyPandaAPI('your-project-id');

// Identify a user
await api.identify({
  userId: 'user_123',
  email: '[email protected]',
  name: 'John Doe',
  properties: {
    plan: 'pro',
    company: 'Acme Inc',
  },
});

// Track events
await api.track('feature_used', { feature: 'export' });

// Track conversions
await api.trackConversion('trial_to_paid', {
  plan: 'pro',
  mrr: 49,
  currency: 'USD',
}, 'user_123');

// Complete onboarding steps
await api.completeStep('user_123', 'create_first_project');

API Reference

Constructor

const api = new HappyPandaAPI(projectId: string, baseUrl?: string);
  • projectId - Your HappyPanda project ID (required)
  • baseUrl - Custom API URL (optional, defaults to production)

User Identification

// Identify a user
await api.identify({
  userId: string,           // Required
  email?: string,           // For emails
  name?: string,            // Display name
  avatarUrl?: string,       // Avatar URL
  properties?: object,      // Custom properties
});

// Enroll in welcome emails
await api.enrollWelcomeEmails({
  userId: string,
  email: string,
  firstName?: string,
  lastName?: string,
});

Event Tracking

// Track custom events
await api.track(eventName: string, properties?: object, userId?: string);

// Track conversions
await api.trackConversion(conversionType: string, properties?: object, userId?: string);

Onboarding Checklist

// Get checklist config
const config = await api.getOnboarding(userId: string);

// Complete a step
await api.completeStep(userId: string, stepId: string);

// Skip a step
await api.skipStep(userId: string, stepId: string);

// Dismiss the checklist
await api.dismissOnboarding(userId: string);

Changelog

// Get changelog entries
const { entries, unreadCount } = await api.getChangelog(userId?: string, limit?: number);

// Mark entries as read
await api.markChangelogRead(userId: string, entryIds: string[]);

Feedback

// Submit feedback
await api.submitFeedback({
  message: 'Great product!',
  rating: 5,
  metadata: {
    browser: 'Chrome',
    url: 'https://example.com',
    // ...
  },
});

Widget Components (React/Preact)

Import UI components for embedding in your app:

import { HappyPandaAPI } from '@happypanda-ai/sdk';
import {
  ChecklistWidget,
  ChangelogLauncher,
  useChecklist,
  useChangelog,
} from '@happypanda-ai/sdk/widget';

const api = new HappyPandaAPI('your-project-id');

function App() {
  const userId = 'user_123';

  return (
    <div>
      {/* Onboarding checklist - place anywhere */}
      <Sidebar>
        <ChecklistWidget api={api} userId={userId} />
      </Sidebar>

      {/* Changelog button with dropdown */}
      <Header>
        <ChangelogLauncher api={api} userId={userId} />
      </Header>
    </div>
  );
}

Hooks

Use hooks for custom UI:

import { useChecklist, useChangelog } from '@happypanda-ai/sdk/widget';

function CustomOnboarding({ api, userId }) {
  const {
    config,
    steps,
    progress,
    isLoading,
    completeStep,
    skipStep,
    dismiss,
  } = useChecklist(api, userId);

  if (isLoading) return <div>Loading...</div>;
  if (!config) return null;

  return (
    <div>
      <h2>{config.name}</h2>
      {steps.map((step) => (
        <div key={step.id}>
          <span>{step.title}</span>
          <button onClick={() => completeStep(step.id)}>Complete</button>
        </div>
      ))}
    </div>
  );
}

Available Components

| Component | Description | |-----------|-------------| | ChecklistWidget | Full checklist with launcher and panel | | ChecklistLauncher | Floating button that opens checklist | | ChangelogLauncher | Button with unread badge and dropdown |

Available Hooks

| Hook | Description | |------|-------------| | useChecklist(api, userId) | Manage checklist state and actions | | useChangelog(api, userId?) | Manage changelog state and actions |

TypeScript

All types are exported:

import type {
  // API Response types
  IdentifyResponse,
  EnrollResult,
  FeedbackResponse,

  // Config types
  WidgetConfig,
  OnboardingConfig,
  OnboardingStep,
  OnboardingProgress,

  // Data types
  ChangelogEntry,
  Survey,
  SubmissionData,
} from '@happypanda-ai/sdk';

Error Handling

import { HappyPandaAPI, APIError, isNetworkError, getErrorMessage } from '@happypanda-ai/sdk';

const api = new HappyPandaAPI('project_id');

try {
  await api.identify({ userId: 'user_123' });
} catch (error) {
  if (isNetworkError(error)) {
    console.log('Network error - retry later');
  } else {
    console.log('Error:', getErrorMessage(error));
  }
}

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 11+
  • Edge 79+

License

MIT