Skip to content

Comments

feat: add budget to order details#3130

Merged
eduardoformiga merged 10 commits intodevfrom
feat/add-budget-to-order-details
Feb 6, 2026
Merged

feat: add budget to order details#3130
eduardoformiga merged 10 commits intodevfrom
feat/add-budget-to-order-details

Conversation

@ArthurTriis1
Copy link
Contributor

@ArthurTriis1 ArthurTriis1 commented Nov 21, 2025

What's the purpose of this pull request?

No contexto do B2B FastStore, clientes corporativos precisam visualizar informações sobre os budgets alocados em seus pedidos para ter transparência sobre como os orçamentos foram utilizados. Atualmente, essas informações não estão disponíveis na página de detalhes do pedido no My Account, dificultando o acompanhamento financeiro e a gestão de budgets pelos compradores B2B.

Esta implementação adiciona a exibição dos budgets alocados diretamente na página de detalhes do pedido, seguindo o mesmo padrão visual dos outros cards informativos (Payment, Delivery, Summary, etc.), proporcionando uma experiência consistente e completa para os usuários B2B.

How it works?

Esta feature adiciona um novo card MyAccountBudgetsCard na página de detalhes do pedido (/pvt/account/orders/[id]) que exibe informações sobre os budgets alocados ao pedido.

Implementação técnica:

  1. GraphQL Schema (packages/api/src/typeDefs/userOrder.graphql):

    • Adicionados novos tipos GraphQL para representar a estrutura de dados de budgets:
      • UserOrderBudgetData: Container principal com lista de budgets
      • UserOrderBudget: Informações do budget (id, name, unitId, cycleConfiguration, balance, allocations)
      • UserOrderBudgetAllocation: Informações de alocação específica (linkedEntity, balance, reservations, ToBeSpent)
      • UserOrderBudgetBalance: Valores financeiros (amount, balanceAdjustment, remaining)
      • UserOrderBudgetCycleConfiguration: Configuração do ciclo do budget
    • Campo budgetData adicionado aos tipos UserOrder e UserOrderResult
  2. API Layer (packages/api/src/platforms/vtex/resolvers/query.ts):

    • O resolver userOrder agora retorna o campo budgetData diretamente da API VTEX OMS
    • Os dados são obtidos através do endpoint /api/oms/user/orders/${orderId} que já retorna essas informações
  3. Componente React (packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/):

    • Novo componente MyAccountBudgetsCard criado seguindo o padrão dos outros cards do My Account
    • Exibe uma tabela com as seguintes colunas:
      • Name: Nome do budget (truncado se > 20 caracteres) e IDs das allocations relacionadas
      • Available: Valor disponível do budget (baseado na maior allocation)
      • To be spent: Valor a ser gasto (balanceAdjustment)
      • Remaining: Valor restante após o gasto
    • O componente processa múltiplos budgets e suas allocations, selecionando a allocation com maior valor de balance para exibição
    • Renderização condicional: o card só é exibido se budgetData existir e contiver budgets com allocations válidas
  4. Integração (packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx):

    • O componente MyAccountBudgetsCard foi integrado na página de detalhes do pedido
    • Posicionado após o MyAccountSummaryCard e antes dos accordions de delivery options
    • Renderização condicional baseada na existência de order.budgetData
  5. Query GraphQL (packages/core/src/pages/pvt/account/orders/[id].tsx):

    • Adicionado o fragment budgetData na query ServerOrderDetailsQuery para buscar todas as informações necessárias dos budgets

Comportamento:

  • O card só aparece quando há budgets alocados ao pedido
  • Valores são formatados usando a moeda do pedido (currencyCode)
  • Se não houver budgets ou allocations válidas, o card não é renderizado (fail-safe)
Screenshot 2025-12-10 at 10 14 45

How to test it?

Pré-requisitos:

  • Ter acesso a uma conta VTEX B2B com budgets configurados
  • Ter um pedido que utilize budgets alocados

