# Zephr JS Client SDK

A JavaScript client SDK to handle Zephr features in the browser.

## Usage

### UMD Module

```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>
```

### Modern ES Module

```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
    }
  });
```

## Building and running on localhost

First install dependencies:

```sh
npm install
```

To develop locally run:

```sh
npm start
```

To create a build:

```sh
npm run build
```
