@tillhub/javascript-sdk
TypeScript icon, indicating that this package has built-in type declarations

4.133.1 • Public • Published

Tillhub JavaScript SDK CircleCI Greenkeeper badge

Usage

# Run npm install and write your library name when asked. That's all!
npm install @tillhub/javascript-sdk

Features

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import * as tillhub from '@tillhub/javascript-sdk'

// configure which API to use. E.g. you can also run staging and sandbox APIs
th.init({
  base: 'https://api.tillhub.com'
})

// use any authentication method that .auth provides
th.auth.loginUsername({ username: 'client_account@client.com', password: 'xxxxxxxxxxx' })

// or when already authenticated and rehydrating state you can immediately also hydrated an
// authenticated th client
th.init({
  base: 'https://api.tillhub.com',
  credentials: {
    token: window.localStorage.getItem('th-token')
  },
  user: window.localStorage.getItem('th-user-uuid')
})

Additionally, you can import the transpiled modules from dist/lib in case you have a modular library:

import Auth from '@tillhub/javascript-sdk/dist/lib/Auth'

Development

  • npm t: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run test:prod: Run linting and generate coverage
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run commit: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)

Utilities

TODO: The SDK will rely on inherited base handlers as utilities.

LICENSE

Apache-2.0

Readme

Keywords

none

Package Sidebar

Install

npm i @tillhub/javascript-sdk

Weekly Downloads

56

Version

4.133.1

License

Apache-2.0

Unpacked Size

2.64 MB

Total Files

493

Last publish

Collaborators

  • tillhub-engineering
  • eljefedelrodeo