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

smess-plugin-subscription

v1.0.2

Published

Subscription plugin for SMESS, a modern web application framework.

Downloads

6

Readme

🚀 Subscription Status Plugin

npm version License: MIT

A lightweight, beautiful plugin to check subscription status via API and display elegant renewal prompts. Works with any website - React, Vue, Angular, or vanilla JavaScript.

✨ Features

  • 🎨 Beautiful UI - Modern modal design with smooth animations
  • 🔧 Universal Compatibility - Works with any framework or vanilla JS
  • Lightweight - Minimal bundle size with excellent performance
  • 🎯 Customizable - Easy theming and configuration options
  • 📱 Responsive - Mobile-friendly design
  • 🌙 Dark Mode - Automatic theme detection
  • 🔒 Type Safe - Full TypeScript support

📦 Installation

npm install smess-plugin-subscription

🚀 Quick Start

React Usage

import { SubscriptionPlugin } from 'smess-plugin-subscription';
import 'smess-plugin-subscription/dist/styles.css';

function App() {
  return (
    <SubscriptionPlugin 
      apiEndpoint="/api/subscription/status"
      userId="user-123"
      onReactivate={() => window.open('/billing', '_blank')}
    />
  );
}

Vanilla JavaScript Usage

<!-- Include CSS -->
<link rel="stylesheet" href="node_modules/smess-plugin-subscription/dist/styles.css">

<!-- Include JS -->
<script src="node_modules/smess-plugin-subscription/dist/vanilla/subscription-plugin.js"></script>

<script>
const plugin = new SubscriptionStatusPlugin({
  apiEndpoint: '/api/subscription/status',
  userId: 'user-123',
  onReactivate: () => window.open('/billing', '_blank'),
  checkInterval: 300000 // Check every 5 minutes
});

plugin.init();
</script>

CDN Usage

<!-- CSS -->
<link rel="stylesheet" href="https://unpkg.com/smess-plugin-subscription/dist/styles.css">

<!-- JavaScript -->
<script src="https://unpkg.com/smess-plugin-subscription/dist/vanilla/subscription-plugin.js"></script>

⚙️ Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiEndpoint | string | Required | API endpoint to check subscription status | | userId | string | undefined | User ID to check (sent as X-User-ID header) | | onReactivate | function | undefined | Callback when user clicks reactivate button | | onClose | function | undefined | Callback when modal is closed | | checkInterval | number | 300000 | How often to check status (milliseconds) | | theme | string | 'auto' | Theme: 'light', 'dark', or 'auto' | | position | string | 'center' | Modal position: 'center', 'top', or 'bottom' |

📡 API Response Format

Your API endpoint should return JSON in this format:

{
  "isExpired": true,
  "planName": "Pro Plan",
  "expiryDate": "2024-01-15",
  "userId": "user-123"
}

🎨 Customizing Colors

Method 1: CSS Variables (Recommended)

:root {
  /* Primary colors */
  --primary: 142 76% 36%;        /* Green theme */
  --primary-glow: 142 76% 60%;
  
  /* Warning colors */
  --warning: 45 93% 58%;         /* Yellow warning */  
  --warning-glow: 45 93% 75%;
}

Method 2: Pre-built Themes

Choose from 5 beautiful themes:

  • Ocean Blue (default) - Professional blue with orange accents
  • Forest Green - Nature-inspired green with yellow warnings
  • Royal Purple - Elegant purple with red warnings
  • Sunset Orange - Warm orange theme with red alerts
  • Tech Dark - High-tech cyan with bright warnings

Method 3: JavaScript Configuration

const plugin = new SubscriptionStatusPlugin({
  apiEndpoint: '/api/subscription/status',
  customStyles: {
    primaryColor: 'hsl(142, 76%, 36%)',
    warningColor: 'hsl(45, 93%, 58%)',
    primaryGlow: 'hsl(142, 76%, 60%)',
    warningGlow: 'hsl(45, 93%, 75%)'
  }
});

🛠️ Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Setup

# Clone the repository
git clone <repository-url>
cd smess-plugin-subscription

# Install dependencies
make install

# Start development server
make dev

Build Commands

# Show all available commands
make help

# Development
make dev          # Start dev server
make install      # Install dependencies

# Building
make build        # Build demo site
make build-lib    # Build library for npm
make package      # Create npm package

# Quality
make lint         # Run linting
make test         # Run tests
make clean        # Clean build files

# Publishing
make version      # Show current version
make release      # Prepare new release
make publish      # Publish to npm

Project Structure

smess-plugin-subscription/
├── src/
│   ├── components/           # React components
│   │   ├── SubscriptionPlugin.tsx
│   │   ├── PluginDemo.tsx
│   │   └── ColorCustomizer.tsx
│   ├── lib/                 # Vanilla JS library
│   │   └── subscription-plugin.ts
│   ├── pages/               # Demo pages
│   └── index.css            # Styles and design tokens
├── dist/                    # Built library files
├── Makefile                 # Build automation
└── package.json

🚀 Publishing to NPM

1. Prepare Release

# Update version and build
make release

2. Login to NPM

npm login

3. Publish

make publish

4. Verify Publication

npm view smess-plugin-subscription

📝 API Integration Examples

Express.js Backend

app.get('/api/subscription/status', async (req, res) => {
  const userId = req.headers['x-user-id'];
  
  // Check subscription in your database
  const subscription = await getSubscription(userId);
  
  res.json({
    isExpired: subscription.expiryDate < new Date(),
    planName: subscription.planName,
    expiryDate: subscription.expiryDate.toISOString(),
    userId: userId
  });
});

Next.js API Route

// pages/api/subscription/status.js
export default async function handler(req, res) {
  const userId = req.headers['x-user-id'];
  
  const subscription = await checkUserSubscription(userId);
  
  res.status(200).json({
    isExpired: subscription.expired,
    planName: subscription.plan,
    expiryDate: subscription.expiryDate,
    userId: userId
  });
}

🎯 Usage Examples

E-commerce Site

const plugin = new SubscriptionStatusPlugin({
  apiEndpoint: '/api/subscription/check',
  userId: getCurrentUserId(),
  onReactivate: () => {
    // Redirect to checkout
    window.location.href = '/checkout?plan=premium';
  },
  checkInterval: 600000 // Check every 10 minutes
});

SaaS Dashboard

<SubscriptionPlugin 
  apiEndpoint="/api/user/subscription"
  userId={user.id}
  onReactivate={() => {
    analytics.track('subscription_reactivate_clicked');
    router.push('/billing');
  }}
  onClose={() => {
    analytics.track('subscription_modal_dismissed');
  }}
/>

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support


Made with ❤️ using Lovable