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

senangwebs-buy

v1.0.8

Published

Lightweight JavaScript library that that enables easy implementation of e-commerce functionality through HTML attributes

Downloads

534

Readme

SenangWebs Learn more at SenangWebs.com

SenangWebs Buy (SWB)

SenangWebs Buy (SWB) is a lightweight JavaScript library that enables easy implementation of e-commerce functionality through HTML attributes. Create a full shopping experience with WhatsApp checkout integration, product sorting, searching, and more - all with minimal setup.

Features

  • Easy HTML attribute-based configuration
  • Shopping cart with localStorage persistence
  • WhatsApp checkout integration
  • Product sorting and searching
  • Multiple currency support
  • Custom color theming
  • External product links
  • Customizable button text
  • Fully responsive design
  • No external dependencies

Installation

Using npm

npm install senangweb-buy

Using a CDN

Include SenangWebs Buy directly in your HTML file:

<script src="https://unpkg.com/senangweb-buy@latest/dist/swb.js"></script>

Usage

Basic Setup

<div data-swb-catalog 
     data-swb-store="Your Store Name" 
     data-swb-whatsapp="+1234567890"
     data-swb-currency="USD"
     data-swb-color-primary="#4F46E5"
     data-swb-color-secondary="#EF4444">
    
    <!-- Product Item -->
    <div data-swb-product
         data-swb-product-sku="PROD001"
         data-swb-product-name="Product Name"
         data-swb-product-price="99.99"
         data-swb-product-add-cart-title="Add to Cart"
         data-swb-product-link="https://example.com"
         data-swb-product-link-title="View Details">
        
        <div data-swb-product-image>
            <img src="product-image.jpg" alt="Product">
        </div>
        
        <div data-swb-product-name>
            <h3>Product Name</h3>
        </div>
        
        <div data-swb-product-price>
            $99.99
        </div>
        
        <div data-swb-product-buttons></div>
    </div>
</div>

Configuration Options

Catalog Attributes

| Attribute | Type | Description | Default | |-----------|------|-------------|---------| | data-swb-catalog | flag | Main container identifier | required | | data-swb-store | string | Store name for messages | required | | data-swb-whatsapp | string | WhatsApp number for checkout | required | | data-swb-currency | string | Currency code (USD, EUR, MYR, etc.) | USD | | data-swb-color-primary | string | Primary theme color (hex) | #007bff | | data-swb-color-secondary | string | Secondary theme color (hex) | #dc3545 | | data-swb-cart | boolean | Enable/disable cart functionality | true | | data-swb-cart-floating | flag | Show floating cart button | false |

Product Attributes

| Attribute | Type | Description | Default | |-----------|------|-------------|---------| | data-swb-product | flag | Product container identifier | required | | data-swb-product-sku | string | Product SKU/ID | required | | data-swb-product-name | string | Product name | required | | data-swb-product-price | number | Product price | required | | data-swb-product-link | string | External product link URL | optional | | data-swb-product-link-title | string | External link button text | "View Details" | | data-swb-product-add-cart-title | string | Add to cart button text | "Add to Cart" | | data-swb-product-buttons | flag | Container for product buttons | required |

Supported Currencies

The library supports multiple currencies including:

  • USD ($)
  • EUR (€)
  • GBP (£)
  • MYR (RM)
  • SGD (S$)
  • AUD (A$)
  • CAD (C$)
  • JPY (¥)
  • CNY (¥)
  • INR (₹)
  • And many more...

Features

Shopping Cart

  • Persists across page refreshes
  • Add/remove products
  • Update quantities
  • Clear all items
  • Shows total items and amount

Product Management

  • Search by name or SKU
  • Sort options:
    • Name (A to Z)
    • Name (Z to A)
    • Price (Low to High)
    • Price (High to Low)

Checkout Process

  1. Collects customer information:
    • Full Name
    • Email
    • Phone Number
    • Delivery Address
  2. Formats order details with currency
  3. Sends to WhatsApp for processing

Customization

  • Custom button text for each product
  • External link option per product
  • Cart toggle functionality
  • Color theme customization
  • Currency selection
  • Responsive design

Browser Support

Works on all modern browsers including:

  • Chrome
  • Firefox
  • Safari
  • Edge
  • Opera

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

  • Thanks to all contributors who have helped improve this library
  • Inspired by the need for simple, WhatsApp-based e-commerce solutions