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

shipped-suite-bigcommerce-react-client-sdk

v2.0.10

Published

Shipped Suite offers premium package assurance for shipments that are lost, damaged or stolen. Instantly track and resolve shipment issues hassle-free with the app.

Downloads

279

Readme

Shipped Suite Bigcommerce React Client SDK

Shipped Suite offers premium package assurance for shipments that are lost, damaged or stolen. Instantly track and resolve shipment issues hassle-free with the app.

Installation

NPM

npm install shipped-suite-bigcommerce-react-client-sdk

Yarn

yarn add shipped-suite-bigcommerce-react-client-sdk

Usage

  1. Import ShippedWidget and ShippedController react components into your project:
import { ShippedWidget, ShippedController } from 'shipped-suite-bigcommerce-react-client-sdk';
  1. Add <ShippedWidget /> component inside a <ShippedController /> component:
<ShippedController
  shippedConfig={{
    storeHash: 'your_store_hash',
  }}
  onInit={handleInit}
  onChange={handleChange}
  onProcessStart={handleProcessStart}
  onProcessEnd={handleProcessEnd}
  cartItems={cartItems}
  isCartEligible={isCartEligible}
/>
  <ShippedWidget />
</ShippedController>

If you need to add more than one <ShippedWidget /> element (for example, one for mobile cart and one for desktop cart), you need to ensure that all <ShippedWidget /> elements are wrapped within a single <ShippedController /> element instance.

  1. Configure component props:
  • shippedConfig is the object that allows widget configuration.

    • storeHash can be derived from your Bigcommerce store dashboard URL. For example, if your URL is https ://store-xxxxxxxxx.mybigcommerce.com/ then your_store_hash value is xxxxxxxxx.
  • onInit & onChange - optional. Since adding & removing Shipped product from cart is handled automatically by the widget, onChange could be useful for any other UI related adjustments. When a user opts in or opts out of Shipped Widget, or when the offer changes, onChange callback is triggered. You can provide a handler for this callback:

    const handleChange = (details) => {
      console.log(details);
    
      // Example 'details':
      // {
      //   "isSelected": true,
      //   "totalFee": "2.23",
      //   "shippedProducts": []
      // }
    };
  • onProcessStart & onProcessEnd - optional. The first one fires immediately before the Shipped widget starts any processes such as fetching cart information, retrieving Shipped offers, or mutating the cart. The second fires immediately afterward. These are useful for preventing the user from making any changes to the cart between these two events.

  • When cartItems value changes

    • the widget will automatically update its price
    • Shipped products in cart will also be automatically updated

    cartItems can be any object from your code that you would want the widget to react to. It could also be just a total price variable.

    IMPORTANT! cartItems must exclude Shipped product(s). The widget needs to react only to non-Shipped items. For example, if a new regular product is added to cart, we want the widget to react and update the Shipped price on the widget and also add the Shipped product to cart. But when the Shipped product itself is added to cart, we no longer want to update the Shipped price.

  • isCartEligible is a boolean that indicates whether or not the cart is eligible for Shipped widget. By default it's true, but if this is changed to false, the widget will no longer show and Shipped items will be removed from cart.