fix(types): correct music OG type and add payment.link namespace#775
Conversation
The Open Graph music namespace defines music.radio_station, not music.radio_status. Fixes harlan-zw/zhead#29
📝 WalkthroughWalkthroughAdds payment OpenGraph properties and types, updates ogType literals (renames music radio type, adds payment.link), extends meta key resolution with payment aliases, updates known-property and URL validations, and adds a unit test covering payment meta output. ChangesPayment OpenGraph & ogType
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Bundle Size Analysis
|
Adds the beta OpenGraph payment namespace (https://ogp.me/ns/payment#): payment:description, payment:currency, payment:amount, payment:expires_at, payment:status, payment:id and payment:success_url, plus the payment.link og:type. Flat keys serialize to property meta tags via the payment namespace and multi-word keys (expires_at, success_url).
music.radio_status to music.radio_stationmusic.radio_station + add payment.link OG namespace
music.radio_station + add payment.link OG namespacemusic.radio_station + add payment.link OG
music.radio_station + add payment.link OGThere was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/unhead/src/types/schema/metaFlat.ts (1)
90-142: AlignMetaFlatPaymentwith ogp.me beta payment namespace + confirm URL validationThe 7
payment:*properties (description,currency,amount,expires_at,status,id,success_url) match the ogp.me beta payment namespace, andpaymentStatususes the correct allowed values.payment:success_urlis already treated as a URL by the validator (packages/unhead/src/validate/known.tsincludes it inURL_META_KEYSandKNOWN_META_PROPERTIES). Consider explicitly calling out the namespace’s “beta” status in theMetaFlatPaymentdocs.🤖 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/unhead/src/types/schema/metaFlat.ts` around lines 90 - 142, Update the MetaFlatPayment JSDoc to explicitly note that these payment:* properties map to the ogp.me payment namespace which is currently in beta (mention "beta" and link or reference ogp.me/ns/payment#), and confirm in the docs that paymentSuccessUrl is treated as a URL by the validator; also verify that the allowed values for paymentStatus ('PENDING' | 'PAID' | 'FAILED' | 'EXPIRED') match the namespace. Reference the interface name MetaFlatPayment and the property paymentSuccessUrl so reviewers can locate and edit the comment block, and ensure the validator lists paymentSuccessUrl in URL_META_KEYS / KNOWN_META_PROPERTIES if not already present.
🤖 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.
Nitpick comments:
In `@packages/unhead/src/types/schema/metaFlat.ts`:
- Around line 90-142: Update the MetaFlatPayment JSDoc to explicitly note that
these payment:* properties map to the ogp.me payment namespace which is
currently in beta (mention "beta" and link or reference ogp.me/ns/payment#), and
confirm in the docs that paymentSuccessUrl is treated as a URL by the validator;
also verify that the allowed values for paymentStatus ('PENDING' | 'PAID' |
'FAILED' | 'EXPIRED') match the namespace. Reference the interface name
MetaFlatPayment and the property paymentSuccessUrl so reviewers can locate and
edit the comment block, and ensure the validator lists paymentSuccessUrl in
URL_META_KEYS / KNOWN_META_PROPERTIES if not already present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cdbe52d2-b91c-4c05-bccf-7dc16c5cc6a7
📒 Files selected for processing (5)
packages/unhead/src/types/schema/meta.tspackages/unhead/src/types/schema/metaFlat.tspackages/unhead/src/utils/meta.tspackages/unhead/src/validate/known.tspackages/unhead/test/unit/server/useSeoMeta.test.ts
✅ Files skipped from review due to trivial changes (1)
- packages/unhead/src/validate/known.ts
🔗 Linked issue
Resolves harlan-zw/zhead#29
❓ Type of change
📚 Description
The
ogTypeunion hadmusic.radio_status, but the Open Graphmusicnamespace definesmusic.radio_station. This fixes the typo and, while in there, adds the betapaymentnamespace from ogp.me/ns/payment#.New
og:typevaluepayment.linkplus sevenpayment:*properties as flatuseSeoMetakeys:paymentDescriptionpayment:descriptionpaymentCurrencypayment:currencypaymentAmountpayment:amountpaymentExpiresAtpayment:expires_atpaymentStatuspayment:status(PENDING/PAID/FAILED/EXPIRED)paymentIdpayment:idpaymentSuccessUrlpayment:success_urlpaymentis registered in the OG namespace set so keys render aspropertytags, with aliases for the two multi-word keys and entries invalidate/known.ts(payment:success_urlcounts as a URL). AuseSeoMetaserver test asserts the exact tag output.