import React from 'react'; import Box from '@mui/material/Box'; import LocationOnOutlinedIcon from '@mui/icons-material/LocationOnOutlined'; import StarRoundedIcon from '@mui/icons-material/StarRounded'; import VerifiedOutlinedIcon from '@mui/icons-material/VerifiedOutlined'; import type { SxProps, Theme } from '@mui/material/styles'; import { WizardLayout } from '../../templates/WizardLayout'; import { ProviderCardCompact } from '../../molecules/ProviderCardCompact'; import { ServiceOption } from '../../molecules/ServiceOption'; import { PackageDetail } from '../../organisms/PackageDetail'; import type { PackageSection } from '../../organisms/PackageDetail'; import { Typography } from '../../atoms/Typography'; import { Card } from '../../atoms/Card'; import { Divider } from '../../atoms/Divider'; // ─── Types ─────────────────────────────────────────────────────────────────── /** Provider summary for the compact card */ export interface UnverifiedPackageT3Provider { /** Provider name */ name: string; /** Location */ location: string; /** Image URL */ imageUrl?: string; /** Rating */ rating?: number; /** Review count */ reviewCount?: number; } /** Package data for the selection list */ export interface UnverifiedPackageT3Data { /** Unique package ID */ id: string; /** Package display name */ name: string; /** Package price in dollars */ price: number; /** Short description */ description?: string; /** Line item sections for the detail panel */ sections: PackageSection[]; /** Total price (may differ from base price with extras) */ total?: number; /** Extra items section (after total) */ extras?: PackageSection; /** Terms and conditions */ terms?: string; } /** A similar package from a nearby verified provider */ export interface NearbyVerifiedPackage { /** Unique ID */ id: string; /** Package name */ packageName: string; /** Package price in dollars */ price: number; /** Provider name */ providerName: string; /** Provider location */ location: string; /** Provider rating */ rating?: number; /** Number of reviews */ reviewCount?: number; } /** Props for the UnverifiedPackageT3 page component */ export interface UnverifiedPackageT3Props { /** Provider summary shown at top of the list panel (no image — unverified provider) */ provider: UnverifiedPackageT3Provider; /** Packages matching the user's filters from the previous step */ packages: UnverifiedPackageT3Data[]; /** Similar packages from nearby verified providers */ nearbyPackages?: NearbyVerifiedPackage[]; /** Currently selected package ID */ selectedPackageId: string | null; /** Callback when a package is selected */ onSelectPackage: (id: string) => void; /** Callback when "Make Arrangement" is clicked (opens ArrangementDialog) */ onArrange: () => void; /** Callback when a nearby verified package is clicked */ onNearbyPackageClick?: (id: string) => void; /** Callback when the provider card is clicked (opens provider profile popup) */ onProviderClick?: () => void; /** Callback for the Back button */ onBack: () => void; /** Validation error */ error?: string; /** Whether the arrange action is loading */ loading?: boolean; /** Navigation bar */ navigation?: React.ReactNode; /** Whether this is a pre-planning flow */ isPrePlanning?: boolean; /** MUI sx prop */ sx?: SxProps; } // ─── Component ─────────────────────────────────────────────────────────────── /** * UnverifiedPackageT3 — Package selection page for unverified (Tier 3) providers. * * List + Detail split layout. Left panel shows the selected provider * (compact) and selectable package cards. Right panel shows the full * detail breakdown of the selected package with "Make Arrangement" CTA. * * Two sections: * - **This provider's packages**: estimated pricing from publicly available info * - **Similar packages from verified providers nearby**: promoted alternatives * with verified pricing, ratings, and location * * Selecting a package reveals its detail. Clicking "Make an enquiry" * on the detail panel initiates contact with the unverified provider. * * Pure presentation component — props in, callbacks out. */ export const UnverifiedPackageT3: React.FC = ({ provider, packages, nearbyPackages = [], selectedPackageId, onSelectPackage, onArrange, onNearbyPackageClick, onProviderClick, onBack, error, loading = false, navigation, isPrePlanning = false, sx, }) => { const selectedPackage = packages.find((p) => p.id === selectedPackageId); const hasNearbyPackages = nearbyPackages.length > 0; const subheading = isPrePlanning ? 'Browse estimated packages to get a sense of what this provider offers. Nothing is committed.' : 'These packages are based on publicly available information. Make an enquiry to confirm details and pricing.'; return ( ) : ( Select a package to see what's included. ) } > {/* Provider compact card — clickable to open provider profile */} {/* Heading */} Explore available packages {subheading} {/* Error message */} {error && ( {error} )} {/* ─── Packages ─── */} {packages.map((pkg) => ( onSelectPackage(pkg.id)} /> ))} {packages.length === 0 && ( No packages match your current preferences. )} {/* ─── Similar packages from nearby verified providers ─── */} {hasNearbyPackages && ( <> Similar packages from verified providers nearby {nearbyPackages.map((pkg) => ( onNearbyPackageClick(pkg.id) : undefined} sx={{ p: 'var(--fa-card-padding-compact)' }} > {/* Package name + price */} {pkg.packageName} ${pkg.price.toLocaleString('en-AU')} {/* Provider info */} {pkg.providerName} {pkg.rating != null && ( <> · {pkg.rating} {pkg.reviewCount != null ? ` (${pkg.reviewCount})` : ''} )} · {pkg.location} ))} )} ); }; UnverifiedPackageT3.displayName = 'UnverifiedPackageT3'; export default UnverifiedPackageT3;