@zephr/saas-client-sdk

1.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @zephr/saas-client-sdk

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

72.9 kB

Total Files

4

Last publish

Collaborators

  • ben-zephr