Passos para teste:

  1. Configurar ambiente de desenvolvimento:

    pnpm install
    pnpm dev
  2. Acessar a página de detalhes do pedido:

    • Fazer login no My Account
    • Navegar para /pvt/account/orders
    • Selecionar um pedido que tenha budgets alocados
  3. Verificar a exibição do card de budgets:

    • O card "Budgets" deve aparecer após o card "Summary"
    • Verificar se os valores estão sendo exibidos corretamente:
      • Nome do budget truncado corretamente se > 20 caracteres
      • Valores formatados na moeda correta
      • IDs das allocations exibidos na linha secundária do nome
    • Verificar se os cálculos estão corretos:
      • Available: valor disponível
      • To be spent: valor do balanceAdjustment
      • Remaining: valor restante
  4. Testar casos edge:

    • Pedido sem budgets: o card não deve aparecer
    • Budget sem allocations: o card não deve aparecer
    • Múltiplos budgets: todos devem ser exibidos na tabela
  5. Verificar responsividade:

    • Testar em diferentes tamanhos de tela
    • Verificar se a tabela se adapta corretamente

Starters Deploy Preview

References

Task relacionada:

  • B2BTEAM-2726 - Exibir budgets alocados no detalhe do pedido do myaccount

Documentação:

Relacionado:

  • B2BTEAM-2724 - Task relacionada que serviu de referência para esta implementação

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits 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)

Summary by CodeRabbit

  • New Features
    • Order details pages now display comprehensive budget information including allocated budgets with cycle dates and auto-reset options, current balance amounts, reserved amounts across allocations, calculated available funds, balance adjustments, and enhanced responsive table layouts optimized for mobile and desktop viewing.

@ArthurTriis1 ArthurTriis1 requested a review from a team as a code owner November 21, 2025 17:22
@ArthurTriis1 ArthurTriis1 requested review from ommeirelles and renatamottam and removed request for a team November 21, 2025 17:22
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 21, 2025

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.

@ArthurTriis1 ArthurTriis1 added the enhancement New feature or request label Nov 21, 2025
@ArthurTriis1 ArthurTriis1 force-pushed the feat/add-budget-to-order-details branch 3 times, most recently from 096568a to 5f27366 Compare November 21, 2025 17:44
@ArthurTriis1 ArthurTriis1 marked this pull request as draft November 21, 2025 18:08
@ArthurTriis1 ArthurTriis1 self-assigned this Dec 4, 2025
@ArthurTriis1 ArthurTriis1 marked this pull request as ready for review December 10, 2025 13:15
eduardoformiga and others added 2 commits February 3, 2026 12:43
## What's the purpose of this pull request?

Generate a new stable version. 



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- New Features
- SEO: Product price amount meta tag now supports fixed fraction digits,
configurable via PDP SEO settings.

- Documentation
  - Updated changelogs with new development release entries.
  - Refreshed CLI README to reflect the latest development version.

- Chores
- Bumped package versions across the suite to new development releases.
- Aligned internal dependencies with corresponding development versions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br>
Co-authored-by: Matheus P. Silva <cout.matheusps@gmail.com>
Co-authored-by: Leandro Rodrigues <leandro.swf@gmail.com>
Co-authored-by: vtexgithubbot <vtexgithubbot@github.com>
Co-authored-by: Lucas Feijó <lucas.portela@vtex.com>
Co-authored-by: Luiz Falcão <39093175+llfalcao@users.noreply.github.com>
Co-authored-by: Artur Santiago <artur.santiago@cubos.io>
Co-authored-by: Sahan Jayawardana <sahan@clouda.io>
Co-authored-by: Mateus Pontes <mateuspo10@gmail.com>
Co-authored-by: Matheus Martins <mathews_2010@outlook.com>
Co-authored-by: renatomaurovtex <167437775+renatomaurovtex@users.noreply.github.com>
Co-authored-by: Leandro Rodrigues <leandro.rodrigues@vtex.com>
Co-authored-by: Fanny Chien <fanny.chien@vtex.com>
Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

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

