UNPKG

botbuilder-dialogs

Version:

A dialog stack based conversation manager for Microsoft BotBuilder.

93 lines 3.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getChannelId = exports.maxActionTitleLength = exports.hasMessageFeed = exports.supportsCardActions = exports.supportsSuggestedActions = void 0; /** * @module botbuilder-dialogs */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ const botbuilder_core_1 = require("botbuilder-core"); /** * @private * @param channelId the id of a channel * @param buttonCnt count of buttons allowed */ function supportsSuggestedActions(channelId, buttonCnt = 100) { switch (channelId) { case botbuilder_core_1.Channels.Facebook: case botbuilder_core_1.Channels.Skype: return buttonCnt <= 10; case botbuilder_core_1.Channels.Line: return buttonCnt <= 13; case botbuilder_core_1.Channels.Kik: return buttonCnt <= 20; case botbuilder_core_1.Channels.Telegram: case botbuilder_core_1.Channels.Emulator: case botbuilder_core_1.Channels.Directline: case botbuilder_core_1.Channels.Webchat: case botbuilder_core_1.Channels.DirectlineSpeech: return buttonCnt <= 100; default: return false; } } exports.supportsSuggestedActions = supportsSuggestedActions; /** * @private * @param channelId the id of a channel * @param buttonCnt count of buttons allowed */ function supportsCardActions(channelId, buttonCnt = 100) { switch (channelId) { case botbuilder_core_1.Channels.Facebook: case botbuilder_core_1.Channels.Skype: return buttonCnt <= 3; case botbuilder_core_1.Channels.Msteams: return buttonCnt <= 50; case botbuilder_core_1.Channels.Line: return buttonCnt <= 99; case botbuilder_core_1.Channels.Slack: case botbuilder_core_1.Channels.Telegram: case botbuilder_core_1.Channels.Emulator: case botbuilder_core_1.Channels.Directline: case botbuilder_core_1.Channels.DirectlineSpeech: case botbuilder_core_1.Channels.Webchat: return buttonCnt <= 100; default: return false; } } exports.supportsCardActions = supportsCardActions; /** * @private * @param _channelId id of a channel */ function hasMessageFeed(_channelId) { // The removed 'cortana' channel was the only channel that returned false. // This channel is no longer available for bot developers and was removed from // the Channels enum while addressing issue #3603. // Though it's marked as private in the docstring, the contents of channel.ts // are publically available but not documented in the official reference docs. // Thus, the method is retained. return true; } exports.hasMessageFeed = hasMessageFeed; /** * @private * @param _channelId id of a channel */ function maxActionTitleLength(_channelId) { return 20; } exports.maxActionTitleLength = maxActionTitleLength; /** * @private * @param context a TurnContext object representing an incoming message */ function getChannelId(context) { return context.activity.channelId || ''; } exports.getChannelId = getChannelId; //# sourceMappingURL=channel.js.map