@burdenoff/microfe-housingvista 2026.1102.2 → 2026.1102.4
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.
- package/dist/housingvista/components/DocumentChip.d.ts +17 -0
- package/dist/housingvista/components/DocumentChip.d.ts.map +1 -0
- package/dist/housingvista/components/DocumentChip.js +68 -0
- package/dist/housingvista/components/DocumentChip.js.map +1 -0
- package/dist/housingvista/components/FileUploader.d.ts +2 -0
- package/dist/housingvista/components/FileUploader.d.ts.map +1 -1
- package/dist/housingvista/components/FileUploader.js +14 -14
- package/dist/housingvista/components/FileUploader.js.map +1 -1
- package/dist/housingvista/components/ServiceCategoryIcon.d.ts +13 -0
- package/dist/housingvista/components/ServiceCategoryIcon.d.ts.map +1 -0
- package/dist/housingvista/components/ServiceCategoryIcon.js +23 -0
- package/dist/housingvista/components/ServiceCategoryIcon.js.map +1 -0
- package/dist/housingvista/components/index.d.ts +1 -0
- package/dist/housingvista/components/index.d.ts.map +1 -1
- package/dist/housingvista/components/index.js +1 -0
- package/dist/housingvista/hooks/index.d.ts +9 -0
- package/dist/housingvista/hooks/index.d.ts.map +1 -1
- package/dist/housingvista/hooks/index.js +4 -2
- package/dist/housingvista/hooks/index.js.map +1 -1
- package/dist/housingvista/pages/investments/InvestmentDetailPage.d.ts.map +1 -1
- package/dist/housingvista/pages/investments/InvestmentDetailPage.js +345 -322
- package/dist/housingvista/pages/investments/InvestmentDetailPage.js.map +1 -1
- package/dist/housingvista/pages/investments/InvestmentDocuments.d.ts +11 -0
- package/dist/housingvista/pages/investments/InvestmentDocuments.d.ts.map +1 -0
- package/dist/housingvista/pages/investments/InvestmentDocuments.js +99 -0
- package/dist/housingvista/pages/investments/InvestmentDocuments.js.map +1 -0
- package/dist/housingvista/pages/legal/LegalPage.d.ts.map +1 -1
- package/dist/housingvista/pages/legal/LegalPage.js +87 -110
- package/dist/housingvista/pages/legal/LegalPage.js.map +1 -1
- package/dist/housingvista/pages/marketplace/MarketplacePage.d.ts.map +1 -1
- package/dist/housingvista/pages/marketplace/MarketplacePage.js +80 -113
- package/dist/housingvista/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/housingvista/pages/marketplace/ServiceDetailPage.d.ts.map +1 -1
- package/dist/housingvista/pages/marketplace/ServiceDetailPage.js +127 -135
- package/dist/housingvista/pages/marketplace/ServiceDetailPage.js.map +1 -1
- package/dist/housingvista/pages/offers/OffersPage.d.ts.map +1 -1
- package/dist/housingvista/pages/offers/OffersPage.js +110 -176
- package/dist/housingvista/pages/offers/OffersPage.js.map +1 -1
- package/dist/housingvista/pages/offers/offerTimeline.d.ts +14 -0
- package/dist/housingvista/pages/offers/offerTimeline.d.ts.map +1 -0
- package/dist/housingvista/pages/offers/offerTimeline.js +77 -0
- package/dist/housingvista/pages/offers/offerTimeline.js.map +1 -0
- package/dist/housingvista/pages/properties/PropertyDetailPage.d.ts.map +1 -1
- package/dist/housingvista/pages/properties/PropertyDetailPage.js +262 -257
- package/dist/housingvista/pages/properties/PropertyDetailPage.js.map +1 -1
- package/dist/housingvista/pages/rental/ApplicationDocuments.d.ts.map +1 -1
- package/dist/housingvista/pages/rental/ApplicationDocuments.js +7 -34
- package/dist/housingvista/pages/rental/ApplicationDocuments.js.map +1 -1
- package/dist/housingvista/services/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/housingvista/services/createSandboxAssistantTransport.js +12 -6
- package/dist/housingvista/services/createSandboxAssistantTransport.js.map +1 -1
- package/dist/housingvista/types/index.d.ts +3 -1
- package/dist/housingvista/types/index.d.ts.map +1 -1
- package/dist/housingvista/utils/assistantRetry.d.ts +31 -0
- package/dist/housingvista/utils/assistantRetry.d.ts.map +1 -0
- package/dist/housingvista/utils/assistantRetry.js +33 -0
- package/dist/housingvista/utils/assistantRetry.js.map +1 -0
- package/dist/housingvista/utils/investmentDocuments.d.ts +17 -0
- package/dist/housingvista/utils/investmentDocuments.d.ts.map +1 -0
- package/dist/housingvista/utils/investmentDocuments.js +12 -0
- package/dist/housingvista/utils/investmentDocuments.js.map +1 -0
- package/dist/housingvista/utils/serviceCategories.d.ts +105 -0
- package/dist/housingvista/utils/serviceCategories.d.ts.map +1 -0
- package/dist/housingvista/utils/serviceCategories.js +70 -0
- package/dist/housingvista/utils/serviceCategories.js.map +1 -0
- package/dist/housingvista/utils/similarProperties.d.ts +14 -0
- package/dist/housingvista/utils/similarProperties.d.ts.map +1 -0
- package/dist/housingvista/utils/similarProperties.js +17 -0
- package/dist/housingvista/utils/similarProperties.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffersPage.js","names":[],"sources":["../../../../src/housingvista/pages/offers/OffersPage.tsx"],"sourcesContent":["/**\n * Offers — the buyer/owner surface for property offers. Buyers track offers they\n * submitted (status timeline submitted→countered→accepted/rejected/withdrawn)\n * and can withdraw; owners can respond (accept / counter / reject). Server-side\n * status filter + pagination, with live per-status tab counts driven off a real\n * unfiltered read (no fabricated numbers).\n * @module housingvista\n */\n\nimport { useState, useMemo, type FormEvent } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Tag, Check, X, Repeat, Undo2, MapPin, ArrowRight, Home, MessageSquare, Handshake } from 'lucide-react';\nimport {\n Button,\n Pagination,\n EmphasisPanel,\n GlassCard,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { PageLayout, StatCard, StatusBadge, EmptyState } from '../../components';\nimport { ContactOwnerDialog } from '../../components';\nimport {\n useOffers,\n useRespondOffer,\n useWithdrawOffer,\n useAllTransactions,\n useCreateTransaction,\n type OfferRow,\n} from '../../hooks';\nimport { useServerPagination } from '../../hooks/useServerPagination';\nimport { notify } from '../../lib/toast';\nimport { cn, formatCurrency, formatDate } from '../../utils/helpers';\nimport { useTrackPageView } from '../../hooks/useHousingVistaAnalytics';\n\nconst statusTabs: { value: string; label: string }[] = [\n { value: 'all', label: 'All' },\n { value: 'submitted', label: 'Submitted' },\n { value: 'countered', label: 'Countered' },\n { value: 'accepted', label: 'Accepted' },\n { value: 'rejected', label: 'Rejected' },\n { value: 'withdrawn', label: 'Withdrawn' },\n { value: 'expired', label: 'Expired' },\n];\n\nfunction statusVariant(status: OfferRow['status']): 'success' | 'warning' | 'error' | 'info' | 'muted' {\n switch (status) {\n case 'accepted':\n return 'success';\n case 'countered':\n return 'warning';\n case 'rejected':\n return 'error';\n case 'submitted':\n return 'info';\n default:\n return 'muted';\n }\n}\n\n// ---- Status timeline (submitted → countered → accepted / rejected / withdrawn) ----\n\ntype NodeTone = 'success' | 'warning' | 'error' | 'info' | 'muted';\ninterface TimelineNode {\n label: string;\n date: string | null;\n tone: NodeTone;\n filled: boolean;\n}\n\nconst toneFill: Record<NodeTone, string> = {\n success: 'bg-status-success',\n warning: 'bg-status-warning',\n error: 'bg-status-error',\n info: 'bg-status-info',\n muted: 'bg-text-secondary',\n};\n\nfunction buildTimeline(offer: OfferRow): TimelineNode[] {\n const submitted: TimelineNode = { label: 'Submitted', date: offer.createdAt, tone: 'info', filled: true };\n const respondedAt = offer.respondedAt;\n switch (offer.status) {\n case 'accepted':\n return [\n { ...submitted, tone: 'success' },\n ...(offer.counterAmount != null\n ? [{ label: 'Countered', date: null, tone: 'success' as NodeTone, filled: true }]\n : []),\n { label: 'Accepted', date: respondedAt, tone: 'success', filled: true },\n ];\n case 'countered':\n return [\n { ...submitted, tone: 'warning' },\n { label: 'Countered', date: respondedAt, tone: 'warning', filled: true },\n { label: 'Accepted', date: null, tone: 'muted', filled: false },\n ];\n case 'rejected':\n return [{ ...submitted }, { label: 'Rejected', date: respondedAt, tone: 'error', filled: true }];\n case 'withdrawn':\n return [{ ...submitted }, { label: 'Withdrawn', date: offer.updatedAt, tone: 'muted', filled: true }];\n case 'expired':\n return [{ ...submitted }, { label: 'Expired', date: offer.expiresAt, tone: 'muted', filled: true }];\n default:\n // submitted\n return [{ ...submitted }, { label: 'Accepted', date: null, tone: 'muted', filled: false }];\n }\n}\n\nfunction OfferTimeline({ offer }: { offer: OfferRow }) {\n const nodes = buildTimeline(offer);\n return (\n <ol className=\"flex items-start\" aria-label=\"Offer status timeline\">\n {nodes.map((node, index) => {\n const isLast = index === nodes.length - 1;\n const nextFilled = !isLast && nodes[index + 1].filled;\n return (\n <li key={node.label} className={cn('flex flex-col items-center', !isLast && 'flex-1')}>\n <div className=\"flex w-full items-center\">\n <span\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full',\n node.filled ? toneFill[node.tone] : 'border-2 border-border-subtle bg-bg-surface'\n )}\n />\n {!isLast && (\n <span\n className={cn(\n 'mx-1 h-0.5 flex-1 rounded-full',\n node.filled && nextFilled ? toneFill[node.tone] : 'bg-border-subtle'\n )}\n />\n )}\n </div>\n <div className={cn('mt-1.5 text-center', isLast ? 'items-end' : '')}>\n <span className=\"block text-xs font-medium text-text-primary\">{node.label}</span>\n {node.date && <span className=\"block text-[0.65rem] text-text-secondary\">{formatDate(node.date)}</span>}\n </div>\n </li>\n );\n })}\n </ol>\n );\n}\n\nconst inputClass =\n 'h-10 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\nexport function OffersPage() {\n useTrackPageView('housingvista.offer.viewed');\n const navigate = useNavigate();\n const pagination = useServerPagination(10);\n const [activeTab, setActiveTab] = useState('all');\n const { data: offers, loading } = useOffers({\n filter: activeTab === 'all' ? undefined : { status: activeTab },\n pagination: pagination.pagination,\n });\n // Unfiltered read powers the live tab counts + summary stats (real data).\n const { data: allOffers } = useOffers({ pagination: { limit: 100, offset: 0 } });\n const { respondOffer, loading: responding } = useRespondOffer();\n const { withdrawOffer, loading: withdrawing } = useWithdrawOffer();\n // Deals already converted from accepted offers — the FULL paged set, so the\n // per-card \"Create deal\" vs \"View deal\" gate holds no matter where a deal\n // falls in the workspace's transaction list. loading / error gate the\n // action: \"unknown\" must never render as \"no deal\".\n const { data: transactions, loading: dealsLoading, error: dealsError, refetch: refetchDeals } = useAllTransactions();\n const { createTransaction, loading: creatingDeal } = useCreateTransaction();\n // offerId → deal, memoized once per snapshot so per-card lookups are O(1)\n // instead of a linear scan inside the card map.\n const dealByOfferId = useMemo(() => {\n const map = new Map<string, (typeof transactions)[number]>();\n for (const transaction of transactions) {\n if (transaction.offerId) map.set(transaction.offerId, transaction);\n }\n return map;\n }, [transactions]);\n\n const [respondTarget, setRespondTarget] = useState<OfferRow | null>(null);\n const [messageTarget, setMessageTarget] = useState<OfferRow | null>(null);\n const [dealTarget, setDealTarget] = useState<OfferRow | null>(null);\n const [dealTitle, setDealTitle] = useState('');\n const [dealAmount, setDealAmount] = useState('');\n const [dealType, setDealType] = useState<'sale' | 'rental'>('sale');\n const [action, setAction] = useState<'accept' | 'reject' | 'counter'>('accept');\n const [counterAmount, setCounterAmount] = useState('');\n const [notes, setNotes] = useState('');\n\n const dealForOffer = (offerId: string) => dealByOfferId.get(offerId) ?? null;\n\n const openCreateDeal = (offer: OfferRow) => {\n setDealTarget(offer);\n setDealTitle(offer.property ? `${offer.property.title} — accepted offer` : 'Accepted offer deal');\n // The counter amount (when the negotiation ended on a counter) is the\n // agreed figure; otherwise the original offer amount.\n setDealAmount(String(offer.counterAmount ?? offer.amount));\n setDealType(offer.property?.price.type === 'rent' ? 'rental' : 'sale');\n };\n\n const handleCreateDeal = async (event: FormEvent) => {\n event.preventDefault();\n if (!dealTarget?.property) return;\n const amount = Number(dealAmount);\n if (!Number.isFinite(amount) || amount <= 0) {\n notify.warning('Enter a valid deal amount');\n return;\n }\n try {\n await createTransaction({\n propertyId: dealTarget.property.id,\n title: dealTitle.trim() || `${dealTarget.property.title} deal`,\n type: dealType,\n status: 'draft',\n amount,\n currency: dealTarget.currency,\n offerId: dealTarget.id,\n });\n notify.success('Deal created', 'The accepted offer now carries through to its transaction.');\n setDealTarget(null);\n } catch (err) {\n // A concurrent convert surfaces as a typed CONFLICT — reads as a hint.\n notify.error('Could not create deal', (err as Error).message);\n return;\n }\n // Refresh the deal gate OUTSIDE the create error boundary: a failed\n // re-crawl must not contradict the \"Deal created\" toast.\n // The gate's own error state shows the retry affordance if the crawl fails.\n refetchDeals().catch(() => undefined);\n };\n\n const openRespond = (offer: OfferRow) => {\n setRespondTarget(offer);\n setAction('accept');\n setCounterAmount(String(offer.amount));\n setNotes('');\n };\n\n const handleRespond = async (event: FormEvent) => {\n event.preventDefault();\n if (!respondTarget) return;\n if (action === 'counter') {\n const amount = Number(counterAmount);\n if (!Number.isFinite(amount) || amount <= 0) {\n notify.warning('Enter a valid counter amount');\n return;\n }\n }\n try {\n await respondOffer(respondTarget.id, {\n action,\n counterAmount: action === 'counter' ? Number(counterAmount) : undefined,\n notes: notes.trim() || undefined,\n });\n notify.success(\n 'Response sent',\n `Offer ${action === 'accept' ? 'accepted' : action === 'reject' ? 'rejected' : 'countered'}.`\n );\n setRespondTarget(null);\n } catch (err) {\n notify.error('Could not respond to offer', (err as Error).message);\n }\n };\n\n const handleWithdraw = async (offer: OfferRow) => {\n try {\n await withdrawOffer(offer.id);\n notify.success('Offer withdrawn');\n } catch (err) {\n notify.error('Could not withdraw offer', (err as Error).message);\n }\n };\n\n const countFor = (value: string): number =>\n value === 'all' ? allOffers.length : allOffers.filter((o) => o.status === value).length;\n\n const activeCount = allOffers.filter((o) => o.status === 'submitted' || o.status === 'countered').length;\n const acceptedCount = allOffers.filter((o) => o.status === 'accepted').length;\n\n return (\n <PageLayout\n title=\"Offers\"\n description=\"Track the offers you have made and respond to offers on your listings\"\n purpose=\"Every offer in one place: watch its status move from submitted to countered, accepted, or rejected — withdraw one you no longer want, or respond to offers coming in on properties you own.\"\n >\n <EmphasisPanel className=\"p-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <StatCard label=\"Total offers\" value={allOffers.length} icon={<Tag className=\"h-4 w-4\" />} />\n <StatCard label=\"Awaiting action\" value={activeCount} icon={<Repeat className=\"h-4 w-4\" />} />\n <StatCard label=\"Accepted\" value={acceptedCount} icon={<Check className=\"h-4 w-4\" />} />\n </div>\n </EmphasisPanel>\n\n <div className=\"-mx-1 flex flex-nowrap items-center gap-2 overflow-x-auto px-1 pb-1 sm:flex-wrap sm:overflow-visible\">\n {statusTabs.map((tab) => {\n const count = countFor(tab.value);\n const isActive = activeTab === tab.value;\n return (\n <button\n key={tab.value}\n onClick={() => {\n setActiveTab(tab.value);\n pagination.setPage(1);\n }}\n className={cn(\n 'inline-flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {tab.label}\n <span\n className={cn(\n 'inline-flex min-w-5 items-center justify-center rounded-full px-1.5 text-[0.65rem] font-semibold tabular-nums',\n isActive ? 'bg-action-primary-text/20 text-action-primary-text' : 'bg-bg-surface text-text-secondary'\n )}\n >\n {count}\n </span>\n </button>\n );\n })}\n </div>\n\n {offers.length === 0 && !loading ? (\n <EmptyState\n illustration=\"empty-search\"\n icon={<Tag className=\"h-12 w-12\" />}\n title=\"No offers here\"\n description=\"Offers you submit on properties — and offers made on your listings — will appear here.\"\n action={<Button onClick={() => navigate('../properties')}>Browse properties</Button>}\n />\n ) : (\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-2\">\n {offers.map((offer) => {\n const image = offer.property?.images.find((img) => img.isPrimary) ?? offer.property?.images[0];\n const canAct = offer.status === 'submitted' || offer.status === 'countered';\n // The deal gate only renders once the full-transaction crawl has\n // settled — \"unknown\" must never present as \"no deal\". Lookup\n // hoisted so the ternary and the navigate target cannot diverge.\n const existingDeal = offer.status === 'accepted' ? dealForOffer(offer.id) : null;\n const dealGateReady = !dealsLoading && !dealsError;\n return (\n <GlassCard\n key={offer.id}\n treatment={canAct ? 'insight' : 'plain'}\n glow={canAct}\n className=\"flex flex-col gap-4 p-5\"\n >\n <div className=\"flex items-start gap-3\">\n <button\n type=\"button\"\n onClick={() => offer.property && navigate(`../properties/${offer.property.id}`)}\n className=\"shrink-0\"\n aria-label={`Open ${offer.property?.title ?? 'property'}`}\n >\n {image ? (\n <img src={image.url} alt=\"\" className=\"h-16 w-16 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex h-16 w-16 items-center justify-center rounded-lg bg-bg-sunken\">\n <Home className=\"h-6 w-6 text-text-secondary\" />\n </div>\n )}\n </button>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <button\n type=\"button\"\n onClick={() => offer.property && navigate(`../properties/${offer.property.id}`)}\n className=\"text-left\"\n >\n <h3 className=\"font-semibold text-text-primary hover:text-primary\">\n {offer.property?.title ?? 'Property'}\n </h3>\n {offer.property && (\n <p className=\"flex items-center gap-1 text-xs text-text-secondary\">\n <MapPin className=\"h-3 w-3\" />\n {offer.property.location.city}, {offer.property.location.state}\n </p>\n )}\n </button>\n <StatusBadge label={offer.status} variant={statusVariant(offer.status)} dot />\n </div>\n <div className=\"mt-2 flex items-baseline gap-3\">\n <span className=\"text-xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(offer.amount, offer.currency)}\n </span>\n {offer.counterAmount != null && (\n <span className=\"text-sm text-text-secondary\">\n Counter{' '}\n <span className=\"font-semibold text-status-warning-text\">\n {formatCurrency(offer.counterAmount, offer.currency)}\n </span>\n </span>\n )}\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary\">Submitted {formatDate(offer.createdAt)}</p>\n {(offer.status === 'submitted' || offer.status === 'countered') && offer.expiresAt && (\n <p className=\"mt-0.5 text-xs text-text-secondary\">Expires {formatDate(offer.expiresAt)}</p>\n )}\n </div>\n </div>\n\n <div className=\"rounded-lg bg-bg-sunken/50 p-3\">\n <OfferTimeline offer={offer} />\n </div>\n\n {(canAct || offer.property) && (\n <div className=\"flex flex-wrap gap-2\">\n {canAct && (\n <Button size=\"sm\" onClick={() => openRespond(offer)}>\n <Check className=\"h-4 w-4\" />\n <span className=\"ml-1\">Respond</span>\n </Button>\n )}\n {canAct && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={withdrawing}\n onClick={() => handleWithdraw(offer)}\n >\n <Undo2 className=\"h-4 w-4\" />\n <span className=\"ml-1\">Withdraw</span>\n </Button>\n )}\n {offer.property && (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setMessageTarget(offer)}>\n <MessageSquare className=\"h-4 w-4\" />\n <span className=\"ml-1\">Message</span>\n </Button>\n )}\n {offer.status === 'accepted' && offer.property && dealsError && (\n // The deal lookup failed — \"unknown\" must not silently\n // render as \"no deal\". Offer a retry so the user can\n // distinguish the two states.\n <Button variant=\"ghost\" size=\"sm\" disabled={dealsLoading} onClick={() => refetchDeals()}>\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">\n {dealsLoading ? 'Checking for a deal…' : 'Deal status unavailable — tap to retry'}\n </span>\n </Button>\n )}\n {offer.status === 'accepted' &&\n offer.property &&\n dealGateReady &&\n (existingDeal ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(`../transactions/${existingDeal.id}`)}\n >\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">View deal</span>\n </Button>\n ) : (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => openCreateDeal(offer)}>\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">Create deal</span>\n </Button>\n ))}\n {offer.property && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(`../properties/${offer.property?.id}`)}\n >\n <span>View property</span>\n <ArrowRight className=\"ml-1 h-4 w-4\" />\n </Button>\n )}\n </div>\n )}\n </GlassCard>\n );\n })}\n </div>\n\n <Pagination\n page={pagination.page}\n pageSize={pagination.pageSize}\n hasNextPage={offers.length >= pagination.pageSize}\n hasPreviousPage={pagination.page > 1}\n onPageChange={pagination.setPage}\n onPageSizeChange={pagination.setPageSize}\n />\n </div>\n )}\n\n {/* Message the other party about this offer — the conversation thread is\n property-scoped (ContactOwnerDialog), the same thread both parties\n already reach from the property detail page; keyed by property id so\n switching offers never reuses a stale conversation (BOFF-8220). */}\n {messageTarget?.property && (\n <ContactOwnerDialog\n key={messageTarget.property.id}\n open={messageTarget !== null}\n onOpenChange={(open) => !open && setMessageTarget(null)}\n entityId={messageTarget.property.id}\n entityType=\"housingvista-property\"\n title={messageTarget.property.title}\n pagePath=\"/housingvista/offers\"\n heading=\"Message\"\n description={`Discuss ${messageTarget.property.title} with the other party. The thread also appears in Messages.`}\n />\n )}\n\n {/* Respond to offer */}\n <ResponsiveDialog open={respondTarget !== null} onOpenChange={(open) => !open && setRespondTarget(null)}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <form onSubmit={handleRespond}>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Respond to offer</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {respondTarget?.property?.title\n ? `Offer of ${formatCurrency(respondTarget.amount, respondTarget.currency)} on ${respondTarget.property.title}.`\n : 'Accept, counter, or reject this offer.'}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"space-y-3 py-2\">\n <div className=\"flex flex-wrap gap-2\">\n {(['accept', 'counter', 'reject'] as const).map((value) => (\n <button\n key={value}\n type=\"button\"\n onClick={() => setAction(value)}\n className={cn(\n 'inline-flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium capitalize transition-colors',\n action === value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {value === 'accept' && <Check className=\"h-4 w-4\" />}\n {value === 'counter' && <Repeat className=\"h-4 w-4\" />}\n {value === 'reject' && <X className=\"h-4 w-4\" />}\n {value}\n </button>\n ))}\n </div>\n {action === 'counter' && (\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Counter amount *</label>\n <input\n type=\"number\"\n min={1}\n step=\"any\"\n value={counterAmount}\n onChange={(event) => setCounterAmount(event.target.value)}\n className={inputClass}\n />\n </div>\n )}\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Note (optional)</label>\n <textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n rows={2}\n className=\"w-full resize-none rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => setRespondTarget(null)}>\n Cancel\n </Button>\n <Button type=\"submit\" disabled={responding}>\n {responding ? 'Sending…' : 'Send response'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n\n {/* Create deal from an accepted offer (TXN-01 / BOFF-9171): prefilled from\n the offer — property, agreed amount (counter when the negotiation ended\n on one), and deal type from the listing. The svc links the deal back\n via offerId and refuses a second convert. */}\n <ResponsiveDialog open={dealTarget !== null} onOpenChange={(open) => !open && setDealTarget(null)}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <form onSubmit={handleCreateDeal}>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Create deal</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {dealTarget?.property?.title\n ? `Carry the accepted offer on ${dealTarget.property.title} through to a transaction.`\n : 'Carry this accepted offer through to a transaction.'}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"space-y-3 py-2\">\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Deal title *</label>\n <input\n value={dealTitle}\n onChange={(event) => setDealTitle(event.target.value)}\n className={inputClass}\n required\n />\n </div>\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Amount *</label>\n <input\n type=\"number\"\n min={1}\n step=\"any\"\n value={dealAmount}\n onChange={(event) => setDealAmount(event.target.value)}\n className={inputClass}\n required\n />\n </div>\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Deal type</label>\n <select\n value={dealType}\n onChange={(event) => setDealType(event.target.value as 'sale' | 'rental')}\n className={inputClass}\n >\n <option value=\"sale\">Sale</option>\n <option value=\"rental\">Rental</option>\n </select>\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => setDealTarget(null)}>\n Cancel\n </Button>\n <Button type=\"submit\" disabled={creatingDeal}>\n {creatingDeal ? 'Creating…' : 'Create deal'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,IAAM,KAAiD;CACrD;EAAE,OAAO;EAAO,OAAO;EAAO;CAC9B;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAW,OAAO;EAAW;CACvC;AAED,SAAS,GAAc,GAAgF;AACrG,SAAQ,GAAR;EACE,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAcb,IAAM,IAAqC;CACzC,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;CACN,OAAO;CACR;AAED,SAAS,EAAc,GAAiC;CACtD,IAAM,IAA0B;EAAE,OAAO;EAAa,MAAM,EAAM;EAAW,MAAM;EAAQ,QAAQ;EAAM,EACnG,IAAc,EAAM;AAC1B,SAAQ,EAAM,QAAd;EACE,KAAK,WACH,QAAO;GACL;IAAE,GAAG;IAAW,MAAM;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,kBAAC,GAAD,EAAA,UACG,GAAY,UAAU,QACnB,+BAA+B,EAAW,SAAS,MAAM,8BACzD,uDACwB,CAAA,CACP,EAAA,CAAA;OACzB,kBAAC,OAAD;QAAK,WAAU;kBAAf;SACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;UAAO,WAAU;oBAAqD;UAAoB,CAAA,EAC1F,kBAAC,SAAD;UACE,OAAO;UACP,WAAW,MAAU,EAAa,EAAM,OAAO,MAAM;UACrD,WAAW;UACX,UAAA;UACA,CAAA,CACE,EAAA,CAAA;SACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;UAAO,WAAU;oBAAqD;UAAgB,CAAA,EACtF,kBAAC,SAAD;UACE,MAAK;UACL,KAAK;UACL,MAAK;UACL,OAAO;UACP,WAAW,MAAU,EAAc,EAAM,OAAO,MAAM;UACtD,WAAW;UACX,UAAA;UACA,CAAA,CACE,EAAA,CAAA;SACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;UAAO,WAAU;oBAAqD;UAAiB,CAAA,EACvF,kBAAC,UAAD;UACE,OAAO;UACP,WAAW,MAAU,EAAY,EAAM,OAAO,MAA2B;UACzE,WAAW;oBAHb,CAKE,kBAAC,UAAD;WAAQ,OAAM;qBAAO;WAAa,CAAA,EAClC,kBAAC,UAAD;WAAQ,OAAM;qBAAS;WAAe,CAAA,CAC/B;YACL,EAAA,CAAA;SACF;;OACN,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;QAAQ,MAAK;QAAS,SAAQ;QAAU,eAAe,EAAc,KAAK;kBAAE;QAEnE,CAAA,EACT,kBAAC,GAAD;QAAQ,MAAK;QAAS,UAAU;kBAC7B,IAAe,cAAc;QACvB,CAAA,CACc,EAAA,CAAA;OACpB;;KACiB,CAAA;IACT,CAAA;GACR"}
|
|
1
|
+
{"version":3,"file":"OffersPage.js","names":[],"sources":["../../../../src/housingvista/pages/offers/OffersPage.tsx"],"sourcesContent":["/**\n * Offers — the buyer/owner surface for property offers. Buyers track offers they\n * submitted (status timeline submitted→countered→accepted/rejected/withdrawn)\n * and can withdraw; owners can respond (accept / counter / reject). Server-side\n * status filter + pagination, with live per-status tab counts driven off a real\n * unfiltered read (no fabricated numbers).\n * @module housingvista\n */\n\nimport { useState, useMemo, type FormEvent } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Tag, Check, X, Repeat, Undo2, MapPin, ArrowRight, Home, MessageSquare, Handshake } from 'lucide-react';\nimport {\n Button,\n Pagination,\n EmphasisPanel,\n GlassCard,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { PageLayout, StatCard, StatusBadge, EmptyState } from '../../components';\nimport { ContactOwnerDialog } from '../../components';\nimport {\n useOffers,\n useRespondOffer,\n useWithdrawOffer,\n useAllTransactions,\n useCreateTransaction,\n type OfferRow,\n} from '../../hooks';\nimport { useServerPagination } from '../../hooks/useServerPagination';\nimport { notify } from '../../lib/toast';\nimport { cn, formatCurrency, formatDate } from '../../utils/helpers';\nimport { useTrackPageView } from '../../hooks/useHousingVistaAnalytics';\nimport { buildTimeline, type NodeTone } from './offerTimeline';\n\nconst statusTabs: { value: string; label: string }[] = [\n { value: 'all', label: 'All' },\n { value: 'submitted', label: 'Submitted' },\n { value: 'countered', label: 'Countered' },\n { value: 'accepted', label: 'Accepted' },\n { value: 'rejected', label: 'Rejected' },\n { value: 'withdrawn', label: 'Withdrawn' },\n { value: 'expired', label: 'Expired' },\n];\n\nfunction statusVariant(status: OfferRow['status']): 'success' | 'warning' | 'error' | 'info' | 'muted' {\n switch (status) {\n case 'accepted':\n return 'success';\n case 'countered':\n return 'warning';\n case 'rejected':\n return 'error';\n case 'submitted':\n return 'info';\n default:\n return 'muted';\n }\n}\n\n// ---- Status timeline (submitted → countered → accepted / rejected / withdrawn) ----\n\nconst toneFill: Record<NodeTone, string> = {\n success: 'bg-status-success',\n warning: 'bg-status-warning',\n error: 'bg-status-error',\n info: 'bg-status-info',\n muted: 'bg-text-secondary',\n};\n\nfunction OfferTimeline({ offer }: { offer: OfferRow }) {\n const nodes = buildTimeline(offer);\n return (\n <ol className=\"flex items-start\" aria-label=\"Offer status timeline\">\n {nodes.map((node, index) => {\n const isLast = index === nodes.length - 1;\n const nextFilled = !isLast && nodes[index + 1].filled;\n return (\n <li key={node.label} className={cn('flex flex-col items-center', !isLast && 'flex-1')}>\n <div className=\"flex w-full items-center\">\n <span\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full',\n node.filled ? toneFill[node.tone] : 'border-2 border-border-subtle bg-bg-surface'\n )}\n />\n {!isLast && (\n <span\n className={cn(\n 'mx-1 h-0.5 flex-1 rounded-full',\n node.filled && nextFilled ? toneFill[node.tone] : 'bg-border-subtle'\n )}\n />\n )}\n </div>\n <div className={cn('mt-1.5 text-center', isLast ? 'items-end' : '')}>\n <span className=\"block text-xs font-medium text-text-primary\">{node.label}</span>\n {node.date ? (\n <span className=\"block text-[0.65rem] text-text-secondary\">{formatDate(node.date)}</span>\n ) : (\n node.note && <span className=\"block text-[0.65rem] italic text-text-secondary\">{node.note}</span>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n );\n}\n\nconst inputClass =\n 'h-10 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\nexport function OffersPage() {\n useTrackPageView('housingvista.offer.viewed');\n const navigate = useNavigate();\n const pagination = useServerPagination(10);\n const [activeTab, setActiveTab] = useState('all');\n const { data: offers, loading } = useOffers({\n filter: activeTab === 'all' ? undefined : { status: activeTab },\n pagination: pagination.pagination,\n });\n // Unfiltered read powers the live tab counts + summary stats (real data).\n const { data: allOffers } = useOffers({ pagination: { limit: 100, offset: 0 } });\n const { respondOffer, loading: responding } = useRespondOffer();\n const { withdrawOffer, loading: withdrawing } = useWithdrawOffer();\n // Deals already converted from accepted offers — the FULL paged set, so the\n // per-card \"Create deal\" vs \"View deal\" gate holds no matter where a deal\n // falls in the workspace's transaction list. loading / error gate the\n // action: \"unknown\" must never render as \"no deal\".\n const { data: transactions, loading: dealsLoading, error: dealsError, refetch: refetchDeals } = useAllTransactions();\n const { createTransaction, loading: creatingDeal } = useCreateTransaction();\n // offerId → deal, memoized once per snapshot so per-card lookups are O(1)\n // instead of a linear scan inside the card map.\n const dealByOfferId = useMemo(() => {\n const map = new Map<string, (typeof transactions)[number]>();\n for (const transaction of transactions) {\n if (transaction.offerId) map.set(transaction.offerId, transaction);\n }\n return map;\n }, [transactions]);\n\n const [respondTarget, setRespondTarget] = useState<OfferRow | null>(null);\n const [messageTarget, setMessageTarget] = useState<OfferRow | null>(null);\n const [dealTarget, setDealTarget] = useState<OfferRow | null>(null);\n const [dealTitle, setDealTitle] = useState('');\n const [dealAmount, setDealAmount] = useState('');\n const [dealType, setDealType] = useState<'sale' | 'rental'>('sale');\n const [action, setAction] = useState<'accept' | 'reject' | 'counter'>('accept');\n const [counterAmount, setCounterAmount] = useState('');\n const [notes, setNotes] = useState('');\n\n const dealForOffer = (offerId: string) => dealByOfferId.get(offerId) ?? null;\n\n const openCreateDeal = (offer: OfferRow) => {\n setDealTarget(offer);\n setDealTitle(offer.property ? `${offer.property.title} — accepted offer` : 'Accepted offer deal');\n // The counter amount (when the negotiation ended on a counter) is the\n // agreed figure; otherwise the original offer amount.\n setDealAmount(String(offer.counterAmount ?? offer.amount));\n setDealType(offer.property?.price.type === 'rent' ? 'rental' : 'sale');\n };\n\n const handleCreateDeal = async (event: FormEvent) => {\n event.preventDefault();\n if (!dealTarget?.property) return;\n const amount = Number(dealAmount);\n if (!Number.isFinite(amount) || amount <= 0) {\n notify.warning('Enter a valid deal amount');\n return;\n }\n try {\n await createTransaction({\n propertyId: dealTarget.property.id,\n title: dealTitle.trim() || `${dealTarget.property.title} deal`,\n type: dealType,\n status: 'draft',\n amount,\n currency: dealTarget.currency,\n offerId: dealTarget.id,\n });\n notify.success('Deal created', 'The accepted offer now carries through to its transaction.');\n setDealTarget(null);\n } catch (err) {\n // A concurrent convert surfaces as a typed CONFLICT — reads as a hint.\n notify.error('Could not create deal', (err as Error).message);\n return;\n }\n // Refresh the deal gate OUTSIDE the create error boundary: a failed\n // re-crawl must not contradict the \"Deal created\" toast.\n // The gate's own error state shows the retry affordance if the crawl fails.\n refetchDeals().catch(() => undefined);\n };\n\n const openRespond = (offer: OfferRow) => {\n setRespondTarget(offer);\n setAction('accept');\n setCounterAmount(String(offer.amount));\n setNotes('');\n };\n\n const handleRespond = async (event: FormEvent) => {\n event.preventDefault();\n if (!respondTarget) return;\n if (action === 'counter') {\n const amount = Number(counterAmount);\n if (!Number.isFinite(amount) || amount <= 0) {\n notify.warning('Enter a valid counter amount');\n return;\n }\n }\n try {\n await respondOffer(respondTarget.id, {\n action,\n counterAmount: action === 'counter' ? Number(counterAmount) : undefined,\n notes: notes.trim() || undefined,\n });\n notify.success(\n 'Response sent',\n `Offer ${action === 'accept' ? 'accepted' : action === 'reject' ? 'rejected' : 'countered'}.`\n );\n setRespondTarget(null);\n } catch (err) {\n notify.error('Could not respond to offer', (err as Error).message);\n }\n };\n\n const handleWithdraw = async (offer: OfferRow) => {\n try {\n await withdrawOffer(offer.id);\n notify.success('Offer withdrawn');\n } catch (err) {\n notify.error('Could not withdraw offer', (err as Error).message);\n }\n };\n\n const countFor = (value: string): number =>\n value === 'all' ? allOffers.length : allOffers.filter((o) => o.status === value).length;\n\n const activeCount = allOffers.filter((o) => o.status === 'submitted' || o.status === 'countered').length;\n const acceptedCount = allOffers.filter((o) => o.status === 'accepted').length;\n\n return (\n <PageLayout\n title=\"Offers\"\n description=\"Track the offers you have made and respond to offers on your listings\"\n purpose=\"Every offer in one place: watch its status move from submitted to countered, accepted, or rejected — withdraw one you no longer want, or respond to offers coming in on properties you own.\"\n >\n <EmphasisPanel className=\"p-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <StatCard label=\"Total offers\" value={allOffers.length} icon={<Tag className=\"h-4 w-4\" />} />\n <StatCard label=\"Awaiting action\" value={activeCount} icon={<Repeat className=\"h-4 w-4\" />} />\n <StatCard label=\"Accepted\" value={acceptedCount} icon={<Check className=\"h-4 w-4\" />} />\n </div>\n </EmphasisPanel>\n\n <div className=\"-mx-1 flex flex-nowrap items-center gap-2 overflow-x-auto px-1 pb-1 sm:flex-wrap sm:overflow-visible\">\n {statusTabs.map((tab) => {\n const count = countFor(tab.value);\n const isActive = activeTab === tab.value;\n return (\n <button\n key={tab.value}\n onClick={() => {\n setActiveTab(tab.value);\n pagination.setPage(1);\n }}\n className={cn(\n 'inline-flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n isActive\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {tab.label}\n <span\n className={cn(\n 'inline-flex min-w-5 items-center justify-center rounded-full px-1.5 text-[0.65rem] font-semibold tabular-nums',\n isActive ? 'bg-action-primary-text/20 text-action-primary-text' : 'bg-bg-surface text-text-secondary'\n )}\n >\n {count}\n </span>\n </button>\n );\n })}\n </div>\n\n {offers.length === 0 && !loading ? (\n <EmptyState\n illustration=\"empty-search\"\n icon={<Tag className=\"h-12 w-12\" />}\n title=\"No offers here\"\n description=\"Offers you submit on properties — and offers made on your listings — will appear here.\"\n action={<Button onClick={() => navigate('../properties')}>Browse properties</Button>}\n />\n ) : (\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-2\">\n {offers.map((offer) => {\n const image = offer.property?.images.find((img) => img.isPrimary) ?? offer.property?.images[0];\n const canAct = offer.status === 'submitted' || offer.status === 'countered';\n // The deal gate only renders once the full-transaction crawl has\n // settled — \"unknown\" must never present as \"no deal\". Lookup\n // hoisted so the ternary and the navigate target cannot diverge.\n const existingDeal = offer.status === 'accepted' ? dealForOffer(offer.id) : null;\n const dealGateReady = !dealsLoading && !dealsError;\n return (\n <GlassCard\n key={offer.id}\n treatment={canAct ? 'insight' : 'plain'}\n glow={canAct}\n className=\"flex flex-col gap-4 p-5\"\n >\n <div className=\"flex items-start gap-3\">\n <button\n type=\"button\"\n onClick={() => offer.property && navigate(`../properties/${offer.property.id}`)}\n className=\"shrink-0\"\n aria-label={`Open ${offer.property?.title ?? 'property'}`}\n >\n {image ? (\n <img src={image.url} alt=\"\" className=\"h-16 w-16 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex h-16 w-16 items-center justify-center rounded-lg bg-bg-sunken\">\n <Home className=\"h-6 w-6 text-text-secondary\" />\n </div>\n )}\n </button>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <button\n type=\"button\"\n onClick={() => offer.property && navigate(`../properties/${offer.property.id}`)}\n className=\"text-left\"\n >\n <h3 className=\"font-semibold text-text-primary hover:text-primary\">\n {offer.property?.title ?? 'Property'}\n </h3>\n {offer.property && (\n <p className=\"flex items-center gap-1 text-xs text-text-secondary\">\n <MapPin className=\"h-3 w-3\" />\n {offer.property.location.city}, {offer.property.location.state}\n </p>\n )}\n </button>\n <StatusBadge label={offer.status} variant={statusVariant(offer.status)} dot />\n </div>\n <div className=\"mt-2 flex items-baseline gap-3\">\n <span className=\"text-xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(offer.amount, offer.currency)}\n </span>\n {offer.counterAmount != null && (\n <span className=\"text-sm text-text-secondary\">\n Counter{' '}\n <span className=\"font-semibold text-status-warning-text\">\n {formatCurrency(offer.counterAmount, offer.currency)}\n </span>\n </span>\n )}\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary\">Submitted {formatDate(offer.createdAt)}</p>\n {(offer.status === 'submitted' || offer.status === 'countered') && offer.expiresAt && (\n <p className=\"mt-0.5 text-xs text-text-secondary\">Expires {formatDate(offer.expiresAt)}</p>\n )}\n </div>\n </div>\n\n <div className=\"rounded-lg bg-bg-sunken/50 p-3\">\n <OfferTimeline offer={offer} />\n </div>\n\n {(canAct || offer.property) && (\n <div className=\"flex flex-wrap gap-2\">\n {canAct && (\n <Button size=\"sm\" onClick={() => openRespond(offer)}>\n <Check className=\"h-4 w-4\" />\n <span className=\"ml-1\">Respond</span>\n </Button>\n )}\n {canAct && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={withdrawing}\n onClick={() => handleWithdraw(offer)}\n >\n <Undo2 className=\"h-4 w-4\" />\n <span className=\"ml-1\">Withdraw</span>\n </Button>\n )}\n {offer.property && (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setMessageTarget(offer)}>\n <MessageSquare className=\"h-4 w-4\" />\n <span className=\"ml-1\">Message</span>\n </Button>\n )}\n {offer.status === 'accepted' && offer.property && dealsError && (\n // The deal lookup failed — \"unknown\" must not silently\n // render as \"no deal\". Offer a retry so the user can\n // distinguish the two states.\n <Button variant=\"ghost\" size=\"sm\" disabled={dealsLoading} onClick={() => refetchDeals()}>\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">\n {dealsLoading ? 'Checking for a deal…' : 'Deal status unavailable — tap to retry'}\n </span>\n </Button>\n )}\n {offer.status === 'accepted' &&\n offer.property &&\n dealGateReady &&\n (existingDeal ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(`../transactions/${existingDeal.id}`)}\n >\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">View deal</span>\n </Button>\n ) : (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => openCreateDeal(offer)}>\n <Handshake className=\"h-4 w-4\" />\n <span className=\"ml-1\">Create deal</span>\n </Button>\n ))}\n {offer.property && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(`../properties/${offer.property?.id}`)}\n >\n <span>View property</span>\n <ArrowRight className=\"ml-1 h-4 w-4\" />\n </Button>\n )}\n </div>\n )}\n </GlassCard>\n );\n })}\n </div>\n\n <Pagination\n page={pagination.page}\n pageSize={pagination.pageSize}\n hasNextPage={offers.length >= pagination.pageSize}\n hasPreviousPage={pagination.page > 1}\n onPageChange={pagination.setPage}\n onPageSizeChange={pagination.setPageSize}\n />\n </div>\n )}\n\n {/* Message the other party about this offer — the conversation thread is\n property-scoped (ContactOwnerDialog), the same thread both parties\n already reach from the property detail page; keyed by property id so\n switching offers never reuses a stale conversation (BOFF-8220). */}\n {messageTarget?.property && (\n <ContactOwnerDialog\n key={messageTarget.property.id}\n open={messageTarget !== null}\n onOpenChange={(open) => !open && setMessageTarget(null)}\n entityId={messageTarget.property.id}\n entityType=\"housingvista-property\"\n title={messageTarget.property.title}\n pagePath=\"/housingvista/offers\"\n heading=\"Message\"\n description={`Discuss ${messageTarget.property.title} with the other party. The thread also appears in Messages.`}\n />\n )}\n\n {/* Respond to offer */}\n <ResponsiveDialog open={respondTarget !== null} onOpenChange={(open) => !open && setRespondTarget(null)}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <form onSubmit={handleRespond}>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Respond to offer</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {respondTarget?.property?.title\n ? `Offer of ${formatCurrency(respondTarget.amount, respondTarget.currency)} on ${respondTarget.property.title}.`\n : 'Accept, counter, or reject this offer.'}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"space-y-3 py-2\">\n <div className=\"flex flex-wrap gap-2\">\n {(['accept', 'counter', 'reject'] as const).map((value) => (\n <button\n key={value}\n type=\"button\"\n onClick={() => setAction(value)}\n className={cn(\n 'inline-flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium capitalize transition-colors',\n action === value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {value === 'accept' && <Check className=\"h-4 w-4\" />}\n {value === 'counter' && <Repeat className=\"h-4 w-4\" />}\n {value === 'reject' && <X className=\"h-4 w-4\" />}\n {value}\n </button>\n ))}\n </div>\n {action === 'counter' && (\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Counter amount *</label>\n <input\n type=\"number\"\n min={1}\n step=\"any\"\n value={counterAmount}\n onChange={(event) => setCounterAmount(event.target.value)}\n className={inputClass}\n />\n </div>\n )}\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Note (optional)</label>\n <textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n rows={2}\n className=\"w-full resize-none rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => setRespondTarget(null)}>\n Cancel\n </Button>\n <Button type=\"submit\" disabled={responding}>\n {responding ? 'Sending…' : 'Send response'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n\n {/* Create deal from an accepted offer (TXN-01 / BOFF-9171): prefilled from\n the offer — property, agreed amount (counter when the negotiation ended\n on one), and deal type from the listing. The svc links the deal back\n via offerId and refuses a second convert. */}\n <ResponsiveDialog open={dealTarget !== null} onOpenChange={(open) => !open && setDealTarget(null)}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <form onSubmit={handleCreateDeal}>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Create deal</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {dealTarget?.property?.title\n ? `Carry the accepted offer on ${dealTarget.property.title} through to a transaction.`\n : 'Carry this accepted offer through to a transaction.'}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"space-y-3 py-2\">\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Deal title *</label>\n <input\n value={dealTitle}\n onChange={(event) => setDealTitle(event.target.value)}\n className={inputClass}\n required\n />\n </div>\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Amount *</label>\n <input\n type=\"number\"\n min={1}\n step=\"any\"\n value={dealAmount}\n onChange={(event) => setDealAmount(event.target.value)}\n className={inputClass}\n required\n />\n </div>\n <div>\n <label className=\"mb-1.5 block text-sm font-medium text-text-primary\">Deal type</label>\n <select\n value={dealType}\n onChange={(event) => setDealType(event.target.value as 'sale' | 'rental')}\n className={inputClass}\n >\n <option value=\"sale\">Sale</option>\n <option value=\"rental\">Rental</option>\n </select>\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => setDealTarget(null)}>\n Cancel\n </Button>\n <Button type=\"submit\" disabled={creatingDeal}>\n {creatingDeal ? 'Creating…' : 'Create deal'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAiD;CACrD;EAAE,OAAO;EAAO,OAAO;EAAO;CAC9B;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAW,OAAO;EAAW;CACvC;AAED,SAAS,GAAc,GAAgF;AACrG,SAAQ,GAAR;EACE,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAMb,IAAM,IAAqC;CACzC,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;CACN,OAAO;CACR;AAED,SAAS,GAAc,EAAE,YAA8B;CACrD,IAAM,IAAQ,EAAc,EAAM;AAClC,QACE,kBAAC,MAAD;EAAI,WAAU;E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/B;YACL,EAAA,CAAA;SACF;;OACN,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;QAAQ,MAAK;QAAS,SAAQ;QAAU,eAAe,EAAc,KAAK;kBAAE;QAEnE,CAAA,EACT,kBAAC,GAAD;QAAQ,MAAK;QAAS,UAAU;kBAC7B,IAAe,cAAc;QACvB,CAAA,CACc,EAAA,CAAA;OACpB;;KACiB,CAAA;IACT,CAAA;GACR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OfferRow } from '../../hooks';
|
|
2
|
+
|
|
3
|
+
export type NodeTone = 'success' | 'warning' | 'error' | 'info' | 'muted';
|
|
4
|
+
export interface TimelineNode {
|
|
5
|
+
label: string;
|
|
6
|
+
date: string | null;
|
|
7
|
+
/** Shown in place of the date when a reached step has none. */
|
|
8
|
+
note?: string;
|
|
9
|
+
tone: NodeTone;
|
|
10
|
+
filled: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const COUNTERED_DATE_NOT_RECORDED = "Date not recorded";
|
|
13
|
+
export declare function buildTimeline(offer: OfferRow): TimelineNode[];
|
|
14
|
+
//# sourceMappingURL=offerTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerTimeline.d.ts","sourceRoot":"","sources":["../../../../src/housingvista/pages/offers/offerTimeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,EAAE,CAoC7D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/housingvista/pages/offers/offerTimeline.ts
|
|
2
|
+
var e = "Date not recorded";
|
|
3
|
+
function t(t) {
|
|
4
|
+
let n = {
|
|
5
|
+
label: "Submitted",
|
|
6
|
+
date: t.createdAt,
|
|
7
|
+
tone: "info",
|
|
8
|
+
filled: !0
|
|
9
|
+
}, r = t.respondedAt;
|
|
10
|
+
switch (t.status) {
|
|
11
|
+
case "accepted": return [
|
|
12
|
+
{
|
|
13
|
+
...n,
|
|
14
|
+
tone: "success"
|
|
15
|
+
},
|
|
16
|
+
...t.counterAmount == null ? [] : [{
|
|
17
|
+
label: "Countered",
|
|
18
|
+
date: null,
|
|
19
|
+
note: e,
|
|
20
|
+
tone: "success",
|
|
21
|
+
filled: !0
|
|
22
|
+
}],
|
|
23
|
+
{
|
|
24
|
+
label: "Accepted",
|
|
25
|
+
date: r,
|
|
26
|
+
tone: "success",
|
|
27
|
+
filled: !0
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
case "countered": return [
|
|
31
|
+
{
|
|
32
|
+
...n,
|
|
33
|
+
tone: "warning"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Countered",
|
|
37
|
+
date: r,
|
|
38
|
+
tone: "warning",
|
|
39
|
+
filled: !0
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Accepted",
|
|
43
|
+
date: null,
|
|
44
|
+
tone: "muted",
|
|
45
|
+
filled: !1
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
case "rejected": return [{ ...n }, {
|
|
49
|
+
label: "Rejected",
|
|
50
|
+
date: r,
|
|
51
|
+
tone: "error",
|
|
52
|
+
filled: !0
|
|
53
|
+
}];
|
|
54
|
+
case "withdrawn": return [{ ...n }, {
|
|
55
|
+
label: "Withdrawn",
|
|
56
|
+
date: t.updatedAt,
|
|
57
|
+
tone: "muted",
|
|
58
|
+
filled: !0
|
|
59
|
+
}];
|
|
60
|
+
case "expired": return [{ ...n }, {
|
|
61
|
+
label: "Expired",
|
|
62
|
+
date: t.expiresAt,
|
|
63
|
+
tone: "muted",
|
|
64
|
+
filled: !0
|
|
65
|
+
}];
|
|
66
|
+
default: return [{ ...n }, {
|
|
67
|
+
label: "Accepted",
|
|
68
|
+
date: null,
|
|
69
|
+
tone: "muted",
|
|
70
|
+
filled: !1
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { t as buildTimeline };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=offerTimeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerTimeline.js","names":[],"sources":["../../../../src/housingvista/pages/offers/offerTimeline.ts"],"sourcesContent":["/**\n * Offer status timeline nodes (submitted → countered → accepted / rejected / withdrawn / expired) for the Offers page.\n * Only one `respondedAt` is persisted and the final response overwrites it, so on the accepted-after-counter path the\n * Countered step has no date. By design (owner decision 2026-10-22, BOFF-8222) it is rendered dateless with a\n * note saying so instead of adding a per-transition timestamp column.\n * @module housingvista/pages/offers/offerTimeline\n */\n\nimport type { OfferRow } from '../../hooks';\n\nexport type NodeTone = 'success' | 'warning' | 'error' | 'info' | 'muted';\n\nexport interface TimelineNode {\n label: string;\n date: string | null;\n /** Shown in place of the date when a reached step has none. */\n note?: string;\n tone: NodeTone;\n filled: boolean;\n}\n\nexport const COUNTERED_DATE_NOT_RECORDED = 'Date not recorded';\n\nexport function buildTimeline(offer: OfferRow): TimelineNode[] {\n const submitted: TimelineNode = { label: 'Submitted', date: offer.createdAt, tone: 'info', filled: true };\n const respondedAt = offer.respondedAt;\n switch (offer.status) {\n case 'accepted':\n return [\n { ...submitted, tone: 'success' },\n ...(offer.counterAmount != null\n ? [\n {\n label: 'Countered',\n date: null,\n note: COUNTERED_DATE_NOT_RECORDED,\n tone: 'success' as NodeTone,\n filled: true,\n },\n ]\n : []),\n { label: 'Accepted', date: respondedAt, tone: 'success', filled: true },\n ];\n case 'countered':\n return [\n { ...submitted, tone: 'warning' },\n { label: 'Countered', date: respondedAt, tone: 'warning', filled: true },\n { label: 'Accepted', date: null, tone: 'muted', filled: false },\n ];\n case 'rejected':\n return [{ ...submitted }, { label: 'Rejected', date: respondedAt, tone: 'error', filled: true }];\n case 'withdrawn':\n return [{ ...submitted }, { label: 'Withdrawn', date: offer.updatedAt, tone: 'muted', filled: true }];\n case 'expired':\n return [{ ...submitted }, { label: 'Expired', date: offer.expiresAt, tone: 'muted', filled: true }];\n default:\n // submitted\n return [{ ...submitted }, { label: 'Accepted', date: null, tone: 'muted', filled: false }];\n }\n}\n"],"mappings":";AAqBA,IAAa,IAA8B;AAE3C,SAAgB,EAAc,GAAiC;CAC7D,IAAM,IAA0B;EAAE,OAAO;EAAa,MAAM,EAAM;EAAW,MAAM;EAAQ,QAAQ;EAAM,EACnG,IAAc,EAAM;AAC1B,SAAQ,EAAM,QAAd;EACE,KAAK,WACH,QAAO;GACL;IAAE,GAAG;IAAW,MAAM;IAAW;GACjC,GAAI,EAAM,iBAAiB,OAUvB,EAAE,GATF,CACE;IACE,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACT,CACF;GAEL;IAAE,OAAO;IAAY,MAAM;IAAa,MAAM;IAAW,QAAQ;IAAM;GACxE;EACH,KAAK,YACH,QAAO;GACL;IAAE,GAAG;IAAW,MAAM;IAAW;GACjC;IAAE,OAAO;IAAa,MAAM;IAAa,MAAM;IAAW,QAAQ;IAAM;GACxE;IAAE,OAAO;IAAY,MAAM;IAAM,MAAM;IAAS,QAAQ;IAAO;GAChE;EACH,KAAK,WACH,QAAO,CAAC,EAAE,GAAG,GAAW,EAAE;GAAE,OAAO;GAAY,MAAM;GAAa,MAAM;GAAS,QAAQ;GAAM,CAAC;EAClG,KAAK,YACH,QAAO,CAAC,EAAE,GAAG,GAAW,EAAE;GAAE,OAAO;GAAa,MAAM,EAAM;GAAW,MAAM;GAAS,QAAQ;GAAM,CAAC;EACvG,KAAK,UACH,QAAO,CAAC,EAAE,GAAG,GAAW,EAAE;GAAE,OAAO;GAAW,MAAM,EAAM;GAAW,MAAM;GAAS,QAAQ;GAAM,CAAC;EACrG,QAEE,QAAO,CAAC,EAAE,GAAG,GAAW,EAAE;GAAE,OAAO;GAAY,MAAM;GAAM,MAAM;GAAS,QAAQ;GAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/housingvista/pages/properties/PropertyDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"PropertyDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/housingvista/pages/properties/PropertyDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4UH,eAAO,MAAM,kBAAkB,mCA8qE9B,CAAC"}
|