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

@alihaiderrana/email-builder-sdk

v0.1.12

Published

React iframe SDK for embedding the Circles email template builder

Readme

@alihaiderrana/email-builder-sdk

React SDK for embedding the Circles Email Builder in your app.

Install

npm install @alihaiderrana/email-builder-sdk

Quick Start

import { EmailBuilder } from '@alihaiderrana/email-builder-sdk';

export function EmailEditor() {
  return (
    <div style={{ height: '100vh' }}>
      <EmailBuilder
        embedToken={process.env.NEXT_PUBLIC_EMAIL_BUILDER_TOKEN}
        initialHtml="<h1>Welcome</h1><p>Edit this email template</p>"
        showFooter={true}
        includeUnsubscribe={true}
        footerInjectionMode="sdk"
        externalFooterHtml="<div>Custom footer</div>"
        onAuthError={(message) => console.error('auth failed', message)}
        onChange={(html) => console.log('changed', html)}
        onSave={(html) => console.log('saved', html)}
        onUpload={async (file) => {
          const body = new FormData();
          body.append('asset', file);
          const response = await fetch('/api/uploads', { method: 'POST', body });
          const data = await response.json();
          return data.url;
        }}
        onListAssets={async () => {
          const response = await fetch('/api/assets');
          const data = await response.json();
          return data.assets;
        }}
        onDeleteAsset={async ({ id }) => {
          if (!id) return false;
          const response = await fetch(`/api/assets/${id}`, { method: 'DELETE' });
          return response.ok;
        }}
      />
    </div>
  );
}

If initialHtml is not provided, the editor starts with a default Hello World template. If src is not provided, the SDK uses the managed Circles builder endpoint.

Props

| Prop | Type | Required | Description | | --- | --- | --- | --- | | embedToken | string | Yes | Token passed to iframe for backend verification. | | src | string | No | Optional custom builder URL override. | | initialHtml | string | No | Initial HTML content to load in the editor. | | templateId | string | No | Optional template id; builder fetches HTML from backend when provided. | | showFooter | boolean | No | Show "Powered by Public Circles" branding in footer. Defaults to true. | | includeUnsubscribe | boolean | No | Include unsubscribe link in footer. Defaults to true. | | externalFooterHtml | string | No | Optional host-provided footer HTML snippet. | | footerInjectionMode | 'default' \| 'sdk' | No | Footer source mode. Use 'sdk' to apply externalFooterHtml. | | config | Record<string, unknown> | No | Optional builder configuration object. | | className | string | No | Class for the wrapper container. | | style | React.CSSProperties | No | Inline styles for the wrapper container. | | iframeTitle | string | No | Accessible title for the iframe. | | sandbox | string | No | Custom iframe sandbox value. | | allowedOrigin | string | No | Override allowed origin for message validation. | | onReady | () => void | No | Called when editor is ready. | | onStatusChange | (status) => void | No | Called on status changes (loading, ready, error). | | onChange | (html: string) => void | No | Called when editor content changes. | | onSave | (html: string) => void | No | Called when user saves content. | | onUpload | (file: File) => Promise<string> | No | Upload handler that returns a public URL for inserted assets. | | onListAssets | (payload?: { limit?: number }) => Promise<AssetItem[]> | No | Returns previously uploaded images for the picker modal. | | onDeleteAsset | (payload: { id?: string; url?: string }) => Promise<boolean> | No | Deletes an uploaded asset and returns whether it succeeded. | | onAuthError | (message: string) => void | No | Called when token is missing/invalid/rejected. |

AssetItem shape:

type AssetItem = {
  url: string;
  id?: string;
  name?: string;
  thumbnailUrl?: string;
};

Image Management Contract

To support reusable image uploads for any client app:

  • implement onUpload to upload a file and return a public URL
  • implement onListAssets to return uploaded images
  • implement onDeleteAsset to delete uploaded images from your backend/storage

The SDK stays storage-agnostic (S3, GCS, Cloudflare R2, etc.).

Ref API

EmailBuilder supports a ref with:

  • reload(): void - Reloads the embedded editor iframe.

Requirements

  • React >=18.2.0
  • ReactDOM >=18.2.0

License

MIT