import React from 'react'; import { __ } from '@wordpress/i18n'; const PREVIEW_LABELS = { max_snippet: { label: __('Max snippet length', 'ai-rank-suite'), hint: __('How many characters Google may quote. −1 = no limit, 0 = no snippet at all.', 'ai-rank-suite'), names: { '-1': __('No limit', 'ai-rank-suite'), 0: __('No snippet', 'ai-rank-suite'), 50: __('50 characters', 'ai-rank-suite'), 100: __('100 characters', 'ai-rank-suite'), 160: __('160 characters', 'ai-rank-suite'), 200: __('200 characters', 'ai-rank-suite') }, }, max_image_preview: { label: __('Max image preview', 'ai-rank-suite'), hint: __('Size of the image Google may show next to this result.', 'ai-rank-suite'), names: { none: 'No image', standard: 'Standard', large: 'Large' }, }, max_video_preview: { label: __('Max video preview', 'ai-rank-suite'), hint: __('Seconds of video Google may play in the result. −1 = no limit.', 'ai-rank-suite'), names: { '-1': 'No limit', 0: 'No preview', 15: '15 seconds', 30: '30 seconds' }, }, }; const SOCIAL_FIELDS = [ { key: 'og_title', label: __('Facebook title', 'ai-rank-suite'), type: 'text' }, { key: 'og_desc', label: __('Facebook description', 'ai-rank-suite'), type: 'textarea' }, { key: 'og_image', label: __('Facebook image URL', 'ai-rank-suite'), type: 'text' }, { key: 'tw_title', label: __('X title', 'ai-rank-suite'), type: 'text' }, { key: 'tw_desc', label: __('X description', 'ai-rank-suite'), type: 'textarea' }, { key: 'tw_image', label: __('X image URL', 'ai-rank-suite'), type: 'text' }, ]; export default function AdvancedSeo({ item, onChange }) { const previews = item.previews || {}; const social = item.social || {}; const options = item.preview_options || {}; const setPreview = (key, value) => onChange({ previews: { ...previews, [key]: value } }); const setSocial = (key, value) => onChange({ social: { ...social, [key]: value } }); const warn = item.social_card?.image_warn; const meta = item.social_card?.image_meta; return (
{__('Empty fields fall back to the SEO title, the meta description and the featured image.', 'ai-rank-suite')}
{SOCIAL_FIELDS.map((f) => (