Charles Browser SDK
The browser utility for working with the Charles API.
Usage
npm install @heycharles/browser-sdk
Features
Importing Library
You can import the generated bundle to use the whole library generated by this starter:
import * as charles from '@heycharles/browser-sdk'
charles.init({
universe: 'https://my-universe.hello-charles.com'
})
charles.auth.loginUsername({ username: 'client_account@client.com', password: 'xxxxxxxxxxx' })
charles.init({
universe: 'https://my-universe.hello-charles.com',
credentials: {
token: window.localStorage.getItem('charles-token')
},
user: window.localStorage.getItem('charles-user-uuid')
})
Additionally, you can import the transpiled modules from dist/lib
in case you have a modular library:
import Auth from '@heycharles/browser-sdk/dist/lib/Auth'
Development
npm t
: Runs test suite.npm start
: Run npm run build
in watch modenpm run test:watch
: Run test suite in interactive watch modenpm run test:prod
: Run linting and generate coveragenpm run build
: Generate bundles and typings, create docsnpm run lint
: Lints codenpm run commit
: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)
LICENSE
Apache-2.0