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

@ecomplus/storefront-app

v2.0.0-beta.203

Published

Vue.js ecommerce app with cart, checkout and account pages

Downloads

2,070

Readme

Storefront App

npm version License MIT

Vue 2 SPA with cart, checkout and account pages for E-Com Plus Storefront:

CHANGELOG

Installation

You can install the package and import raw source when using bundlers such as Webpack and Browserify, or load compiled from CNDs like jsDelivr or UNPKG.

It requires and doesn't include @ecomplus/utils (peer dependency), it should be used to declare store settings before starting the checkout SPA, check the following examples and edit $ecomConfig.set with your store values.

Component styles will be loaded on demand, but Storefront Twbs styles should be previously imported for base UI.

With bundlers

npm i --save @ecomplus/utils @ecomplus/storefront-app
// config.js
import { $ecomConfig } from '@ecomplus/utils'
$ecomConfig.set('store_id', 1011)
$ecomConfig.set('lang', 'pt_br')
$ecomConfig.set('currency', 'BRL')
$ecomConfig.set('country_code', 'BR')
// checkout.js
import './config.js'
import '@ecomplus/storefront-app/src/main'
@import "node_modules/@ecomplus/storefront-twbs/scss/styles";

CDN

Add the scripts below right before </body> on your cart/checkout page:

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/utils@1/dist/ecom-utils.polyfill.min.js"></script>
<script>
  $ecomConfig.set('store_id', 1011);
  $ecomConfig.set('lang', 'pt_br');
  $ecomConfig.set('currency', 'BRL');
  $ecomConfig.set('country_code', 'BR');
</script>
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@latest/dist/lib/js/app.js"></script>

And base UI styles before </head>:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-twbs@5/dist/storefront-twbs.min.css">

Usage

You just need to have a #storefront-app element on your HTML:

<body>
  <main>
    <div id="storefront-app"></div>
  </main>
  <!-- scripts -->
</body>

Sample JSFiddle

We recommend running the SPA at the /app/ route (eg.: /app/index.html).

Manipulating cart items

You can import @ecomplus/shopping-cart on other ecommerce pages to add items before redirecting user to cart:

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/shopping-cart@2/dist/ecom-cart.bundle.min.js"></script>
<script>
$('#buy-button').click(function () {
  // add item to cart
  ecomCart.addItem({
    product_id: '123a5432109876543210cdef',
    sku: 's-MP_2B4',
    name: 'Mens Pique Polo Shirt',
    quantity: 4,
    price: 42.9,
    picture: {
      normal: {
        url: 'https://samplecdn.x/mens-polo-350x350.webp'
      },
      zoom: {
        url: 'https://samplecdn.x/mens-polo.webp'
      }
    }
  });
  // redirect to checkout
  window.location.href = '/app/#/checkout';
})
</script>

For more details and examples, refer to EcomCart docs.

Manipulating customer account

Please refer to EcomPassport docs.