typings/lib2/messagev2/action/customEventAction.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomEventAction = void 0;
const internal_1 = require("../internal");
/**
 * Represents a postback action that invokes a custom event handler.
 * @extends Action
 */
class CustomEventAction extends internal_1.PostbackAction {
    /**
     * Creates an instance of CustomEventAction.
     * @param label - The label of the CustomEvent postback action.
     * @param event - The name of the event handler that should be invoked
     */
    constructor(label, event) {
        super(label, { 'action': 'system.customEvent', 'event': { 'name': event, 'properties': {} } });
    }
    /**
     * Adds a custom property.
     * @param name - The name of the property
     * @param value - The value of the property
     * @returns The current instance of the CustomEventAction class.
     */
    addCustomProperty(name, value) {
        this.getPostback().event.properties[name] = value;
        return this;
    }
}
exports.CustomEventAction = CustomEventAction;