feat(vtex/plp): rich typing + JSDoc on PLPProps for CMS admin - #80
Merged
Conversation
The CMS admin generates edit forms from the loader's Props TypeScript types.
PLPProps had weak typing (sort?: string, fuzzy?: string) and no JSDoc, so
the admin rendered plain text inputs and raw field names ('Count') instead
of dropdowns and labelled fields.
- sort?: string → sort?: Sort (8-value union → dropdown)
- fuzzy?: string → fuzzy?: LabelledFuzzy ('automatic'|'disabled'|'enabled' → dropdown)
- add @title/@description to every field (e.g. count → 'Items per page')
Also fixes a latent runtime bug: props.fuzzy (a friendly LabelledFuzzy like
'automatic') was passed raw to the IS API, which expects '0'|'1'|'auto'. Now
mapped via mapLabelledFuzzyToFuzzy(); the raw URL ?fuzzy= param still passes
through.
Related: DECO-5296 (CMS Studio loader form parity)
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The decoCMS admin generates section/loader edit forms from the loader's
PropsTypeScript types.PLPProps(VTEX inline PLP loader) had weak typing and no JSDoc, so the admin rendered plain text inputs and raw field names ("Count") instead of dropdowns and labelled fields.Changes (
vtex/inline-loaders/productListingPage.ts)sort?: string→sort?: Sort— the 8-value union already invtex/utils/types.ts→ admin renders a dropdown.fuzzy?: string→fuzzy?: LabelledFuzzy("automatic" | "disabled" | "enabled") → dropdown with friendly labels.@title/@descriptionJSDoc to every field (e.g.count→ "Items per page", "Number of products per page to display").Latent runtime fix
props.fuzzy(a friendlyLabelledFuzzylike"automatic") was passed raw to the Intelligent Search API, which expects"0" | "1" | "auto". It's now mapped via the existingmapLabelledFuzzyToFuzzy(); the raw?fuzzy=URL param still passes through.Compatibility
tsc --noEmitclean;vitest run vtex/inline-loaderspasses (4/4).sort/fuzzyas strings downstream — no behavior change beyond the fuzzy mapping fix.Props) adopt the typed Props to see the richer form.Related
DECO-5296 — CMS Studio loader form parity for @decocms/start sites.
Generated with Claude Code
Summary by cubic
Improve the VTEX PLP loader’s
PLPPropstyping and JSDoc so the CMS admin shows labeled dropdowns and clearer fields instead of plain text. Also fix fuzzy search value mapping to the Intelligent Search API. Addresses DECO-5296 (CMS Studio loader form parity for@decocms/start).New Features
sort?: string→sort?: Sort(8-value union) to render a dropdown.fuzzy?: string→fuzzy?: LabelledFuzzy("automatic" | "disabled" | "enabled") with friendly labels.@title/@descriptionJSDoc to all fields (e.g., count → "Items per page").Bug Fixes
LabelledFuzzyto"0" | "1" | "auto"before calling Intelligent Search; the raw?fuzzy=URL param still passes through.Written for commit fbcc5e3. Summary will update on new commits.