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

@quantabit/activity-sdk

v1.0.1

Published

QuantaBit 活动配置 SDK - 提供运营活动、抽奖、促销等功能

Readme

@quantabit/activity-sdk

QuantaBit 活动配置 SDK - 提供运营活动、抽奖、促销等功能

📦 安装

npm install @quantabit/activity-sdk
# 或
yarn add @quantabit/activity-sdk

🚀 快速开始

1. 引入 Provider

import { ActivityProvider } from "@quantabit/activity-sdk";
import "@quantabit/activity-sdk/styles.css";

function App() {
  return (
    <ActivityProvider
      apiUrl="https://api.example.com/v1"
      token="your-auth-token"
      language="zh"
      onWin={(prize) => console.log("恭喜中奖:", prize)}
    >
      <YourComponent />
    </ActivityProvider>
  );
}

2. 使用组件

import { ActivityList, ActivityCard, LotteryWheel } from '@quantabit/activity-sdk';

// 活动列表
<ActivityList
  showFilter
  onActivityClick={(activity) => console.log(activity)}
/>

// 活动卡片
<ActivityCard
  activity={activityData}
  showCountdown
  onParticipate={handleParticipate}
/>

// 转盘抽奖
<LotteryWheel
  prizes={[
    { id: '1', name: '10积分', icon: '🪙' },
    { id: '2', name: '优惠券', icon: '🎫' },
    { id: '3', name: '谢谢参与', icon: '🙏' },
  ]}
  chances={3}
  onDraw={handleDraw}
  onComplete={(prize) => console.log('获得:', prize)}
/>

3. 使用 Hooks

import { useActivity } from "@quantabit/activity-sdk";

function MyComponent() {
  const {
    activities, // 活动列表
    currentActivity, // 当前活动
    myPrizes, // 我的奖品
    loading,
    loadActivities, // 加载活动
    participate, // 参与活动
    draw, // 执行抽奖
  } = useActivity();

  return <div>...</div>;
}

📚 组件列表

| 组件 | 描述 | | -------------- | ---------------------------------- | | LotteryWheel | 转盘抽奖组件 | | ActivityCard | 活动卡片(封面、倒计时、参与按钮) | | ActivityList | 活动列表,支持状态筛选 |

📖 活动类型

import { ActivityType, LotteryType } from "@quantabit/activity-sdk";

// 活动类型
ActivityType.LOTTERY; // 抽奖
ActivityType.PROMOTION; // 促销
ActivityType.CAMPAIGN; // 营销活动
ActivityType.AIRDROP; // 空投
ActivityType.CONTEST; // 竞赛

// 抽奖方式
LotteryType.WHEEL; // 转盘
LotteryType.CARD; // 翻牌
LotteryType.BOX; // 盲盒
LotteryType.SCRATCH; // 刮刮乐

📄 许可证

MIT License