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OAAQ6H,EACR3H,eAAgB,IAAM4H,GAAc,OAK9C,aC1KA,WAAkB,k7BCAlB,WAAkB","sources":["webpack://_N_E/./components/ChatModalText.js","webpack://_N_E/./pages/ProfileCarousel.js","webpack://_N_E/./components/ChatModalText.module.css","webpack://_N_E/./pages/ProfileCarousel.module.css"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\nimport Modal from 'react-modal';\nimport Image from 'next/image';\nimport styles from './ChatModalText.module.css';\nimport { FaTimes } from 'react-icons/fa';\nimport { toast } from 'react-toastify';\nimport { v4 as uuidv4 } from 'uuid';\n\nModal.setAppElement('#__next');\n\nconst ChatModalText = ({ writer, isOpen, onRequestClose }) => {\n const [messages, setMessages] = useState([\n { \n sender: 'bot', \n text: `Hi! I'm ${writer.full_name || writer.username}, how can I help?`,\n id: uuidv4(),\n },\n ]);\n const [input, setInput] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const messagesEndRef = useRef(null);\n const [userId, setUserId] = useState('');\n const [viewportHeight, setViewportHeight] = useState(0);\n const [isKeyboardOpen, setIsKeyboardOpen] = useState(false);\n const chatContainerRef = useRef(null);\n\n // Get initial viewport height\n useEffect(() => {\n setViewportHeight(window.visualViewport?.height || window.innerHeight);\n \n // Listen for viewport changes (keyboard appearing)\n const handleResize = () => {\n const currentViewportHeight = window.visualViewport?.height || window.innerHeight;\n setViewportHeight(currentViewportHeight);\n \n // If the viewport height decreased significantly, keyboard is likely open\n setIsKeyboardOpen(currentViewportHeight < (window.innerHeight * 0.75));\n };\n \n window.visualViewport?.addEventListener('resize', handleResize);\n return () => window.visualViewport?.removeEventListener('resize', handleResize);\n }, []);\n\n const scrollToBottom = useCallback(() => {\n messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });\n }, []);\n\n useEffect(() => {\n scrollToBottom();\n }, [messages, scrollToBottom]);\n\n useEffect(() => {\n let storedUserId = localStorage.getItem('user_id');\n if (!storedUserId) {\n storedUserId = uuidv4();\n localStorage.setItem('user_id', storedUserId);\n }\n setUserId(storedUserId);\n }, []);\n\n const handleSend = async () => {\n if (!input.trim() || isLoading) return;\n\n const userMessage = { sender: 'user', text: input.trim(), id: uuidv4() };\n setMessages(prev => [...prev, userMessage]);\n setInput('');\n\n // Create a temporary bot message with typing indicator\n const tempMessageId = uuidv4();\n setMessages(prev => [\n ...prev,\n { sender: 'bot', text: '', id: tempMessageId, isTyping: true }\n ]);\n setIsLoading(true);\n\n try {\n const response = await fetch('https://renewalbackend.com/api/interact', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n user_input: input.trim(),\n user_id: userId,\n writer_id: writer.username,\n writer_info: {\n name: writer.full_name || writer.username,\n bio: writer.bio || '',\n topics: writer.topics || [],\n social_links: writer.social_links || {},\n profession: writer.profession || 'Writer',\n location: writer.location || '',\n }\n }),\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch response');\n }\n\n const data = await response.json();\n\n // Replace the temporary typing message with the final bot message\n setMessages(prev => \n prev.map(msg => \n msg.id === tempMessageId\n ? { sender: 'bot', text: data.response, metadata: data.metadata, id: uuidv4() }\n : msg\n )\n );\n } catch (error) {\n console.error('Chat error:', error);\n toast.error('Failed to send message. Please try again.');\n // Remove the temporary typing indicator on error\n setMessages(prev => prev.filter(msg => msg.id !== tempMessageId));\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n };\n\n // Auto-resize textarea height based on content\n const handleInputChange = (e) => {\n setInput(e.target.value);\n e.target.style.height = 'auto';\n e.target.style.height = `${Math.min(e.target.scrollHeight, 100)}px`;\n };\n\n return (\n Chat with {writer.full_name || writer.username}
\n \n
{selectedProfile.about || 'No information available about this writer.'}
\n