Skip to content

feat: allow the sections to be returned in an optimized JSON format. - #8

Closed
marcoferreiradev wants to merge 31 commits into
mainfrom
feat/render-json
Closed

marcoferreiradev wants to merge 31 commits into
mainfrom
feat/render-json

Conversation

@marcoferreiradev

Copy link
Copy Markdown
Collaborator

What is this Contribution About?

Please provide a brief description of the changes or enhancements you are proposing in this pull request.

Issue Link

Please link to the relevant issue that this pull request addresses:

Loom Video

Record a quick screencast describing your changes to help the team understand and review your contribution. This will greatly assist in the review process.

Demonstration Link

Provide a link to a branch or environment where this pull request can be tested and seen in action.

marcoferreiradev and others added 30 commits May 12, 2026 15:55
…shtoken/webstore” in refreshToken and setLoginCookies.
…ate cookie management for sign-in and logout
- Replace boolean `ignoreStructuredData` with explicit `structuredDataControl` options
- Fix bug where bots still received JSON-LD even when `ignoreStructuredData=true`
- Add "always include" (default), "disable for users", and "disable for all" modes
- Deprecate `ignoreStructuredData` with backward compatibility
- Extract shared logic to `shouldIncludeStructuredData` utility
* feat(proxy): add prop to exclude entries from final sitemap

* feat(vtex-proxy): make possible to add custom handlers to proxy

---------

Co-authored-by: Pedro Bernardina <pedro.guidance@gmail.com>
Co-authored-by: Pedro Bernardina <pedro.guidance@gmail.com>
classic/setpassword now requires the session minted by POST /authentication/startlogin (sent via the _vss cookie); the older GET /authentication/start token passed in the request body is rejected with an empty-body HTTP 500 on VTEX ID Authenticator-migrated accounts, breaking password change. Switch resetPassword to the startlogin flow used by vtex.react-vtexid and FastStore useSetPassword (startlogin -> _vss cookie -> setpassword?expireSessions=true, no authenticationToken in the body). Add startlogin + expireSessions to the VTEXCommerceStable client type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
VTEX returns auth rejections (WrongCredentials, BlockedUser) from setpassword as a non-2xx whose body is a valid AuthResponse. fetchSafe wrapped that in an HttpError, so resetPassword/recoveryPassword bubbled it up and the client choked on a JSON.parse SyntaxError — showing a broken/generic screen instead of the real message ("Senha atual incorreta").

Catch the HttpError, recover the AuthResponse via authResponseFromHttpError, and return it so the client maps it to a message. Unexpected failures are logged and rethrown as a typed HttpError. Guard validateSession so a post-success session failure isn't mistaken for a password-change failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fresh.ts gains a structured-JSON exit alongside the existing ?asJson one:
?renderJson (legacy alias ?appJson — remove once consumers switch) resolves
the page with hooks that short-circuit sections opted out of JSON rendering
(their loaders never run), serializes the tree via @deco/deco
serializeResolvedSection honoring each section's `renderJson` export, and
responds { name, path, sections } with lazy sections as
{ component, lazyUrl } placeholders. One-shot JSON responses never use
async render (firstByteThreshold guards extended); renderJson takes
precedence when both params are sent; legacy ?asJson is untouched.

The website app gains `renderJson.sectionsToIgnore` (admin-configurable):
app-owned sections excluded by resolveType suffix — site-owned sections
should prefer `export const renderJson = false` in their own file.

Replaces the site-level wrapper pattern (handler + pages-loader fork) that
oficina-reserva ran as v1 — the default website/loaders/pages.ts now works
unchanged for renderJson consumers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The fresh.ts renderJson branch imports symbols (sectionModuleLookup,
serializeResolvedSection, computeRenderCb) that only exist in our runtime
fork — upstream jsr:@deco/deco doesn't have them, so standalone deno check
broke. Raw URLs don't resolve subpaths via the package exports map, hence
one entry per subpath used, plus @deco/deno-ast-wasm which the runtime
graph self-references. Pre-existing vtex/mod.ts type-constraint errors
remain untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.0.1 update
  • 🎉 for Minor 0.1.0 update
  • 🚀 for Major 1.0.0 update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants