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

@souldi/try-on

v0.1.11

Published

Embeddable virtual try-on widget for e-commerce

Readme

@souldi/try-on

Drop a virtual try-on button into any e-commerce site in under 5 minutes.

Let your customers see how clothes look on them — powered by AI, embedded with a single script tag. No iframes, no redirects, no heavy dependencies.


Quick Start

1. Install

npm install @souldi/try-on

Or load directly via CDN:

<script src="https://unpkg.com/@souldi/try-on/dist/widget.umd.js"></script>

2. Initialize

<script>
  VirtualTryOn.init({
    apiBaseUrl: 'https://api.yourdomain.com',
    tenantApiKey: 'your_publishable_api_key',
  });
</script>

3. Add a Try-On Button

<div id="try-on-jacket"></div>

<script>
  VirtualTryOn.createButton({
    containerId: 'try-on-jacket',
    garmentUrl: 'https://your-cdn.com/images/jacket.png',
    targetImageId: 'product-image',  // optional: auto-swaps this <img> with the result
  });
</script>

That's it. Your customers can now try on clothes with AI.


How It Works

  1. Customer clicks the Try On button
  2. First-time users verify their email (magic link OTP — no passwords)
  3. They upload a photo of themselves
  4. AI generates a realistic try-on image in seconds
  5. The result appears directly on your product page

Returning users skip straight to step 4 — their session and photo are remembered.


Configuration

init(options)

Call once per page load to configure the widget.

| Option | Type | Required | Description | |--------|------|----------|-------------| | apiBaseUrl | string | Yes | Your Souldi API endpoint URL | | tenantApiKey | string | Yes | Your publishable API key (from your Souldi dashboard) | | theme | object | No | Customize the widget appearance (see Theming) | | onGenerationStart | function | No | Called when AI generation begins | | onGenerationSuccess | function(resultUrl) | No | Called with the result image URL on success | | onError | function(message) | No | Called when something goes wrong | | onLogout | function | No | Called when the user logs out |

createButton(options)

Add a try-on button for a specific garment. Call once per product on the page.

| Option | Type | Required | Description | |--------|------|----------|-------------| | containerId | string | Yes | ID of the DOM element where the button will render | | garmentUrl | string | Yes | Public URL of the garment image | | targetImageId | string | No | ID of an <img> element to auto-swap with the try-on result |


Theming

The widget ships with dark and light themes and supports deep customization to match your store's brand.

Theme Modes

VirtualTryOn.init({
  apiBaseUrl: 'https://api.yourdomain.com',
  tenantApiKey: 'your_key',
  theme: {
    mode: 'light',  // 'dark' (default) or 'light'
  },
});

Custom Brand Colors

Override individual properties to match your brand:

VirtualTryOn.init({
  apiBaseUrl: 'https://api.yourdomain.com',
  tenantApiKey: 'your_key',
  theme: {
    mode: 'dark',
    accentColor: '#7C3AED',          // Primary button & accent color
    accentTextColor: '#FFFFFF',       // Text color on accent buttons
    borderRadius: '8px',             // Border radius for cards & modals
    fontFamily: '"Inter", sans-serif',
    headingFontFamily: '"Playfair Display", serif',
    buttonOutlineColor: '#7C3AED',   // Outline on the split button
  },
});

Available Theme Options

| Property | Type | Default | Description | |----------|------|---------|-------------| | mode | 'dark' \| 'light' | 'dark' | Base color palette | | accentColor | CSS color | #adcfab (dark) / #4d7c4b (light) | Primary action color | | accentTextColor | CSS color | #193620 (dark) / #ffffff (light) | Text on accent buttons | | borderRadius | CSS value | 12px | Corner rounding for cards and modals | | fontFamily | CSS font stack | 'Manrope', system-ui, sans-serif | Body text font | | headingFontFamily | CSS font stack | 'Newsreader', serif | Heading font | | buttonOutlineColor | CSS color | transparent | Border color on the try-on button |

All UI is rendered inside a Shadow DOM, so your site's CSS will never leak into the widget and the widget will never break your styles.


Full Example

<!DOCTYPE html>
<html>
<head>
  <title>My Store</title>
  <script src="https://unpkg.com/@souldi/try-on/dist/widget.umd.js"></script>
</head>
<body>
  <div class="product-card">
    <img id="product-image" src="/images/jacket.jpg" alt="Jacket" />
    <h2>Classic Denim Jacket</h2>
    <p>$89.00</p>

    <!-- The try-on button renders here -->
    <div id="try-on-btn"></div>
  </div>

  <script>
    VirtualTryOn.init({
      apiBaseUrl: 'https://api.yourdomain.com',
      tenantApiKey: 'pk_live_abc123',
      theme: { mode: 'light', accentColor: '#2563EB' },
      onGenerationSuccess: (url) => {
        console.log('Try-on result:', url);
      },
      onError: (msg) => {
        console.error('Try-on error:', msg);
      },
    });

    VirtualTryOn.createButton({
      containerId: 'try-on-btn',
      garmentUrl: 'https://your-cdn.com/images/jacket-flat.png',
      targetImageId: 'product-image',
    });
  </script>
</body>
</html>

Keys & Authentication

| Key | Where to use | Purpose | |-----|-------------|---------| | Publishable API Key (tenantApiKey) | In your frontend code | Identifies your store — safe to expose in client-side code | | Secret API Key | Backend only, never in frontend | Used for server-to-server API calls (manage your account, view usage, etc.) |

Your API keys are available in your Souldi Dashboard. The publishable key is scoped to the domains you whitelist — it cannot be used from unauthorized origins.

Security note: The widget communicates exclusively with your Souldi API endpoint. No third-party services are contacted from the browser. All authentication, file uploads, and AI generation are handled server-side.


Browser Support

Works in all modern browsers:

  • Chrome 80+
  • Firefox 78+
  • Safari 14+
  • Edge 80+

License

UNLICENSED - Proprietary software. See your Souldi service agreement for usage terms.