Skip to content

feat: quotes list for B2B buyers in My Account - #3388

Merged
ArthurTriis1 merged 20 commits into
devfrom
feat/quotes-list
Jul 3, 2026
Merged

ArthurTriis1 merged 20 commits into
devfrom
feat/quotes-list

Conversation

@ArthurTriis1

@ArthurTriis1 ArthurTriis1 commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • BBS-1: Buyers can now view their submitted quotes at `/pvt/account/quotes` with pagination (25 per page) and filters (status, created date range, expiry date range)
  • BBS-2: The Quotes nav item is only visible to users belonging to an organization unit (`b2b.unitId` session check), matching the existing Organization Account link gate
    "
image

Changes

API (`packages/api`)

  • `quote.graphql` — `UserQuoteSummary`, `UserQuoteListResult`, `UserQuoteListPaging` GQL types
  • `query.graphql` — `listUserQuotes` query with `@auth` + `@cacheControl(scope: "private")`
  • `types/Quote.ts` — `QuoteSummary`, `QuoteListResult`, `ListUserQuotesArgs` interfaces
  • `commerce/index.ts` — `quotes.listUserQuotes()` fetching `GET /api/quoting/quotes`
  • `resolvers/query.ts` — `listUserQuotes` resolver mapping API result to GQL shape

Core (`packages/core`)

  • `quoteStatus.ts` — status→variant+label map (9 statuses)
  • `getMyAccountRoutes.ts` — `QUOTES_ROUTE` + `ROUTES_ONLY_FOR_B2B_MEMBERS`
  • `MyAccountLayout.tsx` — gates Quotes link behind `b2b?.unitId` from `useSession()`
  • `pages/pvt/account/quotes/index.tsx` — SSR page with `ServerListQuotesQuery` GQL query
  • `MyAccountListQuotes` — list component with filter slider, selected tags, empty state, pagination
  • `MyAccountListQuotesTable` — quote rows (label/ID, amount, created, expires, status badge); click redirects to `/pvt/organization-account/order-entry?quoteId=`
  • `MyAccountQuoteStatusBadge` — badge using `quoteStatusMap` + existing `data-fs-my-account-badge` token system
  • `MyAccountQuotesFilterSlider` — status boolean + two date range facets (created, expiry)
  • `MyAccountQuotesSelectedTags` — active filter tag removal

Tests

No automated tests added in this PR — the feature requires a live VTEX B2B environment with the Quotes module enabled, which is not available in the unit test setup. Manual acceptance testing against the acceptance criteria in the spec is required.

Assumptions

  • Quote `amount` from `/api/quoting/quotes` is in standard currency units (not cents), unlike order `totalValue`. Formatted directly via `Intl.NumberFormat` using `useSession().currency.code`.

Deviations

None.

Follow-ups

See `specs/quotes-list.pending.md` (gitignored) for deferred items:

  • Total amount range filter — requires API support (`totalFrom`/`totalTo` params)
  • Item count column — requires `itemCount` field on `QuoteSummary` from the API

Spec

Specification: faststore-dx-spec-kit#13

Summary by CodeRabbit

  • New Features
    • Added a “Quotes” page in My Account for eligible B2B members, with a paginated list of quotes.
    • Added filtering for quote status, created/expiration date ranges, and label; includes an interactive filter drawer with selected-tag chips and “Clear all.”
    • Added search by label (synced to the URL) and per-quote status badges, “expires in” display, and totals.
  • Bug Fixes
    • Improved filtering/search navigation by keeping paging and label parameters in sync.

@ArthurTriis1
ArthurTriis1 requested a review from a team as a code owner June 10, 2026 18:57
@ArthurTriis1
ArthurTriis1 requested review from ommeirelles and renatomaurovtex and removed request for a team June 10, 2026 18:57
@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR introduces a comprehensive "My Account → Quotes" feature for B2B FastStore customers. It adds a new GraphQL query (listUserQuotes) backed by a VTEX commerce client integration, implements server-side rendering with feature gating for B2B members only, and provides a fully-featured filtering-enabled list UI with pagination, status badges, and date-range filtering.

Changes

B2B Quotes Management Page with Filtering

