@burdenoff/microfe-healthybowl 2026.902.19 → 2026.902.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +234 -220
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/components/assistant/AssistantSpokenTurnsNotice.js +33 -0
  4. package/dist/components/assistant/AssistantSpokenTurnsNotice.js.map +1 -0
  5. package/dist/components/assistant/voice/AssistantVoiceSession.js +16 -16
  6. package/dist/components/assistant/voice/VoiceTranscriptDrawer.js.map +1 -1
  7. package/dist/healthybowl/hooks/useConsultationPayments.js +59 -0
  8. package/dist/healthybowl/hooks/useConsultationPayments.js.map +1 -0
  9. package/dist/healthybowl/hooks/useHealthyBowlData.js +15 -0
  10. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  11. package/dist/healthybowl/offline/graphql.js.map +1 -1
  12. package/dist/healthybowl/offline/syncEngine.js +2 -1
  13. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  14. package/dist/healthybowl/offline/types.js.map +1 -1
  15. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +228 -188
  16. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  17. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +261 -191
  18. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  19. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +49 -0
  20. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +1 -0
  21. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +48 -0
  22. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +1 -0
  23. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +54 -0
  24. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +1 -0
  25. package/dist/healthybowl/pages/network/ExpertsPage.js +520 -419
  26. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  27. package/dist/hooks/useConversationTurns.js +19 -0
  28. package/dist/hooks/useConversationTurns.js.map +1 -0
  29. package/dist/types/assistant.js.map +1 -1
  30. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ExpertsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/network/ExpertsPage.tsx"],"sourcesContent":["import { useState, useRef, useEffect, type FC } from 'react';\nimport {\n Star,\n MapPin,\n Clock,\n Globe,\n Award,\n ArrowUpDown,\n ChevronDown,\n Eye,\n User,\n Zap,\n CalendarCheck,\n Plus,\n Pencil,\n Trash2,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n FilterBar,\n StatusBadge,\n EmptyState,\n ErrorState,\n PageLoader,\n Modal,\n} from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useToast } from '../../hooks/useToast';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport type { Expert, ConsultationStatus, ConsultationMode } from '../../types';\nimport { cn, formatCurrency, HB_DEFAULT_CURRENCY, formatDateOnly, todayLocalDate } from '../../utils/helpers';\n\ntype BookingFormState = {\n topic: string;\n requestedDate: string;\n mode: string;\n notes: string;\n};\n\n// Video consultations are not yet wired to a live provider, so default to\n// phone and do not offer video as a bookable mode until BOFF-4719 is built.\nconst emptyBookingForm: BookingFormState = {\n topic: '',\n requestedDate: '',\n mode: 'phone',\n notes: '',\n};\n\ntype ExpertFormState = {\n name: string;\n specialization: string;\n experience: string;\n rating: string;\n location: string;\n availability: 'available' | 'busy' | 'offline';\n hourlyRate: string;\n languages: string;\n};\n\nconst emptyExpertForm: ExpertFormState = {\n name: '',\n specialization: '',\n experience: '',\n rating: '',\n location: '',\n availability: 'available',\n hourlyRate: '',\n languages: '',\n};\n\nconst consultationStatusVariant = (s: ConsultationStatus) => {\n switch (s) {\n case 'CONFIRMED':\n return 'success' as const;\n case 'COMPLETED':\n return 'info' as const;\n case 'CANCELLED':\n return 'muted' as const;\n case 'REQUESTED':\n default:\n return 'warning' as const;\n }\n};\n\nconst specializations = [\n 'All',\n 'Organic Crop Science',\n 'Integrated Pest Management',\n 'Soil Science & Fertility',\n 'Livestock & Veterinary',\n 'Organic Certification',\n];\nconst availabilityOptions = ['All', 'Available', 'Busy'];\n\ntype SortOption = 'rating' | 'experience' | 'price-asc' | 'price-desc';\nconst sortOrder: SortOption[] = ['rating', 'experience', 'price-asc', 'price-desc'];\n\nconst availabilityVariant = (a: string) => {\n switch (a) {\n case 'available':\n return 'success' as const;\n case 'busy':\n return 'warning' as const;\n case 'offline':\n return 'muted' as const;\n default:\n return 'default' as const;\n }\n};\n\nfunction renderStars(rating: number) {\n return Array.from({ length: 5 }, (_, i) => (\n <Star key={i} className={cn('h-3.5 w-3.5', i < Math.round(rating) ? 'fill-warning text-warning' : 'text-muted')} />\n ));\n}\n\nexport const ExpertsPage: FC = () => {\n const { t } = useI18n();\n const {\n experts,\n consultations,\n createConsultation,\n updateConsultationStatus,\n createExpert,\n updateExpert,\n deleteExpert,\n errors,\n loadings,\n refetch,\n } = useHealthyBowlData();\n\n // Video mode is intentionally omitted from the booking dropdown until the\n // video provider integration is implemented (BOFF-4719). Existing video\n // requests are still displayed with the \"coming soon\" label below.\n const consultationModes = [\n { value: 'phone', label: t('healthybowl.network.experts.modes.phone', 'Phone call') },\n { value: 'in_person', label: t('healthybowl.network.experts.modes.inPerson', 'In person') },\n ];\n\n const sortLabels: Record<SortOption, string> = {\n rating: t('healthybowl.network.experts.sort.rating', 'Rating'),\n experience: t('healthybowl.network.experts.sort.experience', 'Experience'),\n 'price-asc': t('healthybowl.network.experts.sort.priceAsc', 'Price: Low → High'),\n 'price-desc': t('healthybowl.network.experts.sort.priceDesc', 'Price: High → Low'),\n };\n\n const specializationLabels: Record<string, string> = {\n All: t('healthybowl.common.all', 'All'),\n 'Organic Crop Science': t('healthybowl.network.experts.specializations.organicCropScience', 'Organic Crop Science'),\n 'Integrated Pest Management': t(\n 'healthybowl.network.experts.specializations.integratedPestManagement',\n 'Integrated Pest Management'\n ),\n 'Soil Science & Fertility': t(\n 'healthybowl.network.experts.specializations.soilScienceFertility',\n 'Soil Science & Fertility'\n ),\n 'Livestock & Veterinary': t(\n 'healthybowl.network.experts.specializations.livestockVeterinary',\n 'Livestock & Veterinary'\n ),\n 'Organic Certification': t(\n 'healthybowl.network.experts.specializations.organicCertification',\n 'Organic Certification'\n ),\n };\n\n const availabilityFilterLabels: Record<string, string> = {\n All: t('healthybowl.common.all', 'All'),\n Available: t('healthybowl.network.experts.availabilityFilter.available', 'Available'),\n Busy: t('healthybowl.network.experts.availabilityFilter.busy', 'Busy'),\n };\n\n const availabilityDisplayLabels: Record<string, string> = {\n available: t('healthybowl.network.experts.availability.available', 'available'),\n busy: t('healthybowl.network.experts.availability.busy', 'busy'),\n offline: t('healthybowl.network.experts.availability.offline', 'offline'),\n };\n\n const consultationStatusLabels: Record<ConsultationStatus, string> = {\n REQUESTED: t('healthybowl.network.experts.consultationStatus.requested', 'REQUESTED'),\n CONFIRMED: t('healthybowl.network.experts.consultationStatus.confirmed', 'CONFIRMED'),\n COMPLETED: t('healthybowl.network.experts.consultationStatus.completed', 'COMPLETED'),\n CANCELLED: t('healthybowl.network.experts.consultationStatus.cancelled', 'CANCELLED'),\n };\n\n const consultationModeLabels: Record<string, string> = {\n video: t('healthybowl.network.experts.modes.video', 'Video call (coming soon)'),\n phone: t('healthybowl.network.experts.modes.phone', 'Phone call'),\n in_person: t('healthybowl.network.experts.modes.inPerson', 'In person'),\n };\n\n const [search, setSearch] = useState('');\n const [specFilter, setSpecFilter] = useState('All');\n const [availFilter, setAvailFilter] = useState('All');\n const [sort, setSort] = useState<SortOption>('rating');\n const [showSortDropdown, setShowSortDropdown] = useState(false);\n const [expandedExpert, setExpandedExpert] = useState<string | null>(null);\n const [bookingExpert, setBookingExpert] = useState<Expert | null>(null);\n const [bookingForm, setBookingForm] = useState<BookingFormState>(emptyBookingForm);\n const [submitting, setSubmitting] = useState(false);\n\n const [showExpertModal, setShowExpertModal] = useState(false);\n const [editingExpert, setEditingExpert] = useState<Expert | null>(null);\n const [expertForm, setExpertForm] = useState<ExpertFormState>(emptyExpertForm);\n const [savingExpert, setSavingExpert] = useState(false);\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [updatingStatusId, setUpdatingStatusId] = useState<string | null>(null);\n\n const expertAvailabilityOptions: { value: ExpertFormState['availability']; label: string }[] = [\n { value: 'available', label: t('healthybowl.network.experts.availability.available', 'available') },\n { value: 'busy', label: t('healthybowl.network.experts.availability.busy', 'busy') },\n { value: 'offline', label: t('healthybowl.network.experts.availability.offline', 'offline') },\n ];\n\n const sortRef = useRef<HTMLDivElement>(null);\n const { toasts, toast, dismiss } = useToast();\n\n const expertConsultations = consultations.filter((c) => c.consultantType === 'EXPERT');\n\n const updateBookingForm = <K extends keyof BookingFormState>(key: K, value: BookingFormState[K]) =>\n setBookingForm((prev) => ({ ...prev, [key]: value }));\n\n const openBooking = (expert: Expert) => {\n setBookingForm(emptyBookingForm);\n setBookingExpert(expert);\n };\n\n const closeBooking = () => {\n setBookingExpert(null);\n setBookingForm(emptyBookingForm);\n };\n\n const updateExpertForm = <K extends keyof ExpertFormState>(key: K, value: ExpertFormState[K]) =>\n setExpertForm((prev) => ({ ...prev, [key]: value }));\n\n const openCreateExpert = () => {\n setEditingExpert(null);\n setExpertForm(emptyExpertForm);\n setShowExpertModal(true);\n };\n\n const openEditExpert = (expert: Expert) => {\n setEditingExpert(expert);\n setExpertForm({\n name: expert.name,\n specialization: expert.specialization,\n experience: String(expert.experience),\n rating: String(expert.rating),\n location: expert.location,\n availability: expert.availability,\n hourlyRate: String(expert.hourlyRate),\n languages: (expert.languages ?? []).join(', '),\n });\n setShowExpertModal(true);\n };\n\n const closeExpertModal = () => {\n setShowExpertModal(false);\n setEditingExpert(null);\n setExpertForm(emptyExpertForm);\n };\n\n const handleSaveExpert = async () => {\n if (!expertForm.name.trim() || !expertForm.specialization.trim() || !expertForm.location.trim()) {\n toast({\n title: t('healthybowl.network.experts.form.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.network.experts.form.toast.missingFields.description',\n 'Name, specialization, and location are required.'\n ),\n variant: 'warning',\n });\n return;\n }\n const languages = expertForm.languages\n .split(',')\n .map((l) => l.trim())\n .filter((l) => l.length > 0);\n setSavingExpert(true);\n try {\n if (editingExpert) {\n await updateExpert({\n id: editingExpert.id,\n name: expertForm.name.trim(),\n specialization: expertForm.specialization.trim(),\n experience: Number(expertForm.experience) || 0,\n rating: Number(expertForm.rating) || 0,\n location: expertForm.location.trim(),\n availability: expertForm.availability,\n hourlyRate: Number(expertForm.hourlyRate) || 0,\n languages,\n });\n toast({\n title: t('healthybowl.network.experts.form.toast.updated.title', 'Expert updated'),\n description: t('healthybowl.network.experts.form.toast.updated.description', '{{name}} has been updated.', {\n name: expertForm.name.trim(),\n }),\n variant: 'success',\n });\n } else {\n await createExpert({\n name: expertForm.name.trim(),\n specialization: expertForm.specialization.trim(),\n experience: Number(expertForm.experience) || 0,\n rating: Number(expertForm.rating) || 0,\n location: expertForm.location.trim(),\n availability: expertForm.availability,\n hourlyRate: Number(expertForm.hourlyRate) || 0,\n languages,\n });\n toast({\n title: t('healthybowl.network.experts.form.toast.created.title', 'Expert added'),\n description: t('healthybowl.network.experts.form.toast.created.description', '{{name}} has been added.', {\n name: expertForm.name.trim(),\n }),\n variant: 'success',\n });\n }\n closeExpertModal();\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.form.toast.saveError.title', 'Could not save expert'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.form.toast.saveError.description', 'Failed to save expert'),\n variant: 'error',\n });\n } finally {\n setSavingExpert(false);\n }\n };\n\n const handleDeleteExpert = async (expert: Expert) => {\n setDeletingId(expert.id);\n try {\n await deleteExpert(expert.id);\n toast({\n title: t('healthybowl.network.experts.form.toast.deleted.title', 'Expert removed'),\n description: t('healthybowl.network.experts.form.toast.deleted.description', '{{name}} has been removed.', {\n name: expert.name,\n }),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.form.toast.deleteError.title', 'Could not remove expert'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.form.toast.deleteError.description', 'Failed to remove expert'),\n variant: 'error',\n });\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBookConsultation = async () => {\n if (!bookingExpert) return;\n if (!bookingForm.topic.trim() || !bookingForm.requestedDate) {\n toast({\n title: t('healthybowl.network.experts.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.network.experts.toast.missingFields.description',\n 'Topic and preferred date are required.'\n ),\n variant: 'warning',\n });\n return;\n }\n setSubmitting(true);\n try {\n await createConsultation({\n consultantType: 'EXPERT',\n consultantId: bookingExpert.id,\n consultantName: bookingExpert.name,\n topic: bookingForm.topic.trim(),\n requestedDate: bookingForm.requestedDate,\n // The mode <select> only offers the three ConsultationMode values.\n mode: bookingForm.mode as ConsultationMode,\n notes: bookingForm.notes.trim() || undefined,\n fee: bookingExpert.hourlyRate,\n });\n toast({\n title: t('healthybowl.network.experts.toast.requested.title', 'Consultation requested'),\n description: t(\n 'healthybowl.network.experts.toast.requested.description',\n 'Your request to {{name}} has been sent.',\n { name: bookingExpert.name }\n ),\n variant: 'success',\n });\n closeBooking();\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.toast.bookFailed.title', 'Could not book consultation'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.toast.bookFailed.description', 'Failed to book consultation'),\n variant: 'error',\n });\n } finally {\n setSubmitting(false);\n }\n };\n\n const handleUpdateStatus = async (id: string, status: ConsultationStatus) => {\n setUpdatingStatusId(id);\n try {\n await updateConsultationStatus({ id, status });\n toast({\n title: t('healthybowl.network.experts.toast.statusUpdated.title', 'Status updated'),\n description: t(\n 'healthybowl.network.experts.toast.statusUpdated.description',\n 'The consultation has been moved to {{status}}.',\n { status: consultationStatusLabels[status] ?? status }\n ),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.toast.statusUpdateError.title', 'Could not update status'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.toast.statusUpdateError.description', 'Failed to update status'),\n variant: 'error',\n });\n } finally {\n setUpdatingStatusId(null);\n }\n };\n\n // Close sort dropdown on outside click\n useEffect(() => {\n const handleClick = (e: MouseEvent) => {\n if (sortRef.current && !sortRef.current.contains(e.target as Node)) {\n setShowSortDropdown(false);\n }\n };\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, []);\n\n // Filter and sort\n const filtered = experts\n .filter((e) => {\n const matchSearch =\n (e.name ?? '').toLowerCase().includes(search.toLowerCase()) ||\n e.specialization.toLowerCase().includes(search.toLowerCase()) ||\n e.location.toLowerCase().includes(search.toLowerCase());\n const matchSpec = specFilter === 'All' || e.specialization === specFilter;\n const matchAvail = availFilter === 'All' || e.availability === availFilter.toLowerCase();\n return matchSearch && matchSpec && matchAvail;\n })\n .sort((a, b) => {\n switch (sort) {\n case 'rating':\n return b.rating - a.rating;\n case 'experience':\n return b.experience - a.experience;\n case 'price-asc':\n return a.hourlyRate - b.hourlyRate;\n case 'price-desc':\n return b.hourlyRate - a.hourlyRate;\n default:\n return 0;\n }\n });\n\n const availableCount = experts.filter((e) => e.availability === 'available').length;\n const avgRating =\n experts.length > 0 ? (experts.reduce((sum, e) => sum + e.rating, 0) / experts.length).toFixed(1) : '0.0';\n const uniqueSpecs = new Set(experts.map((e) => e.specialization)).size;\n\n return (\n <PageLayout\n title={t('healthybowl.network.experts.title', 'Expert Directory')}\n description={t('healthybowl.network.experts.description', 'Find and connect with agricultural experts')}\n purpose=\"Find agricultural specialists — agronomists, vets, soil scientists — and reach out for help. When you hit a problem outside your experience, this directory connects you with someone who knows the answer.\"\n actions={\n <Button onClick={openCreateExpert} size=\"sm\">\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.experts.actions.addExpert', 'Add Expert')}\n </Button>\n }\n >\n {/* Stats */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.network.experts.stats.totalExperts', 'Total Experts')}\n value={experts.length}\n icon={<Award className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.availableNow', 'Available Now')}\n value={availableCount}\n icon={<Zap className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.avgRating', 'Avg Rating')}\n value={avgRating}\n icon={<Star className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.specializations', 'Specializations')}\n value={uniqueSpecs}\n icon={<User className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Filter Bar */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={t(\n 'healthybowl.network.experts.searchPlaceholder',\n 'Search experts by name, specialty, or location...'\n )}\n filters={\n <div className=\"flex flex-wrap items-center gap-2\">\n {/* Specialization filter */}\n <Select value={specFilter} onValueChange={setSpecFilter}>\n <SelectTrigger className=\"h-8 w-auto text-xs\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {specializations.map((s) => (\n <SelectItem key={s} value={s}>\n {specializationLabels[s] ?? s}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {/* Availability filter */}\n <Select value={availFilter} onValueChange={setAvailFilter}>\n <SelectTrigger className=\"h-8 w-auto text-xs\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {availabilityOptions.map((a) => (\n <SelectItem key={a} value={a}>\n {availabilityFilterLabels[a] ?? a}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {/* Sort dropdown */}\n <div ref={sortRef} className=\"relative\">\n <Button onClick={() => setShowSortDropdown((prev) => !prev)} variant=\"outline\" size=\"sm\">\n <ArrowUpDown className=\"h-3.5 w-3.5\" />\n {sortLabels[sort]}\n <ChevronDown className=\"h-3 w-3\" />\n </Button>\n {showSortDropdown && (\n <div className=\"absolute end-0 z-10 mt-1 w-44 rounded-md border border-border-subtle bg-bg-surface py-1 shadow-lg\">\n {sortOrder.map((key) => (\n <button\n key={key}\n type=\"button\"\n onClick={() => {\n setSort(key);\n setShowSortDropdown(false);\n }}\n className={cn(\n 'flex w-full items-center px-3 py-1.5 text-xs hover:bg-bg-sunken',\n sort === key ? 'font-semibold text-primary' : 'text-text-primary'\n )}\n >\n {sortLabels[key]}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n }\n />\n\n {/* Expert Cards */}\n {filtered.length > 0 ? (\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {filtered.map((expert) => {\n const isExpanded = expandedExpert === expert.id;\n return (\n <div\n key={expert.id}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-5 transition-colors hover:border-primary/20\"\n >\n {/* Header */}\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken text-sm font-bold text-text-primary\">\n {(expert.name ?? '')\n .split(' ')\n .map((n) => n[0])\n .join('')}\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">{expert.name}</h3>\n <p className=\"text-xs text-text-secondary\">{expert.specialization}</p>\n </div>\n <StatusBadge\n label={availabilityDisplayLabels[expert.availability] ?? expert.availability}\n variant={availabilityVariant(expert.availability)}\n dot\n />\n </div>\n\n {/* Info */}\n <div className=\"mt-3 space-y-1.5 text-xs text-text-secondary\">\n <p className=\"flex items-center gap-1.5\">\n <Clock className=\"h-3 w-3\" />{' '}\n {t('healthybowl.network.experts.card.yearsExperience', '{{count}} years experience', {\n count: expert.experience,\n })}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"h-3 w-3\" /> {expert.location}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Globe className=\"h-3 w-3\" /> {(expert.languages ?? []).join(', ')}\n </p>\n </div>\n\n {/* Rating */}\n <div className=\"mt-3 flex items-center gap-1\">\n {renderStars(expert.rating)}\n <span className=\"ms-1 text-xs font-medium text-text-primary\">{expert.rating}</span>\n <span className=\"text-xs text-text-secondary\">\n {t('healthybowl.network.experts.card.reviews', '({{count}} reviews)', { count: expert.reviews })}\n </span>\n </div>\n\n {/* Expanded Profile */}\n {isExpanded && (\n <div className=\"mt-3 rounded-md border border-border-subtle bg-bg-sunken/50 p-3\">\n <h4 className=\"text-xs font-semibold text-text-primary\">\n {t('healthybowl.network.experts.card.about', 'About')}\n </h4>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.network.experts.card.aboutText',\n '{{name}} is a seasoned agricultural expert specializing in {{specialization}} with {{count}} years of field and research experience. Known for practical, evidence-based consulting that delivers measurable results.',\n {\n name: expert.name,\n specialization: (expert.specialization ?? '').toLowerCase(),\n count: expert.experience,\n }\n )}\n </p>\n <div className=\"mt-2 grid grid-cols-2 gap-2 text-xs\">\n <div className=\"rounded bg-bg-surface p-2\">\n <p className=\"font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.pastConsultations', 'Past Consultations')}\n </p>\n <p className=\"text-text-secondary\">{expert.reviews * 3}+</p>\n </div>\n <div className=\"rounded bg-bg-surface p-2\">\n <p className=\"font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.avgResponse', 'Avg Response')}\n </p>\n <p className=\"text-text-secondary\">\n {t('healthybowl.network.experts.card.avgResponseValue', '< 2 hours')}\n </p>\n </div>\n </div>\n </div>\n )}\n\n {/* Footer */}\n <div className=\"mt-3 flex items-center justify-between border-t border-border-subtle pt-3\">\n <span className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.pricePerHour', '{{price}}/hr', {\n price: formatCurrency(expert.hourlyRate, HB_DEFAULT_CURRENCY),\n })}\n </span>\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => setExpandedExpert(isExpanded ? null : expert.id)}\n aria-label={t('healthybowl.network.experts.actions.viewProfile', 'View profile')}\n variant=\"outline\"\n size=\"icon-sm\"\n >\n <Eye className=\"h-3.5 w-3.5\" />\n </Button>\n <Button\n onClick={() => openEditExpert(expert)}\n aria-label={t('healthybowl.network.experts.actions.editExpert', 'Edit expert')}\n variant=\"outline\"\n size=\"icon-sm\"\n >\n <Pencil className=\"h-3.5 w-3.5\" />\n </Button>\n <Button\n onClick={() => handleDeleteExpert(expert)}\n disabled={deletingId === expert.id}\n aria-label={t('healthybowl.network.experts.actions.deleteExpert', 'Delete expert')}\n variant=\"ghost\"\n size=\"icon-sm\"\n className=\"text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n </Button>\n <Button onClick={() => openBooking(expert)} size=\"sm\">\n <CalendarCheck className=\"h-3.5 w-3.5\" />{' '}\n {t('healthybowl.network.experts.actions.bookConsultation', 'Book Consultation')}\n </Button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n ) : experts.length === 0 ? (\n loadings.network ? (\n <PageLoader />\n ) : errors.network ? (\n <ErrorState onRetry={refetch} />\n ) : (\n <EmptyState\n illustration=\"empty-people\"\n title={t('healthybowl.network.experts.emptyState.none.title', 'No experts available yet')}\n description={t(\n 'healthybowl.network.experts.emptyState.none.description',\n 'There are no agricultural experts in your network yet. Add one to get started.'\n )}\n action={\n <Button onClick={openCreateExpert}>\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.experts.actions.addExpert', 'Add Expert')}\n </Button>\n }\n />\n )\n ) : (\n <EmptyState\n illustration=\"empty-search\"\n title={t('healthybowl.network.experts.emptyState.noMatch.title', 'No experts found')}\n description={t(\n 'healthybowl.network.experts.emptyState.noMatch.description',\n 'No experts match your current filters. Try broadening your search.'\n )}\n action={\n <Button\n onClick={() => {\n setSearch('');\n setSpecFilter('All');\n setAvailFilter('All');\n }}\n >\n {t('healthybowl.network.experts.actions.clearFilters', 'Clear Filters')}\n </Button>\n }\n />\n )}\n\n {/* My bookings */}\n {expertConsultations.length > 0 && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <CalendarCheck className=\"h-4 w-4\" />{' '}\n {t('healthybowl.network.experts.myConsultations.heading', 'My Expert Consultations')}\n </h3>\n <ul className=\"mt-3 divide-y divide-border\">\n {expertConsultations.map((c) => (\n <li key={c.id} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{c.topic}</p>\n <p className=\"text-xs text-text-secondary\">\n {c.consultantName} &middot; {formatDateOnly(c.requestedDate)} &middot;{' '}\n {consultationModeLabels[c.mode] ?? c.mode}\n </p>\n </div>\n <div className=\"flex flex-shrink-0 items-center gap-2\">\n {c.status === 'REQUESTED' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => handleUpdateStatus(c.id, 'CONFIRMED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.accept', 'Accept')}\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleUpdateStatus(c.id, 'CANCELLED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.decline', 'Decline')}\n </Button>\n </>\n )}\n {c.status === 'CONFIRMED' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => handleUpdateStatus(c.id, 'COMPLETED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.complete', 'Complete')}\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleUpdateStatus(c.id, 'CANCELLED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.cancel', 'Cancel')}\n </Button>\n </>\n )}\n <StatusBadge\n label={consultationStatusLabels[c.status] ?? c.status}\n variant={consultationStatusVariant(c.status)}\n dot\n />\n </div>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Booking Modal */}\n <Modal\n open={bookingExpert !== null}\n onClose={closeBooking}\n title={t('healthybowl.network.experts.bookingModal.title', 'Book Consultation')}\n description={\n bookingExpert\n ? t('healthybowl.network.experts.bookingModal.description', 'Request a session with {{name}}', {\n name: bookingExpert.name,\n })\n : undefined\n }\n footer={\n <>\n <Button onClick={closeBooking} variant=\"outline\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleBookConsultation} disabled={submitting}>\n {submitting\n ? t('healthybowl.network.experts.bookingModal.booking', 'Booking…')\n : t('healthybowl.network.experts.bookingModal.confirm', 'Confirm Booking')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"expert-booking-topic\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.topic.label', 'Topic')}\n </label>\n <input\n id=\"expert-booking-topic\"\n type=\"text\"\n value={bookingForm.topic}\n onChange={(e) => updateBookingForm('topic', e.target.value)}\n maxLength={200}\n placeholder={t(\n 'healthybowl.network.experts.bookingModal.fields.topic.placeholder',\n 'What would you like help with?'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-booking-date\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.preferredDate.label', 'Preferred date')}\n </label>\n <input\n id=\"expert-booking-date\"\n type=\"date\"\n value={bookingForm.requestedDate}\n onChange={(e) => updateBookingForm('requestedDate', e.target.value)}\n min={todayLocalDate()}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-booking-mode\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.mode.label', 'Mode')}\n </label>\n <Select value={bookingForm.mode} onValueChange={(value) => updateBookingForm('mode', value)}>\n <SelectTrigger id=\"expert-booking-mode\" className=\"w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {consultationModes.map((m) => (\n <SelectItem key={m.value} value={m.value}>\n {m.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div>\n <label htmlFor=\"expert-booking-notes\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.notes.label', 'Notes (optional)')}\n </label>\n <textarea\n id=\"expert-booking-notes\"\n value={bookingForm.notes}\n onChange={(e) => updateBookingForm('notes', e.target.value)}\n rows={3}\n maxLength={1000}\n placeholder={t(\n 'healthybowl.network.experts.bookingModal.fields.notes.placeholder',\n 'Any additional context for the expert'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n {bookingExpert && (\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.network.experts.bookingModal.estimatedFee', 'Estimated fee:')}{' '}\n <span className=\"font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.pricePerHour', '{{price}}/hr', {\n price: formatCurrency(bookingExpert.hourlyRate, HB_DEFAULT_CURRENCY),\n })}\n </span>\n </p>\n )}\n </div>\n </Modal>\n\n {/* Add / Edit Expert Modal */}\n <Modal\n open={showExpertModal}\n onClose={closeExpertModal}\n title={\n editingExpert\n ? t('healthybowl.network.experts.form.editTitle', 'Edit Expert')\n : t('healthybowl.network.experts.form.addTitle', 'Add Expert')\n }\n description={t('healthybowl.network.experts.form.description', 'Manage an expert in your network directory')}\n size=\"lg\"\n footer={\n <>\n <Button onClick={closeExpertModal} variant=\"outline\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleSaveExpert} disabled={savingExpert}>\n {savingExpert\n ? t('healthybowl.network.experts.form.saving', 'Saving…')\n : t('healthybowl.network.experts.form.save', 'Save Expert')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-form-name\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.name.label', 'Name')}\n </label>\n <input\n id=\"expert-form-name\"\n type=\"text\"\n value={expertForm.name}\n onChange={(e) => updateExpertForm('name', e.target.value)}\n maxLength={120}\n placeholder={t('healthybowl.network.experts.form.fields.name.placeholder', 'Full name')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-specialization\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.specialization.label', 'Specialization')}\n </label>\n <input\n id=\"expert-form-specialization\"\n type=\"text\"\n value={expertForm.specialization}\n onChange={(e) => updateExpertForm('specialization', e.target.value)}\n maxLength={120}\n placeholder={t(\n 'healthybowl.network.experts.form.fields.specialization.placeholder',\n 'e.g. Soil Science & Fertility'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"expert-form-experience\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.experience.label', 'Experience (years)')}\n </label>\n <input\n id=\"expert-form-experience\"\n type=\"number\"\n min={0}\n value={expertForm.experience}\n onChange={(e) => updateExpertForm('experience', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-rating\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.rating.label', 'Rating')}\n </label>\n <input\n id=\"expert-form-rating\"\n type=\"number\"\n min={0}\n max={5}\n step={0.1}\n value={expertForm.rating}\n onChange={(e) => updateExpertForm('rating', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-rate\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.hourlyRate.label', 'Hourly rate')}\n </label>\n <input\n id=\"expert-form-rate\"\n type=\"number\"\n min={0}\n step={0.01}\n value={expertForm.hourlyRate}\n onChange={(e) => updateExpertForm('hourlyRate', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-form-location\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.location.label', 'Location')}\n </label>\n <input\n id=\"expert-form-location\"\n type=\"text\"\n value={expertForm.location}\n onChange={(e) => updateExpertForm('location', e.target.value)}\n maxLength={120}\n placeholder={t('healthybowl.network.experts.form.fields.location.placeholder', 'City, Region')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-availability\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.availability.label', 'Availability')}\n </label>\n <Select\n value={expertForm.availability}\n onValueChange={(value) => updateExpertForm('availability', value as ExpertFormState['availability'])}\n >\n <SelectTrigger id=\"expert-form-availability\" className=\"w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {expertAvailabilityOptions.map((o) => (\n <SelectItem key={o.value} value={o.value}>\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div>\n <label htmlFor=\"expert-form-languages\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.languages.label', 'Languages')}\n </label>\n <input\n id=\"expert-form-languages\"\n type=\"text\"\n value={expertForm.languages}\n onChange={(e) => updateExpertForm('languages', e.target.value)}\n placeholder={t('healthybowl.network.experts.form.fields.languages.placeholder', 'English, Hindi, Tamil')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t('healthybowl.network.experts.form.fields.languages.hint', 'Separate multiple languages with commas')}\n </p>\n </div>\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,IAAM,IAAqC;CACzC,OAAO;CACP,eAAe;CACf,MAAM;CACN,OAAO;AACT,GAaM,IAAmC;CACvC,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,UAAU;CACV,cAAc;CACd,YAAY;CACZ,WAAW;AACb,GAEM,MAA6B,MAA0B;CAC3D,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,a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MAAM,EAAiB,YAAY,EAAE,OAAO,KAAK;QAC5D,WAAW;QACX,aAAa,EAAE,gEAAgE,cAAc;QAC7F,WAAU;OACX,CAAA,CACE,EAAA,CAAA,GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;QAAO,SAAQ;QAA2B,WAAU;kBACjD,EAAE,8DAA8D,cAAc;OAC1E,CAAA,GACP,kBAAC,GAAD;QACE,OAAO,EAAW;QAClB,gBAAgB,MAAU,EAAiB,gBAAgB,CAAwC;kBAFrG,CAIE,kBAAC,GAAD;SAAe,IAAG;SAA2B,WAAU;mBACrD,kBAAC,GAAD,CAAc,CAAA;QACD,CAAA,GACf,kBAAC,GAAD,EAAA,UACG,GAA0B,KAAK,MAC9B,kBAAC,GAAD;SAA0B,OAAO,EAAE;mBAChC,EAAE;QACO,GAFK,EAAE,KAEP,CACb,EACY,CAAA,CACT;SACL,EAAA,CAAA,CACF;;MACL,kBAAC,OAAD,EAAA,UAAA;OACE,kBAAC,SAAD;QAAO,SAAQ;QAAwB,WAAU;kBAC9C,EAAE,2DAA2D,WAAW;OACpE,CAAA;OACP,kBAAC,SAAD;QACE,IAAG;QACH,MAAK;QACL,OAAO,EAAW;QAClB,WAAW,MAAM,EAAiB,aAAa,EAAE,OAAO,KAAK;QAC7D,aAAa,EAAE,iEAAiE,uBAAuB;QACvG,WAAU;OACX,CAAA;OACD,kBAAC,KAAD;QAAG,WAAU;kBACV,EAAE,0DAA0D,yCAAyC;OACrG,CAAA;MACA,EAAA,CAAA;KACF;;GACA,CAAA;GAEP,kBAAC,IAAD;IAAwB;IAAQ,WAAW;GAAU,CAAA;EAC3C;;AAEhB"}