Nice! I left some comments along with the review 😉

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

The PR adds budget data exposure to user orders through GraphQL schema enhancements, a new React component for displaying budgets with responsive styling, and integration into the order details page with expanded query support.

Changes

Cohort / File(s) Summary
GraphQL Schema & Resolver
packages/api/src/typeDefs/userOrder.graphql, packages/api/src/platforms/vtex/resolvers/query.ts
Added budgetData field to UserOrder, UserOrderResult, and UserOrderFromListMinimal types. Introduced new types for budget structures: UserOrderBudgetData, UserOrderBudget, UserOrderBudgetCycleConfiguration, UserOrderBudgetBalance, UserOrderBudgetAllocation, and UserOrderBudgetAllocationLinkedEntity. Updated resolver to return budgetData with fallback default.
Budget Display Component
packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx, packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/index.ts, packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/styles.scss
Created MyAccountBudgetsCard component with budget table rendering, calculation logic for available/to-be-spent/remaining amounts, and comprehensive responsive styling with mobile-first design token usage.
Order Details Integration
packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx, packages/core/src/components/account/orders/MyAccountOrderDetails/section.module.scss
Integrated MyAccountBudgetsCard into MyAccountOrderDetails with conditional rendering. Added grid layout styling to span budgets card across full width at Notebook breakpoint.
Query Enhancement
packages/core/src/pages/pvt/account/orders/[id].tsx
Expanded GraphQL query to fetch budgetData including budget details, cycle configuration, balance information, and allocations with linkedEntity references.
Documentation
packages/cli/README.md
Restructured CLI documentation with Installation and Commands sections, improved formatting, and added version command example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • renatomaurovtex

Poem

✨ Budgets bloom on order display,
Responsive cards now light the way,
With allocations neatly stacked up high,
FastStore's details reach the sky! 💰

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding budget information to the order details page. It accurately reflects the PR's primary objective.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-budget-to-order-details

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 and usage tips.

