@ecomplus/admin-helpers

DOM utils for E-Com Plus admin and related frontend apps

Usage no npm install needed!

<script type="module">
  import ecomplusAdminHelpers from 'https://cdn.skypack.dev/@ecomplus/admin-helpers';
</script>

README

E-Com Plus Admin Helpers

Publish CodeFactor npm version License AGPL

DOM utils for E-Com Plus admin and related frontend apps

CHANGELOG

Usage

npm i @ecomplus/admin-helpers

Example

import { i19savedWithSuccess } from '@ecomplus/i18n'
import { i18n } from '@ecomplus/utils'
import ecomAuth from '@ecomplus/auth'
import { toast, handleApiError } from '@ecomplus/admin-helpers'

ecomAuth.login(localStorage.getItem('username'), localStorage.getItem('password'))

ecomAuth.on('login', () => {
  ecomAuth.requestApi('stores/me', 'patch', {
    domain: 'www.mystoredomain.com'
  })
    .then(() => toast(i18n(i19savedWithSuccess)))
    .catch(handleApiError)
})

CDN

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/admin-helpers/dist/toast.var.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/admin-helpers/dist/handle-api-error.var.min.js"></script>
window.toast('Hello!')

External dependencies

It uses jQuery and Bootstrap 4 scripts (toast only).