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

@vitraun/webar

v0.2.4

Published

Vitraun WebAR widget as Web Component

Readme

@vitraun/webar

Web Component package for Vitraun Virtual Try-On (<vitraun-vto>), distributed as npm + CDN bundle.

Install (npm)

npm i @vitraun/webar
import '@vitraun/webar'

// In React / TSX you can write `auto-open={true}` (no spread needed).
<vitraun-vto
  merchant-id="vtrn-mch-key-..."
  widget-id="vtrn-wdg-key-..."
  lang="en"
  auto-open
></vitraun-vto>

Try-On app origin (data-base-url) is baked into the published bundle from constants/default-widget-base-url.js (default dev app origin). Retailers do not need to set it. Use **data-base-url** only to override (staging, self-hosted). Rebuild with VITRAUN_WIDGET_EMBEDDED_BASE_URL=<origin> when the default dev host is wrong for your setup.

The widget script itself should be loaded from your CDN, from jsDelivr (mirror npm), or via import '@vitraun/webar' — not from the Try-On Next.js app.

jsDelivr (@vitraun/webar only)

After npm publish of @vitraun/webar, files under dist/ are available on jsDelivr (paths match the tarball):

https://cdn.jsdelivr.net/npm/@vitraun/webar@<version>/dist/widget.min.js
https://cdn.jsdelivr.net/npm/@vitraun/webar@<version>/dist/events.min.js

Example (<version> = published semver, e.g. 0.1.2):

<script src="https://cdn.jsdelivr.net/npm/@vitraun/[email protected]/dist/widget.min.js"></script>
<script type="module">
  import { subscribeVitraunVTOEvents } from 'https://cdn.jsdelivr.net/npm/@vitraun/[email protected]/dist/events.min.js'
</script>

The package.json field jsdelivr points to dist/widget.min.js so the default short URL https://cdn.jsdelivr.net/npm/@vitraun/webar resolves to the widget bundle when supported by jsDelivr.

Optional attribute **auto-open**: when present (or auto-open="true"), the element calls open() after it connects, so hosts do not need a useLayoutEffect or script callback.

Optional attribute **console**: when true, the widget shows an Events console button that opens a modal with captured Try-On events.

Events and logs helpers

The package exports helpers to capture widget events consistently:

import {
  VITRAUN_VTO_DEFAULT_EVENT_TYPES,
  subscribeVitraunVTOEvents,
} from '@vitraun/webar'

const dispose = subscribeVitraunVTOEvents(containerElement, (entry) => {
  console.log(entry.type, entry.timestamp, entry.detail)
})

// later:
dispose()

By default it listens to: addToCart, removeFromCart, redirectToCart, and analysisFinished. You can opt in to statusChange and vtoUsage using options, or pass a custom eventTypes list.

For React consumers, the package also provides a hook:

import { useVitraunVTOEventLogs } from '@vitraun/webar/react'

const { events, clearEvents } = useVitraunVTOEventLogs(containerRef.current)

Use via CDN (HTML puro)

Publish dist/widget.min.js and dist/widget-runtime.min.js to your CDN after each release (S3 + CloudFront, R2, etc.). This repo ships an AWS S3 helper that uses the AWS CLI:

npm run build
export VITRAUN_CDN_UPLOAD=1
export VITRAUN_CDN_S3_BUCKET=your-bucket-name
npm run deploy:cdn

See config/cdn-upload.env.example for all variables (optional root prefix, dry-run, region).

<script src="https://cdn.example.com/@vitraun/[email protected]/dist/widget.min.js"></script>
<vitraun-vto
  merchant-id="vtrn-mch-key-..."
  widget-id="vtrn-wdg-key-..."
  lang="en"
></vitraun-vto>
<script>
  document.querySelector('vitraun-vto')?.open()
</script>