{"version":3,"file":"BlogHowToSchema.CBYLKvm7.mjs","names":["useMemo","useMemo","__esmMin","init_npm_react_18_3_1","pe","init_jsx_runtime","K","c","addPropertyControls","ControlType","init_framer_BL70qLPA","normalizeWhitespace","value","extractText","node","child","getTopLevelBlocks","content","children","getTagName","isFaqSectionHeading","text","stripped","buildFaqPairs","faqHeadingIndex","blocks","block","questionPattern","pairs","currentQuestion","currentAnswerParts","commitCurrent","answer","i","isPrefixedQuestion","isHeadingQuestion","tagName","AutoFAQSchema","props","schemaJson","faqItems","schema","item","init_AutoFAQSchema","BlogHowToSchema","parsed","init_BlogHowToSchema"],"sources":["https:/framerusercontent.com/modules/SGh0qO5I0GuBRTI6ECNd/X5YIvDlT5RxFtBX80mIp/AutoFAQSchema.js","https:/framerusercontent.com/modules/GurC8O0tGUnQzICn0jyV/7EdSCPnv4ysbuRtQSDwH/BlogHowToSchema.js"],"sourcesContent":["// User request: Create AutoFAQSchema that accepts a RichText \"Content\" prop bound to CMS content, extracts FAQ Q&A blocks automatically, and renders one FAQPage JSON-LD script or null when no valid FAQ pairs exist.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{isValidElement,useMemo}from\"react\";function normalizeWhitespace(value){return value.replace(/\\s+/g,\" \").trim();}function extractText(node){if(node===null||node===undefined||typeof node===\"boolean\")return\"\";if(typeof node===\"string\"||typeof node===\"number\")return String(node);if(Array.isArray(node)){const combined=node.map(child=>extractText(child)).join(\" \");return normalizeWhitespace(combined);}if(/*#__PURE__*/isValidElement(node)){const childText=extractText(node.props?.children);return normalizeWhitespace(childText);}return\"\";}function getTopLevelBlocks(content){if(content===null||content===undefined)return[];if(Array.isArray(content))return content;if(/*#__PURE__*/isValidElement(content)){const children=content.props?.children;if(Array.isArray(children))return children;if(children!==undefined&&children!==null)return[children];}return[content];}function getTagName(node){if(!/*#__PURE__*/isValidElement(node))return null;return typeof node.type===\"string\"?node.type.toLowerCase():null;}function isFaqSectionHeading(text){if(/frequently\\s+asked\\s+questions?/i.test(text))return true;const stripped=text.trim().replace(/^[^a-z0-9']+|[^a-z0-9']+$/gi,\"\");return/^faq'?s?$/i.test(stripped);}function buildFaqPairs(blocks){const faqHeadingIndex=blocks.findIndex(block=>isFaqSectionHeading(block.text));if(faqHeadingIndex===-1)return[];const questionPattern=/^q[\\.\\)\\:\\-]\\s*/i;const pairs=[];let currentQuestion=\"\";let currentAnswerParts=[];const commitCurrent=()=>{const answer=normalizeWhitespace(currentAnswerParts.join(\" \"));if(currentQuestion&&answer){pairs.push({question:currentQuestion,answer});}};for(let i=faqHeadingIndex+1;i<blocks.length;i++){const{text,tagName}=blocks[i];if(!text)continue;const isPrefixedQuestion=questionPattern.test(text);const isHeadingQuestion=(tagName===\"h3\"||tagName===\"h4\")&&/\\?\\s*$/.test(text);if(isPrefixedQuestion||isHeadingQuestion){if(currentQuestion)commitCurrent();currentQuestion=normalizeWhitespace(isPrefixedQuestion?text.replace(questionPattern,\"\"):text);currentAnswerParts=[];continue;}if(!currentQuestion)continue;currentAnswerParts.push(text);}if(currentQuestion)commitCurrent();return pairs;}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function AutoFAQSchema(props){const{content=null}=props;const schemaJson=useMemo(()=>{const topLevelBlocks=getTopLevelBlocks(content);const blocks=topLevelBlocks.map(block=>({text:normalizeWhitespace(extractText(block)),tagName:getTagName(block)})).filter(block=>Boolean(block.text));const faqItems=buildFaqPairs(blocks);if(faqItems.length===0)return null;const schema={\"@context\":\"https://schema.org\",\"@type\":\"FAQPage\",mainEntity:faqItems.map(item=>({\"@type\":\"Question\",name:item.question,acceptedAnswer:{\"@type\":\"Answer\",text:item.answer}}))};return JSON.stringify(schema);},[content]);if(!schemaJson)return null;return /*#__PURE__*/_jsx(\"script\",{type:\"application/ld+json\",dangerouslySetInnerHTML:{__html:schemaJson},\"aria-hidden\":\"true\"});}addPropertyControls(AutoFAQSchema,{content:{type:ControlType.RichText??\"richText\",title:\"Content\",defaultValue:\"<p></p>\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AutoFAQSchema\",\"slots\":[\"content\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoFAQSchema.map","// User request: Create a new code component named “Blog HowTo Schema” for the existing /blog/:Blog CMS detail page. It must expose one String control `schemaJson`. When it receives valid JSON containing `\"@type\":\"HowTo\"`, render exactly one server-rendered `<script type=\"application/ld+json\">` using the supplied JSON directly in markup. When the value is empty or invalid, render nothing. No client-side effects, no document APIs, and no visible UI. Do not alter or manufacture schema content; preserve supplied JSON as-is after validation.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function BlogHowToSchema(props){const{schemaJson=\"\"}=props;const isValidHowToSchema=useMemo(()=>{if(!schemaJson||schemaJson.trim().length===0)return false;try{const parsed=JSON.parse(schemaJson);return typeof parsed===\"object\"&&parsed!==null&&!Array.isArray(parsed)&&parsed[\"@type\"]===\"HowTo\";}catch(_error){return false;}},[schemaJson]);if(!isValidHowToSchema)return null;return /*#__PURE__*/_jsx(\"script\",{id:\"blog-howto-schema-jsonld\",type:\"application/ld+json\",dangerouslySetInnerHTML:{__html:schemaJson},\"aria-hidden\":\"true\"});}addPropertyControls(BlogHowToSchema,{schemaJson:{type:ControlType.String,title:\"Schema JSON\",defaultValue:\"\",displayTextArea:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BlogHowToSchema\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"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