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

@boostengine/gamification

v1.1.0

Published

Interactive eCommerce gamification engine: Lucky Spin-the-Wheel, Scratch-to-Reveal Cards, Mystery Gift Boxes, exit-intent lead capture, and AI reward optimization.

Readme

@boostengine/gamification

Interactive eCommerce gamification engine: Lucky Spin-the-Wheel, Scratch-to-Reveal Cards, Mystery Gift Boxes, exit-intent lead capture, and AI reward optimization.

npm version License: MIT


⚡ Features

  • 🎡 Lucky Spin-the-Wheel:
    • Configurable slices, weighted probability distribution, and precise canvas/SVG rotation angle calculation.
  • ✨ Scratch-to-Reveal Card:
    • Interactive scratchable overlay with threshold-based auto-reveal (e.g. 50% cleared -> instant win).
  • 🚪 Smart Trigger Triggers:
    • Exit-intent cursor detection, time delay (e.g. 5 seconds after page load), or scroll-depth triggers.
  • 📱 Built-In Lead Generation:
    • Captures 10-digit Indian mobile numbers or email IDs before / after claiming rewards.
  • 🛡️ Anti-Abuse Cooldown Shield:
    • Session/Cookie-based cooldown periods (e.g. 7-day limit per device) to prevent discount farming.

📦 Installation

npm install @boostengine/gamification
# or
pnpm add @boostengine/gamification
# or
yarn add @boostengine/gamification

🚀 Quick Start (React / Next.js)

'use client';

import React from 'react';
import { useSpinWheel } from '@boostengine/gamification/react';

const config = {
  id: 'wheel-welcome-1',
  title: 'Spin to Win Exclusive Discounts!',
  type: 'spin_wheel',
  trigger: 'exit_intent',
  cooldownDays: 7,
  slices: [
    { id: '1', label: '10% OFF', probabilityWeight: 50, discountType: 'percentage', discountValue: 10, couponCode: 'SPIN10' },
    { id: '2', label: '20% OFF', probabilityWeight: 20, discountType: 'percentage', discountValue: 20, couponCode: 'LUCKY20' },
    { id: '3', label: 'Flat ₹500 OFF', probabilityWeight: 10, discountType: 'fixed_amount', discountValue: 500, couponCode: 'MEGA500' },
    { id: '4', label: 'Free Delivery', probabilityWeight: 15, discountType: 'free_shipping', discountValue: 0, couponCode: 'FREESHIP' },
    { id: '5', label: 'Better Luck Next Time', probabilityWeight: 5, discountType: 'no_reward', discountValue: 0, isLosingSlice: true },
  ],
};

export function LuckySpinWheelModal() {
  const {
    isOpen,
    isSpinning,
    rotationAngle,
    winningOutcome,
    hasPlayed,
    leadInput,
    setLeadInput,
    isLeadValid,
    spin,
    submitLead,
    close,
  } = useSpinWheel({
    config,
    onRewardWon: (res) => console.log('Won:', res),
    onLeadSubmit: (lead) => console.log('Lead Captured:', lead),
  });

  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-50 bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4">
      <div className="bg-white rounded-3xl p-6 max-w-md w-full shadow-2xl space-y-4 text-center">
        <h3 className="text-xl font-black">{config.title}</h3>

        {/* Wheel Graphic Container */}
        <div
          className="w-48 h-48 mx-auto rounded-full border-4 border-amber-400 transition-transform duration-[3500ms] ease-out flex items-center justify-center bg-gradient-to-tr from-indigo-600 to-purple-600 text-white font-bold"
          style={{ transform: `rotate(${rotationAngle}deg)` }}
        >
          🎡 Wheel
        </div>

        {!hasPlayed ? (
          <button
            onClick={spin}
            disabled={isSpinning}
            className="w-full py-3 bg-amber-500 hover:bg-amber-600 text-slate-950 font-black rounded-2xl shadow-lg transition"
          >
            {isSpinning ? 'Spinning...' : 'SPIN NOW!'}
          </button>
        ) : (
          <div className="space-y-3">
            <div className="p-3 bg-emerald-50 text-emerald-800 rounded-xl font-bold">
              🎉 You Won: {winningOutcome?.discountText}
              <div className="font-mono text-sm mt-1">{winningOutcome?.couponCode}</div>
            </div>

            <input
              type="text"
              placeholder="Enter your phone (+91) to claim"
              value={leadInput}
              onChange={(e) => setLeadInput(e.target.value)}
              className="w-full px-4 py-2.5 border rounded-xl"
            />

            <button
              onClick={submitLead}
              disabled={!isLeadValid}
              className="w-full py-2.5 bg-indigo-600 text-white font-bold rounded-xl disabled:opacity-50"
            >
              Claim & Apply to Cart
            </button>
          </div>
        )}
      </div>
    </div>
  );
}

📄 License

MIT © BoostEngine Team