Add media picker exclusion config to theme schema and media inputs - #524
Open
hta218 wants to merge 5 commits into
Open
Add media picker exclusion config to theme schema and media inputs#524hta218 wants to merge 5 commits into
hta218 wants to merge 5 commits into
Conversation
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.
Follow-up to #519. Adds the developer-declared half of Media Manager filtering; the Studio side is Weaverse/builder#2877.
What
Two places a theme author can declare what the Media Manager gallery hides:
Studio resolves them per field:
An omitted key inherits, an array replaces,
[]deliberately shows every file. NoallowOverrideflag — key presence is the signal.Notes
mediais a sibling ofsettings, not an entry inside it.settingsisInspectorGroup[]and renders as merchant-editable controls in Studio; these rules are meant to be fixed by the theme author.image/videoconfigs are now validated. They previously fell through todefault: returninBasicInputSchema, which allowed any structure. The source is now theme code with no Studio UI to recover from a mistake, so a mistyped exclusion (a bare string instead of an array) has to surface at authoring time rather than silently disabling filtering.z.objectis non-strict, so themes carrying unrelated keys in an image/videoconfigsstill parse.The theme-side type is inline rather than imported from
@weaverse/schema.packages/hydrogenresolves the published@weaverse/schema@0.14.0from the registry, not the workspace copy, so importingMediaInputConfigshere would failpnpm run typecheckuntil schema ships.HydrogenThemeSchemaalready typesinfoandi18ninline, somediamatches. Worth switching to the shared type once schema is published.excludeProductFilesmatches usage, not origin — it maps to Shopify'sused_in:product, so a file uploaded to Files and later attached to a product is hidden too. Studio's UI copy says "used in products" for that reason.Verification
pnpm run biome— cleanpnpm run typecheck— 6/6 packagespnpm exec vp test --run packages/schema packages/hydrogen— 18 files, 269 tests passing (8 new)pnpm run api:report— reports regenerated and committedOut of scope
Per-input allow-list (show only files matching a prefix). No use case raised, and
excludeFilenamePrefixes: []already covers "this picker shows everything".