UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

40 lines 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OnDialogEvent = void 0; /** * @module botbuilder-dialogs-adaptive */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ const adaptive_expressions_1 = require("adaptive-expressions"); const botbuilder_dialogs_1 = require("botbuilder-dialogs"); const onCondition_1 = require("./onCondition"); /** * Actions triggered when a dialog event is emitted. */ class OnDialogEvent extends onCondition_1.OnCondition { /** * Creates a new `OnDialogEvent` instance. * * @param event (Optional) The event to fire on. * @param actions (Optional) The actions to add to the plan when the rule constraints are met. * @param condition (Optional) The condition which needs to be met for the actions to be executed. */ constructor(event, actions = [], condition) { super(condition, actions); this.event = event; } /** * Create the expression for this condition. * * @returns [Expression](xref:adaptive-expressions.Expression) used to evaluate this rule. */ createExpression() { return adaptive_expressions_1.Expression.andExpression(adaptive_expressions_1.Expression.parse(`${botbuilder_dialogs_1.TurnPath.dialogEvent}.name == '${this.event}'`), super.createExpression()); } } exports.OnDialogEvent = OnDialogEvent; OnDialogEvent.$kind = 'Microsoft.OnDialogEvent'; //# sourceMappingURL=onDialogEvent.js.map