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

flowsjackpot

v2.9.0

Published

Flows Jackpot Library

Readme

FlowsJackpot Library

A TypeScript library for integrating jackpot functionality into web applications with customizable UI widgets, real-time event handling, and player opt-in management.

Installation

npm install flowsjackpot
# or with bun
bun add flowsjackpot

Quick Start

ESM (Recommended)

// Use the default instance (similar to Wave.js)
import flowsJackpots from "flowsjackpot";

flowsJackpots.startJackpotWidget(
  "{{orgId}}",
  "{{gameId}}",
  "{{playerId}}",
  "en",
  { bottom: "20px", right: "20px" },
);

Features

Core Functionality

Widget Management

  • startJackpotWidget() - Initialize and display the jackpot widget
  • closeJackpotWidget() - Close widget and clean up resources
  • Automatic positioning and responsive layout support
  • Drag-and-drop widget repositioning
  • Mobile-optimized modal display

Real-time Event Handling

  • Subscribe to jackpot value updates and win events
  • Unsubscribe from all event streams
  • Server-sent events for live jackpot value updates
  • Instant win notifications with animations

Player Opt-in Management

  • Check player's jackpot participation status
  • Update player opt-in preferences
  • Modal-based opt-in/opt-out interface
  • Persistent opt-in status tracking

API Integration

The library includes a comprehensive API service with the following endpoints:

Game Data

  • Retrieve jackpot game configuration
  • Fetch localized appearance settings

Player Management

  • Get player's opt-in status
  • Update opt-in preferences

UI Components

Multi-level Jackpot Display

Supports 1-5 jackpot levels with customizable titles and styling:

  • Level 1: Mega jackpot (primary display)
  • Level 2: Major jackpot
  • Level 3: Minor jackpot
  • Level 4: Mini jackpot
  • Level 5: Rapid jackpot

Navigation System

Three-tab interface:

  • Jackpot: Live jackpot values and participation status
  • News: Announcements and updates
  • Help: User guidance and terms

Visual Effects

  • Fireworks animation on jackpot wins
  • Winner announcements with customizable messaging
  • Responsive animations and transitions
  • Mobile-optimized interactions

Configuration Options

Language Support

  • Automatic browser language detection
  • Custom language specification
  • Localized text assets for all UI elements

Positioning

{
  top: '20px',     // Distance from top
  bottom: '20px',  // Distance from bottom
  left: '20px',    // Distance from left
  right: '20px'    // Distance from right
}

Layout Variants

  • Desktop: Full-featured widget for desktop screens
  • Mobile: Touch-optimized mobile interface
  • StickyTop: Fixed top positioning
  • StickyLeft: Fixed left sidebar positioning

Device Breakpoints

Configurable responsive breakpoint (default: 480px) for automatic mobile/desktop switching.

API Reference

Methods

startJackpotWidget(orgId, gameId, playerId, language?, startingPosition?, deviceBreakingPoint?)

Initialize and display the jackpot widget.

Parameters:

  • orgId (string): Organization identifier
  • gameId (string): Game identifier
  • playerId (string): Player identifier
  • language (string, optional): Language code (e.g., 'en', 'fr-FR')
  • startingPosition (Position, optional): Initial widget position
  • deviceBreakingPoint (number, optional): Mobile breakpoint in pixels

closeJackpotWidget()

Close the widget and clean up all resources including event listeners and stylesheets.

ListenToJackpotEvents(eventUrl, workspaceId, channel, callback)

Subscribe to real-time jackpot events.

Parameters:

  • eventUrl (string): Event server URL
  • workspaceId (string): Workspace identifier
  • channel (string): Event channel name
  • callback (function): Event handler function

StopListeningToJackpotEvents()

Unsubscribe from all active event streams.

Configuration Object

type JackpotGameConfig = {
  organisationId: string;
  playerId: string;
  language: string;
  selectedVariant: "Desktop" | "Mobile";
  defaultPos: Position;
  baseUrl: string;
  eventUrl: string;
  variantBreakingPoint: number;
  optInStatus: OptInStatusEnum;
};

Event Types

Jackpot Events

  • jackpot_won: Player wins jackpot (triggers animations)
  • jackpot_won_other: Another player wins jackpot
  • jackpot_value: Live jackpot value update

Examples

Basic Implementation

// Using default instance (ESM style)
import flowsJackpots from "flowsjackpot";

// Start widget with minimal configuration
flowsJackpots.startJackpotWidget("{{orgId}}", "{{gameId}}", "{{playerId}}");

Advanced Configuration

// Using default instance
import flowsJackpots from "flowsjackpot";

// Custom positioning and language
flowsJackpots.startJackpotWidget(
  "{{orgId}}",
  "{{gameId}}",
  "{{playerId}}",
  "fr-FR",
  { top: "50px", left: "50px" },
  768, // Custom mobile breakpoint
);

// Clean up when done
setTimeout(() => {
  flowsJackpots.closeJackpotWidget();
}, 60000);

Development

This project uses Bun as its package manager. Before starting development:

bun run dev-setup

Use bun for all commands:

bun add package-name
bun run build
bun test

Testing

See example in index.html. Test the widget by running:

bun run build
bun testserver.js

Browser Support

  • Modern browsers with ES2015+ support
  • Mobile Safari and Chrome for mobile optimization
  • Automatic fallbacks for older browsers

License

ISC License

Contributors


Version: 2.0.0
Author: Flows LTD