import React, { useState } from 'react'; import { __ } from '@wordpress/i18n'; import { ChevronRight, Mail, MessageCircle } from 'lucide-react'; import ContactForm from '../features/ContactForm'; import ViewHeader from './ViewHeader'; import OrderStatusCard from './OrderStatusCard'; import HelpSearchCard from './HelpSearchCard'; const HelpView = ({ headerActions, integrations, onAskAi, woocommerceEnabled, onOrderStatus, helpQuestions = [], onHelpQuestion }) => { const [showContactForm, setShowContactForm] = useState(false); const { whatsappEnabled, whatsappNumber, telegramEnabled, telegramUsername } = integrations; const contactFormUrl = window.AiskData?.contactFormUrl; const pluginUrl = window.AiskData?.pluginUrl || ''; const openWhatsApp = () => { const formattedNumber = whatsappNumber.replace('whatsapp:', '').replace(/[^0-9]/g, ''); window.open(`https://wa.me/${formattedNumber}`, '_blank', 'noopener'); }; const openTelegram = () => { window.open(`https://t.me/${telegramUsername}`, '_blank', 'noopener'); }; if (showContactForm) { return (
setShowContactForm(false)} actions={headerActions} />
); } return (
{woocommerceEnabled && } {contactFormUrl && ( )} {whatsappEnabled && whatsappNumber && ( )} {telegramEnabled && telegramUsername && ( )}
); }; export default HelpView;