UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

39 lines 1.45 kB
"use strict"; /** * @module botbuilder-dialogs-adaptive */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.HasPendingActionsFunction = void 0; const adaptive_expressions_1 = require("adaptive-expressions"); /** * Defines hasPendingActions() expression function. * The expression will return true if the current adaptive dialog has any pending actions. */ class HasPendingActionsFunction extends adaptive_expressions_1.ExpressionEvaluator { /** * Initializes a new instance of the [HasPendingActionsFunction](xref:botbuilder-dialogs-adaptive.HasPendingActionsFunction). */ constructor() { super(HasPendingActionsFunction.functionName, HasPendingActionsFunction.function, adaptive_expressions_1.ReturnType.Boolean); } static function(expression, state, _options) { const actions = state.getValue('dialog._adaptive.actions'); if (actions) { return { value: actions.length > 0, error: undefined, }; } return { value: false, error: undefined }; } } exports.HasPendingActionsFunction = HasPendingActionsFunction; /** * Function identifier name. */ HasPendingActionsFunction.functionName = 'hasPendingActions'; // `name` is reserved in JavaScript //# sourceMappingURL=hasPendingActionsFunction.js.map