@burdenoff/microfe-housingvista 2026.1108.1 → 2026.1110.2
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.
|
@@ -1957,7 +1957,8 @@ var G = ["housingvistaMarketplaceServices", "housingvistaMarketplaceService"], K
|
|
|
1957
1957
|
});
|
|
1958
1958
|
return {
|
|
1959
1959
|
createInvestment: async (t) => {
|
|
1960
|
-
await e({ variables: { input: t } });
|
|
1960
|
+
let { error: n } = await e({ variables: { input: t } });
|
|
1961
|
+
if (n) throw n;
|
|
1961
1962
|
},
|
|
1962
1963
|
loading: t
|
|
1963
1964
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_LIST_PAGINATION","getPaginationVariables","pagination","GET_DASHBOARD_STATS","PROPERTY_FIELDS","PROPERTY_VERIFICATION_FIELDS","GET_PROPERTIES","GET_PROPERTY","TRANSACTION_FIELDS","GET_TRANSACTIONS","GET_TRANSACTION","INVESTMENT_FIELDS","GET_INVESTMENTS","GET_INVESTMENT_COMPLIANCE","GET_INVESTMENT","GET_RENTAL_UNITS","ASSET_FIELDS","GET_ASSETS","GET_ASSET","GET_AMC_CONTRACTS","MARKETPLACE_SERVICE_FIELDS","GET_MARKETPLACE_SERVICES","GET_MARKETPLACE_SERVICE","VERIFICATION_FIELDS","GET_VERIFICATIONS","GET_VERIFICATION","LEGAL_SERVICE_FIELDS","GET_LEGAL_SERVICES","GET_LEGAL_SERVICE","HOME_LOAN_FIELDS","GET_HOME_LOANS","GET_HOME_LOAN","GET_MARKET_TRENDS","GET_AREA_INSIGHTS","GET_ANALYTICS","SHORTLIST_FIELDS","GET_SHORTLISTS","OFFER_FIELDS","GET_OFFERS","VIEWING_FIELDS","GET_VIEWINGS","RENTAL_APPLICATION_FIELDS","GET_RENTAL_APPLICATIONS","MAINTENANCE_FIELDS","GET_MAINTENANCE_REQUESTS","CREATE_PROPERTY","UPDATE_PROPERTY","DELETE_PROPERTY","SAVE_SHORTLIST","REMOVE_SHORTLIST","BOOK_VIEWING","CANCEL_VIEWING","SUBMIT_OFFER","RESPOND_OFFER","CREATE_TRANSACTION","CREATE_INVESTMENT","CREATE_RENTAL_UNIT","SUBMIT_RENTAL_APPLICATION","CREATE_AMC_CONTRACT","CREATE_MAINTENANCE_REQUEST","CREATE_VERIFICATION_ITEM","APPROVE_VERIFICATION","REJECT_VERIFICATION","UPDATE_PROPERTY_RERA_STATUS","WITHDRAW_OFFER","VIEWING_SLOT_FIELDS","GET_VIEWING_SLOTS","PUBLISH_VIEWING_SLOTS","CANCEL_VIEWING_SLOT","UPDATE_VIEWING","UPDATE_INVESTMENT","DELETE_INVESTMENT","CREATE_ASSET","UPDATE_AMC_CONTRACT","DELETE_AMC_CONTRACT","UPDATE_TRANSACTION","RESOLVE_MAINTENANCE","REVIEW_RENTAL_APPLICATION","mapProperty","row","item","file","emptyTrends","useDashboardStats","useQuery","empty","data","useRecentActivities","txn","useProperties","options","useProperty","id","NL_SEARCH_PROPERTIES","useNaturalLanguageSearch","run","useLazyQuery","search","result","useTransactions","useAllPages","client","useApolloClient","setData","useState","loading","setLoading","error","setError","baseVariablesRef","useRef","baseVariables","fetchAll","useCallback","all","offset","pageIndex","page","listField","query","generationRef","refetch","generation","err","useEffect","cancelled","useAllTransactions","useTransaction","useInvestments","useInvestmentCompliance","permissions","useSafePermissions","canRead","useInvestment","useRentalUnits","useAssets","useAsset","normalizeAmcContracts","contracts","contract","useAMCContracts","useMemo","useAllAmcContracts","useMarketplaceServices","useMarketplaceService","useVerifications","useVerificationItem","useLegalServices","useLegalService","useHomeLoans","useHomeLoanOffer","useMarketTrends","useAreaInsights","CREATE_MARKETPLACE_SERVICE","UPDATE_MARKETPLACE_SERVICE","DELETE_MARKETPLACE_SERVICE","CREATE_LEGAL_SERVICE","UPDATE_LEGAL_SERVICE","DELETE_LEGAL_SERVICE","CREATE_HOME_LOAN_OFFER","UPDATE_HOME_LOAN_OFFER","DELETE_HOME_LOAN_OFFER","CREATE_AREA_INSIGHT","UPDATE_AREA_INSIGHT","DELETE_AREA_INSIGHT","useCatalogWrite","mutate","useMutation","document","listQuery","fieldName","cacheFields","MARKETPLACE_CACHE","LEGAL_CACHE","HOME_LOAN_CACHE","AREA_INSIGHT_CACHE","useCreateMarketplaceService","useUpdateMarketplaceService","useDeleteMarketplaceService","useCreateLegalService","useUpdateLegalService","useDeleteLegalService","useCreateHomeLoanOffer","useUpdateHomeLoanOffer","useDeleteHomeLoanOffer","useCreateAreaInsight","useUpdateAreaInsight","useDeleteAreaInsight","useHasPermission","permission","useCanManageCatalog","resource","useCanRental","action","useShortlists","useAnalyticsData","GET_EXPENSES","CREATE_EXPENSE","UPDATE_EXPENSE","DELETE_EXPENSE","evictExpenseCaches","cache","useExpenses","useAllExpenses","useCreateExpense","useUpdateExpense","useDeleteExpense","useOffers","useViewings","useRentalApplications","LEASE_FIELDS","GET_LEASES","useAllLeases","useCreateLease","useRenewLease","useTerminateLease","useMaintenanceRequests","useCreateProperty","res","useUpdateProperty","useDeleteProperty","useSaveShortlist","useRemoveShortlist","useBookViewing","useViewingSlots","propertyId","usePublishViewingSlots","useCancelViewingSlot","useCancelViewing","useSubmitOffer","useRespondOffer","useCreateTransaction","useCreateInvestment","useCreateRentalUnit","useSubmitRentalApplication","useCreateAmcContract","useCreateMaintenanceRequest","useCreateVerification","useApproveVerification","pid","useRejectVerification","useUpdatePropertyReraStatus","useWithdrawOffer","useUpdateViewing","useUpdateInvestment","useDeleteInvestment","useCreateAsset","useUpdateAmcContract","useRenewAmcContract","useDeleteAmcContract","useUpdateTransaction","useResolveMaintenanceRequest","useReviewRentalApplication","useContactConversation","useConversationMessages","useCreateEntityComment","useDeleteUploadedFile","useEntityComments","useFileUpload","useSendContextMessage","useSendMessage","useUploadedFile"],"sources":["../../../src/housingvista/hooks/index.ts"],"sourcesContent":["/**\n * HousingVista data hooks — real GraphQL against the wspace gateway via Apollo.\n *\n * Every read maps the `housingvista*` query contract to the MFE domain types in\n * `../types`. Every write wraps a `housingvista*` mutation and (where it changes\n * a list the UI shows) refetches the affected query so the cache stays honest.\n * No `any`, no mock data — hooks that have no backing query return an explicit\n * `unsupported` empty-state instead of fabricating rows.\n * @module housingvista\n */\n\nimport { gql, type ApolloCache, type DocumentNode } from '@apollo/client';\nimport { useQuery, useMutation, useLazyQuery, useApolloClient } from '@apollo/client/react';\nimport { useEffect, useMemo, useState, useCallback, useRef } from 'react';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type {\n Property,\n Transaction,\n Investment,\n DashboardStats,\n DashboardTrends,\n RecentActivity,\n RentalUnit,\n Asset,\n AMCContract,\n MarketplaceService,\n VerificationItem,\n LegalService,\n HomeLoan,\n MarketTrend,\n AreaInsight,\n AnalyticsChartData,\n AnalyticsPeriod,\n PropertyType,\n PropertyStatus,\n ReraVerificationStatus,\n VerificationStatus,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Shared input shapes (mirror HousingVista*Input from the subgraph schema)\n// ---------------------------------------------------------------------------\n\nexport type PaginationInput = {\n limit?: number;\n offset?: number;\n};\n\nexport type PropertyGeoBoundsInput = {\n neLat: number;\n neLng: number;\n swLat: number;\n swLng: number;\n};\n\nexport type PropertyGeoCenterInput = {\n latitude: number;\n longitude: number;\n radiusKm: number;\n};\n\nexport type PropertyFilterInput = {\n search?: string;\n status?: PropertyStatus;\n type?: PropertyType;\n city?: string;\n category?: string;\n priceMin?: number;\n priceMax?: number;\n bedroomsMin?: number;\n amenities?: string[];\n reraVerificationStatus?: ReraVerificationStatus;\n bounds?: PropertyGeoBoundsInput;\n center?: PropertyGeoCenterInput;\n};\n\nexport type TransactionFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n propertyId?: string;\n};\n\nexport type LeaseFilterInput = {\n status?: string;\n type?: string;\n rentalUnitId?: string;\n};\n\nexport type InvestmentFilterInput = {\n search?: string;\n status?: string;\n investmentType?: string;\n riskLevel?: string;\n propertyId?: string;\n};\n\nexport type RentalUnitFilterInput = {\n search?: string;\n status?: string;\n paymentStatus?: string;\n propertyId?: string;\n};\n\nexport type AssetFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n category?: string;\n};\n\nexport type AmcContractFilterInput = {\n search?: string;\n status?: string;\n propertyId?: string;\n};\n\nexport type MarketplaceServiceFilterInput = {\n search?: string;\n category?: string;\n verified?: boolean;\n};\n\nexport type LegalServiceFilterInput = {\n search?: string;\n status?: string;\n category?: string;\n};\n\nexport type VerificationItemFilterInput = {\n search?: string;\n status?: string;\n priority?: string;\n entityType?: string;\n};\n\nexport type CreateVerificationItemInput = {\n entityLabel: string;\n entityType: string;\n entityId?: string;\n priority: string;\n notes?: string;\n documentFileIds?: string[];\n};\n\nexport type ViewingFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n propertyId?: string;\n};\n\nexport type OfferFilterInput = {\n status?: string;\n propertyId?: string;\n};\n\nexport type RentalApplicationFilterInput = {\n search?: string;\n status?: string;\n rentalUnitId?: string;\n};\n\nexport type MaintenanceRequestFilterInput = {\n search?: string;\n status?: string;\n priority?: 'low' | 'medium' | 'high';\n category?: string;\n propertyId?: string;\n rentalUnitId?: string;\n};\n\n/** Options accepted by every server-filtered list hook. */\nexport interface ListOptions<TFilter> {\n filter?: TFilter;\n pagination?: PaginationInput;\n}\n\nconst DEFAULT_LIST_PAGINATION: Required<PaginationInput> = { limit: 50, offset: 0 };\n\nconst getPaginationVariables = (pagination: PaginationInput = DEFAULT_LIST_PAGINATION) => ({\n pagination: {\n limit: pagination.limit ?? DEFAULT_LIST_PAGINATION.limit,\n offset: pagination.offset ?? DEFAULT_LIST_PAGINATION.offset,\n },\n});\n\n// ---------------------------------------------------------------------------\n// Query documents\n// ---------------------------------------------------------------------------\n\nconst GET_DASHBOARD_STATS = gql`\n query GetDashboardStats {\n housingvistaDashboardStats {\n totalProperties\n totalValue\n occupancyRate\n monthlyRevenue\n activeTransactions\n pendingVerifications\n totalInvestments\n totalPortfolioValue\n investmentReturns\n totalTenants\n maintenanceRequests\n unreadMessages\n upcomingViewings\n trends {\n totalProperties {\n label\n value\n }\n monthlyRevenue {\n label\n value\n }\n occupancyRate {\n label\n value\n }\n activeTransactions {\n label\n value\n }\n }\n }\n }\n`;\n\nconst PROPERTY_FIELDS = gql`\n fragment PropertyFields on HousingVistaProperty {\n id\n title\n description\n type\n status\n category\n verificationStatus\n reraRegistrationNo\n reraAuthority\n reraApprovalDate\n reraUrl\n reraVerificationStatus\n imageUrl\n createdAt\n updatedAt\n price {\n amount\n currency\n type\n period\n negotiable\n pricePerSqft\n }\n location {\n address\n city\n state\n country\n pincode\n coordinates {\n latitude\n longitude\n }\n neighborhood\n landmarks\n }\n specifications {\n totalArea\n carpetArea\n builtUpArea\n bedrooms\n bathrooms\n floors\n totalFloors\n parking\n balconies\n furnishingStatus\n ageOfProperty\n facing\n }\n amenities {\n id\n name\n category\n available\n }\n images {\n id\n url\n title\n type\n order\n isPrimary\n }\n }\n`;\n\n// Trust-layer evidence (BOFF-8674) — DETAIL-ONLY. Kept out of the shared\n// PROPERTY_FIELDS on purpose: list/map queries (up to 200 listings) must not\n// resolve evidence files + signed downloadUrls they never render (Codex P2,\n// mfe#19). Only GetProperty spreads this fragment.\nconst PROPERTY_VERIFICATION_FIELDS = gql`\n fragment PropertyVerificationFields on HousingVistaProperty {\n verificationItems {\n id\n entityLabel\n entityType\n status\n submittedAt\n documentFiles {\n id\n name\n downloadUrl\n createdAt\n }\n }\n }\n`;\n\nconst GET_PROPERTIES = gql`\n ${PROPERTY_FIELDS}\n query GetProperties($filter: HousingVistaPropertyFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaProperties(filter: $filter, pagination: $pagination) {\n ...PropertyFields\n }\n }\n`;\n\nconst GET_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n ${PROPERTY_VERIFICATION_FIELDS}\n query GetProperty($id: ID!) {\n housingvistaProperty(id: $id) {\n ...PropertyFields\n ...PropertyVerificationFields\n }\n }\n`;\n\nconst TRANSACTION_FIELDS = gql`\n fragment TransactionFields on HousingVistaTransaction {\n id\n title\n type\n status\n amount\n currency\n documents\n milestones\n parties\n escrow\n # Origin offer this deal was converted from (TXN-01 / BOFF-9171); null for\n # transactions not born from an accepted offer.\n offerId\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n }\n buyer {\n id\n firstName\n lastName\n avatar\n }\n seller {\n id\n firstName\n lastName\n avatar\n }\n tenant {\n id\n firstName\n lastName\n avatar\n }\n landlord {\n id\n firstName\n lastName\n avatar\n }\n }\n`;\n\nconst GET_TRANSACTIONS = gql`\n ${TRANSACTION_FIELDS}\n query GetTransactions($filter: HousingVistaTransactionFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaTransactions(filter: $filter, pagination: $pagination) {\n ...TransactionFields\n }\n }\n`;\n\nconst GET_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n query GetTransaction($id: ID!) {\n housingvistaTransaction(id: $id) {\n ...TransactionFields\n }\n }\n`;\n\nconst INVESTMENT_FIELDS = gql`\n fragment InvestmentFields on HousingVistaInvestment {\n id\n title\n investmentType\n totalValue\n status\n startDate\n maturityDate\n riskLevel\n investors\n returns\n documentFileIds\n property {\n id\n title\n location {\n city\n state\n }\n }\n }\n`;\n\nconst GET_INVESTMENTS = gql`\n ${INVESTMENT_FIELDS}\n query GetInvestments($filter: HousingVistaInvestmentFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaInvestments(filter: $filter, pagination: $pagination) {\n ...InvestmentFields\n }\n }\n`;\n\nconst GET_INVESTMENT_COMPLIANCE = gql`\n query GetHousingvistaInvestmentCompliance {\n housingvistaInvestmentComplianceSetting {\n workspaceId\n eligibilityVerified\n }\n }\n`;\n\nconst GET_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n query GetInvestment($id: ID!) {\n housingvistaInvestment(id: $id) {\n ...InvestmentFields\n }\n }\n`;\n\nconst GET_RENTAL_UNITS = gql`\n query GetRentalUnits($filter: HousingVistaRentalUnitFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaRentalUnits(filter: $filter, pagination: $pagination) {\n id\n propertyId\n propertyTitle\n unitNumber\n tenantName\n tenantEmail\n tenantPhone\n monthlyRent\n leaseStart\n leaseEnd\n status\n lastPaymentDate\n paymentStatus\n securityDeposit\n }\n }\n`;\n\nconst ASSET_FIELDS = gql`\n fragment AssetFields on HousingVistaAsset {\n id\n title\n type\n category\n location\n currentValue\n purchasePrice\n purchaseDate\n appreciationPercent\n rentalYield\n status\n imageUrl\n lastValuationDate\n }\n`;\n\nconst GET_ASSETS = gql`\n ${ASSET_FIELDS}\n query GetAssets($filter: HousingVistaAssetFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaAssets(filter: $filter, pagination: $pagination) {\n ...AssetFields\n }\n }\n`;\n\nconst GET_ASSET = gql`\n ${ASSET_FIELDS}\n query GetAsset($id: ID!) {\n housingvistaAsset(id: $id) {\n ...AssetFields\n }\n }\n`;\n\nconst GET_AMC_CONTRACTS = gql`\n query GetAmcContracts($filter: HousingVistaAmcContractFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaAmcContracts(filter: $filter, pagination: $pagination) {\n id\n propertyId\n marketplaceServiceId\n propertyTitle\n packageName\n providerName\n status\n startDate\n endDate\n monthlyCost\n nextServiceDate\n servicesIncluded\n }\n }\n`;\n\nconst MARKETPLACE_SERVICE_FIELDS = gql`\n fragment MarketplaceServiceFields on HousingVistaMarketplaceService {\n id\n name\n providerName\n category\n description\n rating\n reviewCount\n priceRange\n availableAreas\n responseTime\n verified\n imageUrl\n featured\n }\n`;\n\nconst GET_MARKETPLACE_SERVICES = gql`\n ${MARKETPLACE_SERVICE_FIELDS}\n query GetMarketplaceServices(\n $filter: HousingVistaMarketplaceServiceFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaMarketplaceServices(filter: $filter, pagination: $pagination) {\n ...MarketplaceServiceFields\n }\n }\n`;\n\nconst GET_MARKETPLACE_SERVICE = gql`\n ${MARKETPLACE_SERVICE_FIELDS}\n query GetMarketplaceService($id: ID!) {\n housingvistaMarketplaceService(id: $id) {\n ...MarketplaceServiceFields\n }\n }\n`;\n\nconst VERIFICATION_FIELDS = gql`\n fragment VerificationFields on HousingVistaVerificationItem {\n id\n entityType\n entityId\n entityLabel\n status\n submittedDate\n reviewerName\n priority\n notes\n createdAt\n updatedAt\n }\n`;\n\nconst GET_VERIFICATIONS = gql`\n ${VERIFICATION_FIELDS}\n query GetVerifications($filter: HousingVistaVerificationItemFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaVerificationItems(filter: $filter, pagination: $pagination) {\n ...VerificationFields\n }\n }\n`;\n\nconst GET_VERIFICATION = gql`\n ${VERIFICATION_FIELDS}\n query GetVerification($id: ID!) {\n housingvistaVerificationItem(id: $id) {\n ...VerificationFields\n }\n }\n`;\n\nconst LEGAL_SERVICE_FIELDS = gql`\n fragment LegalServiceFields on HousingVistaLegalService {\n id\n title\n category\n description\n providerName\n providerRating\n estimatedDuration\n priceRange\n status\n consultationFee\n documentsRequired\n }\n`;\n\nconst GET_LEGAL_SERVICES = gql`\n ${LEGAL_SERVICE_FIELDS}\n query GetLegalServices($filter: HousingVistaLegalServiceFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaLegalServices(filter: $filter, pagination: $pagination) {\n ...LegalServiceFields\n }\n }\n`;\n\nconst GET_LEGAL_SERVICE = gql`\n ${LEGAL_SERVICE_FIELDS}\n query GetLegalService($id: ID!) {\n housingvistaLegalService(id: $id) {\n ...LegalServiceFields\n }\n }\n`;\n\nconst HOME_LOAN_FIELDS = gql`\n fragment HomeLoanFields on HousingVistaHomeLoanOffer {\n id\n bankName\n bankLogo\n interestRate\n maxTenure\n maxAmount\n processingFee\n emiPerLakh\n features\n rating\n specialOffer\n prepaymentCharges\n }\n`;\n\nconst GET_HOME_LOANS = gql`\n ${HOME_LOAN_FIELDS}\n query GetHomeLoans($pagination: HousingVistaPaginationInput) {\n housingvistaHomeLoanOffers(pagination: $pagination) {\n ...HomeLoanFields\n }\n }\n`;\n\nconst GET_HOME_LOAN = gql`\n ${HOME_LOAN_FIELDS}\n query GetHomeLoan($id: ID!) {\n housingvistaHomeLoanOffer(id: $id) {\n ...HomeLoanFields\n }\n }\n`;\n\nconst GET_MARKET_TRENDS = gql`\n query GetMarketTrends($pagination: HousingVistaPaginationInput) {\n housingvistaMarketTrends(pagination: $pagination) {\n month\n avgPrice\n avgRent\n demandIndex\n supplyIndex\n priceChangePercent\n }\n }\n`;\n\nconst GET_AREA_INSIGHTS = gql`\n query GetAreaInsights($pagination: HousingVistaPaginationInput) {\n housingvistaAreaInsights(pagination: $pagination) {\n id\n areaName\n city\n avgPropertyPrice\n avgRentalYield\n appreciationRate\n safetyScore\n connectivityScore\n amenitiesScore\n schoolsNearby\n hospitalsNearby\n population\n greenCoverPercent\n upcomingProjects\n avg2BhkPrice\n avg3BhkPrice\n amenitiesRating\n priceTrend {\n period\n avgPrice\n }\n futureProjects {\n name\n type\n expectedCompletion\n description\n }\n nearbyHubs\n transportLinks\n schools\n hospitals\n malls\n }\n }\n`;\n\nconst GET_ANALYTICS = gql`\n query GetHousingvistaAnalytics($period: HousingVistaAnalyticsPeriod) {\n housingvistaAnalytics(period: $period) {\n kpis {\n id\n label\n value\n previousValue\n unit\n trend\n changePercent\n }\n revenueByMonth {\n month\n revenue\n expenses\n }\n propertyTypeDistribution {\n type\n count\n value\n }\n occupancyRate {\n month\n rate\n }\n period\n }\n }\n`;\n\nconst SHORTLIST_FIELDS = gql`\n ${PROPERTY_FIELDS}\n fragment ShortlistFields on HousingVistaShortlist {\n id\n propertyId\n notes\n createdAt\n property {\n ...PropertyFields\n }\n }\n`;\n\nconst GET_SHORTLISTS = gql`\n ${SHORTLIST_FIELDS}\n query GetShortlists($pagination: HousingVistaPaginationInput) {\n housingvistaShortlists(pagination: $pagination) {\n ...ShortlistFields\n }\n }\n`;\n\nconst OFFER_FIELDS = gql`\n fragment OfferFields on HousingVistaOffer {\n id\n propertyId\n amount\n counterAmount\n currency\n status\n notes\n respondedAt\n expiresAt\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n price {\n amount\n currency\n # sale | rent — drives the deal type when converting to a transaction.\n type\n }\n }\n }\n`;\n\nconst GET_OFFERS = gql`\n ${OFFER_FIELDS}\n query GetOffers($filter: HousingVistaOfferFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaOffers(filter: $filter, pagination: $pagination) {\n ...OfferFields\n }\n }\n`;\n\nconst GET_OFFER = gql`\n ${OFFER_FIELDS}\n query GetOffer($id: ID!) {\n housingvistaOffer(id: $id) {\n ...OfferFields\n }\n }\n`;\n\nconst VIEWING_FIELDS = gql`\n fragment ViewingFields on HousingVistaViewing {\n id\n propertyId\n scheduledAt\n type\n status\n slotId\n attendeeName\n attendeeEmail\n notes\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n }\n }\n`;\n\nconst GET_VIEWINGS = gql`\n ${VIEWING_FIELDS}\n query GetViewings($filter: HousingVistaViewingFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaViewings(filter: $filter, pagination: $pagination) {\n ...ViewingFields\n }\n }\n`;\n\nconst GET_VIEWING = gql`\n ${VIEWING_FIELDS}\n query GetViewing($id: ID!) {\n housingvistaViewing(id: $id) {\n ...ViewingFields\n }\n }\n`;\n\nconst RENTAL_APPLICATION_FIELDS = gql`\n fragment RentalApplicationFields on HousingVistaRentalApplication {\n id\n rentalUnitId\n applicantName\n applicantEmail\n applicantPhone\n monthlyIncome\n moveInDate\n status\n reviewNotes\n reviewedAt\n createdAt\n updatedAt\n documentFileIds\n rentalUnit {\n id\n unitNumber\n propertyTitle\n monthlyRent\n }\n }\n`;\n\nconst GET_RENTAL_APPLICATIONS = gql`\n ${RENTAL_APPLICATION_FIELDS}\n query GetRentalApplications(\n $filter: HousingVistaRentalApplicationFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaRentalApplications(filter: $filter, pagination: $pagination) {\n ...RentalApplicationFields\n }\n }\n`;\n\nconst MAINTENANCE_FIELDS = gql`\n fragment MaintenanceFields on HousingVistaMaintenanceRequest {\n id\n propertyId\n rentalUnitId\n title\n description\n category\n priority\n status\n resolutionNotes\n resolvedAt\n createdAt\n updatedAt\n }\n`;\n\nconst GET_MAINTENANCE_REQUESTS = gql`\n ${MAINTENANCE_FIELDS}\n query GetMaintenanceRequests(\n $filter: HousingVistaMaintenanceRequestFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaMaintenanceRequests(filter: $filter, pagination: $pagination) {\n ...MaintenanceFields\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Mutation documents\n// ---------------------------------------------------------------------------\n\nconst CREATE_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n mutation CreateHousingvistaProperty($input: HousingVistaCreatePropertyInput!) {\n createHousingvistaProperty(input: $input) {\n ...PropertyFields\n }\n }\n`;\n\nconst UPDATE_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n mutation UpdateHousingvistaProperty($id: ID!, $input: HousingVistaUpdatePropertyInput!) {\n updateHousingvistaProperty(id: $id, input: $input) {\n ...PropertyFields\n }\n }\n`;\n\nconst DELETE_PROPERTY = gql`\n mutation DeleteHousingvistaProperty($id: ID!) {\n deleteHousingvistaProperty(id: $id)\n }\n`;\n\nconst SAVE_SHORTLIST = gql`\n ${SHORTLIST_FIELDS}\n mutation SaveHousingvistaShortlist($input: HousingVistaSaveShortlistInput!) {\n saveHousingvistaShortlist(input: $input) {\n ...ShortlistFields\n }\n }\n`;\n\nconst REMOVE_SHORTLIST = gql`\n mutation RemoveHousingvistaShortlist($propertyId: ID!) {\n removeHousingvistaShortlist(propertyId: $propertyId)\n }\n`;\n\nconst BOOK_VIEWING = gql`\n mutation BookHousingvistaViewing($input: HousingVistaBookViewingInput!) {\n bookHousingvistaViewing(input: $input) {\n id\n propertyId\n scheduledAt\n slotId\n type\n status\n attendeeName\n attendeeEmail\n notes\n }\n }\n`;\n\nconst CANCEL_VIEWING = gql`\n mutation CancelHousingvistaViewing($id: ID!) {\n cancelHousingvistaViewing(id: $id) {\n id\n status\n }\n }\n`;\n\nconst SUBMIT_OFFER = gql`\n mutation SubmitHousingvistaOffer($input: HousingVistaSubmitOfferInput!) {\n submitHousingvistaOffer(input: $input) {\n id\n propertyId\n amount\n currency\n status\n notes\n expiresAt\n createdAt\n }\n }\n`;\n\nconst RESPOND_OFFER = gql`\n mutation RespondHousingvistaOffer($id: ID!, $input: HousingVistaRespondOfferInput!) {\n respondHousingvistaOffer(id: $id, input: $input) {\n id\n status\n counterAmount\n respondedAt\n }\n }\n`;\n\nconst CREATE_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n mutation CreateHousingvistaTransaction($input: HousingVistaCreateTransactionInput!) {\n createHousingvistaTransaction(input: $input) {\n ...TransactionFields\n }\n }\n`;\n\nconst CREATE_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n mutation CreateHousingvistaInvestment($input: HousingVistaCreateInvestmentInput!) {\n createHousingvistaInvestment(input: $input) {\n ...InvestmentFields\n }\n }\n`;\n\nconst CREATE_RENTAL_UNIT = gql`\n mutation CreateHousingvistaRentalUnit($input: HousingVistaCreateRentalUnitInput!) {\n createHousingvistaRentalUnit(input: $input) {\n id\n propertyTitle\n unitNumber\n tenantName\n monthlyRent\n status\n }\n }\n`;\n\nconst SUBMIT_RENTAL_APPLICATION = gql`\n mutation SubmitHousingvistaRentalApplication($input: HousingVistaSubmitRentalApplicationInput!) {\n submitHousingvistaRentalApplication(input: $input) {\n id\n rentalUnitId\n applicantName\n status\n }\n }\n`;\n\nconst CREATE_AMC_CONTRACT = gql`\n mutation CreateHousingvistaAmcContract($input: HousingVistaCreateAmcContractInput!) {\n createHousingvistaAmcContract(input: $input) {\n id\n propertyTitle\n packageName\n providerName\n monthlyCost\n status\n }\n }\n`;\n\nconst CREATE_MAINTENANCE_REQUEST = gql`\n mutation CreateHousingvistaMaintenanceRequest($input: HousingVistaCreateMaintenanceRequestInput!) {\n createHousingvistaMaintenanceRequest(input: $input) {\n id\n title\n category\n priority\n status\n }\n }\n`;\n\nconst CREATE_VERIFICATION_ITEM = gql`\n mutation CreateHousingvistaVerificationItem($input: HousingVistaCreateVerificationItemInput!) {\n createHousingvistaVerificationItem(input: $input) {\n id\n status\n entityLabel\n }\n }\n`;\n\nconst APPROVE_VERIFICATION = gql`\n mutation ApproveHousingvistaVerificationItem($id: ID!, $notes: String) {\n approveHousingvistaVerificationItem(id: $id, notes: $notes) {\n id\n status\n reviewerName\n notes\n # Needed to sync the normalized listing record (badge) in the cache\n # after a decision (reviewer P2, mfe#19).\n entityType\n entityId\n }\n }\n`;\n\nconst REJECT_VERIFICATION = gql`\n mutation RejectHousingvistaVerificationItem($id: ID!, $notes: String) {\n rejectHousingvistaVerificationItem(id: $id, notes: $notes) {\n id\n status\n reviewerName\n notes\n entityType\n entityId\n }\n }\n`;\n\nconst UPDATE_PROPERTY_RERA_STATUS = gql`\n mutation UpdateHousingvistaPropertyReraStatus(\n $id: ID!\n $status: HousingVistaReraVerificationStatus!\n $notes: String\n ) {\n updateHousingvistaPropertyReraStatus(id: $id, status: $status, notes: $notes) {\n id\n reraVerificationStatus\n reraApprovalDate\n }\n }\n`;\n\nconst WITHDRAW_OFFER = gql`\n mutation WithdrawHousingvistaOffer($id: ID!) {\n withdrawHousingvistaOffer(id: $id) {\n id\n status\n }\n }\n`;\n\nconst VIEWING_SLOT_FIELDS = gql`\n fragment ViewingSlotFields on HousingVistaViewingSlot {\n id\n propertyId\n startsAt\n endsAt\n status\n }\n`;\n\nconst GET_VIEWING_SLOTS = gql`\n ${VIEWING_SLOT_FIELDS}\n query GetViewingSlots($propertyId: ID!, $includeBooked: Boolean, $pagination: HousingVistaPaginationInput) {\n housingvistaViewingSlots(propertyId: $propertyId, includeBooked: $includeBooked, pagination: $pagination) {\n ...ViewingSlotFields\n }\n }\n`;\n\nconst PUBLISH_VIEWING_SLOTS = gql`\n ${VIEWING_SLOT_FIELDS}\n mutation PublishHousingvistaViewingSlots($input: HousingVistaPublishViewingSlotsInput!) {\n publishHousingvistaViewingSlots(input: $input) {\n ...ViewingSlotFields\n }\n }\n`;\n\nconst CANCEL_VIEWING_SLOT = gql`\n mutation CancelHousingvistaViewingSlot($id: ID!) {\n cancelHousingvistaViewingSlot(id: $id) {\n id\n status\n }\n }\n`;\n\nconst UPDATE_VIEWING = gql`\n mutation UpdateHousingvistaViewing($id: ID!, $input: HousingVistaUpdateViewingInput!) {\n updateHousingvistaViewing(id: $id, input: $input) {\n id\n scheduledAt\n status\n type\n notes\n }\n }\n`;\n\nconst UPDATE_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n mutation UpdateHousingvistaInvestment($id: ID!, $input: HousingVistaUpdateInvestmentInput!) {\n updateHousingvistaInvestment(id: $id, input: $input) {\n ...InvestmentFields\n }\n }\n`;\n\nconst DELETE_INVESTMENT = gql`\n mutation DeleteHousingvistaInvestment($id: ID!) {\n deleteHousingvistaInvestment(id: $id)\n }\n`;\n\nconst CREATE_ASSET = gql`\n ${ASSET_FIELDS}\n mutation CreateHousingvistaAsset($input: HousingVistaCreateAssetInput!) {\n createHousingvistaAsset(input: $input) {\n ...AssetFields\n }\n }\n`;\n\nconst UPDATE_ASSET = gql`\n ${ASSET_FIELDS}\n mutation UpdateHousingvistaAsset($id: ID!, $input: HousingVistaUpdateAssetInput!) {\n updateHousingvistaAsset(id: $id, input: $input) {\n ...AssetFields\n }\n }\n`;\n\nconst DELETE_ASSET = gql`\n mutation DeleteHousingvistaAsset($id: ID!) {\n deleteHousingvistaAsset(id: $id)\n }\n`;\n\nconst UPDATE_AMC_CONTRACT = gql`\n mutation UpdateHousingvistaAmcContract($id: ID!, $input: HousingVistaUpdateAmcContractInput!) {\n updateHousingvistaAmcContract(id: $id, input: $input) {\n id\n status\n packageName\n providerName\n monthlyCost\n }\n }\n`;\n\nconst DELETE_AMC_CONTRACT = gql`\n mutation DeleteHousingvistaAmcContract($id: ID!) {\n deleteHousingvistaAmcContract(id: $id)\n }\n`;\n\nconst UPDATE_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n mutation UpdateHousingvistaTransaction($id: ID!, $input: HousingVistaUpdateTransactionInput!) {\n updateHousingvistaTransaction(id: $id, input: $input) {\n ...TransactionFields\n }\n }\n`;\n\nconst DELETE_TRANSACTION = gql`\n mutation DeleteHousingvistaTransaction($id: ID!) {\n deleteHousingvistaTransaction(id: $id)\n }\n`;\n\nconst RESOLVE_MAINTENANCE = gql`\n ${MAINTENANCE_FIELDS}\n mutation ResolveHousingvistaMaintenanceRequest($id: ID!, $resolutionNotes: String) {\n resolveHousingvistaMaintenanceRequest(id: $id, resolutionNotes: $resolutionNotes) {\n ...MaintenanceFields\n }\n }\n`;\n\nconst REVIEW_RENTAL_APPLICATION = gql`\n ${RENTAL_APPLICATION_FIELDS}\n mutation ReviewHousingvistaRentalApplication($id: ID!, $input: HousingVistaReviewRentalApplicationInput!) {\n reviewHousingvistaRentalApplication(id: $id, input: $input) {\n ...RentalApplicationFields\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Query-result row shapes (as selected above)\n// ---------------------------------------------------------------------------\n\ninterface PropertyVerificationItemRow {\n id: string;\n entityLabel: string;\n entityType: string;\n status: string;\n submittedAt: string;\n documentFiles: {\n id: string;\n name: string;\n downloadUrl: string | null;\n createdAt: string;\n }[];\n}\n\ninterface PropertyRow {\n id: string;\n title: string;\n description: string | null;\n type: Property['type'];\n status: Property['status'];\n category: string;\n verificationStatus: string;\n reraRegistrationNo: string | null;\n reraAuthority: string | null;\n reraApprovalDate: string | null;\n reraUrl: string | null;\n reraVerificationStatus: ReraVerificationStatus;\n imageUrl: string | null;\n createdAt: string;\n updatedAt: string;\n price: Property['price'];\n location: Omit<Property['location'], 'coordinates'> & {\n coordinates: { latitude: number; longitude: number } | null;\n };\n specifications: Property['specifications'];\n amenities: Property['amenities'];\n images: Property['images'];\n // Trust layer (BOFF-8674): verification checks filed against the listing.\n // Detail-only (see PROPERTY_VERIFICATION_FIELDS) — absent on list rows.\n verificationItems?: PropertyVerificationItemRow[];\n}\n\ninterface TransactionRow {\n id: string;\n title: string;\n type: string;\n status: string;\n amount: number;\n currency: string;\n documents: unknown;\n milestones: unknown;\n parties: unknown;\n escrow: unknown;\n /** Origin offer id when this deal was converted from an accepted offer (TXN-01). */\n offerId: string | null;\n createdAt: string;\n updatedAt: string;\n property: PropertyRow | null;\n buyer: TxParty | null;\n seller: TxParty | null;\n tenant: TxParty | null;\n landlord: TxParty | null;\n}\n\ninterface TxParty {\n id: string | null;\n firstName: string | null;\n lastName: string | null;\n avatar: string | null;\n}\n\ninterface InvestmentRow {\n id: string;\n title: string;\n investmentType: string;\n totalValue: number;\n status: string;\n startDate: string;\n maturityDate: string | null;\n riskLevel: string;\n investors: unknown;\n returns: unknown;\n documentFileIds: string[];\n property: PropertyRow | null;\n}\n\ninterface ShortlistRow {\n id: string;\n propertyId: string;\n notes: string | null;\n createdAt: string;\n property: PropertyRow;\n}\n\n// ---------------------------------------------------------------------------\n// Mappers: GraphQL row → MFE domain type\n// ---------------------------------------------------------------------------\n\n/**\n * The domain `Property` carries display-only fields the subgraph does not\n * resolve (owner/documents/features/virtualTours/availability). We fill the\n * present fields from the query and default the rest to empty so consumers can\n * render honest empty-states rather than crashing on `undefined`.\n */\nconst mapProperty = (row: PropertyRow): Property => ({\n id: row.id,\n title: row.title,\n description: row.description ?? '',\n type: row.type,\n status: row.status,\n category: row.category as Property['category'],\n price: row.price,\n location: {\n ...row.location,\n coordinates: row.location.coordinates ?? { latitude: 0, longitude: 0 },\n },\n specifications: row.specifications,\n amenities: row.amenities ?? [],\n images: row.images ?? [],\n // Trust layer (BOFF-8674): flatten each verification check's evidence\n // files into the existing PropertyDocument shape so any consumer of\n // property.documents sees per-document verification. The check's status\n // covers its whole document set (batch-level truth; the item IS the\n // document batch here) — 'approved' maps to the 'verified' signal the\n // badge/filter already use.\n documents: (row.verificationItems ?? []).flatMap((item) =>\n (item.documentFiles ?? []).map((file) => ({\n id: file.id,\n name: file.name,\n type: 'verification',\n url: file.downloadUrl ?? '',\n verificationStatus: (item.status === 'approved' ? 'verified' : item.status) as VerificationStatus,\n // The File's own createdAt is the upload time — the item's submittedAt\n // can be later than the actual upload if the agent drafted first\n // (Codex P2, mfe#19).\n uploadedAt: new Date(file.createdAt),\n }))\n ),\n virtualTours: [],\n owner: { id: '', name: '', email: '', phone: '', verified: false },\n features: [],\n verificationStatus: (row.verificationStatus as Property['verificationStatus']) ?? 'pending',\n availability: { available: true },\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n reraRegistrationNo: row.reraRegistrationNo,\n reraAuthority: row.reraAuthority,\n reraApprovalDate: row.reraApprovalDate ? new Date(row.reraApprovalDate) : null,\n reraUrl: row.reraUrl,\n reraVerificationStatus: row.reraVerificationStatus ?? 'not_applicable',\n});\n\n// ---------------------------------------------------------------------------\n// Query hooks\n// ---------------------------------------------------------------------------\n\nconst emptyTrends: DashboardTrends = {\n totalProperties: [],\n monthlyRevenue: [],\n occupancyRate: [],\n activeTransactions: [],\n};\n\nexport const useDashboardStats = () => {\n const { data, loading, error } = useQuery<{ housingvistaDashboardStats: DashboardStats }>(GET_DASHBOARD_STATS);\n const empty: DashboardStats = {\n totalProperties: 0,\n totalValue: 0,\n occupancyRate: 0,\n monthlyRevenue: 0,\n activeTransactions: 0,\n pendingVerifications: 0,\n totalInvestments: 0,\n investmentReturns: 0,\n totalTenants: 0,\n maintenanceRequests: 0,\n unreadMessages: 0,\n upcomingViewings: 0,\n trends: emptyTrends,\n };\n return { data: data?.housingvistaDashboardStats ?? empty, loading, error };\n};\n\nexport const useRecentActivities = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaTransactions: TransactionRow[] }>(GET_TRANSACTIONS, {\n variables: getPaginationVariables(pagination),\n });\n const activities: RecentActivity[] = (data?.housingvistaTransactions ?? []).map((txn) => ({\n id: `act-${txn.id}`,\n type: 'transaction_update',\n title: `Transaction: ${txn.type}`,\n description: `${txn.property?.title ?? 'Property'} - ${txn.status}`,\n timestamp: txn.updatedAt || txn.createdAt,\n entityId: txn.id,\n entityType: 'transaction',\n actorName: txn.buyer\n ? `${txn.buyer.firstName ?? ''} ${txn.buyer.lastName ?? ''}`.trim()\n : txn.tenant\n ? `${txn.tenant.firstName ?? ''} ${txn.tenant.lastName ?? ''}`.trim()\n : 'System',\n actorAvatar: txn.buyer?.avatar ?? txn.tenant?.avatar ?? undefined,\n }));\n return { data: activities, loading, error };\n};\n\nexport const useProperties = (options?: {\n filter?: PropertyFilterInput;\n pagination?: PaginationInput;\n skip?: boolean;\n}) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaProperties: PropertyRow[] }>(GET_PROPERTIES, {\n variables: {\n filter: options?.filter,\n ...getPaginationVariables(options?.pagination),\n },\n skip: options?.skip,\n });\n return {\n data: (data?.housingvistaProperties ?? []).map(mapProperty),\n loading,\n error,\n refetch,\n };\n};\n\nexport const useProperty = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaProperty: PropertyRow | null }>(GET_PROPERTY, {\n variables: { id: id ?? '' },\n skip: !id,\n // cache-and-network: the Documents tab's evidence can change from the\n // Verification Center (or another reviewer) between visits — serve the\n // cache instantly but always reconcile against the network on mount\n // (Codex P2, mfe#19).\n fetchPolicy: 'cache-and-network',\n });\n return {\n data: data?.housingvistaProperty ? mapProperty(data.housingvistaProperty) : null,\n loading,\n error,\n };\n};\n\n// BOFF-4129 — natural-language property search. `method` tells the caller\n// whether the filter shown was extracted by an LLM ('ai') or the\n// deterministic keyword baseline ('keyword'); `fallbackReason` is set when\n// an AI attempt was made and failed. `results` are always a real\n// `listProperties` query result — never LLM-generated listing data.\nexport interface NlSearchFilter {\n city?: string | null;\n type?: PropertyType | null;\n status?: PropertyStatus | null;\n category?: string | null;\n priceMin?: number | null;\n priceMax?: number | null;\n bedroomsMin?: number | null;\n amenities?: string[] | null;\n reraVerificationStatus?: string | null;\n}\n\ninterface NlSearchResultRow {\n query: string;\n method: 'ai' | 'keyword';\n fallbackReason: string | null;\n filter: NlSearchFilter;\n properties: PropertyRow[];\n}\n\nconst NL_SEARCH_PROPERTIES = gql`\n ${PROPERTY_FIELDS}\n query HousingVistaNaturalLanguageSearch($query: String!, $pagination: HousingVistaPaginationInput) {\n housingvistaNaturalLanguageSearch(query: $query, pagination: $pagination) {\n query\n method\n fallbackReason\n filter {\n city\n type\n status\n category\n priceMin\n priceMax\n bedroomsMin\n amenities\n reraVerificationStatus\n }\n properties {\n ...PropertyFields\n }\n }\n }\n`;\n\nexport const useNaturalLanguageSearch = () => {\n const [run, { data, loading, error }] = useLazyQuery<\n { housingvistaNaturalLanguageSearch: NlSearchResultRow },\n { query: string; pagination?: PaginationInput }\n >(NL_SEARCH_PROPERTIES);\n\n const search = (query: string, pagination?: PaginationInput) => run({ variables: { query, pagination } });\n\n const result = data?.housingvistaNaturalLanguageSearch;\n return {\n search,\n loading,\n error,\n method: result?.method ?? null,\n fallbackReason: result?.fallbackReason ?? null,\n filter: result?.filter ?? null,\n properties: (result?.properties ?? []).map(mapProperty),\n };\n};\n\nexport const useTransactions = (options?: ListOptions<TransactionFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaTransactions: TransactionRow[] }>(GET_TRANSACTIONS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n // Transaction JSON columns (documents/milestones/parties/escrow) are opaque to\n // the schema; the page guards their runtime shape. Cast is localized here.\n return { data: (data?.housingvistaTransactions ?? []) as unknown as Transaction[], loading, error, refetch };\n};\n\n/**\n * Generic paged-to-completion reader: the svc caps a page at 100, so crawl\n * until a short page (50-page safety bound = 5,000 rows). Pure crawl: state\n * is written only behind the caller's cancellation guard, so a stopped crawl\n * never publishes partial results. Exposes error + refetch so callers can\n * tell \"no rows\" apart from \"we don't know\" and refresh after a mutation.\n */\nfunction useAllPages<TRow>(query: DocumentNode, listField: string, baseVariables?: Record<string, unknown>) {\n const client = useApolloClient();\n const [data, setData] = useState<TRow[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n // Ref indirection so an inline baseVariables object (new ref every render)\n // cannot re-trigger the crawl effect on every render.\n const baseVariablesRef = useRef(baseVariables);\n useEffect(() => {\n baseVariablesRef.current = baseVariables;\n }, [baseVariables]);\n\n const fetchAll = useCallback(\n async (shouldStop?: () => boolean): Promise<TRow[]> => {\n const all: TRow[] = [];\n let offset = 0;\n const MAX_PAGES = 50;\n for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex += 1) {\n if (shouldStop?.()) break;\n const result = await client.query<{ [key: string]: TRow[] | undefined }>({\n query,\n variables: { ...baseVariablesRef.current, pagination: { limit: 100, offset } },\n fetchPolicy: 'network-only',\n });\n const page = result.data?.[listField] ?? [];\n all.push(...page);\n if (page.length < 100) break;\n offset += page.length;\n }\n return all;\n },\n [client, query, listField]\n );\n\n // Monotonic generation: a crawl superseded by a newer one (e.g. refetch()\n // racing an in-flight initial crawl) must never write state — only the\n // latest generation publishes.\n const generationRef = useRef(0);\n\n const refetch = useCallback(async () => {\n const generation = ++generationRef.current;\n setLoading(true);\n setError(null);\n try {\n const all = await fetchAll();\n if (generation !== generationRef.current) return;\n setData(all);\n } catch (err) {\n if (generation === generationRef.current) setError(err as Error);\n } finally {\n if (generation === generationRef.current) setLoading(false);\n }\n }, [fetchAll]);\n\n useEffect(() => {\n let cancelled = false;\n const generation = ++generationRef.current;\n setLoading(true);\n setError(null);\n fetchAll(() => cancelled)\n .then((all) => {\n if (!cancelled && generation === generationRef.current) setData(all);\n })\n .catch((err) => {\n if (!cancelled && generation === generationRef.current) setError(err as Error);\n })\n .finally(() => {\n // A refetch() that started meanwhile owns the loading flag and the error state now.\n if (!cancelled && generation === generationRef.current) setLoading(false);\n });\n return () => {\n cancelled = true;\n };\n }, [fetchAll]);\n\n return { data, loading, error, refetch };\n}\n\n/**\n * Every transaction in the workspace, paged to completion. Used where the UI\n * must match rows across the full set — e.g. the OffersPage \"Create deal\"\n * gate, which must see a deal converted from any accepted offer no matter\n * where it falls in the list.\n */\nexport const useAllTransactions = () => {\n const { data, loading, error, refetch } = useAllPages<TransactionRow>(GET_TRANSACTIONS, 'housingvistaTransactions');\n // Transaction JSON columns are opaque to the schema; pages guard their\n // runtime shape. Cast is localized here.\n return {\n data: data as unknown as Transaction[],\n loading,\n error,\n refetch,\n };\n};\n\nexport const useTransaction = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaTransaction: TransactionRow | null }>(GET_TRANSACTION, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return {\n data: (data?.housingvistaTransaction ?? null) as unknown as Transaction | null,\n loading,\n error,\n };\n};\n\nexport const useInvestments = (options?: ListOptions<InvestmentFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaInvestments: InvestmentRow[] }>(GET_INVESTMENTS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: (data?.housingvistaInvestments ?? []) as unknown as Investment[], loading, error, refetch };\n};\n\n/**\n * Whether the workspace's investor eligibility is verified (BOFF-9839). Fails\n * closed: while loading, when the caller may not read the setting (admin-only\n * `investment-compliance:read`; skipped so a non-admin never triggers a\n * permission toast), or when the read fails, it reports `false`, so the UI\n * only offers the expression-of-interest status. The server gate is the\n * enforcement point either way.\n */\nexport const useInvestmentCompliance = () => {\n const permissions = useSafePermissions();\n const canRead =\n permissions !== null && !permissions.isLoading && permissions.hasPermission('investment-compliance:read');\n const { data, loading } = useQuery<{\n housingvistaInvestmentComplianceSetting: { workspaceId: string; eligibilityVerified: boolean };\n }>(GET_INVESTMENT_COMPLIANCE, { skip: !canRead });\n return {\n eligibilityVerified: data?.housingvistaInvestmentComplianceSetting.eligibilityVerified === true,\n // True until the answer is known: permissions still resolving, or the read in flight. A\n // skipped read (no permission) is settled, not loading — it stays fail-closed.\n loading: permissions !== null && (permissions.isLoading || (canRead && loading)),\n };\n};\n\nexport const useInvestment = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaInvestment: InvestmentRow | null }>(GET_INVESTMENT, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: (data?.housingvistaInvestment ?? null) as unknown as Investment | null, loading, error, refetch };\n};\n\nexport const useRentalUnits = (options?: ListOptions<RentalUnitFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaRentalUnits: RentalUnit[] }>(GET_RENTAL_UNITS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaRentalUnits ?? [], loading, error, refetch };\n};\n\nexport const useAssets = (options?: ListOptions<AssetFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaAssets: Asset[] }>(GET_ASSETS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaAssets ?? [], loading, error, refetch };\n};\n\nexport const useAsset = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaAsset: Asset | null }>(GET_ASSET, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaAsset ?? null, loading, error };\n};\n\n// servicesIncluded is a JSON column: a contract created without services reads back null.\nconst normalizeAmcContracts = (contracts: AMCContract[]): AMCContract[] =>\n contracts.map((contract) => ({\n ...contract,\n servicesIncluded: Array.isArray(contract.servicesIncluded) ? contract.servicesIncluded : [],\n }));\n\nexport const useAMCContracts = (options?: ListOptions<AmcContractFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaAmcContracts: AMCContract[] }>(GET_AMC_CONTRACTS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n const contracts = useMemo(() => normalizeAmcContracts(data?.housingvistaAmcContracts ?? []), [data]);\n return { data: contracts, loading, error, refetch };\n};\n\n/**\n * Every AMC contract in the workspace, paged to completion (BOFF-9605). The list page shows 10 at a time and\n * filters by search, so anything that must describe the whole portfolio — the stat cards and the service\n * schedule — reads this instead. Not an Apollo watch query: call `refetch` after a mutation.\n */\nexport const useAllAmcContracts = () => {\n const { data, loading, error, refetch } = useAllPages<AMCContract>(GET_AMC_CONTRACTS, 'housingvistaAmcContracts');\n const contracts = useMemo(() => normalizeAmcContracts(data), [data]);\n return { data: contracts, loading, error, refetch };\n};\n\nexport const useMarketplaceServices = (options?: ListOptions<MarketplaceServiceFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaMarketplaceServices: MarketplaceService[] }>(\n GET_MARKETPLACE_SERVICES,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaMarketplaceServices ?? [], loading, error, refetch };\n};\n\nexport const useMarketplaceService = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaMarketplaceService: MarketplaceService | null }>(\n GET_MARKETPLACE_SERVICE,\n { variables: { id: id ?? '' }, skip: !id }\n );\n return { data: data?.housingvistaMarketplaceService ?? null, loading, error };\n};\n\nexport const useVerifications = (options?: ListOptions<VerificationItemFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaVerificationItems: VerificationItem[] }>(\n GET_VERIFICATIONS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaVerificationItems ?? [], loading, error, refetch };\n};\n\n/**\n * Single verification item. The detail view needs the audit timestamps\n * (`createdAt`/`updatedAt`) that the list type omits, so the result is typed as\n * `VerificationItem` extended with those ISO-string fields.\n */\nexport type VerificationItemDetail = VerificationItem & {\n createdAt: string;\n updatedAt: string;\n};\n\nexport const useVerificationItem = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaVerificationItem: VerificationItemDetail | null }>(\n GET_VERIFICATION,\n { variables: { id: id ?? '' }, skip: !id }\n );\n return { data: data?.housingvistaVerificationItem ?? null, loading, error, refetch };\n};\n\nexport const useLegalServices = (options?: ListOptions<LegalServiceFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaLegalServices: LegalService[] }>(\n GET_LEGAL_SERVICES,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaLegalServices ?? [], loading, error, refetch };\n};\n\nexport const useLegalService = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaLegalService: LegalService | null }>(GET_LEGAL_SERVICE, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaLegalService ?? null, loading, error };\n};\n\nexport const useHomeLoans = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaHomeLoanOffers: HomeLoan[] }>(GET_HOME_LOANS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaHomeLoanOffers ?? [], loading, error };\n};\n\nexport const useHomeLoanOffer = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaHomeLoanOffer: HomeLoan | null }>(GET_HOME_LOAN, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaHomeLoanOffer ?? null, loading, error };\n};\n\nexport const useMarketTrends = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaMarketTrends: MarketTrend[] }>(GET_MARKET_TRENDS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaMarketTrends ?? [], loading, error };\n};\n\nexport const useAreaInsights = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaAreaInsights: AreaInsight[] }>(GET_AREA_INSIGHTS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaAreaInsights ?? [], loading, error };\n};\n\n// ---------------------------------------------------------------------------\n// Catalog authoring (BOFF-9838): marketplace services, legal services, home-loan offers, area insights\n// ---------------------------------------------------------------------------\n\n/** An update input: every field optional, and null clears a nullable one. */\ntype CatalogUpdate<T> = { [K in keyof T]?: T[K] | null };\n\nexport interface MarketplaceServiceInput {\n name: string;\n providerName: string;\n category: string;\n description?: string;\n imageUrl?: string;\n priceRange?: string;\n responseTime?: string;\n rating?: number;\n reviewCount?: number;\n verified?: boolean;\n featured?: boolean;\n availableAreas?: string[];\n}\n\nexport interface LegalServiceInput {\n title: string;\n providerName: string;\n category: string;\n status: string;\n description?: string;\n providerRating?: number;\n estimatedDuration?: string;\n priceRange?: string;\n consultationFee?: number;\n documentsRequired?: string[];\n}\n\nexport interface HomeLoanOfferInput {\n bankName: string;\n interestRate: number;\n maxTenure: number;\n maxAmount: number;\n bankLogo?: string;\n emiPerLakh?: number;\n processingFee?: string;\n prepaymentCharges?: string;\n specialOffer?: string;\n rating?: number;\n features?: string[];\n}\n\nexport interface AreaInsightInput {\n areaName: string;\n city: string;\n safetyScore: number;\n connectivityScore: number;\n amenitiesScore: number;\n schoolsNearby: number;\n hospitalsNearby: number;\n population: number;\n greenCoverPercent: number;\n avgPropertyPrice: number;\n avgRentalYield: number;\n appreciationRate: number;\n upcomingProjects: number;\n avg2BhkPrice?: number;\n avg3BhkPrice?: number;\n amenitiesRating?: number;\n nearbyHubs?: string[];\n transportLinks?: string[];\n schools?: string[];\n hospitals?: string[];\n malls?: string[];\n}\n\nconst CREATE_MARKETPLACE_SERVICE = gql`\n mutation CreateHousingvistaMarketplaceService($input: HousingVistaCreateMarketplaceServiceInput!) {\n createHousingvistaMarketplaceService(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_MARKETPLACE_SERVICE = gql`\n mutation UpdateHousingvistaMarketplaceService($id: ID!, $input: HousingVistaUpdateMarketplaceServiceInput!) {\n updateHousingvistaMarketplaceService(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_MARKETPLACE_SERVICE = gql`\n mutation DeleteHousingvistaMarketplaceService($id: ID!) {\n deleteHousingvistaMarketplaceService(id: $id)\n }\n`;\nconst CREATE_LEGAL_SERVICE = gql`\n mutation CreateHousingvistaLegalService($input: HousingVistaCreateLegalServiceInput!) {\n createHousingvistaLegalService(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_LEGAL_SERVICE = gql`\n mutation UpdateHousingvistaLegalService($id: ID!, $input: HousingVistaUpdateLegalServiceInput!) {\n updateHousingvistaLegalService(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_LEGAL_SERVICE = gql`\n mutation DeleteHousingvistaLegalService($id: ID!) {\n deleteHousingvistaLegalService(id: $id)\n }\n`;\nconst CREATE_HOME_LOAN_OFFER = gql`\n mutation CreateHousingvistaHomeLoanOffer($input: HousingVistaCreateHomeLoanOfferInput!) {\n createHousingvistaHomeLoanOffer(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_HOME_LOAN_OFFER = gql`\n mutation UpdateHousingvistaHomeLoanOffer($id: ID!, $input: HousingVistaUpdateHomeLoanOfferInput!) {\n updateHousingvistaHomeLoanOffer(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_HOME_LOAN_OFFER = gql`\n mutation DeleteHousingvistaHomeLoanOffer($id: ID!) {\n deleteHousingvistaHomeLoanOffer(id: $id)\n }\n`;\nconst CREATE_AREA_INSIGHT = gql`\n mutation CreateHousingvistaAreaInsight($input: HousingVistaCreateAreaInsightInput!) {\n createHousingvistaAreaInsight(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_AREA_INSIGHT = gql`\n mutation UpdateHousingvistaAreaInsight($id: ID!, $input: HousingVistaUpdateAreaInsightInput!) {\n updateHousingvistaAreaInsight(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_AREA_INSIGHT = gql`\n mutation DeleteHousingvistaAreaInsight($id: ID!) {\n deleteHousingvistaAreaInsight(id: $id)\n }\n`;\n\n/**\n * One catalog write. `refetchQueries` reaches only the list that is mounted, so the cached list pages and the detail\n * of the changed entity are evicted too: whatever is mounted refetches, whatever is not drops its stale copy.\n */\nfunction useCatalogWrite<TVars extends Record<string, unknown>>(\n document: DocumentNode,\n cacheFields: readonly string[],\n listQuery: string\n) {\n const [mutate, { loading }] = useMutation<Record<string, unknown>, TVars>(document, {\n refetchQueries: [listQuery],\n update: (cache: ApolloCache) => {\n for (const fieldName of cacheFields) cache.evict({ fieldName });\n cache.gc();\n },\n });\n const run = async (variables: TVars): Promise<unknown> => {\n const res = await mutate({ variables });\n return res.data;\n };\n return { run, loading };\n}\n\nconst MARKETPLACE_CACHE = ['housingvistaMarketplaceServices', 'housingvistaMarketplaceService'] as const;\nconst LEGAL_CACHE = ['housingvistaLegalServices', 'housingvistaLegalService'] as const;\nconst HOME_LOAN_CACHE = ['housingvistaHomeLoanOffers', 'housingvistaHomeLoanOffer'] as const;\nconst AREA_INSIGHT_CACHE = ['housingvistaAreaInsights'] as const;\n\nexport const useCreateMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ input: MarketplaceServiceInput }>(\n CREATE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n createMarketplaceService: async (input: MarketplaceServiceInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<MarketplaceServiceInput> }>(\n UPDATE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n updateMarketplaceService: async (id: string, input: CatalogUpdate<MarketplaceServiceInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(\n DELETE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n deleteMarketplaceService: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaMarketplaceService?: boolean } | undefined;\n return data?.deleteHousingvistaMarketplaceService ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateLegalService = () => {\n const { run, loading } = useCatalogWrite<{ input: LegalServiceInput }>(\n CREATE_LEGAL_SERVICE,\n LEGAL_CACHE,\n 'GetLegalServices'\n );\n return {\n createLegalService: async (input: LegalServiceInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateLegalService = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<LegalServiceInput> }>(\n UPDATE_LEGAL_SERVICE,\n LEGAL_CACHE,\n 'GetLegalServices'\n );\n return {\n updateLegalService: async (id: string, input: CatalogUpdate<LegalServiceInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteLegalService = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_LEGAL_SERVICE, LEGAL_CACHE, 'GetLegalServices');\n return {\n deleteLegalService: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaLegalService?: boolean } | undefined;\n return data?.deleteHousingvistaLegalService ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ input: HomeLoanOfferInput }>(\n CREATE_HOME_LOAN_OFFER,\n HOME_LOAN_CACHE,\n 'GetHomeLoans'\n );\n return {\n createHomeLoanOffer: async (input: HomeLoanOfferInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<HomeLoanOfferInput> }>(\n UPDATE_HOME_LOAN_OFFER,\n HOME_LOAN_CACHE,\n 'GetHomeLoans'\n );\n return {\n updateHomeLoanOffer: async (id: string, input: CatalogUpdate<HomeLoanOfferInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_HOME_LOAN_OFFER, HOME_LOAN_CACHE, 'GetHomeLoans');\n return {\n deleteHomeLoanOffer: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaHomeLoanOffer?: boolean } | undefined;\n return data?.deleteHousingvistaHomeLoanOffer ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ input: AreaInsightInput }>(\n CREATE_AREA_INSIGHT,\n AREA_INSIGHT_CACHE,\n 'GetAreaInsights'\n );\n return {\n createAreaInsight: async (input: AreaInsightInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<AreaInsightInput> }>(\n UPDATE_AREA_INSIGHT,\n AREA_INSIGHT_CACHE,\n 'GetAreaInsights'\n );\n return {\n updateAreaInsight: async (id: string, input: CatalogUpdate<AreaInsightInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_AREA_INSIGHT, AREA_INSIGHT_CACHE, 'GetAreaInsights');\n return {\n deleteAreaInsight: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaAreaInsight?: boolean } | undefined;\n return data?.deleteHousingvistaAreaInsight ?? false;\n },\n loading,\n };\n};\n\n/** The catalog resources whose writes the gateway gates on the `manage` action. */\nexport type CatalogResource = 'marketplace' | 'legal' | 'homeloan' | 'market';\n\n/**\n * True only once the shell has loaded the caller's permissions and they include `permission`. The gateway enforces\n * the same `@rbac` directive on every write; this only keeps controls the caller cannot use off the screen.\n */\nconst useHasPermission = (permission: string): boolean => {\n const permissions = useSafePermissions();\n return permissions !== null && !permissions.isLoading && permissions.hasPermission(permission);\n};\n\n/** `<resource>:manage` for a catalog the gateway gates on the `manage` action. */\nexport const useCanManageCatalog = (resource: CatalogResource): boolean => useHasPermission(`${resource}:manage`);\n\n/** The rental actions the expense writes are gated on: create, update and delete HousingvistaExpense. */\nexport type RentalAction = 'create' | 'update' | 'delete';\n\n/** `rental:<action>`, so Edit and Delete are offered only to callers the gateway will let through. */\nexport const useCanRental = (action: RentalAction): boolean => useHasPermission(`rental:${action}`);\n\nexport const useShortlists = (pagination?: PaginationInput) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaShortlists: ShortlistRow[] }>(GET_SHORTLISTS, {\n variables: getPaginationVariables(pagination),\n });\n const shortlists = (data?.housingvistaShortlists ?? []).map((row) => ({\n id: row.id,\n propertyId: row.propertyId,\n notes: row.notes ?? undefined,\n createdAt: row.createdAt,\n property: mapProperty(row.property),\n }));\n return { data: shortlists, loading, error, refetch };\n};\n\nexport const useAnalyticsData = (period: AnalyticsPeriod = 'month') => {\n const { data, loading, error } = useQuery<{ housingvistaAnalytics: AnalyticsChartData }>(GET_ANALYTICS, {\n variables: { period },\n });\n return { data: data?.housingvistaAnalytics ?? null, loading, error };\n};\n\n// ---------------------------------------------------------------------------\n// Expense ledger (BOFF-9843)\n// ---------------------------------------------------------------------------\n\nexport interface ExpenseRow {\n id: string;\n amount: number;\n category: string;\n description: string | null;\n incurredOn: string;\n propertyId: string | null;\n createdAt: string;\n}\n\nexport type ExpenseFilterInput = {\n search?: string;\n category?: string;\n propertyId?: string;\n from?: string;\n to?: string;\n};\n\nexport interface CreateExpenseInput {\n amount: number;\n category: string;\n incurredOn: string;\n description?: string;\n propertyId?: string;\n}\n\nexport interface UpdateExpenseInput {\n amount?: number;\n category?: string;\n incurredOn?: string;\n /** null clears the description. */\n description?: string | null;\n /** null unlinks the property, making the expense portfolio-wide. */\n propertyId?: string | null;\n}\n\nconst GET_EXPENSES = gql`\n query GetHousingvistaExpenses($filter: HousingVistaExpenseFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaExpenses(filter: $filter, pagination: $pagination) {\n id\n amount\n category\n description\n incurredOn\n propertyId\n createdAt\n }\n }\n`;\n\nconst CREATE_EXPENSE = gql`\n mutation CreateHousingvistaExpense($input: HousingVistaCreateExpenseInput!) {\n createHousingvistaExpense(input: $input) {\n id\n }\n }\n`;\n\nconst UPDATE_EXPENSE = gql`\n mutation UpdateHousingvistaExpense($id: ID!, $input: HousingVistaUpdateExpenseInput!) {\n updateHousingvistaExpense(id: $id, input: $input) {\n id\n }\n }\n`;\n\nconst DELETE_EXPENSE = gql`\n mutation DeleteHousingvistaExpense($id: ID!) {\n deleteHousingvistaExpense(id: $id)\n }\n`;\n\n/**\n * Analytics reads the expense ledger, so any change to it makes the cached analytics stale, and so does every cached\n * page / filter combination of the list itself (refetchQueries only reaches the one that is mounted). Evicting both\n * fields refetches what is mounted and drops what is not.\n */\nconst evictExpenseCaches = (cache: ApolloCache) => {\n cache.evict({ fieldName: 'housingvistaAnalytics' });\n cache.evict({ fieldName: 'housingvistaExpenses' });\n cache.gc();\n};\n\nexport const useExpenses = (options?: ListOptions<ExpenseFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaExpenses: ExpenseRow[] }>(GET_EXPENSES, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n const expenses = useMemo(() => data?.housingvistaExpenses ?? [], [data]);\n return { data: expenses, loading, error, refetch };\n};\n\n/**\n * Every recorded expense, paged to completion. The ledger page shows 10 at a time and filters, but its summary\n * cards describe the whole ledger, so they read this. Not an Apollo watch query: call `refetch` after a mutation.\n */\nexport const useAllExpenses = () => useAllPages<ExpenseRow>(GET_EXPENSES, 'housingvistaExpenses');\n\nexport const useCreateExpense = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaExpense: { id: string } },\n { input: CreateExpenseInput }\n >(CREATE_EXPENSE, { refetchQueries: ['GetHousingvistaExpenses'], update: evictExpenseCaches });\n const createExpense = async (input: CreateExpenseInput) => {\n await mutate({ variables: { input } });\n };\n return { createExpense, loading };\n};\n\nexport const useUpdateExpense = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaExpense: { id: string } },\n { id: string; input: UpdateExpenseInput }\n >(UPDATE_EXPENSE, { refetchQueries: ['GetHousingvistaExpenses'], update: evictExpenseCaches });\n const updateExpense = async (id: string, input: UpdateExpenseInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateExpense, loading };\n};\n\nexport const useDeleteExpense = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaExpense: boolean }, { id: string }>(DELETE_EXPENSE, {\n refetchQueries: ['GetHousingvistaExpenses'],\n update: evictExpenseCaches,\n });\n const deleteExpense = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaExpense ?? false;\n };\n return { deleteExpense, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Offers / Viewings / Rental applications / Maintenance — query hooks\n// ---------------------------------------------------------------------------\n\nexport interface OfferRow {\n id: string;\n propertyId: string;\n amount: number;\n counterAmount: number | null;\n currency: string;\n status: 'submitted' | 'countered' | 'accepted' | 'rejected' | 'withdrawn' | 'expired';\n notes: string | null;\n respondedAt: string | null;\n /** Optional deadline; open offers flip to 'expired' past it (backend lazy sweep). */\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n property: {\n id: string;\n title: string;\n location: { city: string; state: string };\n images: { id: string; url: string; isPrimary: boolean }[];\n price: { amount: number; currency: string; type?: string | null };\n } | null;\n}\n\nexport const useOffers = (options?: ListOptions<OfferFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaOffers: OfferRow[] }>(GET_OFFERS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaOffers ?? [], loading, error, refetch };\n};\n\nexport const useOffer = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaOffer: OfferRow | null }>(GET_OFFER, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaOffer ?? null, loading, error, refetch };\n};\n\nexport interface ViewingRow {\n id: string;\n propertyId: string;\n scheduledAt: string;\n type: 'in_person' | 'virtual';\n status: 'requested' | 'confirmed' | 'completed' | 'cancelled';\n /** The published slot this viewing holds, or null for a free-datetime booking. */\n slotId: string | null;\n attendeeName: string | null;\n attendeeEmail: string | null;\n notes: string | null;\n createdAt: string;\n updatedAt: string;\n property: {\n id: string;\n title: string;\n location: { city: string; state: string };\n images: { id: string; url: string; isPrimary: boolean }[];\n } | null;\n}\n\nexport const useViewings = (options?: ListOptions<ViewingFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewings: ViewingRow[] }>(GET_VIEWINGS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaViewings ?? [], loading, error, refetch };\n};\n\nexport const useViewing = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewing: ViewingRow | null }>(GET_VIEWING, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaViewing ?? null, loading, error, refetch };\n};\n\nexport interface RentalApplicationRow {\n id: string;\n rentalUnitId: string;\n applicantName: string;\n applicantEmail: string;\n applicantPhone: string | null;\n monthlyIncome: number | null;\n moveInDate: string | null;\n status: 'submitted' | 'screening' | 'approved' | 'rejected';\n reviewNotes: string | null;\n reviewedAt: string | null;\n createdAt: string;\n updatedAt: string;\n /**\n * Supporting documents the applicant attached (ID, payslips, references…).\n * Metadata is read per file with `useUploadedFile` — the federated\n * `documentFiles` field cannot hydrate `File` fields yet.\n */\n documentFileIds: string[];\n rentalUnit: {\n id: string;\n unitNumber: string;\n propertyTitle: string;\n monthlyRent: number;\n } | null;\n}\n\nexport const useRentalApplications = (options?: ListOptions<RentalApplicationFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaRentalApplications: RentalApplicationRow[] }>(\n GET_RENTAL_APPLICATIONS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaRentalApplications ?? [], loading, error, refetch };\n};\n\n// ── Leases (TXN-02 / BOFF-9330) ──────────────────────────────────────────\n\nconst LEASE_FIELDS = gql`\n fragment LeaseFields on HousingVistaLease {\n id\n rentalUnitId\n rentalApplicationId\n tenantName\n tenantEmail\n tenantPhone\n monthlyRent\n securityDeposit\n leaseStart\n leaseEnd\n type\n status\n createdAt\n updatedAt\n rentalUnit {\n id\n unitNumber\n propertyTitle\n }\n }\n`;\n\nconst GET_LEASES = gql`\n ${LEASE_FIELDS}\n query GetLeases($filter: HousingVistaLeaseFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaLeases(filter: $filter, pagination: $pagination) {\n ...LeaseFields\n }\n }\n`;\n\nexport interface LeaseRow {\n id: string;\n rentalUnitId: string;\n rentalApplicationId: string | null;\n tenantName: string;\n tenantEmail: string;\n tenantPhone: string | null;\n monthlyRent: number;\n securityDeposit: number | null;\n leaseStart: string;\n leaseEnd: string;\n type: string;\n status: 'draft' | 'active' | 'renewed' | 'terminated';\n createdAt: string;\n updatedAt: string;\n rentalUnit: {\n id: string;\n unitNumber: string;\n propertyTitle: string;\n } | null;\n}\n\nexport const useLeases = (options?: ListOptions<LeaseFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaLeases: LeaseRow[] }>(GET_LEASES, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaLeases ?? [], loading, error, refetch };\n};\n\n/** Every lease in the workspace, paged to completion (see useAllPages). */\nexport const useAllLeases = () => useAllPages<LeaseRow>(GET_LEASES, 'housingvistaLeases');\n\nexport interface CreateLeaseInput {\n rentalUnitId: string;\n rentalApplicationId?: string;\n tenantName: string;\n tenantEmail: string;\n tenantPhone?: string;\n monthlyRent: number;\n securityDeposit?: number;\n leaseStart: string;\n leaseEnd: string;\n type?: string;\n status?: string;\n}\n\nexport const useCreateLease = () => {\n const [mutate, { loading }] = useMutation<{ createHousingvistaLease: LeaseRow }, { input: CreateLeaseInput }>(\n gql`\n ${LEASE_FIELDS}\n mutation CreateHousingvistaLease($input: HousingVistaCreateLeaseInput!) {\n createHousingvistaLease(input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits', 'GetRentalApplications'], awaitRefetchQueries: true }\n );\n const createLease = async (input: CreateLeaseInput) => {\n await mutate({ variables: { input } });\n };\n return { createLease, loading };\n};\n\nexport const useRenewLease = () => {\n const [mutate, { loading }] = useMutation<\n { renewHousingvistaLease: LeaseRow },\n { id: string; input: { leaseEnd: string } }\n >(\n gql`\n ${LEASE_FIELDS}\n mutation RenewHousingvistaLease($id: ID!, $input: HousingVistaRenewLeaseInput!) {\n renewHousingvistaLease(id: $id, input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits'], awaitRefetchQueries: true }\n );\n const renewLease = async (id: string, leaseEnd: string) => {\n await mutate({ variables: { id, input: { leaseEnd } } });\n };\n return { renewLease, loading };\n};\n\nexport const useTerminateLease = () => {\n const [mutate, { loading }] = useMutation<\n { terminateHousingvistaLease: LeaseRow },\n { id: string; input: { notes?: string } }\n >(\n gql`\n ${LEASE_FIELDS}\n mutation TerminateHousingvistaLease($id: ID!, $input: HousingVistaTerminateLeaseInput!) {\n terminateHousingvistaLease(id: $id, input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits'], awaitRefetchQueries: true }\n );\n const terminateLease = async (id: string, notes?: string) => {\n await mutate({ variables: { id, input: { notes } } });\n };\n return { terminateLease, loading };\n};\n\nexport interface MaintenanceRequestRow {\n id: string;\n propertyId: string | null;\n rentalUnitId: string | null;\n title: string;\n description: string | null;\n category: string;\n priority: 'low' | 'medium' | 'high';\n status: 'open' | 'in_progress' | 'resolved';\n resolutionNotes: string | null;\n resolvedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport const useMaintenanceRequests = (options?: ListOptions<MaintenanceRequestFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaMaintenanceRequests: MaintenanceRequestRow[] }>(\n GET_MAINTENANCE_REQUESTS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaMaintenanceRequests ?? [], loading, error, refetch };\n};\n\n// ---------------------------------------------------------------------------\n// Mutation hooks\n// ---------------------------------------------------------------------------\n\nexport interface CreatePropertyInput {\n title: string;\n description?: string;\n status: PropertyStatus;\n type: PropertyType;\n category: string;\n address?: string;\n city: string;\n state: string;\n country?: string;\n pincode?: string;\n neighborhood?: string;\n landmarks?: string[];\n price: number;\n currency?: string;\n priceType?: string;\n /** On update, pass null to clear a stored period; absent/undefined means \"no change\". */\n pricePeriod?: string | null;\n negotiable?: boolean;\n pricePerSqft?: number;\n bedrooms: number;\n bathrooms: number;\n totalArea: number;\n carpetArea?: number;\n builtUpArea?: number;\n floors?: number;\n totalFloors?: number;\n parking?: number;\n balconies?: number;\n furnishingStatus?: string;\n ageOfProperty?: number;\n facing?: string;\n amenities?: { name: string; category: string; available?: boolean }[];\n images?: { url: string; title?: string; type?: string; order?: number; isPrimary?: boolean }[];\n imageUrl?: string;\n /** Optional geo-pin captured in the listing wizard (BOFF-7795). */\n coordinates?: { latitude: number; longitude: number } | null;\n}\n\nexport type UpdatePropertyInput = Partial<CreatePropertyInput>;\n\nexport const useCreateProperty = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaProperty: PropertyRow },\n { input: CreatePropertyInput }\n >(CREATE_PROPERTY, { refetchQueries: ['GetProperties'], awaitRefetchQueries: true });\n const createProperty = async (input: CreatePropertyInput): Promise<Property> => {\n const res = await mutate({ variables: { input } });\n if (!res.data) throw new Error('Property was not created');\n return mapProperty(res.data.createHousingvistaProperty);\n };\n return { createProperty, loading };\n};\n\nexport const useUpdateProperty = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaProperty: PropertyRow },\n { id: string; input: UpdatePropertyInput }\n >(UPDATE_PROPERTY);\n const updateProperty = async (id: string, input: UpdatePropertyInput): Promise<Property> => {\n const res = await mutate({ variables: { id, input } });\n if (!res.data) throw new Error('Property was not updated');\n return mapProperty(res.data.updateHousingvistaProperty);\n };\n return { updateProperty, loading };\n};\n\nexport const useDeleteProperty = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaProperty: boolean }, { id: string }>(DELETE_PROPERTY, {\n refetchQueries: ['GetProperties'],\n awaitRefetchQueries: true,\n });\n const deleteProperty = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaProperty ?? false;\n };\n return { deleteProperty, loading };\n};\n\nexport const useSaveShortlist = () => {\n const [mutate, { loading }] = useMutation<\n { saveHousingvistaShortlist: ShortlistRow },\n { input: { propertyId: string; notes?: string } }\n >(SAVE_SHORTLIST, { refetchQueries: ['GetShortlists'], awaitRefetchQueries: true });\n const saveShortlist = async (propertyId: string, notes?: string) => {\n await mutate({ variables: { input: { propertyId, notes } } });\n };\n return { saveShortlist, loading };\n};\n\nexport const useRemoveShortlist = () => {\n const [mutate, { loading }] = useMutation<{ removeHousingvistaShortlist: boolean }, { propertyId: string }>(\n REMOVE_SHORTLIST,\n { refetchQueries: ['GetShortlists'], awaitRefetchQueries: true }\n );\n const removeShortlist = async (propertyId: string) => {\n await mutate({ variables: { propertyId } });\n };\n return { removeShortlist, loading };\n};\n\nexport interface BookViewingInput {\n propertyId: string;\n /** Free-datetime booking. Send either this or `slotId` (a slot's own start time is also accepted). */\n scheduledAt?: string;\n /** A published slot to book; the viewing takes the slot's start time. */\n slotId?: string;\n type?: 'in_person' | 'virtual';\n attendeeName?: string;\n attendeeEmail?: string;\n notes?: string;\n}\n\nexport const useBookViewing = () => {\n const [mutate, { loading }] = useMutation<{ bookHousingvistaViewing: { id: string } }, { input: BookViewingInput }>(\n BOOK_VIEWING,\n // A booked slot leaves the open list.\n { refetchQueries: ['GetViewingSlots'] }\n );\n const bookViewing = async (input: BookViewingInput) => {\n await mutate({ variables: { input } });\n };\n return { bookViewing, loading };\n};\n\nexport type ViewingSlotStatus = 'open' | 'booked' | 'cancelled';\n\n/** A dated window a host published for buyers to book a viewing in. */\nexport interface ViewingSlotRow {\n id: string;\n propertyId: string;\n startsAt: string;\n endsAt: string;\n status: ViewingSlotStatus;\n}\n\nexport interface ViewingSlotInput {\n startsAt: string;\n endsAt: string;\n}\n\n/**\n * Slots of a property, soonest first. Buyers get the open future ones; a host managing availability passes\n * `includeBooked` to see the taken ones too.\n */\nexport const useViewingSlots = (\n propertyId: string | undefined,\n options?: { includeBooked?: boolean; skip?: boolean }\n) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewingSlots: ViewingSlotRow[] }>(\n GET_VIEWING_SLOTS,\n {\n variables: {\n propertyId: propertyId ?? '',\n includeBooked: options?.includeBooked ?? false,\n ...getPaginationVariables({ limit: 100, offset: 0 }),\n },\n skip: !propertyId || options?.skip,\n }\n );\n return { data: data?.housingvistaViewingSlots ?? [], loading, error, refetch };\n};\n\nexport const usePublishViewingSlots = () => {\n const [mutate, { loading }] = useMutation<\n { publishHousingvistaViewingSlots: ViewingSlotRow[] },\n { input: { propertyId: string; slots: ViewingSlotInput[] } }\n >(PUBLISH_VIEWING_SLOTS, { refetchQueries: ['GetViewingSlots'], awaitRefetchQueries: true });\n const publishViewingSlots = async (propertyId: string, slots: ViewingSlotInput[]) => {\n const result = await mutate({ variables: { input: { propertyId, slots } } });\n return result.data?.publishHousingvistaViewingSlots ?? [];\n };\n return { publishViewingSlots, loading };\n};\n\nexport const useCancelViewingSlot = () => {\n const [mutate, { loading }] = useMutation<{ cancelHousingvistaViewingSlot: { id: string } }, { id: string }>(\n CANCEL_VIEWING_SLOT,\n { refetchQueries: ['GetViewingSlots'], awaitRefetchQueries: true }\n );\n const cancelViewingSlot = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { cancelViewingSlot, loading };\n};\n\nexport const useCancelViewing = () => {\n const [mutate, { loading }] = useMutation<{ cancelHousingvistaViewing: { id: string } }, { id: string }>(\n CANCEL_VIEWING,\n // Cancelling a viewing frees the slot it held.\n { refetchQueries: ['GetViewingSlots'] }\n );\n const cancelViewing = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { cancelViewing, loading };\n};\n\nexport interface SubmitOfferInput {\n propertyId: string;\n amount: number;\n currency?: string;\n notes?: string;\n /** ISO deadline; omit for an offer that never expires. */\n expiresAt?: string;\n}\n\nexport const useSubmitOffer = () => {\n const [mutate, { loading }] = useMutation<{ submitHousingvistaOffer: { id: string } }, { input: SubmitOfferInput }>(\n SUBMIT_OFFER\n );\n const submitOffer = async (input: SubmitOfferInput) => {\n await mutate({ variables: { input } });\n };\n return { submitOffer, loading };\n};\n\nexport const useRespondOffer = () => {\n const [mutate, { loading }] = useMutation<\n { respondHousingvistaOffer: { id: string } },\n { id: string; input: { action: 'accept' | 'reject' | 'counter'; counterAmount?: number; notes?: string } }\n >(RESPOND_OFFER);\n const respondOffer = async (\n id: string,\n input: { action: 'accept' | 'reject' | 'counter'; counterAmount?: number; notes?: string }\n ) => {\n await mutate({ variables: { id, input } });\n };\n return { respondOffer, loading };\n};\n\nexport interface CreateTransactionInput {\n propertyId: string;\n title: string;\n type: string;\n status: string;\n amount: number;\n currency?: string;\n /** Accepted offer being converted into this deal (TXN-01 / BOFF-9171). */\n offerId?: string;\n}\n\nexport const useCreateTransaction = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaTransaction: TransactionRow },\n { input: CreateTransactionInput }\n >(CREATE_TRANSACTION, { refetchQueries: ['GetTransactions'], awaitRefetchQueries: true });\n const createTransaction = async (input: CreateTransactionInput) => {\n await mutate({ variables: { input } });\n };\n return { createTransaction, loading };\n};\n\nexport interface CreateInvestmentInput {\n propertyId: string;\n title: string;\n status: string;\n investmentType: string;\n riskLevel: string;\n totalValue: number;\n startDate?: string;\n maturityDate?: string;\n}\n\nexport const useCreateInvestment = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaInvestment: InvestmentRow },\n { input: CreateInvestmentInput }\n >(CREATE_INVESTMENT, { refetchQueries: ['GetInvestments'], awaitRefetchQueries: true });\n const createInvestment = async (input: CreateInvestmentInput) => {\n await mutate({ variables: { input } });\n };\n return { createInvestment, loading };\n};\n\nexport interface CreateRentalUnitInput {\n propertyId?: string;\n propertyTitle: string;\n unitNumber: string;\n tenantName: string;\n tenantEmail: string;\n tenantPhone?: string;\n monthlyRent: number;\n leaseStart: string;\n leaseEnd: string;\n status: string;\n paymentStatus: string;\n securityDeposit?: number;\n}\n\nexport const useCreateRentalUnit = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaRentalUnit: { id: string } },\n { input: CreateRentalUnitInput }\n >(CREATE_RENTAL_UNIT, { refetchQueries: ['GetRentalUnits'], awaitRefetchQueries: true });\n const createRentalUnit = async (input: CreateRentalUnitInput) => {\n await mutate({ variables: { input } });\n };\n return { createRentalUnit, loading };\n};\n\nexport interface SubmitRentalApplicationInput {\n rentalUnitId: string;\n applicantName: string;\n applicantEmail: string;\n applicantPhone?: string;\n monthlyIncome?: number;\n moveInDate?: string;\n /** Ids of files already uploaded through wspace-files-svc (max 10). */\n documentFileIds?: string[];\n}\n\nexport const useSubmitRentalApplication = () => {\n const [mutate, { loading }] = useMutation<\n { submitHousingvistaRentalApplication: { id: string } },\n { input: SubmitRentalApplicationInput }\n >(SUBMIT_RENTAL_APPLICATION);\n const submitRentalApplication = async (input: SubmitRentalApplicationInput) => {\n await mutate({ variables: { input } });\n };\n return { submitRentalApplication, loading };\n};\n\nexport interface CreateAmcContractInput {\n propertyId?: string;\n marketplaceServiceId?: string;\n propertyTitle: string;\n packageName: string;\n providerName: string;\n monthlyCost: number;\n startDate: string;\n endDate: string;\n nextServiceDate?: string;\n status: string;\n servicesIncluded?: string[];\n}\n\nexport const useCreateAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaAmcContract: { id: string } },\n { input: CreateAmcContractInput }\n >(CREATE_AMC_CONTRACT, { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true });\n const createAmcContract = async (input: CreateAmcContractInput) => {\n await mutate({ variables: { input } });\n };\n return { createAmcContract, loading };\n};\n\nexport interface CreateMaintenanceRequestInput {\n propertyId?: string;\n rentalUnitId?: string;\n title: string;\n description?: string;\n category: string;\n priority?: 'low' | 'medium' | 'high';\n}\n\nexport const useCreateMaintenanceRequest = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaMaintenanceRequest: { id: string } },\n { input: CreateMaintenanceRequestInput }\n >(CREATE_MAINTENANCE_REQUEST);\n const createMaintenanceRequest = async (input: CreateMaintenanceRequestInput) => {\n await mutate({ variables: { input } });\n };\n return { createMaintenanceRequest, loading };\n};\n\nexport const useCreateVerification = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaVerificationItem: { id: string } },\n { input: CreateVerificationItemInput }\n >(CREATE_VERIFICATION_ITEM, {\n // GetProperty refetch: a new check changes the detail page's Documents\n // evidence (active-query case); cache-and-network on useProperty covers\n // the return-to-listing case (Codex P2, mfe#19). Deliberately NO\n // GetProperties refetch and NO cache.modify here: creating an item does\n // NOT change Property.verificationStatus server-side (the svc write-back\n // is decide-path only, BOFF-8673), so a cached list badge stays truthful\n // — refetching the list would be pure waste.\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n });\n const createVerification = async (input: CreateVerificationItemInput) => {\n await mutate({ variables: { input } });\n };\n return { createVerification, loading };\n};\n\nexport const useApproveVerification = () => {\n const [mutate, { loading }] = useMutation<\n {\n approveHousingvistaVerificationItem: {\n id: string;\n status: string;\n entityType: string | null;\n entityId: string | null;\n };\n },\n { id: string; notes?: string }\n >(APPROVE_VERIFICATION, {\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n // Sync the normalized listing record so a badge shown by a cached,\n // unmounted list query updates immediately (reviewer P2, mfe#19) —\n // refetchQueries only reaches ACTIVE queries.\n update: (cache, result) => {\n const item = result.data?.approveHousingvistaVerificationItem;\n if (item?.entityType !== 'property' || !item.entityId) return;\n const pid = cache.identify({\n __typename: 'HousingVistaProperty',\n id: item.entityId,\n });\n if (!pid) return;\n cache.modify({\n id: pid,\n fields: {\n // Fail-safe direction: ONLY an explicit rejection writes\n // 'rejected'. The mutation currently returns the raw svc value\n // 'approved' (live-verified on alpha), but the MFE convention is\n // 'verified' — if the API ever normalizes to that, an\n // === 'approved' ternary would write 'rejected' for approvals\n // (Codex P2, mfe#19).\n verificationStatus: () => (item.status === 'rejected' ? 'rejected' : 'verified'),\n },\n });\n },\n });\n const approveVerification = async (id: string, notes?: string) => {\n await mutate({ variables: { id, notes } });\n };\n return { approveVerification, loading };\n};\n\nexport const useRejectVerification = () => {\n const [mutate, { loading }] = useMutation<\n {\n rejectHousingvistaVerificationItem: {\n id: string;\n status: string;\n entityType: string | null;\n entityId: string | null;\n };\n },\n { id: string; notes?: string }\n >(REJECT_VERIFICATION, {\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n update: (cache, result) => {\n const item = result.data?.rejectHousingvistaVerificationItem;\n if (item?.entityType !== 'property' || !item.entityId) return;\n const pid = cache.identify({\n __typename: 'HousingVistaProperty',\n id: item.entityId,\n });\n if (!pid) return;\n cache.modify({\n id: pid,\n fields: {\n // Same fail-safe direction as approve: only an explicit\n // 'rejected' writes 'rejected'.\n verificationStatus: () => (item.status === 'rejected' ? 'rejected' : 'verified'),\n },\n });\n },\n });\n const rejectVerification = async (id: string, notes?: string) => {\n await mutate({ variables: { id, notes } });\n };\n return { rejectVerification, loading };\n};\n\n/** RERA review workflow transition (BOFF-4132) — separate from the generic\n * verification review above since RERA is its own regulatory workflow. */\nexport const useUpdatePropertyReraStatus = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaPropertyReraStatus: { id: string; reraVerificationStatus: ReraVerificationStatus } },\n { id: string; status: ReraVerificationStatus; notes?: string }\n >(UPDATE_PROPERTY_RERA_STATUS, { refetchQueries: ['GetProperties', 'GetProperty'], awaitRefetchQueries: true });\n const updatePropertyReraStatus = async (id: string, status: ReraVerificationStatus, notes?: string) => {\n await mutate({ variables: { id, status, notes } });\n };\n return { updatePropertyReraStatus, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Offer / Viewing owner-side + lifecycle mutation hooks\n// ---------------------------------------------------------------------------\n\nexport const useWithdrawOffer = () => {\n const [mutate, { loading }] = useMutation<{ withdrawHousingvistaOffer: { id: string } }, { id: string }>(\n WITHDRAW_OFFER,\n { refetchQueries: ['GetOffers', 'GetOffer'], awaitRefetchQueries: true }\n );\n const withdrawOffer = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { withdrawOffer, loading };\n};\n\nexport interface UpdateViewingInput {\n scheduledAt?: string;\n status?: 'requested' | 'confirmed' | 'completed' | 'cancelled';\n type?: 'in_person' | 'virtual';\n attendeeName?: string;\n attendeeEmail?: string;\n notes?: string;\n}\n\nexport const useUpdateViewing = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaViewing: { id: string } },\n { id: string; input: UpdateViewingInput }\n >(UPDATE_VIEWING, {\n refetchQueries: ['GetViewings', 'GetViewing', 'GetViewingSlots'],\n awaitRefetchQueries: true,\n });\n const updateViewing = async (id: string, input: UpdateViewingInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateViewing, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Investment update / delete\n// ---------------------------------------------------------------------------\n\nexport interface UpdateInvestmentInput {\n title?: string;\n investmentType?: string;\n status?: string;\n riskLevel?: string;\n totalValue?: number;\n startDate?: string;\n maturityDate?: string;\n /** Replaces the attached File ids (at most ten); `[]` clears them, omitting it leaves them untouched. */\n documentFileIds?: string[];\n}\n\nexport const useUpdateInvestment = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaInvestment: InvestmentRow },\n { id: string; input: UpdateInvestmentInput }\n >(UPDATE_INVESTMENT, { refetchQueries: ['GetInvestments', 'GetInvestment'], awaitRefetchQueries: true });\n const updateInvestment = async (id: string, input: UpdateInvestmentInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateInvestment, loading };\n};\n\nexport const useDeleteInvestment = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaInvestment: boolean }, { id: string }>(\n DELETE_INVESTMENT,\n { refetchQueries: ['GetInvestments'], awaitRefetchQueries: true }\n );\n const deleteInvestment = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaInvestment ?? false;\n };\n return { deleteInvestment, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Asset create / update / delete\n// ---------------------------------------------------------------------------\n\nexport interface CreateAssetInput {\n title: string;\n type: string;\n category: string;\n location: string;\n currentValue: number;\n purchasePrice: number;\n purchaseDate?: string;\n appreciationPercent?: number;\n rentalYield?: number;\n status: string;\n imageUrl?: string;\n lastValuationDate?: string;\n}\n\nexport const useCreateAsset = () => {\n const [mutate, { loading }] = useMutation<{ createHousingvistaAsset: Asset }, { input: CreateAssetInput }>(\n CREATE_ASSET,\n { refetchQueries: ['GetAssets'], awaitRefetchQueries: true }\n );\n const createAsset = async (input: CreateAssetInput) => {\n await mutate({ variables: { input } });\n };\n return { createAsset, loading };\n};\n\nexport type UpdateAssetInput = Partial<CreateAssetInput>;\n\nexport const useUpdateAsset = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaAsset: Asset },\n { id: string; input: UpdateAssetInput }\n >(UPDATE_ASSET, { refetchQueries: ['GetAssets', 'GetAsset'], awaitRefetchQueries: true });\n const updateAsset = async (id: string, input: UpdateAssetInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateAsset, loading };\n};\n\nexport const useDeleteAsset = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaAsset: boolean }, { id: string }>(DELETE_ASSET, {\n refetchQueries: ['GetAssets'],\n awaitRefetchQueries: true,\n });\n const deleteAsset = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaAsset ?? false;\n };\n return { deleteAsset, loading };\n};\n\n// ---------------------------------------------------------------------------\n// AMC update / delete\n// ---------------------------------------------------------------------------\n\n// nextServiceDate: null clears the stored date (the svc treats null as \"no upcoming service\").\nexport type UpdateAmcContractInput = Partial<\n Omit<CreateAmcContractInput, 'nextServiceDate' | 'propertyId' | 'marketplaceServiceId'>\n> & {\n nextServiceDate?: string | null;\n // null unlinks (back to a free-text property / provider).\n propertyId?: string | null;\n marketplaceServiceId?: string | null;\n};\n\nexport const useUpdateAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaAmcContract: { id: string } },\n { id: string; input: UpdateAmcContractInput }\n >(UPDATE_AMC_CONTRACT, { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true });\n const updateAmcContract = async (id: string, input: UpdateAmcContractInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateAmcContract, loading };\n};\n\nexport const useRenewAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { renewHousingvistaAmcContract: { id: string; status: string; endDate: string } },\n { id: string; input: { endDate: string } }\n >(\n gql`\n mutation RenewHousingvistaAmcContract($id: ID!, $input: HousingVistaRenewAmcContractInput!) {\n renewHousingvistaAmcContract(id: $id, input: $input) {\n id\n status\n endDate\n }\n }\n `,\n { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true }\n );\n const renewAmcContract = async (id: string, endDate: string) => {\n await mutate({ variables: { id, input: { endDate } } });\n };\n return { renewAmcContract, loading };\n};\n\nexport const useDeleteAmcContract = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaAmcContract: boolean }, { id: string }>(\n DELETE_AMC_CONTRACT,\n { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true }\n );\n const deleteAmcContract = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaAmcContract ?? false;\n };\n return { deleteAmcContract, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Transaction update / delete\n// ---------------------------------------------------------------------------\n\nexport interface UpdateTransactionInput {\n title?: string;\n type?: string;\n status?: string;\n amount?: number;\n currency?: string;\n documents?: unknown;\n}\n\nexport const useUpdateTransaction = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaTransaction: TransactionRow },\n { id: string; input: UpdateTransactionInput }\n >(UPDATE_TRANSACTION, { refetchQueries: ['GetTransactions', 'GetTransaction'], awaitRefetchQueries: true });\n const updateTransaction = async (id: string, input: UpdateTransactionInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateTransaction, loading };\n};\n\nexport const useDeleteTransaction = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaTransaction: boolean }, { id: string }>(\n DELETE_TRANSACTION,\n { refetchQueries: ['GetTransactions'], awaitRefetchQueries: true }\n );\n const deleteTransaction = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaTransaction ?? false;\n };\n return { deleteTransaction, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Maintenance resolve + Rental-application review\n// ---------------------------------------------------------------------------\n\nexport const useResolveMaintenanceRequest = () => {\n const [mutate, { loading }] = useMutation<\n { resolveHousingvistaMaintenanceRequest: MaintenanceRequestRow },\n { id: string; resolutionNotes?: string }\n >(RESOLVE_MAINTENANCE, { refetchQueries: ['GetMaintenanceRequests'], awaitRefetchQueries: true });\n const resolveMaintenanceRequest = async (id: string, resolutionNotes?: string) => {\n await mutate({ variables: { id, resolutionNotes } });\n };\n return { resolveMaintenanceRequest, loading };\n};\n\nexport interface ReviewRentalApplicationInput {\n decision: 'approved' | 'rejected' | 'screening' | 'submitted';\n reviewNotes?: string;\n}\n\nexport const useReviewRentalApplication = () => {\n const [mutate, { loading }] = useMutation<\n { reviewHousingvistaRentalApplication: RentalApplicationRow },\n { id: string; input: ReviewRentalApplicationInput }\n >(REVIEW_RENTAL_APPLICATION, { refetchQueries: ['GetRentalApplications'], awaitRefetchQueries: true });\n const reviewRentalApplication = async (id: string, input: ReviewRentalApplicationInput) => {\n await mutate({ variables: { id, input } });\n };\n return { reviewRentalApplication, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Platform-service reuse (conversations / files) — re-exported from ./platform\n// ---------------------------------------------------------------------------\n\nexport {\n useContactConversation,\n useSendMessage,\n useSendContextMessage,\n useConversationMessages,\n useEntityComments,\n useCreateEntityComment,\n useFileUpload,\n useDeleteUploadedFile,\n useUploadedFile,\n} from './platform';\nexport type {\n HvContextTarget,\n HvConversationMessage,\n HvConversationSourceContext,\n HvEntityComment,\n HvMessageAttachment,\n HvUploadedFile,\n} from './platform';\n\n// Analytics\nexport { useHousingVistaAnalytics } from './useHousingVistaAnalytics';\n"],"mappings":";;;;;;;AAkLA,IAAMA,IAAqD;CAAE,OAAO;CAAI,QAAQ;AAAE,GAE5EC,KAA0B,IAA8BD,OAA6B,EACzF,YAAY;CACV,OAAOE,EAAW,SAASF,EAAwB;CACnD,QAAQE,EAAW,UAAUF,EAAwB;AACvD,EACF,IAMMG,KAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCzBC,IAAkB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyErBC,KAA+B,CAAG;;;;;;;;;;;;;;;;GAkBlCC,KAAiB,CAAG;IACtBF,EAAgB;;;;;;GAQdG,KAAe,CAAG;IACpBH,EAAgB;IAChBC,GAA6B;;;;;;;GAS3BG,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDxBC,IAAmB,CAAG;IACxBD,EAAmB;;;;;;GAQjBE,KAAkB,CAAG;IACvBF,EAAmB;;;;;;GAQjBG,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;GAwBvBC,IAAkB,CAAG;IACvBD,EAAkB;;;;;;GAQhBE,KAA4B,CAAG;;;;;;;GAS/BC,KAAiB,CAAG;IACtBH,EAAkB;;;;;;GAQhBI,KAAmB,CAAG;;;;;;;;;;;;;;;;;;;GAqBtBC,IAAe,CAAG;;;;;;;;;;;;;;;;GAkBlBC,KAAa,CAAG;IAClBD,EAAa;;;;;;GAQXE,KAAY,CAAG;IACjBF,EAAa;;;;;;GAQXG,IAAoB,CAAG;;;;;;;;;;;;;;;;;GAmBvBC,IAA6B,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E,gBAAgB,CAAC,iBAAiB;EAAG,qBAAqB;CAAK,CACnE;CAKA,OAAO;EAAE,0BAJwB,OAExB,MADW4F,EAAO,EAAE,WAAW,EAAE,MAAG,EAAE,CAAC,EAAA,CACnC,MAAM,iCAAiC;EAExB;CAAQ;AACtC,GAeaoF,WAA6B;CACxC,IAAM,CAACpF,GAAQ,EAAE,gBAAaC,EAG5B5F,IAAoB;EAAE,gBAAgB,CAAC,mBAAmB,gBAAgB;EAAG,qBAAqB;CAAK,CAAC;CAI1G,OAAO;EAAE,0BAHwB,GAAY,MAAkC;GAC7E,MAAM2F,EAAO,EAAE,WAAW;IAAE;IAAI;GAAM,EAAE,CAAC;EAC3C;EAC4B;CAAQ;AACtC,GAkBaqF,WAAqC;CAChD,IAAM,CAACrF,GAAQ,EAAE,gBAAaC,EAG5B3F,IAAqB;EAAE,gBAAgB,CAAC,wBAAwB;EAAG,qBAAqB;CAAK,CAAC;CAIhG,OAAO;EAAE,kCAHgC,GAAY,MAA6B;GAChF,MAAM0F,EAAO,EAAE,WAAW;IAAE;IAAI;GAAgB,EAAE,CAAC;EACrD;EACoC;CAAQ;AAC9C,GAOasF,WAAmC;CAC9C,IAAM,CAACtF,GAAQ,EAAE,gBAAaC,EAG5B1F,IAA2B;EAAE,gBAAgB,CAAC,uBAAuB;EAAG,qBAAqB;CAAK,CAAC;CAIrG,OAAO;EAAE,gCAH8B,GAAY,MAAwC;GACzF,MAAMyF,EAAO,EAAE,WAAW;IAAE;IAAI;GAAM,EAAE,CAAC;EAC3C;EACkC;CAAQ;AAC5C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DEFAULT_LIST_PAGINATION","getPaginationVariables","pagination","GET_DASHBOARD_STATS","PROPERTY_FIELDS","PROPERTY_VERIFICATION_FIELDS","GET_PROPERTIES","GET_PROPERTY","TRANSACTION_FIELDS","GET_TRANSACTIONS","GET_TRANSACTION","INVESTMENT_FIELDS","GET_INVESTMENTS","GET_INVESTMENT_COMPLIANCE","GET_INVESTMENT","GET_RENTAL_UNITS","ASSET_FIELDS","GET_ASSETS","GET_ASSET","GET_AMC_CONTRACTS","MARKETPLACE_SERVICE_FIELDS","GET_MARKETPLACE_SERVICES","GET_MARKETPLACE_SERVICE","VERIFICATION_FIELDS","GET_VERIFICATIONS","GET_VERIFICATION","LEGAL_SERVICE_FIELDS","GET_LEGAL_SERVICES","GET_LEGAL_SERVICE","HOME_LOAN_FIELDS","GET_HOME_LOANS","GET_HOME_LOAN","GET_MARKET_TRENDS","GET_AREA_INSIGHTS","GET_ANALYTICS","SHORTLIST_FIELDS","GET_SHORTLISTS","OFFER_FIELDS","GET_OFFERS","VIEWING_FIELDS","GET_VIEWINGS","RENTAL_APPLICATION_FIELDS","GET_RENTAL_APPLICATIONS","MAINTENANCE_FIELDS","GET_MAINTENANCE_REQUESTS","CREATE_PROPERTY","UPDATE_PROPERTY","DELETE_PROPERTY","SAVE_SHORTLIST","REMOVE_SHORTLIST","BOOK_VIEWING","CANCEL_VIEWING","SUBMIT_OFFER","RESPOND_OFFER","CREATE_TRANSACTION","CREATE_INVESTMENT","CREATE_RENTAL_UNIT","SUBMIT_RENTAL_APPLICATION","CREATE_AMC_CONTRACT","CREATE_MAINTENANCE_REQUEST","CREATE_VERIFICATION_ITEM","APPROVE_VERIFICATION","REJECT_VERIFICATION","UPDATE_PROPERTY_RERA_STATUS","WITHDRAW_OFFER","VIEWING_SLOT_FIELDS","GET_VIEWING_SLOTS","PUBLISH_VIEWING_SLOTS","CANCEL_VIEWING_SLOT","UPDATE_VIEWING","UPDATE_INVESTMENT","DELETE_INVESTMENT","CREATE_ASSET","UPDATE_AMC_CONTRACT","DELETE_AMC_CONTRACT","UPDATE_TRANSACTION","RESOLVE_MAINTENANCE","REVIEW_RENTAL_APPLICATION","mapProperty","row","item","file","emptyTrends","useDashboardStats","useQuery","empty","data","useRecentActivities","txn","useProperties","options","useProperty","id","NL_SEARCH_PROPERTIES","useNaturalLanguageSearch","run","useLazyQuery","search","result","useTransactions","useAllPages","client","useApolloClient","setData","useState","loading","setLoading","error","setError","baseVariablesRef","useRef","baseVariables","fetchAll","useCallback","all","offset","pageIndex","page","listField","query","generationRef","refetch","generation","err","useEffect","cancelled","useAllTransactions","useTransaction","useInvestments","useInvestmentCompliance","permissions","useSafePermissions","canRead","useInvestment","useRentalUnits","useAssets","useAsset","normalizeAmcContracts","contracts","contract","useAMCContracts","useMemo","useAllAmcContracts","useMarketplaceServices","useMarketplaceService","useVerifications","useVerificationItem","useLegalServices","useLegalService","useHomeLoans","useHomeLoanOffer","useMarketTrends","useAreaInsights","CREATE_MARKETPLACE_SERVICE","UPDATE_MARKETPLACE_SERVICE","DELETE_MARKETPLACE_SERVICE","CREATE_LEGAL_SERVICE","UPDATE_LEGAL_SERVICE","DELETE_LEGAL_SERVICE","CREATE_HOME_LOAN_OFFER","UPDATE_HOME_LOAN_OFFER","DELETE_HOME_LOAN_OFFER","CREATE_AREA_INSIGHT","UPDATE_AREA_INSIGHT","DELETE_AREA_INSIGHT","useCatalogWrite","mutate","useMutation","document","listQuery","fieldName","cacheFields","MARKETPLACE_CACHE","LEGAL_CACHE","HOME_LOAN_CACHE","AREA_INSIGHT_CACHE","useCreateMarketplaceService","useUpdateMarketplaceService","useDeleteMarketplaceService","useCreateLegalService","useUpdateLegalService","useDeleteLegalService","useCreateHomeLoanOffer","useUpdateHomeLoanOffer","useDeleteHomeLoanOffer","useCreateAreaInsight","useUpdateAreaInsight","useDeleteAreaInsight","useHasPermission","permission","useCanManageCatalog","resource","useCanRental","action","useShortlists","useAnalyticsData","GET_EXPENSES","CREATE_EXPENSE","UPDATE_EXPENSE","DELETE_EXPENSE","evictExpenseCaches","cache","useExpenses","useAllExpenses","useCreateExpense","useUpdateExpense","useDeleteExpense","useOffers","useViewings","useRentalApplications","LEASE_FIELDS","GET_LEASES","useAllLeases","useCreateLease","useRenewLease","useTerminateLease","useMaintenanceRequests","useCreateProperty","res","useUpdateProperty","useDeleteProperty","useSaveShortlist","useRemoveShortlist","useBookViewing","useViewingSlots","propertyId","usePublishViewingSlots","useCancelViewingSlot","useCancelViewing","useSubmitOffer","useRespondOffer","useCreateTransaction","useCreateInvestment","useCreateRentalUnit","useSubmitRentalApplication","useCreateAmcContract","useCreateMaintenanceRequest","useCreateVerification","useApproveVerification","pid","useRejectVerification","useUpdatePropertyReraStatus","useWithdrawOffer","useUpdateViewing","useUpdateInvestment","useDeleteInvestment","useCreateAsset","useUpdateAmcContract","useRenewAmcContract","useDeleteAmcContract","useUpdateTransaction","useResolveMaintenanceRequest","useReviewRentalApplication","useContactConversation","useConversationMessages","useCreateEntityComment","useDeleteUploadedFile","useEntityComments","useFileUpload","useSendContextMessage","useSendMessage","useUploadedFile"],"sources":["../../../src/housingvista/hooks/index.ts"],"sourcesContent":["/**\n * HousingVista data hooks — real GraphQL against the wspace gateway via Apollo.\n *\n * Every read maps the `housingvista*` query contract to the MFE domain types in\n * `../types`. Every write wraps a `housingvista*` mutation and (where it changes\n * a list the UI shows) refetches the affected query so the cache stays honest.\n * No `any`, no mock data — hooks that have no backing query return an explicit\n * `unsupported` empty-state instead of fabricating rows.\n * @module housingvista\n */\n\nimport { gql, type ApolloCache, type DocumentNode } from '@apollo/client';\nimport { useQuery, useMutation, useLazyQuery, useApolloClient } from '@apollo/client/react';\nimport { useEffect, useMemo, useState, useCallback, useRef } from 'react';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type {\n Property,\n Transaction,\n Investment,\n DashboardStats,\n DashboardTrends,\n RecentActivity,\n RentalUnit,\n Asset,\n AMCContract,\n MarketplaceService,\n VerificationItem,\n LegalService,\n HomeLoan,\n MarketTrend,\n AreaInsight,\n AnalyticsChartData,\n AnalyticsPeriod,\n PropertyType,\n PropertyStatus,\n ReraVerificationStatus,\n VerificationStatus,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Shared input shapes (mirror HousingVista*Input from the subgraph schema)\n// ---------------------------------------------------------------------------\n\nexport type PaginationInput = {\n limit?: number;\n offset?: number;\n};\n\nexport type PropertyGeoBoundsInput = {\n neLat: number;\n neLng: number;\n swLat: number;\n swLng: number;\n};\n\nexport type PropertyGeoCenterInput = {\n latitude: number;\n longitude: number;\n radiusKm: number;\n};\n\nexport type PropertyFilterInput = {\n search?: string;\n status?: PropertyStatus;\n type?: PropertyType;\n city?: string;\n category?: string;\n priceMin?: number;\n priceMax?: number;\n bedroomsMin?: number;\n amenities?: string[];\n reraVerificationStatus?: ReraVerificationStatus;\n bounds?: PropertyGeoBoundsInput;\n center?: PropertyGeoCenterInput;\n};\n\nexport type TransactionFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n propertyId?: string;\n};\n\nexport type LeaseFilterInput = {\n status?: string;\n type?: string;\n rentalUnitId?: string;\n};\n\nexport type InvestmentFilterInput = {\n search?: string;\n status?: string;\n investmentType?: string;\n riskLevel?: string;\n propertyId?: string;\n};\n\nexport type RentalUnitFilterInput = {\n search?: string;\n status?: string;\n paymentStatus?: string;\n propertyId?: string;\n};\n\nexport type AssetFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n category?: string;\n};\n\nexport type AmcContractFilterInput = {\n search?: string;\n status?: string;\n propertyId?: string;\n};\n\nexport type MarketplaceServiceFilterInput = {\n search?: string;\n category?: string;\n verified?: boolean;\n};\n\nexport type LegalServiceFilterInput = {\n search?: string;\n status?: string;\n category?: string;\n};\n\nexport type VerificationItemFilterInput = {\n search?: string;\n status?: string;\n priority?: string;\n entityType?: string;\n};\n\nexport type CreateVerificationItemInput = {\n entityLabel: string;\n entityType: string;\n entityId?: string;\n priority: string;\n notes?: string;\n documentFileIds?: string[];\n};\n\nexport type ViewingFilterInput = {\n search?: string;\n status?: string;\n type?: string;\n propertyId?: string;\n};\n\nexport type OfferFilterInput = {\n status?: string;\n propertyId?: string;\n};\n\nexport type RentalApplicationFilterInput = {\n search?: string;\n status?: string;\n rentalUnitId?: string;\n};\n\nexport type MaintenanceRequestFilterInput = {\n search?: string;\n status?: string;\n priority?: 'low' | 'medium' | 'high';\n category?: string;\n propertyId?: string;\n rentalUnitId?: string;\n};\n\n/** Options accepted by every server-filtered list hook. */\nexport interface ListOptions<TFilter> {\n filter?: TFilter;\n pagination?: PaginationInput;\n}\n\nconst DEFAULT_LIST_PAGINATION: Required<PaginationInput> = { limit: 50, offset: 0 };\n\nconst getPaginationVariables = (pagination: PaginationInput = DEFAULT_LIST_PAGINATION) => ({\n pagination: {\n limit: pagination.limit ?? DEFAULT_LIST_PAGINATION.limit,\n offset: pagination.offset ?? DEFAULT_LIST_PAGINATION.offset,\n },\n});\n\n// ---------------------------------------------------------------------------\n// Query documents\n// ---------------------------------------------------------------------------\n\nconst GET_DASHBOARD_STATS = gql`\n query GetDashboardStats {\n housingvistaDashboardStats {\n totalProperties\n totalValue\n occupancyRate\n monthlyRevenue\n activeTransactions\n pendingVerifications\n totalInvestments\n totalPortfolioValue\n investmentReturns\n totalTenants\n maintenanceRequests\n unreadMessages\n upcomingViewings\n trends {\n totalProperties {\n label\n value\n }\n monthlyRevenue {\n label\n value\n }\n occupancyRate {\n label\n value\n }\n activeTransactions {\n label\n value\n }\n }\n }\n }\n`;\n\nconst PROPERTY_FIELDS = gql`\n fragment PropertyFields on HousingVistaProperty {\n id\n title\n description\n type\n status\n category\n verificationStatus\n reraRegistrationNo\n reraAuthority\n reraApprovalDate\n reraUrl\n reraVerificationStatus\n imageUrl\n createdAt\n updatedAt\n price {\n amount\n currency\n type\n period\n negotiable\n pricePerSqft\n }\n location {\n address\n city\n state\n country\n pincode\n coordinates {\n latitude\n longitude\n }\n neighborhood\n landmarks\n }\n specifications {\n totalArea\n carpetArea\n builtUpArea\n bedrooms\n bathrooms\n floors\n totalFloors\n parking\n balconies\n furnishingStatus\n ageOfProperty\n facing\n }\n amenities {\n id\n name\n category\n available\n }\n images {\n id\n url\n title\n type\n order\n isPrimary\n }\n }\n`;\n\n// Trust-layer evidence (BOFF-8674) — DETAIL-ONLY. Kept out of the shared\n// PROPERTY_FIELDS on purpose: list/map queries (up to 200 listings) must not\n// resolve evidence files + signed downloadUrls they never render (Codex P2,\n// mfe#19). Only GetProperty spreads this fragment.\nconst PROPERTY_VERIFICATION_FIELDS = gql`\n fragment PropertyVerificationFields on HousingVistaProperty {\n verificationItems {\n id\n entityLabel\n entityType\n status\n submittedAt\n documentFiles {\n id\n name\n downloadUrl\n createdAt\n }\n }\n }\n`;\n\nconst GET_PROPERTIES = gql`\n ${PROPERTY_FIELDS}\n query GetProperties($filter: HousingVistaPropertyFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaProperties(filter: $filter, pagination: $pagination) {\n ...PropertyFields\n }\n }\n`;\n\nconst GET_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n ${PROPERTY_VERIFICATION_FIELDS}\n query GetProperty($id: ID!) {\n housingvistaProperty(id: $id) {\n ...PropertyFields\n ...PropertyVerificationFields\n }\n }\n`;\n\nconst TRANSACTION_FIELDS = gql`\n fragment TransactionFields on HousingVistaTransaction {\n id\n title\n type\n status\n amount\n currency\n documents\n milestones\n parties\n escrow\n # Origin offer this deal was converted from (TXN-01 / BOFF-9171); null for\n # transactions not born from an accepted offer.\n offerId\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n }\n buyer {\n id\n firstName\n lastName\n avatar\n }\n seller {\n id\n firstName\n lastName\n avatar\n }\n tenant {\n id\n firstName\n lastName\n avatar\n }\n landlord {\n id\n firstName\n lastName\n avatar\n }\n }\n`;\n\nconst GET_TRANSACTIONS = gql`\n ${TRANSACTION_FIELDS}\n query GetTransactions($filter: HousingVistaTransactionFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaTransactions(filter: $filter, pagination: $pagination) {\n ...TransactionFields\n }\n }\n`;\n\nconst GET_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n query GetTransaction($id: ID!) {\n housingvistaTransaction(id: $id) {\n ...TransactionFields\n }\n }\n`;\n\nconst INVESTMENT_FIELDS = gql`\n fragment InvestmentFields on HousingVistaInvestment {\n id\n title\n investmentType\n totalValue\n status\n startDate\n maturityDate\n riskLevel\n investors\n returns\n documentFileIds\n property {\n id\n title\n location {\n city\n state\n }\n }\n }\n`;\n\nconst GET_INVESTMENTS = gql`\n ${INVESTMENT_FIELDS}\n query GetInvestments($filter: HousingVistaInvestmentFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaInvestments(filter: $filter, pagination: $pagination) {\n ...InvestmentFields\n }\n }\n`;\n\nconst GET_INVESTMENT_COMPLIANCE = gql`\n query GetHousingvistaInvestmentCompliance {\n housingvistaInvestmentComplianceSetting {\n workspaceId\n eligibilityVerified\n }\n }\n`;\n\nconst GET_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n query GetInvestment($id: ID!) {\n housingvistaInvestment(id: $id) {\n ...InvestmentFields\n }\n }\n`;\n\nconst GET_RENTAL_UNITS = gql`\n query GetRentalUnits($filter: HousingVistaRentalUnitFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaRentalUnits(filter: $filter, pagination: $pagination) {\n id\n propertyId\n propertyTitle\n unitNumber\n tenantName\n tenantEmail\n tenantPhone\n monthlyRent\n leaseStart\n leaseEnd\n status\n lastPaymentDate\n paymentStatus\n securityDeposit\n }\n }\n`;\n\nconst ASSET_FIELDS = gql`\n fragment AssetFields on HousingVistaAsset {\n id\n title\n type\n category\n location\n currentValue\n purchasePrice\n purchaseDate\n appreciationPercent\n rentalYield\n status\n imageUrl\n lastValuationDate\n }\n`;\n\nconst GET_ASSETS = gql`\n ${ASSET_FIELDS}\n query GetAssets($filter: HousingVistaAssetFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaAssets(filter: $filter, pagination: $pagination) {\n ...AssetFields\n }\n }\n`;\n\nconst GET_ASSET = gql`\n ${ASSET_FIELDS}\n query GetAsset($id: ID!) {\n housingvistaAsset(id: $id) {\n ...AssetFields\n }\n }\n`;\n\nconst GET_AMC_CONTRACTS = gql`\n query GetAmcContracts($filter: HousingVistaAmcContractFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaAmcContracts(filter: $filter, pagination: $pagination) {\n id\n propertyId\n marketplaceServiceId\n propertyTitle\n packageName\n providerName\n status\n startDate\n endDate\n monthlyCost\n nextServiceDate\n servicesIncluded\n }\n }\n`;\n\nconst MARKETPLACE_SERVICE_FIELDS = gql`\n fragment MarketplaceServiceFields on HousingVistaMarketplaceService {\n id\n name\n providerName\n category\n description\n rating\n reviewCount\n priceRange\n availableAreas\n responseTime\n verified\n imageUrl\n featured\n }\n`;\n\nconst GET_MARKETPLACE_SERVICES = gql`\n ${MARKETPLACE_SERVICE_FIELDS}\n query GetMarketplaceServices(\n $filter: HousingVistaMarketplaceServiceFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaMarketplaceServices(filter: $filter, pagination: $pagination) {\n ...MarketplaceServiceFields\n }\n }\n`;\n\nconst GET_MARKETPLACE_SERVICE = gql`\n ${MARKETPLACE_SERVICE_FIELDS}\n query GetMarketplaceService($id: ID!) {\n housingvistaMarketplaceService(id: $id) {\n ...MarketplaceServiceFields\n }\n }\n`;\n\nconst VERIFICATION_FIELDS = gql`\n fragment VerificationFields on HousingVistaVerificationItem {\n id\n entityType\n entityId\n entityLabel\n status\n submittedDate\n reviewerName\n priority\n notes\n createdAt\n updatedAt\n }\n`;\n\nconst GET_VERIFICATIONS = gql`\n ${VERIFICATION_FIELDS}\n query GetVerifications($filter: HousingVistaVerificationItemFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaVerificationItems(filter: $filter, pagination: $pagination) {\n ...VerificationFields\n }\n }\n`;\n\nconst GET_VERIFICATION = gql`\n ${VERIFICATION_FIELDS}\n query GetVerification($id: ID!) {\n housingvistaVerificationItem(id: $id) {\n ...VerificationFields\n }\n }\n`;\n\nconst LEGAL_SERVICE_FIELDS = gql`\n fragment LegalServiceFields on HousingVistaLegalService {\n id\n title\n category\n description\n providerName\n providerRating\n estimatedDuration\n priceRange\n status\n consultationFee\n documentsRequired\n }\n`;\n\nconst GET_LEGAL_SERVICES = gql`\n ${LEGAL_SERVICE_FIELDS}\n query GetLegalServices($filter: HousingVistaLegalServiceFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaLegalServices(filter: $filter, pagination: $pagination) {\n ...LegalServiceFields\n }\n }\n`;\n\nconst GET_LEGAL_SERVICE = gql`\n ${LEGAL_SERVICE_FIELDS}\n query GetLegalService($id: ID!) {\n housingvistaLegalService(id: $id) {\n ...LegalServiceFields\n }\n }\n`;\n\nconst HOME_LOAN_FIELDS = gql`\n fragment HomeLoanFields on HousingVistaHomeLoanOffer {\n id\n bankName\n bankLogo\n interestRate\n maxTenure\n maxAmount\n processingFee\n emiPerLakh\n features\n rating\n specialOffer\n prepaymentCharges\n }\n`;\n\nconst GET_HOME_LOANS = gql`\n ${HOME_LOAN_FIELDS}\n query GetHomeLoans($pagination: HousingVistaPaginationInput) {\n housingvistaHomeLoanOffers(pagination: $pagination) {\n ...HomeLoanFields\n }\n }\n`;\n\nconst GET_HOME_LOAN = gql`\n ${HOME_LOAN_FIELDS}\n query GetHomeLoan($id: ID!) {\n housingvistaHomeLoanOffer(id: $id) {\n ...HomeLoanFields\n }\n }\n`;\n\nconst GET_MARKET_TRENDS = gql`\n query GetMarketTrends($pagination: HousingVistaPaginationInput) {\n housingvistaMarketTrends(pagination: $pagination) {\n month\n avgPrice\n avgRent\n demandIndex\n supplyIndex\n priceChangePercent\n }\n }\n`;\n\nconst GET_AREA_INSIGHTS = gql`\n query GetAreaInsights($pagination: HousingVistaPaginationInput) {\n housingvistaAreaInsights(pagination: $pagination) {\n id\n areaName\n city\n avgPropertyPrice\n avgRentalYield\n appreciationRate\n safetyScore\n connectivityScore\n amenitiesScore\n schoolsNearby\n hospitalsNearby\n population\n greenCoverPercent\n upcomingProjects\n avg2BhkPrice\n avg3BhkPrice\n amenitiesRating\n priceTrend {\n period\n avgPrice\n }\n futureProjects {\n name\n type\n expectedCompletion\n description\n }\n nearbyHubs\n transportLinks\n schools\n hospitals\n malls\n }\n }\n`;\n\nconst GET_ANALYTICS = gql`\n query GetHousingvistaAnalytics($period: HousingVistaAnalyticsPeriod) {\n housingvistaAnalytics(period: $period) {\n kpis {\n id\n label\n value\n previousValue\n unit\n trend\n changePercent\n }\n revenueByMonth {\n month\n revenue\n expenses\n }\n propertyTypeDistribution {\n type\n count\n value\n }\n occupancyRate {\n month\n rate\n }\n period\n }\n }\n`;\n\nconst SHORTLIST_FIELDS = gql`\n ${PROPERTY_FIELDS}\n fragment ShortlistFields on HousingVistaShortlist {\n id\n propertyId\n notes\n createdAt\n property {\n ...PropertyFields\n }\n }\n`;\n\nconst GET_SHORTLISTS = gql`\n ${SHORTLIST_FIELDS}\n query GetShortlists($pagination: HousingVistaPaginationInput) {\n housingvistaShortlists(pagination: $pagination) {\n ...ShortlistFields\n }\n }\n`;\n\nconst OFFER_FIELDS = gql`\n fragment OfferFields on HousingVistaOffer {\n id\n propertyId\n amount\n counterAmount\n currency\n status\n notes\n respondedAt\n expiresAt\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n price {\n amount\n currency\n # sale | rent — drives the deal type when converting to a transaction.\n type\n }\n }\n }\n`;\n\nconst GET_OFFERS = gql`\n ${OFFER_FIELDS}\n query GetOffers($filter: HousingVistaOfferFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaOffers(filter: $filter, pagination: $pagination) {\n ...OfferFields\n }\n }\n`;\n\nconst GET_OFFER = gql`\n ${OFFER_FIELDS}\n query GetOffer($id: ID!) {\n housingvistaOffer(id: $id) {\n ...OfferFields\n }\n }\n`;\n\nconst VIEWING_FIELDS = gql`\n fragment ViewingFields on HousingVistaViewing {\n id\n propertyId\n scheduledAt\n type\n status\n slotId\n attendeeName\n attendeeEmail\n notes\n createdAt\n updatedAt\n property {\n id\n title\n location {\n city\n state\n }\n images {\n id\n url\n isPrimary\n }\n }\n }\n`;\n\nconst GET_VIEWINGS = gql`\n ${VIEWING_FIELDS}\n query GetViewings($filter: HousingVistaViewingFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaViewings(filter: $filter, pagination: $pagination) {\n ...ViewingFields\n }\n }\n`;\n\nconst GET_VIEWING = gql`\n ${VIEWING_FIELDS}\n query GetViewing($id: ID!) {\n housingvistaViewing(id: $id) {\n ...ViewingFields\n }\n }\n`;\n\nconst RENTAL_APPLICATION_FIELDS = gql`\n fragment RentalApplicationFields on HousingVistaRentalApplication {\n id\n rentalUnitId\n applicantName\n applicantEmail\n applicantPhone\n monthlyIncome\n moveInDate\n status\n reviewNotes\n reviewedAt\n createdAt\n updatedAt\n documentFileIds\n rentalUnit {\n id\n unitNumber\n propertyTitle\n monthlyRent\n }\n }\n`;\n\nconst GET_RENTAL_APPLICATIONS = gql`\n ${RENTAL_APPLICATION_FIELDS}\n query GetRentalApplications(\n $filter: HousingVistaRentalApplicationFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaRentalApplications(filter: $filter, pagination: $pagination) {\n ...RentalApplicationFields\n }\n }\n`;\n\nconst MAINTENANCE_FIELDS = gql`\n fragment MaintenanceFields on HousingVistaMaintenanceRequest {\n id\n propertyId\n rentalUnitId\n title\n description\n category\n priority\n status\n resolutionNotes\n resolvedAt\n createdAt\n updatedAt\n }\n`;\n\nconst GET_MAINTENANCE_REQUESTS = gql`\n ${MAINTENANCE_FIELDS}\n query GetMaintenanceRequests(\n $filter: HousingVistaMaintenanceRequestFilterInput\n $pagination: HousingVistaPaginationInput\n ) {\n housingvistaMaintenanceRequests(filter: $filter, pagination: $pagination) {\n ...MaintenanceFields\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Mutation documents\n// ---------------------------------------------------------------------------\n\nconst CREATE_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n mutation CreateHousingvistaProperty($input: HousingVistaCreatePropertyInput!) {\n createHousingvistaProperty(input: $input) {\n ...PropertyFields\n }\n }\n`;\n\nconst UPDATE_PROPERTY = gql`\n ${PROPERTY_FIELDS}\n mutation UpdateHousingvistaProperty($id: ID!, $input: HousingVistaUpdatePropertyInput!) {\n updateHousingvistaProperty(id: $id, input: $input) {\n ...PropertyFields\n }\n }\n`;\n\nconst DELETE_PROPERTY = gql`\n mutation DeleteHousingvistaProperty($id: ID!) {\n deleteHousingvistaProperty(id: $id)\n }\n`;\n\nconst SAVE_SHORTLIST = gql`\n ${SHORTLIST_FIELDS}\n mutation SaveHousingvistaShortlist($input: HousingVistaSaveShortlistInput!) {\n saveHousingvistaShortlist(input: $input) {\n ...ShortlistFields\n }\n }\n`;\n\nconst REMOVE_SHORTLIST = gql`\n mutation RemoveHousingvistaShortlist($propertyId: ID!) {\n removeHousingvistaShortlist(propertyId: $propertyId)\n }\n`;\n\nconst BOOK_VIEWING = gql`\n mutation BookHousingvistaViewing($input: HousingVistaBookViewingInput!) {\n bookHousingvistaViewing(input: $input) {\n id\n propertyId\n scheduledAt\n slotId\n type\n status\n attendeeName\n attendeeEmail\n notes\n }\n }\n`;\n\nconst CANCEL_VIEWING = gql`\n mutation CancelHousingvistaViewing($id: ID!) {\n cancelHousingvistaViewing(id: $id) {\n id\n status\n }\n }\n`;\n\nconst SUBMIT_OFFER = gql`\n mutation SubmitHousingvistaOffer($input: HousingVistaSubmitOfferInput!) {\n submitHousingvistaOffer(input: $input) {\n id\n propertyId\n amount\n currency\n status\n notes\n expiresAt\n createdAt\n }\n }\n`;\n\nconst RESPOND_OFFER = gql`\n mutation RespondHousingvistaOffer($id: ID!, $input: HousingVistaRespondOfferInput!) {\n respondHousingvistaOffer(id: $id, input: $input) {\n id\n status\n counterAmount\n respondedAt\n }\n }\n`;\n\nconst CREATE_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n mutation CreateHousingvistaTransaction($input: HousingVistaCreateTransactionInput!) {\n createHousingvistaTransaction(input: $input) {\n ...TransactionFields\n }\n }\n`;\n\nconst CREATE_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n mutation CreateHousingvistaInvestment($input: HousingVistaCreateInvestmentInput!) {\n createHousingvistaInvestment(input: $input) {\n ...InvestmentFields\n }\n }\n`;\n\nconst CREATE_RENTAL_UNIT = gql`\n mutation CreateHousingvistaRentalUnit($input: HousingVistaCreateRentalUnitInput!) {\n createHousingvistaRentalUnit(input: $input) {\n id\n propertyTitle\n unitNumber\n tenantName\n monthlyRent\n status\n }\n }\n`;\n\nconst SUBMIT_RENTAL_APPLICATION = gql`\n mutation SubmitHousingvistaRentalApplication($input: HousingVistaSubmitRentalApplicationInput!) {\n submitHousingvistaRentalApplication(input: $input) {\n id\n rentalUnitId\n applicantName\n status\n }\n }\n`;\n\nconst CREATE_AMC_CONTRACT = gql`\n mutation CreateHousingvistaAmcContract($input: HousingVistaCreateAmcContractInput!) {\n createHousingvistaAmcContract(input: $input) {\n id\n propertyTitle\n packageName\n providerName\n monthlyCost\n status\n }\n }\n`;\n\nconst CREATE_MAINTENANCE_REQUEST = gql`\n mutation CreateHousingvistaMaintenanceRequest($input: HousingVistaCreateMaintenanceRequestInput!) {\n createHousingvistaMaintenanceRequest(input: $input) {\n id\n title\n category\n priority\n status\n }\n }\n`;\n\nconst CREATE_VERIFICATION_ITEM = gql`\n mutation CreateHousingvistaVerificationItem($input: HousingVistaCreateVerificationItemInput!) {\n createHousingvistaVerificationItem(input: $input) {\n id\n status\n entityLabel\n }\n }\n`;\n\nconst APPROVE_VERIFICATION = gql`\n mutation ApproveHousingvistaVerificationItem($id: ID!, $notes: String) {\n approveHousingvistaVerificationItem(id: $id, notes: $notes) {\n id\n status\n reviewerName\n notes\n # Needed to sync the normalized listing record (badge) in the cache\n # after a decision (reviewer P2, mfe#19).\n entityType\n entityId\n }\n }\n`;\n\nconst REJECT_VERIFICATION = gql`\n mutation RejectHousingvistaVerificationItem($id: ID!, $notes: String) {\n rejectHousingvistaVerificationItem(id: $id, notes: $notes) {\n id\n status\n reviewerName\n notes\n entityType\n entityId\n }\n }\n`;\n\nconst UPDATE_PROPERTY_RERA_STATUS = gql`\n mutation UpdateHousingvistaPropertyReraStatus(\n $id: ID!\n $status: HousingVistaReraVerificationStatus!\n $notes: String\n ) {\n updateHousingvistaPropertyReraStatus(id: $id, status: $status, notes: $notes) {\n id\n reraVerificationStatus\n reraApprovalDate\n }\n }\n`;\n\nconst WITHDRAW_OFFER = gql`\n mutation WithdrawHousingvistaOffer($id: ID!) {\n withdrawHousingvistaOffer(id: $id) {\n id\n status\n }\n }\n`;\n\nconst VIEWING_SLOT_FIELDS = gql`\n fragment ViewingSlotFields on HousingVistaViewingSlot {\n id\n propertyId\n startsAt\n endsAt\n status\n }\n`;\n\nconst GET_VIEWING_SLOTS = gql`\n ${VIEWING_SLOT_FIELDS}\n query GetViewingSlots($propertyId: ID!, $includeBooked: Boolean, $pagination: HousingVistaPaginationInput) {\n housingvistaViewingSlots(propertyId: $propertyId, includeBooked: $includeBooked, pagination: $pagination) {\n ...ViewingSlotFields\n }\n }\n`;\n\nconst PUBLISH_VIEWING_SLOTS = gql`\n ${VIEWING_SLOT_FIELDS}\n mutation PublishHousingvistaViewingSlots($input: HousingVistaPublishViewingSlotsInput!) {\n publishHousingvistaViewingSlots(input: $input) {\n ...ViewingSlotFields\n }\n }\n`;\n\nconst CANCEL_VIEWING_SLOT = gql`\n mutation CancelHousingvistaViewingSlot($id: ID!) {\n cancelHousingvistaViewingSlot(id: $id) {\n id\n status\n }\n }\n`;\n\nconst UPDATE_VIEWING = gql`\n mutation UpdateHousingvistaViewing($id: ID!, $input: HousingVistaUpdateViewingInput!) {\n updateHousingvistaViewing(id: $id, input: $input) {\n id\n scheduledAt\n status\n type\n notes\n }\n }\n`;\n\nconst UPDATE_INVESTMENT = gql`\n ${INVESTMENT_FIELDS}\n mutation UpdateHousingvistaInvestment($id: ID!, $input: HousingVistaUpdateInvestmentInput!) {\n updateHousingvistaInvestment(id: $id, input: $input) {\n ...InvestmentFields\n }\n }\n`;\n\nconst DELETE_INVESTMENT = gql`\n mutation DeleteHousingvistaInvestment($id: ID!) {\n deleteHousingvistaInvestment(id: $id)\n }\n`;\n\nconst CREATE_ASSET = gql`\n ${ASSET_FIELDS}\n mutation CreateHousingvistaAsset($input: HousingVistaCreateAssetInput!) {\n createHousingvistaAsset(input: $input) {\n ...AssetFields\n }\n }\n`;\n\nconst UPDATE_ASSET = gql`\n ${ASSET_FIELDS}\n mutation UpdateHousingvistaAsset($id: ID!, $input: HousingVistaUpdateAssetInput!) {\n updateHousingvistaAsset(id: $id, input: $input) {\n ...AssetFields\n }\n }\n`;\n\nconst DELETE_ASSET = gql`\n mutation DeleteHousingvistaAsset($id: ID!) {\n deleteHousingvistaAsset(id: $id)\n }\n`;\n\nconst UPDATE_AMC_CONTRACT = gql`\n mutation UpdateHousingvistaAmcContract($id: ID!, $input: HousingVistaUpdateAmcContractInput!) {\n updateHousingvistaAmcContract(id: $id, input: $input) {\n id\n status\n packageName\n providerName\n monthlyCost\n }\n }\n`;\n\nconst DELETE_AMC_CONTRACT = gql`\n mutation DeleteHousingvistaAmcContract($id: ID!) {\n deleteHousingvistaAmcContract(id: $id)\n }\n`;\n\nconst UPDATE_TRANSACTION = gql`\n ${TRANSACTION_FIELDS}\n mutation UpdateHousingvistaTransaction($id: ID!, $input: HousingVistaUpdateTransactionInput!) {\n updateHousingvistaTransaction(id: $id, input: $input) {\n ...TransactionFields\n }\n }\n`;\n\nconst DELETE_TRANSACTION = gql`\n mutation DeleteHousingvistaTransaction($id: ID!) {\n deleteHousingvistaTransaction(id: $id)\n }\n`;\n\nconst RESOLVE_MAINTENANCE = gql`\n ${MAINTENANCE_FIELDS}\n mutation ResolveHousingvistaMaintenanceRequest($id: ID!, $resolutionNotes: String) {\n resolveHousingvistaMaintenanceRequest(id: $id, resolutionNotes: $resolutionNotes) {\n ...MaintenanceFields\n }\n }\n`;\n\nconst REVIEW_RENTAL_APPLICATION = gql`\n ${RENTAL_APPLICATION_FIELDS}\n mutation ReviewHousingvistaRentalApplication($id: ID!, $input: HousingVistaReviewRentalApplicationInput!) {\n reviewHousingvistaRentalApplication(id: $id, input: $input) {\n ...RentalApplicationFields\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Query-result row shapes (as selected above)\n// ---------------------------------------------------------------------------\n\ninterface PropertyVerificationItemRow {\n id: string;\n entityLabel: string;\n entityType: string;\n status: string;\n submittedAt: string;\n documentFiles: {\n id: string;\n name: string;\n downloadUrl: string | null;\n createdAt: string;\n }[];\n}\n\ninterface PropertyRow {\n id: string;\n title: string;\n description: string | null;\n type: Property['type'];\n status: Property['status'];\n category: string;\n verificationStatus: string;\n reraRegistrationNo: string | null;\n reraAuthority: string | null;\n reraApprovalDate: string | null;\n reraUrl: string | null;\n reraVerificationStatus: ReraVerificationStatus;\n imageUrl: string | null;\n createdAt: string;\n updatedAt: string;\n price: Property['price'];\n location: Omit<Property['location'], 'coordinates'> & {\n coordinates: { latitude: number; longitude: number } | null;\n };\n specifications: Property['specifications'];\n amenities: Property['amenities'];\n images: Property['images'];\n // Trust layer (BOFF-8674): verification checks filed against the listing.\n // Detail-only (see PROPERTY_VERIFICATION_FIELDS) — absent on list rows.\n verificationItems?: PropertyVerificationItemRow[];\n}\n\ninterface TransactionRow {\n id: string;\n title: string;\n type: string;\n status: string;\n amount: number;\n currency: string;\n documents: unknown;\n milestones: unknown;\n parties: unknown;\n escrow: unknown;\n /** Origin offer id when this deal was converted from an accepted offer (TXN-01). */\n offerId: string | null;\n createdAt: string;\n updatedAt: string;\n property: PropertyRow | null;\n buyer: TxParty | null;\n seller: TxParty | null;\n tenant: TxParty | null;\n landlord: TxParty | null;\n}\n\ninterface TxParty {\n id: string | null;\n firstName: string | null;\n lastName: string | null;\n avatar: string | null;\n}\n\ninterface InvestmentRow {\n id: string;\n title: string;\n investmentType: string;\n totalValue: number;\n status: string;\n startDate: string;\n maturityDate: string | null;\n riskLevel: string;\n investors: unknown;\n returns: unknown;\n documentFileIds: string[];\n property: PropertyRow | null;\n}\n\ninterface ShortlistRow {\n id: string;\n propertyId: string;\n notes: string | null;\n createdAt: string;\n property: PropertyRow;\n}\n\n// ---------------------------------------------------------------------------\n// Mappers: GraphQL row → MFE domain type\n// ---------------------------------------------------------------------------\n\n/**\n * The domain `Property` carries display-only fields the subgraph does not\n * resolve (owner/documents/features/virtualTours/availability). We fill the\n * present fields from the query and default the rest to empty so consumers can\n * render honest empty-states rather than crashing on `undefined`.\n */\nconst mapProperty = (row: PropertyRow): Property => ({\n id: row.id,\n title: row.title,\n description: row.description ?? '',\n type: row.type,\n status: row.status,\n category: row.category as Property['category'],\n price: row.price,\n location: {\n ...row.location,\n coordinates: row.location.coordinates ?? { latitude: 0, longitude: 0 },\n },\n specifications: row.specifications,\n amenities: row.amenities ?? [],\n images: row.images ?? [],\n // Trust layer (BOFF-8674): flatten each verification check's evidence\n // files into the existing PropertyDocument shape so any consumer of\n // property.documents sees per-document verification. The check's status\n // covers its whole document set (batch-level truth; the item IS the\n // document batch here) — 'approved' maps to the 'verified' signal the\n // badge/filter already use.\n documents: (row.verificationItems ?? []).flatMap((item) =>\n (item.documentFiles ?? []).map((file) => ({\n id: file.id,\n name: file.name,\n type: 'verification',\n url: file.downloadUrl ?? '',\n verificationStatus: (item.status === 'approved' ? 'verified' : item.status) as VerificationStatus,\n // The File's own createdAt is the upload time — the item's submittedAt\n // can be later than the actual upload if the agent drafted first\n // (Codex P2, mfe#19).\n uploadedAt: new Date(file.createdAt),\n }))\n ),\n virtualTours: [],\n owner: { id: '', name: '', email: '', phone: '', verified: false },\n features: [],\n verificationStatus: (row.verificationStatus as Property['verificationStatus']) ?? 'pending',\n availability: { available: true },\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n reraRegistrationNo: row.reraRegistrationNo,\n reraAuthority: row.reraAuthority,\n reraApprovalDate: row.reraApprovalDate ? new Date(row.reraApprovalDate) : null,\n reraUrl: row.reraUrl,\n reraVerificationStatus: row.reraVerificationStatus ?? 'not_applicable',\n});\n\n// ---------------------------------------------------------------------------\n// Query hooks\n// ---------------------------------------------------------------------------\n\nconst emptyTrends: DashboardTrends = {\n totalProperties: [],\n monthlyRevenue: [],\n occupancyRate: [],\n activeTransactions: [],\n};\n\nexport const useDashboardStats = () => {\n const { data, loading, error } = useQuery<{ housingvistaDashboardStats: DashboardStats }>(GET_DASHBOARD_STATS);\n const empty: DashboardStats = {\n totalProperties: 0,\n totalValue: 0,\n occupancyRate: 0,\n monthlyRevenue: 0,\n activeTransactions: 0,\n pendingVerifications: 0,\n totalInvestments: 0,\n investmentReturns: 0,\n totalTenants: 0,\n maintenanceRequests: 0,\n unreadMessages: 0,\n upcomingViewings: 0,\n trends: emptyTrends,\n };\n return { data: data?.housingvistaDashboardStats ?? empty, loading, error };\n};\n\nexport const useRecentActivities = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaTransactions: TransactionRow[] }>(GET_TRANSACTIONS, {\n variables: getPaginationVariables(pagination),\n });\n const activities: RecentActivity[] = (data?.housingvistaTransactions ?? []).map((txn) => ({\n id: `act-${txn.id}`,\n type: 'transaction_update',\n title: `Transaction: ${txn.type}`,\n description: `${txn.property?.title ?? 'Property'} - ${txn.status}`,\n timestamp: txn.updatedAt || txn.createdAt,\n entityId: txn.id,\n entityType: 'transaction',\n actorName: txn.buyer\n ? `${txn.buyer.firstName ?? ''} ${txn.buyer.lastName ?? ''}`.trim()\n : txn.tenant\n ? `${txn.tenant.firstName ?? ''} ${txn.tenant.lastName ?? ''}`.trim()\n : 'System',\n actorAvatar: txn.buyer?.avatar ?? txn.tenant?.avatar ?? undefined,\n }));\n return { data: activities, loading, error };\n};\n\nexport const useProperties = (options?: {\n filter?: PropertyFilterInput;\n pagination?: PaginationInput;\n skip?: boolean;\n}) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaProperties: PropertyRow[] }>(GET_PROPERTIES, {\n variables: {\n filter: options?.filter,\n ...getPaginationVariables(options?.pagination),\n },\n skip: options?.skip,\n });\n return {\n data: (data?.housingvistaProperties ?? []).map(mapProperty),\n loading,\n error,\n refetch,\n };\n};\n\nexport const useProperty = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaProperty: PropertyRow | null }>(GET_PROPERTY, {\n variables: { id: id ?? '' },\n skip: !id,\n // cache-and-network: the Documents tab's evidence can change from the\n // Verification Center (or another reviewer) between visits — serve the\n // cache instantly but always reconcile against the network on mount\n // (Codex P2, mfe#19).\n fetchPolicy: 'cache-and-network',\n });\n return {\n data: data?.housingvistaProperty ? mapProperty(data.housingvistaProperty) : null,\n loading,\n error,\n };\n};\n\n// BOFF-4129 — natural-language property search. `method` tells the caller\n// whether the filter shown was extracted by an LLM ('ai') or the\n// deterministic keyword baseline ('keyword'); `fallbackReason` is set when\n// an AI attempt was made and failed. `results` are always a real\n// `listProperties` query result — never LLM-generated listing data.\nexport interface NlSearchFilter {\n city?: string | null;\n type?: PropertyType | null;\n status?: PropertyStatus | null;\n category?: string | null;\n priceMin?: number | null;\n priceMax?: number | null;\n bedroomsMin?: number | null;\n amenities?: string[] | null;\n reraVerificationStatus?: string | null;\n}\n\ninterface NlSearchResultRow {\n query: string;\n method: 'ai' | 'keyword';\n fallbackReason: string | null;\n filter: NlSearchFilter;\n properties: PropertyRow[];\n}\n\nconst NL_SEARCH_PROPERTIES = gql`\n ${PROPERTY_FIELDS}\n query HousingVistaNaturalLanguageSearch($query: String!, $pagination: HousingVistaPaginationInput) {\n housingvistaNaturalLanguageSearch(query: $query, pagination: $pagination) {\n query\n method\n fallbackReason\n filter {\n city\n type\n status\n category\n priceMin\n priceMax\n bedroomsMin\n amenities\n reraVerificationStatus\n }\n properties {\n ...PropertyFields\n }\n }\n }\n`;\n\nexport const useNaturalLanguageSearch = () => {\n const [run, { data, loading, error }] = useLazyQuery<\n { housingvistaNaturalLanguageSearch: NlSearchResultRow },\n { query: string; pagination?: PaginationInput }\n >(NL_SEARCH_PROPERTIES);\n\n const search = (query: string, pagination?: PaginationInput) => run({ variables: { query, pagination } });\n\n const result = data?.housingvistaNaturalLanguageSearch;\n return {\n search,\n loading,\n error,\n method: result?.method ?? null,\n fallbackReason: result?.fallbackReason ?? null,\n filter: result?.filter ?? null,\n properties: (result?.properties ?? []).map(mapProperty),\n };\n};\n\nexport const useTransactions = (options?: ListOptions<TransactionFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaTransactions: TransactionRow[] }>(GET_TRANSACTIONS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n // Transaction JSON columns (documents/milestones/parties/escrow) are opaque to\n // the schema; the page guards their runtime shape. Cast is localized here.\n return { data: (data?.housingvistaTransactions ?? []) as unknown as Transaction[], loading, error, refetch };\n};\n\n/**\n * Generic paged-to-completion reader: the svc caps a page at 100, so crawl\n * until a short page (50-page safety bound = 5,000 rows). Pure crawl: state\n * is written only behind the caller's cancellation guard, so a stopped crawl\n * never publishes partial results. Exposes error + refetch so callers can\n * tell \"no rows\" apart from \"we don't know\" and refresh after a mutation.\n */\nfunction useAllPages<TRow>(query: DocumentNode, listField: string, baseVariables?: Record<string, unknown>) {\n const client = useApolloClient();\n const [data, setData] = useState<TRow[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n // Ref indirection so an inline baseVariables object (new ref every render)\n // cannot re-trigger the crawl effect on every render.\n const baseVariablesRef = useRef(baseVariables);\n useEffect(() => {\n baseVariablesRef.current = baseVariables;\n }, [baseVariables]);\n\n const fetchAll = useCallback(\n async (shouldStop?: () => boolean): Promise<TRow[]> => {\n const all: TRow[] = [];\n let offset = 0;\n const MAX_PAGES = 50;\n for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex += 1) {\n if (shouldStop?.()) break;\n const result = await client.query<{ [key: string]: TRow[] | undefined }>({\n query,\n variables: { ...baseVariablesRef.current, pagination: { limit: 100, offset } },\n fetchPolicy: 'network-only',\n });\n const page = result.data?.[listField] ?? [];\n all.push(...page);\n if (page.length < 100) break;\n offset += page.length;\n }\n return all;\n },\n [client, query, listField]\n );\n\n // Monotonic generation: a crawl superseded by a newer one (e.g. refetch()\n // racing an in-flight initial crawl) must never write state — only the\n // latest generation publishes.\n const generationRef = useRef(0);\n\n const refetch = useCallback(async () => {\n const generation = ++generationRef.current;\n setLoading(true);\n setError(null);\n try {\n const all = await fetchAll();\n if (generation !== generationRef.current) return;\n setData(all);\n } catch (err) {\n if (generation === generationRef.current) setError(err as Error);\n } finally {\n if (generation === generationRef.current) setLoading(false);\n }\n }, [fetchAll]);\n\n useEffect(() => {\n let cancelled = false;\n const generation = ++generationRef.current;\n setLoading(true);\n setError(null);\n fetchAll(() => cancelled)\n .then((all) => {\n if (!cancelled && generation === generationRef.current) setData(all);\n })\n .catch((err) => {\n if (!cancelled && generation === generationRef.current) setError(err as Error);\n })\n .finally(() => {\n // A refetch() that started meanwhile owns the loading flag and the error state now.\n if (!cancelled && generation === generationRef.current) setLoading(false);\n });\n return () => {\n cancelled = true;\n };\n }, [fetchAll]);\n\n return { data, loading, error, refetch };\n}\n\n/**\n * Every transaction in the workspace, paged to completion. Used where the UI\n * must match rows across the full set — e.g. the OffersPage \"Create deal\"\n * gate, which must see a deal converted from any accepted offer no matter\n * where it falls in the list.\n */\nexport const useAllTransactions = () => {\n const { data, loading, error, refetch } = useAllPages<TransactionRow>(GET_TRANSACTIONS, 'housingvistaTransactions');\n // Transaction JSON columns are opaque to the schema; pages guard their\n // runtime shape. Cast is localized here.\n return {\n data: data as unknown as Transaction[],\n loading,\n error,\n refetch,\n };\n};\n\nexport const useTransaction = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaTransaction: TransactionRow | null }>(GET_TRANSACTION, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return {\n data: (data?.housingvistaTransaction ?? null) as unknown as Transaction | null,\n loading,\n error,\n };\n};\n\nexport const useInvestments = (options?: ListOptions<InvestmentFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaInvestments: InvestmentRow[] }>(GET_INVESTMENTS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: (data?.housingvistaInvestments ?? []) as unknown as Investment[], loading, error, refetch };\n};\n\n/**\n * Whether the workspace's investor eligibility is verified (BOFF-9839). Fails\n * closed: while loading, when the caller may not read the setting (admin-only\n * `investment-compliance:read`; skipped so a non-admin never triggers a\n * permission toast), or when the read fails, it reports `false`, so the UI\n * only offers the expression-of-interest status. The server gate is the\n * enforcement point either way.\n */\nexport const useInvestmentCompliance = () => {\n const permissions = useSafePermissions();\n const canRead =\n permissions !== null && !permissions.isLoading && permissions.hasPermission('investment-compliance:read');\n const { data, loading } = useQuery<{\n housingvistaInvestmentComplianceSetting: { workspaceId: string; eligibilityVerified: boolean };\n }>(GET_INVESTMENT_COMPLIANCE, { skip: !canRead });\n return {\n eligibilityVerified: data?.housingvistaInvestmentComplianceSetting.eligibilityVerified === true,\n // True until the answer is known: permissions still resolving, or the read in flight. A\n // skipped read (no permission) is settled, not loading — it stays fail-closed.\n loading: permissions !== null && (permissions.isLoading || (canRead && loading)),\n };\n};\n\nexport const useInvestment = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaInvestment: InvestmentRow | null }>(GET_INVESTMENT, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: (data?.housingvistaInvestment ?? null) as unknown as Investment | null, loading, error, refetch };\n};\n\nexport const useRentalUnits = (options?: ListOptions<RentalUnitFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaRentalUnits: RentalUnit[] }>(GET_RENTAL_UNITS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaRentalUnits ?? [], loading, error, refetch };\n};\n\nexport const useAssets = (options?: ListOptions<AssetFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaAssets: Asset[] }>(GET_ASSETS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaAssets ?? [], loading, error, refetch };\n};\n\nexport const useAsset = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaAsset: Asset | null }>(GET_ASSET, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaAsset ?? null, loading, error };\n};\n\n// servicesIncluded is a JSON column: a contract created without services reads back null.\nconst normalizeAmcContracts = (contracts: AMCContract[]): AMCContract[] =>\n contracts.map((contract) => ({\n ...contract,\n servicesIncluded: Array.isArray(contract.servicesIncluded) ? contract.servicesIncluded : [],\n }));\n\nexport const useAMCContracts = (options?: ListOptions<AmcContractFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaAmcContracts: AMCContract[] }>(GET_AMC_CONTRACTS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n const contracts = useMemo(() => normalizeAmcContracts(data?.housingvistaAmcContracts ?? []), [data]);\n return { data: contracts, loading, error, refetch };\n};\n\n/**\n * Every AMC contract in the workspace, paged to completion (BOFF-9605). The list page shows 10 at a time and\n * filters by search, so anything that must describe the whole portfolio — the stat cards and the service\n * schedule — reads this instead. Not an Apollo watch query: call `refetch` after a mutation.\n */\nexport const useAllAmcContracts = () => {\n const { data, loading, error, refetch } = useAllPages<AMCContract>(GET_AMC_CONTRACTS, 'housingvistaAmcContracts');\n const contracts = useMemo(() => normalizeAmcContracts(data), [data]);\n return { data: contracts, loading, error, refetch };\n};\n\nexport const useMarketplaceServices = (options?: ListOptions<MarketplaceServiceFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaMarketplaceServices: MarketplaceService[] }>(\n GET_MARKETPLACE_SERVICES,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaMarketplaceServices ?? [], loading, error, refetch };\n};\n\nexport const useMarketplaceService = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaMarketplaceService: MarketplaceService | null }>(\n GET_MARKETPLACE_SERVICE,\n { variables: { id: id ?? '' }, skip: !id }\n );\n return { data: data?.housingvistaMarketplaceService ?? null, loading, error };\n};\n\nexport const useVerifications = (options?: ListOptions<VerificationItemFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaVerificationItems: VerificationItem[] }>(\n GET_VERIFICATIONS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaVerificationItems ?? [], loading, error, refetch };\n};\n\n/**\n * Single verification item. The detail view needs the audit timestamps\n * (`createdAt`/`updatedAt`) that the list type omits, so the result is typed as\n * `VerificationItem` extended with those ISO-string fields.\n */\nexport type VerificationItemDetail = VerificationItem & {\n createdAt: string;\n updatedAt: string;\n};\n\nexport const useVerificationItem = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaVerificationItem: VerificationItemDetail | null }>(\n GET_VERIFICATION,\n { variables: { id: id ?? '' }, skip: !id }\n );\n return { data: data?.housingvistaVerificationItem ?? null, loading, error, refetch };\n};\n\nexport const useLegalServices = (options?: ListOptions<LegalServiceFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaLegalServices: LegalService[] }>(\n GET_LEGAL_SERVICES,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaLegalServices ?? [], loading, error, refetch };\n};\n\nexport const useLegalService = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaLegalService: LegalService | null }>(GET_LEGAL_SERVICE, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaLegalService ?? null, loading, error };\n};\n\nexport const useHomeLoans = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaHomeLoanOffers: HomeLoan[] }>(GET_HOME_LOANS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaHomeLoanOffers ?? [], loading, error };\n};\n\nexport const useHomeLoanOffer = (id: string | undefined) => {\n const { data, loading, error } = useQuery<{ housingvistaHomeLoanOffer: HomeLoan | null }>(GET_HOME_LOAN, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaHomeLoanOffer ?? null, loading, error };\n};\n\nexport const useMarketTrends = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaMarketTrends: MarketTrend[] }>(GET_MARKET_TRENDS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaMarketTrends ?? [], loading, error };\n};\n\nexport const useAreaInsights = (pagination?: PaginationInput) => {\n const { data, loading, error } = useQuery<{ housingvistaAreaInsights: AreaInsight[] }>(GET_AREA_INSIGHTS, {\n variables: getPaginationVariables(pagination),\n });\n return { data: data?.housingvistaAreaInsights ?? [], loading, error };\n};\n\n// ---------------------------------------------------------------------------\n// Catalog authoring (BOFF-9838): marketplace services, legal services, home-loan offers, area insights\n// ---------------------------------------------------------------------------\n\n/** An update input: every field optional, and null clears a nullable one. */\ntype CatalogUpdate<T> = { [K in keyof T]?: T[K] | null };\n\nexport interface MarketplaceServiceInput {\n name: string;\n providerName: string;\n category: string;\n description?: string;\n imageUrl?: string;\n priceRange?: string;\n responseTime?: string;\n rating?: number;\n reviewCount?: number;\n verified?: boolean;\n featured?: boolean;\n availableAreas?: string[];\n}\n\nexport interface LegalServiceInput {\n title: string;\n providerName: string;\n category: string;\n status: string;\n description?: string;\n providerRating?: number;\n estimatedDuration?: string;\n priceRange?: string;\n consultationFee?: number;\n documentsRequired?: string[];\n}\n\nexport interface HomeLoanOfferInput {\n bankName: string;\n interestRate: number;\n maxTenure: number;\n maxAmount: number;\n bankLogo?: string;\n emiPerLakh?: number;\n processingFee?: string;\n prepaymentCharges?: string;\n specialOffer?: string;\n rating?: number;\n features?: string[];\n}\n\nexport interface AreaInsightInput {\n areaName: string;\n city: string;\n safetyScore: number;\n connectivityScore: number;\n amenitiesScore: number;\n schoolsNearby: number;\n hospitalsNearby: number;\n population: number;\n greenCoverPercent: number;\n avgPropertyPrice: number;\n avgRentalYield: number;\n appreciationRate: number;\n upcomingProjects: number;\n avg2BhkPrice?: number;\n avg3BhkPrice?: number;\n amenitiesRating?: number;\n nearbyHubs?: string[];\n transportLinks?: string[];\n schools?: string[];\n hospitals?: string[];\n malls?: string[];\n}\n\nconst CREATE_MARKETPLACE_SERVICE = gql`\n mutation CreateHousingvistaMarketplaceService($input: HousingVistaCreateMarketplaceServiceInput!) {\n createHousingvistaMarketplaceService(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_MARKETPLACE_SERVICE = gql`\n mutation UpdateHousingvistaMarketplaceService($id: ID!, $input: HousingVistaUpdateMarketplaceServiceInput!) {\n updateHousingvistaMarketplaceService(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_MARKETPLACE_SERVICE = gql`\n mutation DeleteHousingvistaMarketplaceService($id: ID!) {\n deleteHousingvistaMarketplaceService(id: $id)\n }\n`;\nconst CREATE_LEGAL_SERVICE = gql`\n mutation CreateHousingvistaLegalService($input: HousingVistaCreateLegalServiceInput!) {\n createHousingvistaLegalService(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_LEGAL_SERVICE = gql`\n mutation UpdateHousingvistaLegalService($id: ID!, $input: HousingVistaUpdateLegalServiceInput!) {\n updateHousingvistaLegalService(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_LEGAL_SERVICE = gql`\n mutation DeleteHousingvistaLegalService($id: ID!) {\n deleteHousingvistaLegalService(id: $id)\n }\n`;\nconst CREATE_HOME_LOAN_OFFER = gql`\n mutation CreateHousingvistaHomeLoanOffer($input: HousingVistaCreateHomeLoanOfferInput!) {\n createHousingvistaHomeLoanOffer(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_HOME_LOAN_OFFER = gql`\n mutation UpdateHousingvistaHomeLoanOffer($id: ID!, $input: HousingVistaUpdateHomeLoanOfferInput!) {\n updateHousingvistaHomeLoanOffer(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_HOME_LOAN_OFFER = gql`\n mutation DeleteHousingvistaHomeLoanOffer($id: ID!) {\n deleteHousingvistaHomeLoanOffer(id: $id)\n }\n`;\nconst CREATE_AREA_INSIGHT = gql`\n mutation CreateHousingvistaAreaInsight($input: HousingVistaCreateAreaInsightInput!) {\n createHousingvistaAreaInsight(input: $input) {\n id\n }\n }\n`;\nconst UPDATE_AREA_INSIGHT = gql`\n mutation UpdateHousingvistaAreaInsight($id: ID!, $input: HousingVistaUpdateAreaInsightInput!) {\n updateHousingvistaAreaInsight(id: $id, input: $input) {\n id\n }\n }\n`;\nconst DELETE_AREA_INSIGHT = gql`\n mutation DeleteHousingvistaAreaInsight($id: ID!) {\n deleteHousingvistaAreaInsight(id: $id)\n }\n`;\n\n/**\n * One catalog write. `refetchQueries` reaches only the list that is mounted, so the cached list pages and the detail\n * of the changed entity are evicted too: whatever is mounted refetches, whatever is not drops its stale copy.\n */\nfunction useCatalogWrite<TVars extends Record<string, unknown>>(\n document: DocumentNode,\n cacheFields: readonly string[],\n listQuery: string\n) {\n const [mutate, { loading }] = useMutation<Record<string, unknown>, TVars>(document, {\n refetchQueries: [listQuery],\n update: (cache: ApolloCache) => {\n for (const fieldName of cacheFields) cache.evict({ fieldName });\n cache.gc();\n },\n });\n const run = async (variables: TVars): Promise<unknown> => {\n const res = await mutate({ variables });\n return res.data;\n };\n return { run, loading };\n}\n\nconst MARKETPLACE_CACHE = ['housingvistaMarketplaceServices', 'housingvistaMarketplaceService'] as const;\nconst LEGAL_CACHE = ['housingvistaLegalServices', 'housingvistaLegalService'] as const;\nconst HOME_LOAN_CACHE = ['housingvistaHomeLoanOffers', 'housingvistaHomeLoanOffer'] as const;\nconst AREA_INSIGHT_CACHE = ['housingvistaAreaInsights'] as const;\n\nexport const useCreateMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ input: MarketplaceServiceInput }>(\n CREATE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n createMarketplaceService: async (input: MarketplaceServiceInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<MarketplaceServiceInput> }>(\n UPDATE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n updateMarketplaceService: async (id: string, input: CatalogUpdate<MarketplaceServiceInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteMarketplaceService = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(\n DELETE_MARKETPLACE_SERVICE,\n MARKETPLACE_CACHE,\n 'GetMarketplaceServices'\n );\n return {\n deleteMarketplaceService: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaMarketplaceService?: boolean } | undefined;\n return data?.deleteHousingvistaMarketplaceService ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateLegalService = () => {\n const { run, loading } = useCatalogWrite<{ input: LegalServiceInput }>(\n CREATE_LEGAL_SERVICE,\n LEGAL_CACHE,\n 'GetLegalServices'\n );\n return {\n createLegalService: async (input: LegalServiceInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateLegalService = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<LegalServiceInput> }>(\n UPDATE_LEGAL_SERVICE,\n LEGAL_CACHE,\n 'GetLegalServices'\n );\n return {\n updateLegalService: async (id: string, input: CatalogUpdate<LegalServiceInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteLegalService = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_LEGAL_SERVICE, LEGAL_CACHE, 'GetLegalServices');\n return {\n deleteLegalService: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaLegalService?: boolean } | undefined;\n return data?.deleteHousingvistaLegalService ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ input: HomeLoanOfferInput }>(\n CREATE_HOME_LOAN_OFFER,\n HOME_LOAN_CACHE,\n 'GetHomeLoans'\n );\n return {\n createHomeLoanOffer: async (input: HomeLoanOfferInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<HomeLoanOfferInput> }>(\n UPDATE_HOME_LOAN_OFFER,\n HOME_LOAN_CACHE,\n 'GetHomeLoans'\n );\n return {\n updateHomeLoanOffer: async (id: string, input: CatalogUpdate<HomeLoanOfferInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteHomeLoanOffer = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_HOME_LOAN_OFFER, HOME_LOAN_CACHE, 'GetHomeLoans');\n return {\n deleteHomeLoanOffer: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaHomeLoanOffer?: boolean } | undefined;\n return data?.deleteHousingvistaHomeLoanOffer ?? false;\n },\n loading,\n };\n};\n\nexport const useCreateAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ input: AreaInsightInput }>(\n CREATE_AREA_INSIGHT,\n AREA_INSIGHT_CACHE,\n 'GetAreaInsights'\n );\n return {\n createAreaInsight: async (input: AreaInsightInput) => {\n await run({ input });\n },\n loading,\n };\n};\n\nexport const useUpdateAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ id: string; input: CatalogUpdate<AreaInsightInput> }>(\n UPDATE_AREA_INSIGHT,\n AREA_INSIGHT_CACHE,\n 'GetAreaInsights'\n );\n return {\n updateAreaInsight: async (id: string, input: CatalogUpdate<AreaInsightInput>) => {\n await run({ id, input });\n },\n loading,\n };\n};\n\nexport const useDeleteAreaInsight = () => {\n const { run, loading } = useCatalogWrite<{ id: string }>(DELETE_AREA_INSIGHT, AREA_INSIGHT_CACHE, 'GetAreaInsights');\n return {\n deleteAreaInsight: async (id: string): Promise<boolean> => {\n const data = (await run({ id })) as { deleteHousingvistaAreaInsight?: boolean } | undefined;\n return data?.deleteHousingvistaAreaInsight ?? false;\n },\n loading,\n };\n};\n\n/** The catalog resources whose writes the gateway gates on the `manage` action. */\nexport type CatalogResource = 'marketplace' | 'legal' | 'homeloan' | 'market';\n\n/**\n * True only once the shell has loaded the caller's permissions and they include `permission`. The gateway enforces\n * the same `@rbac` directive on every write; this only keeps controls the caller cannot use off the screen.\n */\nconst useHasPermission = (permission: string): boolean => {\n const permissions = useSafePermissions();\n return permissions !== null && !permissions.isLoading && permissions.hasPermission(permission);\n};\n\n/** `<resource>:manage` for a catalog the gateway gates on the `manage` action. */\nexport const useCanManageCatalog = (resource: CatalogResource): boolean => useHasPermission(`${resource}:manage`);\n\n/** The rental actions the expense writes are gated on: create, update and delete HousingvistaExpense. */\nexport type RentalAction = 'create' | 'update' | 'delete';\n\n/** `rental:<action>`, so Edit and Delete are offered only to callers the gateway will let through. */\nexport const useCanRental = (action: RentalAction): boolean => useHasPermission(`rental:${action}`);\n\nexport const useShortlists = (pagination?: PaginationInput) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaShortlists: ShortlistRow[] }>(GET_SHORTLISTS, {\n variables: getPaginationVariables(pagination),\n });\n const shortlists = (data?.housingvistaShortlists ?? []).map((row) => ({\n id: row.id,\n propertyId: row.propertyId,\n notes: row.notes ?? undefined,\n createdAt: row.createdAt,\n property: mapProperty(row.property),\n }));\n return { data: shortlists, loading, error, refetch };\n};\n\nexport const useAnalyticsData = (period: AnalyticsPeriod = 'month') => {\n const { data, loading, error } = useQuery<{ housingvistaAnalytics: AnalyticsChartData }>(GET_ANALYTICS, {\n variables: { period },\n });\n return { data: data?.housingvistaAnalytics ?? null, loading, error };\n};\n\n// ---------------------------------------------------------------------------\n// Expense ledger (BOFF-9843)\n// ---------------------------------------------------------------------------\n\nexport interface ExpenseRow {\n id: string;\n amount: number;\n category: string;\n description: string | null;\n incurredOn: string;\n propertyId: string | null;\n createdAt: string;\n}\n\nexport type ExpenseFilterInput = {\n search?: string;\n category?: string;\n propertyId?: string;\n from?: string;\n to?: string;\n};\n\nexport interface CreateExpenseInput {\n amount: number;\n category: string;\n incurredOn: string;\n description?: string;\n propertyId?: string;\n}\n\nexport interface UpdateExpenseInput {\n amount?: number;\n category?: string;\n incurredOn?: string;\n /** null clears the description. */\n description?: string | null;\n /** null unlinks the property, making the expense portfolio-wide. */\n propertyId?: string | null;\n}\n\nconst GET_EXPENSES = gql`\n query GetHousingvistaExpenses($filter: HousingVistaExpenseFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaExpenses(filter: $filter, pagination: $pagination) {\n id\n amount\n category\n description\n incurredOn\n propertyId\n createdAt\n }\n }\n`;\n\nconst CREATE_EXPENSE = gql`\n mutation CreateHousingvistaExpense($input: HousingVistaCreateExpenseInput!) {\n createHousingvistaExpense(input: $input) {\n id\n }\n }\n`;\n\nconst UPDATE_EXPENSE = gql`\n mutation UpdateHousingvistaExpense($id: ID!, $input: HousingVistaUpdateExpenseInput!) {\n updateHousingvistaExpense(id: $id, input: $input) {\n id\n }\n }\n`;\n\nconst DELETE_EXPENSE = gql`\n mutation DeleteHousingvistaExpense($id: ID!) {\n deleteHousingvistaExpense(id: $id)\n }\n`;\n\n/**\n * Analytics reads the expense ledger, so any change to it makes the cached analytics stale, and so does every cached\n * page / filter combination of the list itself (refetchQueries only reaches the one that is mounted). Evicting both\n * fields refetches what is mounted and drops what is not.\n */\nconst evictExpenseCaches = (cache: ApolloCache) => {\n cache.evict({ fieldName: 'housingvistaAnalytics' });\n cache.evict({ fieldName: 'housingvistaExpenses' });\n cache.gc();\n};\n\nexport const useExpenses = (options?: ListOptions<ExpenseFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaExpenses: ExpenseRow[] }>(GET_EXPENSES, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n const expenses = useMemo(() => data?.housingvistaExpenses ?? [], [data]);\n return { data: expenses, loading, error, refetch };\n};\n\n/**\n * Every recorded expense, paged to completion. The ledger page shows 10 at a time and filters, but its summary\n * cards describe the whole ledger, so they read this. Not an Apollo watch query: call `refetch` after a mutation.\n */\nexport const useAllExpenses = () => useAllPages<ExpenseRow>(GET_EXPENSES, 'housingvistaExpenses');\n\nexport const useCreateExpense = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaExpense: { id: string } },\n { input: CreateExpenseInput }\n >(CREATE_EXPENSE, { refetchQueries: ['GetHousingvistaExpenses'], update: evictExpenseCaches });\n const createExpense = async (input: CreateExpenseInput) => {\n await mutate({ variables: { input } });\n };\n return { createExpense, loading };\n};\n\nexport const useUpdateExpense = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaExpense: { id: string } },\n { id: string; input: UpdateExpenseInput }\n >(UPDATE_EXPENSE, { refetchQueries: ['GetHousingvistaExpenses'], update: evictExpenseCaches });\n const updateExpense = async (id: string, input: UpdateExpenseInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateExpense, loading };\n};\n\nexport const useDeleteExpense = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaExpense: boolean }, { id: string }>(DELETE_EXPENSE, {\n refetchQueries: ['GetHousingvistaExpenses'],\n update: evictExpenseCaches,\n });\n const deleteExpense = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaExpense ?? false;\n };\n return { deleteExpense, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Offers / Viewings / Rental applications / Maintenance — query hooks\n// ---------------------------------------------------------------------------\n\nexport interface OfferRow {\n id: string;\n propertyId: string;\n amount: number;\n counterAmount: number | null;\n currency: string;\n status: 'submitted' | 'countered' | 'accepted' | 'rejected' | 'withdrawn' | 'expired';\n notes: string | null;\n respondedAt: string | null;\n /** Optional deadline; open offers flip to 'expired' past it (backend lazy sweep). */\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n property: {\n id: string;\n title: string;\n location: { city: string; state: string };\n images: { id: string; url: string; isPrimary: boolean }[];\n price: { amount: number; currency: string; type?: string | null };\n } | null;\n}\n\nexport const useOffers = (options?: ListOptions<OfferFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaOffers: OfferRow[] }>(GET_OFFERS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaOffers ?? [], loading, error, refetch };\n};\n\nexport const useOffer = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaOffer: OfferRow | null }>(GET_OFFER, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaOffer ?? null, loading, error, refetch };\n};\n\nexport interface ViewingRow {\n id: string;\n propertyId: string;\n scheduledAt: string;\n type: 'in_person' | 'virtual';\n status: 'requested' | 'confirmed' | 'completed' | 'cancelled';\n /** The published slot this viewing holds, or null for a free-datetime booking. */\n slotId: string | null;\n attendeeName: string | null;\n attendeeEmail: string | null;\n notes: string | null;\n createdAt: string;\n updatedAt: string;\n property: {\n id: string;\n title: string;\n location: { city: string; state: string };\n images: { id: string; url: string; isPrimary: boolean }[];\n } | null;\n}\n\nexport const useViewings = (options?: ListOptions<ViewingFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewings: ViewingRow[] }>(GET_VIEWINGS, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaViewings ?? [], loading, error, refetch };\n};\n\nexport const useViewing = (id: string | undefined) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewing: ViewingRow | null }>(GET_VIEWING, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n return { data: data?.housingvistaViewing ?? null, loading, error, refetch };\n};\n\nexport interface RentalApplicationRow {\n id: string;\n rentalUnitId: string;\n applicantName: string;\n applicantEmail: string;\n applicantPhone: string | null;\n monthlyIncome: number | null;\n moveInDate: string | null;\n status: 'submitted' | 'screening' | 'approved' | 'rejected';\n reviewNotes: string | null;\n reviewedAt: string | null;\n createdAt: string;\n updatedAt: string;\n /**\n * Supporting documents the applicant attached (ID, payslips, references…).\n * Metadata is read per file with `useUploadedFile` — the federated\n * `documentFiles` field cannot hydrate `File` fields yet.\n */\n documentFileIds: string[];\n rentalUnit: {\n id: string;\n unitNumber: string;\n propertyTitle: string;\n monthlyRent: number;\n } | null;\n}\n\nexport const useRentalApplications = (options?: ListOptions<RentalApplicationFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaRentalApplications: RentalApplicationRow[] }>(\n GET_RENTAL_APPLICATIONS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaRentalApplications ?? [], loading, error, refetch };\n};\n\n// ── Leases (TXN-02 / BOFF-9330) ──────────────────────────────────────────\n\nconst LEASE_FIELDS = gql`\n fragment LeaseFields on HousingVistaLease {\n id\n rentalUnitId\n rentalApplicationId\n tenantName\n tenantEmail\n tenantPhone\n monthlyRent\n securityDeposit\n leaseStart\n leaseEnd\n type\n status\n createdAt\n updatedAt\n rentalUnit {\n id\n unitNumber\n propertyTitle\n }\n }\n`;\n\nconst GET_LEASES = gql`\n ${LEASE_FIELDS}\n query GetLeases($filter: HousingVistaLeaseFilterInput, $pagination: HousingVistaPaginationInput) {\n housingvistaLeases(filter: $filter, pagination: $pagination) {\n ...LeaseFields\n }\n }\n`;\n\nexport interface LeaseRow {\n id: string;\n rentalUnitId: string;\n rentalApplicationId: string | null;\n tenantName: string;\n tenantEmail: string;\n tenantPhone: string | null;\n monthlyRent: number;\n securityDeposit: number | null;\n leaseStart: string;\n leaseEnd: string;\n type: string;\n status: 'draft' | 'active' | 'renewed' | 'terminated';\n createdAt: string;\n updatedAt: string;\n rentalUnit: {\n id: string;\n unitNumber: string;\n propertyTitle: string;\n } | null;\n}\n\nexport const useLeases = (options?: ListOptions<LeaseFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaLeases: LeaseRow[] }>(GET_LEASES, {\n variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) },\n });\n return { data: data?.housingvistaLeases ?? [], loading, error, refetch };\n};\n\n/** Every lease in the workspace, paged to completion (see useAllPages). */\nexport const useAllLeases = () => useAllPages<LeaseRow>(GET_LEASES, 'housingvistaLeases');\n\nexport interface CreateLeaseInput {\n rentalUnitId: string;\n rentalApplicationId?: string;\n tenantName: string;\n tenantEmail: string;\n tenantPhone?: string;\n monthlyRent: number;\n securityDeposit?: number;\n leaseStart: string;\n leaseEnd: string;\n type?: string;\n status?: string;\n}\n\nexport const useCreateLease = () => {\n const [mutate, { loading }] = useMutation<{ createHousingvistaLease: LeaseRow }, { input: CreateLeaseInput }>(\n gql`\n ${LEASE_FIELDS}\n mutation CreateHousingvistaLease($input: HousingVistaCreateLeaseInput!) {\n createHousingvistaLease(input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits', 'GetRentalApplications'], awaitRefetchQueries: true }\n );\n const createLease = async (input: CreateLeaseInput) => {\n await mutate({ variables: { input } });\n };\n return { createLease, loading };\n};\n\nexport const useRenewLease = () => {\n const [mutate, { loading }] = useMutation<\n { renewHousingvistaLease: LeaseRow },\n { id: string; input: { leaseEnd: string } }\n >(\n gql`\n ${LEASE_FIELDS}\n mutation RenewHousingvistaLease($id: ID!, $input: HousingVistaRenewLeaseInput!) {\n renewHousingvistaLease(id: $id, input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits'], awaitRefetchQueries: true }\n );\n const renewLease = async (id: string, leaseEnd: string) => {\n await mutate({ variables: { id, input: { leaseEnd } } });\n };\n return { renewLease, loading };\n};\n\nexport const useTerminateLease = () => {\n const [mutate, { loading }] = useMutation<\n { terminateHousingvistaLease: LeaseRow },\n { id: string; input: { notes?: string } }\n >(\n gql`\n ${LEASE_FIELDS}\n mutation TerminateHousingvistaLease($id: ID!, $input: HousingVistaTerminateLeaseInput!) {\n terminateHousingvistaLease(id: $id, input: $input) {\n ...LeaseFields\n }\n }\n `,\n { refetchQueries: ['GetLeases', 'GetRentalUnits'], awaitRefetchQueries: true }\n );\n const terminateLease = async (id: string, notes?: string) => {\n await mutate({ variables: { id, input: { notes } } });\n };\n return { terminateLease, loading };\n};\n\nexport interface MaintenanceRequestRow {\n id: string;\n propertyId: string | null;\n rentalUnitId: string | null;\n title: string;\n description: string | null;\n category: string;\n priority: 'low' | 'medium' | 'high';\n status: 'open' | 'in_progress' | 'resolved';\n resolutionNotes: string | null;\n resolvedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport const useMaintenanceRequests = (options?: ListOptions<MaintenanceRequestFilterInput>) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaMaintenanceRequests: MaintenanceRequestRow[] }>(\n GET_MAINTENANCE_REQUESTS,\n { variables: { filter: options?.filter, ...getPaginationVariables(options?.pagination) } }\n );\n return { data: data?.housingvistaMaintenanceRequests ?? [], loading, error, refetch };\n};\n\n// ---------------------------------------------------------------------------\n// Mutation hooks\n// ---------------------------------------------------------------------------\n\nexport interface CreatePropertyInput {\n title: string;\n description?: string;\n status: PropertyStatus;\n type: PropertyType;\n category: string;\n address?: string;\n city: string;\n state: string;\n country?: string;\n pincode?: string;\n neighborhood?: string;\n landmarks?: string[];\n price: number;\n currency?: string;\n priceType?: string;\n /** On update, pass null to clear a stored period; absent/undefined means \"no change\". */\n pricePeriod?: string | null;\n negotiable?: boolean;\n pricePerSqft?: number;\n bedrooms: number;\n bathrooms: number;\n totalArea: number;\n carpetArea?: number;\n builtUpArea?: number;\n floors?: number;\n totalFloors?: number;\n parking?: number;\n balconies?: number;\n furnishingStatus?: string;\n ageOfProperty?: number;\n facing?: string;\n amenities?: { name: string; category: string; available?: boolean }[];\n images?: { url: string; title?: string; type?: string; order?: number; isPrimary?: boolean }[];\n imageUrl?: string;\n /** Optional geo-pin captured in the listing wizard (BOFF-7795). */\n coordinates?: { latitude: number; longitude: number } | null;\n}\n\nexport type UpdatePropertyInput = Partial<CreatePropertyInput>;\n\nexport const useCreateProperty = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaProperty: PropertyRow },\n { input: CreatePropertyInput }\n >(CREATE_PROPERTY, { refetchQueries: ['GetProperties'], awaitRefetchQueries: true });\n const createProperty = async (input: CreatePropertyInput): Promise<Property> => {\n const res = await mutate({ variables: { input } });\n if (!res.data) throw new Error('Property was not created');\n return mapProperty(res.data.createHousingvistaProperty);\n };\n return { createProperty, loading };\n};\n\nexport const useUpdateProperty = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaProperty: PropertyRow },\n { id: string; input: UpdatePropertyInput }\n >(UPDATE_PROPERTY);\n const updateProperty = async (id: string, input: UpdatePropertyInput): Promise<Property> => {\n const res = await mutate({ variables: { id, input } });\n if (!res.data) throw new Error('Property was not updated');\n return mapProperty(res.data.updateHousingvistaProperty);\n };\n return { updateProperty, loading };\n};\n\nexport const useDeleteProperty = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaProperty: boolean }, { id: string }>(DELETE_PROPERTY, {\n refetchQueries: ['GetProperties'],\n awaitRefetchQueries: true,\n });\n const deleteProperty = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaProperty ?? false;\n };\n return { deleteProperty, loading };\n};\n\nexport const useSaveShortlist = () => {\n const [mutate, { loading }] = useMutation<\n { saveHousingvistaShortlist: ShortlistRow },\n { input: { propertyId: string; notes?: string } }\n >(SAVE_SHORTLIST, { refetchQueries: ['GetShortlists'], awaitRefetchQueries: true });\n const saveShortlist = async (propertyId: string, notes?: string) => {\n await mutate({ variables: { input: { propertyId, notes } } });\n };\n return { saveShortlist, loading };\n};\n\nexport const useRemoveShortlist = () => {\n const [mutate, { loading }] = useMutation<{ removeHousingvistaShortlist: boolean }, { propertyId: string }>(\n REMOVE_SHORTLIST,\n { refetchQueries: ['GetShortlists'], awaitRefetchQueries: true }\n );\n const removeShortlist = async (propertyId: string) => {\n await mutate({ variables: { propertyId } });\n };\n return { removeShortlist, loading };\n};\n\nexport interface BookViewingInput {\n propertyId: string;\n /** Free-datetime booking. Send either this or `slotId` (a slot's own start time is also accepted). */\n scheduledAt?: string;\n /** A published slot to book; the viewing takes the slot's start time. */\n slotId?: string;\n type?: 'in_person' | 'virtual';\n attendeeName?: string;\n attendeeEmail?: string;\n notes?: string;\n}\n\nexport const useBookViewing = () => {\n const [mutate, { loading }] = useMutation<{ bookHousingvistaViewing: { id: string } }, { input: BookViewingInput }>(\n BOOK_VIEWING,\n // A booked slot leaves the open list.\n { refetchQueries: ['GetViewingSlots'] }\n );\n const bookViewing = async (input: BookViewingInput) => {\n await mutate({ variables: { input } });\n };\n return { bookViewing, loading };\n};\n\nexport type ViewingSlotStatus = 'open' | 'booked' | 'cancelled';\n\n/** A dated window a host published for buyers to book a viewing in. */\nexport interface ViewingSlotRow {\n id: string;\n propertyId: string;\n startsAt: string;\n endsAt: string;\n status: ViewingSlotStatus;\n}\n\nexport interface ViewingSlotInput {\n startsAt: string;\n endsAt: string;\n}\n\n/**\n * Slots of a property, soonest first. Buyers get the open future ones; a host managing availability passes\n * `includeBooked` to see the taken ones too.\n */\nexport const useViewingSlots = (\n propertyId: string | undefined,\n options?: { includeBooked?: boolean; skip?: boolean }\n) => {\n const { data, loading, error, refetch } = useQuery<{ housingvistaViewingSlots: ViewingSlotRow[] }>(\n GET_VIEWING_SLOTS,\n {\n variables: {\n propertyId: propertyId ?? '',\n includeBooked: options?.includeBooked ?? false,\n ...getPaginationVariables({ limit: 100, offset: 0 }),\n },\n skip: !propertyId || options?.skip,\n }\n );\n return { data: data?.housingvistaViewingSlots ?? [], loading, error, refetch };\n};\n\nexport const usePublishViewingSlots = () => {\n const [mutate, { loading }] = useMutation<\n { publishHousingvistaViewingSlots: ViewingSlotRow[] },\n { input: { propertyId: string; slots: ViewingSlotInput[] } }\n >(PUBLISH_VIEWING_SLOTS, { refetchQueries: ['GetViewingSlots'], awaitRefetchQueries: true });\n const publishViewingSlots = async (propertyId: string, slots: ViewingSlotInput[]) => {\n const result = await mutate({ variables: { input: { propertyId, slots } } });\n return result.data?.publishHousingvistaViewingSlots ?? [];\n };\n return { publishViewingSlots, loading };\n};\n\nexport const useCancelViewingSlot = () => {\n const [mutate, { loading }] = useMutation<{ cancelHousingvistaViewingSlot: { id: string } }, { id: string }>(\n CANCEL_VIEWING_SLOT,\n { refetchQueries: ['GetViewingSlots'], awaitRefetchQueries: true }\n );\n const cancelViewingSlot = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { cancelViewingSlot, loading };\n};\n\nexport const useCancelViewing = () => {\n const [mutate, { loading }] = useMutation<{ cancelHousingvistaViewing: { id: string } }, { id: string }>(\n CANCEL_VIEWING,\n // Cancelling a viewing frees the slot it held.\n { refetchQueries: ['GetViewingSlots'] }\n );\n const cancelViewing = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { cancelViewing, loading };\n};\n\nexport interface SubmitOfferInput {\n propertyId: string;\n amount: number;\n currency?: string;\n notes?: string;\n /** ISO deadline; omit for an offer that never expires. */\n expiresAt?: string;\n}\n\nexport const useSubmitOffer = () => {\n const [mutate, { loading }] = useMutation<{ submitHousingvistaOffer: { id: string } }, { input: SubmitOfferInput }>(\n SUBMIT_OFFER\n );\n const submitOffer = async (input: SubmitOfferInput) => {\n await mutate({ variables: { input } });\n };\n return { submitOffer, loading };\n};\n\nexport const useRespondOffer = () => {\n const [mutate, { loading }] = useMutation<\n { respondHousingvistaOffer: { id: string } },\n { id: string; input: { action: 'accept' | 'reject' | 'counter'; counterAmount?: number; notes?: string } }\n >(RESPOND_OFFER);\n const respondOffer = async (\n id: string,\n input: { action: 'accept' | 'reject' | 'counter'; counterAmount?: number; notes?: string }\n ) => {\n await mutate({ variables: { id, input } });\n };\n return { respondOffer, loading };\n};\n\nexport interface CreateTransactionInput {\n propertyId: string;\n title: string;\n type: string;\n status: string;\n amount: number;\n currency?: string;\n /** Accepted offer being converted into this deal (TXN-01 / BOFF-9171). */\n offerId?: string;\n}\n\nexport const useCreateTransaction = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaTransaction: TransactionRow },\n { input: CreateTransactionInput }\n >(CREATE_TRANSACTION, { refetchQueries: ['GetTransactions'], awaitRefetchQueries: true });\n const createTransaction = async (input: CreateTransactionInput) => {\n await mutate({ variables: { input } });\n };\n return { createTransaction, loading };\n};\n\nexport interface CreateInvestmentInput {\n propertyId: string;\n title: string;\n status: string;\n investmentType: string;\n riskLevel: string;\n totalValue: number;\n startDate?: string;\n maturityDate?: string;\n}\n\nexport const useCreateInvestment = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaInvestment: InvestmentRow },\n { input: CreateInvestmentInput }\n >(CREATE_INVESTMENT, { refetchQueries: ['GetInvestments'], awaitRefetchQueries: true });\n const createInvestment = async (input: CreateInvestmentInput) => {\n const { error } = await mutate({ variables: { input } });\n // The shell client runs mutations with errorPolicy 'all', so a refusal (a plan-limit 429 included) resolves with\n // `error` instead of rejecting. Rethrow it, or the caller reports success and never sees the failure.\n if (error) throw error;\n };\n return { createInvestment, loading };\n};\n\nexport interface CreateRentalUnitInput {\n propertyId?: string;\n propertyTitle: string;\n unitNumber: string;\n tenantName: string;\n tenantEmail: string;\n tenantPhone?: string;\n monthlyRent: number;\n leaseStart: string;\n leaseEnd: string;\n status: string;\n paymentStatus: string;\n securityDeposit?: number;\n}\n\nexport const useCreateRentalUnit = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaRentalUnit: { id: string } },\n { input: CreateRentalUnitInput }\n >(CREATE_RENTAL_UNIT, { refetchQueries: ['GetRentalUnits'], awaitRefetchQueries: true });\n const createRentalUnit = async (input: CreateRentalUnitInput) => {\n await mutate({ variables: { input } });\n };\n return { createRentalUnit, loading };\n};\n\nexport interface SubmitRentalApplicationInput {\n rentalUnitId: string;\n applicantName: string;\n applicantEmail: string;\n applicantPhone?: string;\n monthlyIncome?: number;\n moveInDate?: string;\n /** Ids of files already uploaded through wspace-files-svc (max 10). */\n documentFileIds?: string[];\n}\n\nexport const useSubmitRentalApplication = () => {\n const [mutate, { loading }] = useMutation<\n { submitHousingvistaRentalApplication: { id: string } },\n { input: SubmitRentalApplicationInput }\n >(SUBMIT_RENTAL_APPLICATION);\n const submitRentalApplication = async (input: SubmitRentalApplicationInput) => {\n await mutate({ variables: { input } });\n };\n return { submitRentalApplication, loading };\n};\n\nexport interface CreateAmcContractInput {\n propertyId?: string;\n marketplaceServiceId?: string;\n propertyTitle: string;\n packageName: string;\n providerName: string;\n monthlyCost: number;\n startDate: string;\n endDate: string;\n nextServiceDate?: string;\n status: string;\n servicesIncluded?: string[];\n}\n\nexport const useCreateAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaAmcContract: { id: string } },\n { input: CreateAmcContractInput }\n >(CREATE_AMC_CONTRACT, { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true });\n const createAmcContract = async (input: CreateAmcContractInput) => {\n await mutate({ variables: { input } });\n };\n return { createAmcContract, loading };\n};\n\nexport interface CreateMaintenanceRequestInput {\n propertyId?: string;\n rentalUnitId?: string;\n title: string;\n description?: string;\n category: string;\n priority?: 'low' | 'medium' | 'high';\n}\n\nexport const useCreateMaintenanceRequest = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaMaintenanceRequest: { id: string } },\n { input: CreateMaintenanceRequestInput }\n >(CREATE_MAINTENANCE_REQUEST);\n const createMaintenanceRequest = async (input: CreateMaintenanceRequestInput) => {\n await mutate({ variables: { input } });\n };\n return { createMaintenanceRequest, loading };\n};\n\nexport const useCreateVerification = () => {\n const [mutate, { loading }] = useMutation<\n { createHousingvistaVerificationItem: { id: string } },\n { input: CreateVerificationItemInput }\n >(CREATE_VERIFICATION_ITEM, {\n // GetProperty refetch: a new check changes the detail page's Documents\n // evidence (active-query case); cache-and-network on useProperty covers\n // the return-to-listing case (Codex P2, mfe#19). Deliberately NO\n // GetProperties refetch and NO cache.modify here: creating an item does\n // NOT change Property.verificationStatus server-side (the svc write-back\n // is decide-path only, BOFF-8673), so a cached list badge stays truthful\n // — refetching the list would be pure waste.\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n });\n const createVerification = async (input: CreateVerificationItemInput) => {\n await mutate({ variables: { input } });\n };\n return { createVerification, loading };\n};\n\nexport const useApproveVerification = () => {\n const [mutate, { loading }] = useMutation<\n {\n approveHousingvistaVerificationItem: {\n id: string;\n status: string;\n entityType: string | null;\n entityId: string | null;\n };\n },\n { id: string; notes?: string }\n >(APPROVE_VERIFICATION, {\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n // Sync the normalized listing record so a badge shown by a cached,\n // unmounted list query updates immediately (reviewer P2, mfe#19) —\n // refetchQueries only reaches ACTIVE queries.\n update: (cache, result) => {\n const item = result.data?.approveHousingvistaVerificationItem;\n if (item?.entityType !== 'property' || !item.entityId) return;\n const pid = cache.identify({\n __typename: 'HousingVistaProperty',\n id: item.entityId,\n });\n if (!pid) return;\n cache.modify({\n id: pid,\n fields: {\n // Fail-safe direction: ONLY an explicit rejection writes\n // 'rejected'. The mutation currently returns the raw svc value\n // 'approved' (live-verified on alpha), but the MFE convention is\n // 'verified' — if the API ever normalizes to that, an\n // === 'approved' ternary would write 'rejected' for approvals\n // (Codex P2, mfe#19).\n verificationStatus: () => (item.status === 'rejected' ? 'rejected' : 'verified'),\n },\n });\n },\n });\n const approveVerification = async (id: string, notes?: string) => {\n await mutate({ variables: { id, notes } });\n };\n return { approveVerification, loading };\n};\n\nexport const useRejectVerification = () => {\n const [mutate, { loading }] = useMutation<\n {\n rejectHousingvistaVerificationItem: {\n id: string;\n status: string;\n entityType: string | null;\n entityId: string | null;\n };\n },\n { id: string; notes?: string }\n >(REJECT_VERIFICATION, {\n refetchQueries: ['GetVerifications', 'GetProperty'],\n awaitRefetchQueries: true,\n update: (cache, result) => {\n const item = result.data?.rejectHousingvistaVerificationItem;\n if (item?.entityType !== 'property' || !item.entityId) return;\n const pid = cache.identify({\n __typename: 'HousingVistaProperty',\n id: item.entityId,\n });\n if (!pid) return;\n cache.modify({\n id: pid,\n fields: {\n // Same fail-safe direction as approve: only an explicit\n // 'rejected' writes 'rejected'.\n verificationStatus: () => (item.status === 'rejected' ? 'rejected' : 'verified'),\n },\n });\n },\n });\n const rejectVerification = async (id: string, notes?: string) => {\n await mutate({ variables: { id, notes } });\n };\n return { rejectVerification, loading };\n};\n\n/** RERA review workflow transition (BOFF-4132) — separate from the generic\n * verification review above since RERA is its own regulatory workflow. */\nexport const useUpdatePropertyReraStatus = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaPropertyReraStatus: { id: string; reraVerificationStatus: ReraVerificationStatus } },\n { id: string; status: ReraVerificationStatus; notes?: string }\n >(UPDATE_PROPERTY_RERA_STATUS, { refetchQueries: ['GetProperties', 'GetProperty'], awaitRefetchQueries: true });\n const updatePropertyReraStatus = async (id: string, status: ReraVerificationStatus, notes?: string) => {\n await mutate({ variables: { id, status, notes } });\n };\n return { updatePropertyReraStatus, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Offer / Viewing owner-side + lifecycle mutation hooks\n// ---------------------------------------------------------------------------\n\nexport const useWithdrawOffer = () => {\n const [mutate, { loading }] = useMutation<{ withdrawHousingvistaOffer: { id: string } }, { id: string }>(\n WITHDRAW_OFFER,\n { refetchQueries: ['GetOffers', 'GetOffer'], awaitRefetchQueries: true }\n );\n const withdrawOffer = async (id: string) => {\n await mutate({ variables: { id } });\n };\n return { withdrawOffer, loading };\n};\n\nexport interface UpdateViewingInput {\n scheduledAt?: string;\n status?: 'requested' | 'confirmed' | 'completed' | 'cancelled';\n type?: 'in_person' | 'virtual';\n attendeeName?: string;\n attendeeEmail?: string;\n notes?: string;\n}\n\nexport const useUpdateViewing = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaViewing: { id: string } },\n { id: string; input: UpdateViewingInput }\n >(UPDATE_VIEWING, {\n refetchQueries: ['GetViewings', 'GetViewing', 'GetViewingSlots'],\n awaitRefetchQueries: true,\n });\n const updateViewing = async (id: string, input: UpdateViewingInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateViewing, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Investment update / delete\n// ---------------------------------------------------------------------------\n\nexport interface UpdateInvestmentInput {\n title?: string;\n investmentType?: string;\n status?: string;\n riskLevel?: string;\n totalValue?: number;\n startDate?: string;\n maturityDate?: string;\n /** Replaces the attached File ids (at most ten); `[]` clears them, omitting it leaves them untouched. */\n documentFileIds?: string[];\n}\n\nexport const useUpdateInvestment = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaInvestment: InvestmentRow },\n { id: string; input: UpdateInvestmentInput }\n >(UPDATE_INVESTMENT, { refetchQueries: ['GetInvestments', 'GetInvestment'], awaitRefetchQueries: true });\n const updateInvestment = async (id: string, input: UpdateInvestmentInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateInvestment, loading };\n};\n\nexport const useDeleteInvestment = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaInvestment: boolean }, { id: string }>(\n DELETE_INVESTMENT,\n { refetchQueries: ['GetInvestments'], awaitRefetchQueries: true }\n );\n const deleteInvestment = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaInvestment ?? false;\n };\n return { deleteInvestment, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Asset create / update / delete\n// ---------------------------------------------------------------------------\n\nexport interface CreateAssetInput {\n title: string;\n type: string;\n category: string;\n location: string;\n currentValue: number;\n purchasePrice: number;\n purchaseDate?: string;\n appreciationPercent?: number;\n rentalYield?: number;\n status: string;\n imageUrl?: string;\n lastValuationDate?: string;\n}\n\nexport const useCreateAsset = () => {\n const [mutate, { loading }] = useMutation<{ createHousingvistaAsset: Asset }, { input: CreateAssetInput }>(\n CREATE_ASSET,\n { refetchQueries: ['GetAssets'], awaitRefetchQueries: true }\n );\n const createAsset = async (input: CreateAssetInput) => {\n await mutate({ variables: { input } });\n };\n return { createAsset, loading };\n};\n\nexport type UpdateAssetInput = Partial<CreateAssetInput>;\n\nexport const useUpdateAsset = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaAsset: Asset },\n { id: string; input: UpdateAssetInput }\n >(UPDATE_ASSET, { refetchQueries: ['GetAssets', 'GetAsset'], awaitRefetchQueries: true });\n const updateAsset = async (id: string, input: UpdateAssetInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateAsset, loading };\n};\n\nexport const useDeleteAsset = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaAsset: boolean }, { id: string }>(DELETE_ASSET, {\n refetchQueries: ['GetAssets'],\n awaitRefetchQueries: true,\n });\n const deleteAsset = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaAsset ?? false;\n };\n return { deleteAsset, loading };\n};\n\n// ---------------------------------------------------------------------------\n// AMC update / delete\n// ---------------------------------------------------------------------------\n\n// nextServiceDate: null clears the stored date (the svc treats null as \"no upcoming service\").\nexport type UpdateAmcContractInput = Partial<\n Omit<CreateAmcContractInput, 'nextServiceDate' | 'propertyId' | 'marketplaceServiceId'>\n> & {\n nextServiceDate?: string | null;\n // null unlinks (back to a free-text property / provider).\n propertyId?: string | null;\n marketplaceServiceId?: string | null;\n};\n\nexport const useUpdateAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaAmcContract: { id: string } },\n { id: string; input: UpdateAmcContractInput }\n >(UPDATE_AMC_CONTRACT, { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true });\n const updateAmcContract = async (id: string, input: UpdateAmcContractInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateAmcContract, loading };\n};\n\nexport const useRenewAmcContract = () => {\n const [mutate, { loading }] = useMutation<\n { renewHousingvistaAmcContract: { id: string; status: string; endDate: string } },\n { id: string; input: { endDate: string } }\n >(\n gql`\n mutation RenewHousingvistaAmcContract($id: ID!, $input: HousingVistaRenewAmcContractInput!) {\n renewHousingvistaAmcContract(id: $id, input: $input) {\n id\n status\n endDate\n }\n }\n `,\n { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true }\n );\n const renewAmcContract = async (id: string, endDate: string) => {\n await mutate({ variables: { id, input: { endDate } } });\n };\n return { renewAmcContract, loading };\n};\n\nexport const useDeleteAmcContract = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaAmcContract: boolean }, { id: string }>(\n DELETE_AMC_CONTRACT,\n { refetchQueries: ['GetAmcContracts'], awaitRefetchQueries: true }\n );\n const deleteAmcContract = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaAmcContract ?? false;\n };\n return { deleteAmcContract, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Transaction update / delete\n// ---------------------------------------------------------------------------\n\nexport interface UpdateTransactionInput {\n title?: string;\n type?: string;\n status?: string;\n amount?: number;\n currency?: string;\n documents?: unknown;\n}\n\nexport const useUpdateTransaction = () => {\n const [mutate, { loading }] = useMutation<\n { updateHousingvistaTransaction: TransactionRow },\n { id: string; input: UpdateTransactionInput }\n >(UPDATE_TRANSACTION, { refetchQueries: ['GetTransactions', 'GetTransaction'], awaitRefetchQueries: true });\n const updateTransaction = async (id: string, input: UpdateTransactionInput) => {\n await mutate({ variables: { id, input } });\n };\n return { updateTransaction, loading };\n};\n\nexport const useDeleteTransaction = () => {\n const [mutate, { loading }] = useMutation<{ deleteHousingvistaTransaction: boolean }, { id: string }>(\n DELETE_TRANSACTION,\n { refetchQueries: ['GetTransactions'], awaitRefetchQueries: true }\n );\n const deleteTransaction = async (id: string): Promise<boolean> => {\n const res = await mutate({ variables: { id } });\n return res.data?.deleteHousingvistaTransaction ?? false;\n };\n return { deleteTransaction, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Maintenance resolve + Rental-application review\n// ---------------------------------------------------------------------------\n\nexport const useResolveMaintenanceRequest = () => {\n const [mutate, { loading }] = useMutation<\n { resolveHousingvistaMaintenanceRequest: MaintenanceRequestRow },\n { id: string; resolutionNotes?: string }\n >(RESOLVE_MAINTENANCE, { refetchQueries: ['GetMaintenanceRequests'], awaitRefetchQueries: true });\n const resolveMaintenanceRequest = async (id: string, resolutionNotes?: string) => {\n await mutate({ variables: { id, resolutionNotes } });\n };\n return { resolveMaintenanceRequest, loading };\n};\n\nexport interface ReviewRentalApplicationInput {\n decision: 'approved' | 'rejected' | 'screening' | 'submitted';\n reviewNotes?: string;\n}\n\nexport const useReviewRentalApplication = () => {\n const [mutate, { loading }] = useMutation<\n { reviewHousingvistaRentalApplication: RentalApplicationRow },\n { id: string; input: ReviewRentalApplicationInput }\n >(REVIEW_RENTAL_APPLICATION, { refetchQueries: ['GetRentalApplications'], awaitRefetchQueries: true });\n const reviewRentalApplication = async (id: string, input: ReviewRentalApplicationInput) => {\n await mutate({ variables: { id, input } });\n };\n return { reviewRentalApplication, loading };\n};\n\n// ---------------------------------------------------------------------------\n// Platform-service reuse (conversations / files) — re-exported from ./platform\n// ---------------------------------------------------------------------------\n\nexport {\n useContactConversation,\n useSendMessage,\n useSendContextMessage,\n useConversationMessages,\n useEntityComments,\n useCreateEntityComment,\n useFileUpload,\n useDeleteUploadedFile,\n useUploadedFile,\n} from './platform';\nexport type {\n HvContextTarget,\n HvConversationMessage,\n HvConversationSourceContext,\n HvEntityComment,\n HvMessageAttachment,\n HvUploadedFile,\n} from './platform';\n\n// Analytics\nexport { useHousingVistaAnalytics } from './useHousingVistaAnalytics';\n"],"mappings":";;;;;;;AAkLA,IAAMA,IAAqD;CAAE,OAAO;CAAI,QAAQ;AAAE,GAE5EC,KAA0B,IAA8BD,OAA6B,EACzF,YAAY;CACV,OAAOE,EAAW,SAASF,EAAwB;CACnD,QAAQE,EAAW,UAAUF,EAAwB;AACvD,EACF,IAMMG,KAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCzBC,IAAkB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyErBC,KAA+B,CAAG;;;;;;;;;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AAE,gBAAgB,CAAC,wBAAwB;EAAG,qBAAqB;CAAK,CAAC;CAIhG,OAAO;EAAE,kCAHgC,GAAY,MAA6B;GAChF,MAAM0F,EAAO,EAAE,WAAW;IAAE;IAAI;GAAgB,EAAE,CAAC;EACrD;EACoC;CAAQ;AAC9C,GAOasF,WAAmC;CAC9C,IAAM,CAACtF,GAAQ,EAAE,gBAAaC,EAG5B1F,IAA2B;EAAE,gBAAgB,CAAC,uBAAuB;EAAG,qBAAqB;CAAK,CAAC;CAIrG,OAAO;EAAE,gCAH8B,GAAY,MAAwC;GACzF,MAAMyF,EAAO,EAAE,WAAW;IAAE;IAAI;GAAM,EAAE,CAAC;EAC3C;EACkC;CAAQ;AAC5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-housingvista",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1110.2",
|
|
4
4
|
"description": "Burdenoff HousingVista Microfrontend - Comprehensive real estate platform for property management, investment, and transactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import e from "react";
|
|
3
|
-
import "react-dom";
|
|
4
|
-
// node_modules/sonner/dist/index.mjs
|
|
5
|
-
function t(e) {
|
|
6
|
-
if (!e || typeof document > "u") return;
|
|
7
|
-
let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
|
|
8
|
-
n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
|
|
9
|
-
}
|
|
10
|
-
Array(12).fill(0);
|
|
11
|
-
var n = 1, r = 100, i = (e) => typeof e?.id == "number" || e?.id?.length > 0 ? e.id : n++, a = new class {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.subscribe = (e) => (this.subscribers.push(e), this.getActiveToasts().forEach((t) => e(t)), () => {
|
|
14
|
-
let t = this.subscribers.indexOf(e);
|
|
15
|
-
this.subscribers.splice(t, 1);
|
|
16
|
-
}), this.publish = (e) => {
|
|
17
|
-
this.subscribers.forEach((t) => t(e));
|
|
18
|
-
}, this.addToast = (e) => {
|
|
19
|
-
this.publish(e), this.toasts = [...this.toasts, e], this.trimHistory();
|
|
20
|
-
}, this.trimHistory = () => {
|
|
21
|
-
let e = this.toasts.length - r;
|
|
22
|
-
e <= 0 || (this.toasts = this.toasts.filter((t) => e > 0 && this.dismissedToasts.has(t.id) ? (this.dismissedToasts.delete(t.id), e--, !1) : !0));
|
|
23
|
-
}, this.create = (e) => {
|
|
24
|
-
let { message: t, ...n } = e, r = i(e), a = this.pendingDismissals.get(r);
|
|
25
|
-
a !== void 0 && (cancelAnimationFrame(a), this.pendingDismissals.delete(r), this.dismissedToasts.delete(r));
|
|
26
|
-
let o = this.dismissedToasts.has(r), s = e.dismissible === void 0 || e.dismissible;
|
|
27
|
-
return o && (this.dismissedToasts.delete(r), this.toasts = this.toasts.filter((e) => e.id !== r)), !o && this.toasts.find((e) => e.id === r) ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
|
|
28
|
-
...n,
|
|
29
|
-
...e,
|
|
30
|
-
id: r,
|
|
31
|
-
title: t
|
|
32
|
-
}), {
|
|
33
|
-
...n,
|
|
34
|
-
...e,
|
|
35
|
-
id: r,
|
|
36
|
-
dismissible: s,
|
|
37
|
-
title: t
|
|
38
|
-
}) : n) : this.addToast({
|
|
39
|
-
title: t,
|
|
40
|
-
...n,
|
|
41
|
-
dismissible: s,
|
|
42
|
-
id: r
|
|
43
|
-
}), r;
|
|
44
|
-
}, this.dismiss = (e) => {
|
|
45
|
-
if (e == null) return this.getActiveToasts().forEach((e) => {
|
|
46
|
-
this.dismissedToasts.add(e.id), this.subscribers.forEach((t) => t({
|
|
47
|
-
id: e.id,
|
|
48
|
-
dismiss: !0
|
|
49
|
-
}));
|
|
50
|
-
}), e;
|
|
51
|
-
this.dismissedToasts.add(e);
|
|
52
|
-
let t = this.pendingDismissals.get(e);
|
|
53
|
-
return t !== void 0 && cancelAnimationFrame(t), this.pendingDismissals.set(e, requestAnimationFrame(() => {
|
|
54
|
-
this.pendingDismissals.delete(e), this.subscribers.forEach((t) => t({
|
|
55
|
-
id: e,
|
|
56
|
-
dismiss: !0
|
|
57
|
-
}));
|
|
58
|
-
})), e;
|
|
59
|
-
}, this.message = (e, t) => this.create({
|
|
60
|
-
...t,
|
|
61
|
-
message: e,
|
|
62
|
-
type: void 0
|
|
63
|
-
}), this.error = (e, t) => this.create({
|
|
64
|
-
...t,
|
|
65
|
-
message: e,
|
|
66
|
-
type: "error"
|
|
67
|
-
}), this.success = (e, t) => this.create({
|
|
68
|
-
...t,
|
|
69
|
-
type: "success",
|
|
70
|
-
message: e
|
|
71
|
-
}), this.info = (e, t) => this.create({
|
|
72
|
-
...t,
|
|
73
|
-
type: "info",
|
|
74
|
-
message: e
|
|
75
|
-
}), this.warning = (e, t) => this.create({
|
|
76
|
-
...t,
|
|
77
|
-
type: "warning",
|
|
78
|
-
message: e
|
|
79
|
-
}), this.loading = (e, t) => this.create({
|
|
80
|
-
...t,
|
|
81
|
-
type: "loading",
|
|
82
|
-
message: e
|
|
83
|
-
}), this.promise = (t, n) => {
|
|
84
|
-
if (!n) return;
|
|
85
|
-
let r;
|
|
86
|
-
n.loading !== void 0 && (r = this.create({
|
|
87
|
-
...n,
|
|
88
|
-
promise: t,
|
|
89
|
-
type: "loading",
|
|
90
|
-
message: n.loading,
|
|
91
|
-
description: typeof n.description == "function" ? void 0 : n.description
|
|
92
|
-
}));
|
|
93
|
-
let i = Promise.resolve(t instanceof Function ? t() : t), a = r !== void 0, o, c = i.then(async (t) => {
|
|
94
|
-
if (o = ["resolve", t], e.isValidElement(t)) a = !1, this.create({
|
|
95
|
-
id: r,
|
|
96
|
-
type: "default",
|
|
97
|
-
message: t
|
|
98
|
-
});
|
|
99
|
-
else if (s(t) && !t.ok) {
|
|
100
|
-
a = !1;
|
|
101
|
-
let i = typeof n.error == "function" ? await n.error(`HTTP error! status: ${t.status}`) : n.error, o = typeof n.description == "function" ? await n.description(`HTTP error! status: ${t.status}`) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
|
|
102
|
-
this.create({
|
|
103
|
-
id: r,
|
|
104
|
-
type: "error",
|
|
105
|
-
description: o,
|
|
106
|
-
...s
|
|
107
|
-
});
|
|
108
|
-
} else if (t instanceof Error) {
|
|
109
|
-
a = !1;
|
|
110
|
-
let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
|
|
111
|
-
this.create({
|
|
112
|
-
id: r,
|
|
113
|
-
type: "error",
|
|
114
|
-
description: o,
|
|
115
|
-
...s
|
|
116
|
-
});
|
|
117
|
-
} else if (n.success !== void 0) {
|
|
118
|
-
a = !1;
|
|
119
|
-
let i = typeof n.success == "function" ? await n.success(t) : n.success, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
|
|
120
|
-
this.create({
|
|
121
|
-
id: r,
|
|
122
|
-
type: "success",
|
|
123
|
-
description: o,
|
|
124
|
-
...s
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}).catch(async (t) => {
|
|
128
|
-
if (o = ["reject", t], n.error !== void 0) {
|
|
129
|
-
a = !1;
|
|
130
|
-
let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
|
|
131
|
-
this.create({
|
|
132
|
-
id: r,
|
|
133
|
-
type: "error",
|
|
134
|
-
description: o,
|
|
135
|
-
...s
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}).finally(() => {
|
|
139
|
-
a && (this.dismiss(r), r = void 0), n.finally == null || n.finally.call(n);
|
|
140
|
-
}), l = () => new Promise((e, t) => c.then(() => o[0] === "reject" ? t(o[1]) : e(o[1])).catch(t));
|
|
141
|
-
return typeof r != "string" && typeof r != "number" ? { unwrap: l } : Object.assign(r, { unwrap: l });
|
|
142
|
-
}, this.custom = (e, t) => {
|
|
143
|
-
let n = i(t);
|
|
144
|
-
return this.create({
|
|
145
|
-
...t,
|
|
146
|
-
jsx: e(n),
|
|
147
|
-
id: n,
|
|
148
|
-
type: void 0
|
|
149
|
-
}), n;
|
|
150
|
-
}, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set(), this.pendingDismissals = /* @__PURE__ */ new Map();
|
|
151
|
-
}
|
|
152
|
-
}(), o = (e, t) => a.message(e, t), s = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", c = Object.assign(o, {
|
|
153
|
-
success: a.success,
|
|
154
|
-
info: a.info,
|
|
155
|
-
warning: a.warning,
|
|
156
|
-
error: a.error,
|
|
157
|
-
custom: a.custom,
|
|
158
|
-
message: a.message,
|
|
159
|
-
promise: a.promise,
|
|
160
|
-
dismiss: a.dismiss,
|
|
161
|
-
loading: a.loading
|
|
162
|
-
}, {
|
|
163
|
-
getHistory: () => a.toasts,
|
|
164
|
-
getToasts: () => a.getActiveToasts()
|
|
165
|
-
});
|
|
166
|
-
t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
167
|
-
export { c as toast };
|
|
168
|
-
|
|
169
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","__insertCSS","code","head","style","toastsCounter","MAX_HISTORY_SIZE","getToastId","data","ToastState","subscriber","toast","index","toRemove","rest","id","pendingDismissal","wasDismissed","dismissible","message","alreadyPending","p","promise","shouldDismiss","result","originalPromise","response","isHttpResponse","promiseData","description","toastSettings","error","unwrap","reject","resolve","jsx","toastFunction","basicToast"],"sources":["../../../../node_modules/sonner/dist/index.mjs"],"sourcesContent":["'use client';\nfunction __insertCSS(code) {\n if (!code || typeof document == 'undefined') return\n let head = document.head || document.getElementsByTagName('head')[0]\n let style = document.createElement('style')\n style.type = 'text/css'\n head.appendChild(style)\n ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))\n}\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nconst getAsset = (type)=>{\n switch(type){\n case 'success':\n return SuccessIcon;\n case 'info':\n return InfoIcon;\n case 'warning':\n return WarningIcon;\n case 'error':\n return ErrorIcon;\n default:\n return null;\n }\n};\nconst bars = Array(12).fill(0);\nconst Loader = ({ visible, className })=>{\n return /*#__PURE__*/ React.createElement(\"div\", {\n className: [\n 'sonner-loading-wrapper',\n className\n ].filter(Boolean).join(' '),\n \"data-visible\": visible\n }, /*#__PURE__*/ React.createElement(\"div\", {\n className: \"sonner-spinner\"\n }, bars.map((_, i)=>/*#__PURE__*/ React.createElement(\"div\", {\n className: \"sonner-loading-bar\",\n key: `spinner-bar-${i}`\n }))));\n};\nconst SuccessIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\",\n \"aria-hidden\": \"true\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\",\n clipRule: \"evenodd\"\n}));\nconst WarningIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\",\n \"aria-hidden\": \"true\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z\",\n clipRule: \"evenodd\"\n}));\nconst InfoIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\",\n \"aria-hidden\": \"true\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z\",\n clipRule: \"evenodd\"\n}));\nconst ErrorIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\",\n \"aria-hidden\": \"true\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\",\n clipRule: \"evenodd\"\n}));\nconst CloseIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"12\",\n height: \"12\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"1.5\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": \"true\"\n}, /*#__PURE__*/ React.createElement(\"line\", {\n x1: \"18\",\n y1: \"6\",\n x2: \"6\",\n y2: \"18\"\n}), /*#__PURE__*/ React.createElement(\"line\", {\n x1: \"6\",\n y1: \"6\",\n x2: \"18\",\n y2: \"18\"\n}));\n\nconst useIsDocumentHidden = ()=>{\n const [isDocumentHidden, setIsDocumentHidden] = React.useState(document.hidden);\n React.useEffect(()=>{\n const callback = ()=>{\n setIsDocumentHidden(document.hidden);\n };\n document.addEventListener('visibilitychange', callback);\n return ()=>document.removeEventListener('visibilitychange', callback);\n }, []);\n return isDocumentHidden;\n};\n\nlet toastsCounter = 1;\n// Amount of toasts kept in `toast.getHistory()`. Dismissed toasts above this limit are\n// dropped so long-running apps don't hold on to them (and their JSX) forever.\nconst MAX_HISTORY_SIZE = 100;\n// A toast keeps the id it was given, otherwise it gets the next one from the counter.\n// `custom` needs the same id `create` would pick, as it hands it to the JSX callback.\nconst getToastId = (data)=>{\n var _data_id;\n return typeof (data == null ? void 0 : data.id) === 'number' || (data == null ? void 0 : (_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;\n};\nclass Observer {\n constructor(){\n // We use arrow functions to maintain the correct `this` reference\n this.subscribe = (subscriber)=>{\n this.subscribers.push(subscriber);\n // A toast can be created before the `Toaster` had a chance to subscribe, e.g. when it's\n // called in an effect of a component rendered above the `Toaster`. Replay whatever is\n // still active so it doesn't get lost.\n this.getActiveToasts().forEach((toast)=>subscriber(toast));\n return ()=>{\n const index = this.subscribers.indexOf(subscriber);\n this.subscribers.splice(index, 1);\n };\n };\n this.publish = (data)=>{\n this.subscribers.forEach((subscriber)=>subscriber(data));\n };\n this.addToast = (data)=>{\n this.publish(data);\n this.toasts = [\n ...this.toasts,\n data\n ];\n this.trimHistory();\n };\n // Keeps the history bounded without ever dropping a toast that's still on screen.\n this.trimHistory = ()=>{\n let toRemove = this.toasts.length - MAX_HISTORY_SIZE;\n if (toRemove <= 0) return;\n this.toasts = this.toasts.filter((toast)=>{\n if (toRemove > 0 && this.dismissedToasts.has(toast.id)) {\n this.dismissedToasts.delete(toast.id);\n toRemove--;\n return false;\n }\n return true;\n });\n };\n this.create = (data)=>{\n const { message, ...rest } = data;\n const id = getToastId(data);\n // A dismissal that hasn't reached the subscribers yet gets cancelled: the toast is still\n // on screen, so this is an update of it rather than a new toast. Without this, creating a\n // toast right after dismissing the same id (React's double effect in StrictMode does\n // exactly that) would have the pending dismissal remove the toast that just got created.\n const pendingDismissal = this.pendingDismissals.get(id);\n if (pendingDismissal !== undefined) {\n cancelAnimationFrame(pendingDismissal);\n this.pendingDismissals.delete(id);\n this.dismissedToasts.delete(id);\n }\n const wasDismissed = this.dismissedToasts.has(id);\n const dismissible = data.dismissible === undefined ? true : data.dismissible;\n if (wasDismissed) {\n this.dismissedToasts.delete(id);\n // The previous toast with this id is gone, so this is a brand new toast. Drop the old\n // one instead of merging into it, otherwise its props (e.g. `action`) leak into the new one.\n this.toasts = this.toasts.filter((toast)=>toast.id !== id);\n }\n const alreadyExists = wasDismissed ? undefined : this.toasts.find((toast)=>{\n return toast.id === id;\n });\n if (alreadyExists) {\n this.toasts = this.toasts.map((toast)=>{\n if (toast.id === id) {\n this.publish({\n ...toast,\n ...data,\n id,\n title: message\n });\n return {\n ...toast,\n ...data,\n id,\n dismissible,\n title: message\n };\n }\n return toast;\n });\n } else {\n this.addToast({\n title: message,\n ...rest,\n dismissible,\n id\n });\n }\n return id;\n };\n this.dismiss = (id)=>{\n if (id === undefined || id === null) {\n this.getActiveToasts().forEach((toast)=>{\n this.dismissedToasts.add(toast.id);\n this.subscribers.forEach((subscriber)=>subscriber({\n id: toast.id,\n dismiss: true\n }));\n });\n return id;\n }\n this.dismissedToasts.add(id);\n const alreadyPending = this.pendingDismissals.get(id);\n if (alreadyPending !== undefined) {\n cancelAnimationFrame(alreadyPending);\n }\n this.pendingDismissals.set(id, requestAnimationFrame(()=>{\n this.pendingDismissals.delete(id);\n this.subscribers.forEach((subscriber)=>subscriber({\n id,\n dismiss: true\n }));\n }));\n return id;\n };\n this.message = (message, data)=>{\n // `type: undefined` resets the type when this updates a toast that had one, e.g. turning\n // a loading toast into a plain one.\n return this.create({\n ...data,\n message,\n type: undefined\n });\n };\n this.error = (message, data)=>{\n return this.create({\n ...data,\n message,\n type: 'error'\n });\n };\n this.success = (message, data)=>{\n return this.create({\n ...data,\n type: 'success',\n message\n });\n };\n this.info = (message, data)=>{\n return this.create({\n ...data,\n type: 'info',\n message\n });\n };\n this.warning = (message, data)=>{\n return this.create({\n ...data,\n type: 'warning',\n message\n });\n };\n this.loading = (message, data)=>{\n return this.create({\n ...data,\n type: 'loading',\n message\n });\n };\n this.promise = (promise, data)=>{\n if (!data) {\n // Nothing to show\n return;\n }\n let id = undefined;\n if (data.loading !== undefined) {\n id = this.create({\n ...data,\n promise,\n type: 'loading',\n message: data.loading,\n description: typeof data.description !== 'function' ? data.description : undefined\n });\n }\n const p = Promise.resolve(promise instanceof Function ? promise() : promise);\n let shouldDismiss = id !== undefined;\n let result;\n const originalPromise = p.then(async (response)=>{\n result = [\n 'resolve',\n response\n ];\n const isReactElementResponse = React.isValidElement(response);\n if (isReactElementResponse) {\n shouldDismiss = false;\n this.create({\n id,\n type: 'default',\n message: response\n });\n } else if (isHttpResponse(response) && !response.ok) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;\n const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n } else if (response instanceof Error) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;\n const description = typeof data.description === 'function' ? await data.description(response) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n } else if (data.success !== undefined) {\n shouldDismiss = false;\n const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;\n const description = typeof data.description === 'function' ? await data.description(response) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'success',\n description,\n ...toastSettings\n });\n }\n }).catch(async (error)=>{\n result = [\n 'reject',\n error\n ];\n if (data.error !== undefined) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;\n const description = typeof data.description === 'function' ? await data.description(error) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n }\n }).finally(()=>{\n if (shouldDismiss) {\n // Toast is still in load state (and will be indefinitely — dismiss it)\n this.dismiss(id);\n id = undefined;\n }\n data.finally == null ? void 0 : data.finally.call(data);\n });\n const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));\n if (typeof id !== 'string' && typeof id !== 'number') {\n // cannot Object.assign on undefined\n return {\n unwrap\n };\n } else {\n return Object.assign(id, {\n unwrap\n });\n }\n };\n this.custom = (jsx, data)=>{\n const id = getToastId(data);\n // A custom toast has no type, so it resets the one of the toast it replaces\n this.create({\n ...data,\n jsx: jsx(id),\n id,\n type: undefined\n });\n return id;\n };\n this.getActiveToasts = ()=>{\n return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));\n };\n this.subscribers = [];\n this.toasts = [];\n this.dismissedToasts = new Set();\n this.pendingDismissals = new Map();\n }\n}\nconst ToastState = new Observer();\n// bind this to the toast function\nconst toastFunction = (message, data)=>{\n return ToastState.message(message, data);\n};\nconst isHttpResponse = (data)=>{\n return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';\n};\nconst basicToast = toastFunction;\nconst getHistory = ()=>ToastState.toasts;\nconst getToasts = ()=>ToastState.getActiveToasts();\n// We use `Object.assign` to maintain the correct types as we would lose them otherwise\nconst toast = Object.assign(basicToast, {\n success: ToastState.success,\n info: ToastState.info,\n warning: ToastState.warning,\n error: ToastState.error,\n custom: ToastState.custom,\n message: ToastState.message,\n promise: ToastState.promise,\n dismiss: ToastState.dismiss,\n loading: ToastState.loading\n}, {\n getHistory,\n getToasts\n});\n\n__insertCSS(\"[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}\");\n\nfunction isAction(action) {\n return action.label !== undefined;\n}\n\n// Visible toasts amount\nconst VISIBLE_TOASTS_AMOUNT = 3;\n// Viewport padding\nconst VIEWPORT_OFFSET = '24px';\n// Mobile viewport padding\nconst MOBILE_VIEWPORT_OFFSET = '16px';\n// Default lifetime of a toasts (in ms)\nconst TOAST_LIFETIME = 4000;\n// Default toast width\nconst TOAST_WIDTH = 356;\n// Default gap between toasts\nconst GAP = 14;\n// Threshold to dismiss a toast\nconst SWIPE_THRESHOLD = 45;\n// Equal to exit animation duration\nconst TIME_BEFORE_UNMOUNT = 200;\nfunction cn(...classes) {\n return classes.filter(Boolean).join(' ');\n}\nfunction getDefaultSwipeDirections(position) {\n const [y, x] = position.split('-');\n const directions = [];\n if (y) {\n directions.push(y);\n }\n if (x) {\n directions.push(x);\n }\n return directions;\n}\nconst Toast = (props)=>{\n var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;\n const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;\n const [swipeDirection, setSwipeDirection] = React.useState(null);\n const [swipeOutDirection, setSwipeOutDirection] = React.useState(null);\n const [mounted, setMounted] = React.useState(false);\n const [removed, setRemoved] = React.useState(false);\n const [swiping, setSwiping] = React.useState(false);\n const [swipeOut, setSwipeOut] = React.useState(false);\n const [isSwiped, setIsSwiped] = React.useState(false);\n const [offsetBeforeRemove, setOffsetBeforeRemove] = React.useState(0);\n const [initialHeight, setInitialHeight] = React.useState(0);\n const remainingTime = React.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);\n const dragStartTime = React.useRef(null);\n const toastRef = React.useRef(null);\n const isFront = index === 0;\n const isVisible = index + 1 <= visibleToasts;\n const toastType = toast.type;\n // Toasts created with `toast()` have no type, `classNames.default` is the key for those.\n const toastTypeKey = toastType != null ? toastType : 'default';\n const dismissible = toast.dismissible !== false;\n const toastClassname = toast.className || '';\n const toastDescriptionClassname = toast.descriptionClassName || '';\n // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.\n const heightIndex = React.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [\n heights,\n toast.id\n ]);\n const closeButton = React.useMemo(()=>{\n var _toast_closeButton;\n return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;\n }, [\n toast.closeButton,\n closeButtonFromToaster\n ]);\n const duration = React.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [\n toast.duration,\n durationFromToaster\n ]);\n const closeTimerStartTimeRef = React.useRef(0);\n const offset = React.useRef(0);\n const lastCloseTimerStartTimeRef = React.useRef(0);\n const pointerStartRef = React.useRef(null);\n const [y, x] = position.split('-');\n const toastsHeightBefore = React.useMemo(()=>{\n return heights.reduce((prev, curr, reducerIndex)=>{\n // Calculate offset up until current toast\n if (reducerIndex >= heightIndex) {\n return prev;\n }\n return prev + curr.height;\n }, 0);\n }, [\n heights,\n heightIndex\n ]);\n const isDocumentHidden = useIsDocumentHidden();\n const swipeDirections = React.useMemo(()=>{\n var _props_swipeDirections;\n return (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);\n }, [\n props.swipeDirections,\n position\n ]);\n const invert = toast.invert || ToasterInvert;\n const disabled = toastType === 'loading';\n offset.current = React.useMemo(()=>heightIndex * gap + toastsHeightBefore, [\n heightIndex,\n toastsHeightBefore\n ]);\n React.useEffect(()=>{\n remainingTime.current = duration;\n }, [\n duration\n ]);\n React.useEffect(()=>{\n // Trigger enter animation without using CSS animation\n setMounted(true);\n }, []);\n React.useEffect(()=>{\n const toastNode = toastRef.current;\n if (toastNode) {\n const height = toastNode.getBoundingClientRect().height;\n // Add toast height to heights array after the toast is mounted\n setInitialHeight(height);\n setHeights((h)=>[\n {\n toastId: toast.id,\n height,\n position: toast.position\n },\n ...h\n ]);\n return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));\n }\n }, [\n setHeights,\n toast.id\n ]);\n React.useLayoutEffect(()=>{\n // Keep height up to date with the content in case it updates\n if (!mounted) return;\n const toastNode = toastRef.current;\n const originalHeight = toastNode.style.height;\n toastNode.style.height = 'auto';\n const newHeight = toastNode.getBoundingClientRect().height;\n toastNode.style.height = originalHeight;\n setInitialHeight(newHeight);\n setHeights((heights)=>{\n const alreadyExists = heights.find((height)=>height.toastId === toast.id);\n if (!alreadyExists) {\n return [\n {\n toastId: toast.id,\n height: newHeight,\n position: toast.position\n },\n ...heights\n ];\n } else {\n return heights.map((height)=>height.toastId === toast.id ? {\n ...height,\n height: newHeight\n } : height);\n }\n });\n }, [\n mounted,\n toast.title,\n toast.description,\n setHeights,\n toast.id,\n toast.jsx,\n toast.action,\n toast.cancel\n ]);\n const deleteToast = React.useCallback(()=>{\n // Save the offset for the exit swipe animation\n setRemoved(true);\n setOffsetBeforeRemove(offset.current);\n setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));\n setTimeout(()=>{\n removeToast(toast);\n }, TIME_BEFORE_UNMOUNT);\n }, [\n toast,\n removeToast,\n setHeights,\n offset\n ]);\n React.useEffect(()=>{\n if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;\n let timeoutId;\n // Pause the timer on each hover\n const pauseTimer = ()=>{\n if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {\n // Get the elapsed time since the timer started\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n remainingTime.current = remainingTime.current - elapsedTime;\n }\n lastCloseTimerStartTimeRef.current = new Date().getTime();\n };\n const startTimer = ()=>{\n // setTimeout(, Infinity) behaves as if the delay is 0.\n // As a result, the toast would be closed immediately, giving the appearance that it was never rendered.\n // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout\n if (remainingTime.current === Infinity) return;\n closeTimerStartTimeRef.current = new Date().getTime();\n // Let the toast know it has started\n timeoutId = setTimeout(()=>{\n toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);\n deleteToast();\n }, remainingTime.current);\n };\n if (expanded || interacting || isDocumentHidden) {\n pauseTimer();\n } else {\n startTimer();\n }\n return ()=>clearTimeout(timeoutId);\n }, [\n expanded,\n interacting,\n toast,\n toastType,\n isDocumentHidden,\n deleteToast\n ]);\n React.useEffect(()=>{\n if (toast.delete) {\n deleteToast();\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n }\n }, [\n deleteToast,\n toast.delete\n ]);\n function getLoadingIcon() {\n var _toast_classNames;\n if (icons == null ? void 0 : icons.loading) {\n var _toast_classNames1;\n return /*#__PURE__*/ React.createElement(\"div\", {\n className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'),\n \"data-visible\": toastType === 'loading'\n }, icons.loading);\n }\n return /*#__PURE__*/ React.createElement(Loader, {\n className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader),\n visible: toastType === 'loading'\n });\n }\n const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);\n var _toast_richColors, _icons_close;\n return /*#__PURE__*/ React.createElement(\"li\", {\n tabIndex: 0,\n ref: toastRef,\n className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames[toastTypeKey], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastTypeKey]),\n \"data-sonner-toast\": \"\",\n \"data-rich-colors\": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,\n \"data-styled\": !Boolean(toast.jsx || toast.unstyled || unstyled),\n \"data-mounted\": mounted,\n \"data-promise\": Boolean(toast.promise),\n \"data-swiped\": isSwiped,\n \"data-removed\": removed,\n \"data-visible\": isVisible,\n \"data-y-position\": y,\n \"data-x-position\": x,\n \"data-index\": index,\n \"data-front\": isFront,\n \"data-swiping\": swiping,\n \"data-dismissible\": dismissible,\n \"data-type\": toastType,\n \"data-invert\": invert,\n \"data-swipe-out\": swipeOut,\n \"data-swipe-direction\": swipeOutDirection,\n \"data-expanded\": Boolean(expanded || expandByDefault && mounted),\n \"data-testid\": toast.testId,\n style: {\n '--index': index,\n '--toasts-before': index,\n '--z-index': toasts.length - index,\n '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,\n '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,\n ...style,\n ...toast.style\n },\n onDragEnd: ()=>{\n setSwiping(false);\n setSwipeDirection(null);\n pointerStartRef.current = null;\n },\n onPointerDown: (event)=>{\n if (event.button === 2) return; // Return early on right click\n if (disabled || !dismissible) return;\n dragStartTime.current = new Date();\n setOffsetBeforeRemove(offset.current);\n // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)\n event.target.setPointerCapture(event.pointerId);\n if (event.target.tagName === 'BUTTON') return;\n setSwiping(true);\n pointerStartRef.current = {\n x: event.clientX,\n y: event.clientY\n };\n },\n onPointerUp: ()=>{\n var _toastRef_current, _toastRef_current1, _dragStartTime_current;\n if (swipeOut || !dismissible) return;\n pointerStartRef.current = null;\n const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0);\n const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0);\n const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());\n const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;\n const velocity = Math.abs(swipeAmount) / timeTaken;\n // Movement towards a direction that isn't allowed is dampened, not blocked, so a fast\n // flick can still pass the velocity check. Only dismiss if the direction is allowed.\n const isAllowedDirection = swipeDirection === 'x' ? swipeDirections.includes(swipeAmountX > 0 ? 'right' : 'left') : swipeDirections.includes(swipeAmountY > 0 ? 'bottom' : 'top');\n if (isAllowedDirection && (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11)) {\n setOffsetBeforeRemove(offset.current);\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n if (swipeDirection === 'x') {\n setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');\n } else {\n setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');\n }\n deleteToast();\n setSwipeOut(true);\n return;\n } else {\n var _toastRef_current2, _toastRef_current3;\n (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`);\n (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`);\n }\n setIsSwiped(false);\n setSwiping(false);\n setSwipeDirection(null);\n },\n onPointerMove: (event)=>{\n var _window_getSelection, // Apply transform using both x and y values\n _toastRef_current, _toastRef_current1;\n if (!pointerStartRef.current || !dismissible) return;\n const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;\n if (isHighlighted) return;\n const yDelta = event.clientY - pointerStartRef.current.y;\n const xDelta = event.clientX - pointerStartRef.current.x;\n // Determine swipe direction if not already locked\n if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {\n setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');\n }\n let swipeAmount = {\n x: 0,\n y: 0\n };\n const getDampening = (delta)=>{\n const factor = Math.abs(delta) / 20;\n return 1 / (1.5 + factor);\n };\n // Only apply swipe in the locked direction\n if (swipeDirection === 'y') {\n // Handle vertical swipes\n if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {\n if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {\n swipeAmount.y = yDelta;\n } else {\n // Smoothly transition to dampened movement\n const dampenedDelta = yDelta * getDampening(yDelta);\n // Ensure we don't jump when transitioning to dampened movement\n swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;\n }\n }\n } else if (swipeDirection === 'x') {\n // Handle horizontal swipes\n if (swipeDirections.includes('left') || swipeDirections.includes('right')) {\n if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {\n swipeAmount.x = xDelta;\n } else {\n // Smoothly transition to dampened movement\n const dampenedDelta = xDelta * getDampening(xDelta);\n // Ensure we don't jump when transitioning to dampened movement\n swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;\n }\n }\n }\n if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {\n setIsSwiped(true);\n }\n (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);\n (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);\n }\n }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React.createElement(\"button\", {\n \"aria-label\": closeButtonAriaLabel,\n \"data-disabled\": disabled,\n \"data-close-button\": true,\n onClick: disabled || !dismissible ? ()=>{} : ()=>{\n deleteToast();\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n },\n className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton)\n }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ React.createElement(\"div\", {\n \"data-icon\": \"\",\n className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)\n }, toastType === 'loading' ? toast.icon || getLoadingIcon() : toast.promise ? getLoadingIcon() : null, toastType !== 'loading' ? icon : null) : null, /*#__PURE__*/ React.createElement(\"div\", {\n \"data-content\": \"\",\n className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)\n }, /*#__PURE__*/ React.createElement(\"div\", {\n \"data-title\": \"\",\n className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title)\n }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React.createElement(\"div\", {\n \"data-description\": \"\",\n className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description)\n }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React.createElement(\"button\", {\n \"data-button\": true,\n \"data-cancel\": true,\n style: toast.cancelButtonStyle || cancelButtonStyle,\n onClick: (event)=>{\n // We need to check twice because typescript\n if (!isAction(toast.cancel)) return;\n if (!dismissible) return;\n toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);\n deleteToast();\n },\n className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton)\n }, toast.cancel.label) : null, /*#__PURE__*/ React.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React.createElement(\"button\", {\n \"data-button\": true,\n \"data-action\": true,\n style: toast.actionButtonStyle || actionButtonStyle,\n onClick: (event)=>{\n // We need to check twice because typescript\n if (!isAction(toast.action)) return;\n toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);\n if (event.defaultPrevented) return;\n deleteToast();\n },\n className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton)\n }, toast.action.label) : null);\n};\nfunction getDocumentDirection() {\n if (typeof window === 'undefined') return 'ltr';\n if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose\n const dirAttribute = document.documentElement.getAttribute('dir');\n if (dirAttribute === 'auto' || !dirAttribute) {\n return window.getComputedStyle(document.documentElement).direction;\n }\n return dirAttribute;\n}\nfunction assignOffset(defaultOffset, mobileOffset) {\n const styles = {};\n [\n defaultOffset,\n mobileOffset\n ].forEach((offset, index)=>{\n const isMobile = index === 1;\n const prefix = isMobile ? '--mobile-offset' : '--offset';\n const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;\n function assignAll(offset) {\n [\n 'top',\n 'right',\n 'bottom',\n 'left'\n ].forEach((key)=>{\n styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset;\n });\n }\n if (typeof offset === 'number' || typeof offset === 'string') {\n assignAll(offset);\n } else if (typeof offset === 'object') {\n [\n 'top',\n 'right',\n 'bottom',\n 'left'\n ].forEach((key)=>{\n if (offset[key] === undefined) {\n styles[`${prefix}-${key}`] = defaultValue;\n } else {\n styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];\n }\n });\n } else {\n assignAll(defaultValue);\n }\n });\n return styles;\n}\nfunction useSonner() {\n const [activeToasts, setActiveToasts] = React.useState([]);\n React.useEffect(()=>{\n return ToastState.subscribe((toast)=>{\n if (toast.dismiss) {\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setActiveToasts((toasts)=>toasts.filter((t)=>t.id !== toast.id));\n });\n });\n return;\n }\n // Prevent batching, temp solution.\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setActiveToasts((toasts)=>{\n const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);\n // Update the toast if it already exists\n if (indexOfExistingToast !== -1) {\n return [\n ...toasts.slice(0, indexOfExistingToast),\n {\n ...toasts[indexOfExistingToast],\n ...toast\n },\n ...toasts.slice(indexOfExistingToast + 1)\n ];\n }\n return [\n toast,\n ...toasts\n ];\n });\n });\n });\n });\n }, []);\n return {\n toasts: activeToasts\n };\n}\nconst Toaster = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {\n const { id, invert, position = 'bottom-right', hotkey = [\n 'altKey',\n 'KeyT'\n ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, customAriaLabel, containerAriaLabel = 'Notifications' } = props;\n const [toasts, setToasts] = React.useState([]);\n const filteredToasts = React.useMemo(()=>{\n if (id) {\n return toasts.filter((toast)=>toast.toasterId === id);\n }\n return toasts.filter((toast)=>!toast.toasterId);\n }, [\n toasts,\n id\n ]);\n const possiblePositions = React.useMemo(()=>{\n return Array.from(new Set([\n position\n ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));\n }, [\n filteredToasts,\n position\n ]);\n const [heights, setHeights] = React.useState([]);\n const [expanded, setExpanded] = React.useState(false);\n const [interacting, setInteracting] = React.useState(false);\n const [actualTheme, setActualTheme] = React.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');\n const listRef = React.useRef(null);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n const lastFocusedElementRef = React.useRef(null);\n const isFocusWithinRef = React.useRef(false);\n const removeToast = React.useCallback((toastToRemove)=>{\n setToasts((toasts)=>{\n var _toasts_find;\n if (!((_toasts_find = toasts.find((toast)=>toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {\n ToastState.dismiss(toastToRemove.id);\n }\n return toasts.filter(({ id })=>id !== toastToRemove.id);\n });\n }, []);\n React.useEffect(()=>{\n return ToastState.subscribe((toast)=>{\n if (toast.dismiss) {\n // Prevent batching of other state updates\n requestAnimationFrame(()=>{\n setToasts((toasts)=>toasts.map((t)=>t.id === toast.id ? {\n ...t,\n delete: true\n } : t));\n });\n return;\n }\n // Prevent batching, temp solution.\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setToasts((toasts)=>{\n const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);\n // Update the toast if it already exists\n if (indexOfExistingToast !== -1) {\n return [\n ...toasts.slice(0, indexOfExistingToast),\n {\n ...toasts[indexOfExistingToast],\n ...toast\n },\n ...toasts.slice(indexOfExistingToast + 1)\n ];\n }\n return [\n toast,\n ...toasts\n ];\n });\n });\n });\n });\n }, []);\n React.useEffect(()=>{\n if (theme !== 'system') {\n setActualTheme(theme);\n return;\n }\n if (theme === 'system') {\n // check if current preference is dark\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n // it's currently dark\n setActualTheme('dark');\n } else {\n // it's not dark\n setActualTheme('light');\n }\n }\n if (typeof window === 'undefined') return;\n const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n try {\n // Chrome & Firefox\n darkMediaQuery.addEventListener('change', ({ matches })=>{\n if (matches) {\n setActualTheme('dark');\n } else {\n setActualTheme('light');\n }\n });\n } catch (error) {\n // Safari < 14\n darkMediaQuery.addListener(({ matches })=>{\n try {\n if (matches) {\n setActualTheme('dark');\n } else {\n setActualTheme('light');\n }\n } catch (e) {\n console.error(e);\n }\n });\n }\n }, [\n theme\n ]);\n React.useEffect(()=>{\n // Ensure expanded is always false when no toasts are present / only one left\n if (toasts.length <= 1) {\n setExpanded(false);\n }\n }, [\n toasts\n ]);\n React.useEffect(()=>{\n const handleKeyDown = (event)=>{\n var _listRef_current;\n const isHotkeyPressed = hotkey.length > 0 && hotkey.every((key)=>event[key] || event.code === key);\n if (isHotkeyPressed) {\n var _listRef_current1;\n setExpanded(true);\n (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();\n }\n if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {\n setExpanded(false);\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n return ()=>document.removeEventListener('keydown', handleKeyDown);\n }, [\n hotkey\n ]);\n React.useEffect(()=>{\n if (listRef.current) {\n return ()=>{\n if (lastFocusedElementRef.current) {\n lastFocusedElementRef.current.focus({\n preventScroll: true\n });\n lastFocusedElementRef.current = null;\n isFocusWithinRef.current = false;\n }\n };\n }\n }, [\n listRef.current\n ]);\n return(// Remove item from normal navigation flow, only available via hotkey\n /*#__PURE__*/ React.createElement(\"section\", {\n ref: ref,\n \"aria-label\": customAriaLabel != null ? customAriaLabel : `${containerAriaLabel} ${hotkeyLabel}`,\n tabIndex: -1,\n \"aria-live\": \"polite\",\n \"aria-relevant\": \"additions text\",\n \"aria-atomic\": \"false\",\n suppressHydrationWarning: true,\n \"data-react-aria-top-layer\": true\n }, possiblePositions.map((position, index)=>{\n var _heights_;\n const [y, x] = position.split('-');\n if (!filteredToasts.length) return null;\n return /*#__PURE__*/ React.createElement(\"ol\", {\n key: position,\n dir: dir === 'auto' ? getDocumentDirection() : dir,\n tabIndex: -1,\n ref: listRef,\n className: className,\n \"data-sonner-toaster\": true,\n \"data-sonner-theme\": actualTheme,\n \"data-y-position\": y,\n \"data-x-position\": x,\n style: {\n '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,\n '--width': `${TOAST_WIDTH}px`,\n '--gap': `${gap}px`,\n ...style,\n ...assignOffset(offset, mobileOffset)\n },\n onBlur: (event)=>{\n if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {\n isFocusWithinRef.current = false;\n if (lastFocusedElementRef.current) {\n lastFocusedElementRef.current.focus({\n preventScroll: true\n });\n lastFocusedElementRef.current = null;\n }\n }\n },\n onFocus: (event)=>{\n const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';\n if (isNotDismissible) return;\n if (!isFocusWithinRef.current) {\n isFocusWithinRef.current = true;\n lastFocusedElementRef.current = event.relatedTarget;\n }\n },\n onMouseEnter: ()=>setExpanded(true),\n onMouseMove: ()=>setExpanded(true),\n onMouseLeave: ()=>{\n // Avoid setting expanded to false when interacting with a toast, e.g. swiping\n if (!interacting) {\n setExpanded(false);\n }\n },\n onDragEnd: ()=>setExpanded(false),\n onPointerDown: (event)=>{\n const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';\n if (isNotDismissible) return;\n setInteracting(true);\n },\n onPointerUp: ()=>setInteracting(false)\n }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{\n var _toastOptions_duration, _toastOptions_closeButton;\n return /*#__PURE__*/ React.createElement(Toast, {\n key: toast.id,\n icons: icons,\n index: index,\n toast: toast,\n defaultRichColors: richColors,\n duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,\n className: toastOptions == null ? void 0 : toastOptions.className,\n descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,\n invert: invert,\n visibleToasts: visibleToasts,\n closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,\n interacting: interacting,\n position: position,\n style: toastOptions == null ? void 0 : toastOptions.style,\n unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,\n classNames: toastOptions == null ? void 0 : toastOptions.classNames,\n cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,\n actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,\n closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,\n removeToast: removeToast,\n toasts: filteredToasts.filter((t)=>t.position == toast.position),\n heights: heights.filter((h)=>h.position == toast.position),\n setHeights: setHeights,\n expandByDefault: expand,\n gap: gap,\n expanded: expanded,\n swipeDirections: props.swipeDirections\n });\n }));\n })));\n});\n\nexport { Toaster, toast, useSonner };\n"],"ignoreList":[0],"mappings":";;;;AACA,SAASC,EAAY,GAAM;CACzB,IAAI,CAACC,KAAQ,OAAO,WAAY,KAAa;CAC7C,IAAIC,IAAO,SAAS,QAAQ,SAAS,qBAAqB,MAAM,CAAC,CAAC,IAC9DC,IAAQ,SAAS,cAAc,OAAO;CAGzC,AAFD,EAAM,OAAO,YACbD,EAAK,YAAYC,CAAK,GACrBA,EAAM,aAAc,EAAM,WAAW,UAAUF,IAAQE,EAAM,YAAY,SAAS,eAAeF,CAAI,CAAC;AACzG;AAmBa,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;AAkG7B,IAAIG,IAAgB,GAGd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