@zephr/saas-client-sdk
Version:
Zephr JS Client SDK
67 lines (50 loc) • 1.26 kB
Markdown
A JavaScript client SDK to handle Zephr features in the browser.
```html
<script src="zephr-client-sdk.umd.js">
<script>
var instance = ZSClient.createInstance('ZEPHR_ORG_ID');
var jwt = '...'; // secure user jwt token
instance.startAccessController({ jwt: jwt })
.then(function () {
instance.isFeatureEnabled('featureFlag')
.then(function(isFeatureEnabled) {
if (isFeatureEnabled) {
// Handle user access to feature
} else {
// Handle feature rejection
}
});
});
</script>
```
```js
import * as ZephrClient from 'zephr-client-sdk.modern.js';
const instance = ZephrClient.createInstance('ZEPHR_ORG_ID');
const jwt = '...'; // secure user jwt token
instance.startAccessController({ jwt })
.then(async () => {
const isFeatureEnabled = await instance.isFeatureEnabled('featureFlag');
if (isFeatureEnabled) {
// Handle user access to feature
} else {
// Handle feature rejection
}
});
```
First install dependencies:
```sh
npm install
```
To develop locally run:
```sh
npm start
```
To create a build:
```sh
npm run build
```