@microsoft/teams.cards
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=c
1,763 lines (1,762 loc) • 314 kB
JavaScript
'use strict';
function isAdaptiveCard(value) {
const obj = value;
return typeof obj === "object" && obj.type === "AdaptiveCard";
}
class AdaptiveCard {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **AdaptiveCard**.
*/
type = "AdaptiveCard";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The locale associated with the element.
*/
lang;
/**
* Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.
*/
isSortKey = false;
/**
* An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported.
*/
selectAction;
/**
* The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met.
*/
style;
/**
* The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details.
*/
layouts;
/**
* The minimum height, in pixels, of the container, in the `<number>px` format.
*/
minHeight;
/**
* Defines the container's background image.
*/
backgroundImage;
/**
* Controls how the container's content should be vertically aligned.
*/
verticalContentAlignment;
/**
* Controls if the content of the card is to be rendered left-to-right or right-to-left.
*/
rtl;
/**
* A URL to the Adaptive Card schema the card is authored against.
*/
$schema;
/**
* The Adaptive Card schema version the card is authored against.
*/
version = "1.5";
/**
* The text that should be displayed if the client is not able to render the card.
*/
fallbackText;
/**
* The text that should be spoken for the entire card.
*/
speak;
/**
* Defines how the card can be refreshed by making a request to the target Bot.
*/
refresh;
/**
* Defines authentication information to enable on-behalf-of single-sign-on or just-in-time OAuth. This information is used in conjunction with the refresh property and Action.Execute in general.
*/
authentication;
/**
* Teams-specific metadata associated with the card.
*/
msteams;
/**
* Metadata associated with the card.
*/
metadata;
/**
* Resources card elements can reference.
*/
resources;
/**
* The area of a Layout.AreaGrid layout in which an element should be displayed.
*/
"grid.area";
/**
* An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
/**
* The body of the card, comprised of a list of elements displayed according to the layouts property. If the layouts property is not specified, a Layout.Stack is used.
*/
body;
/**
* The card level actions, which always appear at the bottom of the card.
*/
actions;
constructor(...body) {
this.body = body;
}
withOptions(value) {
Object.assign(this, value);
return this;
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withLang(lang) {
this.lang = lang;
return this;
}
withIsSortKey(isSortKey = true) {
this.isSortKey = isSortKey;
return this;
}
withSelectAction(selectAction) {
this.selectAction = selectAction;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withLayouts(...layouts) {
this.layouts = layouts;
return this;
}
withMinHeight(minHeight) {
this.minHeight = minHeight;
return this;
}
withBackgroundImage(backgroundImage) {
this.backgroundImage = backgroundImage;
return this;
}
withVerticalContentAlignment(verticalContentAlignment) {
this.verticalContentAlignment = verticalContentAlignment;
return this;
}
withRtl(rtl) {
this.rtl = rtl;
return this;
}
with$schema($schema) {
this.$schema = $schema;
return this;
}
withVersion(version) {
this.version = version;
return this;
}
withFallbackText(fallbackText) {
this.fallbackText = fallbackText;
return this;
}
withSpeak(speak) {
this.speak = speak;
return this;
}
withRefresh(refresh) {
this.refresh = refresh;
return this;
}
withAuthentication(authentication) {
this.authentication = authentication;
return this;
}
withMsteams(msteams) {
this.msteams = msteams;
return this;
}
withMetadata(metadata) {
this.metadata = metadata;
return this;
}
withResources(resources) {
this.resources = resources;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
withBody(...body) {
this.body = body;
return this;
}
withActions(...actions) {
this.actions = actions;
return this;
}
}
class HostCapabilities {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new HostCapabilities(options);
}
}
function isExecuteAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.Execute";
}
class ExecuteAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.Execute**.
*/
type = "Action.Execute";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The data to send to the Bot when the action is executed. When expressed as an object, `data` is sent back to the Bot when the action is executed, adorned with the values of the inputs expressed as key/value pairs, where the key is the Id of the input. If `data` is expressed as a string, input values are not sent to the Bot.
*/
data;
/**
* The Ids of the inputs associated with the Action.Submit. When the action is executed, the values of the associated inputs are sent to the Bot. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details.
*/
associatedInputs;
/**
* Controls if the action is enabled only if at least one required input has been filled by the user.
*/
conditionallyEnabled = false;
/**
* The verb of the action.
*/
verb;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new ExecuteAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withData(data) {
this.data = data;
return this;
}
withAssociatedInputs(associatedInputs) {
this.associatedInputs = associatedInputs;
return this;
}
withConditionallyEnabled(conditionallyEnabled = true) {
this.conditionallyEnabled = conditionallyEnabled;
return this;
}
withVerb(verb) {
this.verb = verb;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isInsertImageAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.InsertImage";
}
class InsertImageAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.InsertImage**.
*/
type = "Action.InsertImage";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The URL of the image to insert.
*/
url;
/**
* The alternate text for the image.
*/
altText;
/**
* The position at which to insert the image.
*/
insertPosition = "Selection";
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new InsertImageAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withUrl(url) {
this.url = url;
return this;
}
withAltText(altText) {
this.altText = altText;
return this;
}
withInsertPosition(insertPosition) {
this.insertPosition = insertPosition;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isOpenUrlAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.OpenUrl";
}
class OpenUrlAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.OpenUrl**.
*/
type = "Action.OpenUrl";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The URL to open.
*/
url;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(url, options = {}) {
Object.assign(this, options);
this.url = url;
}
static from(options) {
return new OpenUrlAction(options.url, options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withUrl(url) {
this.url = url;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isOpenUrlDialogAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.OpenUrlDialog";
}
class OpenUrlDialogAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.OpenUrlDialog**.
*/
type = "Action.OpenUrlDialog";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The title of the dialog to be displayed in the dialog header.
*/
dialogTitle;
/**
* The height of the dialog. To define height as a number of pixels, use the <number>px format.
*/
dialogHeight;
/**
* The width of the dialog. To define width as a number of pixels, use the <number>px format.
*/
dialogWidth;
/**
* The URL to open.
*/
url;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new OpenUrlDialogAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withDialogTitle(dialogTitle) {
this.dialogTitle = dialogTitle;
return this;
}
withDialogHeight(dialogHeight) {
this.dialogHeight = dialogHeight;
return this;
}
withDialogWidth(dialogWidth) {
this.dialogWidth = dialogWidth;
return this;
}
withUrl(url) {
this.url = url;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isResetInputsAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.ResetInputs";
}
class ResetInputsAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.ResetInputs**.
*/
type = "Action.ResetInputs";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The Ids of the inputs that should be reset.
*/
targetInputIds;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new ResetInputsAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withTargetInputIds(...targetInputIds) {
this.targetInputIds = targetInputIds;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isSubmitAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.Submit";
}
class SubmitAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.Submit**.
*/
type = "Action.Submit";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The data to send to the Bot when the action is executed. When expressed as an object, `data` is sent back to the Bot when the action is executed, adorned with the values of the inputs expressed as key/value pairs, where the key is the Id of the input. If `data` is expressed as a string, input values are not sent to the Bot.
*/
data;
/**
* The Ids of the inputs associated with the Action.Submit. When the action is executed, the values of the associated inputs are sent to the Bot. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details.
*/
associatedInputs;
/**
* Controls if the action is enabled only if at least one required input has been filled by the user.
*/
conditionallyEnabled = false;
/**
* Teams-specific metadata associated with the action.
*/
msteams;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new SubmitAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withData(data) {
this.data = data;
return this;
}
withAssociatedInputs(associatedInputs) {
this.associatedInputs = associatedInputs;
return this;
}
withConditionallyEnabled(conditionallyEnabled = true) {
this.conditionallyEnabled = conditionallyEnabled;
return this;
}
withMsteams(msteams) {
this.msteams = msteams;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isToggleVisibilityAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.ToggleVisibility";
}
class ToggleVisibilityAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.ToggleVisibility**.
*/
type = "Action.ToggleVisibility";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The Ids of the elements to toggle the visibility of.
*/
targetElements;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new ToggleVisibilityAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withTargetElements(...targetElements) {
this.targetElements = targetElements;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
class ThemedUrl {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* The theme this URL applies to.
*/
theme = "Light";
/**
* The URL to use for the associated theme.
*/
url;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new ThemedUrl(options);
}
withKey(key) {
this.key = key;
return this;
}
withTheme(theme) {
this.theme = theme;
return this;
}
withUrl(url) {
this.url = url;
return this;
}
}
class TargetElement {
/**
* The Id of the element to change the visibility of.
*/
elementId;
/**
* The new visibility state of the element.
*/
isVisible;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new TargetElement(options);
}
withElementId(elementId) {
this.elementId = elementId;
return this;
}
withIsVisible(isVisible) {
this.isVisible = isVisible;
return this;
}
}
function isShowCardAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.ShowCard";
}
class ShowCardAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.ShowCard**.
*/
type = "Action.ShowCard";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* The actions to display in the overflow menu of a Split action button.
*/
menuActions;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
/**
* The card that should be displayed when the action is executed.
*/
card;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new ShowCardAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withMenuActions(...menuActions) {
this.menuActions = menuActions;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
withCard(card) {
this.card = card;
return this;
}
}
function isPopoverAction(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Action.Popover";
}
class PopoverAction {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Action.Popover**.
*/
type = "Action.Popover";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The title of the action, as it appears on buttons.
*/
title;
/**
* A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title.
*
* `iconUrl` also accepts the `<icon-name>[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image.
*/
iconUrl;
/**
* Control the style of the action, affecting its visual and spoken representations.
*/
style = "default";
/**
* Controls if the action is primary or secondary. Secondary actions appear in an overflow menu.
*/
mode = "primary";
/**
* The tooltip text to display when the action is hovered over.
*/
tooltip;
/**
* Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state.
*/
isEnabled = true;
/**
* A set of theme-specific icon URLs.
*/
themedIconUrls;
/**
* The content of the popover, which can be any element.
*/
content;
/**
* Controls if an arrow should be displayed towards the element that triggered the popover.
*/
displayArrow = true;
/**
* Controls where the popover should be displayed with regards to the element that triggered it.
*/
position = "Above";
/**
* The maximum width of the popover in pixels, in the `<number>px` format
*/
maxPopoverWidth;
/**
* An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
constructor(options = {}) {
Object.assign(this, options);
}
static from(options) {
return new PopoverAction(options);
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withTitle(title) {
this.title = title;
return this;
}
withIconUrl(iconUrl) {
this.iconUrl = iconUrl;
return this;
}
withStyle(style) {
this.style = style;
return this;
}
withMode(mode) {
this.mode = mode;
return this;
}
withTooltip(tooltip) {
this.tooltip = tooltip;
return this;
}
withIsEnabled(isEnabled = false) {
this.isEnabled = isEnabled;
return this;
}
withThemedIconUrls(...themedIconUrls) {
this.themedIconUrls = themedIconUrls;
return this;
}
withContent(content) {
this.content = content;
return this;
}
withDisplayArrow(displayArrow = false) {
this.displayArrow = displayArrow;
return this;
}
withPosition(position) {
this.position = position;
return this;
}
withMaxPopoverWidth(maxPopoverWidth) {
this.maxPopoverWidth = maxPopoverWidth;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
}
function isActionSet(value) {
const obj = value;
return typeof obj === "object" && obj.type === "ActionSet";
}
class ActionSet {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **ActionSet**.
*/
type = "ActionSet";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The locale associated with the element.
*/
lang;
/**
* Controls the visibility of the element.
*/
isVisible = true;
/**
* Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true.
*/
separator = false;
/**
* The height of the element. When set to stretch, the element will use the remaining vertical space in its container.
*/
height = "auto";
/**
* Controls how the element should be horizontally aligned.
*/
horizontalAlignment;
/**
* Controls the amount of space between this element and the previous one. No space will be added for the first element in a container.
*/
spacing = "Default";
/**
* Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](https://adaptivecards.microsoft.com/?topic=responsive-layout).
*/
targetWidth;
/**
* Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.
*/
isSortKey = false;
/**
* The area of a Layout.AreaGrid layout in which an element should be displayed.
*/
"grid.area";
/**
* An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
/**
* The actions in the set.
*/
actions;
constructor(...actions) {
this.actions = actions;
}
withOptions(value) {
Object.assign(this, value);
return this;
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withLang(lang) {
this.lang = lang;
return this;
}
withIsVisible(isVisible = false) {
this.isVisible = isVisible;
return this;
}
withSeparator(separator = true) {
this.separator = separator;
return this;
}
withHeight(height) {
this.height = height;
return this;
}
withHorizontalAlignment(horizontalAlignment) {
this.horizontalAlignment = horizontalAlignment;
return this;
}
withSpacing(spacing) {
this.spacing = spacing;
return this;
}
withTargetWidth(targetWidth) {
this.targetWidth = targetWidth;
return this;
}
withIsSortKey(isSortKey = true) {
this.isSortKey = isSortKey;
return this;
}
withFallback(fallback) {
this.fallback = fallback;
return this;
}
withActions(...actions) {
this.actions = actions;
return this;
}
}
function isContainer(value) {
const obj = value;
return typeof obj === "object" && obj.type === "Container";
}
class Container {
/**
* Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.
*/
key;
/**
* Must be **Container**.
*/
type = "Container";
/**
* A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.
*/
id;
/**
* A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).
*/
requires = {};
/**
* The locale associated with the element.
*/
lang;
/**
* Controls the visibility of the element.
*/
isVisible = true;
/**
* Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true.
*/
separator = false;
/**
* The height of the element. When set to stretch, the element will use the remaining vertical space in its container.
*/
height = "auto";
/**
* Controls how the element should be horizontally aligned.
*/
horizontalAlignment;
/**
* Controls the amount of space between this element and the previous one. No space will be added for the first element in a container.
*/
spacing = "Default";
/**
* Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](https://adaptivecards.microsoft.com/?topic=responsive-layout).
*/
targetWidth;
/**
* Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.
*/
isSortKey = false;
/**
* An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported.
*/
selectAction;
/**
* The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met.
*/
style;
/**
* Controls if a border should be displayed around the container.
*/
showBorder = false;
/**
* Controls if the container should have rounded corners.
*/
roundedCorners = false;
/**
* The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details.
*/
layouts;
/**
* Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding.
*/
bleed = false;
/**
* The minimum height, in pixels, of the container, in the `<number>px` format.
*/
minHeight;
/**
* Defines the container's background image.
*/
backgroundImage;
/**
* Controls how the container's content should be vertically aligned.
*/
verticalContentAlignment;
/**
* Controls if the content of the card is to be rendered left-to-right or right-to-left.
*/
rtl;
/**
* The maximum height, in pixels, of the container, in the `<number>px` format. When the content of a container exceeds the container's maximum height, a vertical scrollbar is displayed.
*/
maxHeight;
/**
* The area of a Layout.AreaGrid layout in which an element should be displayed.
*/
"grid.area";
/**
* An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.
*/
fallback;
/**
* The elements in the container.
*/
items;
constructor(...items) {
this.items = items;
}
withOptions(value) {
Object.assign(this, value);
return this;
}
withKey(key) {
this.key = key;
return this;
}
withId(id) {
this.id = id;
return this;
}
withRequires(requires) {
this.requires = requires;
return this;
}
withLang(lang) {
this.lang = lang;
return this;
}
withIsVisible(isVisible = false) {
this.isVisible = isVisible;
return this;
}
withSeparator(separator = true) {
this.separator = separator;
return this;
}
withHeight(height) {
this.height = height;
return this;
}
withHorizontalAlignment(horizontalAlignment) {
this.horizontalAlignment = horizontalAlignment;
return this;
}
withSpacing(spacing) {
this.spacing = spacing;
return this;
}
withTar