LucasBassetti/react-simple-chatbot

[Doubt] How to store a user input and use it later

Opened this issue · 1 comments

Describe the bug
A clear and concise description of what the bug is.

I basically want to store my user input at some point and then use it later. Similar to previousValue

To Reproduce

const steps = [
    {
      id: '0',
      message: 'Hey User!',
      trigger: '1',
    }, {
      id: '1',
      message: 'Please write your username',
      trigger: '2'
    }, {
      id: '2',
      user: true,
      trigger: '3',
    }, {
      id: '3',
      message: `Hi {previousValue}, how can I help you, ${userName}?`,
      trigger: '4'
    }, {
      id: '4',
      options: [
        {
          value: 1,
          label: 'Report a user',
          trigger: '5',
        },
        {
          value: 2,
          label: 'Report app issue',
          trigger: '11',
        },
        { value: 3, label: 'Need help' },
      ],
    }, {
      id: '5',
      message: 'Which User do you want to Report?',
      trigger: '6',
    }, {
      id: '6',
      user: true,
      trigger: '7',
      delay: 1000,
    }, {
      id: '7',
      message: 'What problem did the User cause?',
      trigger: '8',
    }, {
      id: '8',
      user: true,
      trigger: '9',
      delay: 1000,
    }, {
      id: '9',
      message: '{previousValue} has been warned',
      trigger: '4',
    }, {
      id: '10',
      options: [
        {
          value: 2,
          label: 'Report app issue',
          trigger: '11',
        },
        { value: 3, label: 'Need help' },
      ],
    }, {
      id: '11',
      message: 'What issues do you have with the application?',
      trigger: '12',
    }, {
      id: '12',
      user: true,
      trigger: '13',
      delay: 1000,
    }, {
      id: '13',
      message: 'We will work on this issue and get back to you!',
      end: true,
    }
  ];

Expected behavior
A clear and concise description of what you expected to happen.

I want to use the name that should be reported. Here {previousValue} leads to -
Stole has been warned

Instead of -
Harshit has been warned

Screenshots
If applicable, add screenshots to help explain your problem.

image

@LucasBassetti The work done in this project is commendable. I couldn't find any active mailing list so I asked my doubt here itself.
Would appreciate if you can help be out here.