Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"text": '🔍 ' + title
},
{
"type": "Container",
"items": []
}
]
};
// Render memory
if (memory) {
this.renderObject(memory, card.body[1] as any, '$');
}
// Send card
const msg = MessageFactory.attachment(CardFactory.adaptiveCard(card));
await this.dc.context.sendActivity(msg);
}
}
public async beginDialog(dc: DialogContext): Promise {
if (!this.template) { throw new Error(`${this.id}: no adaptive card template assigned.`) }
// Render card
const memory = dc.state.toJSON();
const data = this.dataProperty ? jsonpath.value(memory, this.dataProperty) || {} : memory;
const card = this.template.render(data);
// Send card as attachment
const activity = MessageFactory.attachment(CardFactory.adaptiveCard(card));
const result = await dc.context.sendActivity(activity);
return await dc.endDialog(result);
}
}
public static heroCard(choices: (string | Choice)[] = [], text = '', speak = ''): Activity {
const buttons: CardAction[] = ChoiceFactory.toChoices(choices).map(choice => ({
title: choice.value,
type: ActionTypes.ImBack,
value: choice.value
} as CardAction));
const attachment = CardFactory.heroCard(null, text, null, buttons);
return MessageFactory.attachment(attachment, null, speak, InputHints.ExpectingInput) as Activity;
}
private static buildActivityFromLGStructuredResult(lgValue: any): Partial {
let activity: Partial = {};
const type: string = this.getStructureType(lgValue);
if (ActivityChecker.genericCardTypeMapping.has(type) || type === 'attachment') {
activity = MessageFactory.attachment(this.getAttachment(lgValue));
} else if (type === 'activity') {
activity = this.buildActivity(lgValue);
}
return activity;
}