/
types.ts
40 lines (32 loc) · 1.32 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { Asset, AssetWrapper, Expression } from '@player-ui/player';
import type { BeaconDataType } from '@player-ui/beacon-plugin';
/**
* User actions can be represented in several places.
* Each view typically has one or more actions that allow the user to navigate away from that view.
* In addition, several asset types can have actions that apply to that asset only.
*/
export interface ActionAsset<AnyTextAsset extends Asset = Asset>
extends Asset<'action'> {
/** The transition value of the action in the state machine */
value?: string;
/** A text-like asset for the action's label */
label?: AssetWrapper<AnyTextAsset>;
/** An optional expression to execute before transitioning */
exp?: Expression;
/** An optional string that describes the action for screen-readers */
accessibility?: string;
/** Additional optional data to assist with the action interactions on the page */
metaData?: {
/** Additional data to beacon */
beacon?: BeaconDataType;
/** Force transition to the next view without checking for validation */
skipValidation?: boolean;
/** string value to decide for the left anchor sign */
role?: string;
};
}
/** A stateful instance of an action */
export interface TransformedAction extends ActionAsset {
/** A method to execute the action */
run: () => void;
}