Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

List Card Support in NodeJs Sample App #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"async": "^2.4.0",
"bluebird": "^3.4.7",
"botbuilder": "^3.15.0",
"botbuilder-teams": "^0.2.1",
"botbuilder-teams": "^0.2.3-beta1",
"chrono-node": "^1.2.5",
"config": "^1.25.1",
"crypto": "0.0.3",
Expand Down
2 changes: 2 additions & 0 deletions src/dialogs/RootDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { UpdateTextMsgSetupDialog } from "./examples/teams/UpdateTextMsgSetupDia
import { NotifyDialog } from "./examples/teams/NotifyDialog";
import { PopupSignInDialog } from "./examples/basic/PopupSignInDialog";
import { AdaptiveCardDialog } from "./examples/basic/AdaptiveCardDialog";
import { ListCardDialog } from "./examples/basic/ListCardDialog";
// *************************** END OF EXAMPLES *********************************

// Add imports for dialogs
Expand Down Expand Up @@ -105,6 +106,7 @@ export class RootDialog extends builder.IntentDialog {
new NotifyDialog(bot);
new PopupSignInDialog(bot);
new AdaptiveCardDialog(bot);
new ListCardDialog(bot);
// *************************** END OF EXAMPLES *********************************

// Add child dialogs
Expand Down
39 changes: 39 additions & 0 deletions src/dialogs/examples/basic/ListCardDialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as builderteams from "botbuilder-teams";
import * as builder from "botbuilder";
import * as config from "config";
import { TriggerActionDialog } from "../../../utils/TriggerActionDialog";
import { DialogIds } from "../../../utils/DialogIds";
import { DialogMatches } from "../../../utils/DialogMatches";
import { Strings } from "../../../locale/locale";

export class ListCardDialog extends TriggerActionDialog {

private static async step1(session: builder.Session, args?: any | builder.IDialogResult<any>, next?: (args?: builder.IDialogResult<any>) => void): Promise<void> {
let card = new builderteams.ListCard(session)
.title(session.gettext(Strings.list_card_title))
// item1
.addItem(new builderteams.ListCardItem(session)
.icon(config.get("app.baseUri") + "/assets/computer_people.jpg")
.title(session.gettext(Strings.list_card_item1_title))
.subtitle(session.gettext(Strings.list_card_item1_subtitle)))
// item2
.addItem(new builderteams.ListCardItem(session)
.icon(config.get("app.baseUri") + "/assets/computer_person.jpg")
.title(session.gettext(Strings.list_card_item2_title))
.subtitle(session.gettext(Strings.list_card_item2_subtitle)));

session.send(new builder.Message(session)
.addAttachment(card));
session.endDialog();
}

constructor(
bot: builder.UniversalBot,
) {
super(bot,
DialogIds.ListCardDialogId,
DialogMatches.ListCardDialogMatch,
ListCardDialog.step1,
);
}
}
5 changes: 5 additions & 0 deletions src/locale/en/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,10 @@
"popupsignin_card_title":"Please click below for popup sign-in experience",
"popupsignin_button_title":"Sign In",
"popupsignin_successful":"Authentication popup closed, magic number passed through - %s",
"list_card_item1_title":"Item1 title",
"list_card_item2_title":"Item2 title",
"list_card_item1_subtitle":"Item1 sub title",
"list_card_item2_subtitle":"Item2 sub title",
"list_card_title":"List card title here",
"end_of_example_string_responses": "******************************* EVERYTHING ABOVE HERE IS FOR A TEMPLATE EXAMPLE DIALOG *******************************"
}
1 change: 1 addition & 0 deletions src/utils/DialogIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const DialogIds = {
NotifyDialogId: "NotifyDialog",
PopupSignInDialogId: "PopupSignInDialog",
AdaptiveCardDialogId: "AdaptiveCardDialog",
ListCardDialogId: "ListCardDialog",
// *************************** END OF EXAMPLES *********************************

// Add entries for dialog ids
Expand Down
1 change: 1 addition & 0 deletions src/utils/DialogMatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const DialogMatches = {
NotifyDialogMatch: /notify/i,
PopUpSignInDialogMatch: /signin/i,
AdaptiveCardDialogMatch: /adaptive card/i,
ListCardDialogMatch: /list card/i,
// *************************** END OF EXAMPLES *********************************

// Add regex or string intent matches for dialogs
Expand Down