1.0.8 • Published 4 months ago

@techmindsolutions/chatbot-iframe v1.0.8

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

@techmindsolutions/chatbot-iframe

A React component package for embedding a floating chatbot iframe in your application.

Installation

To install this private package in your projects:

  1. Make sure you are logged in to npm with an account that has access(talk to publisher for access):
npm login
  1. Install the package:
npm install @techmindsolutions/chatbot-iframe

Usage

import { FloatingChatbot } from '@techmindsolutions/chatbot-iframe';
import '@techmindsolutions/chatbot-iframe/style.css';

function App() {
  const handleFormSubmission = (payload: any) => {
    console.log('Form submission from chatbot:', payload);
  };

  return (
    <FloatingChatbot
      chatbotUrl="http://localhost:3000"
      onFormSubmit={handleFormSubmission}
    />
  );
}

Props

PropTypeRequiredDescription
chatbotUrlstringYesThe URL where your chatbot iframe is hosted
buttonStylesReact.CSSPropertiesNoCustom styles for the chat toggle button
containerStylesReact.CSSPropertiesNoCustom styles for the chatbot container
onFormSubmit(payload: any) => voidNoCallback function that gets called when the chatbot submits a form

Advanced Usage

You can also access the chatbot store directly for more control:

import { useChatbotStore } from '@formbay/chatbot-iframe';

function App() {
  const { setIsOpen, sendDataToChatbot } = useChatbotStore();

  const sendDataToChatBot = () => {
    sendDataToChatbot({
      someKey: 'Custom data to send to chatbot'
    });
  };

  return (
    // Your component code
  );
}
1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.0

4 months ago