Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!attachment.content || !attachment.content.media || attachment.content.media.length === 0)
return null;
return (React.createElement(AdaptiveCardContainer_1.default, { className: "audio", nativeCard: CardBuilder.buildCommonCard(attachment.content), onCardAction: props.onCardAction }, getRichCardContentMedia('audio', attachment.content)));
case "application/vnd.microsoft.card.signin":
if (!attachment.content)
return null;
return (React.createElement(AdaptiveCardContainer_1.default, { className: "signin", nativeCard: CardBuilder.buildCommonCard(attachment.content), onCardAction: props.onCardAction }));
case "application/vnd.microsoft.card.oauth":
if (!attachment.content)
return null;
return (React.createElement(AdaptiveCardContainer_1.default, { className: "signin", nativeCard: CardBuilder.buildOAuthCard(attachment.content), onCardAction: props.onCardAction }));
case "application/vnd.microsoft.card.receipt":
if (!attachment.content)
return null;
const receiptCardBuilder = new CardBuilder.AdaptiveCardBuilder();
receiptCardBuilder.addTextBlock(attachment.content.title, { size: adaptivecards_1.TextSize.Medium, weight: adaptivecards_1.TextWeight.Bolder });
const columns = receiptCardBuilder.addColumnSet([75, 25]);
attachment.content.facts && attachment.content.facts.map((fact, i) => {
receiptCardBuilder.addTextBlock(fact.key, { size: adaptivecards_1.TextSize.Medium }, columns[0]);
receiptCardBuilder.addTextBlock(fact.value, { size: adaptivecards_1.TextSize.Medium, horizontalAlignment: adaptivecards_1.HorizontalAlignment.Right }, columns[1]);
});
attachment.content.items && attachment.content.items.map((item, i) => {
if (item.image) {
const columns2 = receiptCardBuilder.addColumnSet([15, 75, 10]);
receiptCardBuilder.addImage(item.image.url, columns2[0], item.image.tap);
receiptCardBuilder.addTextBlock(item.title, { size: adaptivecards_1.TextSize.Medium, weight: adaptivecards_1.TextWeight.Bolder, wrap: true }, columns2[1]);
receiptCardBuilder.addTextBlock(item.subtitle, { size: adaptivecards_1.TextSize.Medium, wrap: true }, columns2[1]);
receiptCardBuilder.addTextBlock(item.price, { horizontalAlignment: adaptivecards_1.HorizontalAlignment.Right }, columns2[2]);
}
else {
const columns3 = receiptCardBuilder.addColumnSet([75, 25]);
receiptCardBuilder.addTextBlock(item.title, { size: adaptivecards_1.TextSize.Medium, weight: adaptivecards_1.TextWeight.Bolder, wrap: true }, columns3[0]);
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150,
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true,
},
spacing: 10
}
});
}
}
actionsOrientation: Adaptive.Orientation.Horizontal,
actionAlignment: Adaptive.ActionAlignment.Left
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Medium,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true
},
spacing: 10
}
});
}
}
actionsOrientation: Adaptive.Orientation.Horizontal,
actionAlignment: Adaptive.ActionAlignment.Left
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Medium,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true
},
spacing: 10
}
});
};
Object.defineProperty(HostContainer.prototype, "cardHost", {
addCommonHeaders(content) {
this.addTextBlock(content.title, { size: adaptivecards_1.TextSize.Medium, weight: adaptivecards_1.TextWeight.Bolder });
this.addTextBlock(content.subtitle, { isSubtle: true, wrap: true });
this.addTextBlock(content.text, { wrap: true });
}
addCommon(content) {
actionsOrientation: Adaptive.Orientation.Vertical,
actionAlignment: Adaptive.ActionAlignment.Stretch
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Medium,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150,
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true,
},
spacing: 5
}
});
}
}
actionsOrientation: Adaptive.Orientation.Horizontal,
actionAlignment: Adaptive.ActionAlignment.Left
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Medium,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: false,
maxWidth: 150,
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true,
},
spacing: 10
}
});
}
}
actionsOrientation: Adaptive.Orientation.Horizontal,
actionAlignment: Adaptive.ActionAlignment.Stretch
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Small,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true,
},
spacing: 12
}
});
}
}
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true
},
spacing: 10
}
});
};
Object.defineProperty(HostContainer.prototype, "cardHost", {
actionsOrientation: Adaptive.Orientation.Horizontal,
actionAlignment: Adaptive.ActionAlignment.Left
},
adaptiveCard: {
allowCustomStyle: false
},
imageSet: {
imageSize: Adaptive.Size.Medium,
maxImageHeight: 100
},
factSet: {
title: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Bolder,
wrap: true,
maxWidth: 150
},
value: {
color: Adaptive.TextColor.Default,
size: Adaptive.TextSize.Default,
isSubtle: false,
weight: Adaptive.TextWeight.Default,
wrap: true
},
spacing: 10
}
});
}
}