Skip to content

Commit

Permalink
Update ActionProvider.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
MastanSayyad committed Jul 26, 2024
1 parent c6b846a commit 849f289
Showing 1 changed file with 106 additions and 78 deletions.
184 changes: 106 additions & 78 deletions src/Components/ChatBot/ActionProvider.jsx
Original file line number Diff line number Diff line change
@@ -1,97 +1,125 @@
import React from 'react';
import {createChatBotMessage} from 'react-chatbot-kit'
import { createChatBotMessage } from 'react-chatbot-kit';
import { shuffleArray } from './utils';

const ActionProvider = ({ createChatBotMessage, setState, children }) => {
const questions = [
"What services do you offer?",
"Can you tell me about your pricing?",
"How can I contact your support team?",
"What is the mission of your company?",
"Where are you located?",
"How long have you been in business?"
];

const updateState = (message) => {
setState((prev) => ({
...prev,
messages: [...prev.messages, message],
}));
};

const handleHello = () => {
const message = createChatBotMessage('Hello, I am InvestIQ, type in your query.');
updateState(message);
};

const companyDetails = () => {
const message = createChatBotMessage('At StartConnect-Hub, our mission is to create a thriving ecosystem where entrepreneurs and investors can come together to turn ideas into reality. We understand the challenges that startups face, from securing funding to navigating the complexities of the business world. With our platform, entrepreneurs can bring their visions to life and take their businesses to new heights.');
updateState(message);
};

const contactUs = () => {
const message = createChatBotMessage('Contact details can be viewed on our CONTACT US section. Feel free to drop us your query.');
updateState(message);
};

const handleServices = () => {
const message = createChatBotMessage("Our services include investor management, financial services,full service funds, and more. You can visit our website for a detailed list of services.");
updateState(message);
};

const handleCost = () => {
const message = createChatBotMessage("Our pricing varies depending on the scope of the project and specific requirements. Please contact our sales team for detailed pricing information tailored to your needs.");
updateState(message);
};


const handleMore = () => {
const message = createChatBotMessage("Our mission is to empower businesses with innovative technology solutions and help them achieve their goals efficiently and effectively.");
updateState(message);
};

const handleLocation = () => {
const message = createChatBotMessage("We are located in India. You can visit contact details for more");
updateState(message);
};

const handleExperience = () => {
const message = createChatBotMessage("We have been in business for more than 2 years, serving clients worldwide.");
updateState(message);
};

const handleThank = () => {
const message = createChatBotMessage("Hope I could help! Stay connected and thank you.");
updateState(message);
};

const defaultResponse = () => {
const message = createChatBotMessage("I'm not sure about that. Can you ask something else? Or You can feel free to checkout Frequently asked questions") ;
updateState(message) ;
}

const suggestQuestions = () => {
const questionsMessage = questions.map((question, idx) => `${idx + 1}. ${question}`).join('\n');
const message = createChatBotMessage(`Here are some questions you can ask:\n\n${questionsMessage}`);
updateState(message);
const actions = {
services: () => {
const message = createChatBotMessage('Our services include investor management, financial services, full-service funds, and more.', {
widget: 'options'
});
updateState(message);
},
pricing: () => {
const message = createChatBotMessage('Our pricing varies depending on the project. Please contact our sales team for detailed information.', {
widget: 'options'
});
updateState(message);
},
contact: () => {
const message = createChatBotMessage('You can contact us through the Contact Us section on our website.', {
widget: 'options'
});
updateState(message);
},
mission: () => {
const message = createChatBotMessage('Our mission is to create a thriving ecosystem for entrepreneurs and investors.', {
widget: 'options'
});
updateState(message);
},
location: () => {
const message = createChatBotMessage('We are located in India.', {
widget: 'options'
});
updateState(message);
},
experience: () => {
const message = createChatBotMessage('We have been in business for over 2 years.', {
widget: 'options'
});
updateState(message);
},
startups: () => {
const message = createChatBotMessage('We work with a diverse range of startups across various industries.', {
widget: 'options'
});
updateState(message);
},
featured: () => {
const message = createChatBotMessage('To get featured, submit your startup profile through our platform.', {
widget: 'options'
});
updateState(message);
},
benefits: () => {
const message = createChatBotMessage('Joining StartConnectHub offers numerous benefits including access to investors and mentors.', {
widget: 'options'
});
updateState(message);
},
resources: () => {
const message = createChatBotMessage('We offer resources like mentorship programs, funding opportunities, and business development guides.', {
widget: 'options'
});
updateState(message);
},
collaboration: () => {
const message = createChatBotMessage('We encourage collaboration among startups.', {
widget: 'options'
});
updateState(message);
},
contactSupport: () => {
const message = createChatBotMessage('Contact our support team through the Contact Us section on our website.', {
widget: 'options'
});
updateState(message);
},
SuccessStories: () => {
const message = createChatBotMessage('We feature success stories from startups on our website.', {
widget: 'options'
});
updateState(message);
},
investors: () => {
const message = createChatBotMessage('Investors can sign up on our platform to explore investment opportunities.', {
widget: 'options'
});
updateState(message);
},
handleHello: () => {
const message = createChatBotMessage('Hello, I am InvestIQ. Type in your query or Here are some options you can choose from:', {
widget: 'options'
});
updateState(message);
},
handleThank: () => {
const message = createChatBotMessage('You are Welcome! If you have any more questions or need further assistance, feel free to ask.', {
widget: 'options'
});
updateState(message);
},
defaultResponse: () => {
const message = createChatBotMessage("I'm not sure about that. Can you ask something else? Here are some options you can choose from Or feel free to check out the Frequently Asked Questions.", {
widget: 'options'
});
updateState(message);
}
};

return (
<div>
{React.Children.map(children, (child) => {
return React.cloneElement(child, {
actions: {
handleHello,
companyDetails,
contactUs,
suggestQuestions ,
handleCost,
handleExperience,
handleLocation,
handleServices,
handleMore,
handleThank,
defaultResponse
},
actions,
});
})}
</div>
Expand Down

0 comments on commit 849f289

Please sign in to comment.