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

@alfredo-ai/leads-widget

v1.0.4

Published

Embeddable leads widget with optional SMS validation for Alfredo integration

Readme

@alfredo-ai/leads-widget

Embeddable leads widget with optional SMS validation, designed for Alfredo AI integration. Built with React, Material UI, Redux, and TailwindCSS.

Features

  • Multi-step lead form (location, characteristics, personal data, optional SMS validation)
  • Multi-language support (Portuguese, English, Spanish)
  • Google Maps integration for location selection
  • Price interval / estimation display
  • Optional SMS verification flow
  • Theming via primaryColor and backgroundColor
  • Lifecycle callbacks: onSuccess, onError, onStepChange

Installation

Via npm (not tested)

npm install @alfredo-ai/leads-widget

Via script tag (CDN)

No install required. Load the UMD bundle directly (see Script tag usage below).


Usage

Script tag (UMD)

  1. Add a container element where the widget should render:
<div id="leads-widget-root"></div>
  1. Load the widget script and styles:
<script src="https://unpkg.com/@alfredo-ai/leads-widget/dist/widget.umd.cjs"></script>
<link rel="stylesheet" href="https://unpkg.com/@alfredo-ai/leads-widget/dist/style.css" />
  1. Initialize the widget:
<script>
  window.initLeadsWidget({
    token: "YOUR_ALFREDO_LEADS_TOKEN",
    container: "leads-widget-root",
    origin: "pt",
  });
</script>

NPM / ESM (React or any bundler)

Import the package so that initLeadsWidget is attached to window, then call it once the container element is in the DOM:

import "@alfredo-ai/leads-widget";
import "@alfredo-ai/leads-widget/style.css";

window.initLeadsWidget({
  token: "YOUR_ALFREDO_LEADS_TOKEN",
  container: "leads-widget-root",
  origin: "pt",
});

Example in a React component:

import { useEffect } from "react";
import "@alfredo-ai/leads-widget";
import "@alfredo-ai/leads-widget/style.css";

function LeadsWidget() {
  useEffect(() => {
    window.initLeadsWidget({
      token: "YOUR_ALFREDO_LEADS_TOKEN",
      container: "leads-widget-root",
      origin: "pt",
    });
  }, []);

  return <div id="leads-widget-root" />;
}

Configuration options

| Option | Type | Default | Description | | ----------------- | ------- | ----------- | ------------------------------------------------- | | container | string | "root" | DOM id of the element where the widget mounts. | | origin | string | "pt" | Origin/locale key ("pt", "es"). | | userID | string | null | Optional user identifier. | | lang | string | null | Preferred language (pt, en, es). | | token | string | - | Alfredo leads API token. | | showHeader | boolean | true | Whether to show the widget header. | | primaryColor | string | "#009de0" | Primary theme color (hex). | | backgroundColor | string | "#f7f7f7" | Background color (hex). | | onSuccess | function | () => {} | Callback when lead is submitted successfully. | | onError | function | () => {} | Callback when submission fails; receives the error.| | onStepChange | function | () => {} | Callback when user navigates steps; receives new step number.|


Callbacks

onSuccess

Called when the lead is successfully submitted (either after the initial API submit or after SMS verification).

window.initLeadsWidget({
  token: "YOUR_ALFREDO_LEADS_TOKEN",
  container: "leads-widget-root",
  onSuccess: () => {
    console.log("Lead submitted successfully");
    // e.g. redirect, show thank you, track analytics
  },
});

onError

Called when lead submission or SMS validation fails. Receives the error object from the API.

window.initLeadsWidget({
  token: "YOUR_ALFREDO_LEADS_TOKEN",
  container: "leads-widget-root",
  onError: (error) => {
    console.error("Lead submission failed", error);
    // error?.data?.detail may contain API error details
  },
});

onStepChange

Called when the user navigates between form steps (forward or back). Receives the new step number (1-based).

window.initLeadsWidget({
  token: "YOUR_ALFREDO_LEADS_TOKEN",
  container: "leads-widget-root",
  onStepChange: (stepNumber) => {
    console.log("User is on step", stepNumber);
    // e.g. track funnel analytics, update progress in parent UI
  },
});

License

MIT. See LICENSE for details.