Layer / File(s) Summary
Quote data types and GraphQL schema
packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts, packages/api/src/platforms/vtex/typeDefs/quote.graphql, packages/api/src/platforms/vtex/typeDefs/query.graphql
TypeScript interfaces and GraphQL schema define quote summary fields (id, status, label, created/expiry dates, amount, createdBy), paginated list results, and filter arguments for backend/API contract.
Commerce client and GraphQL resolver
packages/api/src/platforms/vtex/clients/commerce/index.ts, packages/api/src/platforms/vtex/resolvers/query.ts, packages/api/test/integration/schema.test.ts
Commerce client surface adds quotes.listUserQuotes() method that calls VTEX /api/quoting/quotes endpoint; resolver normalizes results into list and paging fields, resolves createdBy to shopper display name with fallback, and applies @auth and private cache directives; schema test updated to expect the new query.
Route definitions and server-side rendering
packages/core/src/sdk/account/getMyAccountRoutes.ts, packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx, packages/core/src/pages/pvt/account/quotes/index.tsx
Adds QUOTES_ROUTE and marks it B2B-member-only via ROUTES_ONLY_FOR_B2B_MEMBERS; updates layout menu to conditionally show quotes when user has b2b.unitId; implements getServerSideProps with concurrent global sections and quote data fetching, filter normalization, and error-based redirects (403/404).
Quote status mapping utility
packages/core/src/utils/quoteStatus.ts
Defines quote lifecycle statuses (Draft, Requested, InReview, Reviewed, Approved, Declined, Expired, ConvertedToCart, ConvertedToOrder) with UI variant/label mappings used by display components.
Quote filter utilities and tests
packages/core/src/components/account/quotes/MyAccountListQuotes/quoteFilters.ts, packages/core/test/components/quotes/quoteFilters.test.ts, packages/core/test/server/index.test.ts
Defines filter shape, facet conversion functions, active-filter detection, and locale-aware date formatting; comprehensive test suite validates facet logic, filter grouping, and date parsing across status, date-range, and label filters; server test validates schema.
Quote list page component with facet filtering
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
Builds main component with facet-based filter state management for status and date ranges; implements responsive layout with debounced search input, filter button with active-filter badge, empty-state logic (icon/title based on filter activity), and conditional rendering of table or empty state; wires filter UI integration and responsive pagination.
Quote table, status badge, and pagination
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx, packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
Table component renders locale-aware dates, relative "expires in" strings, currency formatting, status badges, clickable rows with keyboard (Enter) and mouse navigation to quote details, and paginated display with desktop/mobile variants; Pagination component derives page ranges and manages navigation via URL query parameters.
Filter slider with date ranges and status selector
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx, packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
Slider component uses imperative refs for created/expiry date-range inputs, renders multi-select status combobox, applies selected filters via URLSearchParams navigation, provides clear-all functionality, and manages disabled state from date-range widgets; stylesheet loads shared FastStore UI styles and defines slide-over/drawer-specific overrides.
Multi-select status combobox component
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx, packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
Combobox manages selection state for quote statuses, renders selected items as removable chips, provides keyboard/click toggles for dropdown open/close, and displays checkbox listbox with ARIA attributes (role="combobox", aria-expanded, aria-multiselectable) for accessibility; stylesheet defines wrapper, input focus/open states, chips, and dropdown menu with variant color support.
Selected filter tags display and removal
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
Component renders currently-applied filters (created/expiry date ranges and status values) as removable tags with per-tag and clear-all removal controls; uses locale-aware date formatting via formatFilterDate and quoteStatusMap for status label display; computes hasFilters dynamically from filter entries.
Page styles, exports, and customization hooks
packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts, packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss, packages/core/src/customizations/src/myAccount/extensions/quotes/*
Stylesheet defines .page wrapper with shared FastStore UI imports, quote-specific design tokens, and list/row/column layout with hover/focus interaction states and :focus-visible outlines; barrel export provides component public API; Before/After customization components enable CMS section composition around the quote list.

Sequence Diagram(s)

sequenceDiagram
  participant User as B2B Member
  participant Page as Quotes Page<br/>(SSR)
  participant API as GraphQL<br/>listUserQuotes
  participant Commerce as Commerce<br/>Client
  participant VTEX as VTEX Quoting<br/>Service
  
  User->>Page: Navigate /pvt/account/quotes
  Page->>API: getServerSideProps(filters)
  API->>Commerce: quotes.listUserQuotes({page, status, createdAt, expiresAt, label})
  Commerce->>VTEX: GET /api/quoting/quotes?pageNumber=X&pageSize=Y&...
  VTEX-->>Commerce: {items[], pageNumber, pageSize, totalItems}
  Commerce-->>API: QuoteListResult
  API->>API: map items[] → list[],<br/>resolve createdBy → name
  API-->>Page: {list, paging, total, perPage}
  Page-->>User: Render table + filters<br/>+ pagination
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement

Suggested reviewers

  • ommeirelles
  • emersonlaurentino
  • lemagnetic

📋 Quotes now flow through FastStore's veins,
B2B members filter with ease and style,
Date ranges, status badges, pagination—no pains,
A full-featured list that makes commerce worthwhile. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main feature: a quotes list UI for B2B buyers in the My Account section, which is the primary focus across all changed files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/quotes-list

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codesandbox-ci

codesandbox-ci Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (12)
packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss (1)

28-46: ⚡ Quick win

Data attributes use list-orders naming for quotes domain.

The data attributes data-fs-list-orders-controls and data-fs-list-orders-search-filters (and corresponding CSS custom properties like --fs-list-orders-padding) appear to be copy-pasted from the orders component. For clarity and maintainability, consider renaming them to data-fs-list-quotes-* and --fs-list-quotes-* to match the quotes domain.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss`
around lines 28 - 46, The styles file uses orders-specific data attributes and
custom properties that were copy-pasted into the quotes component; update
occurrences of data-fs-list-orders-controls and
data-fs-list-orders-search-filters (and any related CSS variables like
--fs-list-orders-*) to use quotes-specific names (e.g.,
data-fs-list-quotes-controls, data-fs-list-quotes-search-filters and
--fs-list-quotes-*) so the selectors in styles.module.scss and any consumers
match the quotes domain; ensure you change both selectors and CSS variable
references consistently across MyAccountListQuotes styles and any components
that read those attributes/variables (search for data-fs-list-orders- and
--fs-list-orders- to replace).
packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx (1)

26-34: ⚡ Quick win

Flatten the route filtering logic per coding guidelines.

The nested ternary followed by a chained filter could be simplified using flat conditionals for better readability.

♻️ Refactor to use combined conditions
-  const routes = (
-    isRepresentative
-      ? menuRoutes
-      : menuRoutes.filter(
-          ({ route }) => !ROUTES_ONLY_FOR_REPRESENTATIVE.includes(route)
-        )
-  ).filter(
-    ({ route }) => isOrgMember || !ROUTES_ONLY_FOR_B2B_MEMBERS.includes(route)
-  )
+  const routes = menuRoutes.filter(
+    ({ route }) =>
+      (isRepresentative || !ROUTES_ONLY_FOR_REPRESENTATIVE.includes(route)) &&
+      (isOrgMember || !ROUTES_ONLY_FOR_B2B_MEMBERS.includes(route))
+  )

As per coding guidelines: "Prefer flat conditionals over nested ifs: combine conditions with && or use early returns to avoid deep nesting and improve readability" (packages/**/*.{ts,tsx}).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx`
around lines 26 - 34, Refactor the routes calculation to replace the nested
ternary + chained filter with a single flat filter over menuRoutes: iterate
menuRoutes once and include an entry only if (1) either isRepresentative is true
OR the route is not in ROUTES_ONLY_FOR_REPRESENTATIVE, AND (2) either
isOrgMember is true OR the route is not in ROUTES_ONLY_FOR_B2B_MEMBERS; update
the routes variable to use that single combined condition so the logic remains
the same but is flatter and more readable (referencing routes, menuRoutes,
isRepresentative, isOrgMember, ROUTES_ONLY_FOR_REPRESENTATIVE,
ROUTES_ONLY_FOR_B2B_MEMBERS).

Source: Coding guidelines

packages/core/src/pages/pvt/account/quotes/index.tsx (1)

137-149: ⚡ Quick win

Consider simplifying date filter defaults.

Lines 144-149 default date filters to empty strings, then lines 163-166 convert them to undefined. You could default directly to undefined and skip the conversion:

const createdAtFrom = (context.query.createdAtFrom as string | undefined)
const createdAtTo = (context.query.createdAtTo as string | undefined)
const expiresAtFrom = (context.query.expiresAtFrom as string | undefined)
const expiresAtTo = (context.query.expiresAtTo as string | undefined)

Then at lines 163-166, use them directly without the || undefined conversion. This reduces redundant logic and makes the intent clearer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/pages/pvt/account/quotes/index.tsx` around lines 137 - 149,
The date filter vars createdAtFrom, createdAtTo, expiresAtFrom and expiresAtTo
are initialized to empty strings and later converted to undefined—simplify by
initializing them directly from context.query as possibly undefined (i.e., const
createdAtFrom = context.query.createdAtFrom as string | undefined, etc.) and
remove the subsequent `|| undefined` conversions where those variables are used
(look for their usage in the filter construction around lines that currently do
`createdAtFrom || undefined`), so the values flow as undefined when absent
without redundant logic.
packages/api/src/platforms/vtex/clients/commerce/index.ts (1)

782-816: ⚡ Quick win

Consider validating date filter formats before the API call.

The date filters (createdAtFrom, createdAtTo, expiresAtFrom, expiresAtTo) are passed directly to the VTEX API without format validation. If malformed ISO 8601 strings are provided, the API may reject the request or return unexpected results.

For reference, oms.listUserOrders (lines 526-543) normalizes date inputs using new Date().toISOString() to ensure valid format. Consider applying similar validation here for consistency and early error detection.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/api/src/platforms/vtex/clients/commerce/index.ts` around lines 782 -
816, In listUserQuotes, ensure the date filter inputs (createdAtFrom,
createdAtTo, expiresAtFrom, expiresAtTo) are validated/normalized before adding
to URLSearchParams: for each non-empty value, parse with new Date(value) and if
valid use date.toISOString(), otherwise reject/throw or skip and surface a clear
error; mirror the approach used in oms.listUserOrders to guarantee ISO8601
formatting and prevent sending malformed dates to the VTEX API.
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss (1)

23-26: 💤 Low value

Redundant visibility hiding for badges.

Both display: none and visibility: hidden are applied. display: none alone is sufficient to hide the element; visibility: hidden is redundant.

♻️ Suggested simplification
   [data-fs-badge] {
     display: none;
-    visibility: hidden;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss`
around lines 23 - 26, The CSS rule for the selector [data-fs-badge] redundantly
hides the element with both display: none and visibility: hidden; remove the
redundant visibility: hidden declaration and keep only display: none in the
[data-fs-badge] block (update the section.module.scss rule for [data-fs-badge]
accordingly).
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx (3)

54-62: ⚡ Quick win

Consider using Next.js router for pagination.