1
+ {"version":3,"file":"ExpertsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/network/ExpertsPage.tsx"],"sourcesContent":["import { useState, useRef, useEffect, type FC } from 'react';\nimport {\n Star,\n MapPin,\n Clock,\n Globe,\n Award,\n ArrowUpDown,\n ChevronDown,\n Eye,\n User,\n Zap,\n CalendarCheck,\n Plus,\n Pencil,\n Trash2,\n Wallet,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n FilterBar,\n StatusBadge,\n EmptyState,\n ErrorState,\n PageLoader,\n Modal,\n} from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useToast } from '../../hooks/useToast';\nimport { useConsultationPayments } from '../../hooks/useConsultationPayments';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport type {\n Consultation,\n ConsultationPaymentStatus,\n ConsultationStatus,\n ConsultationMode,\n Expert,\n} from '../../types';\nimport { cn, formatCurrency, HB_DEFAULT_CURRENCY, formatDateOnly, todayLocalDate } from '../../utils/helpers';\n\ntype BookingFormState = {\n topic: string;\n requestedDate: string;\n mode: string;\n notes: string;\n};\n\n// Video consultations are not yet wired to a live provider, so default to\n// phone and do not offer video as a bookable mode until BOFF-4719 is built.\nconst emptyBookingForm: BookingFormState = {\n topic: '',\n requestedDate: '',\n mode: 'phone',\n notes: '',\n};\n\ntype ExpertFormState = {\n name: string;\n specialization: string;\n experience: string;\n rating: string;\n location: string;\n availability: 'available' | 'busy' | 'offline';\n hourlyRate: string;\n languages: string;\n};\n\nconst emptyExpertForm: ExpertFormState = {\n name: '',\n specialization: '',\n experience: '',\n rating: '',\n location: '',\n availability: 'available',\n hourlyRate: '',\n languages: '',\n};\n\nconst consultationStatusVariant = (s: ConsultationStatus) => {\n switch (s) {\n case 'CONFIRMED':\n return 'success' as const;\n case 'COMPLETED':\n return 'info' as const;\n case 'CANCELLED':\n return 'muted' as const;\n case 'REQUESTED':\n default:\n return 'warning' as const;\n }\n};\n\nconst consultationPaymentVariant = (s: ConsultationPaymentStatus) => {\n switch (s) {\n case 'PAID':\n return 'success' as const;\n case 'REFUNDED':\n return 'error' as const;\n case 'PENDING':\n default:\n return 'warning' as const;\n }\n};\n\nconst specializations = [\n 'All',\n 'Organic Crop Science',\n 'Integrated Pest Management',\n 'Soil Science & Fertility',\n 'Livestock & Veterinary',\n 'Organic Certification',\n];\nconst availabilityOptions = ['All', 'Available', 'Busy'];\n\ntype SortOption = 'rating' | 'experience' | 'price-asc' | 'price-desc';\nconst sortOrder: SortOption[] = ['rating', 'experience', 'price-asc', 'price-desc'];\n\nconst availabilityVariant = (a: string) => {\n switch (a) {\n case 'available':\n return 'success' as const;\n case 'busy':\n return 'warning' as const;\n case 'offline':\n return 'muted' as const;\n default:\n return 'default' as const;\n }\n};\n\nfunction renderStars(rating: number) {\n return Array.from({ length: 5 }, (_, i) => (\n <Star key={i} className={cn('h-3.5 w-3.5', i < Math.round(rating) ? 'fill-warning text-warning' : 'text-muted')} />\n ));\n}\n\nexport const ExpertsPage: FC = () => {\n const { t } = useI18n();\n const {\n experts,\n consultations,\n createConsultation,\n updateConsultationStatus,\n createExpert,\n updateExpert,\n deleteExpert,\n errors,\n loadings,\n refetch,\n } = useHealthyBowlData();\n const { checkoutConsultation, syncConsultationPayment, loadRazorpay } = useConsultationPayments();\n\n // Video mode is intentionally omitted from the booking dropdown until the\n // video provider integration is implemented (BOFF-4719). Existing video\n // requests are still displayed with the \"coming soon\" label below.\n const consultationModes = [\n { value: 'phone', label: t('healthybowl.network.experts.modes.phone', 'Phone call') },\n { value: 'in_person', label: t('healthybowl.network.experts.modes.inPerson', 'In person') },\n ];\n\n const sortLabels: Record<SortOption, string> = {\n rating: t('healthybowl.network.experts.sort.rating', 'Rating'),\n experience: t('healthybowl.network.experts.sort.experience', 'Experience'),\n 'price-asc': t('healthybowl.network.experts.sort.priceAsc', 'Price: Low → High'),\n 'price-desc': t('healthybowl.network.experts.sort.priceDesc', 'Price: High → Low'),\n };\n\n const specializationLabels: Record<string, string> = {\n All: t('healthybowl.common.all', 'All'),\n 'Organic Crop Science': t('healthybowl.network.experts.specializations.organicCropScience', 'Organic Crop Science'),\n 'Integrated Pest Management': t(\n 'healthybowl.network.experts.specializations.integratedPestManagement',\n 'Integrated Pest Management'\n ),\n 'Soil Science & Fertility': t(\n 'healthybowl.network.experts.specializations.soilScienceFertility',\n 'Soil Science & Fertility'\n ),\n 'Livestock & Veterinary': t(\n 'healthybowl.network.experts.specializations.livestockVeterinary',\n 'Livestock & Veterinary'\n ),\n 'Organic Certification': t(\n 'healthybowl.network.experts.specializations.organicCertification',\n 'Organic Certification'\n ),\n };\n\n const availabilityFilterLabels: Record<string, string> = {\n All: t('healthybowl.common.all', 'All'),\n Available: t('healthybowl.network.experts.availabilityFilter.available', 'Available'),\n Busy: t('healthybowl.network.experts.availabilityFilter.busy', 'Busy'),\n };\n\n const availabilityDisplayLabels: Record<string, string> = {\n available: t('healthybowl.network.experts.availability.available', 'available'),\n busy: t('healthybowl.network.experts.availability.busy', 'busy'),\n offline: t('healthybowl.network.experts.availability.offline', 'offline'),\n };\n\n const consultationStatusLabels: Record<ConsultationStatus, string> = {\n REQUESTED: t('healthybowl.network.experts.consultationStatus.requested', 'REQUESTED'),\n CONFIRMED: t('healthybowl.network.experts.consultationStatus.confirmed', 'CONFIRMED'),\n COMPLETED: t('healthybowl.network.experts.consultationStatus.completed', 'COMPLETED'),\n CANCELLED: t('healthybowl.network.experts.consultationStatus.cancelled', 'CANCELLED'),\n };\n\n const consultationPaymentStatusLabels: Record<ConsultationPaymentStatus, string> = {\n PENDING: t('healthybowl.network.experts.paymentStatus.pending', 'Payment pending'),\n PAID: t('healthybowl.network.experts.paymentStatus.paid', 'Paid'),\n REFUNDED: t('healthybowl.network.experts.paymentStatus.refunded', 'Refunded'),\n };\n\n const consultationModeLabels: Record<string, string> = {\n video: t('healthybowl.network.experts.modes.video', 'Video call (coming soon)'),\n phone: t('healthybowl.network.experts.modes.phone', 'Phone call'),\n in_person: t('healthybowl.network.experts.modes.inPerson', 'In person'),\n };\n\n const [search, setSearch] = useState('');\n const [specFilter, setSpecFilter] = useState('All');\n const [availFilter, setAvailFilter] = useState('All');\n const [sort, setSort] = useState<SortOption>('rating');\n const [showSortDropdown, setShowSortDropdown] = useState(false);\n const [expandedExpert, setExpandedExpert] = useState<string | null>(null);\n const [bookingExpert, setBookingExpert] = useState<Expert | null>(null);\n const [bookingForm, setBookingForm] = useState<BookingFormState>(emptyBookingForm);\n const [submitting, setSubmitting] = useState(false);\n\n const [showExpertModal, setShowExpertModal] = useState(false);\n const [editingExpert, setEditingExpert] = useState<Expert | null>(null);\n const [expertForm, setExpertForm] = useState<ExpertFormState>(emptyExpertForm);\n const [savingExpert, setSavingExpert] = useState(false);\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [updatingStatusId, setUpdatingStatusId] = useState<string | null>(null);\n // Several consultations can be paid concurrently; model each widget rather than letting one\n // checkout clobber another card's loading state. The ref closes the same-render double-click\n // window before React has committed the button's disabled state.\n const [payingIds, setPayingIds] = useState<ReadonlySet<string>>(() => new Set());\n const payingIdsRef = useRef(new Set<string>());\n\n const beginConsultationPayment = (consultationId: string): boolean => {\n if (payingIdsRef.current.has(consultationId)) return false;\n payingIdsRef.current.add(consultationId);\n setPayingIds(new Set(payingIdsRef.current));\n return true;\n };\n\n const finishConsultationPayment = (consultationId: string): void => {\n payingIdsRef.current.delete(consultationId);\n setPayingIds(new Set(payingIdsRef.current));\n };\n\n const expertAvailabilityOptions: { value: ExpertFormState['availability']; label: string }[] = [\n { value: 'available', label: t('healthybowl.network.experts.availability.available', 'available') },\n { value: 'busy', label: t('healthybowl.network.experts.availability.busy', 'busy') },\n { value: 'offline', label: t('healthybowl.network.experts.availability.offline', 'offline') },\n ];\n\n const sortRef = useRef<HTMLDivElement>(null);\n const { toasts, toast, dismiss } = useToast();\n\n const expertConsultations = consultations.filter((c) => c.consultantType === 'EXPERT');\n\n const updateBookingForm = <K extends keyof BookingFormState>(key: K, value: BookingFormState[K]) =>\n setBookingForm((prev) => ({ ...prev, [key]: value }));\n\n const openBooking = (expert: Expert) => {\n setBookingForm(emptyBookingForm);\n setBookingExpert(expert);\n };\n\n const closeBooking = () => {\n setBookingExpert(null);\n setBookingForm(emptyBookingForm);\n };\n\n const updateExpertForm = <K extends keyof ExpertFormState>(key: K, value: ExpertFormState[K]) =>\n setExpertForm((prev) => ({ ...prev, [key]: value }));\n\n const openCreateExpert = () => {\n setEditingExpert(null);\n setExpertForm(emptyExpertForm);\n setShowExpertModal(true);\n };\n\n const openEditExpert = (expert: Expert) => {\n setEditingExpert(expert);\n setExpertForm({\n name: expert.name,\n specialization: expert.specialization,\n experience: String(expert.experience),\n rating: String(expert.rating),\n location: expert.location,\n availability: expert.availability,\n hourlyRate: String(expert.hourlyRate),\n languages: (expert.languages ?? []).join(', '),\n });\n setShowExpertModal(true);\n };\n\n const closeExpertModal = () => {\n setShowExpertModal(false);\n setEditingExpert(null);\n setExpertForm(emptyExpertForm);\n };\n\n const handleSaveExpert = async () => {\n if (!expertForm.name.trim() || !expertForm.specialization.trim() || !expertForm.location.trim()) {\n toast({\n title: t('healthybowl.network.experts.form.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.network.experts.form.toast.missingFields.description',\n 'Name, specialization, and location are required.'\n ),\n variant: 'warning',\n });\n return;\n }\n const languages = expertForm.languages\n .split(',')\n .map((l) => l.trim())\n .filter((l) => l.length > 0);\n setSavingExpert(true);\n try {\n if (editingExpert) {\n await updateExpert({\n id: editingExpert.id,\n name: expertForm.name.trim(),\n specialization: expertForm.specialization.trim(),\n experience: Number(expertForm.experience) || 0,\n rating: Number(expertForm.rating) || 0,\n location: expertForm.location.trim(),\n availability: expertForm.availability,\n hourlyRate: Number(expertForm.hourlyRate) || 0,\n languages,\n });\n toast({\n title: t('healthybowl.network.experts.form.toast.updated.title', 'Expert updated'),\n description: t('healthybowl.network.experts.form.toast.updated.description', '{{name}} has been updated.', {\n name: expertForm.name.trim(),\n }),\n variant: 'success',\n });\n } else {\n await createExpert({\n name: expertForm.name.trim(),\n specialization: expertForm.specialization.trim(),\n experience: Number(expertForm.experience) || 0,\n rating: Number(expertForm.rating) || 0,\n location: expertForm.location.trim(),\n availability: expertForm.availability,\n hourlyRate: Number(expertForm.hourlyRate) || 0,\n languages,\n });\n toast({\n title: t('healthybowl.network.experts.form.toast.created.title', 'Expert added'),\n description: t('healthybowl.network.experts.form.toast.created.description', '{{name}} has been added.', {\n name: expertForm.name.trim(),\n }),\n variant: 'success',\n });\n }\n closeExpertModal();\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.form.toast.saveError.title', 'Could not save expert'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.form.toast.saveError.description', 'Failed to save expert'),\n variant: 'error',\n });\n } finally {\n setSavingExpert(false);\n }\n };\n\n const handleDeleteExpert = async (expert: Expert) => {\n setDeletingId(expert.id);\n try {\n await deleteExpert(expert.id);\n toast({\n title: t('healthybowl.network.experts.form.toast.deleted.title', 'Expert removed'),\n description: t('healthybowl.network.experts.form.toast.deleted.description', '{{name}} has been removed.', {\n name: expert.name,\n }),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.form.toast.deleteError.title', 'Could not remove expert'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.form.toast.deleteError.description', 'Failed to remove expert'),\n variant: 'error',\n });\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBookConsultation = async () => {\n if (!bookingExpert) return;\n if (!bookingForm.topic.trim() || !bookingForm.requestedDate) {\n toast({\n title: t('healthybowl.network.experts.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.network.experts.toast.missingFields.description',\n 'Topic and preferred date are required.'\n ),\n variant: 'warning',\n });\n return;\n }\n setSubmitting(true);\n try {\n await createConsultation({\n consultantType: 'EXPERT',\n consultantId: bookingExpert.id,\n consultantName: bookingExpert.name,\n topic: bookingForm.topic.trim(),\n requestedDate: bookingForm.requestedDate,\n // The mode <select> only offers the three ConsultationMode values.\n mode: bookingForm.mode as ConsultationMode,\n notes: bookingForm.notes.trim() || undefined,\n fee: bookingExpert.hourlyRate,\n });\n toast({\n title: t('healthybowl.network.experts.toast.requested.title', 'Consultation requested'),\n description: t(\n 'healthybowl.network.experts.toast.requested.description',\n 'Your request to {{name}} has been sent.',\n { name: bookingExpert.name }\n ),\n variant: 'success',\n });\n closeBooking();\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.toast.bookFailed.title', 'Could not book consultation'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.toast.bookFailed.description', 'Failed to book consultation'),\n variant: 'error',\n });\n } finally {\n setSubmitting(false);\n }\n };\n\n const handleUpdateStatus = async (id: string, status: ConsultationStatus) => {\n setUpdatingStatusId(id);\n try {\n await updateConsultationStatus({ id, status });\n toast({\n title: t('healthybowl.network.experts.toast.statusUpdated.title', 'Status updated'),\n description: t(\n 'healthybowl.network.experts.toast.statusUpdated.description',\n 'The consultation has been moved to {{status}}.',\n { status: consultationStatusLabels[status] ?? status }\n ),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.toast.statusUpdateError.title', 'Could not update status'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.experts.toast.statusUpdateError.description', 'Failed to update status'),\n variant: 'error',\n });\n } finally {\n setUpdatingStatusId(null);\n }\n };\n\n /** Settle only through the server, which re-reads the authoritative platform-billing Payment. */\n const settleConsultationPayment = async (consultation: Consultation) => {\n try {\n const settled = await syncConsultationPayment(consultation.id);\n // The settlement result is authoritative; a failed list refresh must not make a confirmed\n // payment look like a failure.\n await refetch().catch(() => undefined);\n\n if (settled.paymentStatus === 'PAID') {\n toast({\n title: t('healthybowl.network.experts.payment.toast.paid.title', 'Payment confirmed'),\n description: settled.paymentReference\n ? t(\n 'healthybowl.network.experts.payment.toast.paid.withReference',\n 'Your consultation payment is confirmed — reference {{reference}}.',\n { reference: settled.paymentReference }\n )\n : t(\n 'healthybowl.network.experts.payment.toast.paid.description',\n 'Your consultation payment is confirmed.'\n ),\n variant: 'success',\n });\n } else {\n toast({\n title: t('healthybowl.network.experts.payment.toast.pending.title', 'Payment not completed'),\n description: t(\n 'healthybowl.network.experts.payment.toast.pending.description',\n 'This consultation is still awaiting payment. Nothing was charged — you can pay again any time.'\n ),\n variant: 'info',\n });\n }\n } finally {\n finishConsultationPayment(consultation.id);\n }\n };\n\n /**\n * Opens Razorpay using billing's runtime checkout details. Razorpay may call both `handler` and\n * `ondismiss` after a successful payment, so both routes share the one-shot settlement guard.\n */\n const handlePayNow = async (consultation: Consultation) => {\n if (!beginConsultationPayment(consultation.id)) return;\n let widgetOpened = false;\n\n try {\n const checkout = await checkoutConsultation(consultation.id);\n if (checkout.provider !== 'RAZORPAY') {\n toast({\n title: t(\n 'healthybowl.network.experts.payment.toast.unsupportedProvider.title',\n 'Unsupported payment provider'\n ),\n description: t(\n 'healthybowl.network.experts.payment.toast.unsupportedProvider.description',\n 'Billing routed this consultation to {{provider}}, which this checkout cannot open yet. Contact support for help.',\n { provider: checkout.provider }\n ),\n variant: 'warning',\n });\n return;\n }\n if (!checkout.providerOrderId || !checkout.razorpayKeyId) {\n toast({\n title: t('healthybowl.network.experts.payment.toast.checkoutIncomplete.title', 'Payment session incomplete'),\n description: t(\n 'healthybowl.network.experts.payment.toast.checkoutIncomplete.description',\n 'Billing did not return the details needed to open checkout. Please try again.'\n ),\n variant: 'error',\n });\n return;\n }\n\n const Razorpay = await loadRazorpay();\n let settleRequested = false;\n const settleOnce = () => {\n if (settleRequested) return;\n settleRequested = true;\n // Razorpay does not await event callbacks. Handle the promise explicitly so an unexpected\n // settlement failure cannot turn into an unhandled rejection.\n void settleConsultationPayment(consultation).catch((err: unknown) => {\n toast({\n title: t('healthybowl.network.experts.payment.toast.syncError.title', 'Could not confirm the payment'),\n description: err instanceof Error ? err.message : t('healthybowl.common.error', 'Unknown error'),\n variant: 'error',\n });\n });\n };\n\n const widget = new Razorpay({\n key: checkout.razorpayKeyId,\n order_id: checkout.providerOrderId,\n // Razorpay takes paise (the smallest INR unit), not whole rupees.\n amount: Math.round(checkout.total * 100),\n currency: checkout.currency,\n name: 'HealthyBowl',\n description: t('healthybowl.network.experts.payment.checkoutDescription', 'Consultation: {{topic}}', {\n topic: consultation.topic,\n }),\n // The provider response is not trusted. Both paths ask the backend to settle against billing.\n handler: settleOnce,\n modal: { ondismiss: settleOnce },\n });\n widget.open();\n widgetOpened = true;\n } catch (err) {\n toast({\n title: t('healthybowl.network.experts.payment.toast.checkoutError.title', 'Could not start the payment'),\n description: err instanceof Error ? err.message : t('healthybowl.common.error', 'Unknown error'),\n variant: 'error',\n });\n } finally {\n // The open widget clears this via settleOnce. Every early-return or error path clears it here.\n if (!widgetOpened) {\n finishConsultationPayment(consultation.id);\n }\n }\n };\n\n // Close sort dropdown on outside click\n useEffect(() => {\n const handleClick = (e: MouseEvent) => {\n if (sortRef.current && !sortRef.current.contains(e.target as Node)) {\n setShowSortDropdown(false);\n }\n };\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, []);\n\n // Filter and sort\n const filtered = experts\n .filter((e) => {\n const matchSearch =\n (e.name ?? '').toLowerCase().includes(search.toLowerCase()) ||\n e.specialization.toLowerCase().includes(search.toLowerCase()) ||\n e.location.toLowerCase().includes(search.toLowerCase());\n const matchSpec = specFilter === 'All' || e.specialization === specFilter;\n const matchAvail = availFilter === 'All' || e.availability === availFilter.toLowerCase();\n return matchSearch && matchSpec && matchAvail;\n })\n .sort((a, b) => {\n switch (sort) {\n case 'rating':\n return b.rating - a.rating;\n case 'experience':\n return b.experience - a.experience;\n case 'price-asc':\n return a.hourlyRate - b.hourlyRate;\n case 'price-desc':\n return b.hourlyRate - a.hourlyRate;\n default:\n return 0;\n }\n });\n\n const availableCount = experts.filter((e) => e.availability === 'available').length;\n const avgRating =\n experts.length > 0 ? (experts.reduce((sum, e) => sum + e.rating, 0) / experts.length).toFixed(1) : '0.0';\n const uniqueSpecs = new Set(experts.map((e) => e.specialization)).size;\n\n return (\n <PageLayout\n title={t('healthybowl.network.experts.title', 'Expert Directory')}\n description={t('healthybowl.network.experts.description', 'Find and connect with agricultural experts')}\n purpose=\"Find agricultural specialists — agronomists, vets, soil scientists — and reach out for help. When you hit a problem outside your experience, this directory connects you with someone who knows the answer.\"\n actions={\n <Button onClick={openCreateExpert} size=\"sm\">\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.experts.actions.addExpert', 'Add Expert')}\n </Button>\n }\n >\n {/* Stats */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.network.experts.stats.totalExperts', 'Total Experts')}\n value={experts.length}\n icon={<Award className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.availableNow', 'Available Now')}\n value={availableCount}\n icon={<Zap className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.avgRating', 'Avg Rating')}\n value={avgRating}\n icon={<Star className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.experts.stats.specializations', 'Specializations')}\n value={uniqueSpecs}\n icon={<User className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Filter Bar */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={t(\n 'healthybowl.network.experts.searchPlaceholder',\n 'Search experts by name, specialty, or location...'\n )}\n filters={\n <div className=\"flex flex-wrap items-center gap-2\">\n {/* Specialization filter */}\n <Select value={specFilter} onValueChange={setSpecFilter}>\n <SelectTrigger className=\"h-8 w-auto text-xs\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {specializations.map((s) => (\n <SelectItem key={s} value={s}>\n {specializationLabels[s] ?? s}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {/* Availability filter */}\n <Select value={availFilter} onValueChange={setAvailFilter}>\n <SelectTrigger className=\"h-8 w-auto text-xs\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {availabilityOptions.map((a) => (\n <SelectItem key={a} value={a}>\n {availabilityFilterLabels[a] ?? a}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {/* Sort dropdown */}\n <div ref={sortRef} className=\"relative\">\n <Button onClick={() => setShowSortDropdown((prev) => !prev)} variant=\"outline\" size=\"sm\">\n <ArrowUpDown className=\"h-3.5 w-3.5\" />\n {sortLabels[sort]}\n <ChevronDown className=\"h-3 w-3\" />\n </Button>\n {showSortDropdown && (\n <div className=\"absolute end-0 z-10 mt-1 w-44 rounded-md border border-border-subtle bg-bg-surface py-1 shadow-lg\">\n {sortOrder.map((key) => (\n <button\n key={key}\n type=\"button\"\n onClick={() => {\n setSort(key);\n setShowSortDropdown(false);\n }}\n className={cn(\n 'flex w-full items-center px-3 py-1.5 text-xs hover:bg-bg-sunken',\n sort === key ? 'font-semibold text-primary' : 'text-text-primary'\n )}\n >\n {sortLabels[key]}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n }\n />\n\n {/* Expert Cards */}\n {filtered.length > 0 ? (\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {filtered.map((expert) => {\n const isExpanded = expandedExpert === expert.id;\n return (\n <div\n key={expert.id}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-5 transition-colors hover:border-primary/20\"\n >\n {/* Header */}\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken text-sm font-bold text-text-primary\">\n {(expert.name ?? '')\n .split(' ')\n .map((n) => n[0])\n .join('')}\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">{expert.name}</h3>\n <p className=\"text-xs text-text-secondary\">{expert.specialization}</p>\n </div>\n <StatusBadge\n label={availabilityDisplayLabels[expert.availability] ?? expert.availability}\n variant={availabilityVariant(expert.availability)}\n dot\n />\n </div>\n\n {/* Info */}\n <div className=\"mt-3 space-y-1.5 text-xs text-text-secondary\">\n <p className=\"flex items-center gap-1.5\">\n <Clock className=\"h-3 w-3\" />{' '}\n {t('healthybowl.network.experts.card.yearsExperience', '{{count}} years experience', {\n count: expert.experience,\n })}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"h-3 w-3\" /> {expert.location}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Globe className=\"h-3 w-3\" /> {(expert.languages ?? []).join(', ')}\n </p>\n </div>\n\n {/* Rating */}\n <div className=\"mt-3 flex items-center gap-1\">\n {renderStars(expert.rating)}\n <span className=\"ms-1 text-xs font-medium text-text-primary\">{expert.rating}</span>\n <span className=\"text-xs text-text-secondary\">\n {t('healthybowl.network.experts.card.reviews', '({{count}} reviews)', { count: expert.reviews })}\n </span>\n </div>\n\n {/* Expanded Profile */}\n {isExpanded && (\n <div className=\"mt-3 rounded-md border border-border-subtle bg-bg-sunken/50 p-3\">\n <h4 className=\"text-xs font-semibold text-text-primary\">\n {t('healthybowl.network.experts.card.about', 'About')}\n </h4>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.network.experts.card.aboutText',\n '{{name}} is a seasoned agricultural expert specializing in {{specialization}} with {{count}} years of field and research experience. Known for practical, evidence-based consulting that delivers measurable results.',\n {\n name: expert.name,\n specialization: (expert.specialization ?? '').toLowerCase(),\n count: expert.experience,\n }\n )}\n </p>\n <div className=\"mt-2 grid grid-cols-2 gap-2 text-xs\">\n <div className=\"rounded bg-bg-surface p-2\">\n <p className=\"font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.pastConsultations', 'Past Consultations')}\n </p>\n <p className=\"text-text-secondary\">{expert.reviews * 3}+</p>\n </div>\n <div className=\"rounded bg-bg-surface p-2\">\n <p className=\"font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.avgResponse', 'Avg Response')}\n </p>\n <p className=\"text-text-secondary\">\n {t('healthybowl.network.experts.card.avgResponseValue', '< 2 hours')}\n </p>\n </div>\n </div>\n </div>\n )}\n\n {/* Footer */}\n <div className=\"mt-3 flex items-center justify-between border-t border-border-subtle pt-3\">\n <span className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.network.experts.card.pricePerHour', '{{price}}/hr', {\n price: formatCurrency(expert.hourlyRate, HB_DEFAULT_CURRENCY),\n })}\n </span>\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => setExpandedExpert(isExpanded ? null : expert.id)}\n aria-label={t('healthybowl.network.experts.actions.viewProfile', 'View profile')}\n variant=\"outline\"\n size=\"icon-sm\"\n >\n <Eye className=\"h-3.5 w-3.5\" />\n </Button>\n <Button\n onClick={() => openEditExpert(expert)}\n aria-label={t('healthybowl.network.experts.actions.editExpert', 'Edit expert')}\n variant=\"outline\"\n size=\"icon-sm\"\n >\n <Pencil className=\"h-3.5 w-3.5\" />\n </Button>\n <Button\n onClick={() => handleDeleteExpert(expert)}\n disabled={deletingId === expert.id}\n aria-label={t('healthybowl.network.experts.actions.deleteExpert', 'Delete expert')}\n variant=\"ghost\"\n size=\"icon-sm\"\n className=\"text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n </Button>\n <Button onClick={() => openBooking(expert)} size=\"sm\">\n <CalendarCheck className=\"h-3.5 w-3.5\" />{' '}\n {t('healthybowl.network.experts.actions.bookConsultation', 'Book Consultation')}\n </Button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n ) : experts.length === 0 ? (\n loadings.network ? (\n <PageLoader />\n ) : errors.network ? (\n <ErrorState onRetry={refetch} />\n ) : (\n <EmptyState\n illustration=\"empty-people\"\n title={t('healthybowl.network.experts.emptyState.none.title', 'No experts available yet')}\n description={t(\n 'healthybowl.network.experts.emptyState.none.description',\n 'There are no agricultural experts in your network yet. Add one to get started.'\n )}\n action={\n <Button onClick={openCreateExpert}>\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.experts.actions.addExpert', 'Add Expert')}\n </Button>\n }\n />\n )\n ) : (\n <EmptyState\n illustration=\"empty-search\"\n title={t('healthybowl.network.experts.emptyState.noMatch.title', 'No experts found')}\n description={t(\n 'healthybowl.network.experts.emptyState.noMatch.description',\n 'No experts match your current filters. Try broadening your search.'\n )}\n action={\n <Button\n onClick={() => {\n setSearch('');\n setSpecFilter('All');\n setAvailFilter('All');\n }}\n >\n {t('healthybowl.network.experts.actions.clearFilters', 'Clear Filters')}\n </Button>\n }\n />\n )}\n\n {/* My bookings */}\n {expertConsultations.length > 0 && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <CalendarCheck className=\"h-4 w-4\" />{' '}\n {t('healthybowl.network.experts.myConsultations.heading', 'My Expert Consultations')}\n </h3>\n <ul className=\"mt-3 divide-y divide-border\">\n {expertConsultations.map((c) => (\n <li key={c.id} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{c.topic}</p>\n <p className=\"text-xs text-text-secondary\">\n {c.consultantName} &middot; {formatDateOnly(c.requestedDate)} &middot;{' '}\n {consultationModeLabels[c.mode] ?? c.mode}\n </p>\n {c.fee > 0 && c.paymentStatus === 'PAID' && c.paymentReference && (\n <p className=\"truncate text-xs text-text-secondary\">\n {t('healthybowl.network.experts.payment.reference', 'Payment reference: {{reference}}', {\n reference: c.paymentReference,\n })}\n </p>\n )}\n </div>\n <div className=\"flex flex-shrink-0 items-center gap-2\">\n {c.fee > 0 &&\n c.paymentStatus === 'PENDING' &&\n (c.status === 'REQUESTED' || c.status === 'CONFIRMED') && (\n <Button\n size=\"sm\"\n onClick={() => void handlePayNow(c)}\n disabled={payingIds.has(c.id) || updatingStatusId === c.id}\n >\n <Wallet className=\"h-3.5 w-3.5\" />{' '}\n {payingIds.has(c.id)\n ? t('healthybowl.network.experts.actions.paying', 'Opening checkout…')\n : t('healthybowl.network.experts.actions.payNow', 'Pay Now')}\n </Button>\n )}\n {c.status === 'REQUESTED' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => handleUpdateStatus(c.id, 'CONFIRMED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.accept', 'Accept')}\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleUpdateStatus(c.id, 'CANCELLED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.decline', 'Decline')}\n </Button>\n </>\n )}\n {c.status === 'CONFIRMED' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => handleUpdateStatus(c.id, 'COMPLETED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.complete', 'Complete')}\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleUpdateStatus(c.id, 'CANCELLED')}\n disabled={updatingStatusId === c.id}\n >\n {t('healthybowl.network.experts.actions.cancel', 'Cancel')}\n </Button>\n </>\n )}\n <StatusBadge\n label={consultationStatusLabels[c.status] ?? c.status}\n variant={consultationStatusVariant(c.status)}\n dot\n />\n {c.fee > 0 && c.status !== 'CANCELLED' && (\n <StatusBadge\n label={consultationPaymentStatusLabels[c.paymentStatus] ?? c.paymentStatus}\n variant={consultationPaymentVariant(c.paymentStatus)}\n />\n )}\n </div>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Booking Modal */}\n <Modal\n open={bookingExpert !== null}\n onClose={closeBooking}\n title={t('healthybowl.network.experts.bookingModal.title', 'Book Consultation')}\n description={\n bookingExpert\n ? t('healthybowl.network.experts.bookingModal.description', 'Request a session with {{name}}', {\n name: bookingExpert.name,\n })\n : undefined\n }\n footer={\n <>\n <Button onClick={closeBooking} variant=\"outline\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleBookConsultation} disabled={submitting}>\n {submitting\n ? t('healthybowl.network.experts.bookingModal.booking', 'Booking…')\n : t('healthybowl.network.experts.bookingModal.confirm', 'Confirm Booking')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"expert-booking-topic\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.topic.label', 'Topic')}\n </label>\n <input\n id=\"expert-booking-topic\"\n type=\"text\"\n value={bookingForm.topic}\n onChange={(e) => updateBookingForm('topic', e.target.value)}\n maxLength={200}\n placeholder={t(\n 'healthybowl.network.experts.bookingModal.fields.topic.placeholder',\n 'What would you like help with?'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-booking-date\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.preferredDate.label', 'Preferred date')}\n </label>\n <input\n id=\"expert-booking-date\"\n type=\"date\"\n value={bookingForm.requestedDate}\n onChange={(e) => updateBookingForm('requestedDate', e.target.value)}\n min={todayLocalDate()}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-booking-mode\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.mode.label', 'Mode')}\n </label>\n <Select value={bookingForm.mode} onValueChange={(value) => updateBookingForm('mode', value)}>\n <SelectTrigger id=\"expert-booking-mode\" className=\"w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {consultationModes.map((m) => (\n <SelectItem key={m.value} value={m.value}>\n {m.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div>\n <label htmlFor=\"expert-booking-notes\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.bookingModal.fields.notes.label', 'Notes (optional)')}\n </label>\n <textarea\n id=\"expert-booking-notes\"\n value={bookingForm.notes}\n onChange={(e) => updateBookingForm('notes', e.target.value)}\n rows={3}\n maxLength={1000}\n placeholder={t(\n 'healthybowl.network.experts.bookingModal.fields.notes.placeholder',\n 'Any additional context for the expert'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n {bookingExpert &&\n (bookingExpert.hourlyRate > 0 ? (\n <div className=\"space-y-1 text-xs text-text-secondary\">\n <p>\n {t('healthybowl.network.experts.bookingModal.fee', 'One-hour consultation fee, payable on booking:')}{' '}\n <span className=\"font-medium text-text-primary\">\n {formatCurrency(bookingExpert.hourlyRate, HB_DEFAULT_CURRENCY)}\n </span>\n </p>\n <p>\n {t(\n 'healthybowl.network.experts.bookingModal.payoutNote',\n 'Your payment is collected by the farm. Settlement with the expert is arranged separately.'\n )}\n </p>\n </div>\n ) : (\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.network.experts.bookingModal.noFee', 'No fee for this consultation.')}\n </p>\n ))}\n </div>\n </Modal>\n\n {/* Add / Edit Expert Modal */}\n <Modal\n open={showExpertModal}\n onClose={closeExpertModal}\n title={\n editingExpert\n ? t('healthybowl.network.experts.form.editTitle', 'Edit Expert')\n : t('healthybowl.network.experts.form.addTitle', 'Add Expert')\n }\n description={t('healthybowl.network.experts.form.description', 'Manage an expert in your network directory')}\n size=\"lg\"\n footer={\n <>\n <Button onClick={closeExpertModal} variant=\"outline\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleSaveExpert} disabled={savingExpert}>\n {savingExpert\n ? t('healthybowl.network.experts.form.saving', 'Saving…')\n : t('healthybowl.network.experts.form.save', 'Save Expert')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-form-name\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.name.label', 'Name')}\n </label>\n <input\n id=\"expert-form-name\"\n type=\"text\"\n value={expertForm.name}\n onChange={(e) => updateExpertForm('name', e.target.value)}\n maxLength={120}\n placeholder={t('healthybowl.network.experts.form.fields.name.placeholder', 'Full name')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-specialization\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.specialization.label', 'Specialization')}\n </label>\n <input\n id=\"expert-form-specialization\"\n type=\"text\"\n value={expertForm.specialization}\n onChange={(e) => updateExpertForm('specialization', e.target.value)}\n maxLength={120}\n placeholder={t(\n 'healthybowl.network.experts.form.fields.specialization.placeholder',\n 'e.g. Soil Science & Fertility'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"expert-form-experience\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.experience.label', 'Experience (years)')}\n </label>\n <input\n id=\"expert-form-experience\"\n type=\"number\"\n min={0}\n value={expertForm.experience}\n onChange={(e) => updateExpertForm('experience', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-rating\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.rating.label', 'Rating')}\n </label>\n <input\n id=\"expert-form-rating\"\n type=\"number\"\n min={0}\n max={5}\n step={0.1}\n value={expertForm.rating}\n onChange={(e) => updateExpertForm('rating', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-rate\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.hourlyRate.label', 'Hourly rate')}\n </label>\n <input\n id=\"expert-form-rate\"\n type=\"number\"\n min={0}\n step={0.01}\n value={expertForm.hourlyRate}\n onChange={(e) => updateExpertForm('hourlyRate', e.target.value)}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"expert-form-location\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.location.label', 'Location')}\n </label>\n <input\n id=\"expert-form-location\"\n type=\"text\"\n value={expertForm.location}\n onChange={(e) => updateExpertForm('location', e.target.value)}\n maxLength={120}\n placeholder={t('healthybowl.network.experts.form.fields.location.placeholder', 'City, Region')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"expert-form-availability\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.availability.label', 'Availability')}\n </label>\n <Select\n value={expertForm.availability}\n onValueChange={(value) => updateExpertForm('availability', value as ExpertFormState['availability'])}\n >\n <SelectTrigger id=\"expert-form-availability\" className=\"w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {expertAvailabilityOptions.map((o) => (\n <SelectItem key={o.value} value={o.value}>\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div>\n <label htmlFor=\"expert-form-languages\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.experts.form.fields.languages.label', 'Languages')}\n </label>\n <input\n id=\"expert-form-languages\"\n type=\"text\"\n value={expertForm.languages}\n onChange={(e) => updateExpertForm('languages', e.target.value)}\n placeholder={t('healthybowl.network.experts.form.fields.languages.placeholder', 'English, Hindi, Tamil')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t('healthybowl.network.experts.form.fields.languages.hint', 'Separate multiple languages with commas')}\n </p>\n </div>\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoDA,IAAM,IAAqC;CACzC,OAAO;CACP,eAAe;CACf,MAAM;CACN,OAAO;AACT,GAaM,IAAmC;CACvC,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,UAAU;CACV,cAAc;CACd,YAAY;CACZ,WAAW;AACb,GAEM,MAA6B,MAA0B;CAC3D,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EAET,SACE,OAAO;CACX;AACF,GAEM,MAA8B,MAAiC;CACnE,QAAQ,GAAR;EACE,KAAK,QACH,OAAO;EACT,KAAK,YACH,OAAO;EAET,SACE,OAAO;CACX;AACF,GAEM,KAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;AACF,GACM,KAAsB;CAAC;CAAO;CAAa;AAAM,GAGjD,KAA0B;CAAC;CAAU;CAAc;CAAa;AAAY,GAE5E,MAAuB,MAAc;CACzC,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK,WACH,OAAO;EACT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}
@@ -0,0 +1,19 @@
1
+ import { chatTurns as e, voiceTurnsOnly as t } from "../utils/voiceTurnVisibility.js";
2
+ import { useMemo as n } from "react";
3
+ //#region src/hooks/useConversationTurns.ts
4
+ function r(r) {
5
+ let i = n(() => r?.messages ?? [], [r?.messages]), a = n(() => e(i), [i]), o = n(() => t(i), [i]);
6
+ return n(() => ({
7
+ all: i,
8
+ chat: a,
9
+ voice: o
10
+ }), [
11
+ i,
12
+ a,
13
+ o
14
+ ]);
15
+ }
16
+ //#endregion
17
+ export { r as useConversationTurns };
18
+
19
+ //# sourceMappingURL=useConversationTurns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConversationTurns.js","names":[],"sources":["../../src/hooks/useConversationTurns.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { Conversation, Message } from '@/types/assistant';\nimport { chatTurns, voiceTurnsOnly } from '@/utils/voiceTurnVisibility';\n\nexport interface ConversationTurns {\n /**\n * Every turn, both surfaces. Readonly, so it cannot be handed to a component\n * that renders a message list — that is the point of it being readonly.\n *\n * Use it for questions about the CONVERSATION (\"is it used at all?\"), never\n * for questions about a SURFACE (\"what should I draw?\").\n */\n all: readonly Message[];\n /** Typed turns — what the chat thread draws. */\n chat: Message[];\n /** Spoken turns — what the voice panel and the transcript draw. */\n voice: Message[];\n}\n\n/**\n * One place that decides which turns belong to which surface.\n *\n * Voice and chat share a single message array; separation is a per-message\n * marker plus a filter applied by every reader. That makes correctness scale\n * with the NUMBER OF READERS, which is how the last round of leaks happened —\n * the message list filtered correctly while four other readers did not, and\n * nothing failed.\n *\n * ★ Deliberately a hook returning memoised arrays rather than a zustand\n * selector. A selector like `useAssistantStore(s => chatTurns(...))` builds a\n * fresh array on every call, so `Object.is` never matches and the component\n * re-renders on every unrelated store change. Subscribing to the array and\n * filtering in `useMemo` is the version that does not.\n *\n * The two filters are separate memos on purpose: a typed turn arriving must not\n * hand the voice panel a new array identity, or the voice session re-renders\n * mid-utterance.\n */\nexport function useConversationTurns(conversation: Conversation | undefined): ConversationTurns {\n const all = useMemo(() => conversation?.messages ?? [], [conversation?.messages]);\n const chat = useMemo(() => chatTurns(all), [all]);\n const voice = useMemo(() => voiceTurnsOnly(all), [all]);\n return useMemo(() => ({ all, chat, voice }), [all, chat, voice]);\n}\n"],"mappings":";;;AAsCA,SAAgB,EAAqB,GAA2D;CAC9F,IAAM,IAAM,QAAc,GAAc,YAAY,CAAC,GAAG,CAAC,GAAc,QAAQ,CAAC,GAC1E,IAAO,QAAc,EAAU,CAAG,GAAG,CAAC,CAAG,CAAC,GAC1C,IAAQ,QAAc,EAAe,CAAG,GAAG,CAAC,CAAG,CAAC;CACtD,OAAO,SAAe;EAAE;EAAK;EAAM;CAAM,IAAI;EAAC;EAAK;EAAM;CAAK,CAAC;AACjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.js","names":[],"sources":["../../src/types/assistant.ts"],"sourcesContent":["/**\n * AI Assistant types.\n *\n * Defines the data model for the right-pane AI assistant panel.\n * Interface shapes align with aiApi.ts (AISession, AISessionLog), which is\n * the real workspace gateway backed assistant contract.\n */\n\nimport { ASSISTANT_USECASE_CONFIG, type AssistantUsecaseId } from '@/config/assistantUsecases';\nimport type { AssistantMessageAttachment } from '@/utils/assistantAttachments';\n\nexport type AssistantMode = AssistantUsecaseId;\n\nexport type AssistantSandboxStatus = 'none' | 'provisioning' | 'running' | 'stopping' | 'error';\n\nexport type AssistantConversationStatus = 'idle' | 'provisioning' | 'connecting' | 'streaming' | 'complete' | 'error';\n\nexport interface AssistantArtifact {\n name: string;\n path: string;\n type: 'file' | 'directory';\n size: number;\n downloadPath?: string;\n}\n\nexport interface AssistantMessageMetadata {\n artifacts?: AssistantArtifact[];\n mode?: AssistantMode;\n sandboxId?: string;\n sessionId?: string;\n /**\n * Files the user attached to this turn. Deliberately the SLIM descriptor —\n * conversations are persisted to localStorage, so preview data URLs and\n * inlined text content must never land here (see AssistantMessageAttachment).\n */\n attachments?: AssistantMessageAttachment[];\n /**\n * The language this turn was generated under (BOFF-7108), as an assistant\n * language code.\n *\n * Fixed at send time, because it is a property of the TURN and not of the\n * current preference. `resolveSpeechLocale` cannot tell English from Spanish\n * or French — they share a script — so it falls back to whatever language is\n * selected NOW. Without this, a French reply starts being read by a Spanish\n * voice the moment the user switches, even with the right voice installed.\n */\n lang?: string;\n /**\n * This turn happened inside a live VOICE session, not in the chat panel.\n *\n * ★ The two surfaces share one conversation and one backend session — voice\n * was built as an overlay over the chat thread, so `submitVoiceTurn` calls\n * the same `handleSend` the composer does. Without a marker there is no way\n * to tell a spoken turn from a typed one once it is in the store, and every\n * voice exchange therefore appeared in the normal chat: the operator's own\n * report, \"I see the same chat in the normal conversation tab, both are\n * separate, don't confuse\".\n *\n * Stamped at send time and persisted, so the distinction survives a reload —\n * the chat transcript is never rehydrated from the backend, so the store is\n * the only source of truth for what the panel shows.\n */\n voice?: boolean;\n [key: string]: unknown;\n}\n\nexport interface Message {\n id: string;\n role: 'user' | 'assistant' | 'system';\n content: string;\n timestamp: string;\n tokens?: { input: number; output: number };\n metadata?: AssistantMessageMetadata;\n}\n\nexport interface Conversation {\n id: string;\n title: string;\n mode: AssistantMode;\n messages: Message[];\n createdAt: string;\n updatedAt: string;\n /** Backend session ID for this conversation */\n backendSessionId?: string | null;\n}\n\nexport interface AssistantSandboxRuntime {\n sandboxId: string;\n status: AssistantSandboxStatus;\n}\n\nexport interface AssistantConversationProcessing {\n status: AssistantConversationStatus;\n messageId: string | null;\n error?: string | null;\n updatedAt: string;\n}\n\nexport interface AssistantModeConfig {\n id: AssistantMode;\n label: string;\n description: string;\n suggestions: readonly string[];\n /** Only offered to a global Owner/Admin (see useAssistantApiAccess). */\n requiresAdmin?: boolean;\n /** Executes mutations on live data → triggers the confirm-before-mutate guard. */\n writeCapable?: boolean;\n}\n\nexport const ASSISTANT_MODES: AssistantModeConfig[] = [...ASSISTANT_USECASE_CONFIG];\n"],"mappings":";;AA6GA,IAAa,IAAyC,CAAC,GAAG,CAAwB"}
1
+ {"version":3,"file":"assistant.js","names":[],"sources":["../../src/types/assistant.ts"],"sourcesContent":["/**\n * AI Assistant types.\n *\n * Defines the data model for the right-pane AI assistant panel.\n * Interface shapes align with aiApi.ts (AISession, AISessionLog), which is\n * the real workspace gateway backed assistant contract.\n */\n\nimport { ASSISTANT_USECASE_CONFIG, type AssistantUsecaseId } from '@/config/assistantUsecases';\nimport type { AssistantMessageAttachment } from '@/utils/assistantAttachments';\n\nexport type AssistantMode = AssistantUsecaseId;\n\nexport type AssistantSandboxStatus = 'none' | 'provisioning' | 'running' | 'stopping' | 'error';\n\nexport type AssistantConversationStatus = 'idle' | 'provisioning' | 'connecting' | 'streaming' | 'complete' | 'error';\n\nexport interface AssistantArtifact {\n name: string;\n path: string;\n type: 'file' | 'directory';\n size: number;\n downloadPath?: string;\n}\n\nexport interface AssistantMessageMetadata {\n artifacts?: AssistantArtifact[];\n mode?: AssistantMode;\n sandboxId?: string;\n sessionId?: string;\n /**\n * Files the user attached to this turn. Deliberately the SLIM descriptor —\n * conversations are persisted to localStorage, so preview data URLs and\n * inlined text content must never land here (see AssistantMessageAttachment).\n */\n attachments?: AssistantMessageAttachment[];\n /**\n * The language this turn was generated under (BOFF-7108), as an assistant\n * language code.\n *\n * Fixed at send time, because it is a property of the TURN and not of the\n * current preference. `resolveSpeechLocale` cannot tell English from Spanish\n * or French — they share a script — so it falls back to whatever language is\n * selected NOW. Without this, a French reply starts being read by a Spanish\n * voice the moment the user switches, even with the right voice installed.\n */\n lang?: string;\n /**\n * This turn happened inside a live VOICE session, not in the chat panel.\n *\n * ★ The two surfaces share one conversation and one backend session — voice\n * was built as an overlay over the chat thread, so `submitVoiceTurn` calls\n * the same `handleSend` the composer does. Without a marker there is no way\n * to tell a spoken turn from a typed one once it is in the store, and every\n * voice exchange therefore appeared in the normal chat: the operator's own\n * report, \"I see the same chat in the normal conversation tab, both are\n * separate, don't confuse\".\n *\n * Stamped at send time and persisted, so the distinction survives a reload —\n * the chat transcript is never rehydrated from the backend, so the store is\n * the only source of truth for what the panel shows.\n */\n voice?: boolean;\n [key: string]: unknown;\n}\n\nexport interface Message {\n id: string;\n role: 'user' | 'assistant' | 'system';\n content: string;\n timestamp: string;\n tokens?: { input: number; output: number };\n metadata?: AssistantMessageMetadata;\n}\n\nexport interface Conversation {\n id: string;\n title: string;\n mode: AssistantMode;\n /**\n * EVERY turn, both surfaces — typed and spoken.\n *\n * ★ `readonly` on purpose, and it is load-bearing rather than hygiene. Voice\n * and chat share this one array; what separates them is `metadata.voice` plus\n * a filter at every reader, so the failure mode is a new reader that renders\n * the array as-is and silently spills spoken content into the typed thread.\n * Nothing about that is a type error, and it stays green in CI.\n *\n * Being readonly makes it one: components take `Message[]`, so handing them\n * this field directly no longer compiles. The way through is `chatTurns()` or\n * `voiceTurnsOnly()` (see `utils/voiceTurnVisibility`), both of which return a\n * fresh mutable array — which means picking a surface is now a step you cannot\n * skip by accident.\n *\n * Counting is still fine: `.length` answers \"is this conversation used at\n * all\", which is a question about the conversation and not about either\n * surface.\n */\n messages: readonly Message[];\n createdAt: string;\n updatedAt: string;\n /** Backend session ID for this conversation */\n backendSessionId?: string | null;\n}\n\nexport interface AssistantSandboxRuntime {\n sandboxId: string;\n status: AssistantSandboxStatus;\n}\n\nexport interface AssistantConversationProcessing {\n status: AssistantConversationStatus;\n messageId: string | null;\n error?: string | null;\n updatedAt: string;\n}\n\nexport interface AssistantModeConfig {\n id: AssistantMode;\n label: string;\n description: string;\n suggestions: readonly string[];\n /** Only offered to a global Owner/Admin (see useAssistantApiAccess). */\n requiresAdmin?: boolean;\n /** Executes mutations on live data → triggers the confirm-before-mutate guard. */\n writeCapable?: boolean;\n}\n\nexport const ASSISTANT_MODES: AssistantModeConfig[] = [...ASSISTANT_USECASE_CONFIG];\n"],"mappings":";;AAgIA,IAAa,IAAyC,CAAC,GAAG,CAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.902.19",
3
+ "version": "2026.902.21",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [