# Poductivity SDK - JavaScript

![Tests](https://github.com/CaptivateAudio/poductivity-sdk-js/workflows/Tests/badge.svg)

## Installation

### Simple: From CDN
Include the below script tags in the `<head>` section of your web page.
The HTML tags `<poductivity-player>` and `<poductivity-client>` will be instantly ready to use in your application.

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@poductivity/poductivity-sdk-js@0/dist/poductivity-sdk-js/poductivity-sdk-js.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@poductivity/poductivity-sdk-js@0/dist/poductivity-sdk-js/poductivity-sdk-js.js"></script>
```

### Advanced: From npm
Install via NPM: 
```sh
npm install --save @poductivity/poductivity-sdk-js
```

Apply polyfills as necessary and register the custom elements:
(The call to applyPolyfills is optional)
```js
import { applyPolyfills, defineCustomElements } from '@poductivity/poductivity-sdk-js/loader';
applyPolyfills().then(() => {
  defineCustomElements();
});
```

If using a framework such as Angular/React/Vue, you may have to register the components with the framework. Please see [here](https://stenciljs.com/docs/react) for details.

---
## Usage

### [Poductivity Embed Player](/src/components/pd-player/readme.md)
A HTML embeddable podcast player with Poductivity interaction. [Read documentation](/src/components/pd-player/readme.md)

### [Poductivity Client](/src/components/pd-client/readme.md)
Add Poductivity interaction to your own podcast player. [Read documentation](/src/components/pd-client/readme.md)

---
## Development
- Run `npm install`
- Run `npm start` - default host is at localhost:3333
- Run tests with `npm run test` or `npm test.watch`
- Run linter with `npm run lint`

### Releasing
- Increment the version with `npm version patch|minor|major`
- Run `npm publish`. If lint or tests fail, will not publish.