UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

35 lines 1.49 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.ActivityTemplateConverter = void 0; const templates_1 = require("../templates"); /** * Activity template converter that implements [Converter](xref:botbuilder-dialogs-declarative.Converter). */ class ActivityTemplateConverter { /** * Converts a template to one of the following classes [ActivityTemplate](xref:botbuilder-dialogs-adaptive.ActivityTemplate) | [StaticActivityTemplate](xref:botbuilder-dialogs-adaptive.Static.ActivityTemplate) * * @param value The template to evaluate to create the activity. * @returns A new instance that could be the following classes [ActivityTemplate](xref:botbuilder-dialogs-adaptive.ActivityTemplate) | [StaticActivityTemplate](xref:botbuilder-dialogs-adaptive.Static.ActivityTemplate). */ convert(value) { if (value instanceof templates_1.ActivityTemplate || value instanceof templates_1.StaticActivityTemplate) { return value; } if (typeof value === 'string') { return new templates_1.ActivityTemplate(value); } else { return new templates_1.StaticActivityTemplate(value); } } } exports.ActivityTemplateConverter = ActivityTemplateConverter; //# sourceMappingURL=activityTemplateConverter.js.map