Skip to content

Adding AdaptiveCard to DialogSet results in error #172

Description

@steps371

Hi,

Glad to see community js examples popping up!

I am trying to implement an adaptive card prompt inside of dialogs, but I cannot seem to replicate the brief example in the documentation mentioned here.

The code below is the run method of my top-level dialog.

public async run(turnContext: TurnContext, accessor: StatePropertyAccessor<DialogState>) {

    const cardJson = require('./cards/test.json');

    const card = CardFactory.adaptiveCard(cardJson);

    const promptSettings: AdaptiveCardPromptSettings = {
      card: card,
      requiredInputIds: ['inputA', 'inputB'],
      promptId: 'myCustomId',
    };

    const adaptiveCardPrompt = new AdaptiveCardPrompt(
      'adaptiveCardPrompt',
      promptSettings
    );

    const dialogSet = new DialogSet(accessor);

    //@ts-ignore -- see error below
    dialogSet.add(adaptiveCardPrompt);
    
    dialogSet.add(this);

    const dialogContext = await dialogSet.createContext(turnContext);

    const results = await dialogContext.continueDialog();

    if (results.status === DialogTurnStatus.empty) {
      await dialogContext.beginDialog(this.id);
    }
  }

I get a runtime error: DialogSet.add(): Invalid dialog being added

Typescript error:

Argument of type 'AdaptiveCardPrompt' is not assignable to parameter of type 'Dialog<{}>'.
  Type 'AdaptiveCardPrompt' is missing the following properties from type 'Dialog<{}>': onPreBubbleEventAsync, onPostBubbleEventAsync, hashedLabelts(2345)

Any workarounds, suggestions or solutions will be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedsample

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions