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

@insure-os/client

v0.0.53

Published

InsureOS JavaScript client library for quote flow integration

Readme

@insure-os/scripts

A lightweight JavaScript client library for integrating InsureOS quote functionality into external websites. This library provides two simple integration methods: script tag with auto-initialization or NPM import with programmatic control.


🚀 Quick Start for Developers

Publishing to NPM + CDN

# Publish to both NPM and CDN in one command
pnpm release

This will:

  1. Bump patch version (0.0.0 → 0.0.1)
  2. Build production bundles
  3. Deploy to CDN: https://cdn.os.insure
  4. Publish to NPM: @insure-os/scripts

NPM Package:

  • Install: npm install @insure-os/scripts
  • View: https://www.npmjs.com/package/@insure-os/scripts

CDN URLs:

  • Versioned: https://cdn.os.insure/v{version}/insureos.min.js
  • Major version: https://cdn.os.insure/v{major}/insureos.min.js
  • Latest: https://cdn.os.insure/latest/insureos.min.js

📖 Full guides:


Features

  • 🚀 Simple Integration - Two easy ways to integrate: script tag or NPM import
  • 🎯 Auto-initialization - Script tag automatically creates quote intents and renders buttons
  • 🎨 Customizable Styling - Well-named CSS classes for easy styling
  • 🔒 Secure Authentication - Built-in organization-based authentication
  • Lightweight - Minimal bundle size with essential functionality only

Installation & Usage

Method 1: Script Tag (CDN - Recommended for external sites)

Add a script tag from our CDN. This is the easiest way for external websites to integrate InsureOS.

<!DOCTYPE html>
<html>
    <head>
        <title>Insurance Quote</title>
        <style>
            /* Style the button with well-named CSS classes */
            .insureos-submit-btn {
                background-color: #007bff;
                color: white;
                border: none;
                padding: 12px 24px;
                font-size: 16px;
                border-radius: 6px;
                cursor: pointer;
                font-family: system-ui, sans-serif;
            }

            .insureos-submit-btn:hover:not(:disabled) {
                background-color: #0056b3;
            }

            .insureos-loading {
                background-color: #6c757d;
                cursor: not-allowed;
            }

            .insureos-error {
                color: #dc3545;
                padding: 12px;
                border: 1px solid #dc3545;
                border-radius: 4px;
                background-color: #f8d7da;
            }
        </style>
    </head>
    <body>
        <h1>Get Your Insurance Quote</h1>

        <!-- Load InsureOS from CDN (use specific version for production) -->
        <script
            src="https://cdn.os.insure/v0.0.0/insureos.min.js"
            integrity="sha384-x6rqyvqpRkF+stuy4Ydnp+gou2baQOQFXkfw7bt/NVtF2I0VJiXV8neu2iIDSLzf"
            crossorigin="anonymous">
        </script>

        <script>
            // Initialize InsureOS and mount to container
            const client = new InsureOSScripts.InsureOS({
                apiKey: 'your-api-key',
                environment: 'production',
            });

            client.mount('#insureos-container', {
                quoteIntentId: 'your-quote-intent-id',
            });
        </script>
    </body>
</html>

Method 2: NPM Import with mount()

Install the package and use the InsureOS.mount() method for programmatic control.

npm install @insure-os/scripts
import { InsureOS } from "@insure-os/scripts";

// Mount to a specific DOM element
const container = document.getElementById("quote-container");
InsureOS.mount(container, {
    orgId: "your-org-id",
});
<!DOCTYPE html>
<html>
    <head>
        <title>Insurance Quote</title>
        <style>
            .insureos-submit-btn {
                background-color: #007bff;
                color: white;
                border: none;
                padding: 12px 24px;
                font-size: 16px;
                border-radius: 6px;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <h1>Get Your Insurance Quote</h1>
        <div id="quote-container"></div>

        <script type="module" src="./main.js"></script>
    </body>
</html>

API Reference

InsureOS.mount()

Mounts InsureOS quote functionality to a DOM element.

InsureOS.mount(element: HTMLElement, config: MountConfig): Promise<void>

Parameters:

  • element - DOM element to mount the quote button to
  • config - Configuration object

MountConfig:

interface MountConfig {
    orgId: string; // Required: Your organization ID
    apiBaseUrl?: string; // Optional: Custom API base URL (defaults to https://api.os.insure)
}

Example:

import { InsureOS } from "@insure-os/scripts";

// Basic usage
InsureOS.mount(document.getElementById("quote-btn"), {
    orgId: "123",
});

// With custom API URL (for development)
InsureOS.mount(document.getElementById("quote-btn"), {
    orgId: "123",
    apiBaseUrl: "http://localhost:3000/dev",
});

How It Works

  1. Initialization: The library initializes with your organization ID
  2. Quote Intent Creation: Automatically creates a blank quote intent via API call
  3. Button Rendering: Renders a submit button with loading states
  4. User Interaction: When clicked, redirects user to the signed quote URL

CSS Classes for Styling

The library uses well-named CSS classes that you can style:

  • .insureos-submit-btn - Main submit button
  • .insureos-loading - Loading state (added to button)
  • .insureos-error - Error message display

Examples

React Integration

import React, { useEffect, useRef } from "react";
import { InsureOS } from "@insure-os/scripts";

function QuoteButton({ orgId }) {
    const containerRef = useRef(null);

    useEffect(() => {
        if (containerRef.current) {
            InsureOS.mount(containerRef.current, { orgId });
        }
    }, [orgId]);

    return <div ref={containerRef} />;
}

Vue.js Integration

<template>
    <div ref="quoteContainer"></div>
</template>

<script>
import { InsureOS } from "@insure-os/scripts";

export default {
    props: ["orgId"],
    mounted() {
        InsureOS.mount(this.$refs.quoteContainer, {
            orgId: this.orgId,
        });
    },
};
</script>

Multiple Buttons

import { InsureOS } from "@insure-os/scripts";

// Mount multiple buttons for different organizations
InsureOS.mount(document.getElementById("quote-1"), { orgId: "123" });
InsureOS.mount(document.getElementById("quote-2"), { orgId: "456" });
InsureOS.mount(document.getElementById("quote-3"), { orgId: "789" });

Error Handling

The library handles errors gracefully:

  • Network errors: Shows error message with retry capability
  • API errors: Displays user-friendly error messages
  • Configuration errors: Clear error messages for missing orgId

Errors are displayed using the .insureos-error CSS class.

Browser Support

  • Modern Browsers: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
  • Required Features: Fetch API, Promises, ES2017 syntax

TypeScript Support

Full TypeScript definitions are included:

import { InsureOS, MountConfig, QuoteIntentResponse } from "@insure-os/scripts";

const config: MountConfig = {
    orgId: "your-org-id",
    apiBaseUrl: "https://api.os.insure",
};

InsureOS.mount(element, config);

License

MIT License - see LICENSE file for details.