Skip to content

Commit

Permalink
Updated documentation for plugins that have moved to the metrological…
Browse files Browse the repository at this point in the history
…-sdk.
  • Loading branch information
michielvandergeest committed Aug 22, 2022
1 parent ecadc01 commit 722ccd0
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 1,308 deletions.
1 change: 0 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- [Log](/plugins/log.md)
- [Metadata](/plugins/metadata.md)
- [Metrics](/plugins/metrics.md)
- [Metadata](/plugins/metadata.md)
- [Profile](/plugins/profile.md)
- [Purchase](/plugins/purchase.md)
- [Language](/plugins/language.md)
Expand Down
72 changes: 1 addition & 71 deletions docs/plugins/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,4 @@ If you create an App, you store the App's *metadata* (such as its name, version

The Metadata plugin enables you to use this metadata in your App. (For example, if you want to show the App's version number in an *About* window.)

> If you deploy your App to the Metrological Store, the metadata is 'injected' into the App by the Metrological Store.
## Usage

If you want to access metadata in your App code directly, import the *Metadata* plugin from the Lightning SDK:

```js
import { Metadata } from '@lightningjs/sdk'
```

The SDK automatically creates the `appMetadata` from the Launch params.

## Available methods

### Get

Returns the key value of the metadata.

```js
Metadata.get(key, [fallback])
```
Key can be either `icon`, `id`, `safeId`, `version`, `name`, `description`, `type`, `url` or `artwork` .
Optionally you can specify a `fallback`-value for when the Metadata is not defined.

### AppId

Gets Application id from Metadata

```js
Metadata.appId()
```

### SafeAppId

Returns the *safe ID* of your App. This is actually the `AppId` without dots (and any other special characters) which are are not permitted in JS variables.

```js
Metadata.safeAppId()
```

### AppName

Returns the name of your App.

```js
Metadata.appName()
```

### AppVersion

Returns the version of your App (without the GIT commit hash).

```js
Metadata.appVersion()
```

### AppIcon

Returns the icon of your App.

```js
Metadata.appIcon()
```

### AppFullVersion

Returns the full version of your App.

```js
Metadata.appFullVersion()
```
> Starting <i>v5.0.0</i> and up, the Metadata plugin is part of the <b>metrological-sdk</b>.<br /><br />For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained <a href="https://github.com/Metrological/metrological-sdk" target="_blank">here</a>. More information on how to use this plugin can be found <a href="https://github.com/Metrological/metrological-sdk/blob/master/docs/plugins/metadata.md" target="_blank">here</a>.
148 changes: 1 addition & 147 deletions docs/plugins/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,150 +4,4 @@ It is important to know how people use Apps. We can acquire this information by

Because each operator might implement these tracking metrics in a different way, the Lightning SDK provides the *Metrics* plugin. This plugin is a *generic* interface for developers, independent of any operator or platform.

Some *standard* metrics are automatically implemented by the SDK, such as App Launch, App Loaded, App Close and various video-related [media](#media) events.

You can implement additional metrics in your App. For example, when the App is 'Ready to use', or specific user interactions like 'Clicking on a button'.

There are four event-related categories for sending metrics:

* App
* Page
* User
* Media

## Usage

Import the Metrics plugin in components where you want to track and send events:

```js
import { Metrics } from '@lightningjs/sdk'
```

## Available Methods

### App.launch

Sends a metric that the App is launched (implemented automatically by the SDK).

```js
Metrics.App.launch()
```

### App.loaded

Sends a metric that the App is loaded (implemented automatically by the SDK).

```js
Metrics.App.loaded()
```

### App.ready

Sends a metric that the App is ready to be used.

```js
Metrics.App.ready()
```

### App.close

Sends a metric that the App is closed (implemented automatically by the SDK).

```js
Metrics.App.close()
```

### App.error

Sends a metric that an error has occurred in the App.

```js
Metrics.App.error(message, code, params)
```

### App.event

Sends a custom metric that is related to an App event.

```js
Metrics.App.event(name, params)
```

### Page.view

Sends a metric that a page has been viewed.

```js
Metrics.page.view(name, params)
```

### Page.leave

Sends a metric that a page has been left.

```js
Metrics.page.leave(name, params)
```

### Page.error

Sends a metric that an error has occurred when accessing a page.

```js
Metrics.page.error(message, code, params)
```

### Page.event

Sends a custom metric that is related to a Page event.

```js
Metrics.page.event(name, params)
```

### User.click

Sends a metric that a user has clicked on an element.

```js
Metrics.user.click(name, params)
```

### User.input

Sends a metric that a user has supplied input.

```js
Metrics.user.input(name, params)
```

### User.error

Sends a metric that an error has occurred that is related to a User event.

```js
Metrics.user.error(message, code, params)
```

### User.event

Sends a custom metric that is related to a User event.

```js
Metrics.user.event(name, params)
```

### Media

The [VideoPlayer](videoplayer.md) plugin automatically tracks and sends video-related metrics. Each metric receives the URL and progress of the current video. The Media events that are sent as metrics are:

* Media Abort
* Media CanPlay
* Media Ended
* Media Pause
* Media Play
* Media Suspend
* Media VolumeChange
* Media Waiting
* Media Seeking
* Media Seeked
> Starting <i>v5.0.0</i> and up, the Metrics plugin is part of the <b>metrological-sdk</b>.<br /><br />For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained <a href="https://github.com/Metrological/metrological-sdk" target="_blank">here</a>. More information on how to use this plugin can be found <a href="https://github.com/Metrological/metrological-sdk/blob/master/docs/plugins/metrics.md" target="_blank">here</a>.
79 changes: 1 addition & 78 deletions docs/plugins/pin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,4 @@ You can use the interface to check the middleware layer for the current state of

Depending on the state of the STB, you can use the Pin plugin to lock certain content or screens in your App.

## Usage

If you want to use the Pin plugin, import it from the Lightning SDK:

```js
import { Pin } from '@lightningjs/sdk'
```

## Available Methods

### show

Shows a standard, built-in **Pin** dialog where the user can supply a Pin code.

```js
Pin.show()
```

### hide

Hides the visible **Pin** dialog.

```js
Pin.hide()
```

### submit

Sends a Pin code to the middleware layer for verification. If the code is correct, the STB will be unlocked.

The `submit` method accepts `pin` and `context` as it's arguments. The context argument indicates in with what purpsose the Pin dialog is being used. The accepted values van be either `parental` or `purchase`. `context` defaults to `purchase`, but it's recommended to explicitly specify the context

The `submit` method is automatically invoked when you are using the built-in **Pin** dialog. Use this method for sending the Pin code *only* if you are making a fully custom **Pin** dialog in your App.

```js
Pin.submit('0000', context)
.then(() => console.log('Unlocked!'))
.catch(e => console.log('Pin error', e))
```

The `submit` method returns a *Promise*. If the supplied Pin code is correct (and context is valid), the Promise resolves with `true` and the STB will be unlocked. If the Pin code or context are wrong, the Promise resolves with `false`.

If the middleware is unable to unlock the STB, the Promise is *rejected* (with an optional error message).

During development, the default Pin code is `0000`. Optionally, you can overwrite the default Pin code during development by editing the **settings.json** file and adding the key `pin` as a Platform Setting with a different valid Pin code.

### unlocked

Checks if the STB is currently *unlocked*.

```js
Pin.unlocked(context)
.then(
unlocked => unlocked === true ?
console.log('STB is unlocked') :
console.log('STB is locked'))
```

The `unlocked` method returns a *Promise* which resolves with `true` if the device is *unlocked*, or with `false` if the device is *locked*.

If the middleware is unable to retrieve the current state, the Promise is *rejected*.

### locked

Checks if the STB is currently *locked*.

```js
Pin.locked(context)
.then(
locked => locked === true ?
console.log('STB is locked') :
console.log('STB is unlocked'))
```

The `locked` method is the *exact* counterpart of the `unlocked` method. It returns a *Promise* which resolves to `true` if
the device is *locked* or to `false` if the device is *unlocked*.

If the middleware is unable to retrieve the current state, the Promise is *rejected*.
> Starting <i>v5.0.0</i> and up, the Pin plugin is part of the <b>metrological-sdk</b>.<br /><br />For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained <a href="https://github.com/Metrological/metrological-sdk" target="_blank">here</a>. More information on how to use this plugin can be found <a href="https://github.com/Metrological/metrological-sdk/blob/master/docs/plugins/pin.md" target="_blank">here</a>.
Loading

0 comments on commit 722ccd0

Please sign in to comment.