Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain how initialDialogId is used #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 15 additions & 3 deletions javascript_nodejs/dialogs/DonateFoodDialog.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
const { ComponentDialog, ChoicePrompt, WaterfallDialog } = require('botbuilder-dialogs');
const { getValidDonationDays, filterFoodBanksByDonation, createFoodBankDonationCarousel } = require('../services/schedule-helpers');

const DONATION_DIALOG = 'donationDialog';

class DonateFoodDialog extends ComponentDialog {
constructor(dialogId) {
super(dialogId);

// ID of the child dialog that should be started anytime the component is started.
this.initialDialogId = dialogId;
/**
* THIS IS REQUIRED to tell the framework which dialog
* will be use as the starting one.
*
* Value doesn't matter, you could use the passed-in dialogId
* or something new
*
* Without this, the first Diaglog added will be used, which in
* this example will be the Choice Prompt
* **/
this.initialDialogId = DONATION_DIALOG; // or dialogId

this.addDialog(new ChoicePrompt('choicePrompt'));

// Define the conversation flow using a waterfall model.
this.addDialog(new WaterfallDialog(dialogId, [
// The id used here need to match the value given to `initialId`
this.addDialog(new WaterfallDialog(DONATION_DIALOG, [
async function (step) {
const validDonationDays = getValidDonationDays();

Expand Down