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

white-label-insurance-library

v1.1.13

Published

A reusable white-label insurance application component library.

Readme

📦 How to Use the White-Label Insurance Application Library

This document provides instructions on how to consume and customize the white-label-insurance-library npm package within your own React applications, including how to listen to events.


1. 📥 Consuming the Library

Installation in Consumer App

Create a new React project (if you don't have one):

npm create vite@latest my-consumer-app -- --template react-ts
cd my-consumer-app
npm install

Install required dependencies:

npm install react-router-dom
npm install --save-dev @types/react-router-dom

Install your white-label library:

npm install white-label-insurance-library # Replace with your actual package name

Integration

In your consumer application's entry point (e.g., src/main.tsx), import and render the WhiteLabelApp component. You can pass callback functions as props to WhiteLabelApp to listen for events.

// my-consumer-app/src/main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { WhiteLabelApp, WhiteLabelAppProps } from 'white-label-insurance-library';

const handleBrandChange: WhiteLabelAppProps['onBrandChange'] = (newBrandKey) => {
  console.log(`Consumer App: Brand changed to: ${newBrandKey}`);
};

const handleFormSubmit: WhiteLabelAppProps['onFormSubmit'] = (formData) => {
  console.log('Form submitted successfully!', formData);
};

const handleQuestionsLoadStart: WhiteLabelAppProps['onQuestionsLoadStart'] = () => {
  console.log('Questions API fetch started...');
};

const handleQuestionsLoadSuccess: WhiteLabelAppProps['onQuestionsLoadSuccess'] = () => {
  console.log('Questions API fetch successful!');
};

const handleQuestionsLoadError: WhiteLabelAppProps['onQuestionsLoadError'] = (error) => {
  console.error('Questions API fetch failed:', error);
};

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <BrowserRouter>
      <WhiteLabelApp
        onBrandChange={handleBrandChange}
        onFormSubmit={handleFormSubmit}
        onQuestionsLoadStart={handleQuestionsLoadStart}
        onQuestionsLoadSuccess={handleQuestionsLoadSuccess}
        onQuestionsLoadError={handleQuestionsLoadError}
      />
    </BrowserRouter>
  </React.StrictMode>,
);

You may remove the default App.tsx and App.css if using WhiteLabelApp for all routing.


2. 🎨 Brand Switching

You can switch brands in two ways:

URL Parameter (Initial Load)

Append ?brand=<brandKey> to your application’s URL:

http://localhost:5173/?brand=zurich
http://localhost:5173/?brand=axa
http://localhost:5173/?brand=metlife

Dropdown Selection

Use the "Select Your Brand" dropdown on the Welcome or Questions page. This uses internal context and does not modify the URL.

The onBrandChange callback will be triggered when switching.


3. 🛠 Customization

Defining New Brands

Edit src/branding/brands.ts in the library:

export type BrandKey = 'zurich' | 'axa' | 'metlife' | 'newbrand';

export const brands: Record<BrandKey, Brand> = {
  newbrand: {
    name: 'New Brand Name',
    primaryColor: '#1a1a1a',
    secondaryColor: '#333333',
    fontFamily: '"Arial", sans-serif',
    fontWeight: 400,
    backgroundColor: '#f0f0f0',
    logoUrl: 'https://via.placeholder.com/150/1a1a1a/FFFFFF?text=New+Brand+Logo',
    buttonColor: '#1a1a1a',
    buttonTextColor: '#FFFFFF',
    headingFontSize: '2.0em',
    inputBorderColor: '#555555',
  },
};

Rebuild and publish:

npm run build
npm publish

4. 🎨 Overriding Styles

The library uses CSS variables. You can override them globally in your consumer app:

/* src/index.css */
body {
  --brand-primary: #ff5733;
  --brand-background-color: #f0f8ff;
}

.questions-container {
  box-shadow: 0 0 20px rgba(255, 87, 51, 0.5);
}

✅ Features

  • Multi-brand white-label support
  • Custom theming via CSS variables
  • Callback-based communication for brand and form events
  • Easy React Router integration

📜 License

MIT — free to use and customize.