Similar to the filter removal, window.location.href causes a full page reload. Using Next.js useRouter().push() would provide a smoother user experience.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx`
around lines 54 - 62, The handlePageChange function currently uses
window.location.href which forces a full reload; replace this with Next.js
router navigation by importing and using useRouter() and calling router.push()
(or router.replace() if you want not to add history) to navigate to
`/pvt/account/quotes` with the updated URLSearchParams; update the logic in
handlePageChange to build the query string the same way and call router.push({
pathname: '/pvt/account/quotes', query: Object.fromEntries(params) }) (or
router.push(`/pvt/account/quotes${params.toString() ? `?${params}` : ''}`) if
you prefer string form) so pagination uses client-side routing.

16-22: ⚡ Quick win

Optimize currency formatting with memoization.

Creating a new Intl.NumberFormat instance for every quote is inefficient. For lists with many quotes, memoize the formatter.

⚡ Suggested optimization
+import { useMemo } from 'react'
+
 // In the component:
 export default function MyAccountListQuotesTable({
   listQuotes,
   total,
   perPage,
   filters,
 }: MyAccountListQuotesTableProps) {
   const { isDesktop } = useScreenResize()
   const { locale, currency } = useSession()
   const currencyCode = currency.code
 
+  const currencyFormatter = useMemo(
+    () =>
+      new Intl.NumberFormat(locale, {
+        style: 'currency',
+        currency: currencyCode,
+        minimumFractionDigits: 2,
+      }),
+    [locale, currencyCode]
+  )
+
+  const formatAmount = (amount: number) => currencyFormatter.format(amount)
+
   return (
     // ... rest

Then use formatAmount(item.amount) in the JSX.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx`
around lines 16 - 22, The formatAmount function creates a new Intl.NumberFormat
on each call which is slow for large lists; update formatAmount to memoize
formatters (e.g., keep a module-level Map keyed by `${locale}|${currencyCode}`
and store Intl.NumberFormat instances) and reuse the cached formatter to call
.format(amount); modify any call sites as suggested to use
formatAmount(item.amount, locale, currencyCode) (or adapt to a simplified
formatAmount(item.amount) if you centralize locale/currency defaults) so the JSX
uses the cached formatter instead of creating one per item.

101-184: ⚡ Quick win

Optimize row event handlers to prevent unnecessary re-renders.

Creating handleRowClick and handleRowKeyDown functions inside the .map() callback creates new function instances for every row on every render. Extract these handlers or use stable references.