@ArthurTriis1 ArthurTriis1 force-pushed the feat/add-budget-to-order-details branch from ba46cad to 78c07ca Compare February 6, 2026 19:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@packages/api/src/typeDefs/userOrder.graphql`:
- Around line 813-819: Rename the PascalCase field ToBeSpent to camelCase
toBeSpent in the GraphQL type UserOrderBudgetAllocation to match existing fields
like linkedEntity and cycleConfiguration; update any resolvers or field mappings
that reference UserOrderBudgetAllocation.ToBeSpent to return the value under
toBeSpent (or add an alias/resolver that maps the old name to the new field) so
schema consumers and future resolvers use the camelCase field name consistently.

In
`@packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx`:
- Line 103: The code in MyAccountBudgetsCard uses a falsy check on available
which renders '—' for 0; update the conditional to explicitly check for
null/undefined (or use Number.isFinite) so zero is treated as a valid value:
e.g. render formatPrice(available, currencyCode) when available is not
null/undefined (or Number.isFinite(available)), otherwise render '—'. Locate the
usage of available and formatPrice in MyAccountBudgetsCard and replace the
truthy check with the explicit check.
- Around line 74-77: The MyAccountBudgetsCard component contains hardcoded UI
strings ("Budgets", "Name", "Available", "To be spent", "Remaining"); change it
to read these labels from CMS-config or from props passed by the parent (e.g.,
add a labels/strings prop to MyAccountBudgetsCard or map to the section content
keys used by your sections.json/content-types.json), replace the hardcoded <div>
texts with the prop/CMS values, and provide sensible defaults (or update the
parent to pass CMS-provided values) so localization and central configuration
are used instead of inline literals.
🧹 Nitpick comments (4)
packages/api/src/platforms/vtex/resolvers/query.ts (1)

486-486: Fallback { budgets: [] } makes the parent conditional always truthy.

The resolver always returns a non-null budgetData, so the guard in MyAccountOrderDetails.tsx (order.budgetData && ...) will always pass — even for non-B2B orders. The card component handles this internally by returning null, so there's no visual bug, but you could return null here instead and let the parent conditional work as intended:

♻️ Suggested tweak
-        budgetData: order.budgetData ?? { budgets: [] },
+        budgetData: order.budgetData ?? null,

This way MyAccountBudgetsCard won't even mount for orders without budget data.

packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx (2)

105-109: Redundant ternary — both branches produce the same result.

formatPrice(toBeSpent, currencyCode) already handles 0 correctly, so the conditional is unnecessary.

♻️ Simplify
                  <div data-fs-budgets-to-be-spent>
-                    {toBeSpent !== 0
-                      ? formatPrice(toBeSpent, currencyCode)
-                      : formatPrice(0, currencyCode)}
+                    {formatPrice(toBeSpent, currencyCode)}
                  </div>

70-119: Table-like layout uses only <div>s — screen readers won't announce it as a table.

For accessibility, consider adding ARIA roles (role="table", role="rowgroup", role="row", role="columnheader", role="cell") to the respective <div> elements — or switch to semantic <table> / <thead> / <tbody> / <tr> / <th> / <td> elements. This ensures assistive technology can navigate the budget data meaningfully.

As per coding guidelines, "Use semantic HTML and proper ARIA labels for accessibility".

packages/api/src/typeDefs/userOrder.graphql (1)

817-817: Define a typed GraphQL type for reservations instead of using JSONObject.

The reservations field has a known structure: an object with numeric values (demonstrated by the frontend code that sums them). Replacing JSONObject with a proper type (e.g., input ReservationData { [key: String]: Float } or a concrete type) would:

  • Eliminate runtime type validation in the frontend
  • Provide compile-time type safety for TypeScript consumers
  • Better document the expected structure

If the shape is truly stable, this refactor improves maintainability without adding complexity.

Comment on lines +813 to +819
type UserOrderBudgetAllocation {
id: String
linkedEntity: UserOrderBudgetAllocationLinkedEntity
balance: UserOrderBudgetBalance
reservations: JSONObject
ToBeSpent: Float
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== References to ToBeSpent ==="
rg -n 'ToBeSpent' --type-add 'gql:*.graphql' --type-add 'tsx:*.tsx' --type-add 'ts:*.ts'

echo ""
echo "=== References to toBeSpent (camelCase) ==="
rg -n 'toBeSpent' --type-add 'gql:*.graphql' --type-add 'tsx:*.tsx' --type-add 'ts:*.ts'

Repository: vtex/faststore

Length of output: 1731


🏁 Script executed:

#!/bin/bash
echo "=== GraphQL queries referencing UserOrderBudgetAllocation ==="
rg -A 10 'UserOrderBudgetAllocation' --type graphql

echo ""
echo "=== Check the userOrder.graphql file around the type definition ==="
sed -n '800,850p' packages/api/src/typeDefs/userOrder.graphql

Repository: vtex/faststore

Length of output: 732


🏁 Script executed:

#!/bin/bash
echo "=== Search for UserOrderBudgetAllocation in all files ==="
rg -n 'UserOrderBudgetAllocation' 

echo ""
echo "=== Check for GraphQL fragments or queries that might use budget fields ==="
rg -n -B 5 -A 5 'budget|Budget' packages/api/src/typeDefs/userOrder.graphql | head -100

echo ""
echo "=== Look for resolver files that handle UserOrderBudgetAllocation ==="
find packages/api/src -name '*resolver*' -o -name '*budget*' | head -20

Repository: vtex/faststore

Length of output: 3394


🏁 Script executed:

#!/bin/bash
echo "=== Check resolver implementations for UserOrderBudgetAllocation ==="
find packages/api/src/platforms -name '*.ts' -exec rg -l 'budget|Budget' {} \;

echo ""
echo "=== Look at resolver structure for userOrder ==="
find packages/api/src/platforms -type f -name '*.ts' | xargs rg -l 'userOrder|UserOrder' | head -5

echo ""
echo "=== Verify other field names in related types for camelCase consistency ==="
sed -n '787,825p' packages/api/src/typeDefs/userOrder.graphql

Repository: vtex/faststore

Length of output: 1324


🏁 Script executed:

#!/bin/bash
echo "=== Check userOrder resolver for budget-related code ==="
cat packages/api/src/platforms/vtex/resolvers/userOrder.ts

Repository: vtex/faststore

Length of output: 7556


🏁 Script executed:

#!/bin/bash
echo "=== Check query resolver for budget field handling ==="
rg -n -B 5 -A 10 'budget|Budget' packages/api/src/platforms/vtex/resolvers/query.ts | head -150

Repository: vtex/faststore

Length of output: 602


🏁 Script executed:

#!/bin/bash
echo "=== Check if budgetData is actually being used in any queries ==="
rg -n 'budgetData' packages/core/src --type tsx --type ts | head -20

echo ""
echo "=== Search for any OMS or upstream integration that might provide ToBeSpent ==="
rg -n 'ToBeSpent|to.*[Bb]e.*[Ss]pent' packages/api/src/platforms -A 2 -B 2

Repository: vtex/faststore

Length of output: 249


🏁 Script executed:

#!/bin/bash
echo "=== Search for budgetData usage in core package ==="
find packages/core/src -type f \( -name "*.ts" -o -name "*.tsx" \) -exec rg -l 'budgetData' {} \;

echo ""
echo "=== Search more broadly for budget references ==="
rg -n 'budgetData' packages/core/src

echo ""
echo "=== Check if there are any queries that select budgetData field ==="
rg -n 'budgetData|allocations' packages/core/src -A 1 -B 1 | head -50

Repository: vtex/faststore

Length of output: 7270


🏁 Script executed:

#!/bin/bash
echo "=== Get the full budget query from [id].tsx ==="
sed -n '260,280p' packages/core/src/pages/pvt/account/orders/[id].tsx

Repository: vtex/faststore

Length of output: 424


🏁 Script executed:

#!/bin/bash
echo "=== Check if ToBeSpent is ever selected in any GraphQL query ==="
find packages -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.graphql" \) -exec grep -l 'ToBeSpent\|toBeSpent' {} \;

echo ""
echo "=== Look at the generated types to see if ToBeSpent is optional or required ==="
sed -n '1765,1780p' packages/core/@generated/graphql.ts

Repository: vtex/faststore

Length of output: 1005


Rename ToBeSpent to toBeSpent for camelCase consistency with GraphQL conventions.

Every other field in the budget types uses camelCase (linkedEntity, cycleConfiguration, carryOverBalance, autoResetOnPeriodEnd). ToBeSpent is the sole PascalCase outlier.

Note: The field is currently unused in queries (not selected in the [id].tsx query), so renaming is safe. If exposed via resolver in the future, map the resolver to handle the field name.

Suggested fix
 type UserOrderBudgetAllocation {
   id: String
   linkedEntity: UserOrderBudgetAllocationLinkedEntity
   balance: UserOrderBudgetBalance
   reservations: JSONObject
-  ToBeSpent: Float
+  toBeSpent: Float
 }
🤖 Prompt for AI Agents
In `@packages/api/src/typeDefs/userOrder.graphql` around lines 813 - 819, Rename
the PascalCase field ToBeSpent to camelCase toBeSpent in the GraphQL type
UserOrderBudgetAllocation to match existing fields like linkedEntity and
cycleConfiguration; update any resolvers or field mappings that reference
UserOrderBudgetAllocation.ToBeSpent to return the value under toBeSpent (or add
an alias/resolver that maps the old name to the new field) so schema consumers
and future resolvers use the camelCase field name consistently.

Comment on lines +74 to +77
<div data-fs-budgets-header-name>Name</div>
<div data-fs-budgets-header-available>Available</div>
<div data-fs-budgets-header-to-be-spent>To be spent</div>
<div data-fs-budgets-header-remaining>Remaining</div>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, examine the MyAccountBudgetsCard file to see the full context
cat -n packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx | head -100

Repository: vtex/faststore

Length of output: 4272


🏁 Script executed:

#!/bin/bash
# Check for i18n patterns in MyAccount-related components
rg -n 'useIntl|formatMessage|FormattedMessage|intl\.|useTranslation' packages/core/src/components/account/ -g '*.tsx' | head -30

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Search for how "Name", "Available" etc. are handled elsewhere in the codebase
rg -n '"Name"|"Available"|"To be spent"|"Remaining"' packages/core/src/components/account/ -g '*.tsx' | head -20

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check MyAccountCard to see if it processes the title prop
cat -n packages/core/src/components/account/components/MyAccountCard/MyAccountCard.tsx | head -100

Repository: vtex/faststore

Length of output: 458


🏁 Script executed:

#!/bin/bash
# Look for other MyAccount card components to see if they also use hardcoded strings
fd -e tsx packages/core/src/components/account/orders/MyAccountOrderDetails/ | head -20

Repository: vtex/faststore

Length of output: 627


🏁 Script executed:

#!/bin/bash
# Check other card files in the same directory
ls -la packages/core/src/components/account/orders/MyAccountOrderDetails/

Repository: vtex/faststore

Length of output: 1191


🏁 Script executed:

#!/bin/bash
# Check MyAccountPaymentCard for hardcoded strings
cat -n packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentCard.tsx | head -80

Repository: vtex/faststore

Length of output: 2708


🏁 Script executed:

#!/bin/bash
# Check MyAccountDeliveryCard for hardcoded strings
cat -n packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/MyAccountDeliveryCard.tsx | head -80

Repository: vtex/faststore

Length of output: 1814


🏁 Script executed:

#!/bin/bash
# Search for how "Budgets" title is used - check if it's referenced in CMS or i18n anywhere
rg -i 'budgets' packages/core/src/components/account/ --type tsx | grep -i 'title\|message\|label' | head -20

Repository: vtex/faststore

Length of output: 85


🏁 Script executed:

#!/bin/bash
# Look for sections.json files in the account/orders area
fd -e json . packages/core/src/components/account/orders/ | grep -i section

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Search for any CMS or sections configuration at the root level
fd -e json . packages/core/ | grep -i 'section\|cms\|i18n' | head -20

Repository: vtex/faststore

Length of output: 186


🏁 Script executed:

#!/bin/bash
# Check if there's a locale or translation config in the project
find packages/core -name '*i18n*' -o -name '*locale*' -o -name '*translation*' 2>/dev/null | head -20

Repository: vtex/faststore

Length of output: 110


🏁 Script executed:

#!/bin/bash
# Check the i18n pattern in profile
cat packages/core/src/components/account/profile/i18n.ts

Repository: vtex/faststore

Length of output: 183


🏁 Script executed:

#!/bin/bash
# Search sections.json for MyAccountOrderDetails or Budgets references
rg -i 'budgets|myaccountorder|delivery|payment' packages/core/cms/faststore/sections.json -A 3 -B 1

Repository: vtex/faststore

Length of output: 792


🏁 Script executed:

#!/bin/bash
# Check if there's an i18n file in the orders directory
find packages/core/src/components/account/orders -name '*i18n*' -o -name '*locale*'

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check the full profile i18n usage - how is it imported and used?
rg -n 'i18n\|strings' packages/core/src/components/account/profile/ -A 2

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check if MyAccountOrderDetails or any parent component imports i18n
rg -n 'i18n\|useIntl\|import.*string' packages/core/src/components/account/orders/MyAccountOrderDetails/ -g '*.tsx'

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Look for how content-types.json defines these components
rg -i 'myaccountbudget|myaccountorder' packages/core/cms/faststore/content-types.json -A 10 -B 2

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check if there's any i18n or translation mechanism being used for the order details page
rg -n 'useIntl|formatMessage|FormattedMessage|i18n\.|translation' packages/core/src/components/account/orders/ -g '*.tsx'

Repository: vtex/faststore

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check the MyAccountOrderDetails parent component to see how it's structured
cat -n packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx | head -150

Repository: vtex/faststore

Length of output: 5502


🏁 Script executed:

#!/bin/bash
# Search for where MyAccountBudgetsCard is used - maybe the parent handles localization
rg -n 'MyAccountBudgetsCard' packages/core/src/ -g '*.tsx' -B 5 -A 5

Repository: vtex/faststore

Length of output: 6418


Move hardcoded UI text to CMS configuration or component props.

The strings "Budgets", "Name", "Available", "To be spent", and "Remaining" are hardcoded instead of being sourced from CMS configuration. Per FastStore's pattern, UI text should come from CMS (sections.json, content-types.json) rather than hardcoded defaults, ensuring all localization is centralized and manageable. Either extract these to CMS config or pass them as props from the parent component.

🤖 Prompt for AI Agents
In
`@packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx`
around lines 74 - 77, The MyAccountBudgetsCard component contains hardcoded UI
strings ("Budgets", "Name", "Available", "To be spent", "Remaining"); change it
to read these labels from CMS-config or from props passed by the parent (e.g.,
add a labels/strings prop to MyAccountBudgetsCard or map to the section content
keys used by your sections.json/content-types.json), replace the hardcoded <div>
texts with the prop/CMS values, and provide sensible defaults (or update the
parent to pass CMS-provided values) so localization and central configuration
are used instead of inline literals.

@ArthurTriis1 ArthurTriis1 changed the base branch from main to dev February 6, 2026 19:44
@ArthurTriis1 ArthurTriis1 changed the base branch from dev to main February 6, 2026 19:45
@eduardoformiga eduardoformiga changed the base branch from main to dev February 6, 2026 20:06
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx`:
- Around line 70-114: The div-based table in MyAccountBudgetsCard should expose
a proper tabular structure for assistive tech: update the JSX in
MyAccountBudgetsCard (the container using budgetRows) to either convert the divs
to semantic table elements (<table>/<thead>/<tbody>/<tr>/<th>/<td>) or, if
keeping divs, add ARIA roles and attributes—role="table" on the outer container,
role="rowgroup" on the header/body wrappers, role="row" on each budget row,
role="columnheader" on the header cells (Name/Available/To be spent/Remaining)
and role="cell" on each data cell, and ensure header cells have
aria-colindex/aria-rowindex or use aria-labelledby on cells to reference their
headers; keep existing identifiers like MyAccountCard, budgetRows, budget.id,
budget.name, allocationIds, formatPrice and currencyCode when making the changes
so behavior and formatting remain unchanged.
🧹 Nitpick comments (2)
packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx (2)

