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

Adding AdaptiveCard to DialogSet results in error #172

Open
steps371 opened this issue Jun 3, 2020 · 5 comments
Open

Adding AdaptiveCard to DialogSet results in error #172

steps371 opened this issue Jun 3, 2020 · 5 comments
Labels
question Further information is requested sample

Comments

@steps371
Copy link

steps371 commented Jun 3, 2020

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!

@szul szul added question Further information is requested sample labels Jun 3, 2020
@szul
Copy link
Contributor

szul commented Jun 3, 2020

@mdrichardson Any brief thoughts on this? I'll try to run through it over the weekend, if not.

@mdrichardson
Copy link
Contributor

mdrichardson commented Jun 3, 2020

@szul @steps371 Brief thoughts are that I know Dialogs got reworked quite a bit in 4.9 and I believe they now require providing a type when extending. I haven't looked into it much. Might have time to later this week, but @steps371 might be able to downgrade botbuilder packages to 4.8 for now.

@szul
Copy link
Contributor

szul commented Jun 3, 2020

I think our current packages are sitting on 4.8. I have a PR for 4.9 in draft, but I need to test all the samples before making it non-draft. If nobody gets to it before me, I'll be able to debug/test when I run through those samples.

@steps371
Copy link
Author

Thanks for the responses, unfortunately we need 4.9 for some of the new features like carousel and speech-to-text. Any idea when the packages will refer to 4.9?

@szul
Copy link
Contributor

szul commented Aug 14, 2020

@steps371 Hopefully in the next 1-2 weeks.

@szul szul self-assigned this Aug 14, 2020
@szul szul removed their assignment Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested sample
Projects
None yet
Development

No branches or pull requests

3 participants