♻️ Suggested refactor
 export default function MyAccountListQuotesTable({
   listQuotes,
   total,
   perPage,
   filters,
 }: MyAccountListQuotesTableProps) {
   const { isDesktop } = useScreenResize()
   const { locale, currency } = useSession()
   const currencyCode = currency.code
 
+  const handleRowClick = useCallback((quoteId: string) => {
+    window.location.href = `/pvt/account/quotes/${quoteId}`
+  }, [])
+
+  const handleRowKeyDown = useCallback(
+    (e: React.KeyboardEvent, quoteId: string) => {
+      if (e.key === 'Enter') {
+        e.preventDefault()
+        window.location.href = `/pvt/account/quotes/${quoteId}`
+      }
+    },
+    []
+  )
+
   return (
     <>
       <table data-fs-list-orders-table>
         <tbody data-fs-list-orders-table-body>
           {listQuotes.list.map((item) => {
             const quoteUrl = `/pvt/account/quotes/${item.id}`
             const createdDate = formatDate(item.createdAt, locale)
             const expiresDate = formatDate(item.expiresAt, locale)
             const formattedAmount = formatAmount(
               item.amount,
               locale,
               currencyCode
             )
 
-            const handleRowClick = () => {
-              window.location.href = quoteUrl
-            }
-
-            const handleRowKeyDown = (e: React.KeyboardEvent) => {
-              if (e.key === 'Enter') {
-                e.preventDefault()
-                window.location.href = quoteUrl
-              }
-            }
-
             return (
               <tr
                 data-fs-list-orders-table-row
                 key={item.id}
-                onClick={handleRowClick}
-                onKeyDown={handleRowKeyDown}
+                onClick={() => handleRowClick(item.id)}
+                onKeyDown={(e) => handleRowKeyDown(e, item.id)}
                 tabIndex={0}
                 aria-label={`View quote ${item.label ?? item.id} details`}
               >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx`
around lines 101 - 184, The row handlers (handleRowClick, handleRowKeyDown) are
recreated inside the listQuotes.list.map causing unnecessary re-renders; move
their logic out of the map in MyAccountListQuotesTable by creating stable
handlers (e.g., a single navigateToQuote(id) function plus a generic onRowClick
and onRowKeyDown that read the quote id from a data attribute or use a memoized
callback factory via useCallback) and update the <tr> to pass the id via data
attributes (or bind to the factory) and reuse the same handler references for
all rows to avoid creating new functions per item.
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx (1)

158-190: ⚡ Quick win

Consider using Next.js router for smoother navigation.

window.location.href triggers a full page reload. For better UX, consider using Next.js useRouter() with router.push() to preserve React state and enable client-side navigation.

⚡ Suggested refactor using Next.js router
+import { useRouter } from 'next/router'
+
 export default function MyAccountListQuotes({
   listQuotes,
   total,
   perPage,
   filters,
 }: MyAccountListQuotesProps) {
+  const router = useRouter()
   const { isDesktop } = useScreenResize()
   
   // ... rest of code ...
   
         onRemoveFilter={(key, value) => {
           const updatedFilters = { ...filters }
 
           if (key === 'status' && Array.isArray(updatedFilters.status)) {
             updatedFilters.status = updatedFilters.status.filter(
               (v) => v.toLowerCase() !== value.toLowerCase()
             )
           } else if (key === 'createdAtFrom' || key === 'createdAtTo') {
             updatedFilters.createdAtFrom = ''
             updatedFilters.createdAtTo = ''
           } else if (key === 'expiresAtFrom' || key === 'expiresAtTo') {
             updatedFilters.expiresAtFrom = ''
             updatedFilters.expiresAtTo = ''
           }
 
           const { page: _, ...filterParams } = updatedFilters
           const filteredQuery = Object.fromEntries(
             Object.entries(filterParams).filter(([, v]) =>
               Array.isArray(v) ? v.length > 0 : Boolean(v)
             )
           )
 
-          const params = new URLSearchParams()
-          Object.entries(filteredQuery).forEach(([k, v]) => {
-            if (Array.isArray(v)) {
-              v.forEach((item) => params.append(k, item))
-            } else {
-              params.set(k, v as string)
-            }
-          })
-
-          window.location.href = `/pvt/account/quotes${params.toString() ? `?${params}` : ''}`
+          router.push({
+            pathname: '/pvt/account/quotes',
+            query: filteredQuery,
+          })
         }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx`
around lines 158 - 190, The onRemoveFilter handler in MyAccountListQuotes
currently sets window.location.href which forces a full reload; switch this to
Next.js client navigation by getting the router via useRouter() inside the
MyAccountListQuotes component and call router.push(...) (or router.replace(...)
if you want no history entry) with the same constructed path/query string
instead of setting window.location.href; keep the existing logic that builds
filteredQuery and URLSearchParams, then call
router.push(`/pvt/account/quotes${params.toString() ? `?${params}` : ''}`) to
perform client-side navigation.
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx (1)

53-76: ⚡ Quick win

Consider using Next.js router for filter application.

Like the other navigation points, using window.location.href causes a full page reload. Consider using useRouter().push() for a smoother transition.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx`
around lines 53 - 76, The handleApply function currently does a full page reload
via window.location.href; replace that with Next.js navigation by importing and
using useRouter and calling router.push to navigate to '/pvt/account/quotes'
with the same query parameters (preserve how you build params from selected,
createdDateRangeRef, expiresDateRangeRef and multiple 'status' entries) so the
URL changes without a full reload; update the top of the component to get const
router = useRouter() and call router.push with either a { pathname, query }
object or a string built from params.toString(), keeping the existing param keys
(createdAtFrom/To, expiresAtFrom/To, status).
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx (1)

3-13: 💤 Low value

Type assertion may be unsafe for unexpected status values.

Line 4 uses status as QuoteStatusKey without runtime validation. If the backend returns an unexpected status, the fallback (entry?.label ?? status) handles it gracefully, but TypeScript won't catch this during development.

💡 Optional: Add type guard for better type safety
+function isQuoteStatusKey(status: string): status is QuoteStatusKey {
+  return status in quoteStatusMap
+}
+
 function MyAccountQuoteStatusBadge({ status }: { status: string }) {
-  const entry = quoteStatusMap[status as QuoteStatusKey]
+  const entry = isQuoteStatusKey(status) ? quoteStatusMap[status] : undefined
   return (
     <span
       data-fs-my-account-badge
       data-fs-my-account-badge-variant={entry?.variant ?? 'neutral'}
     >
       {entry?.label ?? status}
     </span>
   )
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx`
around lines 3 - 13, The code unsafely asserts status as QuoteStatusKey when
reading quoteStatusMap in MyAccountQuoteStatusBadge; add a runtime type guard
(e.g., isQuoteStatusKey that checks if status exists in quoteStatusMap or keyof
typeof quoteStatusMap) and use it before indexing quoteStatusMap so you only
cast/lookup when valid, otherwise treat as unknown and rely on the fallback
(entry?.label ?? status); update the lookup logic around entry and keep the
component prop as string.
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx (1)

42-80: 💤 Low value

Non-null assertions can be avoided for better type safety.

Lines 50 and 70 use non-null assertions (createdAtTo!, expiresAtTo!). While safe in this context (they're in the else branch), avoiding assertions makes the code more maintainable.

♻️ Suggested refactor
   const createdTag = (createdAtFrom || createdAtTo) && (
     <div key="created-date-range" data-fs-list-orders-selected-tag>
       <span data-fs-list-orders-selected-tag-label>
         {`Created: ${
           createdAtFrom && createdAtTo
             ? `${formatFilterDate(createdAtFrom, locale)} to ${formatFilterDate(createdAtTo, locale)}`
             : createdAtFrom
               ? `from ${formatFilterDate(createdAtFrom, locale)}`
-              : `to ${formatFilterDate(createdAtTo!, locale)}`
+              : `to ${formatFilterDate(createdAtTo ?? '', locale)}`
         }`}
       </span>
       <button
         data-fs-list-orders-selected-tag-clear
         onClick={() => onRemoveFilter('createdAtFrom', createdAtFrom ?? '')}
       >
         &times;
       </button>
     </div>
   )

Same for expiresAtTo on line 70.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx`
around lines 42 - 80, The code in MyAccountQuotesSelectedTags uses non-null
assertions (createdAtTo! and expiresAtTo!) inside the JSX; refactor by computing
the label strings before rendering to avoid assertions: create local variables
(e.g., createdLabel and expiresLabel) that build the three cases using safe
checks (createdAtFrom && createdAtTo, createdAtFrom, createdAtTo) and call
formatFilterDate only when the date exists, then render those labels in the
createdTag and expiresTag JSX instead of using the `...!` assertions; apply the
same pattern for expiresAt (expiresLabel) to remove both non-null assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts`:
- Line 1: The barrel index.ts currently only re-exports the default component
MyAccountListQuotes; add a re-export for the props by exporting the type
MyAccountListQuotesProps from './MyAccountListQuotes' so consumers can import
the prop type from the same barrel (i.e. add an export type {
MyAccountListQuotesProps } from './MyAccountListQuotes').

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx`:
- Around line 8-14: formatDate currently assumes the input is a valid date
string and can produce "Invalid Date" if parsing fails; update the formatDate
function to validate and handle invalid inputs by parsing the date into a Date
object, checking its validity (e.g., isNaN(dateObj.getTime())), and returning a
safe fallback (empty string or a placeholder like "—") or the original string
when invalid, and wrap parsing/formatting in a try/catch to log or suppress
unexpected errors so the UI never renders "Invalid Date".

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx`:
- Around line 25-32: formatFilterDate currently assumes a valid "YYYY-MM-DD"
string and will produce invalid Dates or NaNs for malformed input; update
formatFilterDate to validate the input (e.g. test against
/^\d{4}-\d{2}-\d{2}$/), parse only if valid, check for NaN after Number
conversions and for isNaN(date.getTime()), and return a safe fallback (such as
the original string or an empty string) or log/throw a clear error when the date
is invalid so callers won’t receive an incorrect formatted value.

---

Nitpick comments:
In `@packages/api/src/platforms/vtex/clients/commerce/index.ts`:
- Around line 782-816: In listUserQuotes, ensure the date filter inputs
(createdAtFrom, createdAtTo, expiresAtFrom, expiresAtTo) are
validated/normalized before adding to URLSearchParams: for each non-empty value,
parse with new Date(value) and if valid use date.toISOString(), otherwise
reject/throw or skip and surface a clear error; mirror the approach used in
oms.listUserOrders to guarantee ISO8601 formatting and prevent sending malformed
dates to the VTEX API.

In `@packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx`:
- Around line 26-34: Refactor the routes calculation to replace the nested
ternary + chained filter with a single flat filter over menuRoutes: iterate
menuRoutes once and include an entry only if (1) either isRepresentative is true
OR the route is not in ROUTES_ONLY_FOR_REPRESENTATIVE, AND (2) either
isOrgMember is true OR the route is not in ROUTES_ONLY_FOR_B2B_MEMBERS; update
the routes variable to use that single combined condition so the logic remains
the same but is flatter and more readable (referencing routes, menuRoutes,
isRepresentative, isOrgMember, ROUTES_ONLY_FOR_REPRESENTATIVE,
ROUTES_ONLY_FOR_B2B_MEMBERS).

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx`:
- Around line 158-190: The onRemoveFilter handler in MyAccountListQuotes
currently sets window.location.href which forces a full reload; switch this to
Next.js client navigation by getting the router via useRouter() inside the
MyAccountListQuotes component and call router.push(...) (or router.replace(...)
if you want no history entry) with the same constructed path/query string
instead of setting window.location.href; keep the existing logic that builds
filteredQuery and URLSearchParams, then call
router.push(`/pvt/account/quotes${params.toString() ? `?${params}` : ''}`) to
perform client-side navigation.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx`:
- Around line 54-62: The handlePageChange function currently uses
window.location.href which forces a full reload; replace this with Next.js
router navigation by importing and using useRouter() and calling router.push()
(or router.replace() if you want not to add history) to navigate to
`/pvt/account/quotes` with the updated URLSearchParams; update the logic in
handlePageChange to build the query string the same way and call router.push({
pathname: '/pvt/account/quotes', query: Object.fromEntries(params) }) (or
router.push(`/pvt/account/quotes${params.toString() ? `?${params}` : ''}`) if
you prefer string form) so pagination uses client-side routing.
- Around line 16-22: The formatAmount function creates a new Intl.NumberFormat
on each call which is slow for large lists; update formatAmount to memoize
formatters (e.g., keep a module-level Map keyed by `${locale}|${currencyCode}`
and store Intl.NumberFormat instances) and reuse the cached formatter to call
.format(amount); modify any call sites as suggested to use
formatAmount(item.amount, locale, currencyCode) (or adapt to a simplified
formatAmount(item.amount) if you centralize locale/currency defaults) so the JSX
uses the cached formatter instead of creating one per item.
- Around line 101-184: The row handlers (handleRowClick, handleRowKeyDown) are
recreated inside the listQuotes.list.map causing unnecessary re-renders; move
their logic out of the map in MyAccountListQuotesTable by creating stable
handlers (e.g., a single navigateToQuote(id) function plus a generic onRowClick
and onRowKeyDown that read the quote id from a data attribute or use a memoized
callback factory via useCallback) and update the <tr> to pass the id via data
attributes (or bind to the factory) and reuse the same handler references for
all rows to avoid creating new functions per item.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx`:
- Around line 3-13: The code unsafely asserts status as QuoteStatusKey when
reading quoteStatusMap in MyAccountQuoteStatusBadge; add a runtime type guard
(e.g., isQuoteStatusKey that checks if status exists in quoteStatusMap or keyof
typeof quoteStatusMap) and use it before indexing quoteStatusMap so you only
cast/lookup when valid, otherwise treat as unknown and rely on the fallback
(entry?.label ?? status); update the lookup logic around entry and keep the
component prop as string.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx`:
- Around line 53-76: The handleApply function currently does a full page reload
via window.location.href; replace that with Next.js navigation by importing and
using useRouter and calling router.push to navigate to '/pvt/account/quotes'
with the same query parameters (preserve how you build params from selected,
createdDateRangeRef, expiresDateRangeRef and multiple 'status' entries) so the
URL changes without a full reload; update the top of the component to get const
router = useRouter() and call router.push with either a { pathname, query }
object or a string built from params.toString(), keeping the existing param keys
(createdAtFrom/To, expiresAtFrom/To, status).

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss`:
- Around line 23-26: The CSS rule for the selector [data-fs-badge] redundantly
hides the element with both display: none and visibility: hidden; remove the
redundant visibility: hidden declaration and keep only display: none in the
[data-fs-badge] block (update the section.module.scss rule for [data-fs-badge]
accordingly).

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx`:
- Around line 42-80: The code in MyAccountQuotesSelectedTags uses non-null
assertions (createdAtTo! and expiresAtTo!) inside the JSX; refactor by computing
the label strings before rendering to avoid assertions: create local variables
(e.g., createdLabel and expiresLabel) that build the three cases using safe
checks (createdAtFrom && createdAtTo, createdAtFrom, createdAtTo) and call
formatFilterDate only when the date exists, then render those labels in the
createdTag and expiresTag JSX instead of using the `...!` assertions; apply the
same pattern for expiresAt (expiresLabel) to remove both non-null assertions.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss`:
- Around line 28-46: The styles file uses orders-specific data attributes and
custom properties that were copy-pasted into the quotes component; update
occurrences of data-fs-list-orders-controls and
data-fs-list-orders-search-filters (and any related CSS variables like
--fs-list-orders-*) to use quotes-specific names (e.g.,
data-fs-list-quotes-controls, data-fs-list-quotes-search-filters and
--fs-list-quotes-*) so the selectors in styles.module.scss and any consumers
match the quotes domain; ensure you change both selectors and CSS variable
references consistently across MyAccountListQuotes styles and any components
that read those attributes/variables (search for data-fs-list-orders- and
--fs-list-orders- to replace).

In `@packages/core/src/pages/pvt/account/quotes/index.tsx`:
- Around line 137-149: The date filter vars createdAtFrom, createdAtTo,
expiresAtFrom and expiresAtTo are initialized to empty strings and later
converted to undefined—simplify by initializing them directly from context.query
as possibly undefined (i.e., const createdAtFrom = context.query.createdAtFrom
as string | undefined, etc.) and remove the subsequent `|| undefined`
conversions where those variables are used (look for their usage in the filter
construction around lines that currently do `createdAtFrom || undefined`), so
the values flow as undefined when absent without redundant logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 181a997c-ae93-4d00-b9e5-50c1b1d309fc

📥 Commits

Reviewing files that changed from the base of the PR and between 649b754 and 7ccce86.

⛔ Files ignored due to path filters (3)
  • packages/api/src/__generated__/schema.ts is excluded by !**/__generated__/** and included by packages/**
  • packages/core/@generated/gql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
  • packages/core/@generated/graphql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
📒 Files selected for processing (19)
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
  • packages/core/src/customizations/src/myAccount/extensions/quotes/after.tsx
  • packages/core/src/customizations/src/myAccount/extensions/quotes/before.tsx
  • packages/core/src/pages/pvt/account/quotes/index.tsx
  • packages/core/src/sdk/account/getMyAccountRoutes.ts
  • packages/core/src/utils/quoteStatus.ts

@renatomaurovtex renatomaurovtex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the full diff (22 files, +1416/-6). Solid, well-structured B2B feature that reuses the existing My Account / orders patterns. Architecture boundaries are respected: @faststore/api stays GraphQL-framework-agnostic, the new quotes commerce client is a clean addition with no circular deps, and listUserQuotes is correctly gated with @auth + @cacheControl(scope: "private") for buyer-specific data. The @generated (schema.ts, gql.ts, graphql.ts) diffs look consistent with the schema/operation changes — just confirm they came from pnpm codegen and not hand edits.

A few things below — one is a functional bug in the status filter.


🟠 [bug] Status filter sends lower-cased values that won't match the platform — MyAccountListQuotes.tsx

getAllFacets builds facet values with key.toLowerCase() and getSelectedFacets stores s.toLowerCase(), so the status sent to the URL/API ends up as inreview, convertedtoorder, etc. But everything else keys off the PascalCase QuoteStatusKey (InReview, ConvertedToOrder). Two observable problems:

  1. The selected-status tag does quoteStatusMap[value as QuoteStatusKey] with a lower-cased value → lookup misses → the tag renders the raw inreview instead of In Review (MyAccountQuotesSelectedTags.tsx).
  2. The Quoting API (/api/quoting/quotes?status=...) receives lower-cased statuses, which almost certainly don't match the canonical PascalCase statuses → the status filter returns nothing.

Keep the canonical casing through the round-trip instead of lower-casing:

-      values: Object.entries(quoteStatusMap).map(([key, { label }]) => ({
-        label,
-        quantity: 0,
-        selected: false,
-        value: key.toLowerCase(),
-      })),
+      values: Object.entries(quoteStatusMap).map(([key, { label }]) => ({
+        label,
+        quantity: 0,
+        selected: false,
+        value: key,
+      })),

…and drop the matching toLowerCase() in getSelectedFacets and the onRemoveFilter status comparison so they compare canonical keys.

🟠 [bug/UX] Quote rows link to a detail page that doesn't exist yet — MyAccountListQuotesTable.tsx

Each <tr> navigates to /pvt/account/quotes/:id, but the PR body says the detail page is out of scope. As shipped, every row click/Enter lands users on a 404. Either make the rows non-interactive until the detail page exists, or ship both together. (The clickable-row + window.location + Enter-only pattern itself mirrors the orders table, so no concern there — only the dead-end destination.)

🟠 [question/data] Confirm amount is in major currency units, not cents

formatAmount feeds item.amount straight into Intl.NumberFormat({ style: 'currency' }). The PR lists this as an assumption. If /api/quoting/quotes returns cents (like order totalValue), every amount renders 100× too large. Worth verifying against a real quote before merge.

🟠 [tests] No unit tests for the testable pure logic

The "needs a live B2B env" note only covers integration. Several pieces here are pure and unit-testable without a backend: quoteStatusMap resolution + fallback (MyAccountQuoteStatusBadge), the Pagination index math, getSelectedFacets/getAllFacets/hasActiveFilters, and formatFilterDate. Per the repo's testing expectations for core behavior, please add coverage for at least these (the status-casing bug above is exactly what a test would catch).


🟡 [edge] Empty result shows an active pagination — MyAccountListQuotesTable.tsx

With total === 0, totalPages = 0, so page === totalPages is 1 === 0 → the Next button stays enabled, and the label reads 1 — 0 of 0. On desktop the top Pagination renders even in the empty state. Minor, but consider hiding pagination when total === 0.

💬 [i18n] Hardcoded English strings

All labels ("Quotes", "Filters", "Created", "Expires", "You don't have any quotes", status labels, etc.) are hardcoded. Consistent with the current orders page, so not blocking — but flagging given the in-flight My Account localization work (#3354); these will likely need to flow through the same i18n path.

💬 [robustness] listUserQuotes is nullable in the schema — pages/.../quotes/index.tsx

listUserQuotes: Maybe<UserQuoteListResult>, but the SSR props access .paging.total / .paging.perPage unguarded. In practice the resolver returns an object whenever there's no error, so this is latent — just noting it mirrors a soft assumption.


Verdict: Changes requested

Blocking (🟠):

  • Status filter lower-cases values → broken filtering + wrong selected-tag label (MyAccountListQuotes.tsx / MyAccountQuotesSelectedTags.tsx)
  • Quote rows navigate to a not-yet-existing detail route → 404 dead-end (MyAccountListQuotesTable.tsx)
  • Confirm amount units (cents vs. major) before relying on Intl.NumberFormat
  • Add unit tests for the pure logic (status map, pagination math, facet builders)

Non-blocking (🟡/💬):

  • Active pagination / 1 — 0 of 0 in the empty state
  • Hardcoded strings vs. the My Account localization effort (#3354)
  • Unguarded access to the nullable listUserQuotes

Checks to confirm before merge: pnpm lint · build · pnpm turbo run test --filter=@faststore/core --filter=@faststore/api · pnpm size (touches core) · confirm @generated came from pnpm codegen.

@pkg-pr-new

pkg-pr-new Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@faststore/api

npm i https://pkg.pr.new/vtex/faststore/@faststore/api@a794720

@faststore/cli

npm i https://pkg.pr.new/vtex/faststore/@faststore/cli@a794720

@faststore/components

npm i https://pkg.pr.new/vtex/faststore/@faststore/components@a794720

@faststore/core

npm i https://pkg.pr.new/vtex/faststore/@faststore/core@a794720

@faststore/diagnostics

npm i https://pkg.pr.new/vtex/faststore/@faststore/diagnostics@a794720

@faststore/lighthouse

npm i https://pkg.pr.new/vtex/faststore/@faststore/lighthouse@a794720

@faststore/sdk

npm i https://pkg.pr.new/vtex/faststore/@faststore/sdk@a794720

@faststore/ui

npm i https://pkg.pr.new/vtex/faststore/@faststore/ui@a794720

commit: a794720

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx (2)

52-71: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve existing non-slider query params when applying filters.

handleApply starts from an empty URLSearchParams, so applying status/date filters clears active label search unexpectedly.

💡 Suggested fix
-    const params = new URLSearchParams()
+    const params = new URLSearchParams(window.location.search)
+    params.delete('page')
+    params.delete('status')
+    params.delete('createdAtFrom')
+    params.delete('createdAtTo')
+    params.delete('expiresAtFrom')
+    params.delete('expiresAtTo')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx`
around lines 52 - 71, The handleApply function creates a new empty
URLSearchParams object, which discards any existing query parameters (such as
the label search parameter) when filters are applied. To fix this, initialize
the URLSearchParams by parsing the current URL's existing query string using
window.location.search, then apply the status and date range filter updates to
this preserved set of parameters. This ensures that applying the slider filters
does not clear other active filters like label search that were already in the
URL.

46-47: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Track date-range invalid state independently per facet.

Both date widgets write into the same disabled state. A valid update in one facet can re-enable Apply while the other facet is still invalid.

💡 Suggested fix
-  const [disabled, setDisabled] = useState(false)
+  const [createdAtInvalid, setCreatedAtInvalid] = useState(false)
+  const [expiresAtInvalid, setExpiresAtInvalid] = useState(false)
+  const disabled = createdAtInvalid || expiresAtInvalid
...
-              setDisabled={setDisabled}
+              setDisabled={setCreatedAtInvalid}
...
-              setDisabled={setDisabled}
+              setDisabled={setExpiresAtInvalid}

Also applies to: 131-145

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx`
around lines 46 - 47, The issue is that a single `disabled` state variable is
shared across multiple date widget facets, allowing one facet to become valid
and re-enable the Apply button even when another facet remains invalid. Replace
the shared `disabled` state declared at lines 46-47 with independent state
tracking for each date facet (one state per date range widget). Update the state
setters around lines 131-145 to each modify only their corresponding facet's
invalid state, and update the Apply button disabled logic to check all facet
states together to determine if it should be disabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx`:
- Around line 6-10: Rename the Props type to MyAccountQuotesStatusSelectorProps
to follow the component props naming convention. The type definition should use
the format {ComponentName}Props where ComponentName is
MyAccountQuotesStatusSelector. Update all references to the Props type to use
the new name MyAccountQuotesStatusSelectorProps throughout the component file.
- Around line 48-61: The combobox div with role="combobox" is not
programmatically associated with its visual label. Add an aria-labelledby
attribute to the combobox div that references an id on the Status label span, or
alternatively add an aria-label="Status" attribute directly to the combobox div
to provide an explicit accessible name that screen readers can announce.

---

Outside diff comments:
In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx`:
- Around line 52-71: The handleApply function creates a new empty
URLSearchParams object, which discards any existing query parameters (such as
the label search parameter) when filters are applied. To fix this, initialize
the URLSearchParams by parsing the current URL's existing query string using
window.location.search, then apply the status and date range filter updates to
this preserved set of parameters. This ensures that applying the slider filters
does not clear other active filters like label search that were already in the
URL.
- Around line 46-47: The issue is that a single `disabled` state variable is
shared across multiple date widget facets, allowing one facet to become valid
and re-enable the Apply button even when another facet remains invalid. Replace
the shared `disabled` state declared at lines 46-47 with independent state
tracking for each date facet (one state per date range widget). Update the state
setters around lines 131-145 to each modify only their corresponding facet's
invalid state, and update the Apply button disabled logic to check all facet
states together to determine if it should be disabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3a894cd8-c8b1-4b51-a059-4015b0fcf3e9

📥 Commits

Reviewing files that changed from the base of the PR and between 7ccce86 and 509f0d3.

⛔ Files ignored due to path filters (3)
  • packages/api/src/__generated__/schema.ts is excluded by !**/__generated__/** and included by packages/**
  • packages/core/@generated/gql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
  • packages/core/@generated/graphql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
📒 Files selected for processing (13)
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
  • packages/core/src/pages/pvt/account/quotes/index.tsx
🚧 Files skipped from review as they are similar to previous changes (8)
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/pages/pvt/account/quotes/index.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss (1)

1-183: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Rename stylesheet to the component name instead of a generic styles file.

styles.module.scss breaks the component-style naming contract for this directory; use the component name in the stylesheet filename for predictable ownership and discovery.
As per coding guidelines, “Component styles MUST match the component name (e.g., ProductCard.scss next to ProductCard.tsx)”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss`
around lines 1 - 183, The stylesheet file is named styles.module.scss but
violates the component-style naming convention which requires the filename to
match the component name. Rename the file from styles.module.scss to
MyAccountListQuotes.module.scss to match the component name in the directory
path and follow the coding guideline that component styles must match their
component name for predictable ownership and discovery.

Source: Coding guidelines

packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss (1)

1-50: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Rename stylesheet to match the component name contract.

section.module.scss does not follow the component-style naming rule for this path. Align it with the component name (for example, MyAccountQuotesFilterSlider.module.scss) to keep style ownership explicit and consistent.
As per coding guidelines, “Component styles MUST match the component name (e.g., ProductCard.scss next to ProductCard.tsx)”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss`
around lines 1 - 50, The stylesheet filename does not match the component name
convention. Rename section.module.scss to
MyAccountQuotesFilterSlider.module.scss to align with the component-style naming
rule where component styles must match the component name. After renaming the
file, update the import statement in the corresponding
MyAccountQuotesFilterSlider component file to reference the new filename instead
of section.module.scss.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss`:
- Around line 89-98: The selector combining `:hover`, `:focus`, and
`:focus-visible` is removing the outline on `:focus` before the `:focus-visible`
fallback is applied, which suppresses focus indicators in browsers without
`:focus-visible` support. Remove the `outline: none;` declaration from the
combined `:hover, :focus, :focus-visible` selector, keeping only the
background-color change there. The outline will then only be removed through the
dedicated `:focus-visible` rule below, which ensures a visible focus indicator
is preserved in older browsers that don't support `:focus-visible`.

---

Outside diff comments:
In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss`:
- Around line 1-50: The stylesheet filename does not match the component name
convention. Rename section.module.scss to
MyAccountQuotesFilterSlider.module.scss to align with the component-style naming
rule where component styles must match the component name. After renaming the
file, update the import statement in the corresponding
MyAccountQuotesFilterSlider component file to reference the new filename instead
of section.module.scss.

In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss`:
- Around line 1-183: The stylesheet file is named styles.module.scss but
violates the component-style naming convention which requires the filename to
match the component name. Rename the file from styles.module.scss to
MyAccountListQuotes.module.scss to match the component name in the directory
path and follow the coding guideline that component styles must match their
component name for predictable ownership and discovery.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b0d27f4c-84e1-44db-95ee-102be3446925

📥 Commits

Reviewing files that changed from the base of the PR and between 509f0d3 and 46de8e9.

⛔ Files ignored due to path filters (3)
  • packages/api/src/__generated__/schema.ts is excluded by !**/__generated__/** and included by packages/**
  • packages/core/@generated/gql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
  • packages/core/@generated/graphql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
📒 Files selected for processing (22)
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/api/test/integration/schema.test.ts
  • packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
  • packages/core/src/customizations/src/myAccount/extensions/quotes/after.tsx
  • packages/core/src/customizations/src/myAccount/extensions/quotes/before.tsx
  • packages/core/src/pages/pvt/account/quotes/index.tsx
  • packages/core/src/sdk/account/getMyAccountRoutes.ts
  • packages/core/src/utils/quoteStatus.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/api/test/integration/schema.test.ts
🚧 Files skipped from review as they are similar to previous changes (19)
  • packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts
  • packages/core/src/customizations/src/myAccount/extensions/quotes/after.tsx
  • packages/core/src/sdk/account/getMyAccountRoutes.ts
  • packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/core/src/customizations/src/myAccount/extensions/quotes/before.tsx
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/utils/quoteStatus.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/core/src/pages/pvt/account/quotes/index.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx

ArthurTriis1 and others added 7 commits June 18, 2026 09:41
BBS-1: Expose quote list via GraphQL so the frontend can fetch the
authenticated buyer's quotes from the VTEX quoting API.

- quote.graphql: UserQuoteSummary, UserQuoteListResult, UserQuoteListPaging types
- query.graphql: listUserQuotes query with @auth + @CacheControl(scope: private)
- types/Quote.ts: QuoteSummary, QuoteListResult, ListUserQuotesArgs interfaces
- commerce/index.ts: quotes.listUserQuotes() method calling GET /api/quoting/quotes
- resolvers/query.ts: listUserQuotes resolver mapping commerce result to GQL shape

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
BBS-1 + BBS-2: Authenticated buyers with an organization unit can now
view and filter their submitted quotes from /pvt/account/quotes.

- quoteStatus.ts: status→variant+label map for badge rendering
- getMyAccountRoutes: QUOTES_ROUTE + ROUTES_ONLY_FOR_B2B_MEMBERS constant
- MyAccountLayout: gates Quotes nav item behind b2b.unitId session check
- MyAccountListQuotes: page-level component with filter slider and empty state
- MyAccountListQuotesTable: quote rows with ID/label, dates, amount, status badge
- MyAccountQuoteStatusBadge: status badge using quoteStatusMap
- MyAccountQuotesFilterSlider: status + created/expiry date range filters
- MyAccountQuotesSelectedTags: active filter tag display and removal
- pages/pvt/account/quotes/index.tsx: SSR page with listUserQuotes GQL query
- customizations/extensions/quotes: before/after extension placeholders

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Add status selector with colored chips inside filter drawer
- Remove accordion from date range filters, render flat with labels
- Add active filter count badge to Filters button
- Remove selected filter tags row below the toolbar
- Separate accountProfile query to prevent 429 cascades to 404 redirect
- Style via data attributes per FastStore convention

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…and filter spacing

- Remove all createdBy filter work (searchQuoteUsers resolver, StoreQuoteUser type,
  MyAccountQuotesCreatedByFilter component, createdBy GQL arg and URL param)
- Remove debug console.log statements added during investigation
- Add label search via SearchInputField in the toolbar (debounced, ?label= URL param)
- Fix status dropdown width: wrap input+dropdown in data-fs-quotes-status-input-wrapper
  so the absolute-positioned dropdown anchors to the input width, not the padded wrapper
- Fix filter drawer section spacing: remove bottom padding from data-fs-quotes-filter-group
  so all filter sections have consistent top-only spacing
- Revert ServerListQuotesQuery persisted hash to cce44921... (without $createdBy)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Export MyAccountListQuotesProps from barrel index.ts
- Add invalid date handling to formatDateTime and formatDateShort
- Add input validation to formatFilterDate (regex + NaN guard)
- Rename Props to MyAccountQuotesStatusSelectorProps
- Add useId + aria-labelledby to associate Status label with combobox
- Rename data-fs-list-orders-* to data-fs-list-quotes-* in quotes component

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/api/src/platforms/vtex/clients/commerce/index.ts`:
- Around line 812-833: The listUserQuotes function forwards input arguments to
VTEX without proper server-side validation, and the current truthy checks
silently drop falsy values like 0 instead of validating them properly. Add
validation logic before constructing the URLSearchParams to check that page and
perPage are positive integers, that date filters are valid date strings in the
expected format, that status array contains only valid status values, and that
label is a non-empty string. Reject or throw an error for invalid values rather
than silently omitting them, ensuring all input is validated against expected
criteria before being forwarded to the VTEX platform call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b6409924-e4ba-45cb-97f4-6a76b62708b1

📥 Commits

Reviewing files that changed from the base of the PR and between 46de8e9 and 472acde.

⛔ Files ignored due to path filters (3)
  • packages/api/src/__generated__/schema.ts is excluded by !**/__generated__/** and included by packages/**
  • packages/core/@generated/gql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
  • packages/core/@generated/graphql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
📒 Files selected for processing (22)
  • packages/api/src/platforms/vtex/clients/commerce/index.ts
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/api/test/integration/schema.test.ts
  • packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/section.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
  • packages/core/src/customizations/src/myAccount/extensions/quotes/after.tsx
  • packages/core/src/customizations/src/myAccount/extensions/quotes/before.tsx
  • packages/core/src/pages/pvt/account/quotes/index.tsx
  • packages/core/src/sdk/account/getMyAccountRoutes.ts
  • packages/core/src/utils/quoteStatus.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/core/src/customizations/src/myAccount/extensions/quotes/before.tsx
🚧 Files skipped from review as they are similar to previous changes (18)
  • packages/api/test/integration/schema.test.ts
  • packages/core/src/customizations/src/myAccount/extensions/quotes/after.tsx
  • packages/api/src/platforms/vtex/clients/commerce/types/Quote.ts
  • packages/core/src/utils/quoteStatus.ts
  • packages/api/src/platforms/vtex/typeDefs/query.graphql
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountQuoteStatusBadge.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/index.ts
  • packages/api/src/platforms/vtex/typeDefs/quote.graphql
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
  • packages/core/src/sdk/account/getMyAccountRoutes.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/styles.module.scss
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/api/src/platforms/vtex/resolvers/query.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotesTable/MyAccountListQuotesTable.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/core/src/pages/pvt/account/quotes/index.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesFilterSlider/MyAccountQuotesFilterSlider.tsx

ArthurTriis1 and others added 2 commits June 18, 2026 09:59
- Fix status filter casing: use PascalCase keys throughout (was lowercased,
  breaking quoteStatusMap lookups and API filtering)
- Extract pure filter helpers to quoteFilters.ts for testability
- Add unit tests for quoteStatusMap, filter helpers, and formatFilterDate
- Hide pagination when total === 0 to avoid "1 — 0 of 0" in empty state
- Fix focus outline: remove :focus + outline:none, keep only :focus-visible
- Fix core server test: add listUserQuotes to expected QUERIES array

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Validate page/perPage as positive integers, date filters as YYYY-MM-DD,
status values against known set, and trim label — throwing on invalid
input instead of silently forwarding bad values to the VTEX API.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/core/src/components/account/quotes/MyAccountListQuotes/quoteFilters.ts`:
- Around line 72-80: The formatFilterDate function does not validate that the
parsed date components are valid calendar dates, allowing invalid inputs like
Feb 31 to be silently normalized by the Date constructor to a different month
(e.g., Mar 02). Add validation after constructing the Date object to verify that
the extracted year, month (accounting for the 0-based index), and day from the
newly created Date object match the originally parsed values. If they do not
match, it indicates date rollover occurred due to an invalid calendar date, so
return the original date string unchanged instead of the normalized date.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8bcd5ae3-194a-46ad-9439-1295347e3378

📥 Commits

Reviewing files that changed from the base of the PR and between 472acde and 14b7789.

📒 Files selected for processing (7)
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesSelectedTags/MyAccountQuotesSelectedTags.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/quoteFilters.ts
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
  • packages/core/test/components/quotes/quoteFilters.test.ts
  • packages/core/test/server/index.test.ts
💤 Files with no reviewable changes (1)
  • packages/core/src/components/account/quotes/MyAccountListQuotes/styles.module.scss
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountQuotesStatusSelector/MyAccountQuotesStatusSelector.tsx
  • packages/core/src/components/account/quotes/MyAccountListQuotes/MyAccountListQuotes.tsx

Validate that the constructed Date's year/month/day match the parsed
values to catch impossible dates like Feb 31 that the Date constructor
silently normalises to a different day.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
<span data-fs-list-orders-selected-tag-label>
{`Created: ${
createdAtFrom && createdAtTo
? `${formatFilterDate(createdAtFrom, locale)} to ${formatFilterDate(createdAtTo, locale)}`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Encadeamento de operadores ternários não é uma boa prática.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — extracted a formatDateRangeLabel helper (from/to/locale) so the from/to/both logic is a single flat if/if/return instead of a nested ternary chain. Applied to both the Created and Expires tags.

<span data-fs-list-orders-selected-tag-label>
{`Expires: ${
expiresAtFrom && expiresAtTo
? `${formatFilterDate(expiresAtFrom, locale)} to ${formatFilterDate(expiresAtTo, locale)}`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Encadeamento de operadores ternários não é uma boa prática.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — same formatDateRangeLabel helper covers this one too.

## What's the purpose of this pull request?

<!--- Considering the context, what is the problem we'll solve? Where in
VTEX's big picture our issue fits in? Write a tweet about the context
and the problem itself. --->

## How it works?

<!--- Tell us the role of the new feature, or component, in its context.
Provide details about what you have implemented and screenshots if
applicable. --->

## How to test it?

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->

## Checklist

<em>You may erase this after checking them all 😉</em>

**PR Title and Commit Messages**

- [ ] PR title and commit messages follow the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification
- Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`,
`refactor`, `ci` and `test`

**PR Description**

- [ ] Added a label according to the PR goal - `breaking change`, `bug`,
`contributing`, `performance`, `documentation`..

**Dependencies**

- [ ] Committed the `pnpm-lock.yaml` file when there were changes to the
packages

**Documentation**

- [ ] PR description
- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)

---------

Co-authored-by: Larícia Mota <[email protected]>
Co-authored-by: vtexgithubbot <[email protected]>
Co-authored-by: Sahan Jayawardana <[email protected]>
Co-authored-by: Mateus Pontes <[email protected]>
Co-authored-by: Lucas Feijó <[email protected]>
Co-authored-by: Matheus Martins <[email protected]>
Co-authored-by: renatomaurovtex <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Arthur Andrade <[email protected]>
Co-authored-by: Matheus P. Silva <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
Co-authored-by: Luiz Falcão <[email protected]>
Co-authored-by: Artur Santiago <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Thiago Pereira <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Giuliana Rigaud <[email protected]>
Co-authored-by: renato <[email protected]>
Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: BrunaCubos <[email protected]>
Co-authored-by: Ícaro Oliveira <[email protected]>
Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: Everton Ataide <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Otavio Moreira Meirelles <[email protected]>
Co-authored-by: Marco Cardoso <[email protected]>
Co-authored-by: Gabriel Paladino <[email protected]>
Co-authored-by: CodeRabbit <[email protected]>
Co-authored-by: dk-portal[bot] <134092483+dk-portal[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Tavares <[email protected]>
Co-authored-by: vitorflg <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Válber Laux <[email protected]>
Co-authored-by: Felipe Sales <[email protected]>

@rodrigo-tavares rodrigo-tavares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking (3): BBS-2 nav gating only in MyAccountLayout — Quotes leaks in Layout/org drawer. N+1 MasterData for createdBy. Drawer apply drops active label search.

Suggestions: SSR unitId gate, null-guard listUserQuotes, API unit tests.

ArthurTriis1 and others added 4 commits July 3, 2026 10:19
- Apply ROUTES_ONLY_FOR_B2B_MEMBERS gate in OrganizationDrawerBody
  (was only applied in MyAccountLayout, exposing Quotes nav in the
  org drawer to non-org members)
- Dedupe/batch masterData.getShopperById lookups in listUserQuotes
  resolver instead of one call per row (N+1)
- Preserve ?label= when applying quote filters (was dropped on
  handleApply)
- Guard against nullable listUserQuotes in SSR props and in
  MyAccountListQuotes
- Extract formatDateRangeLabel helper to remove chained ternaries
  in MyAccountQuotesSelectedTags
- Add unit tests for listUserQuotes client-side input validation

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Adds a Query.isOrganizationMember field (resolved via the existing
commerce.session() client, same source already used by userDetails/
accountProfile for authentication.unitId) and uses it in the quotes
page's getServerSideProps to redirect non-org members to
/pvt/account/403 on direct URL access, instead of relying solely on
the client-side nav filter.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
# Conflicts:
#	packages/core/src/components/account/Drawer/OrganizationDrawer/OrganizationDrawerBody.tsx
#	packages/core/src/components/account/MyAccountLayout/MyAccountLayout.tsx
The row click navigating to order-entry isn't ready for this first
rollout. Removes the click/keyboard handlers and focus affordance,
keeping the hover highlight.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
ArthurTriis1 and others added 4 commits July 3, 2026 15:22
URLSearchParams encodes spaces as "+", not "%20" — the test asserted
the wrong encoding, causing CI to fail (caught by GitHub Actions).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Missed this second QUERIES list (packages/core/test/server/index.test.ts)
when isOrganizationMember was added to the schema — CI caught it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Lint/quality fixes (SonarQube "New Issues" gate):
- window -> globalThis, isNaN -> Number.isNaN
- Mark component props as Readonly
- Extract validateListUserQuotesArgs/buildListUserQuotesParams from
  listUserQuotes to reduce cognitive complexity (22 -> under 15)
- Use optional chaining, default imports, Math.min() over ternary
- Remove combobox/listbox ARIA roles that weren't a full combobox
  implementation (no keyboard nav/aria-activedescendant), replaced
  with a plain accessible checkbox list
- Remove unused import, simplify a nested template literal

Test coverage (SonarQube "Coverage on New Code" gate, was 21%):
- Unit tests for the listUserQuotes/isOrganizationMember resolvers
  (createdBy dedupe, shopper lookup fallback, session-based check)
- Component tests for the quotes list, table, filter slider, status
  selector/badge and selected tags
- Tests for the B2B route gating in Layout and OrganizationDrawerBody
- Tests for getMyAccountRoutes label overriding and route filtering

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Removing role="combobox"/"listbox" earlier left the trigger div with
onClick/onKeyDown/tabIndex but no role, which Sonar correctly flagged
(non-native interactive element, tabIndex without a role). Splitting
the toggle into its own native <button>, sibling to the chips instead
of wrapping them, gives a real interactive element without nesting a
button inside a button (the chip remove controls are buttons too).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@sonar-workflows

Copy link
Copy Markdown

@ArthurTriis1
ArthurTriis1 merged commit a6c1ef6 into dev Jul 3, 2026
9 checks passed
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.

5 participants