Repository navigation
feat: file upload via Order Entry Service (OES) - #3334
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds VTEX Order Entry integration: backend client namespace and GraphQL types/resolvers for file upload and operation polling; frontend SDK hooks (upload, operation, order-form items), Processing UI state for file uploads, SearchInput refactor from CSV to OES flow, and cleanup of CSV parser/bulk-product hooks/exports. ChangesOrder Entry Integration & Quick-Order Refactor
Sequence DiagramsequenceDiagram
participant User
participant Frontend
participant GraphQL
participant VtexCommerceClient
participant OrderEntryAPI
User->>Frontend: select file & submit
Frontend->>GraphQL: uploadFileToOrderEntry(file base64,..)
GraphQL->>VtexCommerceClient: orderEntry.uploadFile(buffer,..)
VtexCommerceClient->>OrderEntryAPI: multipart POST /upload
OrderEntryAPI-->>VtexCommerceClient: objectKey
GraphQL-->>Frontend: objectKey
Frontend->>GraphQL: startOrderEntryOperation(objectKey,orderFormId)
GraphQL->>VtexCommerceClient: orderEntry.startOperation(...)
VtexCommerceClient->>OrderEntryAPI: POST create operation
OrderEntryAPI-->>VtexCommerceClient: operationId
Frontend->>GraphQL: poll orderEntryOperation(operationId)
GraphQL->>VtexCommerceClient: orderEntry.getOperation(operationId)
VtexCommerceClient-->>GraphQL: status/details
Frontend->>GraphQL: orderFormItems(orderFormId)
GraphQL->>VtexCommerceClient: orderEntry.getOrderFormItems(orderFormId)
VtexCommerceClient-->>GraphQL: items
GraphQL-->>Frontend: items -> map -> add to cart
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
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. |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 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 870-874: The checkout request headers are only copying
VtexIdclientAutCookie from autHeaders, dropping other auth headers; update the
headers object used in the commerce checkout calls to spread the entire
autHeaders (e.g., headers: { 'Content-Type': 'application/json',
'X-FORWARDED-HOST': forwardedHost, ...autHeaders }) so all auth-related keys are
forwarded, and apply the same change to the second occurrence that currently
builds headers at the other checkout call (the block using autHeaders around
lines 891-895).
- Around line 769-775: The multipart header assembly in headerPart currently
interpolates the user-controlled fileName directly; sanitize fileName before use
in the Content-Disposition line by stripping or replacing CRLF (\r, \n), double
quotes, and other control characters and optionally limiting length or falling
back to a safe default; update the code that constructs headerPart (referencing
headerPart, fileName, boundary, mimeType, CRLF) to use the sanitized filename
variable so injected CR/LF or quotes cannot break multipart boundaries or
headers.
In `@packages/api/src/platforms/vtex/resolvers/startOrderEntryOperation.ts`:
- Around line 14-19: The resolver currently always calls
commerce.orderEntry.createOrderForm() and ignores any orderFormId provided by
the mutation input; change it to prefer the input by setting a local orderFormId
= data.orderFormId ?? (await commerce.orderEntry.createOrderForm()).orderFormId
(or equivalent) and then pass that orderFormId into
commerce.orderEntry.startOperation along with data.objectKey and
data.sessionToken; update references to the existing orderFormId variable (and
remove the unconditional createOrderForm call) so the input value is used when
present.
In `@packages/api/src/platforms/vtex/resolvers/uploadFileToOrderEntry.ts`:
- Around line 12-19: The input validation currently only checks presence before
calling Buffer.from(fileContent, 'base64') in uploadFileToOrderEntry; update
this to first validate that fileContent is valid Base64 (e.g., match against a
Base64 regex or try a safe decode check) and enforce a maximum upload size by
computing the decoded byte size from the Base64 length (or set a
MAX_UPLOAD_BYTES constant) and throwing BadRequestError if it exceeds the limit;
also add simple checks on fileName/mimeType length/format to reject suspicious
values before decoding or making platform calls so malformed or very large
payloads never reach Buffer.from or downstream APIs.
In `@packages/api/src/typeDefs/orderEntry.graphql`:
- Around line 24-65: The GraphQL output types must be renamed to use the
Store{Entity} prefix: rename OrderEntryUploadResult ->
StoreOrderEntryUploadResult, OrderEntryOperationResult ->
StoreOrderEntryOperationResult, OrderEntryMissingItem ->
StoreOrderEntryMissingItem, OrderEntryOperationStatus ->
StoreOrderEntryOperationStatus, and OrderFormCartItem -> StoreOrderFormCartItem;
update every schema reference and any resolver/type-mapping code that uses those
symbols (queries, mutations, fragments, imports) to the new names so the schema
and implementation remain consistent.
In `@packages/api/src/typeDefs/query.graphql`:
- Around line 467-471: The schema exposes two queries without authentication:
add the `@auth` directive to the GraphQL query fields orderEntryOperation and
orderFormItems in the query type so these endpoints require authentication;
update the definitions for orderEntryOperation(operationId: String!):
OrderEntryOperationStatus and orderFormItems(orderFormId: String!):
[OrderFormCartItem!]! to include `@auth`, ensuring the schema-level protection is
applied for those operations.
In `@packages/core/src/components/search/SearchInput/SearchInput.tsx`:
- Around line 154-162: The effect using useEffect reads oesStatus and calls
fetchOrderFormItems but does not list fetchOrderFormItems in the dependency
array, which can cause stale closures; fix by either adding fetchOrderFormItems
to the dependency array of the useEffect where oesStatus is checked or ensure
fetchOrderFormItems is stable (wrap it in useCallback) and then include that
stable reference in the dependency array (update the useEffect that references
oesStatus, fetchOrderFormItems to depend on oesStatus?.status,
oesStatus?.entityId, and fetchOrderFormItems).
In `@packages/core/src/sdk/orderEntry/useOrderEntry.ts`:
- Around line 12-19: The composite reset in useOrderEntry only calls reset from
useOrderEntryOperation and leaves upload state/error sticky; update
useOrderEntryUpload to expose a reset/clear function (e.g., resetUpload or
clearUploadState) if it doesn't already, then change the composite reset in
useOrderEntry.ts to call both reset (from useOrderEntryOperation) and the new
reset/clear function from useOrderEntryUpload so uploadError and isUploading are
cleared between attempts.
In `@packages/core/src/sdk/orderEntry/useOrderEntryOperation.ts`:
- Around line 100-113: The returned status can be stale after calling reset
since reset only clears operationId but the code still returns statusData;
update the return shape so status is only provided when the current operationId
is active (e.g., return null for status when operationId is falsy) — locate the
return block in useOrderEntryOperation (referencing reset, operationId,
statusData, isPolling/isPending) and change status:
statusData?.orderEntryOperation ?? null to be gated by operationId (only return
the orderEntryOperation when operationId is truthy and matches the active
operation), and ensure any derived flags (isLoading/isPending) consistently
consider operationId so cleared operations don’t leave stale UI state.
In `@packages/core/src/sdk/orderEntry/useOrderFormItems.ts`:
- Around line 47-53: reset currently only clears the orderFormId which leaves
previous items in `data?.orderFormItems`; update the `reset` callback to also
clear the items cache/state so the returned `items` becomes null (e.g. in the
`reset` implementation call the local setter that holds items like
`setOrderFormItems(null)` or, if using a fetch cache/SWR, call
`mutate(null)`/clear the cached `data`) so that `items: data?.orderFormItems ??
null` doesn't leak prior items after reset.
🪄 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: 3d3db84b-f68a-4fea-a5de-11df930ce7c4
⛔ Files ignored due to path filters (4)
packages/api/src/__generated__/schema.tsis excluded by!**/__generated__/**and included bypackages/**packages/core/@generated/gql.tsis excluded by!**/@generated/**,!**/@generated/**and included bypackages/**packages/core/@generated/graphql.tsis excluded by!**/@generated/**,!**/@generated/**and included bypackages/**packages/core/@generated/index.tsis excluded by!**/@generated/**,!**/@generated/**and included bypackages/**
📒 Files selected for processing (25)
packages/api/src/platforms/vtex/clients/commerce/index.tspackages/api/src/platforms/vtex/resolvers/getOrderEntryOperation.tspackages/api/src/platforms/vtex/resolvers/getOrderFormItems.tspackages/api/src/platforms/vtex/resolvers/mutation.tspackages/api/src/platforms/vtex/resolvers/query.tspackages/api/src/platforms/vtex/resolvers/startOrderEntryOperation.tspackages/api/src/platforms/vtex/resolvers/uploadFileToOrderEntry.tspackages/api/src/typeDefs/mutation.graphqlpackages/api/src/typeDefs/orderEntry.graphqlpackages/api/src/typeDefs/query.graphqlpackages/api/test/integration/schema.test.tspackages/components/src/hooks/index.tspackages/components/src/hooks/useCSVParser.tspackages/components/src/molecules/FileUploadCard/FileUploadCard.tsxpackages/components/src/molecules/FileUploadStatus/FileUploadStatus.tsxpackages/core/cms/faststore/sections.jsonpackages/core/src/components/search/SearchInput/SearchInput.tsxpackages/core/src/components/sections/Navbar/Navbar.tsxpackages/core/src/sdk/orderEntry/useOrderEntry.tspackages/core/src/sdk/orderEntry/useOrderEntryOperation.tspackages/core/src/sdk/orderEntry/useOrderEntryUpload.tspackages/core/src/sdk/orderEntry/useOrderFormItems.tspackages/core/src/sdk/product/useBulkProductsQuery.tspackages/core/test/server/index.test.tspackages/ui/src/components/molecules/FileUploadStatus/styles.scss
💤 Files with no reviewable changes (3)
- packages/core/src/sdk/product/useBulkProductsQuery.ts
- packages/components/src/hooks/useCSVParser.ts
- packages/components/src/hooks/index.ts
| orderEntryOperation(operationId: String!): OrderEntryOperationStatus | ||
| """ | ||
| Returns the items in an orderForm by its ID. | ||
| """ | ||
| orderFormItems(orderFormId: String!): [OrderFormCartItem!]! |
There was a problem hiding this comment.
Add @auth to OES queries to avoid unauthenticated access paths.
orderEntryOperation and orderFormItems expose operation/cart data but currently have no auth directive. Protect them at schema level.
Suggested fix
- orderEntryOperation(operationId: String!): OrderEntryOperationStatus
+ orderEntryOperation(operationId: String!): OrderEntryOperationStatus
+ `@auth`
+ `@cacheControl`(scope: "private", sMaxAge: 0, staleWhileRevalidate: 0)
@@
- orderFormItems(orderFormId: String!): [OrderFormCartItem!]!
+ orderFormItems(orderFormId: String!): [OrderFormCartItem!]!
+ `@auth`
+ `@cacheControl`(scope: "private", sMaxAge: 0, staleWhileRevalidate: 0)🤖 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/typeDefs/query.graphql` around lines 467 - 471, The schema
exposes two queries without authentication: add the `@auth` directive to the
GraphQL query fields orderEntryOperation and orderFormItems in the query type so
these endpoints require authentication; update the definitions for
orderEntryOperation(operationId: String!): OrderEntryOperationStatus and
orderFormItems(orderFormId: String!): [OrderFormCartItem!]! to include `@auth`,
ensuring the schema-level protection is applied for those operations.
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |
…d createOrderForm Separate oesBase (vtexcommercebeta.com.br) from the main API base to correctly target the Order Entry Service. Also adds createOrderForm to provision a new orderForm before starting a bulk import operation. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ions Registers uploadFileToOrderEntry and startOrderEntryOperation mutations alongside the orderEntryOperation polling query. Each resolver delegates to the commerce client's orderEntry namespace. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ned flow Introduces useOrderEntryUpload (Base64 file upload), useOrderEntryOperation (polling with 2s interval until terminal status), and useOrderEntry as the high-level composite hook for the full CSV import flow. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ations Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
CSV parsing logic was replaced by the Order Entry Service flow, which handles file processing server-side. The hook and its public exports are no longer needed. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replaces the CSV-parse-then-bulk-search approach (useCSVParser + useBulkProductsQuery) with useOrderEntry, which uploads the file directly to the Order Entry Service and redirects to checkout on success. Removes useBulkProductsQuery as it is no longer used. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…port phase Adds FileUploadState.Processing with a processingStatusText prop so the upload card can display a distinct label while the Order Entry Service operation is polling. The spinning icon animation is shared between the Uploading and Processing states via a selector group. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Exposes isUploading and isProcessing separately from useOrderEntry. isProcessing covers both the startOperation mutation and the polling period, eliminating the Completed flash between phases. SearchInput passes each flag independently to FileUploadCard and wires the new processingStatusText CMS field (default: "Importing..."). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds getOrderFormItems commerce client method (GET /api/checkout/pub/orderForm/{id}),
OrderFormCartItem GraphQL type, orderFormItems query, and its resolver.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…rt merge After OES operation completes (SUCCESS/PARTIAL_SUCCESS), fetches the items from the created orderForm via the new orderFormItems query, maps them to Product[] and opens the QuickOrderDrawer for review. Clicking "Add to Cart" merges each item into the current session cart via cartStore instead of redirecting directly to checkout. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2f86367 to
5d3e7c0
Compare
5d3e7c0 to
fdc5413
Compare
- Convert TERMINAL_STATUSES from Array to Set and use .has() for O(1) lookups - Remove unnecessary ArrayBuffer type assertion on body.buffer Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…cases Covers uploadFile (multipart body, MIME fallback, file content), startOperation (sessionToken include/omit), getOperation, createOrderForm, and getOrderFormItems to improve coverage on commerce/index.ts new code. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… unit tests - FileUploadCard: add drag/drop, dragenter/leave, Escape key, hasError prop, and onDownloadTemplate callback tests to cover uncovered branches - Export and unit-test mapOrderFormItemsToProducts from SearchInput to cover the pure mapping function for OES items Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…s signature Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Covers fetchOrderFormItems trigger on SUCCESS/PARTIAL_SUCCESS, suppression on FAILED, unauthenticated attachment button, and orderFormItems effect. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…actor Re-adds submitButtonAriaLabel, loadingLabel, searchHistoryTitle and searchTopTitle to SearchInputProps so starters can pass them without a TypeScript error. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
renatomaurovtex
left a comment
There was a problem hiding this comment.
Code review — OES file upload
Reviewed the full diff (41 files). Architecture is sound — API/SDK/UI boundaries are respected (resolvers are framework-agnostic, hooks live in core, the new Processing state is in components), and the new hooks/resolvers/commerce-client have good test coverage. A few items should be addressed before merge, mostly around failure/edge paths.
🟠 Blocking
1. Header injection via fileName — packages/api/.../clients/commerce/index.ts. mimeType is sanitized with SAFE_MIME_PATTERN, but fileName is interpolated raw into the Content-Disposition header. A filename containing " or CRLF can break out of the multipart part and inject headers/parts; fileName is end-user controlled.
- `Content-Disposition: form-data; name="file"; filename="${fileName}"`,
+ `Content-Disposition: form-data; name="file"; filename="${fileName.replace(/[\r\n"]/g, '')}"`,2. OrderEntryOperationStatus.entityId should be nullable — packages/api/.../typeDefs/orderEntry.graphql. It's declared entityId: String!, but a FAILED operation has no entity (the new SearchInputComponent.test.tsx itself mocks entityId: null for FAILED, and the getOperation client types it optional). On FAILED with a null entityId, the non-null coercion errors the whole orderEntryOperation query → (a) the real FAILED status never reaches the client (the UI's oesStatus?.status === 'FAILED' branch becomes dead), and (b) useOrderEntryOperation's refreshInterval never sees a terminal status, so it polls forever.
type OrderEntryOperationStatus {
status: String!
- entityId: String!
+ entityId: String
message: String
missingItems: [OrderEntryMissingItem!]
}3. No polling timeout / max attempts — packages/core/src/sdk/orderEntry/useOrderEntryOperation.ts. refreshInterval returns 2000 for any non-terminal/absent status with no ceiling. A stuck/slow OES op or a persistently erroring status query leaves the user on a spinner indefinitely. The CSV flow this replaces had a 30s timeout — please add a deadline/max-attempts that surfaces an error and stops polling.
4. SearchInput.tsx regressions:
handleDownloadTemplateis now an empty no-op, butdownloadTemplateButtonLabelis still passed toFileUploadCard, so the button likely still renders and does nothing. Remove the button or restore behavior (with OES accepting arbitrary formats the template concept may no longer apply).- Public
SearchInputPropsremovals:onFileSearch,submitButtonAriaLabel,loadingLabel,searchHistoryTitle,searchTopTitle, plus thefaststore:file-searchCustomEvent. These are breaking — they need a deprecation note + migration guidance. ThesearchHistoryTitle/searchTopTitle/loadingLabelremovals (no longer forwarded toSearchDropdown) look unrelated to OES — intentional, or scope creep? - a11y: the submit
IconButtonnow usesaria-label={a11yLabels?.searchButtonAriaLabel}with no fallback (thesubmitButtonAriaLabelfallback was removed). Ifa11yLabelsis unset, the button ends up with no accessible name. PARTIAL_SUCCESSopens the drawer butstatus.message/missingItemsare never surfaced — the user is silently not told which items were dropped.
🟡 Minor
5. New required prop — FileUploadCard.tsx / FileUploadStatus.tsx. processingStatusText was added as required on both prop types, breaking existing @faststore/components consumers who don't pass it. Consider making it optional with a default (the core caller already falls back to 'Importing...').
6. data.orderFormId is unused — startOrderEntryOperation.ts. The input requires orderFormId: String! (the SDK passes cart.id), but the resolver ignores it and always calls createOrderForm(). If a throwaway order form is intentional, why require orderFormId in the contract? Use it or drop it.
💬 Nits / questions
7. Global CSS growth — packages/core/src/styles/global/index.scss. Badge/Button/Icon/Price/Alert/QuantitySelector/Table/Tooltip styles now load globally (the portal-rendered drawer is outside .section scope). Reasonable given the portal, but it ships on every page regardless of QuickOrder usage — please confirm pnpm size doesn't regress.
8. Base64 upload payload — useOrderEntryUpload.ts sends the file as a base64 GraphQL variable (~33% inflation). Fine for small CSVs; worth a size limit/note now that larger formats are accepted, to avoid request-body limits.
9. @generated/__generated__ changes look like a clean codegen regeneration matching the new schema (ClientProductQuery is reordered, not dropped) — just confirm they came from pnpm codegen.
Verdict: Changes requested. Blocking: #1 (filename header injection), #2 (nullable entityId / infinite poll on FAILED), #3 (polling timeout), #4 (SearchInput regressions). The rest are minor/nits.
Suggested checks before merge: pnpm lint · build · pnpm turbo run test --filter=@faststore/api --filter=@faststore/core --filter=@faststore/components · pnpm size.
- Sanitize fileName against CR/LF/quotes before multipart Content-Disposition header - Spread full autHeaders in createOrderForm and getOrderFormItems checkout calls - Fix SAFE_MIME_PATTERN formatting to satisfy Biome - Use data.orderFormId when provided in startOrderEntryOperation; create new only when empty - Validate Base64 format and enforce 5 MB size limit in uploadFileToOrderEntry - Rename GraphQL output types to Store* prefix (StoreOrderEntryUploadResult, StoreOrderEntryOperationResult, StoreOrderEntryMissingItem, StoreOrderEntryOperationStatus, StoreOrderFormCartItem) in schema source and generated files - Fix isAutenticated typo → isAuthenticated in useAuth, ProfileChallenge, SearchInput and test mocks - Add fetchOrderFormItems to useEffect dependency array in SearchInput - Fix composite reset() in useOrderEntry to also clear upload error via clearError - Gate status return in useOrderEntryOperation by active operationId to avoid stale state - Gate items return in useOrderFormItems by orderFormId to avoid stale items after reset - Remove transient Completed flash in FileUploadCard handlers; set Uploading immediately - Update discovery.config.default.js with B2B store values while preserving original fields Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Make entityId nullable in StoreOrderEntryOperationStatus schema and generated types — FAILED operations have no entity; non-null coercion was erroring the query and causing infinite polling on failure - Make orderFormId optional in IOrderEntryOperation input — resolver uses the provided value when non-empty, otherwise creates a new orderForm - Add 60s polling timeout to useOrderEntryOperation: pollStartRef tracks start time, refreshInterval stops and surfaces a timeoutError when the deadline is exceeded; reset() also clears the timeout state - Remove no-op handleDownloadTemplate from FileUploadCard call — OES accepts arbitrary formats so the template button no longer applies - Add aria-label fallback 'Search' to hidden submit IconButton so the button always has an accessible name when a11yLabels is unset - Surface PARTIAL_SUCCESS message via alertMessages.notFound in the QuickOrderDrawer so users see which items were not imported - Make processingStatusText optional with default 'Importing...' in both FileUploadStatus and FileUploadCard to avoid breaking existing consumers who do not pass the prop Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Restore discovery.config.default.js to starter defaults (removed accidental B2B tenant values) - Fix startOrderEntryOperation tests: align with resolver behavior (createOrderForm only called when orderFormId is empty); add separate test for reuse path - Add CHANGELOG breaking change entry for removed useCSVParser export Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
a3d80fb to
088fabe
Compare
…ileUploadCard branches Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… on large inputs Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…tatus and FileUploadCard Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
## What's the purpose of this pull request? fix(api): use account-scoped cookie in orderEntry headers The orderEntry methods (file upload via OES, #3334) still referenced the withAutCookie helper that #3381 removed, since that PR was not rebased on the latest dev and did not see the newly merged orderEntry block. This left an undefined withAutCookie reference, breaking the build and tests on dev. Replace the 5 withAutCookie(forwardedHost, account) calls with the withCookie({ 'content-type', 'X-FORWARDED-HOST' }) pattern adopted by #3381 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved authentication/header handling for order entry endpoints to ensure requests consistently include the correct `Content-Type` and forwarded host information. * Ensures file upload continues to use `multipart/form-data` with the proper boundary while retaining the updated base header behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary Graduate the `4.3.0-dev.8` prerelease cycle to the stable `4.3.0` release on `latest`. Merging this PR triggers CD on `main`, which runs `lerna version --conventional-graduate` and publishes all `@faststore/*` packages to the `latest` dist-tag. ### Features - Password Protection (v4) (#3276) - File upload via Order Entry Service (OES) (#3334) - Add sitemap to CMS Landing Page content-type (#3386) ### Bug Fixes - **core:** use authenticator route for setpassword (#3380) - migrate partytown `@builder.io` → `@[email protected]` (#3394) - **api:** use account-scoped cookie in orderEntry headers (#3395) - forward auth token only via account-scoped cookie (#3381) - **core:** propagate upstream error status instead of always 500 (#3379) ## Pre-flight (faststore-release skill) - Working tree clean; `release.yml` has `fetch-depth: 0` - All 8 packages have `repository.url` - No breaking changes since `v4.2.0` - `dev → main` merges cleanly (no CHANGELOG/codegen conflicts) - No unmerged hotfixes on `main` (accidental `4.2.1` was fully reverted in #3375) ## Test plan - [ ] CI green on this PR - [ ] After merge, confirm CD publishes all 8 packages at `4.3.0` under `latest` Made with [Cursor](https://cursor.com) --------- Co-authored-by: Matheus P. Silva <[email protected]> Co-authored-by: vtexgithubbot <[email protected]> Co-authored-by: Lucas Feijó <[email protected]> Co-authored-by: Luiz Falcão <[email protected]> Co-authored-by: Artur Santiago <[email protected]> Co-authored-by: Larícia Mota <[email protected]> Co-authored-by: Sahan Jayawardana <[email protected]> Co-authored-by: Mateus Pontes <[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: Leandro Rodrigues <[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]>
## What's the purpose of this pull request? The search dropdown can't be translated. "Top Search" and "History" ignore the titles set in the CMS (Navbar > searchInput), and "Suggested Products" and "Clear History" have no CMS field at all, so stores in non-English locales always show these four labels in English. The first part is a regression: since #3334 (released in v4.4.0), `SearchInput` no longer destructures `searchTopTitle`/`searchHistoryTitle`. They fall into `...otherProps`, end up on the `<input>` as HTML attributes (`searchtoptitle="..."`), and `<SearchDropdown>` renders without them. ## How it works? - `SearchInput` destructures the dropdown labels again (`searchTopTitle`, `searchHistoryTitle` and `loadingLabel`, which was dropped in the same refactor and left the loading text empty) and forwards them to `SearchDropdown`, so they no longer leak to the `<input>`. - New optional CMS fields on the Navbar `searchInput` (in `sections.json`, `schema.json` and `cms_component__navbar.jsonc`): - `searchProductsTitle` (default "Suggested Products"), passed as `title` to `SearchProducts` - `searchHistoryClearLabel` (default "Clear History"), passed as `clearLabel` to `SearchHistory` - The `searchTopTitle` CMS default now matches the component ("Top Search" instead of "Top search"). - `NavbarProps['searchInput']` and `SearchInputProps` get the two new optional props. This is additive only: nothing changes for stores that don't set them, since `@faststore/components` keeps its English defaults. ## How to test it? - Set the four labels in the CMS (Navbar > Search Input), open the search dropdown and check that the titles and the clear button use the CMS values. - Inspect the search `<input>`: it should no longer carry `searchtoptitle`/`searchhistorytitle` attributes. - Unit tests: `cd packages/core && pnpm vitest run test/components/search`. The new label tests in `SearchInputComponent.test.tsx` and `SearchDropdown.test.tsx` fail on `dev` and pass here. ### Starters Deploy Preview Use the CodeSandbox build from this PR. ## References - Regression introduced in #3334. - #3240 (from a partner) tackles the same problem. This PR is a rebased take on it against the current `dev` and also covers the "Clear History" label. Thanks to the authors of #3240 for the original fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>

0 New Issues
0 Fixed Issues
0 Accepted Issues
Context
Previously, the quick order feature required merchants to upload files in a strict CSV format — with a fixed column layout — for the system to parse and add products to the cart. This was brittle, error-prone, and limited to a single file type.
This PR integrates FastStore with the VTEX Order Entry Service (OES), a backend service that handles file parsing and order composition server-side, with AI-assisted extraction. This means:
What changed
@faststore/api): adds GraphQL mutations and queries (uploadFileToOrderEntry,startOrderEntryOperation,orderEntryOperation,orderFormItems) and the corresponding VTEX commerce client methods to drive the OES flow.@faststore/core): introducesuseOrderEntryUpload,useOrderEntryOperation,useOrderFormItems, and the orchestration hookuseOrderEntrythat ties upload → processing → cart merge together.@faststore/components): adds aProcessingstate toFileUploadStatusto represent the OES processing phase (distinct from the upload phase), with a configurableprocessingStatusTextlabel.useCSVParser+ bulk-product lookup approach with the OES-backed flow end-to-end.useCSVParserhook anduseBulkProductsQuery— no longer needed.Test Plan
pnpm turbo run test --filter=@faststore/api --filter=@faststore/core🤖 Generated with Claude Code