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

shopbeam

v0.0.12

Published

shopbeam js client library

Downloads

1

Readme

shopbeam.js

[DRAFT PROPOSAL]

Shopbeam js client for 3rd parties.

Sites including shopbeam.js gain access to these shopbeam features:

  • universal cart
  • automatic product widgets (individual image, text)
  • create a custom inventory ui (eg. a Flash product carrousel)
  • convenient access to Shopbeam http API

Installation

<script src="www.shopbeam.com/js/v1/shopbeam.js"></script>

Cart

Loading shopbeam.js will automatically load the universal cart, and allow the user to add products in the current site. If the cart is not empty, it will become visible on the bottom-right corner.

To prevent the cart from loading automatically you can use a data attribute on the script tag:

<script src="www.shopbeam.com/js/v1/shopbeam.js" data-auto-cart="no"></script>

And load it at any time with:

shopbeam.cart();

Automatic Product Widgets

shopbeam js will automatically scan the document to create widgets on load, but scan can be triggered again (eg. if new content is loaded with ajax) using:

shopbeam.scan();

Declaration

Any link pointing to a shopbeam product will be converted into a shopbeam widget automatically.

  • If the link contains an image, video or any other "block" media or element, a translucent overlay will be shown on hover.
  • If the link contains just text, a popover will be shown on hover

in any case, clicking will open a modal with product details

Image

<a href="https://www.shopbeam.com/product/123456">
  <img src="<!-- product image -->" />
</a>

Note: no extra attributes are required (class, id, fixed width and height or data-*)

Note 2: video, canvas or div can be used instead of img

Text

hey, check
<a href="https://www.shopbeam.com/product/123456">this bag</a>
I found

Custom Product Widgets

In some cases publishers may want to create a custom ui for product inventory:

  • Silverlight product carrousel
  • Flash banners

For that purpose the shopbeam js client provides methods to obtain product info and communicate with the universal cart.


var product = shopbeam.product(123456);

product.info().then(function(info) {
  if (!info.outOfStock && confirm("would you be interested in a nice " +
    info.title +
    "at just $" + info.price + "?")) {
    // show product details and "add to cart" button
    product.show();
  }
}, function(err) {
  console.error('unable to get product info', err);
});