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 🙏

© 2025 – Pkg Stats / Ryan Hefner

abcart-react

v1.0.0-alpha.5

Published

This repository holds the `abcart-react` SDK. It is build to work with the abcart service as provided by [abcart.io](https://www.abcart.io). The library provides a set of Higher Order Components that provide a full-featured cart, payments, & subscriptions

Readme

abcart-react

This repository holds the abcart-react SDK. It is build to work with the abcart service as provided by abcart.io. The library provides a set of Higher Order Components that provide a full-featured cart, payments, & subscriptions. The abcart service works with your Stripe account and eliminates the need for you to manage your own backend to interface with Stripe's apis.

The library's design is based on a redux style state store and actions that get dispatched. All your components that are using abcart-react state providers will receive updated props whenever the state changes from any action dispatched across your application.

Full documentation: abcart.io/documentation.

Example application: https://github.com/abcloudio/abcart-react-example

Installation

npm install -s react-cart

Quick Start
  • Sign-up for an account at abcart.io

  • Connect your Stripe account, from your abcart account dashboard.

  • Add products and subscriptions to your Stripe account that you would like to charge through the abcart service. https://www.abcart.io/documentation/working-with-products-and-skus-using-stripe
  • Get your apikey, appId, and secret from the abcart dashboard.

  • Create a JSON webtoken signed with your secret for each unique user to your website. This passes your users identity to the abcart service. This MUST be done in a secure environment, ideally on your server during each request. https://www.abcart.io/documentation/signing-json-web-tokens

import jwttoken from "jsonwebtoken";
const token = jwttoken.sign(
    {
        appId: "your-app-id",
        // continue sending the userId as it is linked to
        // cart items
        userId: "anonymous-user-id",

        // add loggedInUserId
        loggedInUserId: "your-users-id-from-your-system",

        // email will be associated with Stripe customer
        email: "customers-email",

        // optional, to enable test mode in your Stripe account
        // will work with Stripe test cards and save all data
        // to your Test dashboard in Stripe
        test: true
    },
    "your-secret-key",
    { issuer: "your-app-id" }
);
  • Wrap your React application in the AbcartProvider, passing it your apikey and the signed JWT you created on your server.
import React from "react";
import { AbcartProvider } from "abcart-react";

const JWT = localStorage.get("ABCART_JWT");
const App = () => (
    <AbcartProvider apikey="your-api-key" token={JWT}>
        <YourApp />
    </AbcartProvider>
);
  • Use this libraries Higher Order Components to provide your application with state and actions.

An example add to cart button.

import React from "react";
import { connectUpdateCartItem } from "abcart-react";

const AddToCart = ({ updateCartItem, sku, metadata }) => {
    return (
        <button onClick={() => updateCartItem({ sku, quantity: 1, metadata })}>
            Add To Cart
        </button>
    );
};
AddToCart.PropTypes = {
    sku: PropType.string,
    metadata: PropType.object
};

export default connectUpdateCartItem(AddToCart);

An example connecting to the shopping cart items.

import React from "react";
import { connectCartItems } from "abcart-react";

const ShoppingCart = ({ cartItems }) => {
    return (
        <div>
            {cartItems.map(item => (
                <div>
                    {item.sku} | {item.quantity} | {item.metadata.name}
                </div>
            ))}
        </div>
    );
};

export default connectCartItems(ShoppingCart);
For further examples and documentation see

Full documentation: abcart.io/documentation.

Example application: https://github.com/abcloudio/abcart-react-example

Development

Install dependencies

npm install

Run the tests

npm run test