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

adstia-quiz-builder

v1.1.53

Published

A React component library for building interactive quiz applications

Readme

Adstia Quiz Builder

A React component library for building interactive quiz applications.

Installation

npm install adstia-quiz-builder

Usage

import { useState } from "react";
import { QuizBuilder } from "adstia-quiz-builder";
import QuizJson from "./quizJson.json";

function QuizPage() {
  const [quizData, setQuizData] = useState(null);

  return (
    <div className="App">
      <QuizBuilder setQuizData={setQuizData} json={QuizJson} />
    </div>
  );
}

Quiz Data Structure Example

Your quiz JSON should follow this structure:

{
  quizName: "Quiz Name",
  totalSteps: 8,
  config: {
    nextButtonText: "Next",
    previousButtonText: "Previous",
    submitButtonText: "Check My Eligibility",
    prefillValues: true,
    leadId: "YOUR_LEAD_ID_WITHOUT_DOMAIN_NAME"
  },
  quizJson: [
    {
      quizCardId: "0",
      question: "What is your marital status?",
      subText: "I wondering if you are married or single?",
      nodes: [
        {
          nodeType: "dropdown", // or "options", "input", "zipcode", "dob", "email", "phone"
          nodeName: "maritalStatus",
          options: [
            { label: "Married", value: "married", next: "1" },
            // ...other options
          ]
        }
      ],
      next: "1"
    },
    {
      quizCardId: "1",
      quizCardType: "start",
      question: "What is your zip code?",
      nodes: [
        {
          nodeType: "zipcode",
          nodeName: "zipcode",
          inputLabel: "Zip Code",
          validation: {
            required: true,
            pattern: "^\\d+$",
            minLength: 5,
            maxLength: 5
          }
        }
      ],
      next: "2"
    },
    // ...more quiz cards
    {
      quizCardId: "10",
      quizCardType: "end",
      nodes: [
        {
          nodeType: "congrats",
          nodeName: "QUALIFIED",
          redirectUrl: "/congrats",
          openInNewTab: false,
          redirectCurrentTab: true,
          redirectCurrentTabUrl: "https://www.youtube.com/"
        }
      ]
    }
  ]
}

Key Properties

  • quizName: Name of the quiz
  • totalSteps: Total number of steps/cards
  • config: Quiz configuration (button texts, prefill, etc.)
  • quizJson: Array of quiz cards
    • quizCardId, quizCardType, question, subText, nodes, next, progress
    • nodes: Each node can be of type input, zipcode, dob, dropdown, options, email, phone, etc.
    • Validation and navigation handled via validation and next keys
    • End cards can include redirect logic

Features

  • Interactive quiz components (input, zipcode, options, dropdown, etc.)
  • Real-time validation and error handling
  • Next button disables automatically on error or required fields
  • Easy to integrate with existing React applications
  • Customizable and extensible
  • Prefill feature: If prefillValues is enabled in quizConfig, previously entered values are automatically loaded from localStorage for supported nodes (input, zipcode, email, phone, dob).
  • Context API: quizConfig is provided via React context for all quiz components.
  • setQuizData prop: Pass a setter to receive quiz results or state in your parent component.

Development

To build the package:

npm run build

To develop locally and test in another app:

npm link
# In your test app:
npm link adstia-quiz-builder

License

ISC