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 { Typography } from '../../atoms/Typography'; import { Card } from '../../atoms/Card'; import { Divider } from '../../atoms/Divider'; // ─── Types ─────────────────────────────────────────────────────────────────── /** Provider summary for the compact card */ export interface UnverifiedPackageT2Provider { /** Provider name */ name: string; /** Location */ location: string; /** Image URL */ imageUrl?: string; /** Rating */ rating?: number; /** Review count */ reviewCount?: number; } /** Package data — price only, no itemised breakdown */ export interface UnverifiedPackageT2Data { /** Unique package ID */ id: string; /** Package display name */ name: string; /** Package price in dollars */ price: number; /** Short description */ description?: 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 UnverifiedPackageT2 page component */ export interface UnverifiedPackageT2Props { /** Provider summary shown at top of the list panel (no image — unverified provider) */ provider: UnverifiedPackageT2Provider; /** Packages with price only (no itemised breakdown) */ packages: UnverifiedPackageT2Data[]; /** 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 an enquiry" is clicked */ onArrange: () => void; /** Callback when a nearby verified package is clicked */ onNearbyPackageClick?: (id: string) => void; /** Callback when the provider card is clicked */ onProviderClick?: () => void; /** Callback for the Back button */ onBack: () => void; /** Validation error */ error?: string; /** Whether the enquiry 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 ─────────────────────────────────────────────────────────────── /** * UnverifiedPackageT2 — Package selection page for Tier 2 unverified providers. * * Similar to T3 but the provider has only shared overall package prices, * not itemised breakdowns. The detail panel shows an "Itemized Pricing * Unavailable" notice instead of line items. * * Two sections: * - **This provider's packages**: price-only, no breakdown available * - **Similar packages from verified providers nearby**: promoted alternatives * * Pure presentation component — props in, callbacks out. */ export const UnverifiedPackageT2: 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 more details. ) } > {/* Provider compact card — no image for unverified */} {/* 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} ))} )} ); }; UnverifiedPackageT2.displayName = 'UnverifiedPackageT2'; export default UnverifiedPackageT2;