Skip to content

External Action

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

Usage

Install the plugin:

Terminal window
npm i @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.