Skip to Main Content
Player Logo
PlayerPlugins

External Action Plugin

The External Action Plugin is an easy way to handle External states from the navigation of a Player flow.

Usage

Install the plugin:
yarn add @player-ui/external-action-plugin
Create a handler for external actions:
import { ExternalStateHandler } from '@player-ui/external-action-plugin';

const externalActionHandler: ExternalStateHandler = async (state, options) => {
  if (state.ref === 'custom') {
    return 'next';
  }
}
Add it to Player:
import { Player } from '@player-ui/player';
import { ExternalActionPlugin } from '@player-ui/external-action-plugin';

const player = new Player({
  plugins: [
    new ExternalActionPlugin(externalActionHandler)
  ]
})
This will transition any EXTERNAL state in Player’s navigation, with a ref property of custom using the next transition.