sg-chatbot-ui v0.0.14
Here's the revised README format with your requested changes:
SG Chatbot UI Integration
Follow these steps to set up the SG Chatbot UI in a React.js or Next.js project.
Step 1: Install the Package
npm install sg-chatbot-uiReact.js Setup
Import and Define Custom Elements
Add the following lines in yourApp.jsfile:import { defineCustomElements } from 'sg-chatbot-ui/loader'; defineCustomElements(window);Use the Custom Element
Add the<chatbot-ui>component at the bottom ofApp.js:<chatbot-ui></chatbot-ui>Set Server URL
In your.envfile, add the server URL and update it with your current base URL:REACT_APP_SERVER_URL=https://sentientgeeks.com
Next.js Setup
Import and Define Custom Elements in app route or
InApp.js, import and define the custom elements conditionally within auseEffecthook:import { useEffect } from 'react'; import { defineCustomElements } from 'sg-chatbot-ui/loader'; useEffect(() => { if (typeof window !== "undefined") { defineCustomElements(window); } }, []);Import and Define Custom Elements in page route
InApp.js, import and define the custom elements conditionally within auseEffecthook:import { useEffect } from 'react'; useEffect(() => { if (typeof window !== "undefined") { import("sg-chatbot-ui/loader").then((module) => { module.defineCustomElements(window); }); } }, []);Declare Custom Element in TypeScript
Inside thesrcfolder, create a file namedglobal.d.tsto declare thechatbot-uicomponent:declare namespace JSX { interface IntrinsicElements { "chatbot-ui": React.DetailedHTMLProps< React.HTMLAttributes<HTMLElement>, HTMLElement >; } }Use the Custom Element
Add the<chatbot-ui>component at the bottom ofpage.tsx:<chatbot-ui></chatbot-ui>Set Server URL
In your.envfile, add the server URL and update it with your current base URL:NEXT_PUBLIC_SERVER_URL=https://sentientgeeks.com
With these steps, you should have the SG Chatbot UI integrated and ready to use in your application!