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

boundless-commerce-components

v2.0.3

Published

Components for E-commerce store: List of products, Individual product page, Thumbnail views, Cart helpers.

Downloads

50

Readme

Boundless Commerce Components

Components for E-commerce store: List of products, Individual product page, Thumbnail views, Cart helpers.

The components can be used with React or Next.js.

The library has 2 entry points:

  • General - import {Products, Product} from 'boundless-commerce-components'
  • Client - import {BoundlessCart} from 'boundless-commerce-components/dist/client'

The client entry point uses client's hooks (useEffect and so on) and in Next.JS v14 should be used with use client directive. Read more about Client components in Next.js

About Boundless Commerce

API’s First Headless E-commerce CMS: We Provide An Admin-Side For Store Management, Powerful API, And Ready-To-Use Checkout Area.

Self-Hosted solution

There is an option for Running Boundless-Commerce on your own server. Read more at Open-Source Headless eCommerce Platform

Installation

yarn add boundless-commerce-components

Or via NPM:

npm install boundless-commerce-components --save

Getting Started

List of products

Example of usage


import {Products, Product} from 'boundless-commerce-components';

<Products
	all={{gap: 10, perRow: 2}}
	lg={{gap: 30, perRow: 4}}
	xxl={{gap: 30, perRow: 6}}
>
	{products.map((product) =>
		<Product
			product={product}
			key={product.product_id}
			link={{component: Link, href: `/product/${product.url_key || product.product_id}`}}
			apiClient={apiClient}
			settings={settings}
		/>
	)}
</Products>

Products accepts all, sm, md, lg, xl, xxl to determine the number of products per row and the spacing between them.

Product view can be customized by redefining internal components:

<Product
	components={{
		image: <div>My own Img view</div>,
		title: <div>My own Title view</div>,
		price: <div>My own Price view</div>
	}}
/>

Cart

If you want to use cart hooks you need to wrap the application in BoundlessCart.

Example of usage

//if you are using NextJS - add client directive:
'use client';

import {BoundlessCart} from 'boundless-commerce-components/dist/client';

<BoundlessCart apiClient={apiClient}>
	{children}
</BoundlessCart>

The wrapper inits the context, retrieves cart_id from the server and saves it in Cookie.

Cart Hook

'use client';

import {useCart} from 'boundless-commerce-components/dist/client';

const {cartId, addToCart, total} = useCart();

Please see examples of usage:

Adding to cart

Cart Button

Cart Page

Customer Hook

'use client';

import {useCustomer} from 'boundless-commerce-components/dist/client';

const {customerAuthToken, setCustomerAuthToken, customer, setCustomer, login, logout, customerIsInited} = useCustomer();

Please see examples of usage:

Login Example

Free E-Commerce themes

Free E-Commerce Themes

Subscribe to my Youtube channel