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

@sledge-app/kubinashi

v0.0.1

Published

JavaScript Library to work with Shopify Headless Cart

Downloads

3

Readme

Kubinashi

A JavaScript library to work with Shopify Headless Cart. Work with Shopify Storefront in any platform (Webflow, Framer, etc.).

Kubinashi (Kubi Nashi) is a latin version of Japanese 首なし which mean headless.

Demo Screenshots :

| Main Page | Flyout Cart | | ------------- |----------------| | Main | Flyout |

Development

  1. npm install
  2. npm run dev

Installation (Still WIP not usable)

npm install @sledge-app/kubinashi

OR using dist

<script src="https://cdn.jsdelivr.net/npm/@sledge-app/kubinashi@latest/dist/kubinashi.min.js" />

API

Getting Started

Setup Cart

const cart = new Cart({
  'storeUrl' : 'https://URL.myshopify.com', 
  'storefrontPublicToken' : 'STOREFRONT_PUBLIC_TOKEN',
  'apiVersion' : '2023-07'
})

Init Cart

await cart.init()

Get Cart

let response = await cart.get()

console.log( 'cart.get() ', response )

Clear Cart

let clear = await cart.clear()

console.log( 'cart.clear()', clear )

Add item to Cart

let add = await cart.add([
  { 
    id : VARIANT_ID, 
    quantity: 3,
    attributes: [
      { key: 'engrave_front', value: 'Your Name' },
      { key: 'engrave_back', value: 'Your Initial' }
    ]
  },
  { id : VARIANT_ID, quantity: 1 }
])

console.log( 'cart.add()', add )

Update item from Cart

let update = await cart.update([
  { 
    id : 'LINE_ITEM_ID', 
    quantity: 3,
    attributes: [
      { key: 'engrave', value: 'Your Name' }
    ]
  },
  { id : 'LINE_ITEM_ID', quantity: 1 }
])

console.log( 'cart.update()', update )

Remove item from Cart

Remove Multiple items : cart.remove( [ 'LINE_ITEM_ID', 'LINE_ITEM_ID' ] )

Remove Single item : cart.remove( 'LINE_ITEM_ID' )

let remove = await cart.remove( 'LINE_ITEM_ID' )

console.log( 'cart.remove()', remove )

Apply discount codes to Cart

Set Multiple discount codes : cart.applyDiscount( [ 'DISCOUNT_CODE_1', 'DISCOUNT_CODE_2' ] )

Set Single discount code : cart.applyDiscount( 'DISCOUNT_CODE_1' )

let applyDiscount = await cart.applyDiscount( [ 'DISCOUNT_CODE_1', 'DISCOUNT_CODE_2' ] )

console.log( 'cart.applyDiscount()', applyDiscount )

Clear discount codes from Cart

let clearDiscount = await cart.clearDiscount()

console.log( 'cart.clearDiscount()', clearDiscount )

Set Cart attributes

let setAttributes = await cart.setAttributes([
  { key: 'sample', value: 'sample juga' }, 
  { key: 'sample3', value: '3sample juga' }
])

console.log( 'cart.setAttributes()', setAttributes )

Get Cart attributes

Get Multiple attributes : cart.getAttributes( [ 'key1', 'key2' ] )

Get Single attribute : cart.getAttributes( 'key1' )

let getAttributes = await cart.getAttributes( 'sample' )

console.log( 'cart.getAttributes()', getAttributes )

Clear Cart attributes

let clearAttributes = await cart.clearAttributes()

console.log( 'cart.clearAttributes()', clearAttributes )

Set Cart note

let setNote = await cart.setNote( 'Coba cart note baru' )

console.log( 'cart.setNote()', setNote )

Get Cart note

let getNote = await cart.getNote()

console.log( 'cart.getNote()', getNote )

Clear Cart note

let clearNote = await cart.clearNote()

console.log( 'cart.clearNote()', clearNote )