# @pitcher/js-api

This is the JavaScript API to interact with the data layer of the NG platform.

## Usage

### In the browser

```html
<!doctype html>
<html>
  <head>
    <title>My app</title>
    <script src="https://cdn.jsdelivr.net/npm/@pitcher/js-api"></script>
    <!-- or for beta: -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/@pitcher/js-api@beta"></script> -->
  </head>
  <body>
    <script>
      const api = pitcher.usePitcherApi()
      const ui = pitcher.useUi()
      const admin = pitcher.useAdmin()

      api.getEnv()
      ui.selectContent()
      admin.getEnv()
    </script>
  </body>
</html>
```

For more details, please visit the [documentation](https://pitcherag.github.io/canvas-ui).

## Beta npm tag publish

1. Go to `canvas-ui` folder
2. Edit `src/assets/jsApiAssets/package.json` and change version in the file to beta eg. `1.0.0-beta.0`
3. Start console in `canvas-ui` folder
4. Run `yarn`
5. Run `yarn js-api:build`
6. Run `cd builds/js-api`
7. Run `npm publish --tag beta`
