Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.createAdaptiveCard = memoize(content => {
const card = new AdaptiveCard();
const errors = [];
// TODO: [P3] Move from "onParseError" to "card.parse(json, errors)"
AdaptiveCard.onParseError = error => errors.push(error);
card.parse({
version: '1.0',
...content
});
AdaptiveCard.onParseError = null;
return {
card,
errors
};
data.payload.forEach((activity) => {
// Create an AdaptiveCard instance
const adaptiveCard = new AdaptiveCards.AdaptiveCard();
// Host Config defines the style and behavior of a card
adaptiveCard.hostConfig = new AdaptiveCards.HostConfig({
containerStyles: {
default: {
backgroundColor: "#FF37474F",
foregroundColors: {
default: {
default: "#FFEEEEEE",
subtle: "#FFEEEEEE"
}
}
}
},
fontFamily: "Segoe UI, Helvetica Neue, sans-serif"
});
render() {
if (!this.props.open || !this.props.template) {
return null;
}
let card: HTMLElement | null = null
try {
const template = getProcessedTemplate(this.props.template, this.props.actionArguments, this.props.hideUndefined)
AdaptiveCards.AdaptiveCard.onProcessMarkdown = ((text, result) => {
result.outputHtml = this.md.render(text)
result.didProcess = true
})
const adaptiveCard = new AdaptiveCards.AdaptiveCard()
adaptiveCard.hostConfig = this.getAdaptiveCardHostConfig()
adaptiveCard.parse(template)
card = adaptiveCard.render()
}
catch (e) {
// Ignore error, show error message below
}
return (
<div>
<div></div></div>
mountAdaptiveCards() {
const adaptiveCard = this.props.nativeCard || new AdaptiveCard();
adaptiveCard.hostConfig = this.props.hostConfig || defaultHostConfig;
let errors: IValidationError[] = [];
if (!this.props.nativeCard && this.props.jsonCard) {
this.props.jsonCard.version = this.props.jsonCard.version || '0.5';
adaptiveCard.parse(cardWithoutHttpActions(this.props.jsonCard));
errors = adaptiveCard.validate();
}
adaptiveCard.onExecuteAction = (action) => this.onExecuteAction(action);
if (errors.length === 0) {
let renderedCard: HTMLElement;
constructor() {
this.card = new AdaptiveCard();
this.container = new Container();
this.card.addItem(this.container);
}
constructor() {
this.card = new adaptivecards_1.AdaptiveCard();
this.container = new adaptivecards_1.Container();
this.card.addItem(this.container);
}
addColumnSet(sizes, container) {
]
}
]
};
let template = new ACData.Template(templatePayload);
let context = new ACData.EvaluationContext();
context.$root = {
title: this.title,
catalogue: catalogue
};
let expandedCardPayload = template.expand(context);
let card = new Adaptive.AdaptiveCard();
card.hostConfig = defaultHostConfig;
card.onExecuteAction = (action: Adaptive.Action) => {
if (action.id == "cancel") {
this.close();
}
else if (action instanceof Adaptive.SubmitAction) {
this._selectedSample = catalogue[action.data["catalogueIndex"]];
this.close();
}
}
card.onParseElement = (element: Adaptive.CardElement, json: any, errors?: Adaptive.IValidationError[]) => {
if (element instanceof Adaptive.CardElementContainer) {
element.allowVerticalOverflow = Adaptive.getBoolValue(json["allowVerticalOverflow"], false);
}
}
mountAdaptiveCards() {
const adaptiveCard = this.props.nativeCard || new AdaptiveCard();
adaptiveCard.hostConfig = this.props.hostConfig || defaultHostConfig;
let errors: IValidationError[] = [];
if (!this.props.nativeCard && this.props.jsonCard) {
this.props.jsonCard.version = this.props.jsonCard.version || '0.5';
adaptiveCard.parse(cardWithoutHttpActions(this.props.jsonCard));
errors = adaptiveCard.validate();
}
adaptiveCard.onExecuteAction = this.onExecuteAction.bind(this);
if (errors.length === 0) {
let renderedCard: HTMLElement;
mountAdaptiveCards() {
const adaptiveCard = this.props.nativeCard || new adaptivecards_1.AdaptiveCard();
adaptiveCard.hostConfig = this.props.hostConfig || defaultHostConfig;
let errors = [];
if (!this.props.nativeCard && this.props.jsonCard) {
this.props.jsonCard.version = this.props.jsonCard.version || '0.5';
adaptiveCard.parse(cardWithoutHttpActions(this.props.jsonCard));
errors = adaptiveCard.validate();
}
adaptiveCard.onExecuteAction = (action) => this.onExecuteAction(action);
if (errors.length === 0) {
let renderedCard;
try {
renderedCard = adaptiveCard.render();
}
catch (e) {
const ve = {
error: -1,