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 🙏

© 2024 – Pkg Stats / Ryan Hefner

meshkraft-vto

v2.2.18

Published

Meshkraft VTO SDK (Public)

Downloads

1,534

Readme

ART Labs Meshkraft Web Virtual Try-On SDK

VTO SDK is a web application for ART Labs Virtual Try-On Engine to enhance its capabilites for user interaction. This application introduces various concepts such as dynamic version management, multiple event handling, customization for customer requirements and many more.

Install

You'll need to paste script code before closing </body> tag of your web page.

<script
  type="module"
  src="https://unpkg.com/meshkraft-vto/dist/index.min.js"
  data-meshkraft-key="YOUR_API_KEY"
></script>

Make sure to replace YOUR_API_KEY with your application token.

Basic Usage

After you place the script above, all you need to do is adding any button, a, div or any other clickable HTML element to your website, with your own style. The SKU that specified in the element can be a comma separated list to show multiple shoes.

<button data-meshkraft-vto-sku="YOUR_SKU">View in AR</button>

That's it 🎉.

Config

You should pass a stringified JSON object to script tag via data-meshkraft-config attribute. Available options are:

showAction - Boolean. Should show action block or not. Default is false. actionButtonText - String. Title for the button. Default is Add to Cart. actionButtonEventName - String. Event name to listen on button click. Default is add-to-cart.

logoUrl - String. Logo URL to use in upper-right corner. Default is null. fontFamily - String. Font family name to use in SDK. Must be included in DOM. Default is Bebas Neue. qrPopupTitle - String. Text to use in Desktop QR popup title. Default is Scan QR Code. qrPopupSubtitle - String. Text to use in Desktop QR popup subtitle. Default is Point your mobile phone camera to the QR code below to experience Virtual Try-on.

<button
  data-meshkraft-vto-sku="Nike-Air-Max-90"
  data-meshkraft-vto-config='{"fontFamily":"Arial","qrPopupTitle":"Scan the Code","qrPopupSubtitle":"Scan the QR code below","logoUrl": "https://artlabs.ai/images/logo.svg", "showAction": true, "actionButtonText":"Add To Cart", "actionButtonEventName": "add-to-cart"}'
>
  Enter VTO
</button>

Events

There are two events that can be listened to. You can register an event listener to the window element via invoking the addEventListener method.

Added to Cart

When user clicks the Add to Cart button in AR banner, this event will be fired with SKU.

window.addEventListener('add-to-cart', (e) => {
  // Product added to cart
  console.log(e.detail.sku);
});

Error

When something goes wrong, this event will be fired with error message.

window.addEventListener('vto-error', (e) => {
  // VTO failed
  console.log(e.detail.message);
});

Full Example

<head>
  <script
    type="module"
    src="https://unpkg.com/meshkraft-vto/dist/index.min.js"
    data-meshkraft-key="YOUR_API_KEY"
  ></script>
</head>

<body>
  <button
    id="meshkraft-vto-button"
    data-meshkraft-vto-sku="Nike-Air-Max-90"
    data-meshkraft-vto-config='{"fontFamily":"Arial","qrPopupTitle":"Scan the Code","qrPopupSubtitle":"Scan the QR code below","logoUrl": "https://artlabs.ai/images/logo.svg", "showAction": true, "actionButtonText":"Add To Cart", "actionButtonEventName": "add-to-cart"}'
  >
    Enter VTO
  </button>
</body>

<script>
  window.addEventListener('add-to-cart', (e) => {
    console.log('Product added to cart :: ', e.detail.sku);
  });

  window.addEventListener('vto-error', (e) => {
    console.log('An error occured :: ', e.detail.message);
  });
</script>

Bundle Size

You will consuming minified and Gzipped or Brotli compressed version, depending on the browser.

┌─────────────────────────────────────────────┐
│                                             │
│   meshkraft-vto.min.js                      │
│   Bundle Size:  253.42 KB                   │
│   Gzipped Size: 77.24 KB                    │
│   Brotli size:  66.91 KB                    │
│                                             │
└─────────────────────────────────────────────┘

Initial bundle size is small but the essential parts of the VTO will be downloaded after user clicks to the button. The total size will be about 2MB to 10MB, depending on the 3D model.