101-105: Redundant ternary — both branches produce the same result.

toBeSpent !== 0 ? formatPrice(toBeSpent, currencyCode) : formatPrice(0, currencyCode) simplifies to formatPrice(toBeSpent, currencyCode) since when the condition is false, toBeSpent is already 0.

♻️ Simplify
                  <div data-fs-budgets-to-be-spent>
-                    {toBeSpent !== 0
-                      ? formatPrice(toBeSpent, currencyCode)
-                      : formatPrice(0, currencyCode)}
+                    {formatPrice(toBeSpent, currencyCode)}
                  </div>

46-46: Prefer ?? 0 over || 0 for numeric fallback.

|| 0 would also replace NaN, false, and "" with 0. While unlikely to cause a real bug here, ?? 0 (nullish coalescing) is the idiomatic and semantically correct choice for defaulting nullable numbers.

♻️ Fix
-      const remaining = budget.balance?.remaining || 0
+      const remaining = budget.balance?.remaining ?? 0

Comment on lines +70 to +114
return (
<MyAccountCard title="Budgets" data-fs-order-budgets-card>
<div data-fs-budgets-table>
<div data-fs-budgets-table-header>
<div data-fs-budgets-header-name>Name</div>
<div data-fs-budgets-header-available>Available</div>
<div data-fs-budgets-header-to-be-spent>To be spent</div>
<div data-fs-budgets-header-remaining>Remaining</div>
</div>
<div data-fs-budgets-table-body>
{budgetRows.map(
(
{ budget, allocationIds, toBeSpent, remaining, available },
index
) => {
const budgetName = budget.name || ''
const allocationsList = allocationIds || ''

return (
<div data-fs-budgets-row key={budget.id || index}>
<div data-fs-budgets-name>
<div data-fs-budgets-name-primary>{budgetName}</div>
<div data-fs-budgets-name-secondary title={allocationsList}>
{allocationsList}
</div>
</div>
<div data-fs-budgets-available>
{Number.isFinite(available)
? formatPrice(available, currencyCode)
: '—'}
</div>
<div data-fs-budgets-to-be-spent>
{toBeSpent !== 0
? formatPrice(toBeSpent, currencyCode)
: formatPrice(0, currencyCode)}
</div>
<div data-fs-budgets-remaining>
<strong>{formatPrice(remaining, currencyCode)}</strong>
</div>
</div>
)
}
)}
</div>
</div>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Accessibility: div-based table needs ARIA roles for screen readers.

This renders a data table using plain <div> elements. Screen readers won't convey the tabular relationship between headers and cells. Add ARIA table roles or switch to semantic <table> / <thead> / <tbody> / <tr> / <th> / <td> elements.

At minimum, add roles to the existing div structure:

♿ Proposed ARIA role additions
-      <div data-fs-budgets-table>
-        <div data-fs-budgets-table-header>
-          <div data-fs-budgets-header-name>Name</div>
-          <div data-fs-budgets-header-available>Available</div>
-          <div data-fs-budgets-header-to-be-spent>To be spent</div>
-          <div data-fs-budgets-header-remaining>Remaining</div>
+      <div data-fs-budgets-table role="table" aria-label="Budgets">
+        <div data-fs-budgets-table-header role="row">
+          <div data-fs-budgets-header-name role="columnheader">Name</div>
+          <div data-fs-budgets-header-available role="columnheader">Available</div>
+          <div data-fs-budgets-header-to-be-spent role="columnheader">To be spent</div>
+          <div data-fs-budgets-header-remaining role="columnheader">Remaining</div>
         </div>
-        <div data-fs-budgets-table-body>
+        <div data-fs-budgets-table-body role="rowgroup">

And for each row:

-                <div data-fs-budgets-row key={budget.id || index}>
-                  <div data-fs-budgets-name>
+                <div data-fs-budgets-row key={budget.id || index} role="row">
+                  <div data-fs-budgets-name role="cell">

(same role="cell" for the available, to-be-spent, and remaining cells)

🤖 Prompt for AI Agents
In
`@packages/core/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx`
around lines 70 - 114, The div-based table in MyAccountBudgetsCard should expose
a proper tabular structure for assistive tech: update the JSX in
MyAccountBudgetsCard (the container using budgetRows) to either convert the divs
to semantic table elements (<table>/<thead>/<tbody>/<tr>/<th>/<td>) or, if
keeping divs, add ARIA roles and attributes—role="table" on the outer container,
role="rowgroup" on the header/body wrappers, role="row" on each budget row,
role="columnheader" on the header cells (Name/Available/To be spent/Remaining)
and role="cell" on each data cell, and ensure header cells have
aria-colindex/aria-rowindex or use aria-labelledby on cells to reference their
headers; keep existing identifiers like MyAccountCard, budgetRows, budget.id,
budget.name, allocationIds, formatPrice and currencyCode when making the changes
so behavior and formatting remain unchanged.

@eduardoformiga eduardoformiga merged commit f109b02 into dev Feb 6, 2026
5 of 6 checks passed
@eduardoformiga eduardoformiga deleted the feat/add-budget-to-order-details branch February 6, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants