Skip to content

Conversation

@icaroov
Copy link
Collaborator

@icaroov icaroov commented Nov 12, 2025

What's the purpose of this pull request?

This pull request introduces a new file upload and CSV parsing feature to the components package, including reusable hooks and UI components. The main changes are the addition of a FileUploadCard component for uploading files, a useCSVParser hook for parsing CSV files in a web worker, and a useFileUpload hook for managing file upload errors and validation. These new utilities are exported for use in other parts of the application.

This PR it was created from #3109

How it works?

New hooks and utilities:

  • Added useCSVParser hook for parsing CSV files in a web worker, with error handling and CSV template generation.
  • Added useFileUpload hook to manage file upload errors, validation, and rejection reasons.
  • Exported new hooks from the hooks index for easier consumption.
  • Added type exports for CSV parsing to the main index file.

New UI components:

  • Added FileUploadCard component for file selection, drag-and-drop, and template download, with error state and file validation.
  • Added exports for FileUploadCard and FileUploadStatus components and their types.

Dependency updates:

  • Added papaparse to dependencies for running CSV parsing in a web worker.

How to test it?

Nov-12-2025 14-49-47

Starters Deploy Preview

References

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)

BrunaCubos and others added 12 commits November 10, 2025 11:23
- Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support.
- Added `FileUploadStatus` to display upload progress and error handling.
- Updated index files to export new components and types.
- Enhanced `SearchInputField` to include an attachment button that triggers the file upload card.
- Added styles for both new components to ensure proper UI integration.
@icaroov icaroov self-assigned this Nov 12, 2025
@icaroov icaroov requested a review from a team as a code owner November 12, 2025 17:53
@icaroov icaroov requested review from BrunaCubos, emersonlaurentino and hellofanny and removed request for a team November 12, 2025 17:53
@icaroov icaroov changed the base branch from main to feat/quick-order-by-file-feature-branch November 21, 2025 15:01
icaroov and others added 5 commits November 21, 2025 12:05
## What's the purpose of this pull request?

This PR aims to generate a new version of faststore.

preview:
https://storeframework-cm652ufll028lmgv665a6xv0g-pm84gc740.b.vtex.app

---------

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>
## 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 <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>
eduardoformiga and others added 2 commits December 2, 2025 12:06
## 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)
@giurigaud
Copy link

The changelog needs to be added.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 3, 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
Copy link
Contributor

Adiciona por favor na descrição do PR o arquivo .csv que estão usando no desenvolvimento

"react-dom": "^18.2.0"
},
"dependencies": {
"papaparse": "^5.5.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Precisamos checar com o time da faststore a opinião sobre a adição desse pacote, consegue explicar um pouco a necessidade dele?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Foi utilizado visando desempenho e simplicidade para processar arquivos CSV grandes. Foi indicado o uso na RFC. Ele lê o CSV em partes (streaming), não trava a tela, já usa Web Worker, detecta separador, trata aspas, dá progresso, permite cancelar e manipula arquivos grandes sem prejudicar a memória.

Comment on lines +13 to +15
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': [
'.xlsx',
Copy link
Contributor

Choose a reason for hiding this comment

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

Acredito que na RFC foi proposto o upload apenas de formato csv, surgiu a necessidade de xls e xlsx tb?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ajustado, aceitando apenas CSV

Copy link
Contributor

@ArthurTriis1 ArthurTriis1 left a comment

Choose a reason for hiding this comment

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

A funcionalidade parece estar funcionando bem, mas reforço que precisamos da avaliação do time da faststore sobre a adição da lib papaparse e averiguar se devemos de fato permitir o upload de xls e xlsx.

@BrunaCubos
Copy link
Collaborator

A funcionalidade parece estar funcionando bem, mas reforço que precisamos da avaliação do time da faststore sobre a adição da lib papaparse e averiguar se devemos de fato permitir o upload de xls e xlsx.

A adição da lib do papaparse foi indicado para uso na RFC.

@BrunaCubos
Copy link
Collaborator

Para desenvolver utilizamos o arquvio fornecido pela propria RFC
FastStore Starter Template.csv

@lariciamota
Copy link
Contributor

Oie, pessoal!
Notei que nesse PR tem alguns arquivos do #3109, acredito que esteja faltando rebase e mudar a branch de destino para não ficar misturando. Como o PR anterior também está em revisão e esses arquivos têm mudanças pedidas lá, seria bom ficar com as mudanças separadas para facilitar review e não ter comentários repetidos. Obrigada!

- Replaced native input elements with custom Input and Button components for consistency.
- Simplified accepted file types in FileUploadCard to only '.csv'.
- Added TODO comment for file size formatting in FileUploadStatus.
- Adjusted SCSS variable formatting for improved readability.
- Updated `useFileUpload` to use `FileRejection` type for better type safety.
- Introduced `UploadFileDropdown` component with improved CSV file handling using `useCSVParser` hook.
- Simplified error handling and template generation for CSV uploads.
- Added lazy loading for `UploadFileDropdown` in `SearchInput` component.
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.

8 participants