()
| 3 | const AlanAIProjectKey = `${process.env.NEXT_PUBLIC_ALAN_AI_CHATBOT}/stage`; |
| 4 | |
| 5 | function AlanAIComponent() { |
| 6 | useEffect(() => { |
| 7 | // Load Alan AI script asynchronously when the component mounts on the client side |
| 8 | // const additionalStyles = ` |
| 9 | // .alanBtn-root { |
| 10 | // right: 2rem !important; |
| 11 | // bottom: 2rem !important; |
| 12 | // } |
| 13 | // `; |
| 14 | |
| 15 | // const styleTag = document.createElement("style"); |
| 16 | // styleTag.innerHTML = additionalStyles; |
| 17 | // document.head.appendChild(styleTag); |
| 18 | |
| 19 | // Initialize Alan AI and handle commands once the script is loaded |
| 20 | /* global alanBtn */ |
| 21 | const alanBtnInstance = alanBtn({ |
| 22 | key: AlanAIProjectKey, |
| 23 | onCommand: function (commandData) { |
| 24 | if (commandData && commandData.command === "openURL") { |
| 25 | if (commandData.target === "_blank") { |
| 26 | window.open( |
| 27 | commandData.url, |
| 28 | "_newtab" + Math.floor(Math.random() * 999999) |
| 29 | ); |
| 30 | } else { |
| 31 | window.location.href = commandData.url; |
| 32 | } |
| 33 | } |
| 34 | }, |
| 35 | }); |
| 36 | |
| 37 | // Clean up the Alan AI instance when the component unmounts |
| 38 | return () => { |
| 39 | alanBtnInstance.deactivate(); |
| 40 | }; |
| 41 | }, []); |
| 42 | |
| 43 | return ( |
| 44 | <div |
| 45 | id="alan-btn" |
| 46 | className="fixed cursor-pointer bg-[#13161B] bottom-16 left-10 p-4" |
| 47 | ></div> |
| 48 | ); // This div will serve as the mount point for the Alan AI button |
| 49 | } |
| 50 | |
| 51 | export default AlanAIComponent; |
nothing calls this directly
no outgoing calls
no test coverage detected