Skip to content

Conversation

@darrensapalo
Copy link
Contributor

@darrensapalo darrensapalo commented Nov 18, 2025

Description

WIP for hooks for the tax estimates API.

APIs are not final and payloads may change; current estimate is that these are already 90% of the way there. The current goal is to have layer-react library have the plumbing (read: hooks) to retrieve data

Changes

  • Added API endpoints, schemas, hooks, and toggle-able mock data.
  • Noted comments on things that need to be revisited as we release this tax estimate as stable (see PR comments).

Blockers

None.

How this has been tested?

See Loom for interactive demo:

https://www.loom.com/share/3e19c6665b7845758fa2d4b88c5e1462

Acceptance criteria:

  • Hooks are wired up to the components correctly
  • Mock flag for fake data works
  • UI is ready for demo

@darrensapalo darrensapalo changed the base branch from main to darren/tax-estimates November 18, 2025 21:40
Comment on lines +31 to +32
const { data: taxOverviewData } = useTaxOverview({ useMockData: true })
const { data: taxChecklistData } = useTaxChecklist({ useMockData: true })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are UI testing and developing, we'll useMockData: true temporarily.

Comment on lines 33 to 37
const yearOptions: YearOption[] = [
{ label: '2025', value: '2025' },
{ label: '2024', value: '2024' },
{ label: '2023', value: '2023' },
{ label: currentYear.toString(), value: currentYear.toString() },
{ label: (currentYear - 1).toString(), value: (currentYear - 1).toString() },
{ label: (currentYear - 2).toString(), value: (currentYear - 2).toString() },
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently assumes that we show current year up to 3 years prior- this needs to be changed later to: all years where the customer's bookkeeping subscription is/was active.

@darrensapalo darrensapalo marked this pull request as ready for review November 18, 2025 22:13
@darrensapalo
Copy link
Contributor Author

@greptileai Give this a first pass review.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 18, 2025

Greptile Summary

  • Introduces comprehensive tax estimates functionality with schemas, API endpoints, hooks, and UI components for retrieving and managing tax data
  • Implements mock data support across all hooks to enable development and testing without live API integration
  • Uses Effect Schema for type-safe API response validation with proper snake_case to camelCase transformations

Confidence Score: 5/5

  • This PR is safe to merge with no critical issues found.
  • Well-structured implementation following established patterns in the codebase with proper type safety, schema validation, and comprehensive hook architecture for tax estimates feature.
  • No files require special attention.

Important Files Changed

Filename Overview
src/schemas/taxEstimates.ts New schema definitions for tax estimates using Effect Schema with proper snake_case to camelCase transformations
src/api/layer/taxEstimates.ts New API endpoints for tax estimates feature with proper type definitions and URL construction
src/hooks/useTaxEstimates/useTaxEstimates.ts Main tax estimates hook with SWR integration, mock data support, and global cache actions for invalidation
src/views/TaxEstimates/TaxEstimateView.tsx Main tax estimates view component integrating hooks with UI, uses mock data and current year for year selector

Sequence Diagram

sequenceDiagram
    participant User
    participant TaxEstimateView
    participant useTaxEstimates
    participant getTaxEstimates
    participant API
    participant Schema
    
    User->>TaxEstimateView: "Views tax estimates page"
    TaxEstimateView->>useTaxEstimates: "Call hook with year and useMockData flag"
    useTaxEstimates->>useTaxEstimates: "Build SWR key with auth and businessId"
    alt Mock Data Enabled
        useTaxEstimates->>useTaxEstimates: "Return mock data from taxEstimateDefaults"
        useTaxEstimates->>Schema: "Decode mock data with TaxEstimateResponseSchema"
        Schema-->>useTaxEstimates: "Validated data"
    else Real API Call
        useTaxEstimates->>getTaxEstimates: "Call API with businessId and year"
        getTaxEstimates->>API: "GET /v1/businesses/{businessId}/taxes/estimates"
        API-->>getTaxEstimates: "Raw API response"
        getTaxEstimates->>Schema: "Decode with TaxEstimateResponseSchema"
        Schema-->>getTaxEstimates: "Validated data"
        getTaxEstimates-->>useTaxEstimates: "Validated data"
    end
    useTaxEstimates-->>TaxEstimateView: "Tax estimates data"
    TaxEstimateView->>TaxEstimateView: "Render UI with data"
    TaxEstimateView-->>User: "Display tax estimates"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

19 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@darrensapalo darrensapalo changed the title Tax estimates hooks Tax estimates - preliminary API, shape, and hooks integration Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants