Action handlers

ActionHandler

An array of actions, where each action includes:

  • actionId: The type of action, as an ActionHandlerId value ('addCustomActionButton' or 'addFollowButton').
  • options: Defines properties based on the type of action handler.
export type ActionHandler = {
  actionId: `${ActionHandlerId}`;
  options: CustomActionButtonOptions | FollowButtonOptions;
};

export type CustomActionButtonOptions = {
  id: string;
  buttonName: string;
  onClick: (e: MouseEvent | Event, data: ContentEntities | null) => void;
};

export type FollowButtonOptions = {
  onClick: (e: MouseEvent | Event, data: FollowingSharedContext) => void;
};
PropertyTypeDescription
ActionHandlerObjectRepresents an action handler.
actionIdActionHandlerIdThe type of action. One of the ActionHandlerId values.
optionsCustomActionButtonOptions | FollowButtonOptionsDefines action handler properties.
CustomActionButtonOptionsObjectConfiguration for the action button.
idstringRequired. Stable identifier for the button, used to group its analytics.
buttonNamestringThe label displayed on the button.
onClick(e: MouseEvent | Event, data: ContentEntities | null) => voidCallback function triggered when the button is clicked.
FollowButtonOptionsObjectConfiguration for the follow button.
onClick(e: MouseEvent | Event, data: FollowingSharedContext) => voidCallback function triggered when the follow button is clicked.
ActionHandlerIdEnumPredefined action identifiers.
AddCustomActionButton'addCustomActionButton'Represents an action to add a custom button.
AddFollowButton'addFollowButton'Represents an action to add a follow button. Currently supported only for moments.

Pass actionHandlers as part of IWidgetViewOptions when you create a widget, or to playContent. See BlazeSDK class.


Did this page help you?