JSPM

  • Created
  • Published
  • Downloads 218
  • Score
    100M100P100Q94483F
  • License MIT

Handle customer authentication with E-Com Plus Passport

Package Exports

  • @ecomplus/passport-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ecomplus/passport-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ecomplus-passport-client

CodeFactor npm version license mit

Handle customer authentication with E-Com Plus Passport

Changelog

Usage

The @ecomplus/passport-client package can be used to handle login and persist/manipulate customer account data trough E-Com Plus Passport and Store APIs.

It's available for both Node.js and browser environments.

Example

import ecomPassport from '@ecomplus/passport-client'

ecomPassport.fetchLogin(localStorage.getItem('email'), localStorage.getItem('doc_number'))

ecomPassport.on('logout', () => {
  console.log('User logged OUT')
})

ecomPassport.on('login', () => {
  console.log('User logged IN', ecomPassport.getCustomer())
  ecomPassport.fetchOrdersList()
    .then(orders => {
      console.log('Listing customer orders', orders)
    })
})

Dependencies

It requires and may not include:

Node.js

npm i --save @ecomplus/utils @ecomplus/passport-client

Webpack

npm i --save core-js @ecomplus/utils @ecomplus/passport-client

CDN

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/passport-client/dist/ecom-passport.var.min.js"></script>

EventEmitter3, ecomUtils and ecomClient libraries must be included separately and available on window scope.