@zephr/saas-client-sdk
v1.1.0
Published
Zephr JS Client SDK
Downloads
7
Readme
Zephr JS Client SDK
A JavaScript client SDK to handle Zephr features in the browser.
Usage
UMD Module
<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>
Modern ES Module
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
}
});
Building and running on localhost
First install dependencies:
npm install
To develop locally run:
npm start
To create a build:
npm run build