@bearer/js
The hassle-free way to use bearer's integrations into any web application
Getting started
Bearer lib can be used instantly in your page or with a package system.
Directly in your page
<script src="https://cdn.jsdelivr.net/npm/@bearer/js@beta5/lib/bearer.production.min.js"></script>
<script>
bearer('clientId')
</script>
With a build system
yarn add @bearer/js
npm install @bearer/js
In your app
import bearer from '@bearer/js'
class MyApp {
componentDidMount() {
bearer('clientId')
}
}
Usage
i18n
@bearer/js
comes with an i18n module that let you deal with internationalization of Bearer's integrations
bearer.i18n.locale
Lets you change the locale
bearer.i18n.locale = 'es'
bearer.i18n.load
Lets you load custom translation for integrations
const dictionnary = { titles: { welcome: 'Ola!' } }
bearer.i18n.load('integration-uuid', dictionnary)
const promiseReturningADictionnary = Promise.new((resolve, reject) => {
resolve({ titles: { welcome: 'Ola!' } })
})
bearer.i18n.load('integration-uuid', promiseReturningADictionnary)
const dictionnary = { titles: { welcome: 'Guten Morgen' } }
bearer.i18n.load('integration-uuid', dictionnary, { locale: 'de' })
const dictionnary = {
['integration-one-uuid']: { title: { welcome: 'Hello my friend' } },
['integration-two-uuid']: { message: { goodbye: 'Bye Bye' } }
}
bearer.i18n.load(null, dictionnary)
init options
Soon