{"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Contains blocks that are displayed when the cart is empty. with these attributes: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/block.json\n{\n\t\"name\": \"woocommerce/empty-cart-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Empty Cart\",\n\t\"description\": \"Contains blocks that are displayed when the cart is empty.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": [\n\t\t\t\"wide\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx\n/**\n * External dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { useEditorContext } from '@woocommerce/base-context';\nimport { SHOP_URL } from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\n\nconst browseStoreTemplate = SHOP_URL\n\t? [\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t/* translators: %s is the link to the store product directory. */\n\t\t\t\t\t__( 'Browse store', 'woocommerce' ),\n\t\t\t\t\tSHOP_URL\n\t\t\t\t),\n\t\t\t\tdropCap: false,\n\t\t\t},\n\t ]\n\t: null;\n\nconst defaultTemplate = [\n\t[\n\t\t'core/heading',\n\t\t{\n\t\t\ttextAlign: 'center',\n\t\t\tcontent: __( 'Your cart is currently empty!', 'woocommerce' ),\n\t\t\tlevel: 2,\n\t\t\tclassName: 'with-empty-cart-icon wc-block-cart__empty-cart__title',\n\t\t},\n\t],\n\tbrowseStoreTemplate,\n\t[\n\t\t'core/separator',\n\t\t{\n\t\t\tclassName: 'is-style-dots',\n\t\t},\n\t],\n\t[\n\t\t'core/heading',\n\t\t{\n\t\t\ttextAlign: 'center',\n\t\t\tcontent: __( 'New in store', 'woocommerce' ),\n\t\t\tlevel: 2,\n\t\t},\n\t],\n\t[\n\t\t'woocommerce/product-new',\n\t\t{\n\t\t\tcolumns: 4,\n\t\t\trows: 1,\n\t\t},\n\t],\n].filter( Boolean ) as unknown as TemplateArray;\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { currentView } = useEditorContext();\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.EMPTY_CART );\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a flexible block component enabling users to input and customize a specific web link within their content."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/nextdoor/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/nextdoor\",\n\t\"title\": \"Nextdoor\",\n\t\"description\": \"Embed a Nextdoor post for your neighbors on your blog.\",\n\t\"keywords\": [ \"neighbor\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"alignWide\": true,\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/nextdoor/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { getBlockDefaultClassName } from '@wordpress/blocks';\nimport { SandBox, Button, Placeholder, withNotices } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport './editor.scss';\nimport { isEqual } from 'lodash';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\nimport NextdoorControls from './controls';\nimport { parseUrl } from './utils';\n\nconst icon = getBlockIconComponent( metadata );\n\nexport function NextdoorEdit( {\n\tattributes,\n\tclientId,\n\tname,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst defaultClassName = getBlockDefaultClassName( name );\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\n\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\tsetAttributes( validatedAttributes );\n\t}\n\n\tconst { url } = validatedAttributes;\n\tconst [ iframeUrl, setIframeUrl ] = useState( url ? parseUrl( url ) : null );\n\n\tconst [ nextdoorShareUrl, setNextdoorShareUrl ] = useState( iframeUrl );\n\n\tconst setErrorNotice = () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t__(\n\t\t\t\t\"Your Nextdoor post couldn't be embedded. Please double check the URL or code.\",\n\t\t\t\t'jetpack'\n\t\t\t)\n\t\t);\n\t};\n\n\tconst onFormSubmit = event => {\n\t\tif ( ! event ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\n\t\tif ( ! nextdoorShareUrl ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tconst embedUrl = parseUrl( nextdoorShareUrl );\n\n\t\tif ( ! embedUrl ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tsetIframeUrl( embedUrl );\n\t\tsetAttributes( { url: embedUrl } );\n\t};\n\n\tconst blockPlaceholder = (\n\t\t\n\t\t\t
\n\t\t\t\t setNextdoorShareUrl( event.target.value ) }\n\t\t\t\t\tplaceholder={ __( 'Nextdoor post URL', 'jetpack' ) }\n\t\t\t\t\tvalue={ nextdoorShareUrl || '' }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t/>\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t\n\t);\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t{ iframeUrl ? (\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\tblockPlaceholder\n\t\t\t) }\n\t\t
\n\t);\n}\n\nconst BlockPreview = ( { defaultClassName, iframeUrl, clientId } ) => {\n\tconst html = `\n\t\t\n\t\t`;\n\n\tconst permissionsLink = (\n\t\t\n\t\t\t{ __( 'Enable Permissions for the calendar you want to share', 'jetpack' ) }\n\t\t\n\t);\n\n\tconst controls = (\n\t\t\n\t\t\t setEditedEmbed( event.target.value ) }\n\t\t\t\tonSubmit={ handleEmbed }\n\t\t\t/>\n\t\t\n\t);\n\n\tlet content;\n\n\tif ( editingUrl || ! url ) {\n\t\tconst supportLink = isWpcomPlatformSite()\n\t\t\t? 'https://en.support.wordpress.com/wordpress-editor/blocks/google-calendar/'\n\t\t\t: 'https://jetpack.com/support/jetpack-blocks/google-calendar/';\n\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t\t
  1. { permissionsLink }
  2. \n\t\t\t\t\t\t
  3. \n\t\t\t\t\t\t\t{ __( 'Paste the embed code you copied from your Google Calendar below', 'jetpack' ) }\n\t\t\t\t\t\t
  4. \n\t\t\t\t\t
\n\t\t\t\t\t{ getEditForm( `${ defaultClassName }-embed-form-editor` ) }\n\t\t\t\t\t
\n\t\t\t\t\t\t{ __( 'Learn more', 'jetpack' ) }\n\t\t\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t);\n\t} else {\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t
\n\t\t\t\t\t) }\n\t\t\t\t
\n\t\t\t\n\t\t);\n\t}\n\n\treturn
{ content }
;\n}\n\nexport default compose(\n\twithNotices,\n\twithViewportMatch( { isMobile: '< small' } )\n)( GoogleCalendarEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/google-calendar/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default ( { attributes: { url } } ) => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t\n\t\t\t{ url }\n\t\t\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays the rating of a product review. that allows users to configure: text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-rating/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-review-rating\",\n\t\"title\": \"Review Rating\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews\" ],\n\t\"description\": \"Displays the rating of a product review.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-rating/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { REVIEWS_STORE_NAME } from '@woocommerce/data';\n\nexport default function Edit( {\n\t// commentId is the ID of the review.\n\tcontext: { commentId: reviewId },\n\tattributes,\n\tsetAttributes,\n}: BlockEditProps< {\n\ttextAlign: string;\n} > & {\n\tcontext: { commentId: string };\n} ) {\n\tconst { textAlign } = attributes;\n\tconst className = clsx( 'wc-block-product-review-rating', {\n\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t} );\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\tconst rating = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getReview } = select( REVIEWS_STORE_NAME );\n\t\t\tconst review = reviewId ? getReview( Number( reviewId ) ) : null;\n\t\t\treturn review?.rating ?? 4;\n\t\t},\n\t\t[ reviewId ]\n\t);\n\n\tconst starStyle = {\n\t\twidth: ( rating / 5 ) * 100 + '%',\n\t};\n\n\tconst ratingText = sprintf(\n\t\t/* translators: %f is referring to the average rating value */\n\t\t__( 'Rated %f out of 5', 'woocommerce' ),\n\t\trating\n\t);\n\n\tconst ratingHTML = {\n\t\t__html: sprintf(\n\t\t\t/* translators: %s is the rating value wrapped in HTML strong tags. */\n\t\t\t__( 'Rated %s out of 5', 'woocommerce' ),\n\t\t\tsprintf( '%f', rating )\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign || '' } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block to showcase dynamically refreshed Instagram post thumbnails, incorporating configuration settings for authentication, user selection, grid layout, and additional customization parameters."}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/instagram-gallery\",\n\t\"title\": \"Latest Instagram Posts\",\n\t\"description\": \"Display an automatically updating list of the latest posts from your Instagram feed.\",\n\t\"keywords\": [ \"images\", \"photos\", \"pictures\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": { \"align\": true, \"html\": false },\n\t\"attributes\": {\n\t\t\"accessToken\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"instagramUser\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3,\n\t\t\t\"min\": 1,\n\t\t\t\"max\": 6\n\t\t},\n\t\t\"count\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 9,\n\t\t\t\"min\": 1,\n\t\t\t\"max\": 30\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 10,\n\t\t\t\"min\": 0,\n\t\t\t\"max\": 50\n\t\t},\n\t\t\"isStackedOnMobile\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/edit.js\nimport { isCurrentUserConnected } from '@automattic/jetpack-shared-extension-utils';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { Button, Placeholder, RadioControl, Spinner, withNotices } from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { isEmpty, isEqual } from 'lodash';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\nimport { NEW_INSTAGRAM_CONNECTION } from './constants';\nimport InstagramGalleryInspectorControls from './controls';\nimport ImageTransition from './image-transition';\nimport useConnectInstagram from './use-connect-instagram';\nimport useConnectWpcom from './use-connect-wpcom';\nimport useInstagramGallery from './use-instagram-gallery';\nimport './editor.scss';\n\nconst InstagramGalleryEdit = props => {\n\tconst blockProps = useBlockProps();\n\tconst { attributes, isSelected, noticeOperations, noticeUI, setAttributes } = props;\n\tconst { accessToken, align, columns, count, isStackedOnMobile, spacing } = attributes;\n\tuseEffect( () => {\n\t\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\t\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\t\tsetAttributes( validatedAttributes );\n\t\t}\n\t}, [ attributes, setAttributes ] );\n\n\tconst [ selectedAccount, setSelectedAccount ] = useState( accessToken );\n\tconst { isRequestingWpcomConnectUrl, wpcomConnectUrl } = useConnectWpcom();\n\tconst { images, isLoadingGallery, setImages } = useInstagramGallery( {\n\t\taccessToken,\n\t\tnoticeOperations,\n\t\tsetAttributes,\n\t\tsetSelectedAccount,\n\t} );\n\tconst {\n\t\tconnectToService,\n\t\tdisconnectFromService,\n\t\tisConnecting,\n\t\tisRequestingUserConnections,\n\t\tuserConnections,\n\t} = useConnectInstagram( {\n\t\taccessToken,\n\t\tnoticeOperations,\n\t\tselectedAccount,\n\t\tsetAttributes,\n\t\tsetImages,\n\t\tsetSelectedAccount,\n\t} );\n\n\tconst currentUserConnected = isCurrentUserConnected();\n\tconst unselectedCount = count > images.length ? images.length : count;\n\n\tconst showPlaceholder = ! isLoadingGallery && ( ! accessToken || isEmpty( images ) );\n\tconst showSidebar = ! showPlaceholder;\n\tconst showLoadingSpinner = accessToken && isLoadingGallery && isEmpty( images );\n\tconst showGallery = ! showPlaceholder && ! showLoadingSpinner;\n\n\tconst blockClasses = clsx( blockProps.className, { [ `align${ align }` ]: align } );\n\tconst gridClasses = clsx(\n\t\t'wp-block-jetpack-instagram-gallery__grid',\n\t\t`wp-block-jetpack-instagram-gallery__grid-columns-${ columns }`,\n\t\t{ 'is-stacked-on-mobile': isStackedOnMobile }\n\t);\n\tconst gridStyle = {\n\t\tgridGap: spacing,\n\t\t// Used to only apply padding when stacked in mobile viewport.\n\t\t[ `--latest-instagram-posts-spacing` ]: spacing ? `${ spacing }px` : undefined,\n\t};\n\tconst photoStyle = { padding: spacing }; // Needed so the updates to the grid gap render when changed.\n\n\tconst shouldRenderSidebarNotice = () =>\n\t\tshowSidebar && ! showLoadingSpinner && images.length < count;\n\n\tconst renderImage = index => {\n\t\tif ( images[ index ] ) {\n\t\t\tconst image = images[ index ];\n\t\t\treturn (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t\n\t\t);\n\t};\n\n\tconst connectBlockToInstagram = () => {\n\t\tif ( selectedAccount && NEW_INSTAGRAM_CONNECTION !== selectedAccount ) {\n\t\t\tsetAttributes( {\n\t\t\t\taccessToken: selectedAccount,\n\t\t\t\tinstagramUser: userConnections.find( v => v.token === selectedAccount ).username,\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\t\tconnectToService();\n\t};\n\n\tconst renderPlaceholderInstructions = () => {\n\t\tif ( ! currentUserConnected ) {\n\t\t\treturn __( \"First, you'll need to connect your WordPress.com account.\", 'jetpack' );\n\t\t}\n\t\tif ( ! isRequestingUserConnections && ! userConnections.length ) {\n\t\t\treturn __( 'Connect to Instagram to start sharing your images.', 'jetpack' );\n\t\t}\n\t};\n\n\tconst renderInstagramConnection = () => {\n\t\tconst hasUserConnections = userConnections.length > 0;\n\t\tconst radioOptions = [\n\t\t\t...userConnections.map( connection => ( {\n\t\t\t\tlabel: `@${ connection.username }`,\n\t\t\t\tvalue: connection.token,\n\t\t\t} ) ),\n\t\t\t{\n\t\t\t\tlabel: __( 'Add a new account', 'jetpack' ),\n\t\t\t\tvalue: NEW_INSTAGRAM_CONNECTION,\n\t\t\t},\n\t\t];\n\t\tconst isButtonDisabled =\n\t\t\tisConnecting || isRequestingUserConnections || ( hasUserConnections && ! selectedAccount );\n\n\t\treturn (\n\t\t\t
\n\t\t\t\t{ hasUserConnections && (\n\t\t\t\t\t setSelectedAccount( value ) }\n\t\t\t\t\t\toptions={ radioOptions }\n\t\t\t\t\t\tselected={ selectedAccount }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ NEW_INSTAGRAM_CONNECTION === selectedAccount && (\n\t\t\t\t\t

\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If you are currently logged in to Instagram on this device, you might need to log out of it first.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

\n\t\t\t\t) }\n\t\t\t\t\n\t\t\t
\n\t\t);\n\t};\n\n\treturn (\n\t\t
\n\t\t\t{ showPlaceholder && (\n\t\t\t\t\n\t\t\t\t\t{ currentUserConnected ? (\n\t\t\t\t\t\trenderInstagramConnection()\n\t\t\t\t\t) : (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Connect to WordPress.com', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t) }\n\n\t\t\t{ showLoadingSpinner && (\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t

{ __( 'Embedding…', 'jetpack' ) }

\n\t\t\t\t
\n\t\t\t) }\n\n\t\t\t{ showGallery && (\n\t\t\t\t
\n\t\t\t\t\t{ Array.from( Array( isSelected ? count : unselectedCount ), ( _, index ) => (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ renderImage( index ) }\n\t\t\t\t\t\t\n\t\t\t\t\t) ) }\n\t\t\t\t
\n\t\t\t) }\n\n\t\t\t{ showSidebar && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
\n\t);\n};\n\nexport default withNotices( InstagramGalleryEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default ( { attributes: { instagramUser } } ) => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\tinstagramUser && (\n\t\t\t
\n\t\t\t\t{ `https://www.instagram.com/${ instagramUser }/` }\n\t\t\t
\n\t\t)\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Enable customers to change the sorting order of the products. with these attributes: font size, use label"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/block.json\n{\n\t\"name\": \"woocommerce/catalog-sorting\",\n\t\"title\": \"Catalog Sorting\",\n\t\"description\": \"Enable customers to change the sorting order of the products.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"fontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"small\"\n\t\t},\n\t\t\"useLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { Disabled, PanelBody, ToggleControl } from '@wordpress/components';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BlockAttributes } from './types';\n\nconst CatalogSorting = ( {\n\tuseLabel,\n}: Pick< BlockAttributes, 'useLabel' > ) => {\n\treturn (\n\t\t<>\n\t\t\t{ useLabel ? (\n\t\t\t\t<>\n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Sort by', 'woocommerce' ) }\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n};\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: BlockEditProps< BlockAttributes > ) => {\n\tconst { useLabel } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'woocommerce wc-block-catalog-sorting',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tuseLabel: isChecked,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Implement a flexible text component allowing dynamic content, source attribution, and text alignment options within a WordPress block."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/pullquote/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/pullquote\",\n\t\"title\": \"Pullquote (deprecated)\",\n\t\"category\": \"text\",\n\t\"description\": \"This block is deprecated. Please use the Quote block instead.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"value\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"p\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"citation\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"cite\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"left\", \"right\", \"wide\", \"full\" ],\n\t\t\"background\": {\n\t\t\t\"backgroundImage\": true,\n\t\t\t\"backgroundSize\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"backgroundImage\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"minHeight\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"minHeight\": false\n\t\t\t}\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalStyle\": {\n\t\t\t\"typography\": {\n\t\t\t\t\"fontSize\": \"1.5em\",\n\t\t\t\t\"lineHeight\": \"1.6\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-pullquote-editor\",\n\t\"style\": \"wp-block-pullquote\"\n}\n\n\n// File: packages/block-library/src/pullquote/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'value',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'citation',\n\t\t\tlabel: __( 'Citation' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'value' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/pullquote/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { textAlign, citation, value } = attributes;\n\tconst shouldShowCitation = ! RichText.isEmpty( citation );\n\n\treturn (\n\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a media block with customizable image before, image after, caption, orientation"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/image-compare/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/image-compare\",\n\t\"title\": \"Image Compare\",\n\t\"description\": \"Compare two images with a slider. Works best with images of the same size.\",\n\t\"keywords\": [ \"juxtapose\", \"photos\", \"pictures\", \"side by side\", \"slider\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"media\",\n\t\"icon\": \"\",\n\t\"supports\": { \"align\": [ \"wide\", \"full\" ] },\n\t\"attributes\": {\n\t\t\"imageBefore\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t},\n\t\t\"imageAfter\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"orientation\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"horizontal\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/image-compare/edit.js\nimport { InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useLayoutEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { photonizedImgProps } from '../tiled-gallery/utils';\nimport ImageCompareControls from './controls';\nimport ImgUpload from './img-upload';\nimport useDebounce from './use-debounce';\nimport './editor.scss';\nimport './view.js';\n\n/* global juxtapose */\n\nconst Edit = ( { attributes, clientId, isSelected, setAttributes } ) => {\n\tconst { align, imageBefore, imageAfter, caption, orientation } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst juxtaposeRef = useRef( undefined );\n\tconst [ containerWidth, setContainerWidth ] = useState( 0 );\n\n\t// Let's look for resize so we can trigger the thing.\n\tconst setElement = useResizeObserver(\n\t\tresizeObserverEntries => {\n\t\t\tconst width = resizeObserverEntries[ 0 ]?.contentRect.width;\n\t\t\tif ( width ) {\n\t\t\t\tsetContainerWidth( width );\n\t\t\t}\n\t\t},\n\t\t{ box: 'border-box' }\n\t);\n\n\tuseDebounce(\n\t\tsz => {\n\t\t\tif ( sz > 0 ) {\n\t\t\t\tif ( typeof juxtapose !== 'undefined' && juxtapose.sliders ) {\n\t\t\t\t\t// only update for *this* slide\n\t\t\t\t\tjuxtapose.sliders.forEach( elem => {\n\t\t\t\t\t\tconst parentElem = elem.wrapper.parentElement;\n\t\t\t\t\t\tif ( parentElem.id === clientId ) {\n\t\t\t\t\t\t\telem.optimizeWrapper( sz );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t200,\n\t\tcontainerWidth\n\t);\n\n\t// Initial state if attributes already set or not.\n\t// If both images are set, add juxtapose class, which is picked up by the library.\n\tconst isComplete = imageBefore && imageBefore.url && imageAfter && imageAfter.url;\n\tconst classes = isComplete ? 'image-compare__comparison juxtapose' : 'image-compare__placeholder';\n\n\t// Watching for changes to key variables to trigger scan.\n\tuseLayoutEffect( () => {\n\t\tif ( imageBefore.url && imageAfter.url && typeof juxtapose !== 'undefined' ) {\n\t\t\tif ( juxtaposeRef.current ) {\n\t\t\t\tsetElement( juxtaposeRef.current );\n\t\t\t\tjuxtapose.makeSlider( juxtaposeRef?.current );\n\t\t\t}\n\t\t}\n\t}, [ align, imageBefore, imageAfter, orientation, setElement ] );\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tif ( img.media_type === 'image' || img.type === 'image' ) {\n\t\t\t\t\t\t\t\t\tconst { src } = photonizedImgProps( img );\n\t\t\t\t\t\t\t\t\tconst { alt, id, media_details } = img;\n\t\t\t\t\t\t\t\t\tconst width = media_details?.width ?? img.width;\n\t\t\t\t\t\t\t\t\tconst height = media_details?.height ?? img.height;\n\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\timageBefore: {\n\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\turl: src ? src : img.url,\n\t\t\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tif ( img.media_type === 'image' || img.type === 'image' ) {\n\t\t\t\t\t\t\t\t\tconst { src } = photonizedImgProps( img );\n\t\t\t\t\t\t\t\t\tconst { alt, id, media_details } = img;\n\t\t\t\t\t\t\t\t\tconst width = media_details?.width ?? img.width;\n\t\t\t\t\t\t\t\t\tconst height = media_details?.height ?? img.height;\n\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\timageAfter: {\n\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\turl: src ? src : img.url,\n\t\t\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t{ ( ! RichText.isEmpty( caption ) ||\n\t\t\t\t( isSelected && imageBefore.url && imageAfter.url ) ) && (\n\t\t\t\t setAttributes( { caption: value } ) }\n\t\t\t\t\tinlineToolbar\n\t\t\t\t/>\n\t\t\t) }\n\t\t
\n\t);\n};\n\nexport default Edit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/image-compare/save.js\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nconst save = ( { attributes } ) => {\n\tconst blockProps = useBlockProps.save();\n\tconst { imageBefore, imageAfter, caption, orientation } = attributes;\n\n\treturn (\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t\n\t\t\t) }\n\t\t
\n\t);\n};\n\nexport default save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the post count of a taxonomy term. with these attributes: bracket type"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-count/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-count\",\n\t\"title\": \"Term Count\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the post count of a taxonomy term.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termId\", \"taxonomy\" ],\n\t\"attributes\": {\n\t\t\"bracketType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"none\", \"round\", \"square\", \"curly\", \"angle\" ],\n\t\t\t\"default\": \"round\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-term-count\"\n}\n\n\n// File: packages/block-library/src/term-count/index.js\n/**\n * WordPress dependencies\n */\nimport { termCount as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a revenue-generating WordPress block that allows flexible URL customization for monetization purposes."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/tock/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/tock\",\n\t\"title\": \"Tock\",\n\t\"description\": \"Reserve a table at your restaurant with Tock.\",\n\t\"keywords\": [ \"booking\", \"reservation\", \"restaurant\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": false\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"url\": \"roister\"\n\t\t},\n\t\t\"viewportWidth\": 250\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/tock/edit.js\nimport { useBlockProps, BlockControls } from '@wordpress/block-editor';\nimport {\n\tSandBox,\n\tTextControl,\n\tToolbarGroup,\n\tToolbarButton,\n\tButton,\n\tBaseControl,\n\tDropdown,\n} from '@wordpress/components';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { ENTER, ESCAPE } from '@wordpress/keycodes';\n\nimport './editor.scss';\n\nconst UrlDropdown = ( { tockUrl, setEditedUrl, setUrl, cancel } ) => {\n\tconst firstRender = useRef( true );\n\tconst committedChanges = useRef( false );\n\tconst handleSubmitOrCancel = ( event, onClose ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t'' !== tockUrl // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tcommitChanges( onClose );\n\t\t}\n\n\t\tif ( keyCode === ESCAPE ) {\n\t\t\tevent.preventDefault();\n\t\t\tcancel();\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst commitChanges = close => {\n\t\tsetUrl();\n\t\tcommittedChanges.current = true;\n\t\tclose();\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\tcommittedChanges.current ? ( committedChanges.current = false ) : cancel()\n\t\t\t\t}\n\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\tif ( firstRender.current && ! isOpen && ! tockUrl ) {\n\t\t\t\t\t\tfirstRender.current = false;\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tisOpen && cancel();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\tmyname',\n\t\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tb: ,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t>\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t handleSubmitOrCancel( event, onClose ) }\n\t\t\t\t\t\t\t\tclassName=\"jetpack-tock-url-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t commitChanges( onClose ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t/>\n\t\t
\n\t);\n};\n\nconst TockPreview = ( { url, popoverAnchor } ) => {\n\tconst html = `\n\t\t
\n\t\t\n\t\t\n\t`;\n\n\treturn (\n\t\t
\n\t\t\t{\n\t\t\t\t// Related to this bug (https://github.com/WordPress/gutenberg/issues/16831), the\n\t\t\t\t// `SandBox` component won't rerun the scripts correctly when the injected `html` prop changes.\n\t\t\t\t// To work around that, we change the key of the component to force a new one render\n\t\t\t }\n\t\t\t\n\t\t\t{ /* Use an overlay to prevent interactivity with the preview, since the preview does not always resize correctly. */ }\n\t\t\t
\n\t\t
\n\t);\n};\n\nexport default function TockBlockEdit( { attributes, setAttributes, isSelected } ) {\n\tconst tockUrl = attributes.url ?? '';\n\tconst [ editedUrl, setEditedUrl ] = useState( tockUrl );\n\n\tconst setUrl = () => {\n\t\tconst newUrl = editedUrl.replace( /.*exploretock.com\\//, '' );\n\t\tsetEditedUrl( newUrl );\n\t\tsetAttributes( { url: newUrl } );\n\t};\n\n\tconst cancel = useCallback( () => {\n\t\tsetEditedUrl( tockUrl );\n\t}, [ tockUrl ] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tcancel();\n\t\t}\n\t}, [ isSelected, cancel ] );\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t
\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a flexible podcast playback block that empowers users to select and stream episodes, offering extensive customization through settings like source URL, episode filtering, display limits, and multiple advanced options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/podcast-player\",\n\t\"title\": \"Podcast Player\",\n\t\"description\": \"Select and play episodes from a single podcast.\",\n\t\"keywords\": [ \"audio\", \"embed\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"anchor\": false,\n\t\t\"customClassName\": true,\n\t\t\"className\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"selectedEpisodes\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"itemsToShow\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"showCoverArt\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showEpisodeTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showEpisodeDescription\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"primaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customPrimaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexPrimaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"secondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customSecondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexSecondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"backgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"exampleFeedData\": {\n\t\t\t\"type\": \"object\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"customPrimaryColor\": \"GREEN\",\n\t\t\t\"hexPrimaryColor\": \"GREEN\",\n\t\t\t\"exampleFeedData\": {\n\t\t\t\t\"title\": \"Jetpack Example Podcast\",\n\t\t\t\t\"link\": \"https://jetpack.com\",\n\t\t\t\t\"cover\": \"https://jetpackme.files.wordpress.com/2020/05/jetpack-example-podcast-cover.png?w=160\",\n\t\t\t\t\"tracks\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"3\",\n\t\t\t\t\t\t\"title\": \"3. Our third episode\",\n\t\t\t\t\t\t\"duration\": \"14:58\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"2\",\n\t\t\t\t\t\t\"title\": \"2. Interview with a special guest\",\n\t\t\t\t\t\t\"duration\": \"19:17\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"1\",\n\t\t\t\t\t\t\"title\": \"1. Welcome to Example Podcast\",\n\t\t\t\t\t\t\"duration\": \"11:25\"\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/edit.js\nimport { isWpcomPlatformSite } from '@automattic/jetpack-script-data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\twithColors,\n\tPanelColorSettings,\n\tContrastChecker,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tButton,\n\tExternalLink,\n\tPanelBody,\n\tPlaceholder,\n\tRangeControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\twithNotices,\n\tToggleControl,\n\tSpinner,\n\tComboboxControl,\n} from '@wordpress/components';\nimport { compose, withInstanceId } from '@wordpress/compose';\nimport { withDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useState, useRef, useReducer, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport debugFactory from 'debug';\nimport { debounce } from 'lodash';\nimport { applyFallbackStyles } from '../../shared/apply-fallback-styles';\nimport { maybeCopyElementsToSiteEditorContext } from '../../shared/block-editor-asset-loader';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport { fetchPodcastFeed, fetchTrackQuantity } from './api';\nimport metadata from './block.json';\nimport PodcastPlayer from './components/podcast-player';\nimport { PODCAST_FEED, EMBED_BLOCK } from './constants';\nimport { queueMusic } from './icons/';\nimport { podcastPlayerReducer, actions } from './state';\nimport { makeCancellable } from './utils';\n\nimport './editor.scss';\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst debug = debugFactory( 'jetpack:podcast-player:edit' );\nconst noop = () => {};\n\n// Support page link.\nconst supportUrl = isWpcomPlatformSite()\n\t? 'http://en.support.wordpress.com/wordpress-editor/blocks/podcast-player-block/'\n\t: 'https://jetpack.com/support/jetpack-blocks/podcast-player-block/';\n\nconst PodcastPlayerEdit = ( {\n\tinstanceId,\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations: { createErrorNotice, removeAllNotices },\n\tnoticeUI,\n\tprimaryColor: primaryColorProp,\n\tsetPrimaryColor,\n\tsecondaryColor: secondaryColorProp,\n\tsetSecondaryColor,\n\tfallbackTextColor,\n\tbackgroundColor: backgroundColorProp,\n\tsetBackgroundColor,\n\tfallbackBackgroundColor,\n\tisSelected,\n\treplaceWithEmbedBlock,\n} ) => {\n\t// Validated attributes.\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\tconst {\n\t\turl,\n\t\tselectedEpisodes,\n\t\titemsToShow,\n\t\tshowCoverArt,\n\t\tshowEpisodeTitle,\n\t\tshowEpisodeDescription,\n\t\texampleFeedData,\n\t} = validatedAttributes;\n\n\tconst playerId = `jetpack-podcast-player-block-${ instanceId }`;\n\n\tconst blockProps = useBlockProps();\n\tconst [ hasMigratedStyles, setHasMigratedStyles ] = useState( false );\n\tconst [ defaultMaxItems, setDefaultMaxItems ] = useState( 10 );\n\n\t// State.\n\tconst cancellableFetch = useRef( undefined );\n\tconst [ { selectedGuid, checkUrl, ...state }, dispatch ] = useReducer( podcastPlayerReducer, {\n\t\teditedUrl: url || '',\n\t\tisEditing: ! url && ! exampleFeedData,\n\t\tisLoading: false,\n\t\tfeedData: exampleFeedData || {},\n\t\tisInteractive: false,\n\t\tselectedGuid: selectedEpisodes?.[ 0 ]?.guid,\n\t\tcheckUrl: url || '',\n\t} );\n\n\tconst fetchFeed = useMemo(\n\t\t() =>\n\t\t\tdebounce( requestParams => {\n\t\t\t\tdispatch( { type: actions.START_FETCH } );\n\t\t\t\tcancellableFetch.current?.cancel();\n\t\t\t\tcancellableFetch.current = makeCancellable(\n\t\t\t\t\tfetchPodcastFeed( { ...requestParams, fetchEpisodeOptions: true } )\n\t\t\t\t);\n\n\t\t\t\tcancellableFetch.current.promise.then(\n\t\t\t\t\tresponse => {\n\t\t\t\t\t\tremoveAllNotices();\n\t\t\t\t\t\tif ( response?.isCanceled ) {\n\t\t\t\t\t\t\tdebug( 'Block was unmounted during fetch', response );\n\t\t\t\t\t\t\treturn; // bail if canceled to avoid setting state\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check what type of response we got and act accordingly.\n\t\t\t\t\t\tswitch ( response?.type ) {\n\t\t\t\t\t\t\tcase PODCAST_FEED:\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\turl: requestParams.url,\n\t\t\t\t\t\t\t\t\tselectedEpisodes: requestParams.guids.map( guid => ( { guid } ) ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn dispatch( { type: actions.FEED_RECEIVED, payload: response.data } );\n\t\t\t\t\t\t\tcase EMBED_BLOCK:\n\t\t\t\t\t\t\t\treturn replaceWithEmbedBlock();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\tif ( error?.isCanceled ) {\n\t\t\t\t\t\t\tdebug( 'Block was unmounted during fetch', error );\n\t\t\t\t\t\t\treturn; // bail if canceled to avoid setting state\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Show error and allow to edit URL.\n\t\t\t\t\t\tdebug( 'feed error', error );\n\t\t\t\t\t\tremoveAllNotices();\n\t\t\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t\t\t// Error messages already come localized.\n\t\t\t\t\t\t\terror.message ||\n\t\t\t\t\t\t\t\t// Fallback to a generic message.\n\t\t\t\t\t\t\t\t__( \"Your podcast couldn't be embedded. Please double check your URL.\", 'jetpack' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdispatch( { type: actions.START_EDITING } );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}, 300 ),\n\t\t[ replaceWithEmbedBlock, setAttributes, createErrorNotice, removeAllNotices ]\n\t);\n\n\t// Call once on mount or unmount (the return callback).\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcancellableFetch?.current?.cancel?.();\n\t\t};\n\t}, [] );\n\n\t// The Podcast player audio element requires wpmedialement styles.\n\t// These aren't available in the Site Editor context, so we have to copy them in.\n\tconst podCastPlayerRef = useCallback(\n\t\tnode => {\n\t\t\tif ( node !== null && ! hasMigratedStyles ) {\n\t\t\t\tmaybeCopyElementsToSiteEditorContext(\n\t\t\t\t\t[ 'link#mediaelement-css', 'link#wp-mediaelement-css' ],\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tsetHasMigratedStyles( true );\n\t\t\t}\n\t\t},\n\t\t[ hasMigratedStyles ]\n\t);\n\n\t// Load RSS feed initially and when the feed or selected episode changes.\n\tuseEffect( () => {\n\t\t// Don't do anything if no url is set.\n\t\tif ( '' === checkUrl ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfetchFeed( {\n\t\t\turl: checkUrl,\n\t\t\tguids: selectedGuid ? [ selectedGuid ] : [],\n\t\t} );\n\n\t\treturn () => cancellableFetch?.current?.cancel?.();\n\t}, [ fetchFeed, checkUrl, selectedGuid ] );\n\n\t// Retrieve tracks quantity to fetch; the jetpack_podcast_helper_tracks_quantity filter value.\n\tuseEffect( () => {\n\t\tfetchTrackQuantity().then( response => {\n\t\t\tsetDefaultMaxItems( response );\n\t\t} );\n\t}, [] );\n\n\t// Make sure itemsToShow is 1 when we have a selected episode\n\tuseEffect( () => {\n\t\tif ( selectedGuid && 1 !== itemsToShow ) {\n\t\t\tsetAttributes( { itemsToShow: 1 } );\n\t\t}\n\t}, [ selectedGuid, itemsToShow, setAttributes ] );\n\n\t// Bring back the overlay after block gets deselected.\n\tuseEffect( () => {\n\t\tif ( ! isSelected && state.isInteractive ) {\n\t\t\tdispatch( { type: actions.PREVENT_INTERACTIONS } );\n\t\t}\n\t}, [ isSelected, state.isInteractive ] );\n\n\t/**\n\t * Check if the current URL of the Podcast RSS feed is valid. If so, set the\n\t * block attribute and changes the edition mode. This function is bound to the\n\t * onSubmit event for the form.\n\t *\n\t * @param {object} event - Form on submit event object.\n\t */\n\tconst checkPodcastLink = event => {\n\t\tevent.preventDefault();\n\n\t\tif ( '' === state.editedUrl ) {\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Ensure URL has `http` appended to it (if it doesn't already) before we\n\t\t * accept it as the entered URL.\n\t\t */\n\t\tconst prependedURL = prependHTTP( state.editedUrl );\n\n\t\tif ( ! isURL( prependedURL ) ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\t__( \"Your podcast couldn't be embedded. Please double check your URL.\", 'jetpack' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Short-circuit feed fetching if we tried before, use useEffect otherwise.\n\t\t * @see {@link https://github.com/Automattic/jetpack/pull/15213}\n\t\t */\n\t\tif ( prependedURL === checkUrl ) {\n\t\t\t// Reset the feedData, so that we display the spinner.\n\t\t\tdispatch( { type: actions.CLEAR_FEED } );\n\t\t\tfetchFeed( {\n\t\t\t\turl: checkUrl,\n\t\t\t\tguids: selectedEpisodes[ 0 ]?.guid ? [ selectedEpisodes[ 0 ].guid ] : [],\n\t\t\t} );\n\t\t} else {\n\t\t\tdispatch( { type: actions.CHECK_URL, payload: prependedURL } );\n\t\t}\n\n\t\t/*\n\t\t * Also update the temporary `input` value in order that clicking `Replace`\n\t\t * in the UI will show the \"corrected\" version of the URL (ie: with `http`\n\t\t * prepended if it wasn't originally present).\n\t\t */\n\t\tdispatch( { type: actions.FINISH_EDITING, payload: prependedURL } );\n\t};\n\n\tlet content;\n\n\tif ( state.isEditing ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t{ noticeUI }\n\t\t\t\t\t dispatch( { type: actions.EDIT_URL, payload: editedUrl } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Learn more about embeds', 'jetpack' ) }\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t);\n\t}\n\n\t// With no tracks data, this is either the first load or the URL has changed\n\t// and we need the data to refresh before displaying the other controls.\n\telse if ( ! state.feedData.tracks?.length ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t} else {\n\t\tconst createColorChangeHandler = ( colorAttr, handler ) => color => {\n\t\t\tsetAttributes( { [ colorAttr ]: color } );\n\t\t\thandler( color );\n\t\t};\n\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t dispatch( { type: actions.START_EDITING } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Replace', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{ ( ComboboxControl || 0 === selectedEpisodes.length ) && (\n\t\t\t\t\t\t\t setAttributes( { itemsToShow: selectedGuid ? 1 : value } ) }\n\t\t\t\t\t\t\t\tmin={ DEFAULT_MIN_ITEMS }\n\t\t\t\t\t\t\t\tmax={ defaultMaxItems }\n\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t\tdisabled={ !! selectedGuid }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ComboboxControl && (\n\t\t\t\t\t\t\t dispatch( { type: actions.SELECT_EPISODE, payload: guid } ) }\n\t\t\t\t\t\t\t\toptions={ state.feedData.options || [] }\n\t\t\t\t\t\t\t\tlabel={ __( 'Episode', 'jetpack' ) }\n\t\t\t\t\t\t\t\tonFilterValueChange={ noop }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t setAttributes( { showCoverArt: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t setAttributes( { showEpisodeTitle: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t setAttributes( { showEpisodeDescription: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Disabled because the overlay div doesn't actually have a role or\n\t\t\t\t\t * functionality as far as the user is concerned. We're just catching\n\t\t\t\t\t * the first click so that the block can be selected without\n\t\t\t\t\t * interacting with the embed preview that the overlay covers.\n\t\t\t\t\t */ }\n\t\t\t\t\t{ /* eslint-disable jsx-a11y/no-static-element-interactions */ }\n\t\t\t\t\t{ ! state.isInteractive && ! state.isLoading && (\n\t\t\t\t\t\t dispatch( { type: actions.MAKE_INTERACTIVE } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-static-element-interactions */ }\n\t\t\t\t\t{ state.isLoading && (\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t) }\n\t\t\t\t
\n\t\t\t\n\t\t);\n\t}\n\n\treturn
{ content }
;\n};\n\nexport default compose( [\n\twithDispatch( ( dispatch, { clientId, attributes } ) => {\n\t\treturn {\n\t\t\treplaceWithEmbedBlock() {\n\t\t\t\tdispatch( 'core/block-editor' ).replaceBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tcreateBlock( 'core/embed', {\n\t\t\t\t\t\turl: attributes.url,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} ),\n\twithColors( 'backgroundColor', { primaryColor: 'color' }, { secondaryColor: 'color' } ),\n\twithNotices,\n\twithInstanceId,\n\tapplyFallbackStyles,\n] )( PodcastPlayerEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { url } = attributes;\n\tif ( ! url || url === '' ) {\n\t\treturn;\n\t}\n\n\tconst blockProps = useBlockProps.save();\n\treturn (\n\t\t\n\t\t\t{ url }\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WooCommerce block that provides users the ability to refine product grid results through price range selection, offering extensive customization like class assignment, input field visibility, and inline input preferences."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/price-filter/block.json\n{\n\t\"name\": \"woocommerce/price-filter\",\n\t\"title\": \"Filter by Price Controls\",\n\t\"description\": \"Enable customers to filter the product grid by choosing a price range.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"showInputFields\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"inlineInput\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showFilterButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"headingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/price-filter/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { getAdminLink } from '@woocommerce/settings';\nimport { blocksConfig } from '@woocommerce/block-settings';\nimport BlockTitle from '@woocommerce/editor-components/block-title';\nimport { Icon, currencyDollar, external } from '@wordpress/icons';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tDisabled,\n\tPanelBody,\n\tToggleControl,\n\tButton,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\nimport type { Attributes } from './types';\nimport { UpgradeNotice } from '../filter-wrapper/upgrade';\n\nexport default function ( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n}: BlockEditProps< Attributes > ) {\n\tconst {\n\t\theading,\n\t\theadingLevel,\n\t\tshowInputFields,\n\t\tinlineInput,\n\t\tshowFilterButton,\n\t} = attributes;\n\n\tconst blockProps = useBlockProps();\n\n\tconst getInspectorControls = () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowInputFields: value === 'editable',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-price-filter__price-range-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t{ showInputFields && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tinlineInput: ! inlineInput,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Show input fields inline with the slider.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowFilterButton: ! showFilterButton,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tconst noProductsPlaceholder = () => (\n\t\t }\n\t\t\tlabel={ __( 'Filter by Price', 'woocommerce' ) }\n\t\t\tinstructions={ __(\n\t\t\t\t'Display a slider to filter products in your store by price.',\n\t\t\t\t'woocommerce'\n\t\t\t) }\n\t\t>\n\t\t\t

\n\t\t\t\t{ __(\n\t\t\t\t\t'To filter your products by price you first need to assign prices to your products.',\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t

\n\t\t\t\n\t\t\t\t{ __( 'Add new product', 'woocommerce' ) + ' ' }\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t{ __( 'Learn more', 'woocommerce' ) }\n\t\t\t\n\t\t\n\t);\n\n\treturn (\n\t\t
\n\t\t\t{ blocksConfig.productCount === 0 ? (\n\t\t\t\tnoProductsPlaceholder()\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{ getInspectorControls() }\n\t\t\t\t\t{ heading && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( { heading: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a personalized WordPress block for showcasing taxonomy term information, integrating core components like the term's title, descriptive text, and supplementary details."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-template/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-template\",\n\t\"title\": \"Term Template\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/terms-query\" ],\n\t\"description\": \"Contains the block elements used to render a taxonomy term, like the name, description, and more.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termQuery\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"layout\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": {\n\t\t\t\t\"__experimentalDefault\": \"1.25em\"\n\t\t\t},\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"margin\": false\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-term-template\",\n\t\"editorStyle\": \"wp-block-term-template-editor\"\n}\n\n\n// File: packages/block-library/src/term-template/index.js\n/**\n * WordPress dependencies\n */\nimport { layout as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/term-template/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function TermTemplateSave() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom Gutenberg block to render page number navigation with configurable mid-range pagination settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/query-pagination-numbers/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-pagination-numbers\",\n\t\"title\": \"Page Numbers\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/query-pagination\" ],\n\t\"description\": \"Displays a list of page numbers for pagination.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"midSize\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t}\n\t},\n\t\"usesContext\": [ \"queryId\", \"query\", \"enhancedPagination\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-query-pagination-numbers-editor\"\n}\n\n\n// File: packages/block-library/src/query-pagination-numbers/index.js\n/**\n * WordPress dependencies\n */\nimport { queryPaginationNumbers as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for The author biography. that allows users to configure: text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-author-biography/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-author-biography\",\n\t\"title\": \"Author Biography\",\n\t\"category\": \"theme\",\n\t\"description\": \"The author biography.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\", \"postId\" ],\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-author-biography\"\n}\n\n\n// File: packages/block-library/src/post-author-biography/index.js\n/**\n * WordPress dependencies\n */\nimport { postAuthor as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable is preview, product id"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/single-product/block.json\n{\n\t\"name\": \"woocommerce/single-product\",\n\t\"icon\": \"info\",\n\t\"title\": \"Product\",\n\t\"description\": \"Display a single product of your choice with full control over its presentation.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\", \"single product\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"align\": [ \"wide\", \"full\" ]\n\t},\n\t\"attributes\": {\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\", \"queryId\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/single-product/save.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nconst Save = () => {\n\t// We add the `woocommerce` class to the wrapper to apply WooCommerce styles to the block.\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: 'woocommerce',\n\t} );\n\n\treturn (\n\t\t
\n\t\t\t{ /* @ts-expect-error: `InnerBlocks.Content` is a component that is typed in WordPress core*/ }\n\t\t\t\n\t\t
\n\t);\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a embed block with customizable style type, size, icon color, and 5 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/sharing-buttons/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/sharing-buttons\",\n\t\"title\": \"Sharing Buttons\",\n\t\"description\": \"Give your readers the ability to easily share your content with X, Facebook, Tumblr, LinkedIn, and a host of other services to help spread your message across the web.\",\n\t\"keywords\": [\n\t\t\"sharing\",\n\t\t\"social\",\n\t\t\"bluesky\",\n\t\t\"twitter\",\n\t\t\"x\",\n\t\t\"linkedin\",\n\t\t\"facebook\",\n\t\t\"mastodon\",\n\t\t\"tumblr\",\n\t\t\"threads\",\n\t\t\"whatsapp\",\n\t\t\"telegram\",\n\t\t\"pinterest\",\n\t\t\"pocket\",\n\t\t\"reddit\",\n\t\t\"nextdoor\",\n\t\t\"print\",\n\t\t\"email\"\n\t],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"attributes\": {\n\t\t\"styleType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"icon-text\",\n\t\t\t\"validValues\": [ \"icon-text\", \"icon\", \"text\", \"official\" ]\n\t\t},\n\t\t\"size\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"has-normal-icon-size\",\n\t\t\t\"validValues\": [\n\t\t\t\t\"has-small-icon-size\",\n\t\t\t\t\"has-normal-icon-size\",\n\t\t\t\t\"has-large-icon-size\",\n\t\t\t\t\"has-huge-icon-size\"\n\t\t\t]\n\t\t},\n\t\t\"iconColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customIconColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"iconColorValue\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"iconBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customIconBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"iconBackgroundColorValue\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"styleType\": \"styleType\",\n\t\t\"iconColor\": \"iconColor\",\n\t\t\"iconColorValue\": \"iconColorValue\",\n\t\t\"iconBackgroundColor\": \"iconBackgroundColor\",\n\t\t\"iconBackgroundColorValue\": \"iconBackgroundColorValue\"\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"center\", \"right\" ],\n\t\t\"anchor\": true,\n\t\t\"__experimentalExposeControlsToChildren\": true,\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowVerticalAlignment\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"enableContrastChecker\": true,\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"customGradient\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": false\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"units\": [ \"px\", \"em\", \"rem\", \"vh\", \"vw\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true,\n\t\t\t\t\"margin\": true,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"innerBlocks\": [\n\t\t\t{\n\t\t\t\t\"name\": \"jetpack/sharing-button\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"service\": \"facebook\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\": \"jetpack/sharing-button\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"service\": \"x\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\": \"jetpack/sharing-button\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"service\": \"mastodon\"\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t},\n\t\"viewScript\": \"file:./view.js\",\n\t\"style\": \"file:./view.css\"\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/sharing-buttons/edit.js\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport './style.scss';\nimport clsx from 'clsx';\nimport SharingButtonsBlockControls from './components/block-controls';\nimport SharingButtonsInspectorControls from './components/inspector-controls';\n\nconst ALLOWED_BLOCKS = [ 'jetpack/sharing-button' ];\n\nfunction SharingButtonsEdit( props ) {\n\tconst { attributes } = props;\n\tconst { size } = attributes;\n\n\tconst SharingButtonsPlaceholder = (\n\t\t
  • { __( 'Click plus to add a Sharing Button', 'jetpack' ) }
  • \n\t);\n\n\tconst className = clsx( size, 'jetpack-sharing-buttons__services-list' );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: SharingButtonsPlaceholder,\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\tsharingEventsAdded: true,\n\t\t__experimentalAppenderTagName: 'li',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t
      \n\t\t\n\t);\n}\n\nexport default SharingButtonsEdit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/sharing-buttons/save.js\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { size } = attributes;\n\tconst className = clsx( size, 'jetpack-sharing-buttons__services-list' );\n\tconst id = 'jetpack-sharing-serivces-list';\n\tconst blockProps = useBlockProps.save( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display a grid of products with selected tags. with these attributes: columns, rows, align buttons, and 6 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-tag/block.json\n{\n\t\"name\": \"woocommerce/product-tag\",\n\t\"title\": \"Products by Tag\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display a grid of products with selected tags.\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"rows\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"alignButtons\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"contentVisibility\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"image\": true,\n\t\t\t\t\"title\": true,\n\t\t\t\t\"price\": true,\n\t\t\t\t\"rating\": true,\n\t\t\t\t\"button\": true\n\t\t\t},\n\t\t\t\"properties\": {\n\t\t\t\t\"image\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"title\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"price\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"rating\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"button\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"tags\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"tagOperator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"any\"\n\t\t},\n\t\t\"orderby\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"date\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"stockStatus\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-tag/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\nimport type { ProductsByTagBlockProps } from './types';\n\nexport const Edit = ( props: ProductsByTagBlockProps ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays a foldable layout that groups content in collapsible sections. that allows users to configure: icon position, show icon, autoclose, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/accordion/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/accordion\",\n\t\"title\": \"Accordion\",\n\t\"category\": \"design\",\n\t\"description\": \"Displays a foldable layout that groups content in collapsible sections.\",\n\t\"example\": {},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"background\": {\n\t\t\t\"backgroundImage\": true,\n\t\t\t\"backgroundSize\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"backgroundImage\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"blockGap\": true\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": true,\n\t\t\"ariaLabel\": true,\n\t\t\"interactivity\": true,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"contentRole\": true\n\t},\n\t\"attributes\": {\n\t\t\"iconPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"right\"\n\t\t},\n\t\t\"showIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"autoclose\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"headingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"core/accordion-icon-position\": \"iconPosition\",\n\t\t\"core/accordion-show-icon\": \"showIcon\",\n\t\t\"core/accordion-heading-level\": \"headingLevel\"\n\t},\n\t\"allowedBlocks\": [ \"core/accordion-item\" ],\n\t\"textdomain\": \"default\",\n\t\"viewScriptModule\": \"@wordpress/block-library/accordion/view\"\n}\n\n\n// File: packages/block-library/src/accordion/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport icon from './icon';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/accordion-item',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/accordion-heading',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/accordion-item',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/accordion-heading',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo lacus, interdum et.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/accordion/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save( {\n\t\trole: 'group',\n\t} );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a versatile WooCommerce block with comprehensive customization capabilities, allowing users to modify query specifications, tag attributes, and multiple extended settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-collection\",\n\t\"title\": \"Product Collection\",\n\t\"description\": \"Display a collection of products from your store.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\",\n\t\t\"Products (Beta)\",\n\t\t\"all products\",\n\t\t\"by attribute\",\n\t\t\"by category\",\n\t\t\"by tag\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"queryId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"query\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"displayLayout\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t\t\"type\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"enum\": [ \"flex\", \"list\", \"carousel\" ]\n\t\t\t\t},\n\t\t\t\t\"columns\": {\n\t\t\t\t\t\"type\": \"number\"\n\t\t\t\t},\n\t\t\t\t\"shrinkColumns\": {\n\t\t\t\t\t\"type\": \"boolean\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"convertedFromProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"collection\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hideControls\": {\n\t\t\t\"default\": [],\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"queryContextIncludes\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"forcePageReload\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"__privatePreviewState\": {\n\t\t\t\"type\": \"object\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"queryId\": \"queryId\",\n\t\t\"query\": \"query\",\n\t\t\"displayLayout\": \"displayLayout\",\n\t\t\"dimensions\": \"dimensions\",\n\t\t\"queryContextIncludes\": \"queryContextIncludes\",\n\t\t\"collection\": \"collection\",\n\t\t\"__privateProductCollectionPreviewState\": \"__privatePreviewState\"\n\t},\n\t\"usesContext\": [ \"templateSlug\", \"postId\" ],\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"html\": false,\n\t\t\"__experimentalLayout\": true,\n\t\t\"interactivity\": true,\n\t\t\"email\": true\n\t},\n\t\"editorStyle\": \"file:../woocommerce/product-collection-editor.css\",\n\t\"style\": \"file:../woocommerce/product-collection-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/save.tsx\n/**\n * External dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function QuerySave( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block displaying cart fee details, incorporating class name and lock attributes for customization."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-fee-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Fees\",\n\t\"description\": \"Shows the cart fee row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a widget block featuring customizable elements including label, visibility toggle, placeholder, and five additional configurable parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/search/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/search\",\n\t\"title\": \"Search\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Help visitors find your content.\",\n\t\"keywords\": [ \"find\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"widthUnit\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"buttonText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"buttonPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"button-outside\"\n\t\t},\n\t\t\"buttonUseIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"query\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t},\n\t\t\"isSearchFieldHidden\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"center\", \"right\" ],\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"typography\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalSelector\": \".wp-block-search__label, .wp-block-search__input, .wp-block-search__button\",\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"html\": false\n\t},\n\t\"editorStyle\": \"wp-block-search-editor\",\n\t\"style\": \"wp-block-search\"\n}\n\n\n// File: packages/block-library/src/search/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t\tshownByDefault: true,\n\t\t},\n\t\t{\n\t\t\tid: 'buttonText',\n\t\t\tlabel: __( 'Button text' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'placeholder',\n\t\t\tlabel: __( 'Placeholder' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'label' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the name of the author of the comment. with these attributes: is link, link target, text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-author-name/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-author-name\",\n\t\"title\": \"Comment Author Name\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays the name of the author of the comment.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"commentId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-comment-author-name\"\n}\n\n\n// File: packages/block-library/src/comment-author-name/index.js\n/**\n * WordPress dependencies\n */\nimport { commentAuthorName as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays a link to reply to a comment. that allows users to configure: text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-reply-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-reply-link\",\n\t\"title\": \"Comment Reply Link\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays a link to reply to a comment.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"html\": false\n\t},\n\t\"style\": \"wp-block-comment-reply-link\"\n}\n\n\n// File: packages/block-library/src/comment-reply-link/index.js\n/**\n * WordPress dependencies\n */\nimport { commentReplyLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\ticon,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a custom Gutenberg block that Display footnotes added to the page."}, {"role": "assistant", "content": "// File: packages/block-library/src/footnotes/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/footnotes\",\n\t\"title\": \"Footnotes\",\n\t\"category\": \"text\",\n\t\"description\": \"Display footnotes added to the page.\",\n\t\"keywords\": [ \"references\" ],\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": false,\n\t\t\t\t\"color\": false,\n\t\t\t\t\"width\": false,\n\t\t\t\t\"style\": false\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"link\": true,\n\t\t\t\"text\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"link\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-footnotes\"\n}\n\n\n// File: packages/block-library/src/footnotes/index.js\n/**\n * WordPress dependencies\n */\nimport { formatListNumbered as icon } from '@wordpress/icons';\nimport { registerFormatType } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport { formatName, format } from './format';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => {\n\tregisterFormatType( formatName, format );\n\tinitBlock( { name, metadata, settings } );\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a embed block with customizable book number, class, custom title, and 15 more options"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/goodreads/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/goodreads\",\n\t\"title\": \"Goodreads\",\n\t\"description\": \"Features books from the shelves of your Goodreads account.\",\n\t\"keywords\": [ \"book\", \"read\", \"author\" ],\n\t\"version\": \"1.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": true\n\t},\n\t\"attributes\": {\n\t\t\"bookNumber\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"5\"\n\t\t},\n\t\t\"class\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTitle\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"goodreadsId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"link\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"orderOption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"d\"\n\t\t},\n\t\t\"shelfOption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"read\"\n\t\t},\n\t\t\"showAuthor\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showCover\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showRating\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showReview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showTags\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"sortOption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"date_added\"\n\t\t},\n\t\t\"style\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"default\"\n\t\t},\n\t\t\"userInput\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"widgetId\": {\n\t\t\t\"type\": \"number\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"goodreadsId\": 1176283\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/goodreads/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { BlockControls, InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { Placeholder, SandBox, Button, Spinner, withNotices } from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport metadata from './block.json';\nimport { GoodreadsBlockControls, GoodreadsInspectorControls } from './controls';\nimport useFetchGoodreadsData from './hooks/use-fetch-goodreads-data';\nimport { createGoodreadsEmbedLink } from './utils';\n\nconst GoodreadsEdit = props => {\n\tconst { attributes, className, noticeOperations, noticeUI, setAttributes } = props;\n\tconst [ userInput, setUserInput ] = useState( '' );\n\tconst [ url, setUrl ] = useState( '' );\n\tconst [ isResolvingUrl, setIsResolvingUrl ] = useState( false );\n\tconst prevPropsRef = useRef( null );\n\tconst blockProps = useBlockProps();\n\n\tconst { isFetchingData, goodreadsUserId, isError } = useFetchGoodreadsData( url );\n\n\tuseEffect( () => {\n\t\tif ( isFetchingData ) {\n\t\t\tsetIsResolvingUrl( true );\n\t\t}\n\n\t\tif ( ! isFetchingData ) {\n\t\t\tsetIsResolvingUrl( false );\n\n\t\t\tif ( isError ) {\n\t\t\t\tsetAttributes( { widgetId: undefined, goodreadsId: undefined, link: undefined } );\n\t\t\t\tsetErrorNotice();\n\t\t\t}\n\n\t\t\t// Applies when transforming from Legacy Widget,\n\t\t\t// in which case goodreadsId is already known.\n\t\t\tif ( attributes.goodreadsId ) {\n\t\t\t\tsetRequestLink();\n\t\t\t}\n\n\t\t\tif ( goodreadsUserId && ! isError ) {\n\t\t\t\tsetAttributes( { goodreadsId: goodreadsUserId } );\n\t\t\t\tsetRequestLink();\n\t\t\t}\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ goodreadsUserId, isFetchingData, isResolvingUrl, isError, setAttributes ] );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tprevPropsRef.current &&\n\t\t\tattributes.goodreadsId &&\n\t\t\tattributes.widgetId === prevPropsRef.current.attributes.widgetId\n\t\t) {\n\t\t\tsetRequestLink();\n\t\t}\n\t\tprevPropsRef.current = props;\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ props, attributes.goodreadsId, attributes.widgetId ] );\n\n\tconst setErrorNotice = () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t<>{ __( 'Sorry, this content could not be embedded.', 'jetpack' ) }\n\t\t);\n\t};\n\n\tconst setRequestLink = () => {\n\t\tconst selector = attributes.style === 'grid' ? 'gr_grid_widget_' : 'gr_custom_widget_';\n\t\tsetAttributes( {\n\t\t\twidgetId: Math.floor( Math.random() * 9999999 ),\n\t\t\tlink: createGoodreadsEmbedLink( { attributes } ),\n\t\t\tid: selector + attributes.widgetId,\n\t\t} );\n\t};\n\n\tconst submitForm = event => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetUrl( userInput );\n\t\tsetIsResolvingUrl( true );\n\t};\n\n\tconst renderLoading = () => {\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t

        { __( 'Embedding…', 'jetpack' ) }

        \n\t\t\t
        \n\t\t);\n\t};\n\n\tconst renderEditEmbed = () => {\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t\t\t setUserInput( event.target.value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t};\n\n\tconst renderInlinePreview = () => {\n\t\tconst { link, id } = attributes;\n\n\t\tconst html = `\n\t\t\n\t\t\n \t
        \n \t`;\n\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t
        \n\t\t\t
        \n\t\t);\n\t};\n\n\tlet content;\n\n\tif ( isResolvingUrl ) {\n\t\tcontent = renderLoading();\n\t} else if ( attributes.goodreadsId ) {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t{ renderInlinePreview() }\n\t\t\t\n\t\t);\n\t} else {\n\t\tcontent = renderEditEmbed();\n\t}\n\n\treturn
        { content }
        ;\n};\n\nexport default withNotices( GoodreadsEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/goodreads/save.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Earn income by adding high quality ads to your post. that allows users to configure: align, format, hide mobile"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/wordads/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/wordads\",\n\t\"title\": \"Ad\",\n\t\"description\": \"Earn income by adding high quality ads to your post.\",\n\t\"keywords\": [ \"ads\", \"WordAds\", \"advertisement\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"center\", \"right\" ],\n\t\t\"alignWide\": false,\n\t\t\"className\": false,\n\t\t\"customClassName\": false,\n\t\t\"html\": false,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"center\"\n\t\t},\n\t\t\"format\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"mrec\"\n\t\t},\n\t\t\"hideMobile\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"example\": {}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/wordads/edit.js\nimport { ThemeProvider } from '@automattic/jetpack-components';\nimport { useModuleStatus } from '@automattic/jetpack-shared-extension-utils';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { WordAdsPlaceholder } from './components/jetpack-wordads-placeholder';\nimport { WordAdsSkeletonLoader } from './components/jetpack-wordads-skeleton-loader';\nimport { AD_FORMATS } from './constants';\nimport AdControls from './controls';\nimport wideSkyscraperExample from './example_160x600.png';\nimport rectangleExample from './example_300x250.png';\nimport mobileLeaderboardExample from './example_320x50.png';\nimport leaderboardExample from './example_728x90.png';\n\nimport './editor.scss';\n\nconst WordAdsEdit = ( { attributes, setAttributes } ) => {\n\tconst blockProps = useBlockProps();\n\tconst { format } = attributes;\n\tconst { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =\n\t\tuseModuleStatus( 'wordads' );\n\tconst selectedFormatObject = AD_FORMATS.find( ( { tag } ) => tag === format );\n\n\tconst getExampleAd = formatting => {\n\t\tswitch ( formatting ) {\n\t\t\tcase 'leaderboard':\n\t\t\t\treturn leaderboardExample;\n\t\t\tcase 'mobile_leaderboard':\n\t\t\t\treturn mobileLeaderboardExample;\n\t\t\tcase `wideskyscraper`:\n\t\t\t\treturn wideSkyscraperExample;\n\t\t\tdefault:\n\t\t\t\treturn rectangleExample;\n\t\t}\n\t};\n\n\tlet content;\n\n\tif ( ! isModuleActive ) {\n\t\tif ( isLoadingModules ) {\n\t\t\tcontent = (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t);\n\t\t} else {\n\t\t\tcontent = (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t
        \n\t\t\t\t\t
        \n\t\t\t\t
        \n\t\t\t\n\t\t);\n\t}\n\n\treturn
        { content }
        ;\n};\n\nexport default WordAdsEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a dynamic growth-oriented block allowing personalized labeling and statistical presentation with adaptable visualization settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blog-stats/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/blog-stats\",\n\t\"title\": \"Blog Stats\",\n\t\"description\": \"Show a stats counter for your blog.\",\n\t\"keywords\": [ \"views\", \"hits\", \"analytics\", \"counter\", \"visitors\" ],\n\t\"version\": \"1.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"alignWide\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"fontSize\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"statsData\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"views\"\n\t\t},\n\t\t\"statsOption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"site\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blog-stats/edit.js\nimport { useModuleStatus } from '@automattic/jetpack-shared-extension-utils';\nimport { formatNumber } from '@automattic/number-formatters';\nimport apiFetch from '@wordpress/api-fetch';\nimport { InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __, _n } from '@wordpress/i18n';\nimport { BlogStatsInspectorControls } from './controls';\nimport { InactiveStatsPlaceholder } from './inactive-placeholder';\n\nfunction BlogStatsEdit( { attributes, className, setAttributes } ) {\n\tconst { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =\n\t\tuseModuleStatus( 'stats' );\n\tconst { label, statsData, statsOption } = attributes;\n\tconst [ blogViews, setBlogViews ] = useState( null );\n\tconst [ blogVisitors, setBlogVisitors ] = useState();\n\tconst [ postViews, setPostViews ] = useState();\n\tconst blockProps = useBlockProps();\n\n\tconst blogStats = statsData === 'views' ? blogViews : blogVisitors;\n\tconst stats = statsOption === 'post' ? postViews : blogStats;\n\n\tconst postId = useSelect( select => select( 'core/editor' ).getCurrentPostId(), [] );\n\n\tuseEffect( () => {\n\t\tif ( isModuleActive ) {\n\t\t\tapiFetch( {\n\t\t\t\tpath: Number.isInteger( postId )\n\t\t\t\t\t? `/wpcom/v2/blog-stats?post_id=${ postId }`\n\t\t\t\t\t: '/wpcom/v2/blog-stats',\n\t\t\t} ).then( response => {\n\t\t\t\tsetBlogViews( response[ 'blog-views' ] );\n\t\t\t\tsetBlogVisitors( response[ 'blog-visitors' ] );\n\n\t\t\t\t// Display \"12,345\" as an obvious placeholder when we have no Post ID.\n\t\t\t\t// Applies to widgets, FSE templates etc.\n\t\t\t\tsetPostViews( Number.isInteger( postId ) ? response[ 'post-views' ] : '12345' );\n\t\t\t} );\n\t\t}\n\t}, [ postId, isModuleActive ] );\n\n\t// We don't collect visitor data for individual posts.\n\tuseEffect( () => {\n\t\tif ( statsData === 'visitors' ) {\n\t\t\tsetAttributes( { statsOption: 'site' } );\n\t\t}\n\t}, [ statsData, setAttributes ] );\n\n\tif ( ! isModuleActive && ! isLoadingModules ) {\n\t\treturn (\n\t\t\t\n\t\t);\n\t}\n\n\tconst visitorsPlaceholder =\n\t\t/* Translators: Number of visitors */\n\t\t_n( 'visitor', 'visitors', parseInt( stats ), 'jetpack', 0 );\n\n\tconst viewsPlaceholder =\n\t\t/* Translators: Number of views */\n\t\t_n( 'hit', 'hits', parseInt( stats ), 'jetpack', 0 );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t
        \n\t\t\t\t{ isLoadingModules || blogViews === null ? (\n\t\t\t\t\t

        { __( 'Loading stats…', 'jetpack' ) }

        \n\t\t\t\t) : (\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ formatNumber( stats ) } \n\t\t\t\t\t\t setAttributes( { label: newLabel } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t

        \n\t\t\t\t) }\n\t\t\t
        \n\t\t
        \n\t);\n}\n\nexport default BlogStatsEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Render additional fields in the 'Additional information' location. with these attributes: class name, lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-additional-information-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-additional-information-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Additional information\",\n\t\"description\": \"Render additional fields in the 'Additional information' location.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-additional-information-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { FormStepBlock } from '@woocommerce/blocks/checkout/form-step';\nimport clsx from 'clsx';\nimport { ORDER_FORM_KEYS } from '@woocommerce/block-settings';\nimport { useCheckoutAddress } from '@woocommerce/base-context';\nimport { useFormFields } from '@woocommerce/base-components/cart-checkout';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ) => {\n\tconst { defaultFields } = useCheckoutAddress();\n\tconst formFields = useFormFields( ORDER_FORM_KEYS, defaultFields, 'order' );\n\tif (\n\t\tformFields.length === 0 ||\n\t\tformFields.every( ( field ) => !! field.hidden )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Contains the hidden or revealed content beneath the heading. with these attributes: template lock, open by default, is selected"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/accordion-panel/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/accordion-panel\",\n\t\"title\": \"Accordion Panel\",\n\t\"category\": \"design\",\n\t\"description\": \"Contains the hidden or revealed content beneath the heading.\",\n\t\"parent\": [ \"core/accordion-item\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": {\n\t\t\t\"allowEditing\": false\n\t\t},\n\t\t\"visibility\": false,\n\t\t\"contentRole\": true,\n\t\t\"allowedBlocks\": true,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ],\n\t\t\t\"default\": false\n\t\t},\n\t\t\"openByDefault\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isSelected\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"default\",\n\t\"style\": \"wp-block-accordion-panel\"\n}\n\n\n// File: packages/block-library/src/accordion-panel/index.js\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport icon from './icon';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/accordion-panel/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save( {\n\t\trole: 'region',\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a custom WordPress block for product visualization that empowers users to customize image interactions, including zoom-on-hover and expandable full-screen mode."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-gallery/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-gallery\",\n\t\"title\": \"Product Gallery (Beta)\",\n\t\"description\": \"Showcase your products relevant images and media.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"interactivity\": true,\n\t\t\"layout\": {\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\",\n\t\t\t\t\"flexWrap\": \"nowrap\",\n\t\t\t\t\"orientation\": \"horizontal\"\n\t\t\t},\n\t\t\t\"allowOrientation\": true,\n\t\t\t\"allowEditing\": true,\n\t\t\t\"allowJustification\": false\n\t\t},\n\t\t\"email\": true\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"postId\" ],\n\t\"providesContext\": {\n\t\t\"hoverZoom\": \"hoverZoom\",\n\t\t\"fullScreenOnClick\": \"fullScreenOnClick\"\n\t},\n\t\"ancestor\": [ \"woocommerce/single-product\" ],\n\t\"attributes\": {\n\t\t\"hoverZoom\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"fullScreenOnClick\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"viewScript\": \"wc-product-gallery-frontend\",\n\t\"example\": {},\n\t\"viewScriptModule\": \"woocommerce/product-gallery\",\n\t\"style\": \"file:../woocommerce/product-gallery-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-gallery/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { BlockEditProps, InnerBlockTemplate } from '@wordpress/blocks';\nimport { withProductDataContext } from '@woocommerce/shared-hocs';\n\n/**\n * Internal dependencies\n */\nimport { ProductGalleryBlockSettings } from './block-settings/index';\nimport type { ProductGalleryBlockAttributes } from './types';\n\nconst TEMPLATE: InnerBlockTemplate[] = [\n\t[ 'woocommerce/product-gallery-thumbnails' ],\n\t[\n\t\t'woocommerce/product-gallery-large-image',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'woocommerce/product-image',\n\t\t\t\t{\n\t\t\t\t\tshowProductLink: false,\n\t\t\t\t\tshowSaleBadge: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'woocommerce/product-sale-badge',\n\t\t\t\t{\n\t\t\t\t\talign: 'right',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[ 'woocommerce/product-gallery-large-image-next-previous' ],\n\t\t],\n\t],\n];\n\nexport const Edit = withProductDataContext(\n\t( {\n\t\tattributes,\n\t\tsetAttributes,\n\t}: BlockEditProps< ProductGalleryBlockAttributes > ) => {\n\t\tconst blockProps = useBlockProps( {\n\t\t\tclassName: 'wc-block-product-gallery',\n\t\t} );\n\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t}\n);\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-gallery/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport const Save = () => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: 'wc-block-product-gallery',\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce-product-elements block with customizable heading level, show product link, link target, and 2 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/title/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-title\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Product Title\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"description\": \"Display the title of a product.\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalFontFamily\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": false,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"__experimentalSelector\": \".wc-block-components-product-title\"\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"headingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t},\n\t\t\"showProductLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"ancestor\": [ \"woocommerce/all-products\" ]\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/title/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Disabled, PanelBody, ToggleControl } from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tAlignmentToolbar,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport HeadingToolbar from '@woocommerce/editor-components/heading-toolbar';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { Attributes } from './types';\nimport './editor.scss';\n\ninterface Props {\n\tattributes: Attributes;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n}\n\nconst TitleEdit = ( { attributes, setAttributes }: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { headingLevel, showProductLink, align, linkTarget } = attributes;\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { headingLevel: newLevel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { align: newAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowProductLink: ! showProductLink,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showProductLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default TitleEdit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/title/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\ntype Props = {\n\tattributes: Record< string, unknown > & {\n\t\tclassName?: string;\n\t};\n};\n\nexport const Save = ( { attributes }: Props ): JSX.Element => {\n\treturn (\n\t\t\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Show customers a summary of their order. with these attributes: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Summary\",\n\t\"description\": \"Show customers a summary of their order.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { __ } from '@wordpress/i18n';\nimport { TotalsFooterItem } from '@woocommerce/base-components/cart-checkout';\nimport { getCurrencyFromPriceResponse } from '@woocommerce/price-format';\nimport { useStoreCart } from '@woocommerce/base-context/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport { OrderMetaSlotFill } from './slotfills';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { cartTotals } = useStoreCart();\n\tconst totalsCurrency = getCurrencyFromPriceResponse( cartTotals );\n\tconst allowedBlocks = getAllowedBlocks(\n\t\tinnerBlockAreas.CART_ORDER_SUMMARY\n\t);\n\tconst defaultTemplate = [\n\t\t[\n\t\t\t'woocommerce/cart-order-summary-heading-block',\n\t\t\t{\n\t\t\t\tcontent: __( 'Cart totals', 'woocommerce' ),\n\t\t\t},\n\t\t\t[],\n\t\t],\n\t\t[ 'woocommerce/cart-order-summary-coupon-form-block', {}, [] ],\n\t\t[ 'woocommerce/cart-order-summary-totals-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t
        \n\t\t\t{ /* do I put an totals wrapper here? */ }\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Enable customers to filter the product grid by selecting one or more attributes, such as color. with these attributes: attribute id, show counts, query type, and 5 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/attribute-filter/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-attribute\",\n\t\"title\": \"Attribute Filter\",\n\t\"description\": \"Enable customers to filter the product grid by selecting one or more attributes, such as color.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [ \"woocommerce/product-filters\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"text\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": false\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"blockGap\": false\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": false,\n\t\t\t\t\"radius\": false,\n\t\t\t\t\"style\": false,\n\t\t\t\t\"width\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"filterParams\" ],\n\t\"attributes\": {\n\t\t\"attributeId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"showCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"queryType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"or\"\n\t\t},\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"woocommerce/product-filter-checkbox-list\"\n\t\t},\n\t\t\"selectType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"multiple\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"sortOrder\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"count-desc\"\n\t\t},\n\t\t\"hideEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t}\n\t},\n\t\"style\": \"woocommerce/product-filter-attribute-view-style\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/attribute-filter/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tuseCollection,\n\tuseCollectionData,\n} from '@woocommerce/base-context/hooks';\nimport {\n\tAttributeSetting,\n\tAttributeTerm,\n\tobjectHasProp,\n} from '@woocommerce/types';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport { withSpokenMessages } from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport { Inspector } from './inspector';\nimport { attributeOptionsPreview } from './constants';\nimport './style.scss';\nimport { EditProps, isAttributeCounts } from './types';\nimport { getAttributeFromId } from './utils';\nimport { getAllowedBlocks } from '../../utils/get-allowed-blocks';\nimport { EXCLUDED_BLOCKS } from '../../constants';\nimport { FilterOptionItem } from '../../types';\nimport { InitialDisabled } from '../../components/initial-disabled';\nimport { Notice } from '../../components/notice';\nimport { sortFilterOptions } from '../../utils/sort-filter-options';\n\nconst ATTRIBUTES = getSetting< AttributeSetting[] >( 'attributes', [] );\n\nconst Edit = ( props: EditProps ) => {\n\tconst { attributes: blockAttributes } = props;\n\n\tconst {\n\t\tattributeId,\n\t\tqueryType,\n\t\tisPreview,\n\t\tdisplayStyle,\n\t\tshowCounts,\n\t\tsortOrder,\n\t\thideEmpty,\n\t} = blockAttributes;\n\n\tconst attributeObject = getAttributeFromId( attributeId );\n\n\tconst [ attributeOptions, setAttributeOptions ] = useState<\n\t\tFilterOptionItem[]\n\t>( [] );\n\tconst [ isOptionsLoading, setIsOptionsLoading ] =\n\t\tuseState< boolean >( true );\n\n\tconst { results: attributeTerms, isLoading: isTermsLoading } =\n\t\tuseCollection< AttributeTerm >( {\n\t\t\tnamespace: '/wc/store/v1',\n\t\t\tresourceName: 'products/attributes/terms',\n\t\t\tresourceValues: [ attributeObject?.id || 0 ],\n\t\t\tshouldSelect: !! attributeObject?.id,\n\t\t\tquery: { orderby: 'menu_order', hide_empty: hideEmpty },\n\t\t} );\n\n\tconst { data: filteredCounts, isLoading: isFilterCountsLoading } =\n\t\tuseCollectionData( {\n\t\t\tqueryAttribute: {\n\t\t\t\ttaxonomy: attributeObject?.taxonomy || '',\n\t\t\t\tqueryType,\n\t\t\t},\n\t\t\tqueryState: {},\n\t\t\tisEditor: true,\n\t\t} );\n\n\tuseEffect( () => {\n\t\tif ( isTermsLoading || isFilterCountsLoading ) return;\n\n\t\tconst termIdHasProducts =\n\t\t\tobjectHasProp( filteredCounts, 'attribute_counts' ) &&\n\t\t\tisAttributeCounts( filteredCounts.attribute_counts )\n\t\t\t\t? filteredCounts.attribute_counts.map( ( term ) => term.term )\n\t\t\t\t: [];\n\n\t\tif ( termIdHasProducts.length === 0 && hideEmpty ) {\n\t\t\tsetAttributeOptions( [] );\n\t\t} else {\n\t\t\tconst filteredOptions = attributeTerms\n\t\t\t\t.filter( ( term ) => {\n\t\t\t\t\tif ( hideEmpty )\n\t\t\t\t\t\treturn termIdHasProducts.includes( term.id );\n\t\t\t\t\treturn true;\n\t\t\t\t} )\n\t\t\t\t.map( ( term, index ) => ( {\n\t\t\t\t\tlabel: term.name,\n\t\t\t\t\tvalue: term.id.toString(),\n\t\t\t\t\tselected: index === 0,\n\t\t\t\t\tcount: term.count,\n\t\t\t\t} ) );\n\n\t\t\tsetAttributeOptions(\n\t\t\t\tsortFilterOptions( filteredOptions, sortOrder )\n\t\t\t);\n\t\t}\n\n\t\tsetIsOptionsLoading( false );\n\t}, [\n\t\tshowCounts,\n\t\tattributeTerms,\n\t\tfilteredCounts,\n\t\tsortOrder,\n\t\thideEmpty,\n\t\tisTermsLoading,\n\t\tisFilterCountsLoading,\n\t\tattributeObject,\n\t] );\n\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps(\n\t\tuseBlockProps(),\n\t\t{\n\t\t\tallowedBlocks: getAllowedBlocks( EXCLUDED_BLOCKS ),\n\t\t\ttemplate: [\n\t\t\t\t[\n\t\t\t\t\t'core/heading',\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\tattributeObject?.label ||\n\t\t\t\t\t\t\t__( 'Attribute', 'woocommerce' ),\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\t\tbottom: '0.625rem',\n\t\t\t\t\t\t\t\t\ttop: '0',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t[ displayStyle ],\n\t\t\t],\n\t\t}\n\t);\n\n\tconst isLoading =\n\t\tisTermsLoading || isFilterCountsLoading || isOptionsLoading;\n\n\tif ( Object.keys( ATTRIBUTES ).length === 0 )\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\"Attributes are needed for filtering your products. You haven't created any attributes yet.\",\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\t\t\t\t
        \n\t\t\t
        \n\t\t);\n\n\tif ( ! attributeId || ! attributeObject )\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Please select an attribute to use this filter!',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\t\t\t\t
        \n\t\t\t
        \n\t\t);\n\n\tif ( ! isLoading && attributeTerms.length === 0 )\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'There are no products with the selected attributes.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\t\t\t\t
        \n\t\t\t
        \n\t\t);\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ children }\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default withSpokenMessages( Edit );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/attribute-filter/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst Save = () => {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a flexible theme block in WordPress that allows adjustable text properties, including type, alignment, level, plus three extra user-defined options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/query-title/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-title\",\n\t\"title\": \"Query Title\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display the query title.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"type\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 1\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"showPrefix\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showSearchTerm\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"type\": \"search\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\" ],\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-query-title\"\n}\n\n\n// File: packages/block-library/src/query-title/index.js\n/**\n * WordPress dependencies\n */\nimport { title as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display your most popular content. with these attributes: layout, display author, display date, and 5 more options"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/top-posts/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/top-posts\",\n\t\"title\": \"Top Posts & Pages\",\n\t\"description\": \"Display your most popular content.\",\n\t\"keywords\": [ \"ranking\", \"views\", \"trending\", \"popular\" ],\n\t\"version\": \"1.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"layout\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"grid\"\n\t\t},\n\t\t\"displayAuthor\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"displayDate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"displayThumbnail\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"displayContext\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"period\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"7\"\n\t\t},\n\t\t\"postsToShow\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"postTypes\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"post\": true,\n\t\t\t\t\"page\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/top-posts/edit.js\nimport { useModuleStatus } from '@automattic/jetpack-shared-extension-utils';\nimport apiFetch from '@wordpress/api-fetch';\nimport { BlockControls, InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport clsx from 'clsx';\nimport { LoadingPostsGrid } from '../../shared/components/loading-posts-grid';\nimport { TopPostsBlockControls, TopPostsInspectorControls } from './controls';\nimport { InactiveStatsPlaceholder } from './inactive-placeholder';\nimport './style.scss';\nimport './editor.scss';\n\nfunction TopPostsPreviewItem( props ) {\n\treturn (\n\t\t
        \n\t\t\t{ props.displayThumbnail && props.thumbnail && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t{ props.displayThumbnail && ! props.thumbnail && (\n\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t
        \n\t\t\t) }\n\t\t\t\n\t\t\t\t{ props.title }\n\t\t\t\n\t\t\t{ props.displayDate && (\n\t\t\t\t{ props.date }\n\t\t\t) }\n\t\t\t{ props.displayAuthor && (\n\t\t\t\t{ props.author }\n\t\t\t) }\n\t\t\t{ props.displayContext && props.context && (\n\t\t\t\t\n\t\t\t\t\t{ props.context[ 0 ].cat_name }\n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n}\n\nfunction TopPostsEdit( { attributes, setAttributes } ) {\n\tconst { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =\n\t\tuseModuleStatus( 'stats' );\n\tconst blockProps = useBlockProps();\n\tconst { className } = blockProps;\n\n\tconst [ postsData, setPostsData ] = useState();\n\tconst [ postsToDisplay, setPostsToDisplay ] = useState();\n\tconst [ postTypesData, setPostTypesData ] = useState();\n\tconst [ toggleAttributes, setToggleAttributes ] = useState( {} );\n\n\tconst {\n\t\tdisplayAuthor,\n\t\tdisplayContext,\n\t\tdisplayDate,\n\t\tdisplayThumbnail,\n\t\tlayout,\n\t\tperiod,\n\t\tpostsToShow,\n\t\tpostTypes,\n\t} = attributes;\n\n\tuseEffect( () => {\n\t\tapiFetch( { path: `/wpcom/v2/post-types` } ).then( response => {\n\t\t\tsetPostTypesData( response );\n\t\t\tresponse.forEach( type => {\n\t\t\t\tif ( postTypes && postTypes[ type.id ] ) {\n\t\t\t\t\tsetToggleAttributes( prevToggleAttributes => ( {\n\t\t\t\t\t\t...prevToggleAttributes,\n\t\t\t\t\t\t[ type.id ]: true,\n\t\t\t\t\t} ) );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}, [ postTypes ] );\n\n\tuseEffect( () => {\n\t\tif ( isModuleActive ) {\n\t\t\tapiFetch( {\n\t\t\t\tpath: `/wpcom/v2/top-posts?period=${ period }`,\n\t\t\t} ).then( response => {\n\t\t\t\tsetPostsData( response );\n\t\t\t} );\n\t\t}\n\t}, [ period, isModuleActive ] );\n\n\tuseEffect( () => {\n\t\tconst data = postsData;\n\n\t\tif ( ! data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newPosts = [];\n\t\tfor ( let i = 0; newPosts.length !== postsToShow; i++ ) {\n\t\t\tif ( data[ i ] && postTypes[ data[ i ].type ] ) {\n\t\t\t\tnewPosts.push(\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Out of posts.\n\t\t\tif ( ! data[ i ] ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tsetPostsToDisplay( newPosts );\n\t}, [\n\t\tdisplayAuthor,\n\t\tdisplayContext,\n\t\tdisplayDate,\n\t\tdisplayThumbnail,\n\t\tpostsData,\n\t\tpostTypes,\n\t\tpostsToShow,\n\t\tsetPostsToDisplay,\n\t] );\n\n\tlet content;\n\n\tif ( ! isModuleActive && ! isLoadingModules ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else if ( ! postsToDisplay ) {\n\t\tcontent = ;\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t
        \n\t\t\t\t\t
        { postsToDisplay }
        \n\t\t\t\t
        \n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t
        \n\t\t\t{ content }\n\t\t
        \n\t);\n}\n\nexport default TopPostsEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a custom WordPress block to implement a clickable page number sequence that enables users to browse through product review sections efficiently."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination-numbers/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews-pagination-numbers\",\n\t\"title\": \"Reviews Page Numbers\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews-pagination\" ],\n\t\"description\": \"Displays a list of page numbers for product reviews pagination.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"postId\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination-numbers/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport type { ElementType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\n\nconst PaginationItem = ( {\n\tcontent,\n\ttag: Tag = 'a',\n\textraClass = '',\n}: {\n\tcontent: string;\n\ttag?: ElementType;\n\textraClass?: string;\n} ) =>\n\tTag === 'a' ? (\n\t\t event.preventDefault() }\n\t\t>\n\t\t\t{ content }\n\t\t\n\t) : (\n\t\t{ content }\n\t);\n\nexport default function Edit() {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Embed a Google Document. that allows users to configure: url, aspect ratio, variation"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/google-docs-embed/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/google-docs-embed\",\n\t\"title\": \"Google Docs (Beta)\",\n\t\"description\": \"Embed a Google Document.\",\n\t\"keywords\": [ \"document\", \"gsuite\", \"doc\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"right\", \"center\", \"wide\", \"full\" ],\n\t\t\"anchor\": true\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"aspectRatio\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"variation\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/google-docs-embed/edit.js\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, SelectControl } from '@wordpress/components';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport Embed from './embed';\nimport variations from './variations';\n\nconst docsVariation = variations?.find( v => v.name === 'jetpack/google-docs' );\nconst sheetsVariation = variations?.find( v => v.name === 'jetpack/google-sheets' );\nconst slidesVariation = variations?.find( v => v.name === 'jetpack/google-slides' );\n\nconst GOOGLE_DOCUMENT = {\n\ttype: 'document',\n\ttitle: docsVariation?.title,\n\ticon: docsVariation.icon,\n\tpatterns: [ /^(http|https):\\/\\/(docs\\.google.com)\\/document\\/d\\/([A-Za-z0-9_-]+).*?$/i ],\n};\n\nconst GOOGLE_SPREADSHEET = {\n\ttype: 'spreadsheets',\n\ttitle: sheetsVariation?.title,\n\ticon: sheetsVariation.icon,\n\tpatterns: [ /^(http|https):\\/\\/(docs\\.google.com)\\/spreadsheets\\/d\\/([A-Za-z0-9_-]+).*?$/i ],\n};\n\nconst GOOGLE_SLIDE = {\n\ttype: 'presentation',\n\ttitle: slidesVariation?.title,\n\ticon: slidesVariation.icon,\n\tpatterns: [ /^(http|https):\\/\\/(docs\\.google.com)\\/presentation\\/d\\/([A-Za-z0-9_-]+).*?$/i ],\n};\n\n/**\n * Edit component.\n * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit\n *\n * @param {object} props - The block props.\n * @param {object} props.attributes - Block attributes.\n * @param {string} props.attributes.title - Custom title to be displayed.\n * @param {string} props.className - Class name for the block.\n * @param {Function} props.setAttributes - Sets the value for block attributes.\n * @return {Function} Render the edit screen\n */\nconst GsuiteBlockEdit = props => {\n\tconst {\n\t\tattributes: { aspectRatio },\n\t\tattributes: { variation },\n\t\tattributes: { url },\n\t\tsetAttributes,\n\t} = props;\n\n\tlet icon = '';\n\tlet title = '';\n\tlet patterns = [];\n\tlet type = '';\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Parse the URL to detect the variation type.\n\t\t *\n\t\t * @return {string} The variation.\n\t\t */\n\t\tconst detectVariation = () => {\n\t\t\tconst regex = /^(http|https):\\/\\/(docs\\.google\\.com)\\/(.*)\\/d\\//;\n\t\t\tconst matches = url.match( regex );\n\n\t\t\tswitch ( matches[ 3 ] ) {\n\t\t\t\tcase 'document':\n\t\t\t\t\treturn 'google-docs';\n\n\t\t\t\tcase 'spreadsheets':\n\t\t\t\t\treturn 'google-sheets';\n\n\t\t\t\tcase 'presentation':\n\t\t\t\t\treturn 'google-slides';\n\t\t\t}\n\n\t\t\treturn '';\n\t\t};\n\n\t\tif ( ! variation ) {\n\t\t\tsetAttributes( { variation: detectVariation() } );\n\t\t}\n\t}, [ variation, url, setAttributes ] );\n\n\tswitch ( variation.replace( 'jetpack/', '' ) ) {\n\t\tcase 'google-docs':\n\t\t\ticon = GOOGLE_DOCUMENT.icon;\n\t\t\ttitle = GOOGLE_DOCUMENT.title;\n\t\t\tpatterns = GOOGLE_DOCUMENT.patterns;\n\t\t\ttype = GOOGLE_DOCUMENT.type;\n\t\t\tbreak;\n\n\t\tcase 'google-sheets':\n\t\t\ticon = GOOGLE_SPREADSHEET.icon;\n\t\t\ttitle = GOOGLE_SPREADSHEET.title;\n\t\t\tpatterns = GOOGLE_SPREADSHEET.patterns;\n\t\t\ttype = GOOGLE_SPREADSHEET.type;\n\t\t\tbreak;\n\n\t\tcase 'google-slides':\n\t\t\ticon = GOOGLE_SLIDE.icon;\n\t\t\ttitle = GOOGLE_SLIDE.title;\n\t\t\tpatterns = GOOGLE_SLIDE.patterns;\n\t\t\ttype = GOOGLE_SLIDE.type;\n\t\t\tbreak;\n\t}\n\n\t/**\n\t * Convert GSuite URL to a preview URL.\n\t *\n\t * @return {string} The URL pattern.\n\t */\n\tconst mapGSuiteURL = () => {\n\t\t/**\n\t\t * If the block is not the expected one, return the\n\t\t * original URL as is.\n\t\t */\n\t\tif ( patterns.length === 0 || '' === type ) {\n\t\t\treturn url;\n\t\t}\n\n\t\t/**\n\t\t * Check if the URL is valid.\n\t\t *\n\t\t * If not, return the original URL as is.\n\t\t */\n\t\tconst matches = url.match( patterns[ 0 ] );\n\t\tif (\n\t\t\tnull === matches ||\n\t\t\t'undefined' === typeof matches[ 1 ] ||\n\t\t\t'undefined' === typeof matches[ 2 ] ||\n\t\t\t'undefined' === typeof matches[ 3 ]\n\t\t) {\n\t\t\treturn url;\n\t\t}\n\n\t\treturn `${ matches[ 1 ] }://${ matches[ 2 ] }/${ type }/d/${ matches[ 3 ] }/preview`;\n\t};\n\n\tconst aspectRatios = [\n\t\t// translators: default aspect ratio for the embedded Google document.\n\t\t{ label: __( 'Default', 'jetpack' ), value: '' },\n\t\t// translators: aspect ratio for the embedded Google document.\n\t\t{ label: __( '100% - Show the whole document', 'jetpack' ), value: 'ar-100' },\n\t\t// translators: aspect ratio for the embedded Google document.\n\t\t{ label: __( '50% - Show half of the document', 'jetpack' ), value: 'ar-50' },\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Select a different aspect-ratio to show more (or less) of your embedded document.',\n\t\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t setAttributes( { aspectRatio: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t
        \n\t\t\t\t
        \n\t\t\t
        \n\t\t\n\t);\n};\nexport default GsuiteBlockEdit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/google-docs-embed/save.js\nconst Save = props => {\n\tconst { attributes } = props;\n\n\treturn (\n\t\t
        \n\t\t\t
        \n\t\t\t\t{ `\\n${ attributes.url }\\n` /* URL on its own line as in core embeds. */ }\n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce-product-elements block with customizable product id, text align, width, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/button/block.json\n{\n\t\"name\": \"woocommerce/product-button\",\n\t\"title\": \"Add to Cart Button\",\n\t\"description\": \"Display a call to action button which either adds the product to the cart, or links to the product page.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [\n\t\t\"query\",\n\t\t\"queryId\",\n\t\t\"postId\",\n\t\t\"collection\",\n\t\t\"woocommerce/isDescendantOfAddToCartWithOptions\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDescendentOfQueryLoop\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": false,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"html\": false,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"email\": true,\n\t\t\"__experimentalSelector\": \".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button\"\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/single-product\",\n\t\t\"core/post-template\",\n\t\t\"woocommerce/product-template\"\n\t],\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"fill\",\n\t\t\t\"label\": \"Fill\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{\n\t\t\t\"name\": \"outline\",\n\t\t\t\"label\": \"Outline\"\n\t\t}\n\t],\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"viewScriptModule\": \"woocommerce/product-button\",\n\t\"style\": \"file:../woocommerce/product-button-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/button/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport {\n\tDisabled,\n\tButton,\n\tButtonGroup,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { useEffect } from '@wordpress/element';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\nimport { useProduct } from '@woocommerce/entities';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { BlockAttributes } from './types';\n\nfunction WidthPanel( {\n\tselectedWidth,\n\tsetAttributes,\n}: {\n\tselectedWidth: number | undefined;\n\tsetAttributes: ( attributes: BlockAttributes ) => void;\n} ) {\n\tfunction handleChange( newWidth: number ) {\n\t\t// Check if we are toggling the width off\n\t\tconst width = selectedWidth === newWidth ? undefined : newWidth;\n\n\t\t// Update attributes.\n\t\tsetAttributes( { width } );\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t handleChange( widthValue ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ widthValue }%\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\n\t\t\n\t);\n}\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n}: BlockEditProps< BlockAttributes > & {\n\tcontext?: Context | undefined;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { product } = useProduct( context?.postId );\n\tconst isDescendentOfQueryLoop = Number.isFinite( context?.queryId );\n\tconst { width } = attributes;\n\n\tuseEffect(\n\t\t() => setAttributes( { isDescendentOfQueryLoop } ),\n\t\t[ setAttributes, isDescendentOfQueryLoop ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign || '' } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/button/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { BlockAttributes } from './types';\n\ntype Props = {\n\tattributes: BlockAttributes;\n};\n\nconst Save = ( { attributes, innerBlocks }: Props ): JSX.Element | null => {\n\tif (\n\t\tattributes.isDescendentOfQueryLoop ||\n\t\tattributes.isDescendentOfSingleProductBlock ||\n\t\t! innerBlocks ||\n\t\tinnerBlocks?.length === 0\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t\n\t);\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Implement a Gutenberg block for Displays a list of page numbers for comments pagination."}, {"role": "assistant", "content": "// File: packages/block-library/src/comments-pagination-numbers/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments-pagination-numbers\",\n\t\"title\": \"Comments Page Numbers\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/comments-pagination\" ],\n\t\"description\": \"Displays a list of page numbers for comments pagination.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"postId\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/comments-pagination-numbers/index.js\n/**\n * WordPress dependencies\n */\nimport { queryPaginationNumbers as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block specifically for displaying cart tax details, enabling customization of class names and lock settings for enhanced flexibility."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-taxes-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Taxes\",\n\t\"description\": \"Shows the cart taxes row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t\tshowRateAfterTaxName: boolean;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className, showRateAfterTaxName } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst taxesEnabled = getSetting( 'taxesEnabled' ) as boolean;\n\tconst displayItemizedTaxes = getSetting(\n\t\t'displayItemizedTaxes',\n\t\tfalse\n\t) as boolean;\n\tconst displayCartPricesIncludingTax = getSetting(\n\t\t'displayCartPricesIncludingTax',\n\t\tfalse\n\t) as boolean;\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t{ taxesEnabled &&\n\t\t\t\t\tdisplayItemizedTaxes &&\n\t\t\t\t\t! displayCartPricesIncludingTax && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowRateAfterTaxName:\n\t\t\t\t\t\t\t\t\t\t\t! showRateAfterTaxName,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable lock"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-billing-address-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Billing Address\",\n\t\"description\": \"Collect your customer's billing address.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useCheckoutAddress } from '@woocommerce/base-context/hooks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { BlockAttributes } from '@wordpress/blocks';\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport Block from './block';\nimport {\n\tgetBillingAddresssBlockTitle,\n\tgetBillingAddresssBlockDescription,\n} from './utils';\nimport { AddressFieldControls } from '../../address-field-controls';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: BlockAttributes ) => void;\n} ): JSX.Element | null => {\n\tconst { showBillingFields, forcedBillingAddress, useBillingAsShipping } =\n\t\tuseCheckoutAddress();\n\n\tif ( ! showBillingFields && ! useBillingAsShipping ) {\n\t\treturn null;\n\t}\n\tattributes.title = getBillingAddresssBlockTitle(\n\t\tattributes.title,\n\t\tforcedBillingAddress\n\t);\n\tattributes.description = getBillingAddresssBlockDescription(\n\t\tattributes.description,\n\t\tforcedBillingAddress\n\t);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Column containing the checkout totals. with these attributes: class name, checkbox, text"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-totals-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Checkout Totals\",\n\t\"description\": \"Column containing the checkout totals.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"checkbox\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"text\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"required\": false\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { Sidebar } from '@woocommerce/base-components/sidebar-layout';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\n\nexport const Edit = ( {\n\tclientId,\n\tattributes,\n}: {\n\tclientId: string;\n\tattributes: {\n\t\tclassName?: string;\n\t};\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-checkout__sidebar', attributes?.className ),\n\t} );\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.CHECKOUT_TOTALS );\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-order-summary-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a WordPress block for widgets that allows extensive personalization through an adjustable label, display option, placeholder field, and a total of seven configurable settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/search/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/search\",\n\t\"title\": \"Search\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Help visitors find your content.\",\n\t\"keywords\": [ \"find\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"widthUnit\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"buttonText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"buttonPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"button-outside\"\n\t\t},\n\t\t\"buttonUseIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"query\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t},\n\t\t\"isSearchFieldHidden\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"center\", \"right\" ],\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"typography\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalSelector\": \".wp-block-search__label, .wp-block-search__input, .wp-block-search__button\",\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"html\": false\n\t},\n\t\"editorStyle\": \"wp-block-search-editor\",\n\t\"style\": \"wp-block-search\"\n}\n\n\n// File: packages/block-library/src/search/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t\tshownByDefault: true,\n\t\t},\n\t\t{\n\t\t\tid: 'buttonText',\n\t\t\tlabel: __( 'Button text' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'placeholder',\n\t\t\tlabel: __( 'Placeholder' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'label' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a new Gutenberg block component designed to function as a standalone list element, equipped with configurable placeholder and content properties."}, {"role": "assistant", "content": "// File: packages/block-library/src/list-item/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/list-item\",\n\t\"title\": \"List Item\",\n\t\"category\": \"text\",\n\t\"parent\": [ \"core/list\" ],\n\t\"allowedBlocks\": [ \"core/list\" ],\n\t\"description\": \"An individual item within a list.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"content\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"li\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"className\": false,\n\t\t\"splitting\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"background\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"root\": \".wp-block-list > li\",\n\t\t\"border\": \".wp-block-list:not(.wp-block-list .wp-block-list) > li\"\n\t}\n}\n\n\n// File: packages/block-library/src/list-item/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { listItem as icon } from '@wordpress/icons';\nimport { privateApis } from '@wordpress/block-editor';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tcontent: attributes.content + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\t[ unlock( privateApis ).requiresWrapperOnCopy ]: true,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/list-item/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t
      • \n\t\t\t\n\t\t\t\n\t\t
      • \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Let shoppers filter products by choosing stock status. with these attributes: show counts, display style, is preview, hide empty"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/status-filter/block.json\n{\n\t\"name\": \"woocommerce/product-filter-status\",\n\t\"title\": \"Status Filter\",\n\t\"description\": \"Let shoppers filter products by choosing stock status.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [ \"woocommerce/product-filters\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"text\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": false\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"blockGap\": false\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": false,\n\t\t\t\t\"radius\": false,\n\t\t\t\t\"style\": false,\n\t\t\t\t\"width\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"showCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"woocommerce/product-filter-checkbox-list\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"hideEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"filterParams\" ],\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/status-filter/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockContextProvider,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { useCollectionData } from '@woocommerce/base-context/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport { InitialDisabled } from '../../components/initial-disabled';\nimport { Inspector } from './inspector';\nimport type { EditProps } from './types';\n\nconst Edit = ( props: EditProps ) => {\n\tconst { showCounts, hideEmpty } = props.attributes;\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps(\n\t\tuseBlockProps(),\n\t\t{\n\t\t\ttemplate: [\n\t\t\t\t[\n\t\t\t\t\t'core/heading',\n\t\t\t\t\t{\n\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\tcontent: __( 'Status', 'woocommerce' ),\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\t\tbottom: '0.625rem',\n\t\t\t\t\t\t\t\t\ttop: '0',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t[ 'woocommerce/product-filter-checkbox-list' ],\n\t\t\t],\n\t\t}\n\t);\n\n\tconst stockStatusOptions: Record< string, string > = getSetting(\n\t\t'stockStatusOptions',\n\t\t{}\n\t);\n\n\tconst { data: filteredCounts, isLoading } = useCollectionData( {\n\t\tqueryStock: true,\n\t\tqueryState: {},\n\t\tisEditor: true,\n\t} );\n\n\tconst items = useMemo( () => {\n\t\treturn Object.entries( stockStatusOptions )\n\t\t\t.map( ( [ key, value ], index ) => {\n\t\t\t\tconst count =\n\t\t\t\t\tfilteredCounts?.stock_status_counts?.find(\n\t\t\t\t\t\t( item ) => item.status === key\n\t\t\t\t\t)?.count ?? 0;\n\n\t\t\t\treturn {\n\t\t\t\t\tlabel: value,\n\t\t\t\t\tariaLabel: value,\n\t\t\t\t\tvalue: key,\n\t\t\t\t\tselected: index === 0,\n\t\t\t\t\tcount,\n\t\t\t\t\ttype: 'status',\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( item ) => ! hideEmpty || item.count > 0 );\n\t}, [ stockStatusOptions, filteredCounts, hideEmpty ] );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ children }\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/status-filter/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst Save = () => {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a dedicated WooCommerce block that renders cart taxes with configurable options for class attributes and locking mechanisms to improve user experience."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-taxes-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Taxes\",\n\t\"description\": \"Shows the cart taxes row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t\tshowRateAfterTaxName: boolean;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className, showRateAfterTaxName } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst taxesEnabled = getSetting( 'taxesEnabled' ) as boolean;\n\tconst displayItemizedTaxes = getSetting(\n\t\t'displayItemizedTaxes',\n\t\tfalse\n\t) as boolean;\n\tconst displayCartPricesIncludingTax = getSetting(\n\t\t'displayCartPricesIncludingTax',\n\t\tfalse\n\t) as boolean;\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t{ taxesEnabled &&\n\t\t\t\t\tdisplayItemizedTaxes &&\n\t\t\t\t\t! displayCartPricesIncludingTax && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowRateAfterTaxName:\n\t\t\t\t\t\t\t\t\t\t\t! showRateAfterTaxName,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a versatile Gutenberg block for rating various items, incorporating rating value, maximum rating, color selection, and three additional customizable parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/rating-star/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/rating-star\",\n\t\"title\": \"Star Rating\",\n\t\"description\": \"Rate movies, books, songs, recipes — anything you can put a number on.\",\n\t\"keywords\": [ \"star\", \"rating\", \"review\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"widgets\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"filled\",\n\t\t\t\"label\": \"Filled\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{\n\t\t\t\"name\": \"outlined\",\n\t\t\t\"label\": \"Outlined\"\n\t\t}\n\t],\n\t\"attributes\": {\n\t\t\"rating\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 1\n\t\t},\n\t\t\"maxRating\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"color\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"ratingStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"star\"\n\t\t},\n\t\t\"className\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"left\"\n\t\t}\n\t},\n\t\"example\": {}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/rating-star/edit.js\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tPanelColorSettings,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, RangeControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport const Rating = ( { id, setRating, children } ) => {\n\tconst setNewRating = newRating => () => setRating( newRating );\n\tconst maybeSetNewRating =\n\t\tnewRating =>\n\t\t( { code } ) =>\n\t\t\tcode === 'Enter' ? setRating( newRating ) : null;\n\n\treturn (\n\t\t\n\t\t\t{ children }\n\t\t\n\t);\n};\n\nexport default Symbol =>\n\tfunction ( { setAttributes, attributes: { align, color, rating, maxRating } } ) {\n\t\tconst blockProps = useBlockProps();\n\n\t\tconst setNewMaxRating = newMaxRating => setAttributes( { maxRating: newMaxRating } );\n\t\tconst setNewColor = newColor => setAttributes( { color: newColor } );\n\t\tconst setNewRating = newRating => {\n\t\t\tif ( newRating === rating ) {\n\t\t\t\t// Same number clicked twice.\n\t\t\t\t// Check if a half rating.\n\t\t\t\tif ( Math.ceil( rating ) === rating ) {\n\t\t\t\t\t// Whole number.\n\t\t\t\t\tnewRating = newRating - 0.5;\n\t\t\t\t}\n\t\t\t} else if ( rating === 0.5 && newRating === 1 ) {\n\t\t\t\t// Clicking the 0.5 star updates to 0 stars.\n\t\t\t\tnewRating = 0;\n\t\t\t}\n\n\t\t\tsetAttributes( { rating: newRating } );\n\t\t};\n\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t setAttributes( { align: nextAlign } ) }\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t
        \n\t\t\t\t\t{ Array.from( Array( Math.ceil( maxRating ) ), ( _, i ) => i + 1 ).map( position => (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t= position - 0.5 ? null : 'is-rating-unfilled' }\n\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t= position ? null : 'is-rating-unfilled' }\n\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t) ) }\n\t\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t};\n\n\n// File: projects/plugins/jetpack/extensions/blocks/rating-star/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\n\n// This is a dynamic block, meaning that its content is created on the server.\n// This function is only to provide a fallback in case the block is deactivated\n// or there is any problem with the render_callback in the server.\n//\n// Note that, unlike the normal ratings block, here we render as many symbols\n// as the rating, not as the maxRating. This is for consistency: some symbols (star)\n// have filled and stroke UTF-8 equivalents but other symbols don't (dollar, chilli).\n// We can't provide the full styled experience using UTF-8, so we optimize\n// for consistency.\nexport default fallbackSymbol =>\n\tfunction ( { attributes: { align, rating, color } } ) {\n\t\tconst blockProps = useBlockProps.save();\n\n\t\treturn (\n\t\t\t
        \n\t\t\t\t{ Array.from( Array( Math.ceil( rating ) ), ( _, i ) => i + 1 ).map( position => (\n\t\t\t\t\t\n\t\t\t\t\t\t{ fallbackSymbol }\n\t\t\t\t\t\n\t\t\t\t) ) }\n\t\t\t
        \n\t\t);\n\t};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a customizable WordPress block that enables selecting and displaying taxonomy terms through flexible query parameters and design settings, supporting term selection and tag naming."}, {"role": "assistant", "content": "// File: packages/block-library/src/terms-query/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/terms-query\",\n\t\"title\": \"Terms Query\",\n\t\"category\": \"theme\",\n\t\"description\": \"An advanced block that allows displaying taxonomy terms based on different query parameters and visual configurations.\",\n\t\"keywords\": [ \"terms\", \"taxonomy\", \"categories\", \"tags\", \"list\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"termQuery\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"perPage\": 10,\n\t\t\t\t\"taxonomy\": \"category\",\n\t\t\t\t\"order\": \"asc\",\n\t\t\t\t\"orderBy\": \"name\",\n\t\t\t\t\"include\": [],\n\t\t\t\t\"hideEmpty\": true,\n\t\t\t\t\"showNested\": false,\n\t\t\t\t\"inherit\": false\n\t\t\t}\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"templateSlug\" ],\n\t\"providesContext\": {\n\t\t\"termQuery\": \"termQuery\"\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"layout\": true,\n\t\t\"interactivity\": true\n\t}\n}\n\n\n// File: packages/block-library/src/terms-query/index.js\n/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {},\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/terms-query/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable show weight, show dimensions, show attributes"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-specifications/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-specifications\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Product Specifications\",\n\t\"description\": \"Display product weight, dimensions, and attributes.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"attributes\", \"weight\", \"dimensions\", \"additional information\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"ancestor\": [\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"attributes\": {\n\t\t\"showWeight\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showDimensions\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showAttributes\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-specifications/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useQueryLoopProductContextValidation } from '@woocommerce/base-hooks';\nimport { useSelect } from '@wordpress/data';\nimport { optionsStore, Product, productsStore } from '@woocommerce/data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { ProductSpecificationsEditProps } from './types';\n\nconst getFormattedDimensions = (\n\tdimensions: Product[ 'dimensions' ],\n\tdimensionUnit: string\n) => {\n\tif ( ! dimensions ) return '';\n\n\tconst dimensionKeys = [\n\t\t'length',\n\t\t'width',\n\t\t'height',\n\t] as ( keyof Product[ 'dimensions' ] )[];\n\n\tconst validDimensions = dimensionKeys\n\t\t.map( ( key ) => dimensions[ key ] )\n\t\t.filter(\n\t\t\t( value ): value is string =>\n\t\t\t\ttypeof value === 'string' && value.length > 0\n\t\t);\n\n\tif ( validDimensions.length === 0 ) return '';\n\n\treturn `${ validDimensions.join( ' × ' ) } ${ dimensionUnit }`;\n};\n\nconst EMPTY_PRODUCT_RESULT = {\n\tproduct: null,\n\tisLoadingProduct: false,\n};\n\nconst Edit = ( {\n\tcontext: { postId, postType },\n\tclientId,\n\tattributes,\n\tsetAttributes,\n}: ProductSpecificationsEditProps ) => {\n\tconst { showWeight, showDimensions, showAttributes } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-table',\n\t} );\n\tconst isSpecificProductContext = !! ( postId && postType === 'product' );\n\n\tconst { dimensionUnit, weightUnit, isLoadingUnits } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getOption } = select( optionsStore );\n\t\t\treturn {\n\t\t\t\tdimensionUnit: getOption(\n\t\t\t\t\t'woocommerce_dimension_unit'\n\t\t\t\t) as string,\n\t\t\t\tweightUnit: getOption( 'woocommerce_weight_unit' ) as string,\n\t\t\t\tisLoadingUnits:\n\t\t\t\t\t! select( optionsStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getOption',\n\t\t\t\t\t\t[ 'woocommerce_dimension_unit' ]\n\t\t\t\t\t) ||\n\t\t\t\t\t! select( optionsStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getOption',\n\t\t\t\t\t\t[ 'woocommerce_weight_unit' ]\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { product, isLoadingProduct } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postId ) return EMPTY_PRODUCT_RESULT;\n\t\t\tconst { getProduct } = select( productsStore );\n\t\t\treturn {\n\t\t\t\tproduct: getProduct( Number( postId ) ),\n\t\t\t\tisLoadingProduct: ! select(\n\t\t\t\t\tproductsStore\n\t\t\t\t).hasFinishedResolution( 'getProduct', [ Number( postId ) ] ),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\t/**\n\t * Validate Query Loop block context\n\t */\n\tconst { hasInvalidContext, warningElement } =\n\t\tuseQueryLoopProductContextValidation( {\n\t\t\tclientId,\n\t\t\tpostType,\n\t\t\tblockName: __( 'Product Specifications', 'woocommerce' ),\n\t\t} );\n\tif ( hasInvalidContext ) {\n\t\treturn warningElement;\n\t}\n\n\t/**\n\t * Display loading state\n\t */\n\tif ( isLoadingUnits || ( isLoadingProduct && isSpecificProductContext ) ) {\n\t\treturn (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t{ __( 'Loading…', 'woocommerce' ) }\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t}\n\n\t/**\n\t * Display no product found message\n\t */\n\tif ( postId && ! product ) {\n\t\treturn (\n\t\t\t
        \n\t\t\t\t

        { __( 'No product found', 'woocommerce' ) }

        \n\t\t\t
        \n\t\t);\n\t}\n\n\tconst productData: Record< string, { label: string; value: string } > = {};\n\n\tif ( showWeight ) {\n\t\tproductData.weight = {\n\t\t\tlabel: __( 'Weight', 'woocommerce' ),\n\t\t\tvalue: '',\n\t\t};\n\n\t\tif ( isSpecificProductContext ) {\n\t\t\tproductData.weight.value = product?.weight\n\t\t\t\t? `${ product.weight } ${ weightUnit }`\n\t\t\t\t: '';\n\t\t} else {\n\t\t\tproductData.weight.value = `10 ${ weightUnit }`;\n\t\t}\n\t}\n\n\tif ( showDimensions ) {\n\t\tproductData.dimensions = {\n\t\t\tlabel: __( 'Dimensions', 'woocommerce' ),\n\t\t\tvalue: '',\n\t\t};\n\n\t\tif ( isSpecificProductContext ) {\n\t\t\tproductData.dimensions.value = product?.dimensions\n\t\t\t\t? getFormattedDimensions( product.dimensions, dimensionUnit )\n\t\t\t\t: '';\n\t\t} else {\n\t\t\tproductData.dimensions.value = `10 × 10 × 10 ${ dimensionUnit }`;\n\t\t}\n\t}\n\n\tif ( showAttributes ) {\n\t\tif ( isSpecificProductContext ) {\n\t\t\tif ( product?.attributes ) {\n\t\t\t\tproduct.attributes.forEach( ( attribute ) => {\n\t\t\t\t\tproductData[ attribute.name.toLowerCase() ] = {\n\t\t\t\t\t\tlabel: attribute.name,\n\t\t\t\t\t\tvalue: attribute.options.join( ', ' ),\n\t\t\t\t\t};\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\tproductData.test_attribute = {\n\t\t\t\tlabel: __( 'Test Attribute', 'woocommerce' ),\n\t\t\t\tvalue: __( 'First, Second, Third', 'woocommerce' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { showWeight: ! showWeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowDimensions: ! showDimensions,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowAttributes: ! showAttributes,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{ Object.entries( productData ).map(\n\t\t\t\t\t\t\t( [ key, data ] ) =>\n\t\t\t\t\t\t\t\tdata.value && (\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{ data.label }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t
        { __( 'Attributes', 'woocommerce' ) }{ __( 'Value', 'woocommerce' ) }
        \n\t\t\t\t\t\t\t\t\t\t\t{ data.value }\n\t\t\t\t\t\t\t\t\t\t
        \n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a Gutenberg block mechanism to dynamically showcase a sale indicator when a product is discounted, with configurable attributes tracking product identification and block/template hierarchical relationships."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sale-badge/block.json\n{\n\t\"name\": \"woocommerce/product-sale-badge\",\n\t\"title\": \"On-Sale Badge\",\n\t\"description\": \"Displays an on-sale badge if the product is on-sale.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": { \"type\": \"number\", \"default\": 0 },\n\t\t\"isDescendentOfQueryLoop\": { \"type\": \"boolean\", \"default\": false },\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDescendentOfSingleProductTemplate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"align\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": false,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"email\": true,\n\t\t\"__experimentalSelector\": \".wc-block-components-product-sale-badge\"\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\",\n\t\t\"woocommerce/product-gallery\"\n\t],\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"example\": {},\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sale-badge/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport type { BlockAttributes } from './types';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\nconst Edit = ( {\n\tattributes,\n\tcontext,\n}: BlockEditProps< BlockAttributes > & { context: Context } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\n\t// Remove the `style` prop from the block props to avoid passing it to the wrapper div.\n\tconst { style, ...wrapperProps } = blockProps;\n\tconst { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t};\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that allows for configurable URL insertion and dynamic growth functionality."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/nextdoor/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/nextdoor\",\n\t\"title\": \"Nextdoor\",\n\t\"description\": \"Embed a Nextdoor post for your neighbors on your blog.\",\n\t\"keywords\": [ \"neighbor\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"alignWide\": true,\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/nextdoor/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { getBlockDefaultClassName } from '@wordpress/blocks';\nimport { SandBox, Button, Placeholder, withNotices } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport './editor.scss';\nimport { isEqual } from 'lodash';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\nimport NextdoorControls from './controls';\nimport { parseUrl } from './utils';\n\nconst icon = getBlockIconComponent( metadata );\n\nexport function NextdoorEdit( {\n\tattributes,\n\tclientId,\n\tname,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst defaultClassName = getBlockDefaultClassName( name );\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\n\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\tsetAttributes( validatedAttributes );\n\t}\n\n\tconst { url } = validatedAttributes;\n\tconst [ iframeUrl, setIframeUrl ] = useState( url ? parseUrl( url ) : null );\n\n\tconst [ nextdoorShareUrl, setNextdoorShareUrl ] = useState( iframeUrl );\n\n\tconst setErrorNotice = () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t__(\n\t\t\t\t\"Your Nextdoor post couldn't be embedded. Please double check the URL or code.\",\n\t\t\t\t'jetpack'\n\t\t\t)\n\t\t);\n\t};\n\n\tconst onFormSubmit = event => {\n\t\tif ( ! event ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\n\t\tif ( ! nextdoorShareUrl ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tconst embedUrl = parseUrl( nextdoorShareUrl );\n\n\t\tif ( ! embedUrl ) {\n\t\t\tsetIframeUrl( null );\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tsetIframeUrl( embedUrl );\n\t\tsetAttributes( { url: embedUrl } );\n\t};\n\n\tconst blockPlaceholder = (\n\t\t\n\t\t\t
        \n\t\t\t\t setNextdoorShareUrl( event.target.value ) }\n\t\t\t\t\tplaceholder={ __( 'Nextdoor post URL', 'jetpack' ) }\n\t\t\t\t\tvalue={ nextdoorShareUrl || '' }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t/>\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t\n\t\t\n\t);\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t{ iframeUrl ? (\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\tblockPlaceholder\n\t\t\t) }\n\t\t
        \n\t);\n}\n\nconst BlockPreview = ( { defaultClassName, iframeUrl, clientId } ) => {\n\tconst html = `\n\t\t\n\t\t\n\t\t\n\t);\n\n\tconst buttonPreview = (\n\t\t\n\t);\n\n\tconst blockPreview = previewStyle => {\n\t\tif ( previewStyle === 'inline' ) {\n\t\t\treturn inlinePreview;\n\t\t}\n\n\t\treturn buttonPreview;\n\t};\n\n\tif ( isResolvingUrl ) {\n\t\treturn blockEmbedding;\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t{ url && ! isEditingUrl ? blockPreview( style ) : blockPlaceholder }\n\t\t
        \n\t);\n}\n\nexport default withNotices( CalendlyEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/calendly/save.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block displaying financial breakdown details, enabling users to customize the class name and locking preferences."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-totals/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-totals-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Totals\",\n\t\"description\": \"Shows the subtotal, fees, discounts, shipping and taxes.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-totals/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst allowedBlocks = getAllowedBlocks(\n\t\tinnerBlockAreas.CHECKOUT_ORDER_SUMMARY_TOTALS\n\t);\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-order-summary-subtotal-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-fee-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-discount-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-shipping-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-taxes-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a versatile text block component that allows dynamic configuration of ordering, value settings, type selection, and three additional customization parameters."}, {"role": "assistant", "content": "// File: packages/block-library/src/list/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/list\",\n\t\"title\": \"List\",\n\t\"category\": \"text\",\n\t\"allowedBlocks\": [ \"core/list-item\" ],\n\t\"description\": \"An organized collection of items displayed in a specific order.\",\n\t\"keywords\": [ \"bullet list\", \"ordered list\", \"numbered list\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"ordered\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"values\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"html\",\n\t\t\t\"selector\": \"ol,ul\",\n\t\t\t\"multiline\": \"li\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"start\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"reversed\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"__unstablePasteTextInline\": true,\n\t\t\"__experimentalOnMerge\": true,\n\t\t\"__experimentalSlashInserter\": true,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"border\": \".wp-block-list:not(.wp-block-list .wp-block-list)\"\n\t},\n\t\"editorStyle\": \"wp-block-list-editor\",\n\t\"style\": \"wp-block-list\"\n}\n\n\n// File: packages/block-library/src/list/index.js\n/**\n * WordPress dependencies\n */\nimport { list as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nconst settings = {\n\ticon,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/list-item',\n\t\t\t\tattributes: { content: __( 'Alice.' ) },\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/list-item',\n\t\t\t\tattributes: { content: __( 'The White Rabbit.' ) },\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/list-item',\n\t\t\t\tattributes: { content: __( 'The Cheshire Cat.' ) },\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/list-item',\n\t\t\t\tattributes: { content: __( 'The Mad Hatter.' ) },\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/list-item',\n\t\t\t\tattributes: { content: __( 'The Queen of Hearts.' ) },\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport { settings };\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/list/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { ordered, type, reversed, start } = attributes;\n\tconst TagName = ordered ? 'ol' : 'ul';\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display an image to represent this site. Update this block and the changes apply everywhere. that allows users to configure: width, is link, link target, should sync icon"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/site-logo/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/site-logo\",\n\t\"title\": \"Site Logo\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display an image to represent this site. Update this block and the changes apply everywhere.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"width\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"shouldSyncIcon\": {\n\t\t\t\"type\": \"boolean\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"viewportWidth\": 500,\n\t\t\"attributes\": {\n\t\t\t\"width\": 350,\n\t\t\t\"className\": \"block-editor-block-types-list__site-logo-example\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": true,\n\t\t\"alignWide\": false,\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"default\",\n\t\t\t\"label\": \"Default\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{ \"name\": \"rounded\", \"label\": \"Rounded\" }\n\t],\n\t\"selectors\": {\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-site-logo img, .wp-block-site-logo .components-placeholder__illustration, .wp-block-site-logo .components-placeholder::before\"\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-site-logo-editor\",\n\t\"style\": \"wp-block-site-logo\"\n}\n\n\n// File: packages/block-library/src/site-logo/index.js\n/**\n * WordPress dependencies\n */\nimport { siteLogo as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Enable customers to filter the product grid by rating. with these attributes: class name, show counts, display style, and 3 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/rating-filter/block.json\n{\n\t\"name\": \"woocommerce/rating-filter\",\n\t\"title\": \"Filter by Rating Controls\",\n\t\"description\": \"Enable customers to filter the product grid by rating.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"button\": true\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"showCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"list\"\n\t\t},\n\t\t\"showFilterButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"selectType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"multiple\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/rating-filter/edit.tsx\n/**\n * External dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport {\n\tDisabled,\n\tNotice,\n\tPanelBody,\n\tToggleControl,\n\twithSpokenMessages,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport type { Attributes } from './types';\nimport './editor.scss';\nimport { UpgradeNotice } from '../filter-wrapper/upgrade';\n\nconst noRatingsNotice = (\n\t\n\t\t

        \n\t\t\t{ __(\n\t\t\t\t\"Your store doesn't have any products with ratings yet. This filter option will display when a product receives a review.\",\n\t\t\t\t'woocommerce'\n\t\t\t) }\n\t\t

        \n\t
        \n);\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n}: BlockEditProps< Attributes > ) => {\n\tconst {\n\t\tclassName,\n\t\tdisplayStyle,\n\t\tshowCounts,\n\t\tshowFilterButton,\n\t\tselectType,\n\t} = attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-rating-filter', className ),\n\t} );\n\n\tconst getInspectorControls = () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCounts: ! showCounts,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tselectType: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__multiple-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayStyle: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__display-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowFilterButton: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ getInspectorControls() }\n\t\t\t{\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t}\n\t\t\n\t);\n};\n\nexport default withSpokenMessages( Edit );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display filter options as chips. with these attributes: chip text, custom chip text, chip background, and 9 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/chips/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-chips\",\n\t\"title\": \"Chips\",\n\t\"description\": \"Display filter options as chips.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [\n\t\t\"woocommerce/product-filter-attribute\",\n\t\t\"woocommerce/product-filter-taxonomy\",\n\t\t\"woocommerce/product-filter-status\"\n\t],\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"usesContext\": [ \"filterData\" ],\n\t\"attributes\": {\n\t\t\"chipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"chipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"chipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"selectedChipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customSelectedChipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"selectedChipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customSelectedChipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"selectedChipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customSelectedChipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"viewScriptModule\": \"woocommerce/product-filter-chips\",\n\t\"style\": \"file:../woocommerce/product-filter-chips-style.css\",\n\t\"editorStyle\": \"file:../woocommerce/product-filter-chips-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/chips/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport clsx from 'clsx';\nimport { decodeHtmlEntities } from '@woocommerce/utils';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\twithColors,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { EditProps } from './types';\nimport './editor.scss';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst Edit = ( props: EditProps ): JSX.Element => {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst {\n\t\tcontext,\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t\tchipText,\n\t\tsetChipText,\n\t\tchipBackground,\n\t\tsetChipBackground,\n\t\tchipBorder,\n\t\tsetChipBorder,\n\t\tselectedChipText,\n\t\tsetSelectedChipText,\n\t\tselectedChipBackground,\n\t\tsetSelectedChipBackground,\n\t\tselectedChipBorder,\n\t\tsetSelectedChipBorder,\n\t} = props;\n\tconst {\n\t\tcustomChipText,\n\t\tcustomChipBackground,\n\t\tcustomChipBorder,\n\t\tcustomSelectedChipText,\n\t\tcustomSelectedChipBackground,\n\t\tcustomSelectedChipBorder,\n\t} = attributes;\n\tconst { filterData } = context;\n\tconst { isLoading, items, showCounts } = filterData;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-product-filter-chips', {\n\t\t\t'is-loading': isLoading,\n\t\t\t...getColorClasses( attributes ),\n\t\t} ),\n\t\tstyle: getColorVars( attributes ),\n\t} );\n\n\tconst loadingState = useMemo( () => {\n\t\treturn [ ...Array( 10 ) ].map( ( _, i ) => (\n\t\t\t\n\t\t\t\t \n\t\t\t
        \n\t\t) );\n\t}, [] );\n\n\tif ( ! items ) {\n\t\treturn <>;\n\t}\n\n\tconst threshold = 15;\n\tconst isLongList = items.length > threshold;\n\n\treturn (\n\t\t<>\n\t\t\t
        \n\t\t\t\t
        \n\t\t\t\t\t{ isLoading && loadingState }\n\t\t\t\t\t{ ! isLoading &&\n\t\t\t\t\t\t( isLongList\n\t\t\t\t\t\t\t? items.slice( 0, threshold )\n\t\t\t\t\t\t\t: items\n\t\t\t\t\t\t).map( ( item, index ) => (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t{ typeof item.label === 'string'\n\t\t\t\t\t\t\t\t\t\t\t? decodeHtmlEntities( item.label )\n\t\t\t\t\t\t\t\t\t\t\t: item.label }\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ showCounts && (\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{ ` (${ item.count })` }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t) ) }\n\t\t\t\t
        \n\t\t\t\t{ ! isLoading && isLongList && (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
        \n\t\t\t\n\t\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\tsetChipText( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipText: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipText( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipText: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Unselected Chip Border',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tchipBorder.color || customChipBorder,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetChipBorder( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBorder: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipBorder( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBorder: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Unselected Chip Background',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tchipBackground.color ||\n\t\t\t\t\t\t\t\t\tcustomChipBackground,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetChipBackground( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBackground: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipBackground( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBackground: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Selected Chip Text',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tselectedChipText.color ||\n\t\t\t\t\t\t\t\t\tcustomSelectedChipText,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipText( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipText: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipText( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipText: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Selected Chip Border',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tselectedChipBorder.color ||\n\t\t\t\t\t\t\t\t\tcustomSelectedChipBorder,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipBorder( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipBorder: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipBorder( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipBorder: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Selected Chip Background',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tselectedChipBackground.color ||\n\t\t\t\t\t\t\t\t\tcustomSelectedChipBackground,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipBackground( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipBackground:\n\t\t\t\t\t\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetSelectedChipBackground( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomSelectedChipBackground: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\n\t\t\n\t);\n};\n\nexport default withColors( {\n\tchipText: 'chip-text',\n\tchipBorder: 'chip-border',\n\tchipBackground: 'chip-background',\n\tselectedChipText: 'selected-chip-text',\n\tselectedChipBorder: 'selected-chip-border',\n\tselectedChipBackground: 'selected-chip-background',\n} )( Edit );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/chips/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { BlockAttributes } from './types';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst Save = ( { attributes }: { attributes: BlockAttributes } ) => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx(\n\t\t\t'wc-block-product-filter-chips',\n\t\t\tattributes.className,\n\t\t\tgetColorClasses( attributes )\n\t\t),\n\t\tstyle: {\n\t\t\t...getColorVars( attributes ),\n\t\t},\n\t} );\n\n\treturn
        ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a Gutenberg block for Let shoppers filter products by choosing a price range."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/price-filter/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-price\",\n\t\"title\": \"Price Filter\",\n\t\"description\": \"Let shoppers filter products by choosing a price range.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [ \"woocommerce/product-filters\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"html\": false\n\t},\n\t\"usesContext\": [ \"query\", \"filterParams\" ],\n\t\"viewScriptModule\": \"woocommerce/product-filter-price\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/price-filter/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tBlockContextProvider,\n\tuseBlockProps,\n\tInnerBlocks,\n} from '@wordpress/block-editor';\nimport { useCollectionData } from '@woocommerce/base-context/hooks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getAllowedBlocks } from '../../utils/get-allowed-blocks';\nimport { getPriceFilterData } from './utils';\nimport { InitialDisabled } from '../../components/initial-disabled';\n\nconst Edit = () => {\n\tconst blockProps = useBlockProps();\n\n\tconst { data, isLoading } = useCollectionData( {\n\t\tqueryPrices: true,\n\t\tqueryState: {},\n\t\tisEditor: true,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/price-filter/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst Save = () => {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a customizable Gutenberg block for image insertion, incorporating blob, url, alt, and an extensive set of 14 additional configurable attributes to enhance visual communication."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/image/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/image\",\n\t\"title\": \"Image\",\n\t\"category\": \"media\",\n\t\"usesContext\": [\n\t\t\"allowResize\",\n\t\t\"imageCrop\",\n\t\t\"fixedHeight\",\n\t\t\"postId\",\n\t\t\"postType\",\n\t\t\"queryId\"\n\t],\n\t\"description\": \"Insert an image to make a visual statement.\",\n\t\"keywords\": [ \"img\", \"photo\", \"picture\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"blob\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"local\"\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"src\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"alt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"alt\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"figcaption\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"lightbox\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"enabled\": {\n\t\t\t\t\"type\": \"boolean\"\n\t\t\t}\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"title\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"href\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"rel\"\n\t\t},\n\t\t\"linkClass\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"class\"\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"height\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"aspectRatio\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"scale\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"sizeSlug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkDestination\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"target\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"align\": [ \"left\", \"center\", \"right\", \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": {\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"border\": \".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder\",\n\t\t\"shadow\": \".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder\",\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-image img, .wp-block-image .components-placeholder\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"default\",\n\t\t\t\"label\": \"Default\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{ \"name\": \"rounded\", \"label\": \"Rounded\" }\n\t],\n\t\"editorStyle\": \"wp-block-image-editor\",\n\t\"style\": \"wp-block-image\"\n}\n\n\n// File: packages/block-library/src/image/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { image as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsizeSlug: 'large',\n\t\t\turl: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg',\n\t\t\t// translators: Caption accompanying an image of the Mont Blanc, which serves as an example for the Image block.\n\t\t\tcaption: __( 'Mont Blanc appears—still, snowy, and serene.' ),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tconst { caption, alt, url } = attributes;\n\n\t\t\tif ( ! url ) {\n\t\t\t\treturn __( 'Empty' );\n\t\t\t}\n\n\t\t\tif ( ! alt ) {\n\t\t\t\treturn caption || '';\n\t\t\t}\n\n\t\t\t// This is intended to be read by a screen reader.\n\t\t\t// A period simply means a pause, no need to translate it.\n\t\t\treturn alt + ( caption ? '. ' + caption : '' );\n\t\t}\n\t},\n\tgetEditWrapperProps( attributes ) {\n\t\treturn {\n\t\t\t'data-align': attributes.align,\n\t\t};\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'image',\n\t\t\tlabel: __( 'Image' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'url',\n\t\t\t\tcaption: 'caption',\n\t\t\t\talt: 'alt',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'href',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t\tdestination: 'linkDestination',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'alt',\n\t\t\tlabel: __( 'Alt text' ),\n\t\t\ttype: 'text',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'image' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/image/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\turl,\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tid,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\ttitle,\n\t\tmetadata: { bindings = {} } = {},\n\t} = attributes;\n\n\tconst newRel = ! rel ? undefined : rel;\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( {\n\t\t// All other align classes are handled by block supports.\n\t\t// `{ align: 'none' }` is unique to transforms for the image block.\n\t\talignnone: 'none' === align,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'is-resized': width || height,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst imageClasses = clsx( borderProps.className, {\n\t\t[ `wp-image-${ id }` ]: !! id,\n\t} );\n\n\tconst image = (\n\t\t\n\t);\n\n\tconst displayCaption =\n\t\t! RichText.isEmpty( caption ) ||\n\t\tbindings.caption ||\n\t\tbindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst figure = (\n\t\t<>\n\t\t\t{ href ? (\n\t\t\t\t\n\t\t\t\t\t{ image }\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\timage\n\t\t\t) }\n\t\t\t{ displayCaption && (\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n\n\treturn (\n\t\t
        \n\t\t\t{ figure }\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a custom Gutenberg block that Block: a8c/model-viewer"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: blocks/model-viewer/src/index.js\n/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { icon } from './icon';\nimport Edit from './edit';\nimport Save from './save';\n\nexport const registerBlock = () => {\n\tregisterBlockType( 'a8c/model-viewer', {\n\t\ttitle: '3D Model',\n\t\tdescription: __(\n\t\t\t'Show 3D models in an interactive viewer. Add files in .gltf or .glb formats.'\n\t\t),\n\t\tcategory: 'widgets',\n\t\ticon,\n\t\tattributes: {\n\t\t\tid: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\tsrc: {\n\t\t\t\ttype: 'string',\n\t\t\t\tsource: 'attribute',\n\t\t\t\tselector: 'model-viewer',\n\t\t\t\tattribute: 'src',\n\t\t\t},\n\t\t\talt: {\n\t\t\t\ttype: 'string',\n\t\t\t\tsource: 'attribute',\n\t\t\t\tselector: 'model-viewer',\n\t\t\t\tattribute: 'alt',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\tautoRotate: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\twidth: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\twidthUnit: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\theight: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\theightUnit: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcameraOrbit: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tfieldOfView: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tsupports: {\n\t\t\talign: true,\n\t\t},\n\t\tedit: ( props ) => ,\n\t\tsave: ( props ) => ,\n\t} );\n};\n\n\n// File: blocks/model-viewer/src/save.js\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps } from '@wordpress/block-editor';\n\nimport { DEFAULT_HEIGHT, DEFAULT_WIDTH } from './utils.js';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tsrc,\n\t\talt,\n\t\twidth,\n\t\theight,\n\t\twidthUnit,\n\t\theightUnit,\n\t\tcameraOrbit,\n\t\tfieldOfView,\n\t\tautoRotate,\n\t} = attributes;\n\n\t// React stringifies custom properties, so use object destructuring to disable auto-rotate.\n\t// See https://github.com/facebook/react/issues/9230\n\t// Gutenberg won't save the value when true is a boolean.\n\tconst autoRotateAttr = autoRotate ? { 'auto-rotate': 'true' } : {};\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft an Accordion header block in WordPress with customizable settings including default state, title, heading hierarchy, and four additional configuration parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-header/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/accordion-header\",\n\t\"title\": \"Accordion Header\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Accordion header.\",\n\t\"example\": {},\n\t\"__experimental\": true,\n\t\"parent\": [ \"woocommerce/accordion-item\" ],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradient\": true\n\t\t},\n\t\t\"align\": false,\n\t\t\"border\": true,\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"margin\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"textAlign\": true,\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"fontFamily\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": true\n\t},\n\t\"attributes\": {\n\t\t\"openByDefault\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"span\"\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"textAlignment\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"left\"\n\t\t},\n\t\t\"icon\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [\n\t\t\t\t\"plus\",\n\t\t\t\t\"chevron\",\n\t\t\t\t\"chevronRight\",\n\t\t\t\t\"caret\",\n\t\t\t\t\"circlePlus\",\n\t\t\t\tfalse\n\t\t\t],\n\t\t\t\"default\": \"plus\"\n\t\t},\n\t\t\"iconPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"left\", \"right\" ],\n\t\t\t\"default\": \"right\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-header/index.js\n/**\n * External dependencies\n */\nimport { SVG, Path } from '@wordpress/components';\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\n\nconst icon = (\n\t\n\t\t\n\t\t\n\t\n);\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tapiVersion: 3,\n\ticon,\n\texample: {},\n\tedit,\n\tsave,\n};\n\nregisterBlockType( metadata, settings );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-header/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport {\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tRichText,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcaret,\n\tchevron,\n\tchevronRight,\n\tcirclePlus,\n\tplus,\n} from '../accordion-item/icons';\n\nconst ICONS = {\n\tplus,\n\tcirclePlus,\n\tchevron,\n\tchevronRight,\n\tcaret,\n};\n\nexport default function save( { attributes } ) {\n\tconst { level, title, iconPosition, textAlign, icon } = attributes;\n\tconst TagName = 'h' + level;\n\n\tconst blockProps = useBlockProps.save();\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst Icon = ICONS[ icon ];\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ icon && }\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block designed to showcase comment content, incorporating text alignment as a key attribute for customization."}, {"role": "assistant", "content": "// File: packages/block-library/src/comment-content/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-content\",\n\t\"title\": \"Comment Content\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays the contents of a comment.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t},\n\t\t\"html\": false\n\t},\n\t\"style\": \"wp-block-comment-content\"\n}\n\n\n// File: packages/block-library/src/comment-content/index.js\n/**\n * WordPress dependencies\n */\nimport { commentContent as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a WordPress block enabling product grid display with customizable attribute filtering, supporting comprehensive configuration of selection criteria and layout parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products-by-attribute/block.json\n{\n\t\"name\": \"woocommerce/products-by-attribute\",\n\t\"title\": \"Products by Attribute\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display a grid of products with selected attributes.\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"attributes\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"attrOperator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"all\", \"any\" ],\n\t\t\t\"default\": \"any\"\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"contentVisibility\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"image\": true,\n\t\t\t\t\"title\": true,\n\t\t\t\t\"price\": true,\n\t\t\t\t\"rating\": true,\n\t\t\t\t\"button\": true\n\t\t\t},\n\t\t\t\"properties\": {\n\t\t\t\t\"image\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"title\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"price\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"rating\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"button\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"orderby\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [\n\t\t\t\t\"date\",\n\t\t\t\t\"popularity\",\n\t\t\t\t\"price_asc\",\n\t\t\t\t\"price_desc\",\n\t\t\t\t\"rating\",\n\t\t\t\t\"title\",\n\t\t\t\t\"menu_order\"\n\t\t\t],\n\t\t\t\"default\": \"date\"\n\t\t},\n\t\t\"rows\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"alignButtons\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"stockStatus\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products-by-attribute/edit.tsx\n/**\n * External dependencies\n */\nimport { BlockControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tDisabled,\n\tToolbarGroup,\n\twithSpokenMessages,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport { Props } from './types';\nimport { ProductsByAttributeInspectorControls } from './inspector-controls';\nimport { ProductsByAttributeEditMode } from './edit-mode';\nimport { ProductsByAttributeBlock } from './block';\n\nexport const EditBlock = ( props: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\n\tconst {\n\t\tattributes: { attributes },\n\t} = props;\n\n\tconst [ isEditing, setIsEditing ] = useState( ! attributes.length );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t setIsEditing( ! isEditing ),\n\t\t\t\t\t\t\tisActive: isEditing,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\t{ isEditing ? (\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n};\n\nexport const Edit = withSpokenMessages( EditBlock );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a dynamic Gutenberg block that conditionally renders block components based on cart product presence, utilizing a lock mechanism to manage content display."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/block.json\n{\n\t\"name\": \"woocommerce/filled-cart-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Filled Cart\",\n\t\"description\": \"Contains blocks that are displayed when the cart contains products.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": [\n\t\t\t\"wide\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { useEditorContext } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport './editor.scss';\nimport { useCartBlockContext } from '../../context';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { currentView } = useEditorContext();\n\tconst { hasDarkControls } = useCartBlockContext();\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.FILLED_CART );\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/cart-items-block', {}, [] ],\n\t\t[ 'woocommerce/cart-totals-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a Gutenberg block that renders the cart fee row, implementing specified attributes including class name and locking mechanism."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-fee-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Fees\",\n\t\"description\": \"Shows the cart fee row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a Gutenberg block designed for appointment scheduling, enabling users to personalize the calendar interface through background color, event detail display, primary color, and three supplementary customization settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/calendly/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/calendly\",\n\t\"title\": \"Calendly\",\n\t\"description\": \"Embed a calendar for customers to schedule appointments.\",\n\t\"keywords\": [ \"calendar\", \"schedule\", \"appointments\", \"events\", \"dates\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"alignWide\": false,\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"backgroundColor\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"ffffff\"\n\t\t},\n\t\t\"hideEventTypeDetails\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"primaryColor\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"00A2FF\"\n\t\t},\n\t\t\"textColor\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"4D5055\"\n\t\t},\n\t\t\"style\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"inline\",\n\t\t\t\"enum\": [ \"inline\", \"link\" ]\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"hideEventTypeDetails\": false,\n\t\t\t\"style\": \"inline\",\n\t\t\t\"url\": \"https://calendly.com/wpcom/jetpack-block-example\"\n\t\t},\n\t\t\"innerBlocks\": [\n\t\t\t{\n\t\t\t\t\"name\": \"jetpack/button\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"element\": \"a\",\n\t\t\t\t\t\"text\": \"Schedule time with me\",\n\t\t\t\t\t\"uniqueId\": \"calendly-widget-id\",\n\t\t\t\t\t\"url\": \"https://calendly.com/wpcom/jetpack-block-example\"\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/calendly/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { getBlockDefaultClassName } from '@wordpress/blocks';\nimport { Button, ExternalLink, Placeholder, Spinner, withNotices } from '@wordpress/components';\nimport { select, dispatch } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { isEqual } from 'lodash';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport testEmbedUrl from '../../shared/test-embed-url';\nimport metadata from './block.json';\nimport { CALENDLY_EXAMPLE_URL } from './constants';\nimport CalendlyControls from './controls';\nimport { getAttributesFromEmbedCode } from './utils';\n\nimport './editor.scss';\nimport './view.scss';\n\nconst innerButtonBlock = {\n\tname: 'jetpack/button',\n\tattributes: {\n\t\telement: 'a',\n\t\ttext: __( 'Schedule time with me', 'jetpack' ),\n\t\tuniqueId: 'calendly-widget-id',\n\t\turl: CALENDLY_EXAMPLE_URL,\n\t},\n};\nconst icon = getBlockIconComponent( metadata );\n\nexport function CalendlyEdit( props ) {\n\tconst { attributes, clientId, name, noticeOperations, noticeUI, setAttributes } = props;\n\tconst defaultClassName = getBlockDefaultClassName( name );\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\n\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\tsetAttributes( validatedAttributes );\n\t}\n\n\tconst { backgroundColor, hideEventTypeDetails, primaryColor, textColor, style, url } =\n\t\tvalidatedAttributes;\n\tconst [ embedCode, setEmbedCode ] = useState( url );\n\tconst [ isEditingUrl, setIsEditingUrl ] = useState( false );\n\tconst [ isResolvingUrl, setIsResolvingUrl ] = useState( false );\n\tconst [ embedButtonAttributes, setEmbedButtonAttributes ] = useState( {} );\n\tconst blockProps = useBlockProps();\n\n\tconst setErrorNotice = () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t__( \"Your calendar couldn't be embedded. Please double check your URL or code.\", 'jetpack' )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! url || CALENDLY_EXAMPLE_URL === url || 'link' === style ) {\n\t\t\treturn;\n\t\t}\n\t\ttestEmbedUrl( url, setIsResolvingUrl ).catch( () => {\n\t\t\tsetAttributes( { url: undefined } );\n\t\t\tsetErrorNotice();\n\t\t} );\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst parseEmbedCode = event => {\n\t\tif ( ! event ) {\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst newAttributes = getAttributesFromEmbedCode( embedCode );\n\t\tif ( ! newAttributes ) {\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( newAttributes.buttonAttributes && 'link' === newAttributes.style ) {\n\t\t\tconst innerButtons = select( 'core/editor' ).getBlocksByClientId( clientId );\n\n\t\t\tif ( innerButtons.length ) {\n\t\t\t\tinnerButtons[ 0 ].innerBlocks.forEach( block => {\n\t\t\t\t\tdispatch( 'core/editor' ).updateBlockAttributes(\n\t\t\t\t\t\tblock.clientId,\n\t\t\t\t\t\tnewAttributes.buttonAttributes\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetEmbedButtonAttributes( newAttributes.buttonAttributes );\n\t\t}\n\n\t\ttestEmbedUrl( newAttributes.url, setIsResolvingUrl )\n\t\t\t.then( () => {\n\t\t\t\tconst newValidatedAttributes = getValidatedAttributes( metadata.attributes, newAttributes );\n\t\t\t\tsetAttributes( newValidatedAttributes );\n\t\t\t\tsetIsEditingUrl( false );\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetAttributes( { url: undefined } );\n\t\t\t\tsetErrorNotice();\n\t\t\t} );\n\t};\n\n\tconst blockEmbedding = (\n\t\t
        \n\t\t\t\n\t\t\t

        { __( 'Embedding…', 'jetpack' ) }

        \n\t\t
        \n\t);\n\n\tconst blockPlaceholder = (\n\t\t\n\t\t\t
        \n\t\t\t\t setEmbedCode( event.target.value ) }\n\t\t\t\t\tplaceholder={ __( 'Calendly web address or embed code…', 'jetpack' ) }\n\t\t\t\t\tvalue={ embedCode || '' }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t/>\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t{ __( 'Need help finding your embed code?', 'jetpack' ) }\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n\n\tconst iframeSrc = () => {\n\t\tconst query = new URLSearchParams( {\n\t\t\tembed_domain: 'wordpress.com',\n\t\t\tembed_type: 'Inline',\n\t\t\thide_event_type_details: hideEventTypeDetails ? 1 : 0,\n\t\t\tbackground_color: backgroundColor,\n\t\t\tprimary_color: primaryColor,\n\t\t\ttext_color: textColor,\n\t\t} );\n\t\treturn `${ url }?${ query }`;\n\t};\n\n\tconst inlinePreview = (\n\t\t<>\n\t\t\t
        \n\t\t\t\n\t\t\n\t);\n\n\tconst buttonPreview = (\n\t\t\n\t);\n\n\tconst blockPreview = previewStyle => {\n\t\tif ( previewStyle === 'inline' ) {\n\t\t\treturn inlinePreview;\n\t\t}\n\n\t\treturn buttonPreview;\n\t};\n\n\tif ( isResolvingUrl ) {\n\t\treturn blockEmbedding;\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t{ url && ! isEditingUrl ? blockPreview( style ) : blockPlaceholder }\n\t\t
        \n\t);\n}\n\nexport default withNotices( CalendlyEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/calendly/save.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a custom WordPress block that empowers users to input and showcase their company's opening hours across different days of the week."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/business-hours/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/business-hours\",\n\t\"title\": \"Business Hours\",\n\t\"description\": \"Display opening hours for your business.\",\n\t\"keywords\": [ \"opening hours\", \"closing time\", \"schedule\", \"working day\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ]\n\t},\n\t\"attributes\": {\n\t\t\"days\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Sun\",\n\t\t\t\t\t\"hours\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Mon\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Tue\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Wed\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Thu\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Fri\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Sat\",\n\t\t\t\t\t\"hours\": []\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"days\": [\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Sun\",\n\t\t\t\t\t\"hours\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Mon\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Tue\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Wed\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Thu\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Fri\",\n\t\t\t\t\t\"hours\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"opening\": \"09:00\",\n\t\t\t\t\t\t\t\"closing\": \"17:00\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Sat\",\n\t\t\t\t\t\"hours\": []\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/business-hours/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport apiFetch from '@wordpress/api-fetch';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { getSettings } from '@wordpress/date';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport metadata from './block.json';\nimport DayEdit from './components/day-edit';\nimport DayPreview from './components/day-preview';\n\nconst icon = getBlockIconComponent( metadata );\n\nexport const defaultLocalization = {\n\tdays: {\n\t\tSun: __( 'Sunday', 'jetpack' ),\n\t\tMon: __( 'Monday', 'jetpack' ),\n\t\tTue: __( 'Tuesday', 'jetpack' ),\n\t\tWed: __( 'Wednesday', 'jetpack' ),\n\t\tThu: __( 'Thursday', 'jetpack' ),\n\t\tFri: __( 'Friday', 'jetpack' ),\n\t\tSat: __( 'Saturday', 'jetpack' ),\n\t},\n\tstartOfWeek: 0,\n};\n\nconst BusinessHours = props => {\n\tconst { attributes, isSelected } = props;\n\tconst blockProps = useBlockProps();\n\tconst [ localization, setLocalization ] = useState( defaultLocalization );\n\tconst [ hasFetched, setHasFetched ] = useState( false );\n\n\tconst { days } = attributes;\n\tconst { startOfWeek } = localization;\n\tconst localizedWeek = days.concat( days.slice( 0, startOfWeek ) ).slice( startOfWeek );\n\n\tuseEffect( () => {\n\t\tapiFetch( { path: '/wpcom/v2/business-hours/localized-week' } ).then(\n\t\t\tdata => {\n\t\t\t\tsetLocalization( data );\n\t\t\t\tsetHasFetched( true );\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tsetLocalization( defaultLocalization );\n\t\t\t\tsetHasFetched( true );\n\t\t\t}\n\t\t);\n\t}, [] );\n\n\tlet content;\n\n\tif ( ! hasFetched ) {\n\t\tcontent = ;\n\t} else if ( ! isSelected ) {\n\t\tconst settings = getSettings();\n\t\tconst {\n\t\t\tformats: { time },\n\t\t} = settings;\n\n\t\tcontent = (\n\t\t\t
        \n\t\t\t\t{ localizedWeek.map( ( day, key ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t
        \n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t
        \n\t\t\t\t{ localizedWeek.map( ( day, key ) => {\n\t\t\t\t\treturn ;\n\t\t\t\t} ) }\n\t\t\t
        \n\t\t);\n\t}\n\n\treturn
        { content }
        ;\n};\n\nexport default BusinessHours;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Implement a Gutenberg block for Block: a8c/waves"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: blocks/waves/src/index.js\n/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WavesIcon from './icon';\nimport Edit from './edit';\nimport Save from './save';\n\nexport const registerBlock = () => {\n\tregisterBlockType( 'a8c/waves', {\n\t\ttitle: __( 'Waves', 'waves' ),\n\t\tdescription: __( 'Create content with waves in motion.', 'waves' ),\n\t\ticon: ,\n\t\tcategory: 'widgets',\n\t\tsupports: {\n\t\t\talign: true,\n\t\t\thtml: false,\n\t\t},\n\t\tattributes: {\n\t\t\tcomplexity: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tdefault: 2,\n\t\t\t},\n\t\t\tmouseSpeed: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tdefault: 20,\n\t\t\t},\n\t\t\tfluidSpeed: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tdefault: 20,\n\t\t\t},\n\t\t\tcolor1: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcolor2: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcolor3: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcolor4: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tminHeight: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\tminHeightUnit: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tpreviewImage: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tedit: Edit,\n\t\tsave: Save,\n\t} );\n};\n\n\n// File: blocks/waves/src/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nconst Save = ( { attributes } ) => {\n\tconst minHeightWithUnit = attributes.minHeightUnit\n\t\t? `${ attributes.minHeight }${ attributes.minHeightUnit }`\n\t\t: attributes.minHeight;\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t\tbackgroundImage: `url( \"${ attributes.previewImage }\" )`,\n\t};\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a design block with customizable label, type, description, and 7 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/navigation-submenu/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/navigation-submenu\",\n\t\"title\": \"Submenu\",\n\t\"category\": \"design\",\n\t\"parent\": [ \"core/navigation\" ],\n\t\"description\": \"Add a submenu to your navigation.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"description\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"opensInNewTab\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"kind\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isTopLevelItem\": {\n\t\t\t\"type\": \"boolean\"\n\t\t}\n\t},\n\t\"usesContext\": [\n\t\t\"textColor\",\n\t\t\"customTextColor\",\n\t\t\"backgroundColor\",\n\t\t\"customBackgroundColor\",\n\t\t\"overlayTextColor\",\n\t\t\"customOverlayTextColor\",\n\t\t\"overlayBackgroundColor\",\n\t\t\"customOverlayBackgroundColor\",\n\t\t\"fontSize\",\n\t\t\"customFontSize\",\n\t\t\"showSubmenuIcon\",\n\t\t\"maxNestingLevel\",\n\t\t\"openSubmenusOnClick\",\n\t\t\"style\"\n\t],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-navigation-submenu-editor\",\n\t\"style\": \"wp-block-navigation-submenu\"\n}\n\n\n// File: packages/block-library/src/navigation-submenu/index.js\n/**\n * WordPress dependencies\n */\nimport { page, addSubmenu } from '@wordpress/icons';\nimport { _x, __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: ( { context } ) => {\n\t\tif ( context === 'list-view' ) {\n\t\t\treturn page;\n\t\t}\n\t\treturn addSubmenu;\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { label } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\t// In the list view, use the block's menu label as the label.\n\t\t// If the menu label is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || label ) ) {\n\t\t\treturn attributes?.metadata?.name || label;\n\t\t}\n\n\t\treturn label;\n\t},\n\tedit,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'About', 'Example link text for Navigation Submenu' ),\n\t\t\ttype: 'page',\n\t\t},\n\t},\n\tsave,\n\ttransforms,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\thref: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t\t// TODO - opens in new tab? id?\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'label' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/navigation-submenu/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display products from your store in a grid layout. that allows users to configure: columns, rows, align buttons, and 4 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products/all-products/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"textdomain\": \"woocommerce\",\n\t\"name\": \"woocommerce/all-products\",\n\t\"title\": \"All Products\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display products from your store in a grid layout.\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"rows\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"alignButtons\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"contentVisibility\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"orderby\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"layoutConfig\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products/all-products/index.js\n/**\n * External dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { Icon, grid } from '@wordpress/icons';\nimport '@woocommerce/atomic-blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\nimport defaults from './defaults';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nconst settings = {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t),\n\t},\n\tedit,\n\t// Save the props to post content.\n\tsave,\n\tdeprecated,\n\tdefaults,\n};\n\nregisterBlockType( name, settings );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products/all-products/save.js\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getBlockClassName } from '../utils.js';\n\nexport default function save( { attributes } ) {\n\tconst dataAttributes = {};\n\tObject.keys( attributes )\n\t\t.sort()\n\t\t.forEach( ( key ) => {\n\t\t\tdataAttributes[ key ] = attributes[ key ];\n\t\t} );\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: getBlockClassName( 'wc-block-all-products', attributes ),\n\t\t'data-attributes': JSON.stringify( dataAttributes ),\n\t} );\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Edit the different global regions of your site, like the header, footer, sidebar, or create your own. with these attributes: slug, theme, tag name, area"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/template-part/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/template-part\",\n\t\"title\": \"Template Part\",\n\t\"category\": \"theme\",\n\t\"description\": \"Edit the different global regions of your site, like the header, footer, sidebar, or create your own.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"slug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"theme\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"area\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"reusable\": false,\n\t\t\"renaming\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-template-part-editor\"\n}\n\n\n// File: packages/block-library/src/template-part/index.js\n/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { symbolFilled } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport { enhanceTemplatePartVariations } from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: symbolFilled,\n\t__experimentalLabel: ( { slug, theme } ) => {\n\t\t// Attempt to find entity title if block is a template part.\n\t\t// Require slug to request, otherwise entity is uncreated and will throw 404.\n\t\tif ( ! slug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getCurrentTheme, getEditedEntityRecord } =\n\t\t\tselect( coreDataStore );\n\t\tconst entity = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t( theme || getCurrentTheme()?.stylesheet ) + '//' + slug\n\t\t);\n\t\tif ( ! entity ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn (\n\t\t\tdecodeEntities( entity.title ) || capitalCase( entity.slug || '' )\n\t\t);\n\t},\n\tedit,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/template-part',\n\t\tenhanceTemplatePartVariations\n\t);\n\n\t// Prevent adding template parts inside post templates.\n\tconst DISALLOWED_PARENTS = [ 'core/post-template', 'core/post-content' ];\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'core/block-library/removeTemplatePartsFromPostTemplates',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlock, getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif ( blockType.name !== 'core/template-part' ) {\n\t\t\t\treturn canInsert;\n\t\t\t}\n\n\t\t\tfor ( const disallowedParentType of DISALLOWED_PARENTS ) {\n\t\t\t\tconst hasDisallowedParent =\n\t\t\t\t\tgetBlock( rootClientId )?.name === disallowedParentType ||\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tdisallowedParentType\n\t\t\t\t\t).length;\n\t\t\t\tif ( hasDisallowedParent ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block designed for order submission, incorporating a checkout form that enables customer transactions, with configurable settings for preview mode, alignment, and form step visibility."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/block.json\n{\n\t\"name\": \"woocommerce/checkout\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Checkout\",\n\t\"description\": \"Display a checkout form so your customers can submit orders.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"align\": [\n\t\t\t\"wide\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"multiple\": false\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t},\n\t\t\"viewportWidth\": 800\n\t},\n\t\"attributes\": {\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"save\": false\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"showFormStepNumbers\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';\nimport { CheckoutProvider, EditorProvider } from '@woocommerce/base-context';\nimport {\n\tpreviewCart,\n\tpreviewSavedPaymentMethods,\n} from '@woocommerce/resource-previews';\nimport { SlotFillProvider } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getQueryArg } from '@wordpress/url';\nimport { dispatch, select as selectData, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { defaultFields as defaultFieldsSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport './inner-blocks';\nimport './styles/editor.scss';\nimport {\n\taddClassToBody,\n\tBlockSettings,\n\tuseBlockPropsWithLocking,\n} from '../cart-checkout-shared';\nimport '../cart-checkout-shared/sidebar-notices';\nimport { CheckoutBlockContext } from './context';\nimport type { Attributes } from './types';\n\n// This is adds a class to body to signal if the selected block is locked\naddClassToBody();\n\n// Array of allowed block names.\nconst ALLOWED_BLOCKS: string[] = [\n\t'woocommerce/checkout-fields-block',\n\t'woocommerce/checkout-totals-block',\n];\n\nexport const Edit = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n}: {\n\tclientId: string;\n\tattributes: Attributes;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => undefined;\n} ): JSX.Element => {\n\tconst {\n\t\tshowOrderNotes,\n\t\tshowPolicyLinks,\n\t\tshowReturnToCart,\n\t\tshowRateAfterTaxName,\n\t\tcartPageId,\n\t\tisPreview = false,\n\t\tshowFormStepNumbers = false,\n\t\thasDarkControls = false,\n\t} = attributes;\n\n\tconst fieldSettings = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore as unknown as string\n\t\t\t// @ts-expect-error getEditedEntityRecord is not typed in @wordpress/core-data yet.\n\t\t).getEditedEntityRecord( 'root', 'site' ) as Record< string, string >;\n\t}, [] );\n\n\tconst fieldsWithDefaults = {\n\t\tphone: 'optional',\n\t\tcompany: 'hidden',\n\t\taddress_2: 'optional',\n\t} as const;\n\n\tconst defaultFields = {\n\t\t...defaultFieldsSetting,\n\t\t...Object.fromEntries(\n\t\t\tObject.entries( fieldsWithDefaults ).map(\n\t\t\t\t( [ field, defaultValue ] ) => {\n\t\t\t\t\tconst value =\n\t\t\t\t\t\tfieldSettings[\n\t\t\t\t\t\t\t`woocommerce_checkout_${ field }_field`\n\t\t\t\t\t\t] || defaultValue;\n\t\t\t\t\treturn [\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultFieldsSetting[\n\t\t\t\t\t\t\t\tfield as keyof typeof defaultFieldsSetting\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\trequired: value === 'required',\n\t\t\t\t\t\t\thidden: value === 'hidden',\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t)\n\t\t),\n\t};\n\n\t// This focuses on the block when a certain query param is found. This is used on the link from the task list.\n\tconst focus = useRef( getQueryArg( window.location.href, 'focus' ) );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tfocus.current === 'checkout' &&\n\t\t\t! selectData( 'core/block-editor' ).hasSelectedBlock()\n\t\t) {\n\t\t\tdispatch( 'core/block-editor' ).selectBlock( clientId );\n\t\t\tdispatch( 'core/interface' ).enableComplementaryArea(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'edit-site/block-inspector'\n\t\t\t);\n\t\t}\n\t}, [ clientId ] );\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-totals-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-fields-block', {}, [] ],\n\t] as TemplateArray;\n\n\tconst blockProps = useBlockPropsWithLocking();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Let shoppers know when products are out of stock or on backorder. This block is hidden when products are in stock. that allows users to configure: is descendant of all products"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/stock-indicator/block.json\n{\n\t\"name\": \"woocommerce/product-stock-indicator\",\n\t\"icon\": \"info\",\n\t\"title\": \"Product Stock Indicator\",\n\t\"description\": \"Let shoppers know when products are out of stock or on backorder. This block is hidden when products are in stock.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"isDescendantOfAllProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/stock-indicator/index.ts\n/**\n * External dependencies\n */\nimport { registerProductBlockType } from '@woocommerce/atomic-utils';\nimport type { BlockConfiguration } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport metadata from './block.json';\nimport { BLOCK_ICON as icon } from './constants';\n\nconst blockConfig: BlockConfiguration = {\n\t...metadata,\n\ticon: { src: icon },\n\tedit,\n\tsave: () => null,\n};\n\nregisterProductBlockType( blockConfig, {\n\tisAvailableOnPostEditor: true,\n} );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a theme block with comprehensive text settings, allowing users to modify alignment, type, label, and four more configurable options for enhanced customization."}, {"role": "assistant", "content": "// File: packages/block-library/src/post-navigation-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-navigation-link\",\n\t\"title\": \"Post Navigation Link\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the next or previous post link that is adjacent to the current post.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"next\"\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"linkLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"arrow\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"none\"\n\t\t},\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-navigation-link\"\n}\n\n\n// File: packages/block-library/src/post-navigation-link/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tvariations,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: __( 'Next post' ),\n\t\t\tarrow: 'arrow',\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display an icon linking to a social profile or site. that allows users to configure: url, service, label, rel"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/social-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/social-link\",\n\t\"title\": \"Social Icon\",\n\t\"category\": \"widgets\",\n\t\"parent\": [ \"core/social-links\" ],\n\t\"description\": \"Display an icon linking to a social profile or site.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"service\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [\n\t\t\"openInNewTab\",\n\t\t\"showLabels\",\n\t\t\"iconColor\",\n\t\t\"iconColorValue\",\n\t\t\"iconBackgroundColor\",\n\t\t\"iconBackgroundColorValue\"\n\t],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-social-link-editor\"\n}\n\n\n// File: packages/block-library/src/social-link/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { share as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\thref: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'link' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a flexible media block offering dynamic customization options and seamless media file integration within the WordPress environment."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/story\",\n\t\"title\": \"Story\",\n\t\"description\": \"Add an interactive story.\",\n\t\"keywords\": [ \"story\", \"image\", \"video\", \"gallery\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"media\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"settings\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"mediaFiles\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"mediaFiles\": [\n\t\t\t\t{\n\t\t\t\t\t\"alt\": \"\",\n\t\t\t\t\t\"caption\": \"\",\n\t\t\t\t\t\"mime\": \"image/jpg\",\n\t\t\t\t\t\"type\": \"image\",\n\t\t\t\t\t\"id\": 22,\n\t\t\t\t\t\"url\": \"./storyExample1.png\"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { isBlobURL } from '@wordpress/blob';\nimport { MediaPlaceholder, useBlockProps } from '@wordpress/block-editor';\nimport { withNotices } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport metadata from './block.json';\nimport Controls from './controls';\nimport StoryPlayer from './player';\n\nimport './editor.scss';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\nconst ALLOWED_MEDIA_PROPS = [\n\t'alt',\n\t'title',\n\t'id',\n\t'link',\n\t'type',\n\t'mime',\n\t'caption',\n\t'width',\n\t'height',\n];\nconst icon = getBlockIconComponent( metadata );\n\nexport const pickRelevantMediaFiles = media => {\n\tconst mediaProps = Object.fromEntries(\n\t\tObject.entries( media ).filter( ( [ k ] ) => ALLOWED_MEDIA_PROPS.includes( k ) )\n\t);\n\tmediaProps.url =\n\t\tmedia?.media_details?.original?.url ||\n\t\tmedia?.media_details?.videopress?.original ||\n\t\tmedia?.media_details?.sizes?.large?.source_url ||\n\t\tmedia?.sizes?.large?.url ||\n\t\tmedia.url;\n\tmediaProps.type = media.media_type || media.type;\n\tmediaProps.mime = media.mime_type || media.mime;\n\tmediaProps.title = mediaProps.title?.rendered || mediaProps.title;\n\tmediaProps.width = mediaProps.width || media.media_details?.width;\n\tmediaProps.height = mediaProps.height || media.media_details?.height;\n\treturn mediaProps;\n};\n\nexport default withNotices( function StoryEdit( {\n\tattributes,\n\tisSelected,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n} ) {\n\tconst { mediaFiles } = attributes;\n\tconst { lockPostSaving, unlockPostSaving } = useDispatch( 'core/editor' );\n\tconst blockProps = useBlockProps();\n\tconst lockName = 'storyBlockLock';\n\n\tconst onSelectMedia = newMediaFiles => {\n\t\tconst allMedia = newMediaFiles\n\t\t\t.map( newMedia => {\n\t\t\t\t// MediaPlaceholder passes only the media ids as value to MediaUpload, so we're only getting those back\n\t\t\t\tif ( ! isNaN( newMedia ) ) {\n\t\t\t\t\tconst existingMedia = mediaFiles.find( mediaFile => mediaFile.id === newMedia );\n\t\t\t\t\treturn existingMedia || { id: newMedia };\n\t\t\t\t}\n\t\t\t\treturn newMedia;\n\t\t\t} )\n\t\t\t.map( pickRelevantMediaFiles );\n\t\tconst uploadedMedias = allMedia.filter( media => ! isBlobURL( media.url ) );\n\t\t// prevent saving blob urls in mediaFiles block attribute\n\t\tif ( allMedia.length !== uploadedMedias.length ) {\n\t\t\tlockPostSaving( lockName );\n\t\t} else {\n\t\t\tunlockPostSaving( lockName );\n\t\t}\n\t\tsetAttributes( {\n\t\t\tmediaFiles: allMedia,\n\t\t} );\n\t};\n\n\tconst controls = (\n\t\t\n\t);\n\n\tconst hasImages = !! mediaFiles.length;\n\n\tconst mediaPlaceholder = (\n\t\t type + '/*' ).join( ',' ) }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\tmultiple=\"add\"\n\t\t\tvalue={ mediaFiles }\n\t\t\tnotices={ hasImages ? undefined : noticeUI }\n\t\t\tonError={ noticeOperations.createErrorNotice }\n\t\t/>\n\t);\n\n\tlet content;\n\n\tif ( ! hasImages ) {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t{ mediaPlaceholder }\n\t\t\t\n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t{ noticeUI }\n\t\t\t\t\n\t\t\t\t{ isSelected && mediaPlaceholder }\n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t\n\t\t\t{ content }\n\t\t
        \n\t);\n} );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default () => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block for showcasing product pricing that enables customization of product identification, query loop hierarchy, text alignment, and two additional configurable parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/price/block.json\n{\n\t\"name\": \"woocommerce/product-price\",\n\t\"title\": \"Product Price\",\n\t\"description\": \"Display the price of a product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": { \"type\": \"number\", \"default\": 0 },\n\t\t\"isDescendentOfQueryLoop\": { \"type\": \"boolean\", \"default\": false },\n\t\t\"textAlign\": { \"type\": \"string\", \"default\": \"\" },\n\t\t\"isDescendentOfSingleProductTemplate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"__experimentalSelector\": \".wp-block-woocommerce-product-price .wc-block-components-product-price\",\n\t\t\"email\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/featured-product\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"viewScriptModule\": \"product-price\",\n\t\"style\": \"file:../product-price.css\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport type { BlockAlignment } from '@wordpress/blocks';\nimport { isExperimentalWcRestApiV4Enabled } from '@woocommerce/block-settings';\nimport { useProduct } from '@woocommerce/entities';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\ntype UnsupportedAligments = 'wide' | 'full';\ntype AllowedAlignments = Exclude< BlockAlignment, UnsupportedAligments >;\n\ninterface BlockAttributes {\n\ttextAlign?: AllowedAlignments;\n}\n\ninterface Attributes {\n\ttextAlign: 'left' | 'center' | 'right';\n\tisDescendentOfSingleProduct: boolean;\n\tisDescendentOfSingleProductBlock: boolean;\n\tproductId: number;\n}\n\ninterface Context {\n\tqueryId: number;\n}\n\ninterface Props {\n\tattributes: Attributes;\n\tsetAttributes: (\n\t\tattributes: Partial< BlockAttributes > & Record< string, unknown >\n\t) => void;\n\tcontext: Context;\n}\n\nconst PriceEdit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n}: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t};\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\n\tlet { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tif ( isDescendentOfQueryLoop ) {\n\t\tisDescendentOfSingleProductTemplate = false;\n\t}\n\n\tuseEffect(\n\t\t() =>\n\t\t\tsetAttributes( {\n\t\t\t\tisDescendentOfQueryLoop,\n\t\t\t\tisDescendentOfSingleProductTemplate,\n\t\t\t} ),\n\t\t[\n\t\t\tisDescendentOfQueryLoop,\n\t\t\tisDescendentOfSingleProductTemplate,\n\t\t\tsetAttributes,\n\t\t]\n\t);\n\n\tconst isExperimentalWcRestApiEnabled = isExperimentalWcRestApiV4Enabled();\n\n\tconst { product } = useProduct( context.postId );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
        \n\t\t\t\t{\n\t\t\t\t\t// If experimental WC API is not available we must fallback to \"old\" way of fetching product data.\n\t\t\t\t\t// Once it's available everywhere we can remove this fallback.\n\t\t\t\t\tisExperimentalWcRestApiEnabled ? (\n\t\t\t\t\t\t\n\t\t\t\t\t) : (\n\t\t\t\t\t\t\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default PriceEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block utilizing Gutenberg that renders the Mini-Cart block's title while implementing the designated lock configuration."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-title-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Title\",\n\t\"description\": \"Block that displays the title of the Mini-Cart block.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/filled-mini-cart-contents-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-mini-cart__title',\n\t} );\n\n\tconst TEMPLATE = [\n\t\t[ 'woocommerce/mini-cart-title-label-block', {} ],\n\t\t[ 'woocommerce/mini-cart-title-items-counter-block', {} ],\n\t];\n\n\treturn (\n\t\t

        \n\t\t\t\n\t\t

        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display a post's featured image. that allows users to configure: is link, aspect ratio, width, and 11 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/post-featured-image/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-featured-image\",\n\t\"title\": \"Featured Image\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display a post's featured image.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"aspectRatio\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"height\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"scale\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"cover\"\n\t\t},\n\t\t\"sizeSlug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"attribute\": \"rel\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"overlayColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customOverlayColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"dimRatio\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"gradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customGradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"useFirstImageFromPost\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\", \"queryId\" ],\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"right\", \"center\", \"wide\", \"full\" ],\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"shadow\": {\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"border\": \".wp-block-post-featured-image img, .wp-block-post-featured-image .block-editor-media-placeholder, .wp-block-post-featured-image .wp-block-post-featured-image__overlay\",\n\t\t\"shadow\": \".wp-block-post-featured-image img, .wp-block-post-featured-image .components-placeholder\",\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-post-featured-image img, .wp-block-post-featured-image .wp-block-post-featured-image__placeholder, .wp-block-post-featured-image .components-placeholder__illustration, .wp-block-post-featured-image .components-placeholder::before\"\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-post-featured-image-editor\",\n\t\"style\": \"wp-block-post-featured-image\"\n}\n\n\n// File: packages/block-library/src/post-featured-image/index.js\n/**\n * WordPress dependencies\n */\nimport { postFeaturedImage as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Add an image or video with a text overlay. that allows users to configure: url, use featured image, id, and 19 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/cover/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/cover\",\n\t\"title\": \"Cover\",\n\t\"category\": \"media\",\n\t\"description\": \"Add an image or video with a text overlay.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"useFeaturedImage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"alt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"hasParallax\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isRepeated\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"dimRatio\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 100\n\t\t},\n\t\t\"overlayColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customOverlayColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isUserOverlayColor\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"backgroundType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"image\"\n\t\t},\n\t\t\"focalPoint\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"minHeight\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"minHeightUnit\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"gradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customGradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"contentPosition\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isDark\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ]\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t},\n\t\t\"sizeSlug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"poster\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"poster\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"shadow\": true,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"heading\": true,\n\t\t\t\"text\": true,\n\t\t\t\"background\": false,\n\t\t\t\"__experimentalSkipSerialization\": [ \"gradients\" ],\n\t\t\t\"enableContrastChecker\": false\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"aspectRatio\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowJustification\": false\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"allowedBlocks\": true\n\t},\n\t\"selectors\": {\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-cover > .wp-block-cover__image-background, .wp-block-cover > .wp-block-cover__video-background\"\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-cover-editor\",\n\t\"style\": \"wp-block-cover\"\n}\n\n\n// File: packages/block-library/src/cover/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\tfontSize: 48,\n\t\t\t\t},\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: 'white',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: `${ __( 'Snow Patrol' ) }`,\n\t\t\t\t\talign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'background',\n\t\t\tlabel: __( 'Background' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\ttype: 'backgroundType',\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'url',\n\t\t\t\talt: 'alt',\n\t\t\t\tfeaturedImage: 'useFeaturedImage',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\t// TODO - How to support custom gradient?\n\t\t\t\t// Build it into Media, or use a custom control?\n\t\t\t\tallowedTypes: [ 'image', 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'background' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/cover/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInnerBlocksProps,\n\tgetColorClassName,\n\t__experimentalGetGradientClass,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tEMBED_VIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from './shared';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tbackgroundType,\n\t\tgradient,\n\t\tcontentPosition,\n\t\tcustomGradient,\n\t\tcustomOverlayColor,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tuseFeaturedImage,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\toverlayColor,\n\t\turl,\n\t\talt,\n\t\tid,\n\t\tminHeight: minHeightProp,\n\t\tminHeightUnit,\n\t\ttagName: Tag,\n\t\tsizeSlug,\n\t\tposter,\n\t} = attributes;\n\tconst overlayColorClass = getColorClassName(\n\t\t'background-color',\n\t\toverlayColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst minHeight =\n\t\tminHeightProp && minHeightUnit\n\t\t\t? `${ minHeightProp }${ minHeightUnit }`\n\t\t\t: minHeightProp;\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\tconst isEmbedVideoBackground =\n\t\tEMBED_VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeight || undefined,\n\t};\n\n\tconst bgStyle = {\n\t\tbackgroundColor: ! overlayColorClass ? customOverlayColor : undefined,\n\t\tbackground: customGradient ? customGradient : undefined,\n\t};\n\n\tconst objectPosition =\n\t\t// prettier-ignore\n\t\tfocalPoint && isImgElement\n\t\t\t ? mediaPosition(focalPoint)\n\t\t\t : undefined;\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst classes = clsx(\n\t\t{\n\t\t\t'is-light': ! isDark,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\tconst imgClasses = clsx(\n\t\t'wp-block-cover__image-background',\n\t\tid ? `wp-image-${ id }` : null,\n\t\t{\n\t\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t}\n\t);\n\n\tconst gradientValue = gradient || customGradient;\n\n\treturn (\n\t\t\n\t\t\t{ ! useFeaturedImage &&\n\t\t\t\tisImageBackground &&\n\t\t\t\turl &&\n\t\t\t\t( isImgElement ? (\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) ) }\n\t\t\t{ isVideoBackground && url && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t{ isEmbedVideoBackground && url && (\n\t\t\t\t\n\t\t\t\t\t
        { url }
        \n\t\t\t\t\n\t\t\t) }\n\n\t\t\t{ /* The `wp-block-cover__background` needs to be immediately before\n\t\t\tthe `wp-block-cover__inner-container`, so the exclusion CSS selector\n\t\t\t`.wp-block-cover__background + .wp-block-cover__inner-container`\n\t\t\tworks properly. If it needs to be changed in the future, the\n\t\t\tselector for the backward compatibility for v14 deprecation also\n\t\t\tneeds change. */ }\n\t\t\t\n\n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress theme block that allows flexible comment identification through user-configurable settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-comment/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"__experimental\": \"fse\",\n\t\"name\": \"core/post-comment\",\n\t\"title\": \"Comment (deprecated)\",\n\t\"category\": \"theme\",\n\t\"allowedBlocks\": [\n\t\t\"core/avatar\",\n\t\t\"core/comment-author-name\",\n\t\t\"core/comment-content\",\n\t\t\"core/comment-date\",\n\t\t\"core/comment-edit-link\",\n\t\t\"core/comment-reply-link\"\n\t],\n\t\"description\": \"This block is deprecated. Please use the Comments block instead.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"commentId\": {\n\t\t\t\"type\": \"number\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"commentId\": \"commentId\"\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"inserter\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/post-comment/index.js\n/**\n * WordPress dependencies\n */\nimport { comment as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/post-comment/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save() {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Visually highlight a product category and encourage prompt action. with these attributes: alt, content align, dim ratio, and 12 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/featured-items/featured-category/block.json\n{\n\t\"name\": \"woocommerce/featured-category\",\n\t\"title\": \"Featured Category\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Visually highlight a product category and encourage prompt action.\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"ariaLabel\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t},\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t},\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"alt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"contentAlign\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"center\"\n\t\t},\n\t\t\"dimRatio\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 50\n\t\t},\n\t\t\"focalPoint\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"x\": 0.5,\n\t\t\t\t\"y\": 0.5\n\t\t\t}\n\t\t},\n\t\t\"imageFit\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"none\"\n\t\t},\n\t\t\"hasParallax\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isRepeated\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"mediaId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"mediaSrc\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"minHeight\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 500\n\t\t},\n\t\t\"linkText\": {\n\t\t\t\"default\": \"Shop now\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"categoryId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"overlayColor\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"#000000\"\n\t\t},\n\t\t\"overlayGradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"previewCategory\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": null\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-woocommerce-featured-category .wc-block-featured-category__background-image\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"usesContext\": [ \"termId\", \"termTaxonomy\" ],\n\t\"providesContext\": {\n\t\t\"termId\": \"categoryId\",\n\t\t\"termTaxonomy\": \"termTaxonomy\"\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/featured-items/featured-category/index.tsx\n/**\n * External dependencies\n */\nimport { folderStarred } from '@woocommerce/icons';\nimport { Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\nimport './editor.scss';\nimport Block from './block';\nimport metadata from './block.json';\nimport { register } from '../register';\nimport { example } from './example';\nimport deprecated from './deprecated';\n\nregister( Block, example, metadata, {\n\tdeprecated,\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t),\n\t},\n} );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WooCommerce block featuring adjustable locking functionality that enables dynamic configuration of access controls."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-shipping-methods-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping Options\",\n\t\"description\": \"Display shipping options and rates for your store.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { PanelBody, ExternalLink } from '@wordpress/components';\nimport { shipping } from '@wordpress/icons';\nimport { ADMIN_URL, getSetting } from '@woocommerce/settings';\nimport ExternalLinkCard from '@woocommerce/editor-components/external-link-card';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { useCheckoutAddress } from '@woocommerce/base-context/hooks';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport ConfigurePlaceholder from '../../configure-placeholder';\nimport Block from './block';\nimport './editor.scss';\n\ntype shippingAdminLink = {\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element | null => {\n\tconst globalShippingMethods = getSetting(\n\t\t'globalShippingMethods'\n\t) as shippingAdminLink[];\n\tconst activeShippingZones = getSetting(\n\t\t'activeShippingZones'\n\t) as shippingAdminLink[];\n\n\tconst { showShippingMethods } = useCheckoutAddress();\n\n\tif ( ! showShippingMethods ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Options that control shipping can be managed in your store settings.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Manage shipping options', 'woocommerce' ) }\n\t\t\t\t\t{ ' ' }\n\t\t\t\t\n\t\t\t\t{ globalShippingMethods.length > 0 && (\n\t\t\t\t\t\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'The following shipping integrations are active on your store.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t{ globalShippingMethods.map( ( method ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Manage shipping methods', 'woocommerce' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t) }\n\t\t\t\t{ activeShippingZones.length && (\n\t\t\t\t\t\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Shipping Zones can be made managed in your store settings.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t{ activeShippingZones.map( ( zone ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t
        \n\t\t\t\t) }\n\t\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-products-table-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Products Table\",\n\t\"description\": \"Block that displays the products table of the Mini-Cart block.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/mini-cart-items-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable display style, icon style, icon class"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/customer-account/block.json\n{\n\t\"name\": \"woocommerce/customer-account\",\n\t\"title\": \"Customer account\",\n\t\"description\": \"A block that allows your customers to log in and out of their accounts in your store.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\", \"My Account\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"align\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"icon_and_text\"\n\t\t},\n\t\t\"iconStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"default\"\n\t\t},\n\t\t\"iconClass\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"icon\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/customer-account/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { Disabled } from '@wordpress/components';\nimport type { BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { Attributes } from './types';\nimport { BlockSettings } from './sidebar-settings';\nimport './editor.scss';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: BlockEditProps< Attributes > ) => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-editor-customer-account', className ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block enabling simple text enhancement with configurable options for adding headings, lists, and hyperlinks to plain content."}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/markdown/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/markdown\",\n\t\"title\": \"Markdown\",\n\t\"description\": \"Add headings, lists, or links to plain text with ease.\",\n\t\"keywords\": [ \"formatting\", \"syntax\", \"markup\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"text\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"margin\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": { \"source\": { \"type\": \"string\" } },\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"source\": \"## ## Try Markdown\\n\\nMarkdown is a text formatting syntax that is converted into HTML. You can _emphasize_ text or **make it strong** with just a few characters.\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/markdown/edit.js\nimport { BlockControls, PlainText, useBlockProps } from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport ToolbarButton from './controls';\nimport MarkdownRenderer from './renderer';\n\n/**\n * Module variables\n */\nconst PANEL_EDITOR = 'editor';\nconst PANEL_PREVIEW = 'preview';\n\nconst MarkdownEdit = ( { attributes, setAttributes, isSelected, removeBlock } ) => {\n\tconst { source } = attributes;\n\tconst isEmpty = ! source || source.trim() === '';\n\n\tconst blockProps = useBlockProps();\n\tconst { className } = blockProps;\n\tconst [ activePanel, setActivePanel ] = useState( PANEL_EDITOR );\n\tconst input = useRef( null );\n\n\tconst onChange = s => setAttributes( { source: s } );\n\tconst onKeyDown = e => {\n\t\t// Remove the block if source is empty and we're pressing the Backspace key\n\t\tif ( e.keyCode === 8 && source === '' ) {\n\t\t\tremoveBlock();\n\t\t\te.preventDefault();\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( isSelected ) {\n\t\t\tif ( activePanel === PANEL_EDITOR ) {\n\t\t\t\tinput?.current.focus();\n\t\t\t}\n\t\t} else if ( activePanel === PANEL_PREVIEW ) {\n\t\t\tsetActivePanel( PANEL_EDITOR );\n\t\t}\n\t}, [ isSelected, activePanel, setActivePanel ] );\n\n\tlet content;\n\n\tif ( ! isSelected && isEmpty ) {\n\t\tcontent = (\n\t\t\t

        \n\t\t\t\t{ __( 'Write your _Markdown_ **here**…', 'jetpack' ) }\n\t\t\t

        \n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t\t\t setActivePanel( PANEL_EDITOR ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t setActivePanel( PANEL_PREVIEW ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t
        \n\t\t\t\t
        \n\n\t\t\t\t{ activePanel === PANEL_PREVIEW || ! isSelected ? (\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
        \n\t\t);\n\t}\n\n\treturn
        { content }
        ;\n};\n\nexport default compose( [\n\twithSelect( select => ( {\n\t\tcurrentBlockId: select( 'core/block-editor' ).getSelectedBlockClientId(),\n\t} ) ),\n\twithDispatch( ( dispatch, { currentBlockId } ) => ( {\n\t\tremoveBlock: () => dispatch( 'core/block-editor' ).removeBlocks( currentBlockId ),\n\t} ) ),\n] )( MarkdownEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/markdown/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport MarkdownRenderer from './renderer';\n\nexport default ( { attributes } ) => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a theme block with customizable text align, more text, show more on new line, excerpt length"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-excerpt/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-excerpt\",\n\t\"title\": \"Excerpt\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display the excerpt.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"moreText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showMoreOnNewLine\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"excerptLength\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 55\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\", \"queryId\" ],\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-post-excerpt-editor\",\n\t\"style\": \"wp-block-post-excerpt\"\n}\n\n\n// File: packages/block-library/src/post-excerpt/index.js\n/**\n * WordPress dependencies\n */\nimport { postExcerpt as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\ttransforms,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the link to the current post comments. with these attributes: text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-comments-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-comments-link\",\n\t\"title\": \"Comments Link\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the link to the current post comments.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"postType\", \"postId\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-comments-link\"\n}\n\n\n// File: packages/block-library/src/post-comments-link/index.js\n/**\n * WordPress dependencies\n */\nimport { postCommentsCount as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\ticon,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Elevate your content creation with our AI-powered Gutenberg Block, offering seamless customization and generation. Bear in mind that, as an evolving tool, occasional imprecision may occur. with these attributes: content, original content, prompt type, and 5 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/ai-assistant/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/ai-assistant\",\n\t\"title\": \"AI Assistant\",\n\t\"description\": \"Elevate your content creation with our AI-powered Gutenberg Block, offering seamless customization and generation. Bear in mind that, as an evolving tool, occasional imprecision may occur.\",\n\t\"keywords\": [ \"AI\", \"GPT\", \"AL\", \"Magic\", \"help\", \"assistant\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"text\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\n\t\t\"originalContent\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\n\t\t\"promptType\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\n\t\t\"originalMessages\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\n\t\t\"messages\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\n\t\t\"userPrompt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\n\t\t\"requestingState\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"init\"\n\t\t},\n\n\t\t\"preTransformAction\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": null\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"content\": \"With **Jetpack AI Assistant**, you can provide a prompt, and it will generate high-quality blog posts, informative pages, well-organized lists, and thorough tables that meet your specific requirements.\\n\\nTo start using the **Jetpack AI Assistant**, type `/AI` in the block editor.\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js\n/**\n * External dependencies\n */\nimport {\n\tBlockAIControl,\n\tUpgradeMessage,\n\trenderHTMLFromMarkdown,\n\tPROMPT_TYPE_GENERATE_TITLE,\n\tmapActionToHumanText,\n\tQuotaExceededMessage,\n\tFairUsageNotice,\n\tuseAICheckout,\n\tuseAiFeature,\n} from '@automattic/jetpack-ai-client';\nimport {\n\tuseAnalytics,\n\tPLAN_TYPE_FREE,\n\tPLAN_TYPE_UNLIMITED,\n\tusePlanType,\n\tisUserConnected,\n} from '@automattic/jetpack-shared-extension-utils';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { rawHandler } from '@wordpress/blocks';\nimport {\n\tNotice,\n\tPanelBody,\n\tPanelRow,\n\tKeyboardShortcuts,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { RawHTML, useState, useCallback, useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport UsagePanel from '../../plugins/ai-assistant-plugin/components/usage-panel';\nimport { USAGE_PANEL_PLACEMENT_BLOCK_SETTINGS_SIDEBAR } from '../../plugins/ai-assistant-plugin/components/usage-panel/types';\nimport ConnectBanner from '../../shared/components/connect-banner';\nimport FeedbackControl from './components/feedback-control';\nimport ToolbarControls from './components/toolbar-controls';\nimport useAIAssistant from './hooks/use-ai-assistant';\nimport useAiProductPage from './hooks/use-ai-product-page';\nimport { getStoreBlockId } from './hooks/use-transform-to-assistant';\nimport './editor.scss';\n\nconst isInBlockEditor = window?.Jetpack_Editor_Initial_State?.screenBase === 'post';\n\nexport default function AIAssistantEdit( { attributes, setAttributes, clientId, isSelected } ) {\n\tconst [ errorDismissed, setErrorDismissed ] = useState( null );\n\tconst { tracks } = useAnalytics();\n\n\tconst { getBlock } = useSelect( 'core/block-editor' );\n\n\tconst aiControlRef = useRef( null );\n\tconst blockRef = useRef( null );\n\n\tconst { replaceBlocks, removeBlock } = useDispatch( 'core/block-editor' );\n\tconst { editPost } = useDispatch( 'core/editor' );\n\n\tconst [ lastAction, setLastAction ] = useState(\n\t\tmapActionToHumanText( attributes.preTransformAction )\n\t);\n\n\tconst {\n\t\tisOverLimit,\n\t\trequireUpgrade,\n\t\tincreaseRequestsCount,\n\t\trequestsCount,\n\t\trequestsLimit,\n\t\tcurrentTier,\n\t\tloading: loadingAiFeature,\n\t\ttierPlansEnabled,\n\t} = useAiFeature();\n\tconst requestsRemaining = Math.max( requestsLimit - requestsCount, 0 );\n\n\tconst { autosaveAndRedirect } = useAICheckout();\n\tconst planType = usePlanType( currentTier );\n\n\tconst focusOnPrompt = () => {\n\t\t/*\n\t\t * Increase the AI Suggestion counter.\n\t\t * @todo: move this at store level.\n\t\t */\n\t\t// Small delay to avoid focus crash\n\t\tsetTimeout( () => {\n\t\t\taiControlRef.current?.focus?.();\n\t\t}, 100 );\n\t};\n\n\tconst focusOnBlock = () => {\n\t\t// Small delay to avoid focus crash\n\t\tsetTimeout( () => {\n\t\t\tblockRef.current?.focus?.();\n\t\t}, 100 );\n\t};\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst contentRef = useRef( null );\n\n\tconst {\n\t\tgetSuggestionFromOpenAI,\n\t\tstopSuggestion,\n\t\tshowRetry,\n\t\tcontentBefore,\n\t\tpostTitle,\n\t\tretryRequest,\n\t\twholeContent,\n\t\trequestingState,\n\t\terror,\n\t} = useAIAssistant( {\n\t\tonSuggestionDone: useCallback(\n\t\t\tskipRequestCount => {\n\t\t\t\tfocusOnPrompt();\n\t\t\t\tif ( ! skipRequestCount ) {\n\t\t\t\t\tincreaseRequestsCount();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ increaseRequestsCount ]\n\t\t),\n\t\tonUnclearPrompt: useCallback( () => {\n\t\t\tfocusOnBlock();\n\t\t\tincreaseRequestsCount();\n\t\t}, [ increaseRequestsCount ] ),\n\t\tonModeration: focusOnPrompt,\n\t\tattributes,\n\t\tclientId,\n\t\tcontent: attributes.content,\n\t\ttracks,\n\t\tuserPrompt: attributes.userPrompt,\n\t\trequireUpgrade,\n\t\tinitialRequestingState: attributes.requestingState,\n\t\tcontentRef,\n\t\tblockRef,\n\t} );\n\n\tconst isWaitingResponse = requestingState === 'requesting';\n\tconst isLoadingCompletion = [ 'requesting', 'suggesting' ].includes( requestingState );\n\n\tconst connected = isUserConnected();\n\n\tconst { productPageUrl } = useAiProductPage();\n\n\t/*\n\t * Auto request the prompt if we detect\n\t * it was previously defined in the local storage.\n\t */\n\tconst storeBlockId = getStoreBlockId( clientId );\n\tuseEffect( () => {\n\t\tif ( ! storeBlockId ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get the parsed data from the local storage.\n\t\tconst data = JSON.parse( localStorage.getItem( storeBlockId ) );\n\t\tif ( ! data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { type, options } = data;\n\n\t\t// Clean up the local storage asap.\n\t\tlocalStorage.removeItem( storeBlockId );\n\n\t\tgetSuggestionFromOpenAI( type, options );\n\t}, [ storeBlockId, getSuggestionFromOpenAI ] );\n\n\tuseEffect( () => {\n\t\tif ( error ) {\n\t\t\tsetErrorDismissed( false );\n\t\t}\n\t}, [ error ] );\n\n\tuseEffect( () => {\n\t\t// we don't want to store \"half way\" states\n\t\tif ( ! [ 'init', 'done' ].includes( requestingState ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( { requestingState } );\n\t}, [ requestingState, setAttributes ] );\n\n\t// Content is loaded\n\tconst contentIsLoaded = !! attributes.content;\n\n\tconst getLastEditableElement = newContentBlocks => {\n\t\tlet lastEditableElement = null;\n\n\t\tnewContentBlocks.forEach( block => {\n\t\t\tconst element = document.querySelector( `.wp-block[data-block=\"${ block.clientId }\"]` );\n\t\t\tif ( ! element ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( element.contentEditable === 'true' ) {\n\t\t\t\tlastEditableElement = element;\n\t\t\t}\n\n\t\t\tconst editableChildren = element.querySelectorAll( `[contenteditable=true]` );\n\t\t\tlastEditableElement = editableChildren.length\n\t\t\t\t? editableChildren[ editableChildren.length - 1 ]\n\t\t\t\t: lastEditableElement;\n\t\t} );\n\n\t\treturn lastEditableElement;\n\t};\n\n\tconst isGeneratingTitle = attributes.promptType === PROMPT_TYPE_GENERATE_TITLE;\n\n\tconst acceptContentLabel = __( 'Accept', 'jetpack' );\n\tconst acceptTitleLabel = __( 'Accept title', 'jetpack' );\n\tconst acceptLabel = isGeneratingTitle ? acceptTitleLabel : acceptContentLabel;\n\n\tconst moveCaretToEnd = element => {\n\t\tconst selection = element.ownerDocument.getSelection();\n\t\tselection.selectAllChildren( element );\n\t\tselection.collapseToEnd();\n\t\telement.focus();\n\t};\n\n\tconst handleGetSuggestion = ( ...args ) => {\n\t\tgetSuggestionFromOpenAI( ...args );\n\t\tfocusOnBlock();\n\t};\n\n\tconst handleChange = value => {\n\t\tsetErrorDismissed( true );\n\t\tsetAttributes( { userPrompt: value } );\n\t};\n\n\tconst handleSend = () => {\n\t\tsetLastAction( attributes.userPrompt );\n\t\thandleGetSuggestion( 'userPrompt' );\n\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_generate', { feature: 'ai-assistant' } );\n\t};\n\n\tconst handleAccept = () => {\n\t\tif ( isGeneratingTitle ) {\n\t\t\thandleAcceptTitle();\n\t\t} else {\n\t\t\thandleAcceptContent();\n\t\t}\n\t};\n\n\tconst replaceContent = async () => {\n\t\tlet newGeneratedBlocks = [];\n\n\t\tlet HTML = renderHTMLFromMarkdown( { content: attributes.content || '' } );\n\n\t\tconst seemsToIncludeTitle =\n\t\t\tHTML?.split( '\\n' ).length > 1 && HTML?.split( '\\n' )?.[ 0 ]?.match( /^

        .*<\\/h1>$/ );\n\n\t\tif ( seemsToIncludeTitle && ! postTitle ) {\n\t\t\t// split HTML on new line characters\n\t\t\tconst htmlLines = HTML.split( '\\n' );\n\t\t\t// take the first line as title\n\t\t\tconst title = htmlLines.shift();\n\t\t\t// rejoin the rest of the lines on HTML\n\t\t\tHTML = htmlLines.join( '\\n' );\n\t\t\t// set the title as post title\n\t\t\teditPost( { title: title.replace( /<[^>]*>/g, '' ) } );\n\t\t}\n\t\tnewGeneratedBlocks = rawHandler( { HTML: HTML } );\n\n\t\t// Replace the block with the new generated blocks\n\t\tawait replaceBlocks( clientId, newGeneratedBlocks );\n\n\t\t// Move the caret to the end of the last editable element\n\t\tconst lastEditableElement = getLastEditableElement( newGeneratedBlocks );\n\t\tif ( lastEditableElement ) {\n\t\t\tmoveCaretToEnd( lastEditableElement );\n\t\t}\n\t};\n\n\tconst handleAcceptContent = () => {\n\t\treplaceContent();\n\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_accept', { feature: 'ai-assistant' } );\n\t};\n\n\tconst handleAcceptTitle = () => {\n\t\tif ( isInBlockEditor ) {\n\t\t\teditPost( { title: attributes.content ? attributes.content.trim() : '' } );\n\t\t\tremoveBlock( clientId );\n\t\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_accept', { feature: 'ai-assistant' } );\n\t\t} else {\n\t\t\thandleAcceptContent();\n\t\t}\n\t};\n\n\tconst handleDiscard = () => {\n\t\tconst isDismiss = attributes?.content === getBlock( clientId ).attributes?.content;\n\t\tsetAttributes( {\n\t\t\tcontent: attributes?.originalContent,\n\t\t\tpromptType: undefined,\n\t\t\tmessages: attributes?.originalMessages,\n\t\t} );\n\t\treplaceContent();\n\t\tif ( isDismiss ) {\n\t\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_dismiss' );\n\t\t} else {\n\t\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_discard', { feature: 'ai-assistant' } );\n\t\t}\n\t};\n\n\tconst handleStopSuggestion = () => {\n\t\tstopSuggestion();\n\t\tfocusOnPrompt();\n\t\ttracks.recordEvent( 'jetpack_ai_assistant_block_stop', { feature: 'ai-assistant' } );\n\t};\n\n\tconst handleGetSuggestionFromToolbar = ( type, options ) => {\n\t\tconst humanText = mapActionToHumanText( type, options );\n\t\tsetLastAction( humanText );\n\t\tgetSuggestionFromOpenAI( type, options );\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tref: blockRef,\n\t\tclassName: clsx( { 'is-waiting-response': isWaitingResponse } ),\n\t} );\n\n\tconst promptPlaceholder = __( 'Ask Jetpack AI…', 'jetpack' );\n\tconst promptPlaceholderWithSamples = __( 'Write about… Make a table for…', 'jetpack' );\n\n\tconst banner = (\n\t\t<>\n\t\t\t{ isOverLimit && isSelected && }\n\t\t\t{ ! connected && }\n\t\t\n\t);\n\n\tconst errorNotice = (\n\t\t<>\n\t\t\t{ error?.message && ! errorDismissed && error?.code !== 'error_quota_exceeded' && (\n\t\t\t\t\n\t\t\t\t\t{ error.message }\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n\n\tconst fairUsageNotice =\n\t\tisOverLimit && planType === PLAN_TYPE_UNLIMITED ? : null;\n\n\tconst trackUpgradeClick = useCallback(\n\t\tevent => {\n\t\t\tevent.preventDefault();\n\t\t\ttracks.recordEvent( 'jetpack_ai_upgrade_button', {\n\t\t\t\tcurrent_tier_slug: currentTier?.slug,\n\t\t\t\trequests_count: requestsCount,\n\t\t\t\tplacement: 'jetpack_ai_assistant_block',\n\t\t\t} );\n\t\t\tautosaveAndRedirect( event );\n\t\t},\n\t\t[ tracks, currentTier, requestsCount, autosaveAndRedirect ]\n\t);\n\n\treturn (\n\t\t {\n\t\t\t\t\tif ( [ 'requesting', 'suggesting' ].includes( requestingState ) ) {\n\t\t\t\t\t\thandleStopSuggestion();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t} }\n\t\t>\n\t\t\t
        \n\t\t\t\t{ contentIsLoaded && (\n\t\t\t\t\t
        \n\t\t\t\t\t\t{ renderHTMLFromMarkdown( { content: attributes.content || '' } ) }\n\t\t\t\t\t
        \n\t\t\t\t) }\n\t\t\t\t\n\t\t\t\t\t{ fairUsageNotice && (\n\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ fairUsageNotice }\n\t\t\t\t\t\t
        \n\t\t\t\t\t) }\n\t\t\t\t\t{ /* Mock BlockCard component styles to keep alignment */ }\n\t\t\t\t\t
        \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Discover all features', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t\t{ ( planType === PLAN_TYPE_FREE ||\n\t\t\t\t\t\t( tierPlansEnabled && planType !== PLAN_TYPE_UNLIMITED ) ) && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
        \n\n\t\t\t\t{ ! isLoadingCompletion && connected && ! requireUpgrade && (\n\t\t\t\t\t {\n\t\t\t\t\t\t\tif ( ! aiControlRef?.current ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst userPromptInput = aiControlRef.current;\n\n\t\t\t\t\t\t\t// Focus the text area\n\t\t\t\t\t\t\tuserPromptInput.focus();\n\n\t\t\t\t\t\t\tsetAttributes( { userPrompt: prompt } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trecordEvent={ tracks.recordEvent }\n\t\t\t\t\t\tisGeneratingTitle={ isGeneratingTitle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t 0 }\n\t\t\t\t\tbanner={ banner }\n\t\t\t\t\terror={ errorNotice }\n\t\t\t\t\tcustomFooter={\n\t\t\t\t\t\t// Only show the upgrade message on each 5th request or if it's the first request - and only if the user is on the free plan\n\t\t\t\t\t\t( requestsRemaining % 5 === 0 || requestsCount === 1 ) &&\n\t\t\t\t\t\t! loadingAiFeature && // Don't show the upgrade message while the feature is loading\n\t\t\t\t\t\tplanType === PLAN_TYPE_FREE ? (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t) : null\n\t\t\t\t\t}\n\t\t\t\t\tlastAction={ lastAction }\n\t\t\t\t/>\n\t\t\t
        \n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Provide a notification message after the form has been submitted. with these attributes: type"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/form-submission-notification/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"__experimental\": true,\n\t\"name\": \"core/form-submission-notification\",\n\t\"title\": \"Form Submission Notification\",\n\t\"category\": \"common\",\n\t\"ancestor\": [ \"core/form\" ],\n\t\"description\": \"Provide a notification message after the form has been submitted.\",\n\t\"keywords\": [ \"form\", \"feedback\", \"notification\", \"message\" ],\n\t\"textdomain\": \"default\",\n\t\"icon\": \"feedback\",\n\t\"attributes\": {\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"success\"\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/form-submission-notification/index.js\n/**\n * WordPress dependencies\n */\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/form-submission-notification/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { type } = attributes;\n\n\treturn (\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Block containing current line items in Cart. that allows users to configure: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-line-items-block/block.json\n{\n\t\"name\": \"woocommerce/cart-line-items-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Cart Line Items\",\n\t\"description\": \"Block containing current line items in Cart.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-items-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-line-items-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: { className: string };\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a WordPress block to Display the product title as a label or paragraph."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-grouped-product-item-label\",\n\t\"title\": \"Grouped Product: Item Label (Beta)\",\n\t\"description\": \"Display the product title as a label or paragraph.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"ancestor\": [ \"woocommerce/add-to-cart-with-options-grouped-product-item\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"supports\": {\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"html\": false,\n\t\t\"layout\": {\n\t\t\t\"selfStretch\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"textAlign\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"fontWeight\": true,\n\t\t\t\t\"fontStyle\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ]\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/index.tsx\n/**\n * External dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { heading } from '@wordpress/icons';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport type { BlockConfiguration } from '@wordpress/blocks';\nimport { useProductDataContext } from '@woocommerce/shared-context';\nimport { Spinner } from '@wordpress/components';\nimport { isProductResponseItem } from '@woocommerce/entities';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t...metadata,\n\tedit: function Edit() {\n\t\tconst blockProps = useBlockProps();\n\t\tconst { isLoading, product } = useProductDataContext();\n\n\t\tif ( isLoading || ! isProductResponseItem( product ) ) {\n\t\t\treturn ;\n\t\t}\n\t\treturn (\n\t\t\t
        \n\t\t\t\t
        \n\t\t\t\t\t{ product.name }\n\t\t\t\t
        \n\t\t\t
        \n\t\t);\n\t},\n\ticon: heading,\n\tsave: () => null,\n} as unknown as BlockConfiguration );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block template for displaying individual child products as list items within the Grouped Product Selector interface."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-grouped-product-item\",\n\t\"title\": \"Grouped Product: Template (Beta)\",\n\t\"description\": \"A list item template that represents a child product within the Grouped Product Selector block.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/add-to-cart-with-options-grouped-product-selector\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"supports\": {\n\t\t\"inserter\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-grouped-product-item-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/edit.tsx\n/**\n * External dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport { BlockInstance, type BlockEditProps } from '@wordpress/blocks';\nimport { withProduct } from '@woocommerce/block-hocs';\nimport {\n\tInnerBlockLayoutContextProvider,\n\tProductDataContextProvider,\n\tuseProductDataContext,\n} from '@woocommerce/shared-context';\nimport { resolveSelect, useSelect } from '@wordpress/data';\nimport type { ProductResponseItem } from '@woocommerce/types';\nimport { productsStore } from '@woocommerce/data';\nimport { isProductResponseItem } from '@woocommerce/entities';\nimport { Spinner } from '@wordpress/components';\nimport { previewProductResponseItems } from '@woocommerce/resource-previews';\n\ninterface Attributes {\n\tclassName?: string;\n}\n\ntype ProductItemWithContextProps = {\n\tattributes: { productId: number };\n\tisLoading?: boolean;\n\tproduct?: ProductResponseItem | null;\n\tblocks: BlockInstance[];\n\tisSelected: boolean;\n\tonSelect(): void;\n};\n\ntype ProductItemProps = {\n\tproduct: ProductResponseItem | null;\n\tblocks: BlockInstance[];\n\tisLoading: boolean;\n\tisSelected: boolean;\n\tonSelect(): void;\n};\n\nconst ProductItem = ( {\n\tproduct,\n\tblocks,\n\tisLoading,\n\tisSelected,\n\tonSelect,\n}: ProductItemProps ) => {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ role: 'listitem' },\n\t\t{ templateLock: 'insert' }\n\t);\n\n\treturn (\n\t\t\n\t\t\t{ isSelected ? (\n\t\t\t\t
        \n\t\t\t) : (\n\t\t\t\t
        \n\t\t\t\t\t {\n\t\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tonSelect();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t
        \n\t\t\t) }\n\t\t\n\t);\n};\n\nconst ProductItemWithContext = withProduct(\n\t( {\n\t\tattributes,\n\t\tisLoading = true,\n\t\tproduct = null,\n\t\tblocks,\n\t\tisSelected,\n\t\tonSelect,\n\t}: ProductItemWithContextProps ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n);\n\nexport default function ProductItemTemplateEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { clientId } = props;\n\tconst { className } = props.attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\n\tconst { product, isLoading } = useProductDataContext();\n\tconst [ isLoadingProducts, setIsLoadingProducts ] = useState( true );\n\tconst [ products, setProducts ] = useState< ProductResponseItem[] | null >(\n\t\tnull\n\t);\n\tconst productsLength = products?.length || 0;\n\n\tuseEffect( () => {\n\t\tconst fetchChildProducts = async ( groupedProductIds: number[] ) => {\n\t\t\tif ( ! groupedProductIds || groupedProductIds.length === 0 ) {\n\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresolveSelect( productsStore )\n\t\t\t\t.getProducts( {\n\t\t\t\t\tinclude: groupedProductIds,\n\t\t\t\t\tper_page: groupedProductIds.length,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t} )\n\t\t\t\t.then( ( fetchedProducts ) => {\n\t\t\t\t\tsetProducts( fetchedProducts );\n\t\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\t} );\n\t\t};\n\n\t\tif ( ! isLoading && product && productsLength === 0 ) {\n\t\t\tif ( isProductResponseItem( product ) ) {\n\t\t\t\tfetchChildProducts( product.grouped_products );\n\t\t\t} else {\n\t\t\t\t// If not editing a specific product, we are editing a template.\n\t\t\t\t// Fetch an existing grouped product so template can be edited.\n\t\t\t\tresolveSelect( productsStore )\n\t\t\t\t\t.getProducts( { type: 'grouped', per_page: 1 } )\n\t\t\t\t\t.then( ( groupedProduct ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgroupedProduct.length > 0 &&\n\t\t\t\t\t\t\tgroupedProduct[ 0 ]?.grouped_products?.length > 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfetchChildProducts(\n\t\t\t\t\t\t\t\tgroupedProduct[ 0 ].grouped_products\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If there are no grouped products, query for any three other products.\n\t\t\t\t\t\t\tresolveSelect( productsStore )\n\t\t\t\t\t\t\t\t.getProducts( {\n\t\t\t\t\t\t\t\t\tper_page: 3,\n\t\t\t\t\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.then( ( fetchedProducts ) => {\n\t\t\t\t\t\t\t\t\tif ( fetchedProducts.length > 0 ) {\n\t\t\t\t\t\t\t\t\t\tsetProducts( fetchedProducts );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}, [ isLoading, product, productsLength ] );\n\n\tconst { blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\treturn { blocks: getBlocks( clientId ) };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ selectedProductItem, setSelectedProductItem ] =\n\t\tuseState< number >();\n\n\tif ( isLoading || isLoadingProducts ) {\n\t\treturn ;\n\t}\n\n\tconst productList = products\n\t\t? products?.map( ( productItem ) => (\n\t\t\t\t setSelectedProductItem( productItem.id ) }\n\t\t\t\t/>\n\t\t ) )\n\t\t: previewProductResponseItems?.map( ( productItem ) => (\n\t\t\t\t setSelectedProductItem( productItem.id ) }\n\t\t\t\t/>\n\t\t ) );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t
        { productList }
        \n\t\t\t
        \n\t\t
        \n\t);\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function ProductItemTemplateSave() {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\t...blockProps,\n\t\trole: 'listitem',\n\t} );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a embed block with customizable align, points, address, and 7 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/map/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/map\",\n\t\"title\": \"Map\",\n\t\"description\": \"Add an interactive map showing one or more locations.\",\n\t\"keywords\": [ \"maps\", \"location\", \"navigation\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": { \"defaultStylePicker\": false, \"html\": false },\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"points\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"address\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"mapDetails\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"zoom\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 13\n\t\t},\n\t\t\"mapCenter\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"longitude\": -122.41941550000001,\n\t\t\t\t\"latitude\": 37.7749295\n\t\t\t}\n\t\t},\n\t\t\"markerColor\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"red\"\n\t\t},\n\t\t\"scrollToZoom\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"mapHeight\": {\n\t\t\t\"type\": \"integer\"\n\t\t},\n\t\t\"showFullscreenButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"example\": {}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/map/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tExternalLink,\n\tPlaceholder,\n\tSpinner,\n\twithNotices,\n\tResizableBox,\n} from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getActiveStyleName } from '../../shared/block-styles';\nimport AddPoint from './add-point';\nimport metadata from './block.json';\nimport Map from './component';\nimport Controls from './controls';\nimport { getCoordinates } from './get-coordinates.js';\nimport previewPlaceholder from './map-preview.jpg';\nimport styles from './styles';\nimport getMapProvider from './utils/get-map-provider';\n\nconst icon = getBlockIconComponent( metadata );\n\nconst API_STATE_LOADING = 0;\nconst API_STATE_FAILURE = 1;\nconst API_STATE_SUCCESS = 2;\n\n// The minimum height that the map can be set to.\nconst MIN_HEIGHT = 400;\n\n// Options for the map wrapper.\nconst RESIZABLE_BOX_ENABLE_OPTION = {\n\ttop: false,\n\tright: false,\n\tbottom: true,\n\tleft: false,\n\ttopRight: false,\n\tbottomRight: false,\n\tbottomLeft: false,\n\ttopLeft: false,\n};\n\nconst MapEdit = ( {\n\tsetAttributes,\n\tattributes,\n\tnoticeUI,\n\tnotices,\n\tisSelected,\n\tnoticeOperations,\n} ) => {\n\tconst {\n\t\taddress,\n\t\tmapDetails,\n\t\tpoints,\n\t\tzoom,\n\t\tmapCenter,\n\t\tmarkerColor,\n\t\tmapHeight,\n\t\tshowFullscreenButton,\n\t} = attributes;\n\n\tconst { toggleSelection } = useDispatch( 'core/block-editor' );\n\n\tconst { isPreviewMode } = useSelect( select => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tisPreviewMode: settings.isPreviewMode,\n\t\t};\n\t}, [] );\n\n\tconst [ addPointVisibility, setAddPointVisibility ] = useState( false );\n\tconst [ apiState, setApiState ] = useState( API_STATE_LOADING );\n\tconst [ apiKey, setApiKey ] = useState( null );\n\tconst [ apiKeyControl, setApiKeyControl ] = useState( null );\n\tconst [ apiKeySource, setApiKeySource ] = useState( null );\n\tconst [ apiRequestOutstanding, setApiRequestOutstanding ] = useState( null );\n\tconst mapRef = useRef( null );\n\tconst blockProps = useBlockProps();\n\tconst { className } = blockProps;\n\n\tconst mapStyle = getActiveStyleName( styles, className );\n\tconst mapProvider = getMapProvider( { mapStyle } );\n\n\tconst geoCodeAddress = () => {\n\t\tif ( ! address || ! apiKey || mapProvider === 'mapkit' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tgetCoordinates( address, apiKey )\n\t\t\t.then( result => {\n\t\t\t\tif ( ! result.features?.length ) {\n\t\t\t\t\tonError(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Could not find the coordinates of the provided address. Displaying default location. Feel free to add the location manually.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconst feature = result.features[ 0 ];\n\t\t\t\t\tconst newPoint = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: feature.text,\n\t\t\t\t\t\t\tplaceTitle: feature.text,\n\t\t\t\t\t\t\tcaption: feature.place_name,\n\t\t\t\t\t\t\tid: feature.id,\n\t\t\t\t\t\t\tcoordinates: {\n\t\t\t\t\t\t\t\tlatitude: feature.center[ 1 ],\n\t\t\t\t\t\t\t\tlongitude: feature.center[ 0 ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t\tsetAttributes( { points: newPoint } );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( error => onError( null, error.message ) );\n\t};\n\n\tconst apiCall = ( serviceApiKey = null, method = 'GET' ) => {\n\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\tconst path = '/wpcom/v2/service-api-keys/mapbox';\n\t\t\tconst fetch = serviceApiKey\n\t\t\t\t? { path, method, data: { service_api_key: serviceApiKey } }\n\t\t\t\t: { path, method };\n\n\t\t\tsetApiRequestOutstanding( true );\n\n\t\t\tapiFetch( fetch ).then(\n\t\t\t\t( { service_api_key: key, service_api_key_source: source } ) => {\n\t\t\t\t\tnoticeOperations.removeAllNotices();\n\n\t\t\t\t\tsetApiState( key ? API_STATE_SUCCESS : API_STATE_FAILURE );\n\t\t\t\t\tsetApiKey( key );\n\t\t\t\t\tsetApiKeyControl( 'wpcom' === source ? '' : key );\n\t\t\t\t\tsetApiKeySource( source );\n\t\t\t\t\tsetApiRequestOutstanding( false );\n\n\t\t\t\t\tresolve();\n\t\t\t\t},\n\t\t\t\t( { message } ) => {\n\t\t\t\t\tonError( null, message );\n\n\t\t\t\t\tsetApiState( API_STATE_FAILURE );\n\t\t\t\t\tsetApiRequestOutstanding( false );\n\n\t\t\t\t\treject();\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst addPoint = point => {\n\t\tif ( points.some( existingPoint => existingPoint.id === point.id ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst newPoints = points.slice( 0 );\n\t\tnewPoints.push( point );\n\t\tsetAttributes( { points: newPoints } );\n\t\tsetAddPointVisibility( false );\n\t};\n\n\tconst updateAPIKey = () => {\n\t\tnoticeOperations.removeAllNotices();\n\n\t\tif ( apiKeyControl ) {\n\t\t\tapiCall( apiKeyControl, 'POST' );\n\t\t}\n\t};\n\n\tconst removeAPIKey = () => apiCall( null, 'DELETE' );\n\n\tconst onError = ( code, message ) => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t};\n\n\t/**\n\t * Event handler for the ResizableBox component. Updates both the height attribute,\n\t * and the map component's height in the DOM.\n\t *\n\t * @param {Event} event - The event object.\n\t * @param {string} direction - A string representing which resize handler was used.\n\t * @param {HTMLElement} elt - A ref to the ResizeableBox's container element.\n\t * @param {object} delta - Information about how far the element was resized.\n\t */\n\tconst onMapResize = ( event, direction, elt, delta ) => {\n\t\ttoggleSelection( true );\n\t\tconst ref = mapRef?.current?.mapRef ?? mapRef;\n\n\t\tif ( ref ) {\n\t\t\tconst height = parseInt( ref.current.offsetHeight + delta.height, 10 );\n\n\t\t\tsetAttributes( {\n\t\t\t\tmapHeight: height,\n\t\t\t} );\n\n\t\t\tif ( ref.current.sizeMap ) {\n\t\t\t\tsetTimeout( ref.current.sizeMap, 0 );\n\t\t\t}\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( mapProvider === 'mapbox' ) {\n\t\t\tapiCall().then( geoCodeAddress );\n\t\t} else {\n\t\t\tsetApiState( API_STATE_SUCCESS );\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tuseEffect( geoCodeAddress, [ address ] );\n\n\tuseEffect( () => {\n\t\t// Fetch API key when switching from mapkit to mapbox\n\t\tif ( className && ! apiKey ) {\n\t\t\tsetApiState( API_STATE_LOADING );\n\t\t\tapiCall();\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ className ] );\n\n\tlet content;\n\n\tif ( isPreviewMode ) {\n\t\tconst mapStyleObject = styles.find( styleObject => styleObject.name === mapStyle );\n\n\t\tcontent = (\n\t\t\t
        \n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t} else if ( apiState === API_STATE_LOADING ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t} else if ( apiState === API_STATE_FAILURE ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t<>\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __( 'To use the map block, you need an Access Token.', 'jetpack' ) }\n\t\t\t\t\t\t
        \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Create an account or log in to Mapbox.', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\t
        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Locate and copy the default access token. Then, paste it into the field below.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\n\t\t\t\t\t
        \n\t\t\t\t\t\t setApiKeyControl( event.target.value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Set Token', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t} else if ( apiState === API_STATE_SUCCESS ) {\n\t\tconst onKeyChange = value => setApiKeyControl( value );\n\n\t\t// Only scroll to zoom when the block is selected, and there's 1 or less points.\n\t\tconst allowScrollToZoom = isSelected && points.length <= 1;\n\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\t setAddPointVisibility( true ) }\n\t\t\t\t\t\tcontext=\"toolbar\"\n\t\t\t\t\t\tmapRef={ mapRef }\n\t\t\t\t\t\tmapProvider={ mapProvider }\n\t\t\t\t\t/>\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t toggleSelection( false ) }\n\t\t\t\t\tonResizeStop={ onMapResize }\n\t\t\t\t>\n\t\t\t\t\t
        \n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tsetAttributes( { zoom: value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tadmin={ true }\n\t\t\t\t\t\t\tapiKey={ apiKey }\n\t\t\t\t\t\t\tonSetPoints={ value => setAttributes( { points: value } ) }\n\t\t\t\t\t\t\tonSetMapCenter={ value => setAttributes( { mapCenter: value } ) }\n\t\t\t\t\t\t\tonMapLoaded={ () => setAddPointVisibility( ! points.length ) }\n\t\t\t\t\t\t\tonMarkerClick={ () => setAddPointVisibility( false ) }\n\t\t\t\t\t\t\tonError={ onError }\n\t\t\t\t\t\t\tmapProvider={ mapProvider }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isSelected && addPointVisibility && (\n\t\t\t\t\t\t\t\t setAddPointVisibility( false ) }\n\t\t\t\t\t\t\t\t\tapiKey={ apiKey }\n\t\t\t\t\t\t\t\t\tonError={ onError }\n\t\t\t\t\t\t\t\t\ttagName=\"AddPoint\"\n\t\t\t\t\t\t\t\t\tmapProvider={ mapProvider }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t
        \n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t
        \n\t\t\t{ noticeUI }\n\t\t\t{ content }\n\t\t
        \n\t);\n};\n\nexport default compose( withNotices )( MapEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/map/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\nimport { getActiveStyleName } from '../../shared/block-styles';\nimport styles from './styles';\n\nconst MapSave = ( { attributes } ) => {\n\tconst {\n\t\talign,\n\t\tmapDetails,\n\t\tpoints,\n\t\tzoom,\n\t\tmapCenter,\n\t\tmarkerColor,\n\t\tscrollToZoom,\n\t\tmapHeight,\n\t\tshowFullscreenButton,\n\t} = attributes;\n\tconst blockProps = useBlockProps.save();\n\tconst { className } = blockProps;\n\n\tconst mapStyle = getActiveStyleName( styles, className );\n\tconst pointsList = points.map( ( point, index ) => {\n\t\tconst { longitude, latitude } = point.coordinates;\n\t\tconst url = 'https://www.google.com/maps/search/?api=1&query=' + latitude + ',' + longitude;\n\t\treturn (\n\t\t\t
      • \n\t\t\t\t{ point.title }\n\t\t\t
      • \n\t\t);\n\t} );\n\n\t// All camelCase attribute names converted to snake_case data attributes\n\treturn (\n\t\t\n\t\t\t{ points.length > 0 &&
          { pointsList }
        }\n\t\t
        \n\t);\n};\n\nexport default MapSave;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Enable customers to filter the product grid by stock status. with these attributes: class name, heading level, show counts, and 4 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/stock-filter/block.json\n{\n\t\"name\": \"woocommerce/stock-filter\",\n\t\"title\": \"Filter by Stock Controls\",\n\t\"description\": \"Enable customers to filter the product grid by stock status.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"button\": true\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"headingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"showCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showFilterButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"list\"\n\t\t},\n\t\t\"selectType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"multiple\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/stock-filter/edit.tsx\n/**\n * External dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport BlockTitle from '@woocommerce/editor-components/block-title';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport {\n\tDisabled,\n\tPanelBody,\n\tToggleControl,\n\twithSpokenMessages,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\nimport { Attributes } from './types';\nimport { UpgradeNotice } from '../filter-wrapper/upgrade';\n\nconst Edit = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n}: BlockEditProps< Attributes > ) => {\n\tconst {\n\t\tclassName,\n\t\theading,\n\t\theadingLevel,\n\t\tshowCounts,\n\t\tshowFilterButton,\n\t\tselectType,\n\t\tdisplayStyle,\n\t} = attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-stock-filter', className ),\n\t} );\n\n\tconst getInspectorControls = () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCounts: ! showCounts,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tselectType: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__multiple-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayStyle: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__display-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowFilterButton: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ getInspectorControls() }\n\t\t\t{\n\t\t\t\t
        \n\t\t\t\t\t{ heading && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( { heading: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t}\n\t\t\n\t);\n};\n\nexport default withSpokenMessages( Edit );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a Gutenberg block designed to transform spoken language into a publication-ready post through AI-driven content conversion, featuring a dedicated content attribute."}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/voice-to-content/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/voice-to-content\",\n\t\"title\": \"Voice to content\",\n\t\"description\": \"Transform your spoken words into a post ready to publish with AI.\",\n\t\"keywords\": [ \"AI\", \"GPT\", \"AL\", \"Magic\", \"help\", \"assistant\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"media\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/voice-to-content/edit.tsx\nimport {\n\tuseMediaRecording,\n\tuseAudioValidation,\n\tTRANSCRIPTION_POST_PROCESSING_ACTION_SIMPLE_DRAFT,\n} from '@automattic/jetpack-ai-client';\nimport { ThemeProvider } from '@automattic/jetpack-components';\nimport { useAnalytics } from '@automattic/jetpack-shared-extension-utils';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { type BlockInstance } from '@wordpress/blocks';\nimport { Button, Modal, Icon } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport ActionButtons from './components/action-buttons';\nimport AudioStatusPanel from './components/audio-status-panel';\nimport useTranscriptionCreator from './hooks/use-transcription-creator';\nimport useTranscriptionInserter from './hooks/use-transcription-inserter';\nimport type {\n\tRecordingState,\n\tTranscriptionState,\n\tValidatedAudioInformation,\n} from '@automattic/jetpack-ai-client';\n\n/**\n * Helper to determine the state of the transcription.\n *\n * @param {boolean} isCreatingTranscription - The transcription creation state\n * @param {boolean} isValidatingAudio - The audio validation state\n * @param {RecordingState} recordingState - The recording state\n * @return {TranscriptionState} - The transcription state\n */\nconst transcriptionStateHelper = (\n\tisCreatingTranscription: boolean,\n\tisValidatingAudio: boolean,\n\trecordingState: RecordingState\n): TranscriptionState => {\n\tif ( isValidatingAudio ) {\n\t\treturn 'validating';\n\t}\n\n\tif ( isCreatingTranscription ) {\n\t\treturn 'processing';\n\t}\n\n\treturn recordingState;\n};\n\nexport default function VoiceToContentEdit( { clientId } ) {\n\tconst [ audio, setAudio ] = useState< Blob >( null );\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t// TODO: The second `deps` argument shouldn't be needed, but it's added to make the type checker happy.\n\t// This can be removed when the core data types are updated to fix the issue.\n\tconst { getBlocks } = useSelect( blockEditorStore, [] ) as {\n\t\tgetBlocks: () => BlockInstance[];\n\t};\n\n\tconst destroyBlock = useCallback( () => {\n\t\t// Remove the block from the editor\n\t\tsetTimeout( () => {\n\t\t\tremoveBlock( clientId );\n\t\t}, 100 );\n\t}, [ removeBlock, clientId ] );\n\n\t// Track the usage of the feature\n\tconst { tracks } = useAnalytics();\n\n\tconst { isValidatingAudio, validateAudio } = useAudioValidation();\n\n\tconst { upsertTranscription } = useTranscriptionInserter();\n\tconst { isCreatingTranscription, createTranscription, cancelTranscription } =\n\t\tuseTranscriptionCreator( {\n\t\t\tonReady: ( content: string ) => {\n\t\t\t\t// When transcription is ready, insert it into the editor\n\t\t\t\tupsertTranscription( content );\n\n\t\t\t\t// Then check if there is a single empty paragraph block before the transcription and remove it\n\t\t\t\t// This is to ensure the P2 title is correct as it's based on the first block\n\t\t\t\tconst blocks = getBlocks();\n\t\t\t\t// One block is the voice-to-content block itself, so we check the first two blocks\n\t\t\t\tfor ( let i = 0; i < 2; i++ ) {\n\t\t\t\t\tif ( blocks[ i ].name === 'core/paragraph' && blocks[ i ].attributes?.content === '' ) {\n\t\t\t\t\t\tremoveBlock( String( blocks[ i ].clientId ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\thandleClose();\n\t\t\t},\n\t\t\tonUpdate: ( content: string ) => {\n\t\t\t\t// When transcription is updated, insert it into the editor\n\t\t\t\tupsertTranscription( content );\n\t\t\t},\n\t\t\tonError: ( error: string ) => {\n\t\t\t\t// When transcription fails, show an error message\n\t\t\t\tonError( error );\n\t\t\t},\n\t\t} );\n\n\tconst handleClose = () => {\n\t\tcancelTranscription();\n\t\tdestroyBlock();\n\t};\n\n\tconst { state, controls, error, onError, duration, analyser } = useMediaRecording( {\n\t\tonDone: lastBlob => {\n\t\t\t// When recording is done, set the audio to be transcribed\n\t\t\tonAudioHandler( lastBlob );\n\t\t},\n\t} );\n\n\tconst onAudioHandler = useCallback(\n\t\t( audioFile: Blob ) => {\n\t\t\tif ( audioFile ) {\n\t\t\t\tsetAudio( audioFile );\n\t\t\t}\n\t\t},\n\t\t[ setAudio ]\n\t);\n\n\t/**\n\t * When the audio changes, create the transcription. In the future,\n\t * we can trigger this action (and others) from a button in the UI.\n\t */\n\tuseEffect( () => {\n\t\tif ( audio ) {\n\t\t\tvalidateAudio(\n\t\t\t\taudio,\n\t\t\t\t( audioInfo: ValidatedAudioInformation ) => {\n\t\t\t\t\t// Track the transcription event\n\t\t\t\t\ttracks.recordEvent( 'jetpack_ai_voice_to_content_transcription_started', {\n\t\t\t\t\t\tpost_processing_action: TRANSCRIPTION_POST_PROCESSING_ACTION_SIMPLE_DRAFT,\n\t\t\t\t\t\ttype: audioInfo.isFile ? 'upload' : 'record',\n\t\t\t\t\t\taudio_duration: audioInfo.duration,\n\t\t\t\t\t\taudio_file_size: audioInfo.size,\n\t\t\t\t\t} );\n\n\t\t\t\t\tcreateTranscription( audio, TRANSCRIPTION_POST_PROCESSING_ACTION_SIMPLE_DRAFT );\n\t\t\t\t},\n\t\t\t\tonError\n\t\t\t);\n\t\t}\n\t}, [ audio, tracks, validateAudio, createTranscription, onError ] );\n\n\t// Destructure controls\n\tconst {\n\t\tstart: controlStart,\n\t\tpause: controlPause,\n\t\tresume: controlResume,\n\t\tstop: controlStop,\n\t\treset: controlReset,\n\t} = controls;\n\n\tconst onUploadHandler = useCallback(\n\t\tevent => {\n\t\t\tif ( event.currentTarget.files.length > 0 ) {\n\t\t\t\tconst file = event.currentTarget.files[ 0 ];\n\t\t\t\tonAudioHandler( file );\n\t\t\t}\n\t\t},\n\t\t[ onAudioHandler ]\n\t);\n\n\tconst onCancelHandler = useCallback( () => {\n\t\tcancelTranscription();\n\t\tcontrolReset();\n\t}, [ cancelTranscription, controlReset ] );\n\n\tconst onRecordHandler = useCallback( () => {\n\t\tcontrolStart( 1000 ); // Stream audio on 1 second intervals\n\t}, [ controlStart ] );\n\n\tconst onPauseHandler = useCallback( () => {\n\t\tcontrolPause();\n\t}, [ controlPause ] );\n\n\tconst onResumeHandler = useCallback( () => {\n\t\tcontrolResume();\n\t}, [ controlResume ] );\n\n\tconst onDoneHandler = useCallback( () => {\n\t\tcontrolStop();\n\t}, [ controlStop ] );\n\n\t// To avoid a wrong TS warning\n\tconst iconProps = { className: 'icon' };\n\n\tconst transcriptionState = transcriptionStateHelper(\n\t\tisCreatingTranscription,\n\t\tisValidatingAudio,\n\t\tstate\n\t);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t
        \n\t\t\t\t\t
        \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Transform your spoken words into a post ready to publish with AI.',\n\t\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\n\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
        \n\t\t\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t\t
        \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Provide feedback', 'jetpack' ) }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t
        \n\t\t\t
        \n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display the order summary on the order confirmation page. with these attributes: align, class name"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/summary/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-summary\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Summary\",\n\t\"description\": \"Display the order summary on the order confirmation page.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"width\": true,\n\t\t\t\t\"color\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/summary/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { formatPrice } from '@woocommerce/price-format';\nimport { date } from '@wordpress/date';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nconst Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-order-confirmation-summary',\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t
          \n\t\t\t\t\t
        • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Order number:', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t123\n\t\t\t\t\t\t\n\t\t\t\t\t
        • \n\t\t\t\t\t
        • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Date:', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ date(\n\t\t\t\t\t\t\t\tgetSetting( 'dateFormat' ),\n\t\t\t\t\t\t\t\tnew Date(),\n\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        • \n\t\t\t\t\t
        • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Total:', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ formatPrice( 4000 ) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        • \n\t\t\t\t\t
        • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Email:', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ttest@test.com\n\t\t\t\t\t\t\n\t\t\t\t\t
        • \n\t\t\t\t\t
        • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Payment method:', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Credit Card', 'woocommerce' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t
        • \n\t\t\t\t
        \n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for A single column within a columns block. that allows users to configure: vertical alignment, width, template lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/column/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/column\",\n\t\"title\": \"Column\",\n\t\"category\": \"design\",\n\t\"parent\": [ \"core/columns\" ],\n\t\"description\": \"A single column within a columns block.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"verticalAlignment\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ]\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"__experimentalOnEnter\": true,\n\t\t\"anchor\": true,\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"button\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": true,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"allowedBlocks\": true\n\t}\n}\n\n\n// File: packages/block-library/src/column/index.js\n/**\n * WordPress dependencies\n */\nimport { column as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/column/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { verticalAlignment, width } = attributes;\n\n\tconst wrapperClasses = clsx( {\n\t\t[ `is-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t} );\n\n\tlet style;\n\n\tif ( width && /\\d/.test( width ) ) {\n\t\t// Numbers are handled for backward compatibility as they can be still provided with templates.\n\t\tlet flexBasis = Number.isFinite( width ) ? width + '%' : width;\n\t\t// In some cases we need to round the width to a shorter float.\n\t\tif ( ! Number.isFinite( width ) && width?.endsWith( '%' ) ) {\n\t\t\tconst multiplier = 1000000000000;\n\t\t\t// Shrink the number back to a reasonable float.\n\t\t\tflexBasis =\n\t\t\t\tMath.round( Number.parseFloat( width ) * multiplier ) /\n\t\t\t\t\tmultiplier +\n\t\t\t\t'%';\n\t\t}\n\t\tstyle = { flexBasis };\n\t}\n\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: wrapperClasses,\n\t\tstyle,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a customizable WooCommerce block that allows users to adjust text alignment settings with ease."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-form/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-review-form\",\n\t\"title\": \"Reviews Form\",\n\t\"category\": \"woocommerce\",\n\t\"description\": \"Display a product's reviews form.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"textAlign\": \"center\"\n\t\t}\n\t},\n\t\"viewScriptModule\": \"woocommerce/product-review-form\",\n\t\"style\": \"file:../woocommerce/product-review-form-style.css\",\n\t\"editorStyle\": \"file:../woocommerce/product-review-form-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-form/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport type { BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from './form';\n\nexport default function PostCommentsFormEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n}: BlockEditProps< {\n\ttextAlign: string;\n} > & {\n\tcontext: { postId: string; postType: string };\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst instanceId = useInstanceId( PostCommentsFormEdit );\n\tconst instanceIdDesc = sprintf( 'comments-form-edit-%d-desc', instanceId );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'comment-respond', {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t\t'aria-describedby': instanceIdDesc,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Reviews form disabled in editor.', 'woocommerce' ) }\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Add a link to a downloadable file. with these attributes: id, blob, href, and 8 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/file/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/file\",\n\t\"title\": \"File\",\n\t\"category\": \"media\",\n\t\"description\": \"Add a link to a downloadable file.\",\n\t\"keywords\": [ \"document\", \"pdf\", \"download\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"id\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"blob\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"local\"\n\t\t},\n\t\t\"href\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"fileId\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a:not([download])\",\n\t\t\t\"attribute\": \"id\"\n\t\t},\n\t\t\"fileName\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"a:not([download])\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"textLinkHref\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a:not([download])\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"textLinkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a:not([download])\",\n\t\t\t\"attribute\": \"target\"\n\t\t},\n\t\t\"showDownloadButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"downloadButtonText\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"a[download]\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"displayPreview\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"previewHeight\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 600\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": true\n\t},\n\t\"editorStyle\": \"wp-block-file-editor\",\n\t\"style\": \"wp-block-file\"\n}\n\n\n// File: packages/block-library/src/file/index.js\n/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thref: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t\tfileName: _x( 'Armstrong_Small_Step', 'Name of the file' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'file',\n\t\t\tlabel: __( 'File' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'href',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'fileName',\n\t\t\tlabel: __( 'Filename' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'downloadButtonText',\n\t\t\tlabel: __( 'Button Text' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'file' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/file/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\thref,\n\t\tfileId,\n\t\tfileName,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\n\tconst pdfEmbedLabel = RichText.isEmpty( fileName )\n\t\t? 'PDF embed'\n\t\t: // To do: use toPlainText, but we need ensure it's RichTextData. See\n\t\t // https://github.com/WordPress/gutenberg/pull/56710.\n\t\t fileName.toString();\n\n\tconst hasFilename = ! RichText.isEmpty( fileName );\n\n\t// Only output an `aria-describedby` when the element it's referring to is\n\t// actually rendered.\n\tconst describedById = hasFilename ? fileId : undefined;\n\n\treturn (\n\t\thref && (\n\t\t\t
        \n\t\t\t\t{ displayPreview && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\t{ hasFilename && (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
        \n\t\t)\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom Gutenberg block that enables users to create an interactive set of call-to-action buttons for engaging website visitors."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/buttons/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/buttons\",\n\t\"title\": \"Buttons\",\n\t\"category\": \"design\",\n\t\"allowedBlocks\": [ \"core/button\" ],\n\t\"description\": \"Prompt visitors to take action with a group of button-style links.\",\n\t\"keywords\": [ \"link\" ],\n\t\"textdomain\": \"default\",\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"__experimentalExposeControlsToChildren\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"contentRole\": true\n\t},\n\t\"editorStyle\": \"wp-block-buttons-editor\",\n\t\"style\": \"wp-block-buttons\"\n}\n\n\n// File: packages/block-library/src/buttons/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { buttons as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport transforms from './transforms';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/button',\n\t\t\t\tattributes: { text: __( 'Find out more' ) },\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/button',\n\t\t\t\tattributes: { text: __( 'Contact us' ) },\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/buttons/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst { fontSize, style } = attributes;\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx( className, {\n\t\t\t'has-custom-font-size': fontSize || style?.typography?.fontSize,\n\t\t} ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a widget block that allows dynamic parent page selection and supports nested configuration."}, {"role": "assistant", "content": "// File: packages/block-library/src/page-list/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/page-list\",\n\t\"title\": \"Page List\",\n\t\"category\": \"widgets\",\n\t\"allowedBlocks\": [ \"core/page-list-item\" ],\n\t\"description\": \"Display a list of all pages.\",\n\t\"keywords\": [ \"menu\", \"navigation\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"parentPageID\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"isNested\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [\n\t\t\"textColor\",\n\t\t\"customTextColor\",\n\t\t\"backgroundColor\",\n\t\t\"customBackgroundColor\",\n\t\t\"overlayTextColor\",\n\t\t\"customOverlayTextColor\",\n\t\t\"overlayBackgroundColor\",\n\t\t\"customOverlayBackgroundColor\",\n\t\t\"fontSize\",\n\t\t\"customFontSize\",\n\t\t\"showSubmenuIcon\",\n\t\t\"style\",\n\t\t\"openSubmenusOnClick\"\n\t],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"margin\": false\n\t\t\t}\n\t\t},\n\t\t\"contentRole\": true\n\t},\n\t\"editorStyle\": \"wp-block-page-list-editor\",\n\t\"style\": \"wp-block-page-list\"\n}\n\n\n// File: packages/block-library/src/page-list/index.js\n/**\n * WordPress dependencies\n */\nimport { pages } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit.js';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: pages,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json\n{\n\t\"name\": \"woocommerce/empty-mini-cart-contents-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Empty Mini-Cart view\",\n\t\"description\": \"Blocks that are displayed when the Mini-Cart is empty.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/mini-cart-contents\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { useEditorContext } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport { getMiniCartAllowedBlocks } from '../allowed-blocks';\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { currentView } = useEditorContext();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that implements a pagination control displaying sequential page indicators, incorporating a mid-size range parameter."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/query-pagination-numbers/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-pagination-numbers\",\n\t\"title\": \"Page Numbers\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/query-pagination\" ],\n\t\"description\": \"Displays a list of page numbers for pagination.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"midSize\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t}\n\t},\n\t\"usesContext\": [ \"queryId\", \"query\", \"enhancedPagination\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-query-pagination-numbers-editor\"\n}\n\n\n// File: packages/block-library/src/query-pagination-numbers/index.js\n/**\n * WordPress dependencies\n */\nimport { queryPaginationNumbers as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable class name, lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-taxes-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Taxes\",\n\t\"description\": \"Shows the cart taxes row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { getSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t\tshowRateAfterTaxName: boolean;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className, showRateAfterTaxName } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst taxesEnabled = getSetting( 'taxesEnabled' ) as boolean;\n\tconst displayItemizedTaxes = getSetting(\n\t\t'displayItemizedTaxes',\n\t\tfalse\n\t) as boolean;\n\tconst displayCartPricesIncludingTax = getSetting(\n\t\t'displayCartPricesIncludingTax',\n\t\tfalse\n\t) as boolean;\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t{ taxesEnabled &&\n\t\t\t\t\tdisplayItemizedTaxes &&\n\t\t\t\t\t! displayCartPricesIncludingTax && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowRateAfterTaxName:\n\t\t\t\t\t\t\t\t\t\t\t! showRateAfterTaxName,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block displaying a keyword tag cloud with customizable parameters like tag quantity, taxonomy selection, count visibility, and additional configurable options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/tag-cloud/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/tag-cloud\",\n\t\"title\": \"Tag Cloud\",\n\t\"category\": \"widgets\",\n\t\"description\": \"A cloud of popular keywords, each sized by how often it appears.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"numberOfTags\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 45,\n\t\t\t\"minimum\": 1,\n\t\t\t\"maximum\": 100\n\t\t},\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"post_tag\"\n\t\t},\n\t\t\"showTagCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"smallestFontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"8pt\"\n\t\t},\n\t\t\"largestFontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"22pt\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{ \"name\": \"default\", \"label\": \"Default\", \"isDefault\": true },\n\t\t{ \"name\": \"outline\", \"label\": \"Outline\" }\n\t],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-tag-cloud-editor\"\n}\n\n\n// File: packages/block-library/src/tag-cloud/index.js\n/**\n * WordPress dependencies\n */\nimport { tag as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport transforms from './transforms';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a text block with customizable content, drop cap, placeholder, direction"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/paragraph/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/paragraph\",\n\t\"title\": \"Paragraph\",\n\t\"category\": \"text\",\n\t\"description\": \"Start with the basic building block of all narrative.\",\n\t\"keywords\": [ \"text\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"p\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"dropCap\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"direction\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"ltr\", \"rtl\" ]\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"splitting\": true,\n\t\t\"anchor\": true,\n\t\t\"className\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"textAlign\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"fitText\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalSelector\": \"p\",\n\t\t\"__unstablePasteTextInline\": true,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-paragraph-editor\",\n\t\"style\": \"wp-block-paragraph\"\n}\n\n\n// File: packages/block-library/src/paragraph/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __(\n\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tif ( customName ) {\n\t\t\t\treturn customName;\n\t\t\t}\n\n\t\t\tconst { content } = attributes;\n\t\t\treturn ! content || content.length === 0 ? __( 'Empty' ) : content;\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/paragraph/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { isRTL } from '@wordpress/i18n';\n\nexport default function save( { attributes } ) {\n\tconst { content, dropCap, direction, style } = attributes;\n\tconst textAlign = style?.typography?.textAlign;\n\tconst className = clsx( {\n\t\t'has-drop-cap':\n\t\t\ttextAlign === ( isRTL() ? 'left' : 'right' ) ||\n\t\t\ttextAlign === 'center'\n\t\t\t\t? false\n\t\t\t\t: dropCap,\n\t} );\n\n\treturn (\n\t\t

        \n\t\t\t\n\t\t

        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Contains blocks that display the content of the Mini-Cart. that allows users to configure: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json\n{\n\t\"name\": \"woocommerce/filled-mini-cart-contents-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Filled Mini-Cart view\",\n\t\"description\": \"Contains blocks that display the content of the Mini-Cart.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/mini-cart-contents\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { EditorProvider, useEditorContext } from '@woocommerce/base-context';\nimport { previewCart } from '@woocommerce/resource-previews';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../../cart-checkout-shared';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.FILLED_MINI_CART );\n\tconst { currentView } = useEditorContext();\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/mini-cart-title-block', {} ],\n\t\t[ 'woocommerce/mini-cart-items-block', {} ],\n\t\t[ 'woocommerce/mini-cart-footer-block', {} ],\n\t].filter( Boolean ) as unknown as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a Gutenberg block for generating dynamic breadcrumb trails that supports flexible settings including taxonomy selection, path separator, home page link, and two extra customization options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/breadcrumbs/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/breadcrumbs\",\n\t\"title\": \"Breadcrumbs\",\n\t\"__experimental\": true,\n\t\"category\": \"theme\",\n\t\"description\": \"Display a breadcrumb trail for hierarchical post types or based on taxonomy terms.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"prefersTaxonomy\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"separator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"/\"\n\t\t},\n\t\t\"showHomeItem\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showCurrentItem\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showOnHomePage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\", \"templateSlug\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": false,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-breadcrumbs\"\n}\n\n\n// File: packages/block-library/src/breadcrumbs/index.js\n/**\n * WordPress dependencies\n */\nimport { breadcrumbs } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: breadcrumbs,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a custom WordPress block that renders a real-time Instagram feed preview, allowing configuration through an access token, specified user profile, column arrangement, and three supplementary display options."}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/instagram-gallery\",\n\t\"title\": \"Latest Instagram Posts\",\n\t\"description\": \"Display an automatically updating list of the latest posts from your Instagram feed.\",\n\t\"keywords\": [ \"images\", \"photos\", \"pictures\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": { \"align\": true, \"html\": false },\n\t\"attributes\": {\n\t\t\"accessToken\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"instagramUser\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3,\n\t\t\t\"min\": 1,\n\t\t\t\"max\": 6\n\t\t},\n\t\t\"count\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 9,\n\t\t\t\"min\": 1,\n\t\t\t\"max\": 30\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 10,\n\t\t\t\"min\": 0,\n\t\t\t\"max\": 50\n\t\t},\n\t\t\"isStackedOnMobile\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/edit.js\nimport { isCurrentUserConnected } from '@automattic/jetpack-shared-extension-utils';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { Button, Placeholder, RadioControl, Spinner, withNotices } from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { isEmpty, isEqual } from 'lodash';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\nimport { NEW_INSTAGRAM_CONNECTION } from './constants';\nimport InstagramGalleryInspectorControls from './controls';\nimport ImageTransition from './image-transition';\nimport useConnectInstagram from './use-connect-instagram';\nimport useConnectWpcom from './use-connect-wpcom';\nimport useInstagramGallery from './use-instagram-gallery';\nimport './editor.scss';\n\nconst InstagramGalleryEdit = props => {\n\tconst blockProps = useBlockProps();\n\tconst { attributes, isSelected, noticeOperations, noticeUI, setAttributes } = props;\n\tconst { accessToken, align, columns, count, isStackedOnMobile, spacing } = attributes;\n\tuseEffect( () => {\n\t\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\t\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\t\tsetAttributes( validatedAttributes );\n\t\t}\n\t}, [ attributes, setAttributes ] );\n\n\tconst [ selectedAccount, setSelectedAccount ] = useState( accessToken );\n\tconst { isRequestingWpcomConnectUrl, wpcomConnectUrl } = useConnectWpcom();\n\tconst { images, isLoadingGallery, setImages } = useInstagramGallery( {\n\t\taccessToken,\n\t\tnoticeOperations,\n\t\tsetAttributes,\n\t\tsetSelectedAccount,\n\t} );\n\tconst {\n\t\tconnectToService,\n\t\tdisconnectFromService,\n\t\tisConnecting,\n\t\tisRequestingUserConnections,\n\t\tuserConnections,\n\t} = useConnectInstagram( {\n\t\taccessToken,\n\t\tnoticeOperations,\n\t\tselectedAccount,\n\t\tsetAttributes,\n\t\tsetImages,\n\t\tsetSelectedAccount,\n\t} );\n\n\tconst currentUserConnected = isCurrentUserConnected();\n\tconst unselectedCount = count > images.length ? images.length : count;\n\n\tconst showPlaceholder = ! isLoadingGallery && ( ! accessToken || isEmpty( images ) );\n\tconst showSidebar = ! showPlaceholder;\n\tconst showLoadingSpinner = accessToken && isLoadingGallery && isEmpty( images );\n\tconst showGallery = ! showPlaceholder && ! showLoadingSpinner;\n\n\tconst blockClasses = clsx( blockProps.className, { [ `align${ align }` ]: align } );\n\tconst gridClasses = clsx(\n\t\t'wp-block-jetpack-instagram-gallery__grid',\n\t\t`wp-block-jetpack-instagram-gallery__grid-columns-${ columns }`,\n\t\t{ 'is-stacked-on-mobile': isStackedOnMobile }\n\t);\n\tconst gridStyle = {\n\t\tgridGap: spacing,\n\t\t// Used to only apply padding when stacked in mobile viewport.\n\t\t[ `--latest-instagram-posts-spacing` ]: spacing ? `${ spacing }px` : undefined,\n\t};\n\tconst photoStyle = { padding: spacing }; // Needed so the updates to the grid gap render when changed.\n\n\tconst shouldRenderSidebarNotice = () =>\n\t\tshowSidebar && ! showLoadingSpinner && images.length < count;\n\n\tconst renderImage = index => {\n\t\tif ( images[ index ] ) {\n\t\t\tconst image = images[ index ];\n\t\t\treturn (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t\n\t\t);\n\t};\n\n\tconst connectBlockToInstagram = () => {\n\t\tif ( selectedAccount && NEW_INSTAGRAM_CONNECTION !== selectedAccount ) {\n\t\t\tsetAttributes( {\n\t\t\t\taccessToken: selectedAccount,\n\t\t\t\tinstagramUser: userConnections.find( v => v.token === selectedAccount ).username,\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\t\tconnectToService();\n\t};\n\n\tconst renderPlaceholderInstructions = () => {\n\t\tif ( ! currentUserConnected ) {\n\t\t\treturn __( \"First, you'll need to connect your WordPress.com account.\", 'jetpack' );\n\t\t}\n\t\tif ( ! isRequestingUserConnections && ! userConnections.length ) {\n\t\t\treturn __( 'Connect to Instagram to start sharing your images.', 'jetpack' );\n\t\t}\n\t};\n\n\tconst renderInstagramConnection = () => {\n\t\tconst hasUserConnections = userConnections.length > 0;\n\t\tconst radioOptions = [\n\t\t\t...userConnections.map( connection => ( {\n\t\t\t\tlabel: `@${ connection.username }`,\n\t\t\t\tvalue: connection.token,\n\t\t\t} ) ),\n\t\t\t{\n\t\t\t\tlabel: __( 'Add a new account', 'jetpack' ),\n\t\t\t\tvalue: NEW_INSTAGRAM_CONNECTION,\n\t\t\t},\n\t\t];\n\t\tconst isButtonDisabled =\n\t\t\tisConnecting || isRequestingUserConnections || ( hasUserConnections && ! selectedAccount );\n\n\t\treturn (\n\t\t\t
        \n\t\t\t\t{ hasUserConnections && (\n\t\t\t\t\t setSelectedAccount( value ) }\n\t\t\t\t\t\toptions={ radioOptions }\n\t\t\t\t\t\tselected={ selectedAccount }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ NEW_INSTAGRAM_CONNECTION === selectedAccount && (\n\t\t\t\t\t

        \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If you are currently logged in to Instagram on this device, you might need to log out of it first.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

        \n\t\t\t\t) }\n\t\t\t\t\n\t\t\t
        \n\t\t);\n\t};\n\n\treturn (\n\t\t
        \n\t\t\t{ showPlaceholder && (\n\t\t\t\t\n\t\t\t\t\t{ currentUserConnected ? (\n\t\t\t\t\t\trenderInstagramConnection()\n\t\t\t\t\t) : (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Connect to WordPress.com', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t) }\n\n\t\t\t{ showLoadingSpinner && (\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t\t

        { __( 'Embedding…', 'jetpack' ) }

        \n\t\t\t\t
        \n\t\t\t) }\n\n\t\t\t{ showGallery && (\n\t\t\t\t
        \n\t\t\t\t\t{ Array.from( Array( isSelected ? count : unselectedCount ), ( _, index ) => (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ renderImage( index ) }\n\t\t\t\t\t\t\n\t\t\t\t\t) ) }\n\t\t\t\t
        \n\t\t\t) }\n\n\t\t\t{ showSidebar && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n};\n\nexport default withNotices( InstagramGalleryEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/instagram-gallery/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default ( { attributes: { instagramUser } } ) => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\tinstagramUser && (\n\t\t\t
        \n\t\t\t\t{ `https://www.instagram.com/${ instagramUser }/` }\n\t\t\t
        \n\t\t)\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress theme block that allows flexible text alignment configurations."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-description/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-description\",\n\t\"title\": \"Term Description\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display the description of categories, tags and custom taxonomies when viewing an archive.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termId\", \"taxonomy\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/term-description/index.js\n/**\n * WordPress dependencies\n */\nimport { termDescription as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a custom block for presenting order cost components, with configurable styling and lock options for enhanced user control."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-totals/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-totals-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Totals\",\n\t\"description\": \"Shows the subtotal, fees, discounts, shipping and taxes.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-totals/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst allowedBlocks = getAllowedBlocks(\n\t\tinnerBlockAreas.CHECKOUT_ORDER_SUMMARY_TOTALS\n\t);\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-order-summary-subtotal-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-fee-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-discount-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-shipping-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-taxes-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Block that displays the cart button when the Mini-Cart has products. with these attributes: lock, cart button label"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-cart-button-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-cart-button-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart View Cart Button\",\n\t\"description\": \"Block that displays the cart button when the Mini-Cart has products.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": false,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t},\n\t\t\"cartButtonLabel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"fill\",\n\t\t\t\"label\": \"Fill\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"outline\",\n\t\t\t\"label\": \"Outline\",\n\t\t\t\"isDefault\": true\n\t\t}\n\t],\n\t\"parent\": [ \"woocommerce/mini-cart-footer-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-cart-button-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport EditableButton from '@woocommerce/editor-components/editable-button';\n\n/**\n * Internal dependencies\n */\nimport { defaultCartButtonLabel } from './constants';\nimport { getVariant } from '../utils';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tcartButtonLabel: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-mini-cart__footer-cart',\n\t} );\n\tconst { cartButtonLabel } = attributes;\n\n\treturn (\n\t\t
        \n\t\t\t {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tcartButtonLabel: content,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tstyle={ blockProps.style }\n\t\t\t/>\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block for showcasing the primary product image, incorporating configurable attributes like product link visibility, sale badge display, badge alignment, and additional customization settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/image/block.json\n{\n\t\"name\": \"woocommerce/product-image\",\n\t\"title\": \"Product Image\",\n\t\"description\": \"Display the main product image.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"showProductLink\": { \"type\": \"boolean\", \"default\": true },\n\t\t\"showSaleBadge\": { \"type\": \"boolean\", \"default\": true },\n\t\t\"saleBadgeAlign\": { \"type\": \"string\", \"default\": \"right\" },\n\t\t\"imageSizing\": { \"type\": \"string\", \"default\": \"single\" },\n\t\t\"productId\": { \"type\": \"number\", \"default\": 0 },\n\t\t\"isDescendentOfQueryLoop\": { \"type\": \"boolean\", \"default\": false },\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"width\": { \"type\": \"string\" },\n\t\t\"height\": { \"type\": \"string\" },\n\t\t\"scale\": { \"type\": \"string\", \"default\": \"cover\" },\n\t\t\"aspectRatio\": { \"type\": \"string\" }\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"aspectRatio\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"email\": true,\n\t\t\"__experimentalSelector\": \".wc-block-components-product-image\"\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"usesContext\": [ \"imageId\", \"postId\", \"query\", \"queryId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/image/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { getAdminLink, getSettingWithCoercion } from '@woocommerce/settings';\nimport { useProduct } from '@woocommerce/entities';\nimport { isBoolean } from '@woocommerce/types';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\nimport {\n\tPanelBody,\n\tToggleControl,\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - Ignoring because `__experimentalToggleGroupControl` is not yet in the type definitions.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - Ignoring because `__experimentalToggleGroupControl` is not yet in the type definitions.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { useIsDescendentOfSingleProductBlock } from '../shared/use-is-descendent-of-single-product-block';\nimport { BlockAttributes, ImageSizing } from './types';\nimport { ImageSizeSettings } from './image-size-settings';\n\nconst TEMPLATE = [\n\t[\n\t\t'woocommerce/product-sale-badge',\n\t\t{\n\t\t\talign: 'right',\n\t\t},\n\t],\n];\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n\tclientId,\n}: BlockEditProps< BlockAttributes > & { context: Context } ): JSX.Element => {\n\tconst { showProductLink, imageSizing, width, height, scale } = attributes;\n\n\tconst ref = useRef< HTMLDivElement >( null );\n\n\tconst blockProps = useBlockProps();\n\tconst { wasBlockJustInserted, isInProductGallery } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\twasBlockJustInserted:\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t\t// @ts-expect-error method exists but not typed\n\t\t\t\t\tselect( blockEditorStore ).wasBlockJustInserted( clientId ),\n\t\t\t\tisInProductGallery:\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t\t// @ts-expect-error method exists but not typed\n\t\t\t\t\tselect( blockEditorStore ).getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'woocommerce/product-gallery'\n\t\t\t\t\t).length > 0,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\tconst { isDescendentOfSingleProductBlock } =\n\t\tuseIsDescendentOfSingleProductBlock( {\n\t\t\tblockClientId: blockProps?.id,\n\t\t} );\n\n\tuseEffect( () => {\n\t\tif ( isDescendentOfQueryLoop || isDescendentOfSingleProductBlock ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisDescendentOfQueryLoop,\n\t\t\t\tisDescendentOfSingleProductBlock,\n\t\t\t\tshowSaleBadge: false,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( {\n\t\t\t\tisDescendentOfQueryLoop,\n\t\t\t\tisDescendentOfSingleProductBlock,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tisDescendentOfQueryLoop,\n\t\tisDescendentOfSingleProductBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst showAllControls =\n\t\tisDescendentOfQueryLoop || isDescendentOfSingleProductBlock;\n\n\tconst innerBlockProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wc-block-components-product-image__inner-container',\n\t\t},\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplate: wasBlockJustInserted ? TEMPLATE : undefined,\n\t\t}\n\t);\n\n\tconst isBlockTheme = getSettingWithCoercion(\n\t\t'isBlockTheme',\n\t\tfalse,\n\t\tisBoolean\n\t);\n\n\tconst { product, isResolving } = useProduct( context.postId );\n\n\treturn (\n\t\t
        \n\t\t\t{ /* Don't show controls in product gallery as we rely on\n\t\t\tcore supports API (aspect ratio setting) */ }\n\t\t\t{ showAllControls && ! isInProductGallery && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowProductLink: ! showProductLink,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\tCustomizer.',\n\t\t\t\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ imageSizing }\n\t\t\t\t\t\t\tonChange={ ( value: ImageSizing ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { imageSizing: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t{ showAllControls &&
        }\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a customizable column block within WordPress that presents cart items and provides locking configuration options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/block.json\n{\n\t\"name\": \"woocommerce/cart-items-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Cart Items\",\n\t\"description\": \"Column containing cart items.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/filled-cart-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { Main } from '@woocommerce/base-components/sidebar-layout';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport crossSells from '../../../product-collection/collections/cross-sells';\n\ninterface Props {\n\tclientId: string;\n}\n\nexport const Edit = ( { clientId }: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps( { className: 'wc-block-cart__main' } );\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.CART_ITEMS );\n\t// Product collection is used for the Cross-Sells block.\n\t// We don't want to set a parent on the product collection block\n\t// so we add it here manually.\n\tallowedBlocks.push( 'woocommerce/product-collection' );\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/cart-line-items-block', {}, [] ],\n\t\t[\n\t\t\t'woocommerce/product-collection',\n\t\t\t{\n\t\t\t\t...crossSells.attributes,\n\t\t\t\tdisplayLayout: {\n\t\t\t\t\t...crossSells.attributes.displayLayout,\n\t\t\t\t\tcolumns: 3,\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\t...crossSells.attributes.query,\n\t\t\t\t\tperPage: 3,\n\t\t\t\t},\n\t\t\t\tcollection: 'woocommerce/product-collection/cross-sells',\n\t\t\t},\n\t\t\tcrossSells.innerBlocks,\n\t\t],\n\t] as unknown as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a dynamic WordPress block that allows for customizable referencing and content editing to enhance template reusability."}, {"role": "assistant", "content": "// File: packages/block-library/src/block/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/block\",\n\t\"title\": \"Pattern\",\n\t\"category\": \"reusable\",\n\t\"description\": \"Reuse this design across your site.\",\n\t\"keywords\": [ \"reusable\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"ref\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"content\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"pattern/overrides\": \"content\"\n\t},\n\t\"supports\": {\n\t\t\"customClassName\": false,\n\t\t\"html\": false,\n\t\t\"inserter\": false,\n\t\t\"renaming\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/block/index.js\n/**\n * WordPress dependencies\n */\nimport { symbol as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tdeprecated,\n\tedit,\n\ticon,\n\t__experimentalLabel: ( { ref } ) => {\n\t\tif ( ! ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst entity = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_block',\n\t\t\tref\n\t\t);\n\t\tif ( ! entity?.title ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn decodeEntities( entity.title );\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a block component that renders a list-based representation of child products in the Grouped Product Selector functionality."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-grouped-product-item\",\n\t\"title\": \"Grouped Product: Template (Beta)\",\n\t\"description\": \"A list item template that represents a child product within the Grouped Product Selector block.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/add-to-cart-with-options-grouped-product-selector\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"supports\": {\n\t\t\"inserter\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-grouped-product-item-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/edit.tsx\n/**\n * External dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport { BlockInstance, type BlockEditProps } from '@wordpress/blocks';\nimport { withProduct } from '@woocommerce/block-hocs';\nimport {\n\tInnerBlockLayoutContextProvider,\n\tProductDataContextProvider,\n\tuseProductDataContext,\n} from '@woocommerce/shared-context';\nimport { resolveSelect, useSelect } from '@wordpress/data';\nimport type { ProductResponseItem } from '@woocommerce/types';\nimport { productsStore } from '@woocommerce/data';\nimport { isProductResponseItem } from '@woocommerce/entities';\nimport { Spinner } from '@wordpress/components';\nimport { previewProductResponseItems } from '@woocommerce/resource-previews';\n\ninterface Attributes {\n\tclassName?: string;\n}\n\ntype ProductItemWithContextProps = {\n\tattributes: { productId: number };\n\tisLoading?: boolean;\n\tproduct?: ProductResponseItem | null;\n\tblocks: BlockInstance[];\n\tisSelected: boolean;\n\tonSelect(): void;\n};\n\ntype ProductItemProps = {\n\tproduct: ProductResponseItem | null;\n\tblocks: BlockInstance[];\n\tisLoading: boolean;\n\tisSelected: boolean;\n\tonSelect(): void;\n};\n\nconst ProductItem = ( {\n\tproduct,\n\tblocks,\n\tisLoading,\n\tisSelected,\n\tonSelect,\n}: ProductItemProps ) => {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ role: 'listitem' },\n\t\t{ templateLock: 'insert' }\n\t);\n\n\treturn (\n\t\t\n\t\t\t{ isSelected ? (\n\t\t\t\t
        \n\t\t\t) : (\n\t\t\t\t
        \n\t\t\t\t\t {\n\t\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tonSelect();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t
        \n\t\t\t) }\n\t\t\n\t);\n};\n\nconst ProductItemWithContext = withProduct(\n\t( {\n\t\tattributes,\n\t\tisLoading = true,\n\t\tproduct = null,\n\t\tblocks,\n\t\tisSelected,\n\t\tonSelect,\n\t}: ProductItemWithContextProps ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n);\n\nexport default function ProductItemTemplateEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { clientId } = props;\n\tconst { className } = props.attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\n\tconst { product, isLoading } = useProductDataContext();\n\tconst [ isLoadingProducts, setIsLoadingProducts ] = useState( true );\n\tconst [ products, setProducts ] = useState< ProductResponseItem[] | null >(\n\t\tnull\n\t);\n\tconst productsLength = products?.length || 0;\n\n\tuseEffect( () => {\n\t\tconst fetchChildProducts = async ( groupedProductIds: number[] ) => {\n\t\t\tif ( ! groupedProductIds || groupedProductIds.length === 0 ) {\n\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresolveSelect( productsStore )\n\t\t\t\t.getProducts( {\n\t\t\t\t\tinclude: groupedProductIds,\n\t\t\t\t\tper_page: groupedProductIds.length,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t} )\n\t\t\t\t.then( ( fetchedProducts ) => {\n\t\t\t\t\tsetProducts( fetchedProducts );\n\t\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\t} );\n\t\t};\n\n\t\tif ( ! isLoading && product && productsLength === 0 ) {\n\t\t\tif ( isProductResponseItem( product ) ) {\n\t\t\t\tfetchChildProducts( product.grouped_products );\n\t\t\t} else {\n\t\t\t\t// If not editing a specific product, we are editing a template.\n\t\t\t\t// Fetch an existing grouped product so template can be edited.\n\t\t\t\tresolveSelect( productsStore )\n\t\t\t\t\t.getProducts( { type: 'grouped', per_page: 1 } )\n\t\t\t\t\t.then( ( groupedProduct ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgroupedProduct.length > 0 &&\n\t\t\t\t\t\t\tgroupedProduct[ 0 ]?.grouped_products?.length > 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfetchChildProducts(\n\t\t\t\t\t\t\t\tgroupedProduct[ 0 ].grouped_products\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If there are no grouped products, query for any three other products.\n\t\t\t\t\t\t\tresolveSelect( productsStore )\n\t\t\t\t\t\t\t\t.getProducts( {\n\t\t\t\t\t\t\t\t\tper_page: 3,\n\t\t\t\t\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.then( ( fetchedProducts ) => {\n\t\t\t\t\t\t\t\t\tif ( fetchedProducts.length > 0 ) {\n\t\t\t\t\t\t\t\t\t\tsetProducts( fetchedProducts );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetIsLoadingProducts( false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}, [ isLoading, product, productsLength ] );\n\n\tconst { blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\treturn { blocks: getBlocks( clientId ) };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ selectedProductItem, setSelectedProductItem ] =\n\t\tuseState< number >();\n\n\tif ( isLoading || isLoadingProducts ) {\n\t\treturn ;\n\t}\n\n\tconst productList = products\n\t\t? products?.map( ( productItem ) => (\n\t\t\t\t setSelectedProductItem( productItem.id ) }\n\t\t\t\t/>\n\t\t ) )\n\t\t: previewProductResponseItems?.map( ( productItem ) => (\n\t\t\t\t setSelectedProductItem( productItem.id ) }\n\t\t\t\t/>\n\t\t ) );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t
        { productList }
        \n\t\t\t
        \n\t\t
        \n\t);\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function ProductItemTemplateSave() {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\t...blockProps,\n\t\trole: 'listitem',\n\t} );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a custom block designed to render and showcase the active filtering criteria within the current view."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/active-filters/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-active\",\n\t\"title\": \"Active Filters\",\n\t\"description\": \"Display the currently active filters.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [ \"woocommerce/product-filters\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": false,\n\t\t\t\t\"radius\": false,\n\t\t\t\t\"style\": false,\n\t\t\t\t\"width\": false\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"blockGap\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [ \"activeFilters\" ],\n\t\"viewScriptModule\": \"woocommerce/product-filter-active\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/active-filters/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { InitialDisabled } from '../../components/initial-disabled';\nimport { EXCLUDED_BLOCKS } from '../../constants';\nimport { getAllowedBlocks } from '../../utils/get-allowed-blocks';\nimport { filtersPreview } from './constants';\n\nconst Edit = () => {\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps(\n\t\tuseBlockProps(),\n\t\t{\n\t\t\tallowedBlocks: getAllowedBlocks( EXCLUDED_BLOCKS ),\n\t\t\ttemplate: [\n\t\t\t\t[ 'woocommerce/product-filter-removable-chips' ],\n\t\t\t\t[ 'woocommerce/product-filter-clear-button' ],\n\t\t\t],\n\t\t}\n\t);\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ children }\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/active-filters/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst Save = () => {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays a heading that toggles the accordion panel. that allows users to configure: open by default, title, level, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/accordion-heading/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/accordion-heading\",\n\t\"title\": \"Accordion Heading\",\n\t\"category\": \"design\",\n\t\"description\": \"Displays a heading that toggles the accordion panel.\",\n\t\"parent\": [ \"core/accordion-item\" ],\n\t\"usesContext\": [\n\t\t\"core/accordion-icon-position\",\n\t\t\"core/accordion-show-icon\",\n\t\t\"core/accordion-heading-level\"\n\t],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"align\": false,\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t},\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalSelector\": \".wp-block-accordion-heading__toggle\"\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalSkipSerialization\": [\n\t\t\t\t\"textDecoration\",\n\t\t\t\t\"letterSpacing\"\n\t\t\t],\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"fontFamily\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"visibility\": false,\n\t\t\"lock\": false\n\t},\n\t\"selectors\": {\n\t\t\"typography\": {\n\t\t\t\"letterSpacing\": \".wp-block-accordion-heading .wp-block-accordion-heading__toggle-title\",\n\t\t\t\"textDecoration\": \".wp-block-accordion-heading .wp-block-accordion-heading__toggle-title\"\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"openByDefault\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \".wp-block-accordion-heading__toggle-title\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"iconPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"left\", \"right\" ],\n\t\t\t\"default\": \"right\"\n\t\t},\n\t\t\"showIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"textdomain\": \"default\"\n}\n\n\n// File: packages/block-library/src/accordion-heading/index.js\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport icon from './icon';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/accordion-heading/save.js\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\tRichText,\n\tgetTypographyClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { level, title, iconPosition, showIcon } = attributes;\n\tconst TagName = 'h' + ( level || 3 );\n\tconst typographyProps = getTypographyClassesAndStyles( attributes );\n\n\tconst blockProps = useBlockProps.save();\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t{ showIcon && iconPosition === 'left' && (\n\t\t\t\t\t\n\t\t\t\t\t\t+\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\t\n\t\t\t\t{ showIcon && iconPosition === 'right' && (\n\t\t\t\t\t\n\t\t\t\t\t\t+\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a WordPress block within the Gutenberg editor that enables checkout address input, featuring customizable class name and lock settings for flexible implementation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-fields-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Checkout Fields\",\n\t\"description\": \"Column containing checkout address fields.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { Main } from '@woocommerce/base-components/sidebar-layout';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useCheckoutBlockContext } from '../../context';\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport './style.scss';\nimport { AddressFieldControls } from '../../address-field-controls';\n\nexport const Edit = ( {\n\tclientId,\n\tattributes,\n}: {\n\tclientId: string;\n\tattributes: {\n\t\tclassName?: string;\n\t\tisPreview?: boolean;\n\t};\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-checkout__main', attributes?.className ),\n\t} );\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.CHECKOUT_FIELDS );\n\n\tconst { showFormStepNumbers } = useCheckoutBlockContext();\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-express-payment-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-contact-information-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-shipping-method-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-pickup-options-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-shipping-address-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-billing-address-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-shipping-methods-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-payment-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-additional-information-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-note-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-terms-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-actions-block', {}, [] ],\n\t].filter( Boolean ) as unknown as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Display a concise customer order overview block with configurable locking settings for user control."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Summary\",\n\t\"description\": \"Show customers a summary of their order.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { TotalsFooterItem } from '@woocommerce/base-components/cart-checkout';\nimport { getCurrencyFromPriceResponse } from '@woocommerce/price-format';\nimport { useStoreCart } from '@woocommerce/base-context/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useId, useState } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport clsx from 'clsx';\nimport { FormattedMonetaryAmount } from '@woocommerce/blocks-components';\nimport { useContainerWidthContext } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport { OrderMetaSlotFill } from './slotfills';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { cartTotals } = useStoreCart();\n\tconst totalsCurrency = getCurrencyFromPriceResponse( cartTotals );\n\tconst totalPrice = parseInt( cartTotals.total_price, 10 );\n\tconst allowedBlocks = getAllowedBlocks(\n\t\tinnerBlockAreas.CHECKOUT_ORDER_SUMMARY\n\t);\n\tconst { isLarge } = useContainerWidthContext();\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst ariaControlsId = useId();\n\n\tconst orderSummaryProps = ! isLarge\n\t\t? {\n\t\t\t\trole: 'button',\n\t\t\t\tonClick: () => setIsOpen( ! isOpen ),\n\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t'aria-controls': ariaControlsId,\n\t\t\t\ttabIndex: 0,\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tsetIsOpen( ! isOpen );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t }\n\t\t: {};\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-order-summary-cart-items-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-coupon-form-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-totals-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Order summary', 'woocommerce' ) }\n\t\t\t\t

        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t\t\n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a text block with customizable show content, summary, name, placeholder"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/details/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/details\",\n\t\"title\": \"Details\",\n\t\"category\": \"text\",\n\t\"description\": \"Hide and show additional content.\",\n\t\"keywords\": [ \"summary\", \"toggle\", \"disclosure\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"showContent\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"summary\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"summary\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"name\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"attribute\": \"name\",\n\t\t\t\"selector\": \".wp-block-details\"\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"__experimentalOnEnter\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowEditing\": false\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"allowedBlocks\": true\n\t},\n\t\"editorStyle\": \"wp-block-details-editor\",\n\t\"style\": \"wp-block-details\"\n}\n\n\n// File: packages/block-library/src/details/index.js\n/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: __( 'La Mancha' ),\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { summary } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasSummary = summary?.trim().length > 0;\n\n\t\t// In the list view, use the block's summary as the label.\n\t\t// If the summary is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasSummary ) ) {\n\t\t\treturn customName || summary;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasSummary\n\t\t\t\t? __( 'Details. Empty.' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: accessibility text; summary title. */\n\t\t\t\t\t\t__( 'Details. %s' ),\n\t\t\t\t\t\tsummary\n\t\t\t\t );\n\t\t}\n\t},\n\tsave,\n\tedit,\n\ttransforms,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'summary',\n\t\t\tlabel: __( 'Summary' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'summary' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/details/save.js\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps, InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { name, showContent } = attributes;\n\tconst summary = attributes.summary ? attributes.summary : 'Details';\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress theme block featuring flexible text configuration, including alignment, typography, labeling, and four additional customizable parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-navigation-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-navigation-link\",\n\t\"title\": \"Post Navigation Link\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the next or previous post link that is adjacent to the current post.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"next\"\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"linkLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"arrow\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"none\"\n\t\t},\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-navigation-link\"\n}\n\n\n// File: packages/block-library/src/post-navigation-link/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tvariations,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: __( 'Next post' ),\n\t\t\tarrow: 'arrow',\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom WordPress block enabling product filtering functionality with configurable preview settings for e-commerce page visitors."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-filters\",\n\t\"title\": \"Product Filters\",\n\t\"description\": \"Let shoppers filter products displayed on the page.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"enableContrastChecker\": false,\n\t\t\t\"button\": true\n\t\t},\n\t\t\"multiple\": true,\n\t\t\"inserter\": true,\n\t\t\"interactivity\": true,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\",\n\t\t\t\t\"orientation\": \"vertical\",\n\t\t\t\t\"flexWrap\": \"nowrap\",\n\t\t\t\t\"justifyContent\": \"stretch\"\n\t\t\t},\n\t\t\t\"allowEditing\": false\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": true\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"postId\", \"query\", \"queryId\" ],\n\t\"attributes\": {\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t}\n\t},\n\t\"viewScriptModule\": \"woocommerce/product-filters\",\n\t\"style\": \"file:../woocommerce/product-filters-style.css\",\n\t\"editorStyle\": \"file:../woocommerce/product-filters-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/edit.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { BlockEditProps, InnerBlockTemplate } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, close } from '@wordpress/icons';\nimport { useState } from '@wordpress/element';\nimport { filterThreeLines } from '@woocommerce/icons';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport { type BlockAttributes } from './types';\nimport { getProductFiltersCss } from './utils/get-product-filters-css';\n\nconst TEMPLATE: InnerBlockTemplate[] = [\n\t[\n\t\t'core/heading',\n\t\t{\n\t\t\tlevel: 2,\n\t\t\tcontent: __( 'Filters', 'woocommerce' ),\n\t\t\tstyle: {\n\t\t\t\tmargin: { top: '0', bottom: '0' },\n\t\t\t\tspacing: { margin: { top: '0', bottom: '0' } },\n\t\t\t},\n\t\t},\n\t],\n\t[ 'woocommerce/product-filter-active' ],\n\t[ 'woocommerce/product-filter-price' ],\n\t[ 'woocommerce/product-filter-rating' ],\n\t[ 'woocommerce/product-filter-attribute' ],\n\t[ 'woocommerce/product-filter-taxonomy' ],\n\t[ 'woocommerce/product-filter-status' ],\n];\n\nexport const Edit = ( props: BlockEditProps< BlockAttributes > ) => {\n\tconst { attributes } = props;\n\tconst { isPreview } = attributes;\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-product-filters', {\n\t\t\t'is-overlay-opened': isOpen,\n\t\t} ),\n\t\tstyle: getProductFiltersCss( attributes ),\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t{ isPreview ? (\n\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t
        \n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t setIsOpen( ! isOpen ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Filter products', 'woocommerce' ) }\n\t\t\t\t\t\n\n\t\t\t\t\t
        \n\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\t\t setIsOpen( ! isOpen ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Close', 'woocommerce' ) }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t\t\t setIsOpen( ! isOpen ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Apply', 'woocommerce' ) }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t\t
        \n\t\t\t\t\t\t
        \n\t\t\t\t\t
        \n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n};\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport { type BlockAttributes } from './types';\nimport { getProductFiltersCss } from './utils/get-product-filters-css';\n\nexport const Save = ( {\n\tattributes,\n}: {\n\tattributes: BlockAttributes;\n\tstyle: Record< string, string >;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx( 'wc-block-product-filters' ),\n\t\tstyle: getProductFiltersCss( attributes ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Content before this block will be shown in the excerpt on your archives page. with these attributes: custom text, no teaser"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/more/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/more\",\n\t\"title\": \"More\",\n\t\"category\": \"design\",\n\t\"description\": \"Content before this block will be shown in the excerpt on your archives page.\",\n\t\"keywords\": [ \"read more\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"customText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"noTeaser\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"customClassName\": false,\n\t\t\"className\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-more-editor\"\n}\n\n\n// File: packages/block-library/src/more/index.js\n/**\n * WordPress dependencies\n */\nimport { more as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn attributes.customText;\n\t\t}\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'customText',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'customText' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/more/save.js\n/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\n\nexport default function save( { attributes: { customText, noTeaser } } ) {\n\tconst moreTag = customText ? `` : '';\n\n\tconst noTeaserTag = noTeaser ? '' : '';\n\n\treturn (\n\t\t\n\t\t\t{ [ moreTag, noTeaserTag ].filter( Boolean ).join( '\\n' ) }\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Gather blocks in a layout container. that allows users to configure: tag name, template lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/group/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/group\",\n\t\"title\": \"Group\",\n\t\"category\": \"design\",\n\t\"description\": \"Gather blocks in a layout container.\",\n\t\"keywords\": [ \"container\", \"wrapper\", \"row\", \"section\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t},\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ]\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"__experimentalOnEnter\": true,\n\t\t\"__experimentalOnMerge\": true,\n\t\t\"__experimentalSettings\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"ariaLabel\": true,\n\t\t\"html\": false,\n\t\t\"background\": {\n\t\t\t\"backgroundImage\": true,\n\t\t\t\"backgroundSize\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"backgroundImage\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"button\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"minHeight\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"position\": {\n\t\t\t\"sticky\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSizingOnChildren\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"allowedBlocks\": true\n\t},\n\t\"editorStyle\": \"wp-block-group-editor\",\n\t\"style\": \"wp-block-group\"\n}\n\n\n// File: packages/block-library/src/group/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tlayout: {\n\t\t\t\ttype: 'constrained',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t},\n\t\t\tstyle: {\n\t\t\t\tspacing: {\n\t\t\t\t\tpadding: {\n\t\t\t\t\t\ttop: '4em',\n\t\t\t\t\t\tright: '3em',\n\t\t\t\t\t\tbottom: '4em',\n\t\t\t\t\t\tleft: '3em',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'La Mancha' ),\n\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\talign: 'center',\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/spacer',\n\t\t\t\tattributes: {\n\t\t\t\t\theight: '10px',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/button',\n\t\t\t\tattributes: {\n\t\t\t\t\ttext: __( 'Read more' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tviewportWidth: 600,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/group/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag } } ) {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block representing a singular list item, incorporating placeholder and content attributes for dynamic customization."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/list-item/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/list-item\",\n\t\"title\": \"List Item\",\n\t\"category\": \"text\",\n\t\"parent\": [ \"core/list\" ],\n\t\"allowedBlocks\": [ \"core/list\" ],\n\t\"description\": \"An individual item within a list.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"content\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"li\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"className\": false,\n\t\t\"splitting\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"background\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"root\": \".wp-block-list > li\",\n\t\t\"border\": \".wp-block-list:not(.wp-block-list .wp-block-list) > li\"\n\t}\n}\n\n\n// File: packages/block-library/src/list-item/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { listItem as icon } from '@wordpress/icons';\nimport { privateApis } from '@wordpress/block-editor';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tcontent: attributes.content + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\t[ unlock( privateApis ).requiresWrapperOnCopy ]: true,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/list-item/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t
      • \n\t\t\t\n\t\t\t\n\t\t
      • \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a custom Gutenberg block featuring an interactive checkout interface that allows customers to place orders, with options to toggle preview, adjust alignment, and display sequential form step indicators."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/block.json\n{\n\t\"name\": \"woocommerce/checkout\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Checkout\",\n\t\"description\": \"Display a checkout form so your customers can submit orders.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"align\": [\n\t\t\t\"wide\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"multiple\": false\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"isPreview\": true\n\t\t},\n\t\t\"viewportWidth\": 800\n\t},\n\t\"attributes\": {\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"save\": false\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"showFormStepNumbers\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';\nimport { CheckoutProvider, EditorProvider } from '@woocommerce/base-context';\nimport {\n\tpreviewCart,\n\tpreviewSavedPaymentMethods,\n} from '@woocommerce/resource-previews';\nimport { SlotFillProvider } from '@woocommerce/blocks-checkout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getQueryArg } from '@wordpress/url';\nimport { dispatch, select as selectData, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { defaultFields as defaultFieldsSetting } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport './inner-blocks';\nimport './styles/editor.scss';\nimport {\n\taddClassToBody,\n\tBlockSettings,\n\tuseBlockPropsWithLocking,\n} from '../cart-checkout-shared';\nimport '../cart-checkout-shared/sidebar-notices';\nimport { CheckoutBlockContext } from './context';\nimport type { Attributes } from './types';\n\n// This is adds a class to body to signal if the selected block is locked\naddClassToBody();\n\n// Array of allowed block names.\nconst ALLOWED_BLOCKS: string[] = [\n\t'woocommerce/checkout-fields-block',\n\t'woocommerce/checkout-totals-block',\n];\n\nexport const Edit = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n}: {\n\tclientId: string;\n\tattributes: Attributes;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => undefined;\n} ): JSX.Element => {\n\tconst {\n\t\tshowOrderNotes,\n\t\tshowPolicyLinks,\n\t\tshowReturnToCart,\n\t\tshowRateAfterTaxName,\n\t\tcartPageId,\n\t\tisPreview = false,\n\t\tshowFormStepNumbers = false,\n\t\thasDarkControls = false,\n\t} = attributes;\n\n\tconst fieldSettings = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore as unknown as string\n\t\t\t// @ts-expect-error getEditedEntityRecord is not typed in @wordpress/core-data yet.\n\t\t).getEditedEntityRecord( 'root', 'site' ) as Record< string, string >;\n\t}, [] );\n\n\tconst fieldsWithDefaults = {\n\t\tphone: 'optional',\n\t\tcompany: 'hidden',\n\t\taddress_2: 'optional',\n\t} as const;\n\n\tconst defaultFields = {\n\t\t...defaultFieldsSetting,\n\t\t...Object.fromEntries(\n\t\t\tObject.entries( fieldsWithDefaults ).map(\n\t\t\t\t( [ field, defaultValue ] ) => {\n\t\t\t\t\tconst value =\n\t\t\t\t\t\tfieldSettings[\n\t\t\t\t\t\t\t`woocommerce_checkout_${ field }_field`\n\t\t\t\t\t\t] || defaultValue;\n\t\t\t\t\treturn [\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultFieldsSetting[\n\t\t\t\t\t\t\t\tfield as keyof typeof defaultFieldsSetting\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\trequired: value === 'required',\n\t\t\t\t\t\t\thidden: value === 'hidden',\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t)\n\t\t),\n\t};\n\n\t// This focuses on the block when a certain query param is found. This is used on the link from the task list.\n\tconst focus = useRef( getQueryArg( window.location.href, 'focus' ) );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tfocus.current === 'checkout' &&\n\t\t\t! selectData( 'core/block-editor' ).hasSelectedBlock()\n\t\t) {\n\t\t\tdispatch( 'core/block-editor' ).selectBlock( clientId );\n\t\t\tdispatch( 'core/interface' ).enableComplementaryArea(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'edit-site/block-inspector'\n\t\t\t);\n\t\t}\n\t}, [ clientId ] );\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-totals-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-fields-block', {}, [] ],\n\t] as TemplateArray;\n\n\tconst blockProps = useBlockPropsWithLocking();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display the order confirmation shipping address. that allows users to configure: align"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/shipping-address/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-shipping-address\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping Address\",\n\t\"description\": \"Display the order confirmation shipping address.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"inserter\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"width\": true,\n\t\t\t\t\"color\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/shipping-address/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { AdditionalFieldsPlaceholder } from '@woocommerce/base-components/cart-checkout';\nimport { ADDRESS_FORM_FIELDS } from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nconst Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-order-confirmation-shipping-address',\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t
        \n\t\t\t\tTest address 1
        \n\t\t\t\tTest address 2
        \n\t\t\t\tSan Francisco, CA 94110\n\t\t\t\t
        \n\t\t\t\tUnited States\n\t\t\t\t\n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a new Gutenberg block specifically designed to render the cart discount row, implementing a class name and lock feature to support precise customization."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-discount-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Discount\",\n\t\"description\": \"Shows the cart discount row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a purpose-built WordPress block that facilitates product sales, service offerings, and donation collection through an integrated on-page solution."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/payments-intro/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/payments-intro\",\n\t\"title\": \"Payments\",\n\t\"description\": \"Sell products and services or receive donations on your website.\",\n\t\"keywords\": [ \"earn\", \"monetize\", \"paid\", \"pay\", \"money\", \"checkout\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"alignWide\": false,\n\t\t\"className\": true,\n\t\t\"customClassName\": false,\n\t\t\"html\": false,\n\t\t\"reusable\": false\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/payments-intro/edit.js\nimport { InnerBlocks, store as blockEditorStore, useBlockProps } from '@wordpress/block-editor';\nimport { cloneBlock, createBlock, getBlockType, registerBlockVariation } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport ConnectBanner from '../../shared/components/connect-banner';\nimport useIsUserConnected from '../../shared/use-is-user-connected';\nimport PaymentsIntroBlockPicker from './block-picker';\nimport PaymentsIntroPatternPicker from './pattern-picker';\nimport defaultVariations from './variations';\n\nexport default function JetpackPaymentsIntroEdit( { name, clientId } ) {\n\tconst patternFilter = pattern => pattern.categories?.includes( 'shop' );\n\n\tconst blockProps = useBlockProps();\n\tconst { blockType, hasInnerBlocks, hasPatterns, settings } = useSelect( select => {\n\t\tconst { getBlocks, __experimentalGetAllowedPatterns, getSettings } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tblockType: getBlockType( name ),\n\t\t\thasInnerBlocks: getBlocks( clientId )?.length > 0,\n\t\t\thasPatterns: __experimentalGetAllowedPatterns?.().filter( patternFilter ).length > 0,\n\t\t};\n\t} );\n\n\tconst isUserConnected = useIsUserConnected();\n\n\tconst { replaceBlock, selectBlock, updateSettings } = useDispatch( blockEditorStore );\n\n\tconst maybeMakeBlockVisible = useCallback(\n\t\tblockName => {\n\t\t\tconst isBlockAllowed =\n\t\t\t\tsettings?.allowedBlockTypes === true || settings?.allowedBlockTypes?.includes( blockName );\n\t\t\tif ( ! isBlockAllowed ) {\n\t\t\t\t// Add the block to the allowed block list before rendering\n\t\t\t\tupdateSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tallowedBlockTypes: [ ...settings.allowedBlockTypes, blockName ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ settings, updateSettings ]\n\t);\n\n\tconst setVariation = variation => {\n\t\tconst blockName = variation.name;\n\n\t\tmaybeMakeBlockVisible( blockName );\n\t\treplaceBlock( clientId, createBlock( blockName ) );\n\t\tselectBlock( clientId );\n\t};\n\n\tconst usableVariations = defaultVariations.filter( variation => getBlockType( variation.name ) );\n\n\tuseEffect( () => {\n\t\t// Populate default variation on older versions of WP or GB that don't support variations.\n\t\tif ( ! hasInnerBlocks && ! registerBlockVariation ) {\n\t\t\tsetVariation( usableVariations[ 0 ] );\n\t\t}\n\t} );\n\n\tconst displayVariations = usableVariations.length && registerBlockVariation;\n\n\tlet instructions = __( \"Please select which kind of payment you'd like to add.\", 'jetpack' );\n\tif ( hasPatterns ) {\n\t\tinstructions = __( 'Start by choosing one of our suggested layout patterns.', 'jetpack' );\n\t}\n\n\tlet content;\n\n\tif ( ! isUserConnected ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else if ( ! hasInnerBlocks && displayVariations ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t replaceBlock( clientId, blocks.map( cloneBlock ) ) }\n\t\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t

        { __( 'Or use one of our blocks to create your own.', 'jetpack' ) }

        \n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\t {\n\t\t\t\t\t\tsetVariation( nextVariation );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t);\n\t} else {\n\t\tcontent = ;\n\t}\n\n\treturn
        { content }
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays additional information provided by third-party extensions for the current order. that allows users to configure: align, class name"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/additional-information/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-additional-information\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Additional Information\",\n\t\"description\": \"Displays additional information provided by third-party extensions for the current order.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"width\": true,\n\t\t\t\t\"color\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/additional-information/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nconst Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-order-confirmation-additional-information',\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t
        \n\t\t\t\t{ __( 'Additional Information for your order', 'woocommerce' ) }\n\t\t\t
        \n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a versatile, modifiable block featuring a configurable reference and adaptable content for flexible implementation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/block/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/block\",\n\t\"title\": \"Pattern\",\n\t\"category\": \"reusable\",\n\t\"description\": \"Reuse this design across your site.\",\n\t\"keywords\": [ \"reusable\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"ref\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"content\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {}\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"pattern/overrides\": \"content\"\n\t},\n\t\"supports\": {\n\t\t\"customClassName\": false,\n\t\t\"html\": false,\n\t\t\"inserter\": false,\n\t\t\"renaming\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/block/index.js\n/**\n * WordPress dependencies\n */\nimport { symbol as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tdeprecated,\n\tedit,\n\ticon,\n\t__experimentalLabel: ( { ref } ) => {\n\t\tif ( ! ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst entity = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_block',\n\t\t\tref\n\t\t);\n\t\tif ( ! entity?.title ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn decodeEntities( entity.title );\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display multiple images in a rich gallery. that allows users to configure: images, ids, short code transforms, and 10 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/gallery/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/gallery\",\n\t\"title\": \"Gallery\",\n\t\"category\": \"media\",\n\t\"allowedBlocks\": [ \"core/image\" ],\n\t\"description\": \"Display multiple images in a rich gallery.\",\n\t\"keywords\": [ \"images\", \"photos\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"images\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [],\n\t\t\t\"source\": \"query\",\n\t\t\t\"selector\": \".blocks-gallery-item\",\n\t\t\t\"query\": {\n\t\t\t\t\"url\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"selector\": \"img\",\n\t\t\t\t\t\"attribute\": \"src\"\n\t\t\t\t},\n\t\t\t\t\"fullUrl\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"selector\": \"img\",\n\t\t\t\t\t\"attribute\": \"data-full-url\"\n\t\t\t\t},\n\t\t\t\t\"link\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"selector\": \"img\",\n\t\t\t\t\t\"attribute\": \"data-link\"\n\t\t\t\t},\n\t\t\t\t\"alt\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"selector\": \"img\",\n\t\t\t\t\t\"attribute\": \"alt\",\n\t\t\t\t\t\"default\": \"\"\n\t\t\t\t},\n\t\t\t\t\"id\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"selector\": \"img\",\n\t\t\t\t\t\"attribute\": \"data-id\"\n\t\t\t\t},\n\t\t\t\t\"caption\": {\n\t\t\t\t\t\"type\": \"rich-text\",\n\t\t\t\t\t\"source\": \"rich-text\",\n\t\t\t\t\t\"selector\": \".blocks-gallery-item__caption\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"ids\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"number\"\n\t\t\t},\n\t\t\t\"default\": []\n\t\t},\n\t\t\"shortCodeTransforms\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"object\"\n\t\t\t},\n\t\t\t\"default\": []\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"minimum\": 1,\n\t\t\t\"maximum\": 8\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \".blocks-gallery-caption\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"imageCrop\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"randomOrder\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"fixedHeight\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkTo\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"sizeSlug\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"large\"\n\t\t},\n\t\t\"allowResize\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"aspectRatio\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"auto\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"allowResize\": \"allowResize\",\n\t\t\"imageCrop\": \"imageCrop\",\n\t\t\"fixedHeight\": \"fixedHeight\"\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true\n\t\t\t}\n\t\t},\n\t\t\"html\": false,\n\t\t\"units\": [ \"px\", \"em\", \"rem\", \"vh\", \"vw\" ],\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"__experimentalSkipSerialization\": [ \"blockGap\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true,\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowEditing\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-gallery-editor\",\n\t\"style\": \"wp-block-gallery\"\n}\n\n\n// File: packages/block-library/src/gallery/index.js\n/**\n * WordPress dependencies\n */\nimport { gallery as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcolumns: 2,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/image',\n\t\t\t\tattributes: {\n\t\t\t\t\turl: 'https://s.w.org/images/core/5.3/Glacial_lakes%2C_Bhutan.jpg',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/image',\n\t\t\t\tattributes: {\n\t\t\t\t\turl: 'https://s.w.org/images/core/5.3/Sediment_off_the_Yucatan_Peninsula.jpg',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/gallery/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function saveWithInnerBlocks( { attributes } ) {\n\tconst { caption, columns, imageCrop } = attributes;\n\n\tconst className = clsx( 'has-nested-images', {\n\t\t[ `columns-${ columns }` ]: columns !== undefined,\n\t\t[ `columns-default` ]: columns === undefined,\n\t\t'is-cropped': imageCrop,\n\t} );\n\tconst blockProps = useBlockProps.save( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\treturn (\n\t\t
        \n\t\t\t{ innerBlocksProps.children }\n\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a bespoke Gutenberg block to display taxonomy term details, encompassing key elements such as term name, description, and additional attributes."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-template/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-template\",\n\t\"title\": \"Term Template\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/terms-query\" ],\n\t\"description\": \"Contains the block elements used to render a taxonomy term, like the name, description, and more.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termQuery\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"layout\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": {\n\t\t\t\t\"__experimentalDefault\": \"1.25em\"\n\t\t\t},\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"margin\": false\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-term-template\",\n\t\"editorStyle\": \"wp-block-term-template-editor\"\n}\n\n\n// File: packages/block-library/src/term-template/index.js\n/**\n * WordPress dependencies\n */\nimport { layout as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/term-template/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function TermTemplateSave() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Shows the apply coupon form. with these attributes: class name, lock"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-coupon-form/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-coupon-form-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Coupon Form\",\n\t\"description\": \"Shows the apply coupon form.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": false,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-coupon-form/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a block that Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-template/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-template\",\n\t\"title\": \"Post Template\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/query\" ],\n\t\"description\": \"Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [\n\t\t\"queryId\",\n\t\t\"query\",\n\t\t\"displayLayout\",\n\t\t\"templateSlug\",\n\t\t\"previewPostType\",\n\t\t\"enhancedPagination\",\n\t\t\"postType\"\n\t],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"layout\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": {\n\t\t\t\t\"__experimentalDefault\": \"1.25em\"\n\t\t\t},\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true,\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"margin\": false\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-template\",\n\t\"editorStyle\": \"wp-block-post-template-editor\"\n}\n\n\n// File: packages/block-library/src/post-template/index.js\n/**\n * WordPress dependencies\n */\nimport { layout } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: layout,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/post-template/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function PostTemplateSave() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that renders comment text with configurable alignment options within the Gutenberg editor."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-content/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-content\",\n\t\"title\": \"Comment Content\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays the contents of a comment.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t},\n\t\t\"html\": false\n\t},\n\t\"style\": \"wp-block-comment-content\"\n}\n\n\n// File: packages/block-library/src/comment-content/index.js\n/**\n * WordPress dependencies\n */\nimport { commentContent as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays a paginated navigation to next/previous set of comments, when applicable. with these attributes: pagination arrow"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comments-pagination/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments-pagination\",\n\t\"title\": \"Comments Pagination\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/comments\" ],\n\t\"allowedBlocks\": [\n\t\t\"core/comments-pagination-previous\",\n\t\t\"core/comments-pagination-numbers\",\n\t\t\"core/comments-pagination-next\"\n\t],\n\t\"description\": \"Displays a paginated navigation to next/previous set of comments, when applicable.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"paginationArrow\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"none\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"paginationArrow\": \"none\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"comments/paginationArrow\": \"paginationArrow\"\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-comments-pagination-editor\",\n\t\"style\": \"wp-block-comments-pagination\"\n}\n\n\n// File: packages/block-library/src/comments-pagination/index.js\n/**\n * WordPress dependencies\n */\nimport { queryPagination as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/comments-pagination/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Shows the cart shipping row. with these attributes: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-shipping-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping\",\n\t\"description\": \"Shows the cart shipping row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, ExternalLink } from '@wordpress/components';\nimport { ADMIN_URL } from '@woocommerce/settings';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\nimport { SHIPPING_ENABLED } from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t\tlock: {\n\t\t\tmove: boolean;\n\t\t\tremove: boolean;\n\t\t};\n\t};\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t{ !! SHIPPING_ENABLED && (\n\t\t\t\t\t\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Options that control shipping can be managed in your store settings.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

        \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Manage shipping options', 'woocommerce' ) }\n\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
        \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
        ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block designed to reveal specific content elements when items are present in the shopping cart, incorporating a lock attribute for controlled visibility."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/block.json\n{\n\t\"name\": \"woocommerce/filled-cart-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Filled Cart\",\n\t\"description\": \"Contains blocks that are displayed when the cart contains products.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": [\n\t\t\t\"wide\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { useEditorContext } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport './editor.scss';\nimport { useCartBlockContext } from '../../context';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { currentView } = useEditorContext();\n\tconst { hasDarkControls } = useCartBlockContext();\n\tconst allowedBlocks = getAllowedBlocks( innerBlockAreas.FILLED_CART );\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/cart-items-block', {}, [] ],\n\t\t[ 'woocommerce/cart-totals-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
        \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display a custom date. that allows users to configure: datetime, text align, format, is link"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-date/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-date\",\n\t\"title\": \"Date\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display a custom date.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"datetime\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"format\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\", \"queryId\" ],\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/post-date/index.js\n/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Collect one-time, monthly, or annually recurring donations. that allows users to configure: currency, one time donation, monthly donation, and 5 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/donations/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/donations\",\n\t\"title\": \"Donations Form\",\n\t\"description\": \"Collect one-time, monthly, or annually recurring donations.\",\n\t\"keywords\": [\n\t\t\"charity\",\n\t\t\"contribution\",\n\t\t\"credit card\",\n\t\t\"debit card\",\n\t\t\"donate\",\n\t\t\"earn\",\n\t\t\"monetize\",\n\t\t\"ecommerce\",\n\t\t\"fundraising\",\n\t\t\"fundraiser\",\n\t\t\"gofundme\",\n\t\t\"money\",\n\t\t\"nonprofit\",\n\t\t\"non-profit\",\n\t\t\"paid\",\n\t\t\"patreon\",\n\t\t\"pay\",\n\t\t\"payments\",\n\t\t\"recurring\",\n\t\t\"stripe\",\n\t\t\"sponsor\",\n\t\t\"square\",\n\t\t\"tipping\",\n\t\t\"venmo\"\n\t],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": { \"html\": false },\n\t\"attributes\": {\n\t\t\"currency\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"oneTimeDonation\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"show\": true,\n\t\t\t\t\"planId\": null,\n\t\t\t\t\"amounts\": [ 5, 15, 100 ]\n\t\t\t}\n\t\t},\n\t\t\"monthlyDonation\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"show\": true,\n\t\t\t\t\"planId\": null,\n\t\t\t\t\"amounts\": [ 5, 15, 100 ]\n\t\t\t}\n\t\t},\n\t\t\"annualDonation\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"show\": true,\n\t\t\t\t\"planId\": null,\n\t\t\t\t\"amounts\": [ 5, 15, 100 ]\n\t\t\t}\n\t\t},\n\t\t\"showCustomAmount\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"chooseAmountText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customAmountText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"fallbackLinkUrl\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/donations/edit.js\nimport { Spinner } from '@automattic/jetpack-components';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport ConnectBanner from '../../shared/components/connect-banner';\nimport { StripeNudge } from '../../shared/components/stripe-nudge';\nimport { SUPPORTED_CURRENCIES } from '../../shared/currencies';\nimport getConnectUrl from '../../shared/get-connect-url';\nimport useIsUserConnected from '../../shared/use-is-user-connected';\nimport { store as membershipProductsStore } from '../../store/membership-products';\nimport { STORE_NAME as MEMBERSHIPS_PRODUCTS_STORE } from '../../store/membership-products/constants';\nimport fetchDefaultProducts from './fetch-default-products';\nimport fetchStatus from './fetch-status';\nimport FirstTimeModal from './first-time-modal';\nimport './first-time-modal.scss';\nimport LoadingError from './loading-error';\nimport Tabs from './tabs';\n\nconst Edit = props => {\n\tconst { attributes, setAttributes } = props;\n\tconst { currency } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst [ loadingError, setLoadingError ] = useState( '' );\n\tconst [ products, setProducts ] = useState( [] );\n\tconst [ showFirstTimeModal, setShowFirstTimeModal ] = useState( false );\n\tconst isUserConnected = useIsUserConnected();\n\n\tconst { lockPostSaving, unlockPostSaving } = useDispatch( 'core/editor' );\n\tconst { getEntityRecord, getCurrentUser } = useSelect( 'core' );\n\tconst { editEntityRecord, saveEditedEntityRecord } = useDispatch( 'core' );\n\tconst post = useSelect( select => select( 'core/editor' ).getCurrentPost(), [] );\n\tconst isPostSavingLocked = useSelect(\n\t\tselect => select( 'core/editor' ).isPostSavingLocked(),\n\t\t[]\n\t);\n\n\tconst stripeConnectUrl = useSelect(\n\t\tselect => select( membershipProductsStore ).getConnectUrl() || '',\n\t\t[]\n\t);\n\n\tconst { setConnectUrl, setConnectedAccountDefaultCurrency } = useDispatch(\n\t\tMEMBERSHIPS_PRODUCTS_STORE\n\t);\n\n\tconst stripeDefaultCurrency = useSelect( select =>\n\t\tselect( MEMBERSHIPS_PRODUCTS_STORE ).getConnectedAccountDefaultCurrency()\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! currency && stripeDefaultCurrency && ! isPostSavingLocked ) {\n\t\t\tconst uppercasedStripeCurrency = stripeDefaultCurrency.toUpperCase();\n\t\t\tconst isCurrencySupported = !! SUPPORTED_CURRENCIES[ uppercasedStripeCurrency ];\n\t\t\tif ( isCurrencySupported ) {\n\t\t\t\t// If no currency is available, default to the stripe one\n\t\t\t\tsetAttributes( { currency: uppercasedStripeCurrency } );\n\t\t\t} else {\n\t\t\t\t// We default to USD\n\t\t\t\tsetAttributes( { currency: 'USD' } );\n\t\t\t}\n\t\t}\n\t}, [ currency, stripeDefaultCurrency, isPostSavingLocked, setAttributes ] );\n\n\tconst apiError = message => {\n\t\tsetLoadingError( message );\n\t};\n\n\tconst hasRequiredProducts = productIdsPerInterval => {\n\t\tconst intervals = Object.keys( productIdsPerInterval );\n\n\t\treturn (\n\t\t\tintervals.includes( 'one-time' ) &&\n\t\t\tintervals.includes( '1 month' ) &&\n\t\t\tintervals.includes( '1 year' )\n\t\t);\n\t};\n\n\t//\n\t// Check if this is the first time using the donations block\n\t//\n\n\t// Add this to preload the user entity\n\tconst currentUser = getCurrentUser();\n\tuseEffect( () => {\n\t\tif ( currentUser?.id ) {\n\t\t\t// Ensure the user entity is loaded\n\t\t\tgetEntityRecord( 'root', 'user', currentUser.id );\n\t\t}\n\t}, [ currentUser?.id, getEntityRecord ] );\n\n\tconst hasDismissedDonationWarning =\n\t\tcurrentUser?.meta?.jetpack_donation_warning_dismissed || false;\n\n\t// Show the modal if the user has not dismissed the warning\n\tuseEffect( () => {\n\t\tif ( currentUser?.id && hasDismissedDonationWarning === false ) {\n\t\t\tsetShowFirstTimeModal( true );\n\t\t}\n\t}, [ currentUser, hasDismissedDonationWarning ] );\n\n\tuseEffect( () => {\n\t\tlockPostSaving( 'donations' );\n\n\t\tconst filterProducts = productList =>\n\t\t\tproductList.reduce(\n\t\t\t\t( filteredProducts, { id, currency: productCurrency, type, interval } ) => {\n\t\t\t\t\tif ( productCurrency === currency && type === 'donation' ) {\n\t\t\t\t\t\tfilteredProducts[ interval ] = id;\n\t\t\t\t\t}\n\t\t\t\t\treturn filteredProducts;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\n\t\tfetchStatus( 'donation' ).then( result => {\n\t\t\tif ( ( ! result && typeof result !== 'object' ) || result.errors ) {\n\t\t\t\tunlockPostSaving( 'donations' );\n\t\t\t\tsetLoadingError( __( 'Could not load data from WordPress.com.', 'jetpack' ) );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetConnectUrl( getConnectUrl( post.id, result.connect_url ) );\n\t\t\tsetConnectedAccountDefaultCurrency(\n\t\t\t\tresult?.connected_account_default_currency?.toUpperCase()\n\t\t\t);\n\n\t\t\tconst filteredProducts = filterProducts( result.products );\n\n\t\t\tif ( hasRequiredProducts( filteredProducts ) ) {\n\t\t\t\tsetProducts( filteredProducts );\n\t\t\t\tunlockPostSaving( 'donations' );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set fake products when there is no connection to Stripe so users can still try the block in the editor.\n\t\t\tif ( result.connect_url ) {\n\t\t\t\tsetProducts( {\n\t\t\t\t\t'one-time': -1,\n\t\t\t\t\t'1 month': -1,\n\t\t\t\t\t'1 year': -1,\n\t\t\t\t} );\n\t\t\t\tunlockPostSaving( 'donations' );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( currency ) {\n\t\t\t\t// Only create products if we have the correct plan and stripe connection.\n\t\t\t\tfetchDefaultProducts( currency ).then( defaultProducts => {\n\t\t\t\t\tsetProducts( filterProducts( defaultProducts ) );\n\t\t\t\t\tunlockPostSaving( 'donations' );\n\t\t\t\t}, apiError );\n\t\t\t}\n\n\t\t\tunlockPostSaving( 'donations' );\n\t\t}, apiError );\n\t}, [\n\t\tlockPostSaving,\n\t\tcurrency,\n\t\tpost.id,\n\t\tsetConnectUrl,\n\t\tsetConnectedAccountDefaultCurrency,\n\t\tunlockPostSaving,\n\t] );\n\n\tlet content;\n\n\tif ( ! isUserConnected ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else if ( loadingError ) {\n\t\tcontent = ;\n\t} else if ( stripeConnectUrl ) {\n\t\t// Need to connect Stripe first\n\t\tcontent = ;\n\t} else if ( ! currency ) {\n\t\t// Memberships settings are still loading\n\t\tcontent = ;\n\t} else {\n\t\tcontent = ;\n\t}\n\n\t// When the first time modal is closed, update the user meta to mark the donation warning as dismissed\n\tconst handleModalClose = async () => {\n\t\tsetShowFirstTimeModal( false );\n\n\t\tif ( ! currentUser?.id ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'Cannot update user meta: User not loaded' );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'root', 'user', currentUser.id, {\n\t\t\t\tmeta: {\n\t\t\t\t\tjetpack_donation_warning_dismissed: true,\n\t\t\t\t},\n\t\t\t} );\n\t\t\tawait saveEditedEntityRecord( 'root', 'user', currentUser.id );\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'Failed to update user meta:', error );\n\t\t}\n\t};\n\n\treturn (\n\t\t
        \n\t\t\t{ content }\n\t\t\t{ showFirstTimeModal && }\n\t\t
        \n\t);\n};\n\nexport default Edit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/donations/save.js\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { getDefaultTexts } from './utils';\n\nconst DEFAULT_TEXTS = getDefaultTexts();\n\nconst Save = ( { attributes } ) => {\n\tconst { fallbackLinkUrl, oneTimeDonation, monthlyDonation, annualDonation } = attributes;\n\n\tif (\n\t\t! oneTimeDonation ||\n\t\t! oneTimeDonation.show ||\n\t\t! oneTimeDonation.planId ||\n\t\toneTimeDonation.planId === -1\n\t) {\n\t\treturn null;\n\t}\n\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t{ monthlyDonation.show && (\n\t\t\t\t<>\n\t\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t{ annualDonation.show && (\n\t\t\t\t<>\n\t\t\t\t\t
        \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
        \n\t);\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom Gutenberg block for showcasing product SKUs, incorporating a product ID selector, descendant product visibility toggle, product picker, and two additional configurable parameters."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sku/block.json\n{\n\t\"name\": \"woocommerce/product-sku\",\n\t\"title\": \"Product SKU\",\n\t\"description\": \"Displays the SKU of a product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"isDescendantOfAllProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showProductSelector\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"prefix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"SKU:\"\n\t\t},\n\t\t\"suffix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/product-meta\",\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sku/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport EditProductLink from '@woocommerce/editor-components/edit-product-link';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport Block from './block';\nimport type { Attributes } from './types';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n}: BlockEditProps< Attributes > & { context: Context } ): JSX.Element => {\n\tconst { style, ...blockProps } = useBlockProps( {\n\t\tclassName:\n\t\t\t'wc-block-components-product-sku wp-block-woocommerce-product-sku',\n\t} );\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t};\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\n\tlet { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tif ( isDescendentOfQueryLoop ) {\n\t\tisDescendentOfSingleProductTemplate = false;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block using Gutenberg that renders a product's SKU, featuring customizable attributes including product identification, hierarchical product display, selector functionality, and two supplementary options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sku/block.json\n{\n\t\"name\": \"woocommerce/product-sku\",\n\t\"title\": \"Product SKU\",\n\t\"description\": \"Displays the SKU of a product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"isDescendantOfAllProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showProductSelector\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"prefix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"SKU:\"\n\t\t},\n\t\t\"suffix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/product-meta\",\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/sku/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport EditProductLink from '@woocommerce/editor-components/edit-product-link';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport Block from './block';\nimport type { Attributes } from './types';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n}: BlockEditProps< Attributes > & { context: Context } ): JSX.Element => {\n\tconst { style, ...blockProps } = useBlockProps( {\n\t\tclassName:\n\t\t\t'wc-block-components-product-sku wp-block-woocommerce-product-sku',\n\t} );\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t};\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\n\tlet { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tif ( isDescendentOfQueryLoop ) {\n\t\tisDescendentOfSingleProductTemplate = false;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a text block with customizable content"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/preformatted/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/preformatted\",\n\t\"title\": \"Preformatted\",\n\t\"category\": \"text\",\n\t\"description\": \"Add text that respects your spacing and tabs, and also allows styling.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"pre\",\n\t\t\t\"__unstablePreserveWhiteSpace\": true,\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-preformatted\"\n}\n\n\n// File: packages/block-library/src/preformatted/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/preformatted/save.js\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { content } = attributes;\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display the order confirmation billing section. with these attributes: heading"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/billing-wrapper/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-billing-wrapper\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Billing Address Section\",\n\t\"description\": \"Display the order confirmation billing section.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"attributes\": {\n\t\t\"heading\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/billing-wrapper/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\theading: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ) => {\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( { heading: value } ),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t'woocommerce/order-confirmation-billing-address',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlock: {\n\t\t\t\t\t\t\t\tremove: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t] }\n\t\t\t/>\n\t\t
        \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WooCommerce block that enables flexible configuration through customizable parameters, including query ID, query type, tag name, and six additional configurable options."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-collection\",\n\t\"title\": \"Product Collection\",\n\t\"description\": \"Display a collection of products from your store.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\",\n\t\t\"Products (Beta)\",\n\t\t\"all products\",\n\t\t\"by attribute\",\n\t\t\"by category\",\n\t\t\"by tag\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"queryId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"query\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"displayLayout\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t\t\"type\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"enum\": [ \"flex\", \"list\", \"carousel\" ]\n\t\t\t\t},\n\t\t\t\t\"columns\": {\n\t\t\t\t\t\"type\": \"number\"\n\t\t\t\t},\n\t\t\t\t\"shrinkColumns\": {\n\t\t\t\t\t\"type\": \"boolean\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"convertedFromProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"collection\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hideControls\": {\n\t\t\t\"default\": [],\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"queryContextIncludes\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"forcePageReload\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"__privatePreviewState\": {\n\t\t\t\"type\": \"object\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"queryId\": \"queryId\",\n\t\t\"query\": \"query\",\n\t\t\"displayLayout\": \"displayLayout\",\n\t\t\"dimensions\": \"dimensions\",\n\t\t\"queryContextIncludes\": \"queryContextIncludes\",\n\t\t\"collection\": \"collection\",\n\t\t\"__privateProductCollectionPreviewState\": \"__privatePreviewState\"\n\t},\n\t\"usesContext\": [ \"templateSlug\", \"postId\" ],\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"html\": false,\n\t\t\"__experimentalLayout\": true,\n\t\t\"interactivity\": true,\n\t\t\"email\": true\n\t},\n\t\"editorStyle\": \"file:../woocommerce/product-collection-editor.css\",\n\t\"style\": \"file:../woocommerce/product-collection-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/save.tsx\n/**\n * External dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function QuerySave( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable text align, show product title, show reviews count, and 2 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-title/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews-title\",\n\t\"title\": \"Reviews Title\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews\" ],\n\t\"description\": \"Displays a title with the number of reviews.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"showProductTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showReviewsCount\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": false,\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\t\"__experimentalFontWeight\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-title/index.ts\n/**\n * External dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { title as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport './style.scss';\n\n// @ts-expect-error metadata is not typed.\nregisterBlockType( metadata, {\n\tedit,\n\ticon,\n} );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a dynamic pricing block in WordPress that provides flexibility for users to set product details, including ID, query loop relationship, text positioning, and two extra personalization options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/price/block.json\n{\n\t\"name\": \"woocommerce/product-price\",\n\t\"title\": \"Product Price\",\n\t\"description\": \"Display the price of a product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": { \"type\": \"number\", \"default\": 0 },\n\t\t\"isDescendentOfQueryLoop\": { \"type\": \"boolean\", \"default\": false },\n\t\t\"textAlign\": { \"type\": \"string\", \"default\": \"\" },\n\t\t\"isDescendentOfSingleProductTemplate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"interactivity\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"__experimentalSelector\": \".wp-block-woocommerce-product-price .wc-block-components-product-price\",\n\t\t\"email\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t}\n\t},\n\t\"ancestor\": [\n\t\t\"woocommerce/all-products\",\n\t\t\"woocommerce/featured-product\",\n\t\t\"woocommerce/single-product\",\n\t\t\"woocommerce/product-template\",\n\t\t\"core/post-template\"\n\t],\n\t\"viewScriptModule\": \"product-price\",\n\t\"style\": \"file:../product-price.css\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport type { BlockAlignment } from '@wordpress/blocks';\nimport { isExperimentalWcRestApiV4Enabled } from '@woocommerce/block-settings';\nimport { useProduct } from '@woocommerce/entities';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\ntype UnsupportedAligments = 'wide' | 'full';\ntype AllowedAlignments = Exclude< BlockAlignment, UnsupportedAligments >;\n\ninterface BlockAttributes {\n\ttextAlign?: AllowedAlignments;\n}\n\ninterface Attributes {\n\ttextAlign: 'left' | 'center' | 'right';\n\tisDescendentOfSingleProduct: boolean;\n\tisDescendentOfSingleProductBlock: boolean;\n\tproductId: number;\n}\n\ninterface Context {\n\tqueryId: number;\n}\n\ninterface Props {\n\tattributes: Attributes;\n\tsetAttributes: (\n\t\tattributes: Partial< BlockAttributes > & Record< string, unknown >\n\t) => void;\n\tcontext: Context;\n}\n\nconst PriceEdit = ( {\n\tattributes,\n\tsetAttributes,\n\tcontext,\n}: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t};\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\n\tlet { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tif ( isDescendentOfQueryLoop ) {\n\t\tisDescendentOfSingleProductTemplate = false;\n\t}\n\n\tuseEffect(\n\t\t() =>\n\t\t\tsetAttributes( {\n\t\t\t\tisDescendentOfQueryLoop,\n\t\t\t\tisDescendentOfSingleProductTemplate,\n\t\t\t} ),\n\t\t[\n\t\t\tisDescendentOfQueryLoop,\n\t\t\tisDescendentOfSingleProductTemplate,\n\t\t\tsetAttributes,\n\t\t]\n\t);\n\n\tconst isExperimentalWcRestApiEnabled = isExperimentalWcRestApiV4Enabled();\n\n\tconst { product } = useProduct( context.postId );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
        \n\t\t\t\t{\n\t\t\t\t\t// If experimental WC API is not available we must fallback to \"old\" way of fetching product data.\n\t\t\t\t\t// Once it's available everywhere we can remove this fallback.\n\t\t\t\t\tisExperimentalWcRestApiEnabled ? (\n\t\t\t\t\t\t\n\t\t\t\t\t) : (\n\t\t\t\t\t\t\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t
        \n\t\t\n\t);\n};\n\nexport default PriceEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a customizable block that empowers users to effortlessly transform plain text by incorporating headings, lists, and link functionalities with intuitive source configuration."}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/markdown/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/markdown\",\n\t\"title\": \"Markdown\",\n\t\"description\": \"Add headings, lists, or links to plain text with ease.\",\n\t\"keywords\": [ \"formatting\", \"syntax\", \"markup\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"text\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"margin\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"attributes\": { \"source\": { \"type\": \"string\" } },\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"source\": \"## ## Try Markdown\\n\\nMarkdown is a text formatting syntax that is converted into HTML. You can _emphasize_ text or **make it strong** with just a few characters.\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/markdown/edit.js\nimport { BlockControls, PlainText, useBlockProps } from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport ToolbarButton from './controls';\nimport MarkdownRenderer from './renderer';\n\n/**\n * Module variables\n */\nconst PANEL_EDITOR = 'editor';\nconst PANEL_PREVIEW = 'preview';\n\nconst MarkdownEdit = ( { attributes, setAttributes, isSelected, removeBlock } ) => {\n\tconst { source } = attributes;\n\tconst isEmpty = ! source || source.trim() === '';\n\n\tconst blockProps = useBlockProps();\n\tconst { className } = blockProps;\n\tconst [ activePanel, setActivePanel ] = useState( PANEL_EDITOR );\n\tconst input = useRef( null );\n\n\tconst onChange = s => setAttributes( { source: s } );\n\tconst onKeyDown = e => {\n\t\t// Remove the block if source is empty and we're pressing the Backspace key\n\t\tif ( e.keyCode === 8 && source === '' ) {\n\t\t\tremoveBlock();\n\t\t\te.preventDefault();\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( isSelected ) {\n\t\t\tif ( activePanel === PANEL_EDITOR ) {\n\t\t\t\tinput?.current.focus();\n\t\t\t}\n\t\t} else if ( activePanel === PANEL_PREVIEW ) {\n\t\t\tsetActivePanel( PANEL_EDITOR );\n\t\t}\n\t}, [ isSelected, activePanel, setActivePanel ] );\n\n\tlet content;\n\n\tif ( ! isSelected && isEmpty ) {\n\t\tcontent = (\n\t\t\t

        \n\t\t\t\t{ __( 'Write your _Markdown_ **here**…', 'jetpack' ) }\n\t\t\t

        \n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\t
        \n\t\t\t\t\t\t setActivePanel( PANEL_EDITOR ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t setActivePanel( PANEL_PREVIEW ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t
        \n\t\t\t\t
        \n\n\t\t\t\t{ activePanel === PANEL_PREVIEW || ! isSelected ? (\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
        \n\t\t);\n\t}\n\n\treturn
        { content }
        ;\n};\n\nexport default compose( [\n\twithSelect( select => ( {\n\t\tcurrentBlockId: select( 'core/block-editor' ).getSelectedBlockClientId(),\n\t} ) ),\n\twithDispatch( ( dispatch, { currentBlockId } ) => ( {\n\t\tremoveBlock: () => dispatch( 'core/block-editor' ).removeBlocks( currentBlockId ),\n\t} ) ),\n] )( MarkdownEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/markdown/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport MarkdownRenderer from './renderer';\n\nexport default ( { attributes } ) => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn (\n\t\t\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Button allowing you to sell products and subscriptions. with these attributes: plan id, plan ids, align, and 3 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/recurring-payments/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/recurring-payments\",\n\t\"title\": \"Payment Button\",\n\t\"description\": \"Button allowing you to sell products and subscriptions.\",\n\t\"keywords\": [\n\t\t\"buy\",\n\t\t\"contribution\",\n\t\t\"commerce\",\n\t\t\"credit card\",\n\t\t\"debit card\",\n\t\t\"donate\",\n\t\t\"Donations\",\n\t\t\"monetize\",\n\t\t\"earn\",\n\t\t\"ecommerce\",\n\t\t\"gofundme\",\n\t\t\"memberships\",\n\t\t\"money\",\n\t\t\"paid\",\n\t\t\"patreon\",\n\t\t\"pay\",\n\t\t\"payments\",\n\t\t\"products\",\n\t\t\"purchase\",\n\t\t\"recurring\",\n\t\t\"sell\",\n\t\t\"shop\",\n\t\t\"stripe\",\n\t\t\"subscribe\",\n\t\t\"subscriptions\",\n\t\t\"sponsor\",\n\t\t\"square\",\n\t\t\"toast\",\n\t\t\"venmo\"\n\t],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"__experimentalExposeControlsToChildren\": true\n\t},\n\t\"usesContext\": [ \"isPremiumContentChild\" ],\n\t\"providesContext\": {\n\t\t\"jetpack/parentBlockWidth\": \"width\"\n\t},\n\t\"attributes\": {\n\t\t\"planId\": {\n\t\t\t\"type\": \"integer\"\n\t\t},\n\t\t\"planIds\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"#\"\n\t\t},\n\t\t\"uniqueId\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"id\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"parent\": [ \"jetpack/payment-buttons\" ]\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/recurring-payments/edit.jsx\nimport { InspectorControls, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useEffect, useMemo, useCallback } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\nimport ProductManagementControls from '../../shared/components/product-management-controls';\nimport { StripeNudge } from '../../shared/components/stripe-nudge';\nimport { getEditorType, POST_EDITOR } from '../../shared/get-editor-type';\nimport useWidth from '../../shared/use-width';\nimport { WidthPanel } from '../../shared/width-panel';\nimport { getBlockStyles } from './util';\n\n// If we use the name on index.js and the block name changes the events block name will also change.\nconst BLOCK_NAME = 'recurring-payments';\n\nexport default function Edit( { attributes, clientId, setAttributes } ) {\n\tconst { align, planId, planIds, width } = attributes;\n\n\t// planId is a integer, planIds is an array.\n\t// if planIds is set, use it, otherwise use planId. Going forward we should only use planIds.\n\t// This is placed in useMemo to support the useCallback and useEffect hooks below.\n\tconst _planIds = useMemo( () => {\n\t\treturn planIds || ( planId ? [ planId ] : [] );\n\t}, [ planId, planIds ] );\n\n\tconst editorType = getEditorType();\n\tconst postLink = useSelect( select => select( editorStore )?.getCurrentPost()?.link, [] );\n\n\tconst updateSubscriptionPlans = useCallback(\n\t\tnewPlanIds => {\n\t\t\t// verify newPlanIds is a non-empty array.\n\t\t\tif ( ! Array.isArray( newPlanIds ) || 0 === newPlanIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// ensure/convert all elements to integers.\n\t\t\tconst validatedPlanIds = newPlanIds\n\t\t\t\t.map( id => parseInt( id, 10 ) )\n\t\t\t\t.filter( id => ! isNaN( id ) );\n\n\t\t\t// if all the elements match the existing planIds, do nothing.\n\t\t\tif (\n\t\t\t\tArray.isArray( _planIds ) &&\n\t\t\t\tvalidatedPlanIds.length === _planIds.length &&\n\t\t\t\tvalidatedPlanIds.every( i => _planIds.includes( i ) )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newPlanId = validatedPlanIds.join( '+' );\n\t\t\tconst resolvePaymentUrl = paymentPlanId => {\n\t\t\t\tif ( POST_EDITOR !== editorType || ! postLink ) {\n\t\t\t\t\treturn '#';\n\t\t\t\t}\n\n\t\t\t\tconst postUrl = new URL( postLink );\n\t\t\t\tpostUrl.searchParams.set( 'recurring_payments', paymentPlanId );\n\t\t\t\treturn postUrl.toString();\n\t\t\t};\n\n\t\t\tsetAttributes( {\n\t\t\t\tplanId: null,\n\t\t\t\tplanIds: validatedPlanIds,\n\t\t\t\turl: resolvePaymentUrl( newPlanId ),\n\t\t\t\tuniqueId: `recurring-payments-${ newPlanId }`,\n\t\t\t} );\n\t\t},\n\t\t[ editorType, _planIds, postLink, setAttributes ]\n\t);\n\n\tuseEffect( () => {\n\t\tupdateSubscriptionPlans( _planIds );\n\t}, [ _planIds, updateSubscriptionPlans ] );\n\n\t/**\n\t * Filters the editor settings of the Payment Button block (`jetpack/recurring-payments`).\n\t *\n\t * @param {object} editorSettings - An object with the block settings.\n\t * @param {boolean} editorSettings.showProductManagementControls - Whether the product management block controls should be shown.\n\t * @param {boolean} editorSettings.showStripeNudge - Whether the action to connect to Stripe should be shown.\n\t * @param {string} clientId - Block ID.\n\t */\n\tconst { showProductManagementControls, showStripeNudge } = applyFilters(\n\t\t'jetpack.recurringPayments.editorSettings',\n\t\t{\n\t\t\tshowProductManagementControls: true,\n\t\t\tshowStripeNudge: true,\n\t\t},\n\t\tclientId\n\t);\n\n\tuseWidth( { attributes, setAttributes } );\n\n\tconst blockProps = useBlockProps( { style: getBlockStyles( { width } ) } );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{},\n\t\t{\n\t\t\ttemplate: [\n\t\t\t\t[\n\t\t\t\t\t'jetpack/button',\n\t\t\t\t\t{\n\t\t\t\t\t\telement: 'a',\n\t\t\t\t\t\tpassthroughAttributes: {\n\t\t\t\t\t\t\tuniqueId: 'uniqueId',\n\t\t\t\t\t\t\turl: 'url',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t],\n\t\t\ttemplateLock: 'all',\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t}\n\t);\n\n\treturn (\n\t\t
        \n\t\t\t{ showProductManagementControls && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t setAttributes( { width: newWidth } ) }\n\t\t\t\t/>\n\t\t\t\n\t\t\t{ showStripeNudge && }\n\t\t\t
        \n\t\t
        \n\t);\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/recurring-payments/save.js\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { getBlockStyles } from './util';\n\nexport default function save( { attributes: { width } } ) {\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\t...useBlockProps.save(),\n\t\tstyle: getBlockStyles( { width } ),\n\t} );\n\treturn
        ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a block specifically for scenarios where no product inventory exists, displaying alternative content when no items are found."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/inner-blocks/no-results/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-collection-no-results\",\n\t\"title\": \"No results\",\n\t\"category\": \"woocommerce\",\n\t\"description\": \"The contents of this block will display when there are no products found.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"keywords\": [ \"Product Collection\" ],\n\t\"usesContext\": [ \"queryId\", \"query\" ],\n\t\"ancestor\": [ \"woocommerce/product-collection\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"align\": true,\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"email\": true\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/inner-blocks/no-results/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { Template } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE: Template[] = [\n\t[\n\t\t'core/group',\n\t\t{\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\torientation: 'vertical',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\tflexWrap: 'wrap',\n\t\t\t},\n\t\t},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/paragraph',\n\t\t\t\t{\n\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\tfontSize: 'medium',\n\t\t\t\t\tcontent: `${ __(\n\t\t\t\t\t\t'No results found',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) }`,\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/paragraph',\n\t\t\t\t{\n\t\t\t\t\tcontent: `${ __(\n\t\t\t\t\t\t'You can try',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) } ${ __(\n\t\t\t\t\t\t'clearing any filters',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) } ${ __(\n\t\t\t\t\t\t'or head to our',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) } ${ __(\n\t\t\t\t\t\t\"store's home\",\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) }`,\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t],\n];\n\nconst Edit = () => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-product-collection-no-results',\n\t} );\n\n\treturn (\n\t\t
        \n\t\t\t\n\t\t
        \n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-collection/inner-blocks/no-results/save.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function NoResultsSave() {\n\t// @ts-expect-error: `InnerBlocks.Content` is a component that is typed in WordPress core\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a custom Gutenberg block that Displays the description of the selected variation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-description/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/add-to-cart-with-options-variation-description\",\n\t\"title\": \"Variation Description (Beta)\",\n\t\"description\": \"Displays the description of the selected variation.\",\n\t\"category\": \"woocommerce\",\n\t\"textdomain\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/add-to-cart-with-options\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"html\": false,\n\t\t\"dimensions\": {\n\t\t\t\"minHeight\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"viewScriptModule\": \"woocommerce/product-elements\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-description/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nexport default function VariationDescriptionEdit() {\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
        \n\t\t\t

        \n\t\t\t\t{ __(\n\t\t\t\t\t'This block displays the variation description. When the shopper selects a variation, the description content will automatically appear here.',\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t

        \n\t\t
        \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a WooCommerce custom block with the ability to modify the surrounding tag's HTML element programmatically."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews\",\n\t\"icon\": \"admin-comments\",\n\t\"title\": \"Product Reviews\",\n\t\"description\": \"Display a product's reviews\",\n\t\"category\": \"woocommerce\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"viewScriptModule\": \"woocommerce/product-reviews\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/edit.tsx\n/**\n * External dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useQueryLoopProductContextValidation } from '@woocommerce/base-hooks';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t// @ts-expect-error missing types.\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TEMPLATE from './template';\nimport { ProductReviewsEditProps } from './types';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n}: ProductReviewsEditProps ) => {\n\tconst { tagName: TagName = 'div' } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\tconst { hasInvalidContext, warningElement } =\n\t\tuseQueryLoopProductContextValidation( {\n\t\t\tclientId,\n\t\t\tpostType: context.postType,\n\t\t\tblockName: __( 'Product Reviews', 'woocommerce' ),\n\t\t} );\n\n\tif ( hasInvalidContext ) {\n\t\treturn warningElement;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* @ts-expect-error missing types */ }\n\t\t\t\n\t\t\t\t)', 'woocommerce' ),\n\t\t\t\t\t\t\tvalue: 'div',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ label: '
        ', value: 'section' },\n\t\t\t\t\t\t{ label: '

      \n\t);\n}\n\nexport default function AttributeOptionsEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { attributes, setAttributes } = props;\n\tconst { className, optionStyle } = attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\n\t// Apply selected variation pill styles based on Site Editor's background and text colors.\n\tuseThemeColors(\n\t\t'add-to-cart-with-options-variation-selector-attribute-options',\n\t\t( { editorBackgroundColor, editorColor } ) => `\n\t\t\t:where(.wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill--selected) {\n\t\t\t\t--pill-color: ${ editorBackgroundColor };\n\t\t\t\t--pill-background-color: ${ editorColor };\n\t\t\t}\n\t\t`\n\t);\n\n\tconst { data: attribute } =\n\t\tuseCustomDataContext< ProductResponseAttributeItem >( 'attribute' );\n\n\tif ( ! attribute ) return null;\n\n\tconst options = attribute.terms.map( ( term, index ) => ( {\n\t\tvalue: term.slug,\n\t\tlabel: term.name,\n\t\tdisabled: index > 1 && index === attribute.terms.length - 1,\n\t} ) );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnewOptionStyle === 'pills' ||\n\t\t\t\t\t\t\t\tnewOptionStyle === 'dropdown'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\toptionStyle: newOptionStyle,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{ optionStyle === 'dropdown' ? (\n\t\t\t\t\t\n\t\t\t\t\t\t{ options.map( ( option ) => (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block enabling users to showcase followed websites with customizable display settings including avatar visibility, site description, link behavior, and two additional configurable options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blogroll/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/blogroll\",\n\t\"title\": \"Blogroll\",\n\t\"description\": \"Share the sites you follow with your users.\",\n\t\"keywords\": [],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"alignWide\": true,\n\t\t\"anchor\": false,\n\t\t\"customClassName\": true,\n\t\t\"className\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"show_avatar\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"show_description\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"open_links_new_window\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"ignore_user_blogs\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"load_placeholders\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"showAvatar\": \"show_avatar\",\n\t\t\"showDescription\": \"show_description\",\n\t\t\"openLinksNewWindow\": \"open_links_new_window\"\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blogroll/edit.js\nimport { InspectorControls, useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport { PanelBody, ToggleControl, FlexBlock, Spinner, Notice } from '@wordpress/components';\nimport { dispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport ConnectBanner from '../../shared/components/connect-banner';\nimport useIsUserConnected from '../../shared/use-is-user-connected';\nimport BlogrollAppender from './components/blogroll-appender';\nimport useRecommendations from './use-recommendations';\nimport { useSiteRecommendationSync } from './use-site-recommendations';\nimport useSubscriptions from './use-subscriptions';\nimport { createBlockFromRecommendation } from './utils';\nimport './editor.scss';\n\nexport function BlogRollEdit( { className, attributes, setAttributes, clientId } ) {\n\tconst {\n\t\tshow_avatar,\n\t\tshow_description,\n\t\topen_links_new_window,\n\t\tignore_user_blogs,\n\t\tload_placeholders,\n\t} = attributes;\n\n\tconst isUserConnected = useIsUserConnected();\n\n\tconst {\n\t\tisLoading: isLoadingRecommendations,\n\t\trecommendations,\n\t\terrorMessage: recommendationsErrorMessage,\n\t} = useRecommendations( load_placeholders );\n\tconst {\n\t\tisLoading: isLoadingSubscriptions,\n\t\tsubscriptions,\n\t\terrorMessage: subscriptionsErrorMessage,\n\t} = useSubscriptions( {\n\t\tignore_user_blogs,\n\t} );\n\tuseSiteRecommendationSync( { clientId } );\n\tconst { replaceInnerBlocks } = dispatch( 'core/block-editor' );\n\n\tuseEffect( () => {\n\t\tif ( load_placeholders && recommendations.length ) {\n\t\t\tsetAttributes( { load_placeholders: false } );\n\n\t\t\tconst blocks = [\n\t\t\t\tcreateBlock( 'core/heading', { content: __( 'Blogroll', 'jetpack' ), level: 3 } ),\n\t\t\t\t...recommendations.map( createBlockFromRecommendation ),\n\t\t\t];\n\t\t\treplaceInnerBlocks( clientId, blocks );\n\t\t}\n\t}, [ recommendations, load_placeholders, setAttributes, clientId, replaceInnerBlocks ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( className, {\n\t\t\t'hide-avatar': ! show_avatar,\n\t\t\t'hide-description': ! show_description,\n\t\t} ),\n\t} );\n\n\tif ( ! isUserConnected ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n\n\tconst errorMessage = recommendationsErrorMessage || subscriptionsErrorMessage;\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\t! isLoadingRecommendations && (\n\t\t\t\t\t\t\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t{ errorMessage && (\n\t\t\t\t\n\t\t\t\t\t

      { errorMessage }

      \n\t\t\t\t
      \n\t\t\t) }\n\n\t\t\t{ load_placeholders && isLoadingRecommendations && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t setAttributes( { show_avatar: ! show_avatar } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes( { show_description: ! show_description } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes( { open_links_new_window: ! open_links_new_window } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes( { ignore_user_blogs: ! ignore_user_blogs } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t
      \n\t);\n}\n\nexport default BlogRollEdit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blogroll/save.js\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport function BlogRollSave( { attributes: { show_avatar, show_description }, className } ) {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx( className, {\n\t\t\t'hide-avatar': ! show_avatar,\n\t\t\t'hide-description': ! show_description,\n\t\t} ),\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n}\n\nexport default BlogRollSave;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays a title with the number of comments. that allows users to configure: text align, show post title, show comments count, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comments-title/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments-title\",\n\t\"title\": \"Comments Title\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comments\" ],\n\t\"description\": \"Displays a title with the number of comments.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"showPostTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showCommentsCount\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": false,\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\t\"__experimentalFontWeight\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/comments-title/index.js\n/**\n * WordPress dependencies\n */\nimport { title as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a embed block with customizable service, label"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/sharing-button/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/sharing-button\",\n\t\"title\": \"Sharing Button\",\n\t\"description\": \"Display a sharing button, allowing users to share your post.\",\n\t\"keywords\": [],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"parent\": [ \"jetpack/sharing-buttons\" ],\n\t\"attributes\": {\n\t\t\"service\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"styleType\", \"postId\", \"iconColorValue\", \"iconBackgroundColorValue\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false\n\t},\n\t\"viewScript\": \"file:./view.js\"\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/sharing-button/edit.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport clsx from 'clsx';\nimport { SocialLogo } from 'social-logos';\nimport { getNameBySite } from './utils';\nimport './style.scss';\n\nconst SharingButtonEdit = ( { attributes, context } ) => {\n\tconst { service, label } = attributes;\n\tconst { styleType, iconColorValue, iconBackgroundColorValue } = context;\n\n\tconst socialLinkName = getNameBySite( service );\n\tconst socialLinkLabel = label ?? socialLinkName;\n\n\tconst sharingButtonClass = clsx(\n\t\t'jetpack-sharing-button__button',\n\t\t'style-' + styleType,\n\t\t'share-' + service\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'jetpack-sharing-button__list-item',\n\t} );\n\n\tconst buttonStyle = {\n\t\tcolor: iconColorValue,\n\t\tbackgroundColor: iconBackgroundColorValue,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t
    • \n\t\t\t\t\n\t\t\t
    • \n\t\t\n\t);\n};\n\nexport default SharingButtonEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a block that Contains the block elements used to display a comment, like the title, date, author, avatar and more."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-template/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-template\",\n\t\"title\": \"Comment Template\",\n\t\"category\": \"design\",\n\t\"parent\": [ \"core/comments\" ],\n\t\"description\": \"Contains the block elements used to display a comment, like the title, date, author, avatar and more.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"postId\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"reusable\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-comment-template\"\n}\n\n\n// File: packages/block-library/src/comment-template/index.js\n/**\n * WordPress dependencies\n */\nimport { layout as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/comment-template/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function CommentTemplateSave() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a flexible theme block in WordPress that allows users to modify link target and text positioning with intuitive configuration options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-edit-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-edit-link\",\n\t\"title\": \"Comment Edit Link\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-comment-edit-link\"\n}\n\n\n// File: packages/block-library/src/comment-edit-link/index.js\n/**\n * WordPress dependencies\n */\nimport { commentEditLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom Gutenberg block capable of embedding external content from platforms such as Twitter or YouTube, incorporating attributes for URL, caption, type, and four additional configurable parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/embed/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/embed\",\n\t\"title\": \"Embed\",\n\t\"category\": \"embed\",\n\t\"description\": \"Add a block that displays content pulled from other sites, like Twitter or YouTube.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"figcaption\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"providerNameSlug\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"allowResponsive\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"responsive\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"previewable\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true,\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-embed-editor\",\n\t\"style\": \"wp-block-embed\"\n}\n\n\n// File: packages/block-library/src/embed/index.js\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport transforms from './transforms';\nimport variations from './variations';\nimport deprecated from './deprecated';\nimport { embedContentIcon } from './icons';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: embedContentIcon,\n\tedit,\n\tsave,\n\ttransforms,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/embed/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { url, caption, type, providerNameSlug } = attributes;\n\n\tif ( ! url ) {\n\t\treturn null;\n\t}\n\n\tconst className = clsx( 'wp-block-embed', {\n\t\t[ `is-type-${ type }` ]: type,\n\t\t[ `is-provider-${ providerNameSlug }` ]: providerNameSlug,\n\t\t[ `wp-block-embed-${ providerNameSlug }` ]: providerNameSlug,\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t
      \n\t\t\t\t{ `\\n${ url }\\n` /* URL needs to be on its own line. */ }\n\t\t\t
      \n\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t\n\t\t\t) }\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the next comment's page link. with these attributes: label"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comments-pagination-next/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments-pagination-next\",\n\t\"title\": \"Comments Next Page\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/comments-pagination\" ],\n\t\"description\": \"Displays the next comment's page link.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"comments/paginationArrow\" ],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/comments-pagination-next/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { queryPaginationNext as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: __( 'Newer Comments' ),\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display shopper-facing notifications generated by WooCommerce or extensions. that allows users to configure: align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/store-notices/block.json\n{\n\t\"name\": \"woocommerce/store-notices\",\n\t\"title\": \"Store Notices\",\n\t\"description\": \"Display shopper-facing notifications generated by WooCommerce or extensions.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"multiple\": false,\n\t\t\"align\": [ \"wide\", \"full\" ]\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/store-notices/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport NoticeBanner from '@woocommerce/base-components/notice-banner';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\n\nconst Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-store-notices',\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t{ __(\n\t\t\t\t\t'Notices added by WooCommerce or extensions will show up here.',\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a grow block with customizable text, style, align, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/cookie-consent/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/cookie-consent\",\n\t\"title\": \"Cookie Consent\",\n\t\"description\": \"Display a customizable cookie consent banner. To display this block on all pages of your site, please add it inside a Template Part that is present on all your templates, like a Header or a Footer.\",\n\t\"keywords\": [ \"cookie\", \"consent\", \"privacy\", \"GDPR\", \"EU\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"left\", \"right\", \"wide\", \"full\" ],\n\t\t\"alignWide\": true,\n\t\t\"anchor\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"customClassName\": true,\n\t\t\"className\": true,\n\t\t\"html\": false,\n\t\t\"lock\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"text\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"html\",\n\t\t\t\"selector\": \"p\"\n\t\t},\n\t\t\"style\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"color\": {\n\t\t\t\t\t\"text\": \"var(--wp--preset--color--contrast)\",\n\t\t\t\t\t\"background\": \"var(--wp--preset--color--tertiary)\",\n\t\t\t\t\t\"link\": \"var(--wp--preset--color--contrast)\"\n\t\t\t\t},\n\t\t\t\t\"spacing\": {\n\t\t\t\t\t\"padding\": {\n\t\t\t\t\t\t\"top\": \"1em\",\n\t\t\t\t\t\t\"right\": \"1em\",\n\t\t\t\t\t\t\"bottom\": \"1em\",\n\t\t\t\t\t\t\"left\": \"1em\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"consentExpiryDays\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 365\n\t\t},\n\t\t\"showOverlay\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"viewScript\": \"file:./view.js\"\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/cookie-consent/edit.js\nimport { InspectorControls, useBlockProps, InnerBlocks, RichText } from '@wordpress/block-editor';\nimport { PanelBody, TextControl, SelectControl } from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport './editor.scss';\nimport { DEFAULT_TEXT } from './constants';\nimport { useSaveCookieConsentSettings } from './use-save-cookie-consent-settings';\n\n/**\n * Cookie Consent Edit Component.\n *\n * @param {object} props - Component props.\n * @param {string} props.clientId - Block id\n * @param {object} props.attributes - {object} Block attributes.\n * @param {Function} props.setAttributes - Set block attributes.\n * @return {object} Element to render.\n */\nfunction CookieConsentBlockEdit( { clientId, attributes, setAttributes } ) {\n\tconst { consentExpiryDays, align, text = DEFAULT_TEXT } = attributes;\n\n\tuseSaveCookieConsentSettings( clientId );\n\t/**\n\t * Update the alignment of the block. This takes care setting names alignments (left, right, etc..) or eg width=500.\n\t *\n\t * @param {string} nextAlign - The new alignment.\n\t */\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? { width: undefined, height: undefined }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: `wp-block-jetpack-cookie-consent align${ align }`,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t updateAlignment( alignValue ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes( { consentExpiryDays: parseInt( value ) } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t

      \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Note: The block position in the editor is not indicative of the position on the front end. The block will always be positioned at the bottom of the page.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

      \n\t\t\t\t
      \n\t\t\t
      \n\t\t\t
      \n\t\t\t\t setAttributes( { text: textValue } ) }\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t
      \n\t\t\n\t);\n}\n\nexport default CookieConsentBlockEdit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/cookie-consent/save.js\n/**\n * React hook that is used to mark the block wrapper element.\n * It provides all the necessary props like the class name.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops\n */\nimport { InnerBlocks, useBlockProps, RichText } from '@wordpress/block-editor';\nimport { DEFAULT_TEXT } from './constants';\n\n/**\n * The save function defines the way in which the different attributes should\n * be combined into the final markup, which is then serialized by the block\n * editor into `post_content`.\n *\n * @param {object} props - Save props.\n * @param {object} props.attributes - Block attributes.\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save\n * @return {object} Element to render.\n */\nexport default function save( { attributes } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst { text = DEFAULT_TEXT, consentExpiryDays } = attributes;\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\n\t\t\t{ consentExpiryDays }\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a block feature that provides flexible login/logout link rendering, supporting custom form display and seamless redirection to the active page context."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/loginout/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/loginout\",\n\t\"title\": \"Login/out\",\n\t\"category\": \"theme\",\n\t\"description\": \"Show login & logout links.\",\n\t\"keywords\": [ \"login\", \"logout\", \"form\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"displayLoginAsForm\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"redirectToCurrent\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"className\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": false,\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-loginout\"\n}\n\n\n// File: packages/block-library/src/loginout/index.js\n/**\n * WordPress dependencies\n */\nimport { login as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable show button styles, button height, button border radius, lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.json\n{\n\t\"name\": \"woocommerce/cart-express-payment-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Express Checkout\",\n\t\"description\": \"Allow customers to breeze through with quick payment options.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"showButtonStyles\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"buttonHeight\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"48\"\n\t\t},\n\t\t\"buttonBorderRadius\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"4\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useExpressPaymentMethods } from '@woocommerce/base-context/hooks';\nimport clsx from 'clsx';\nimport { ExpressPaymentControls } from '@woocommerce/blocks/cart-checkout-shared';\nimport type { BlockAttributes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\nimport type { ExpressCartAttributes } from '../../../cart-checkout-shared/types';\nimport { ExpressPaymentContext } from '../../../cart-checkout-shared/payment-methods/express-payment/express-payment-context';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: ExpressCartAttributes;\n\tsetAttributes: ( attrs: BlockAttributes ) => void;\n} ): JSX.Element | null => {\n\tconst { paymentMethods, isInitialized } = useExpressPaymentMethods();\n\tconst hasExpressPaymentMethods = Object.keys( paymentMethods ).length > 0;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'wp-block-woocommerce-cart-express-payment-block--has-express-payment-methods':\n\t\t\t\thasExpressPaymentMethods,\n\t\t} ),\n\t} );\n\n\tconst { className, showButtonStyles, buttonHeight, buttonBorderRadius } =\n\t\tattributes;\n\n\tif ( ! isInitialized || ! hasExpressPaymentMethods ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a customizable WooCommerce block with integrated lock mechanisms that allow flexible restriction and permission settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-shipping-methods-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping Options\",\n\t\"description\": \"Display shipping options and rates for your store.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { PanelBody, ExternalLink } from '@wordpress/components';\nimport { shipping } from '@wordpress/icons';\nimport { ADMIN_URL, getSetting } from '@woocommerce/settings';\nimport ExternalLinkCard from '@woocommerce/editor-components/external-link-card';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { useCheckoutAddress } from '@woocommerce/base-context/hooks';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport ConfigurePlaceholder from '../../configure-placeholder';\nimport Block from './block';\nimport './editor.scss';\n\ntype shippingAdminLink = {\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element | null => {\n\tconst globalShippingMethods = getSetting(\n\t\t'globalShippingMethods'\n\t) as shippingAdminLink[];\n\tconst activeShippingZones = getSetting(\n\t\t'activeShippingZones'\n\t) as shippingAdminLink[];\n\n\tconst { showShippingMethods } = useCheckoutAddress();\n\n\tif ( ! showShippingMethods ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t

      \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Options that control shipping can be managed in your store settings.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

      \n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Manage shipping options', 'woocommerce' ) }\n\t\t\t\t\t{ ' ' }\n\t\t\t\t\n\t\t\t\t{ globalShippingMethods.length > 0 && (\n\t\t\t\t\t\n\t\t\t\t\t\t

      \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'The following shipping integrations are active on your store.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

      \n\t\t\t\t\t\t{ globalShippingMethods.map( ( method ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __( 'Manage shipping methods', 'woocommerce' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t
      \n\t\t\t\t) }\n\t\t\t\t{ activeShippingZones.length && (\n\t\t\t\t\t\n\t\t\t\t\t\t

      \n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Shipping Zones can be made managed in your store settings.',\n\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t

      \n\t\t\t\t\t\t{ activeShippingZones.map( ( zone ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t
      \n\t\t\t\t) }\n\t\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that supports custom text input, enables citation fields, and provides text positioning controls for enhanced content presentation."}, {"role": "assistant", "content": "// File: packages/block-library/src/pullquote/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/pullquote\",\n\t\"title\": \"Pullquote (deprecated)\",\n\t\"category\": \"text\",\n\t\"description\": \"This block is deprecated. Please use the Quote block instead.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"value\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"p\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"citation\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"cite\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"left\", \"right\", \"wide\", \"full\" ],\n\t\t\"background\": {\n\t\t\t\"backgroundImage\": true,\n\t\t\t\"backgroundSize\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"backgroundImage\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"dimensions\": {\n\t\t\t\"minHeight\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"minHeight\": false\n\t\t\t}\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalStyle\": {\n\t\t\t\"typography\": {\n\t\t\t\t\"fontSize\": \"1.5em\",\n\t\t\t\t\"lineHeight\": \"1.6\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-pullquote-editor\",\n\t\"style\": \"wp-block-pullquote\"\n}\n\n\n// File: packages/block-library/src/pullquote/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'value',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'citation',\n\t\t\tlabel: __( 'Citation' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'value' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/pullquote/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { textAlign, citation, value } = attributes;\n\tconst shouldShowCitation = ! RichText.isEmpty( citation );\n\n\treturn (\n\t\t\n\t\t\t
      \n\t\t\t\t\n\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t
      \n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results. with these attributes: level, level options, text align, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/site-title/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/site-title\",\n\t\"title\": \"Site Title\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 1\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [ 0, 1, 2, 3, 4, 5, 6 ]\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"viewportWidth\": 500\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-site-title-editor\",\n\t\"style\": \"wp-block-site-title\"\n}\n\n\n// File: packages/block-library/src/site-title/index.js\n/**\n * WordPress dependencies\n */\nimport { mapMarker as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 350,\n\t\tattributes: {\n\t\t\ttextAlign: 'center',\n\t\t},\n\t},\n\tedit,\n\ttransforms,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Prompt visitors to take action with a button-style link. with these attributes: tag name, type, text align, and 10 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/button/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/button\",\n\t\"title\": \"Button\",\n\t\"category\": \"design\",\n\t\"parent\": [ \"core/buttons\" ],\n\t\"description\": \"Prompt visitors to take action with a button-style link.\",\n\t\"keywords\": [ \"link\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"a\", \"button\" ],\n\t\t\t\"default\": \"a\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"button\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a,button\",\n\t\t\t\"attribute\": \"title\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"text\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"a,button\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a\",\n\t\t\t\"attribute\": \"target\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"a\",\n\t\t\t\"attribute\": \"rel\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"backgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"textColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"gradient\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"number\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"splitting\": true,\n\t\t\"align\": false,\n\t\t\"alignWide\": false,\n\t\t\"color\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalSkipSerialization\": [\n\t\t\t\t\"fontSize\",\n\t\t\t\t\"lineHeight\",\n\t\t\t\t\"fontFamily\",\n\t\t\t\t\"fontWeight\",\n\t\t\t\t\"fontStyle\",\n\t\t\t\t\"textTransform\",\n\t\t\t\t\"textDecoration\",\n\t\t\t\t\"letterSpacing\"\n\t\t\t],\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"reusable\": false,\n\t\t\"shadow\": {\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"padding\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{ \"name\": \"fill\", \"label\": \"Fill\", \"isDefault\": true },\n\t\t{ \"name\": \"outline\", \"label\": \"Outline\" }\n\t],\n\t\"editorStyle\": \"wp-block-button-editor\",\n\t\"style\": \"wp-block-button\",\n\t\"selectors\": {\n\t\t\"root\": \".wp-block-button .wp-block-button__link\",\n\t\t\"typography\": {\n\t\t\t\"writingMode\": \".wp-block-button\"\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/button/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'text',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'text' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/button/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\t__experimentalGetElementClassName,\n\tgetTypographyClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst {\n\t\ttagName,\n\t\ttype,\n\t\ttextAlign,\n\t\tfontSize,\n\t\tlinkTarget,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\ttitle,\n\t\turl,\n\t\twidth,\n\t} = attributes;\n\n\tconst TagName = tagName || 'a';\n\tconst isButtonTag = 'button' === TagName;\n\tconst buttonType = type || 'button';\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst typographyProps = getTypographyClassesAndStyles( attributes );\n\tconst buttonClasses = clsx(\n\t\t'wp-block-button__link',\n\t\tcolorProps.className,\n\t\tborderProps.className,\n\t\ttypographyProps.className,\n\t\t{\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t// For backwards compatibility add style that isn't provided via\n\t\t\t// block support.\n\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,\n\t\t},\n\t\t__experimentalGetElementClassName( 'button' )\n\t);\n\tconst buttonStyle = {\n\t\t...borderProps.style,\n\t\t...colorProps.style,\n\t\t...spacingProps.style,\n\t\t...shadowProps.style,\n\t\t...typographyProps.style,\n\t\twritingMode: undefined,\n\t};\n\n\t// The use of a `title` attribute here is soft-deprecated, but still applied\n\t// if it had already been assigned, for the sake of backward-compatibility.\n\t// A title will no longer be assigned for new or updated button block links.\n\n\tconst wrapperClasses = clsx( className, {\n\t\t[ `has-custom-width wp-block-button__width-${ width }` ]: width,\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display a product's description, attributes, and reviews with these attributes: align, hide tab title"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-details/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-details\",\n\t\"title\": \"Product Details\",\n\t\"description\": \"Display a product's description, attributes, and reviews\",\n\t\"category\": \"woocommerce\",\n\t\"textdomain\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ]\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"hideTabTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\", \"postType\" ]\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-details/edit.tsx\n/**\n * External dependencies\n */\nimport { productsStore } from '@woocommerce/data';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { Disabled, PanelBody, ToggleControl } from '@wordpress/components';\n\nimport {\n\tstore as blockEditorStore,\n\tuseBlockProps,\n\t// @ts-expect-error - useInnerBlocksProps is not exported from @wordpress/block-editor\n\tuseInnerBlocksProps,\n\tWarning,\n\tInspectorControls,\n} from '@wordpress/block-editor';\n\n/**\n * External dependencies\n */\nimport { getInnerBlockByName } from '@woocommerce/utils';\n\n/**\n * Internal dependencies\n */\nimport { ProductDetailsEditProps } from './types';\nimport { getTemplate, isAdditionalProductDataEmpty } from './utils';\nimport { LegacyProductDetailsPreview } from './legacy-preview';\nimport './editor.scss';\n\n/**\n * Check if block is inside a Query Loop with non-product post type\n *\n * @param {string} clientId The block's client ID\n * @param {string} postType The current post type\n * @return {boolean} Whether the block is in an invalid Query Loop context\n */\nconst useIsInvalidQueryLoopContext = ( clientId: string, postType: string ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockParents = select(\n\t\t\t\tblockEditorStore\n\t\t\t).getBlockParentsByBlockName( clientId, 'core/post-template' );\n\t\t\treturn blockParents.length > 0 && postType !== 'product';\n\t\t},\n\t\t[ clientId, postType ]\n\t);\n};\n\nconst Edit = ( {\n\tclientId,\n\tcontext,\n\tattributes,\n\tsetAttributes,\n}: ProductDetailsEditProps ) => {\n\tconst blockProps = useBlockProps();\n\tconst { hideTabTitle } = attributes;\n\n\tconst product = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! context.postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getProduct } = select( productsStore );\n\t\t\treturn getProduct( Number( context.postId ) );\n\t\t},\n\t\t[ context.postId ]\n\t);\n\n\tconst {\n\t\tisInnerBlockOfSingleProductBlock,\n\t\thasInnerBlocks,\n\t\twasBlockJustInserted,\n\t\taccordionItemClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\n\t\t\t// Check if block is inner block of single product block\n\t\t\tconst singleProductParentBlocks = blockEditorSelect\n\t\t\t\t// @ts-expect-error - getBlockParentsByBlockName is not typed\n\t\t\t\t.getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'woocommerce/single-product'\n\t\t\t\t);\n\t\t\tconst isInnerBlock = singleProductParentBlocks.length > 0;\n\n\t\t\t// Get inner blocks and insertion status\n\t\t\t// @ts-expect-error - getBlocks is not typed\n\t\t\tconst blocks = blockEditorSelect.getBlocks( clientId );\n\t\t\tconst innerBlocks = blocks.length > 0;\n\t\t\tconst blockJustInserted =\n\t\t\t\t// @ts-expect-error - wasBlockJustInserted is not typed\n\t\t\t\tblockEditorSelect.wasBlockJustInserted( clientId );\n\n\t\t\tconst productDetailsBlock = select(\n\t\t\t\tblockEditorStore\n\t\t\t\t// @ts-expect-error - getBlocksByName is not typed\n\t\t\t).getBlock( clientId );\n\n\t\t\tconst productSpecificationClientId = getInnerBlockByName(\n\t\t\t\tproductDetailsBlock,\n\t\t\t\t'woocommerce/product-specifications'\n\t\t\t)?.clientId;\n\n\t\t\tconst accordionClientId = select(\n\t\t\t\tblockEditorStore\n\t\t\t\t// @ts-expect-error - getBlockParentsByBlockName is not typed\n\t\t\t).getBlockParentsByBlockName(\n\t\t\t\tproductSpecificationClientId ?? '',\n\t\t\t\t'woocommerce/accordion-item'\n\t\t\t)[ 0 ];\n\n\t\t\treturn {\n\t\t\t\tisInnerBlockOfSingleProductBlock: isInnerBlock,\n\t\t\t\thasInnerBlocks: innerBlocks,\n\t\t\t\twasBlockJustInserted: blockJustInserted,\n\t\t\t\taccordionItemClientId: accordionClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst template = useMemo( () => {\n\t\treturn getTemplate( product, {\n\t\t\tisInnerBlockOfSingleProductBlock,\n\t\t} );\n\t}, [ product, isInnerBlockOfSingleProductBlock ] );\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: wasBlockJustInserted ? template : undefined,\n\t} );\n\n\t/**\n\t * In some cases, the template variable is calculated before all the props are set.\n\t * This is why we need to do this additional check.\n\t * Check the PR for more details: https://github.com/woocommerce/woocommerce/pull/59686\n\t */\n\tuseEffect( () => {\n\t\tif (\n\t\t\twasBlockJustInserted &&\n\t\t\tproduct &&\n\t\t\tisAdditionalProductDataEmpty( product ) &&\n\t\t\taccordionItemClientId\n\t\t) {\n\t\t\tremoveBlock( accordionItemClientId );\n\t\t}\n\t}, [ wasBlockJustInserted, accordionItemClientId, product, removeBlock ] );\n\n\tconst isInvalidQueryLoopContext = useIsInvalidQueryLoopContext(\n\t\tclientId,\n\t\tcontext.postType\n\t);\n\tif ( isInvalidQueryLoopContext ) {\n\t\treturn (\n\t\t\t
      \n\t\t\t\t\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'The Product Details block requires a product context. When used in a Query Loop, the Query Loop must be configured to display products.',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t
      \n\t\t);\n\t}\n\n\tif ( hasInnerBlocks || wasBlockJustInserted ) {\n\t\treturn
      ;\n\t}\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thideTabTitle: ! hideTabTitle,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport default Edit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-details/save.tsx\n/**\n * External dependencies\n */\nimport {\n\t// @ts-expect-error Missing types for this package.\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\nexport default function Save() {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
      ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable align, class name"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/downloads/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-downloads\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Downloads\",\n\t\"description\": \"Display links to purchased downloads.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"html\": false,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalSelector\": \".wp-block-woocommerce-order-confirmation-totals table\"\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/downloads/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Disabled } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nconst Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-order-confirmation-downloads',\n\t} );\n\n\tconst {\n\t\tborderBottomColor,\n\t\tborderLeftColor,\n\t\tborderRightColor,\n\t\tborderTopColor,\n\t\tborderWidth,\n\t} = blockProps.style;\n\n\tconst borderStyles = {\n\t\tborderBottomColor,\n\t\tborderLeftColor,\n\t\tborderRightColor,\n\t\tborderTopColor,\n\t\tborderWidth,\n\t} as React.CSSProperties;\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ __( 'Product', 'woocommerce' ) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Downloads remaining',\n\t\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ __( 'Expires', 'woocommerce' ) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ __( 'Download', 'woocommerce' ) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t\t'Test Product',\n\t\t\t\t\t\t\t\t\t\t'sample product name',\n\t\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t'∞',\n\t\t\t\t\t\t\t\t\t'infinite downloads remaining',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t'Never',\n\t\t\t\t\t\t\t\t\t'download expires',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t\t'Test Download',\n\t\t\t\t\t\t\t\t\t\t'sample download name',\n\t\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Displays the name of the author of the review. with these attributes: is link, link target, text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-author-name/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-review-author-name\",\n\t\"title\": \"Review Author Name\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews\" ],\n\t\"description\": \"Displays the name of the author of the review.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"commentId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-author-name/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport {\n\t// @ts-expect-error AlignmentControl is not exported from @wordpress/block-editor\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\ntype Comment = {\n\tauthor_name?: string;\n\tauthor: number;\n};\n\ntype User = {\n\tname?: string;\n};\n\nexport default function Edit( {\n\tattributes: { isLink, linkTarget, textAlign },\n\tcontext: { commentId },\n\tsetAttributes,\n}: BlockEditProps< {\n\tisLink: boolean;\n\tlinkTarget: string;\n\ttextAlign: string;\n} > & {\n\tcontext: { commentId: string };\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\tcommentId\n\t\t\t) as Comment | null;\n\t\t\tconst authorName = comment?.author_name;\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'user',\n\t\t\t\t\tcomment.author\n\t\t\t\t) as User | null;\n\t\t\t\treturn user?.name ?? __( 'Anonymous', 'woocommerce' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Review Author', 'block title', 'woocommerce' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tif ( typeof newAlign === 'string' ) {\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
      { displayAuthor }
      \n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for A group of headers and associated expandable content. that allows users to configure: icon position, autoclose, allowed blocks"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/accordion-group/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/accordion-group\",\n\t\"title\": \"Accordion Group\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"A group of headers and associated expandable content.\",\n\t\"example\": {},\n\t\"__experimental\": true,\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"background\": {\n\t\t\t\"backgroundImage\": true,\n\t\t\t\"backgroundSize\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"backgroundImage\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradient\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"blockGap\": true\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": true,\n\t\t\"interactivity\": true\n\t},\n\t\"attributes\": {\n\t\t\"iconPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"right\"\n\t\t},\n\t\t\"autoclose\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"allowedBlocks\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"allowedBlocks\": [ \"woocommerce/accordion-item\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"viewScriptModule\": \"woocommerce/accordion-group\",\n\t\"style\": \"file:../woocommerce/accordion-group-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/accordion-group/index.js\n/**\n * External dependencies\n */\nimport { SVG, Path } from '@wordpress/components';\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\n\nconst icon = (\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n);\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tapiVersion: 3,\n\ticon,\n\texample: {},\n\tedit,\n\tsave,\n};\n\nregisterBlockType( metadata, settings );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/accordion-group/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { iconPosition } = attributes;\n\tconst blockProps = useBlockProps.save();\n\tconst className = clsx(\n\t\t{\n\t\t\t'icon-position-left': iconPosition === 'left',\n\t\t},\n\t\tblockProps.className\n\t);\n\n\treturn (\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a text block with customizable answers link, answers link text, gravatars, and 8 more options"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/blogging-prompt/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/blogging-prompt\",\n\t\"title\": \"Writing Prompt\",\n\t\"description\": \"Answer a new and inspiring writing prompt each day.\",\n\t\"keywords\": [ \"writing\", \"blogging\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"text\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"alignWide\": false,\n\t\t\"anchor\": false,\n\t\t\"className\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"text\": true\n\t\t},\n\t\t\"customClassName\": true,\n\t\t\"html\": false,\n\t\t\"inserter\": true,\n\t\t\"multiple\": false,\n\t\t\"reusable\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"padding\": true,\n\t\t\t\"blockGap\": false\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"answersLink\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"selector\": \".jetpack-blogging-prompt__answers-link\"\n\t\t},\n\t\t\"answersLinkText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"html\",\n\t\t\t\"selector\": \".jetpack-blogging-prompt__answers-link\"\n\t\t},\n\t\t\"gravatars\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"source\": \"query\",\n\t\t\t\"selector\": \".jetpack-blogging-prompt__answers-gravatar\",\n\t\t\t\"query\": {\n\t\t\t\t\"url\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\"attribute\": \"src\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"default\": []\n\t\t},\n\t\t\"promptLabel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"html\",\n\t\t\t\"selector\": \".jetpack-blogging-prompt__label\"\n\t\t},\n\t\t\"promptText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"html\",\n\t\t\t\"selector\": \".jetpack-blogging-prompt__text\"\n\t\t},\n\t\t\"promptFetched\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"promptId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"showResponses\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"tagsAdded\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isBloganuary\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{ \"name\": \"block\", \"label\": \"Block\", \"isDefault\": true },\n\t\t{ \"name\": \"quote\", \"label\": \"Quote\" }\n\t]\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blogging-prompt/edit.js\nimport apiFetch from '@wordpress/api-fetch';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { Button, PanelBody, Spinner, ToggleControl, withNotices } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport clsx from 'clsx';\nimport './editor.scss';\nimport { languageToLocale } from '../../shared/locale';\nimport { usePromptTags } from './use-prompt-tags';\n\nfunction BloggingPromptEdit( { attributes, noticeOperations, noticeUI, setAttributes } ) {\n\t// Use the ref to keep track of starting to fetch the prompt, so we don't make duplicate requests.\n\tconst fetchingPromptRef = useRef( false );\n\tconst {\n\t\tanswersLink,\n\t\tanswersLinkText,\n\t\tgravatars,\n\t\t// Use the attribute the track when we've finished fetching the prompt.\n\t\tpromptFetched,\n\t\tpromptId,\n\t\tpromptLabel,\n\t\tpromptText,\n\t\tshowLabel,\n\t\tshowResponses,\n\t\ttagsAdded,\n\t\tisBloganuary,\n\t} = attributes;\n\tconst blockProps = useBlockProps( { className: 'jetpack-blogging-prompt' } );\n\n\tconst setTagsAdded = state => setAttributes( { tagsAdded: state } );\n\n\t// Add the prompt tags to the post, if they haven't already been added.\n\tusePromptTags( promptId, tagsAdded, setTagsAdded );\n\n\tconst siteLanguage = useSelect( select => {\n\t\tconst { getEntityRecord, hasFinishedResolution } = select( 'core' );\n\t\tconst language = getEntityRecord( 'root', 'site' )?.language || 'en_US';\n\t\tconst hasFinishedResolving = hasFinishedResolution( 'getEntityRecord', [ 'root', 'site' ] );\n\t\treturn hasFinishedResolving ? language : null;\n\t}, [] );\n\n\t// Fetch the prompt by id, if present, otherwise the get the prompt for today.\n\tuseEffect( () => {\n\t\t// Only fetch the prompt one time when the block is inserted, after we know the site language.\n\t\tif ( ! siteLanguage || fetchingPromptRef.current || promptFetched ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst retryPrompt = () => {\n\t\t\tsetAttributes( { promptFetched: false, promptId: null, tagsAdded: false } );\n\t\t\tfetchingPromptRef.current = false;\n\t\t\tnoticeOperations.removeAllNotices();\n\t\t};\n\n\t\tconst errorMessage = message => (\n\t\t\t<>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %s is the error message. */\n\t\t\t\t\t__( 'Error while fetching prompt: %s', 'jetpack' ),\n\t\t\t\t\tmessage\n\t\t\t\t) }{ ' ' }\n\t\t\t\t\n\t\t\t\n\t\t);\n\n\t\tconst notFoundMessage = pId => (\n\t\t\t<>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d is the prompt id. */\n\t\t\t\t\t__( 'Prompt with id %d not found.', 'jetpack' ),\n\t\t\t\t\tpId\n\t\t\t\t) }{ ' ' }\n\t\t\t\t\n\t\t\t\n\t\t);\n\n\t\tlet path = '/wpcom/v3/blogging-prompts';\n\n\t\tif ( promptId ) {\n\t\t\tpath += '/' + encodeURIComponent( promptId );\n\t\t} else {\n\t\t\tconst date = new Date();\n\n\t\t\t// Current month and day with leading zeros.\n\t\t\tconst month = ( date.getMonth() + 1 ).toString().padStart( 2, '0' );\n\t\t\tconst day = date.getDate().toString().padStart( 2, '0' );\n\n\t\t\tpath += `?after=--${ month }-${ day }&order=desc`;\n\t\t}\n\n\t\tpath = addQueryArgs( path, {\n\t\t\t_locale: siteLanguage,\n\t\t\tforce_year: new Date()?.getFullYear(),\n\t\t} );\n\t\tfetchingPromptRef.current = true;\n\t\tapiFetch( { path } )\n\t\t\t.then( prompts => {\n\t\t\t\tconst promptData = promptId ? prompts : prompts[ 0 ];\n\t\t\t\tconst locale = languageToLocale( siteLanguage );\n\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tanswersLink: promptData.answered_link + `?locale=${ locale }`,\n\t\t\t\t\tanswersLinkText: promptData.answered_link_text,\n\t\t\t\t\tgravatars: promptData.answered_users_sample.map( ( { avatar } ) => ( { url: avatar } ) ),\n\t\t\t\t\tpromptFetched: true,\n\t\t\t\t\tpromptLabel: promptData.label,\n\t\t\t\t\tpromptText: promptData.text,\n\t\t\t\t\tpromptId: promptData.id,\n\t\t\t\t\tisBloganuary: !! promptData.bloganuary_id,\n\t\t\t\t} );\n\t\t\t} )\n\t\t\t.catch( error => {\n\t\t\t\tsetAttributes( { promptFetched: true } );\n\t\t\t\tconst message =\n\t\t\t\t\terror.code === 'rest_post_invalid_id' && promptId\n\t\t\t\t\t\t? notFoundMessage( promptId )\n\t\t\t\t\t\t: errorMessage( error.message );\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t} );\n\t}, [\n\t\tfetchingPromptRef,\n\t\tnoticeOperations,\n\t\tpromptFetched,\n\t\tpromptId,\n\t\tsetAttributes,\n\t\tsiteLanguage,\n\t] );\n\n\tconst onShowLabelChange = newValue => {\n\t\tsetAttributes( { showLabel: newValue } );\n\t};\n\n\tconst onShowResponsesChange = newValue => {\n\t\tsetAttributes( { showResponses: newValue } );\n\t};\n\n\tconst renderControls = () => (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n\tconst labelClassnames = clsx( [ 'jetpack-blogging-prompt__label' ], {\n\t\t'is-bloganuary-icon': isBloganuary,\n\t} );\n\n\tconst renderPrompt = () => (\n\t\t<>\n\t\t\t{ showLabel &&
      { promptLabel }
      }\n\n\t\t\t
      { promptText }
      \n\n\t\t\t{ showResponses && promptId && (\n\t\t\t\t
      \n\t\t\t\t\t{ gravatars &&\n\t\t\t\t\t\tgravatars.slice( 0, 3 ).map( ( { url } ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\turl && (\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/alt-text\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\n\t\t\t\t\t\n\t\t\t\t\t\t{ answersLinkText }\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t) }\n\t\t\n\t);\n\n\treturn (\n\t\t
      \n\t\t\t{ noticeUI }\n\t\t\t{ renderControls() }\n\n\t\t\t{ ! promptFetched ? (\n\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t) : (\n\t\t\t\trenderPrompt()\n\t\t\t) }\n\t\t
      \n\t);\n}\n\nexport default withNotices( BloggingPromptEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blogging-prompt/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nfunction BloggingPromptSave( { attributes } ) {\n\tconst {\n\t\tanswersLink,\n\t\tanswersLinkText,\n\t\tgravatars,\n\t\tpromptId,\n\t\tpromptLabel,\n\t\tpromptText,\n\t\tshowLabel,\n\t\tshowResponses,\n\t\tisBloganuary,\n\t} = attributes;\n\n\tconst blockProps = useBlockProps.save( { className: 'jetpack-blogging-prompt' } );\n\n\tconst labelClassnames = clsx( [ 'jetpack-blogging-prompt__label' ], {\n\t\t'is-bloganuary-icon': isBloganuary,\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t{ showLabel &&
      { promptLabel }
      }\n\t\t\t
      { promptText }
      \n\t\t\t{ showResponses && promptId && (\n\t\t\t\t
      \n\t\t\t\t\t{ gravatars.map( ( { url } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\turl && (\n\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/alt-text\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t\t\n\t\t\t\t\t\t{ answersLinkText }\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t) }\n\t\t
      \n\t);\n}\n\nexport default BloggingPromptSave;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-footer-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Footer\",\n\t\"description\": \"Block that displays the footer of the Mini-Cart block.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/filled-mini-cart-contents-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TotalsItem } from '@woocommerce/blocks-components';\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport { getCurrencyFromPriceResponse } from '@woocommerce/price-format';\nimport {\n\tusePaymentMethods,\n\tuseStoreCart,\n} from '@woocommerce/base-context/hooks';\nimport PaymentMethodIcons from '@woocommerce/base-components/cart-checkout/payment-method-icons';\nimport { getIconsFromPaymentMethods } from '@woocommerce/base-utils';\nimport { getSetting } from '@woocommerce/settings';\nimport { PaymentEventsProvider } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport { getTotalsItemDescription } from '../utils';\nimport './editor.scss';\n\nconst PaymentMethodIconsElement = (): JSX.Element => {\n\tconst { paymentMethods } = usePaymentMethods();\n\treturn (\n\t\t\n\t);\n};\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { cartTotals } = useStoreCart();\n\tconst subTotal = getSetting( 'displayCartPricesIncludingTax', false )\n\t\t? parseInt( cartTotals.total_items, 10 ) +\n\t\t parseInt( cartTotals.total_items_tax, 10 )\n\t\t: parseInt( cartTotals.total_items, 10 );\n\n\tconst TEMPLATE = [\n\t\t[ 'woocommerce/mini-cart-cart-button-block', {} ],\n\t\t[ 'woocommerce/mini-cart-checkout-button-block', {} ],\n\t];\n\n\treturn (\n\t\t
      \n\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
      \n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a configurable media component that allows users to personalize display settings and upload various media assets."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/story\",\n\t\"title\": \"Story\",\n\t\"description\": \"Add an interactive story.\",\n\t\"keywords\": [ \"story\", \"image\", \"video\", \"gallery\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"media\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"settings\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"mediaFiles\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"mediaFiles\": [\n\t\t\t\t{\n\t\t\t\t\t\"alt\": \"\",\n\t\t\t\t\t\"caption\": \"\",\n\t\t\t\t\t\"mime\": \"image/jpg\",\n\t\t\t\t\t\"type\": \"image\",\n\t\t\t\t\t\"id\": 22,\n\t\t\t\t\t\"url\": \"./storyExample1.png\"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/edit.js\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { isBlobURL } from '@wordpress/blob';\nimport { MediaPlaceholder, useBlockProps } from '@wordpress/block-editor';\nimport { withNotices } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport metadata from './block.json';\nimport Controls from './controls';\nimport StoryPlayer from './player';\n\nimport './editor.scss';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\nconst ALLOWED_MEDIA_PROPS = [\n\t'alt',\n\t'title',\n\t'id',\n\t'link',\n\t'type',\n\t'mime',\n\t'caption',\n\t'width',\n\t'height',\n];\nconst icon = getBlockIconComponent( metadata );\n\nexport const pickRelevantMediaFiles = media => {\n\tconst mediaProps = Object.fromEntries(\n\t\tObject.entries( media ).filter( ( [ k ] ) => ALLOWED_MEDIA_PROPS.includes( k ) )\n\t);\n\tmediaProps.url =\n\t\tmedia?.media_details?.original?.url ||\n\t\tmedia?.media_details?.videopress?.original ||\n\t\tmedia?.media_details?.sizes?.large?.source_url ||\n\t\tmedia?.sizes?.large?.url ||\n\t\tmedia.url;\n\tmediaProps.type = media.media_type || media.type;\n\tmediaProps.mime = media.mime_type || media.mime;\n\tmediaProps.title = mediaProps.title?.rendered || mediaProps.title;\n\tmediaProps.width = mediaProps.width || media.media_details?.width;\n\tmediaProps.height = mediaProps.height || media.media_details?.height;\n\treturn mediaProps;\n};\n\nexport default withNotices( function StoryEdit( {\n\tattributes,\n\tisSelected,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n} ) {\n\tconst { mediaFiles } = attributes;\n\tconst { lockPostSaving, unlockPostSaving } = useDispatch( 'core/editor' );\n\tconst blockProps = useBlockProps();\n\tconst lockName = 'storyBlockLock';\n\n\tconst onSelectMedia = newMediaFiles => {\n\t\tconst allMedia = newMediaFiles\n\t\t\t.map( newMedia => {\n\t\t\t\t// MediaPlaceholder passes only the media ids as value to MediaUpload, so we're only getting those back\n\t\t\t\tif ( ! isNaN( newMedia ) ) {\n\t\t\t\t\tconst existingMedia = mediaFiles.find( mediaFile => mediaFile.id === newMedia );\n\t\t\t\t\treturn existingMedia || { id: newMedia };\n\t\t\t\t}\n\t\t\t\treturn newMedia;\n\t\t\t} )\n\t\t\t.map( pickRelevantMediaFiles );\n\t\tconst uploadedMedias = allMedia.filter( media => ! isBlobURL( media.url ) );\n\t\t// prevent saving blob urls in mediaFiles block attribute\n\t\tif ( allMedia.length !== uploadedMedias.length ) {\n\t\t\tlockPostSaving( lockName );\n\t\t} else {\n\t\t\tunlockPostSaving( lockName );\n\t\t}\n\t\tsetAttributes( {\n\t\t\tmediaFiles: allMedia,\n\t\t} );\n\t};\n\n\tconst controls = (\n\t\t\n\t);\n\n\tconst hasImages = !! mediaFiles.length;\n\n\tconst mediaPlaceholder = (\n\t\t type + '/*' ).join( ',' ) }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\tmultiple=\"add\"\n\t\t\tvalue={ mediaFiles }\n\t\t\tnotices={ hasImages ? undefined : noticeUI }\n\t\t\tonError={ noticeOperations.createErrorNotice }\n\t\t/>\n\t);\n\n\tlet content;\n\n\tif ( ! hasImages ) {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t{ mediaPlaceholder }\n\t\t\t\n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t{ noticeUI }\n\t\t\t\t\n\t\t\t\t{ isSelected && mediaPlaceholder }\n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t\n\t\t\t{ content }\n\t\t
      \n\t);\n} );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/story/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default () => {\n\tconst blockProps = useBlockProps.save();\n\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build an adaptable block featuring configurable URL settings to enable seamless monetization strategies within your WordPress site."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/tock/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/tock\",\n\t\"title\": \"Tock\",\n\t\"description\": \"Reserve a table at your restaurant with Tock.\",\n\t\"keywords\": [ \"booking\", \"reservation\", \"restaurant\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": false\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"url\": \"roister\"\n\t\t},\n\t\t\"viewportWidth\": 250\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/tock/edit.js\nimport { useBlockProps, BlockControls } from '@wordpress/block-editor';\nimport {\n\tSandBox,\n\tTextControl,\n\tToolbarGroup,\n\tToolbarButton,\n\tButton,\n\tBaseControl,\n\tDropdown,\n} from '@wordpress/components';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { ENTER, ESCAPE } from '@wordpress/keycodes';\n\nimport './editor.scss';\n\nconst UrlDropdown = ( { tockUrl, setEditedUrl, setUrl, cancel } ) => {\n\tconst firstRender = useRef( true );\n\tconst committedChanges = useRef( false );\n\tconst handleSubmitOrCancel = ( event, onClose ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t'' !== tockUrl // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tcommitChanges( onClose );\n\t\t}\n\n\t\tif ( keyCode === ESCAPE ) {\n\t\t\tevent.preventDefault();\n\t\t\tcancel();\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst commitChanges = close => {\n\t\tsetUrl();\n\t\tcommittedChanges.current = true;\n\t\tclose();\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\tcommittedChanges.current ? ( committedChanges.current = false ) : cancel()\n\t\t\t\t}\n\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\tif ( firstRender.current && ! isOpen && ! tockUrl ) {\n\t\t\t\t\t\tfirstRender.current = false;\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tisOpen && cancel();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\tmyname',\n\t\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tb: ,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t>\n\t\t\t\t\t\t
      \n\t\t\t\t\t\t\t handleSubmitOrCancel( event, onClose ) }\n\t\t\t\t\t\t\t\tclassName=\"jetpack-tock-url-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t
      \n\t\t\t\t\t\t\t\t commitChanges( onClose ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t
      \n\t\t\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t/>\n\t\t
      \n\t);\n};\n\nconst TockPreview = ( { url, popoverAnchor } ) => {\n\tconst html = `\n\t\t
      \n\t\t\n\t\t\n\t`;\n\n\treturn (\n\t\t
      \n\t\t\t{\n\t\t\t\t// Related to this bug (https://github.com/WordPress/gutenberg/issues/16831), the\n\t\t\t\t// `SandBox` component won't rerun the scripts correctly when the injected `html` prop changes.\n\t\t\t\t// To work around that, we change the key of the component to force a new one render\n\t\t\t }\n\t\t\t\n\t\t\t{ /* Use an overlay to prevent interactivity with the preview, since the preview does not always resize correctly. */ }\n\t\t\t
      \n\t\t
      \n\t);\n};\n\nexport default function TockBlockEdit( { attributes, setAttributes, isSelected } ) {\n\tconst tockUrl = attributes.url ?? '';\n\tconst [ editedUrl, setEditedUrl ] = useState( tockUrl );\n\n\tconst setUrl = () => {\n\t\tconst newUrl = editedUrl.replace( /.*exploretock.com\\//, '' );\n\t\tsetEditedUrl( newUrl );\n\t\tsetAttributes( { url: newUrl } );\n\t};\n\n\tconst cancel = useCallback( () => {\n\t\tsetEditedUrl( tockUrl );\n\t}, [ tockUrl ] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tcancel();\n\t\t}\n\t}, [ isSelected, cancel ] );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Enable customers to filter the product grid by selecting one or more attributes, such as color. with these attributes: class name, attribute id, show counts, and 6 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/attribute-filter/block.json\n{\n\t\"name\": \"woocommerce/attribute-filter\",\n\t\"title\": \"Filter by Attribute Controls\",\n\t\"description\": \"Enable customers to filter the product grid by selecting one or more attributes, such as color.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"attributeId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"showCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"queryType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"or\"\n\t\t},\n\t\t\"headingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"displayStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"list\"\n\t\t},\n\t\t\"showFilterButton\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"selectType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"multiple\"\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/attribute-filter/edit.tsx\n/**\n * External dependencies\n */\nimport { sort } from 'fast-sort';\nimport { __, sprintf, _n, _x } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { Icon, category, external } from '@wordpress/icons';\nimport { SearchListControl } from '@woocommerce/editor-components/search-list-control';\nimport { getAdminLink, getSetting } from '@woocommerce/settings';\nimport BlockTitle from '@woocommerce/editor-components/block-title';\nimport clsx from 'clsx';\nimport { SearchListItem } from '@woocommerce/editor-components/search-list-control/types';\nimport { AttributeSetting } from '@woocommerce/types';\nimport {\n\tPlaceholder,\n\tDisabled,\n\tPanelBody,\n\tToggleControl,\n\tButton,\n\tToolbarGroup,\n\tNotice,\n\twithSpokenMessages,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\nimport type { EditProps, GetNotice } from './types';\nimport { UpgradeNotice } from '../filter-wrapper/upgrade';\n\nconst ATTRIBUTES = getSetting< AttributeSetting[] >( 'attributes', [] );\n\nconst noticeContent = {\n\tnoAttributes: __(\n\t\t'Please select an attribute to use this filter!',\n\t\t'woocommerce'\n\t),\n\tnoProducts: __(\n\t\t'There are no products with the selected attributes.',\n\t\t'woocommerce'\n\t),\n};\n\nconst getNotice: GetNotice = ( type ) => {\n\tconst content = noticeContent[ type ];\n\treturn content ? (\n\t\t\n\t\t\t

      { content }

      \n\t\t
      \n\t) : null;\n};\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tdebouncedSpeak,\n\tclientId,\n}: EditProps ) => {\n\tconst {\n\t\tattributeId,\n\t\tdisplayStyle,\n\t\theading,\n\t\theadingLevel,\n\t\tisPreview,\n\t\tqueryType,\n\t\tshowCounts,\n\t\tshowFilterButton,\n\t\tselectType,\n\t} = attributes;\n\n\tconst [ isEditing, setIsEditing ] = useState(\n\t\t! attributeId && ! isPreview\n\t);\n\n\tconst blockProps = useBlockProps();\n\n\tconst getBlockControls = () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t setIsEditing( ! isEditing ),\n\t\t\t\t\t\t\tisActive: isEditing,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\n\t\t);\n\t};\n\n\tconst onChange = ( selected: SearchListItem[] ) => {\n\t\tif ( ! selected || ! selected.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst selectedId = selected[ 0 ].id;\n\t\tconst productAttribute = ATTRIBUTES.find(\n\t\t\t( attribute ) => attribute.attribute_id === selectedId.toString()\n\t\t);\n\n\t\tif ( ! productAttribute || attributeId === selectedId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tattributeId: selectedId as number,\n\t\t} );\n\t};\n\n\tconst renderAttributeControl = ( {\n\t\tisCompact,\n\t}: {\n\t\tisCompact: boolean;\n\t} ) => {\n\t\tconst messages = {\n\t\t\tclear: __( 'Clear selected attribute', 'woocommerce' ),\n\t\t\tlist: __( 'Product Attributes', 'woocommerce' ),\n\t\t\tnoItems: __(\n\t\t\t\t\"Your store doesn't have any product attributes.\",\n\t\t\t\t'woocommerce'\n\t\t\t),\n\t\t\tsearch: __( 'Search for a product attribute:', 'woocommerce' ),\n\t\t\tselected: ( n: number ) =>\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %d is the number of attributes selected. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d attribute selected',\n\t\t\t\t\t\t'%d attributes selected',\n\t\t\t\t\t\tn,\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t),\n\t\t\t\t\tn\n\t\t\t\t),\n\t\t\tupdated: __(\n\t\t\t\t'Product attribute search results updated.',\n\t\t\t\t'woocommerce'\n\t\t\t),\n\t\t};\n\n\t\tconst list = sort(\n\t\t\tATTRIBUTES.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: parseInt( item.attribute_id, 10 ),\n\t\t\t\t\tname: item.attribute_label,\n\t\t\t\t};\n\t\t\t} )\n\t\t).asc( 'name' );\n\n\t\treturn (\n\t\t\t id === attributeId ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tmessages={ messages }\n\t\t\t\tisSingle\n\t\t\t\tisCompact={ isCompact }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst getInspectorControls = () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCounts: ! showCounts,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tselectType: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__multiple-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t{ selectType === 'multiple' && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tqueryType: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__conditions-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayStyle: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wc-block-attribute-filter__display-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowFilterButton: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ renderAttributeControl( { isCompact: true } ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tconst noAttributesPlaceholder = () => (\n\t\t }\n\t\t\tlabel={ __( 'Filter by Attribute', 'woocommerce' ) }\n\t\t\tinstructions={ __(\n\t\t\t\t'Display a list of filters based on the selected attributes.',\n\t\t\t\t'woocommerce'\n\t\t\t) }\n\t\t>\n\t\t\t

      \n\t\t\t\t{ __(\n\t\t\t\t\t\"Attributes are needed for filtering your products. You haven't created any attributes yet.\",\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t

      \n\t\t\t\n\t\t\t\t{ __( 'Add new attribute', 'woocommerce' ) + ' ' }\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t{ __( 'Learn more', 'woocommerce' ) }\n\t\t\t\n\t\t\n\t);\n\n\tconst onDone = () => {\n\t\tsetIsEditing( false );\n\t\tdebouncedSpeak(\n\t\t\t__(\n\t\t\t\t'Now displaying a preview of the Filter Products by Attribute block.',\n\t\t\t\t'woocommerce'\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderEditMode = () => {\n\t\treturn (\n\t\t\t }\n\t\t\t\tlabel={ __( 'Filter by Attribute', 'woocommerce' ) }\n\t\t\t>\n\t\t\t\t
      \n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Display a list of filters based on the selected attributes.',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t) }\n\t\t\t\t
      \n\t\t\t\t
      \n\t\t\t\t\t{ renderAttributeControl( { isCompact: false } ) }\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t\n\t\t);\n\t};\n\n\treturn Object.keys( ATTRIBUTES ).length === 0 ? (\n\t\tnoAttributesPlaceholder()\n\t) : (\n\t\t
      \n\t\t\t{ getBlockControls() }\n\t\t\t{ getInspectorControls() }\n\t\t\t{ isEditing ? (\n\t\t\t\trenderEditMode()\n\t\t\t) : (\n\t\t\t\t
      \n\t\t\t\t\t{ heading && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( { heading: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t) }\n\t\t
      \n\t);\n};\n\nexport default withSpokenMessages( Edit );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block enabling dynamic login/logout link display with configurable form presentation and current-page redirection options."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/loginout/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/loginout\",\n\t\"title\": \"Login/out\",\n\t\"category\": \"theme\",\n\t\"description\": \"Show login & logout links.\",\n\t\"keywords\": [ \"login\", \"logout\", \"form\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"displayLoginAsForm\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"redirectToCurrent\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"className\": true,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": false,\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-loginout\"\n}\n\n\n// File: packages/block-library/src/loginout/index.js\n/**\n * WordPress dependencies\n */\nimport { login as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Implement a Gutenberg block for Contains the block elements used to render a product."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-template/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-template\",\n\t\"title\": \"Product Template\",\n\t\"category\": \"woocommerce\",\n\t\"description\": \"Contains the block elements used to render a product.\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [\n\t\t\"queryId\",\n\t\t\"query\",\n\t\t\"queryContext\",\n\t\t\"displayLayout\",\n\t\t\"templateSlug\",\n\t\t\"postId\",\n\t\t\"queryContextIncludes\",\n\t\t\"collection\",\n\t\t\"__privateProductCollectionPreviewState\"\n\t],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"inserter\": false,\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowEditing\": false,\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowSizingOnChildren\": false,\n\t\t\t\"allowVerticalAlignment\": false\n\t\t},\n\t\t\"email\": true\n\t},\n\t\"editorStyle\": \"file:../woocommerce/product-template-editor.css\",\n\t\"style\": \"file:../woocommerce/product-template-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-template/edit.tsx\n/* eslint-disable @wordpress/no-unsafe-wp-apis */\n/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ProductCollectionAttributes } from '@woocommerce/blocks/product-collection/types';\nimport { getSettingWithCoercion } from '@woocommerce/settings';\nimport { isNumber, ProductResponseItem } from '@woocommerce/types';\nimport { ProductDataContextProvider } from '@woocommerce/shared-context';\nimport { withProduct } from '@woocommerce/block-hocs';\nimport type { BlockEditProps, BlockInstance } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseGetLocation,\n\tuseProductCollectionQueryContext,\n\tparseTemplateSlug,\n} from './utils';\nimport { getDefaultStockStatuses } from '../product-collection/constants';\n\nconst DEFAULT_QUERY_CONTEXT_ATTRIBUTES = [ 'collection' ];\n\nconst ProductTemplateInnerBlocks = () => {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wc-block-product' },\n\t\t{ __unstableDisableLayoutClassNames: true }\n\t);\n\treturn
    • ;\n};\n\ntype ProductTemplateBlockPreviewProps = {\n\tblocks: object[];\n\tblockContextId: string;\n\tisHidden: boolean;\n\tsetActiveBlockContextId: ( blockContextId: string ) => void;\n};\n\nconst ProductTemplateBlockPreview = ( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n}: ProductTemplateBlockPreviewProps ) => {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wc-block-product',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t\n\t);\n};\n\nconst MemoizedProductTemplateBlockPreview = memo( ProductTemplateBlockPreview );\n\ntype ProductContentProps = {\n\tattributes: { productId: string };\n\tdisplayTemplate: boolean;\n\tblocks: BlockInstance[];\n\tblockContext: {\n\t\tpostType: string;\n\t\tpostId: string;\n\t};\n\tsetActiveBlockContextId: ( id: string ) => void;\n};\n\nconst ProductContent = ( {\n\tdisplayTemplate,\n\tblocks,\n\tblockContext,\n\tsetActiveBlockContextId,\n}: ProductContentProps ) => {\n\treturn (\n\t\t\n\t\t\t{ displayTemplate ? : null }\n\t\t\t\n\t\t\n\t);\n};\n\n// This version of the component is used only when Product Collection is within Single Product block.\n// But because it's causing performance issues in editor, it's extracted to a separate component\n// and will be removed once all inner blocks are migrated from withProduct to useProduct HOC.\nconst ProductContentWithProduct = withProduct(\n\t( {\n\t\tisLoading,\n\t\tproduct,\n\t\tdisplayTemplate,\n\t\tblocks,\n\t\tblockContext,\n\t\tsetActiveBlockContextId,\n\t}: ProductContentProps & {\n\t\tisLoading: boolean;\n\t\tproduct: ProductResponseItem;\n\t} ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ displayTemplate ? : null }\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n);\n\nconst getOrderPropertiesForDefaultQuery = ( defaultSetting: string ) => {\n\tswitch ( defaultSetting ) {\n\t\tcase 'title':\n\t\t\treturn {\n\t\t\t\torderby: 'title',\n\t\t\t\torder: 'asc',\n\t\t\t};\n\t\tcase 'price':\n\t\t\treturn {\n\t\t\t\torderby: 'price',\n\t\t\t\torder: 'asc',\n\t\t\t};\n\t\tcase 'price-desc':\n\t\t\treturn {\n\t\t\t\torderby: 'price',\n\t\t\t\torder: 'desc',\n\t\t\t};\n\t\tcase 'popularity':\n\t\t\treturn {\n\t\t\t\torderby: 'popularity',\n\t\t\t\torder: 'desc',\n\t\t\t};\n\t\tcase 'rating':\n\t\t\treturn {\n\t\t\t\torderby: 'rating',\n\t\t\t\torder: 'desc',\n\t\t\t};\n\t\tcase 'date':\n\t\t\treturn {\n\t\t\t\torderby: 'date',\n\t\t\t\torder: 'desc',\n\t\t\t};\n\t}\n\n\treturn {\n\t\torderby: 'menu_order',\n\t\torder: 'asc',\n\t};\n};\n\nconst ProductTemplateEdit = (\n\tprops: BlockEditProps< {\n\t\tclientId: string;\n\t} > & {\n\t\tcontext: ProductCollectionAttributes;\n\t\t__unstableLayoutClassNames: string;\n\t}\n) => {\n\tconst {\n\t\tclientId,\n\t\tcontext: {\n\t\t\tquery: {\n\t\t\t\tperPage,\n\t\t\t\toffset = 0,\n\t\t\t\torder,\n\t\t\t\torderBy,\n\t\t\t\tsearch,\n\t\t\t\texclude,\n\t\t\t\tinherit,\n\t\t\t\ttaxQuery,\n\t\t\t\tpages,\n\t\t\t\t...restQueryArgs\n\t\t\t},\n\t\t\tqueryContext = [ { page: 1 } ],\n\t\t\ttemplateSlug,\n\t\t\tdisplayLayout: { type: layoutType, columns, shrinkColumns } = {\n\t\t\t\ttype: 'flex',\n\t\t\t\tcolumns: 3,\n\t\t\t\tshrinkColumns: false,\n\t\t\t},\n\t\t\tqueryContextIncludes = [],\n\t\t\t__privateProductCollectionPreviewState,\n\t\t},\n\t\t__unstableLayoutClassNames,\n\t} = props;\n\tconst location = useGetLocation( props.context, props.clientId );\n\n\tconst [ { page } ] = queryContext;\n\tconst [ activeBlockContextId, setActiveBlockContextId ] =\n\t\tuseState< string >();\n\tconst postType = 'product';\n\tconst loopShopPerPage = getSettingWithCoercion(\n\t\t'loopShopPerPage',\n\t\t12,\n\t\tisNumber\n\t);\n\n\t// Add default query context attributes to queryContextIncludes\n\tconst queryContextIncludesWithDefaults = [\n\t\t...new Set(\n\t\t\tqueryContextIncludes.concat( DEFAULT_QUERY_CONTEXT_ATTRIBUTES )\n\t\t),\n\t];\n\n\tconst productCollectionQueryContext = useProductCollectionQueryContext( {\n\t\tclientId,\n\t\tqueryContextIncludes: queryContextIncludesWithDefaults,\n\t} );\n\n\tconst { products, isInSingleProductBlock, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getEditedEntityRecord, getTaxonomies } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks, getBlockParentsByBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query: Record< string, unknown > = {\n\t\t\t\tpostType,\n\t\t\t\toffset: perPage ? perPage * ( page - 1 ) + offset : 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\tconst { taxonomy, slug } = parseTemplateSlug( templateSlug );\n\n\t\t\t\tif ( taxonomy && slug ) {\n\t\t\t\t\tconst taxonomyRecord = getEntityRecords(\n\t\t\t\t\t\t'taxonomy',\n\t\t\t\t\t\ttaxonomy,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( taxonomyRecord ) {\n\t\t\t\t\t\tconst taxonomyId = taxonomyRecord[ 0 ]?.id;\n\t\t\t\t\t\tif ( taxonomy === 'category' ) {\n\t\t\t\t\t\t\tquery.categories = taxonomyId;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If taxonomy is not `category`, we expect either `product_cat` or `product_tag`\n\t\t\t\t\t\t\tquery[ taxonomy ] = taxonomyId;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tquery.per_page = loopShopPerPage;\n\n\t\t\t\tconst settings = getEditedEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined\n\t\t\t\t) as unknown as Record< string, string >;\n\n\t\t\t\tconst orderProperties = getOrderPropertiesForDefaultQuery(\n\t\t\t\t\tsettings.woocommerce_default_catalog_orderby\n\t\t\t\t);\n\t\t\t\tquery.orderby = orderProperties.orderby;\n\t\t\t\tquery.order = orderProperties.order;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tproducts: getEntityRecords( 'postType', postType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t\tproductCollectionLocation: location,\n\t\t\t\t\tproductCollectionQueryContext,\n\t\t\t\t\tpreviewState: __privateProductCollectionPreviewState,\n\t\t\t\t\t/**\n\t\t\t\t\t * Use value of \"Out of stock visibility\" setting to determine\n\t\t\t\t\t * which stock statuses to include if inherit query\n\t\t\t\t\t * from template is true.\n\t\t\t\t\t */\n\t\t\t\t\t...( inherit && {\n\t\t\t\t\t\twoocommerceStockStatus: getDefaultStockStatuses(),\n\t\t\t\t\t} ),\n\t\t\t\t} ),\n\t\t\t\tisInSingleProductBlock:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\t'woocommerce/single-product',\n\t\t\t\t\t] ).length > 0,\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\tpage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\trestQueryArgs,\n\t\t\tlocation,\n\t\t\tproductCollectionQueryContext,\n\t\t\tloopShopPerPage,\n\t\t\t__privateProductCollectionPreviewState,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tproducts?.map( ( product ) => ( {\n\t\t\t\tpostType: product.type,\n\t\t\t\tpostId: product.id,\n\t\t\t} ) ),\n\t\t[ products ]\n\t);\n\n\tconst hasLayoutFlex = layoutType === 'flex' && columns > 1;\n\tlet customClassName = '';\n\n\t// We don't want to apply layout styles if there's no products.\n\tif ( products && products.length && hasLayoutFlex ) {\n\t\tconst dynamicGrid = `wc-block-product-template__responsive columns-${ columns }`;\n\t\tconst staticGrid = `is-flex-container columns-${ columns }`;\n\n\t\tcustomClassName = shrinkColumns ? dynamicGrid : staticGrid;\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t__unstableLayoutClassNames,\n\t\t\t'wc-block-product-template',\n\t\t\tcustomClassName,\n\t\t\t{ [ `is-product-collection-layout-${ layoutType }` ]: layoutType }\n\t\t),\n\t} );\n\n\tif ( ! products ) {\n\t\treturn (\n\t\t\t

      \n\t\t\t\t\n\t\t\t

      \n\t\t);\n\t}\n\n\tif ( ! products.length ) {\n\t\treturn (\n\t\t\t

      \n\t\t\t\t{ ' ' }\n\t\t\t\t{ __(\n\t\t\t\t\t'No products to display. Try adjusting the filters in the block settings panel.',\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t

      \n\t\t);\n\t}\n\n\tconst ProductContentComponent = isInSingleProductBlock\n\t\t? ProductContentWithProduct\n\t\t: ProductContent;\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t
        \n\t\t\t{ blockContexts &&\n\t\t\t\tblockContexts.map( ( blockContext ) => {\n\t\t\t\t\tconst displayTemplate =\n\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t( activeBlockContextId || blockContexts[ 0 ]?.postId );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t\t\t// @ts-ignore isLoading and product props are missing as they're coming from untyped withProduct HOC.\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t
      \n\t);\n};\n\nexport default ProductTemplateEdit;\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-template/save.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function Save() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom Gutenberg block enabling video embedding directly from WordPress media or new uploads, incorporating autoplay, caption, controls, and additional configurable settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/video/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/video\",\n\t\"title\": \"Video\",\n\t\"category\": \"media\",\n\t\"description\": \"Embed a video from your media library or upload a new one.\",\n\t\"keywords\": [ \"movie\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"autoplay\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"autoplay\"\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"figcaption\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"controls\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"controls\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"loop\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"loop\"\n\t\t},\n\t\t\"muted\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"muted\"\n\t\t},\n\t\t\"poster\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"poster\"\n\t\t},\n\t\t\"preload\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"preload\",\n\t\t\t\"default\": \"metadata\"\n\t\t},\n\t\t\"blob\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"local\"\n\t\t},\n\t\t\"src\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"src\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"playsInline\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"video\",\n\t\t\t\"attribute\": \"playsinline\"\n\t\t},\n\t\t\"tracks\": {\n\t\t\t\"role\": \"content\",\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"object\"\n\t\t\t},\n\t\t\t\"default\": []\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-video-editor\",\n\t\"style\": \"wp-block-video\"\n}\n\n\n// File: packages/block-library/src/video/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'src',\n\t\t\t\tcaption: 'caption',\n\t\t\t\tposter: 'poster',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'video' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/video/save.js\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Tracks from './tracks';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tautoplay,\n\t\tcaption,\n\t\tcontrols,\n\t\tloop,\n\t\tmuted,\n\t\tposter,\n\t\tpreload,\n\t\tsrc,\n\t\tplaysInline,\n\t\ttracks,\n\t} = attributes;\n\treturn (\n\t\t
      \n\t\t\t{ src && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t\n\t\t\t) }\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a Gutenberg block representing the cart subtotal, featuring configurable class name and lock settings to enhance block functionality."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-subtotal-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Subtotal\",\n\t\"description\": \"Shows the cart subtotal row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Block that displays the shopping button when the Mini-Cart is empty. with these attributes: lock, start shopping button label"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-shopping-button-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Shopping Button\",\n\t\"description\": \"Block that displays the shopping button when the Mini-Cart is empty.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": true,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": false,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t},\n\t\t\"startShoppingButtonLabel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"fill\",\n\t\t\t\"label\": \"Fill\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{\n\t\t\t\"name\": \"outline\",\n\t\t\t\"label\": \"Outline\"\n\t\t}\n\t],\n\t\"parent\": [ \"woocommerce/empty-mini-cart-contents-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\nimport EditableButton from '@woocommerce/editor-components/editable-button';\n\n/**\n * Internal dependencies\n */\nimport { defaultStartShoppingButtonLabel } from './constants';\nimport { getVariant } from '../utils';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tstartShoppingButtonLabel: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-button aligncenter',\n\t} );\n\tconst colorProps = useColorProps( attributes );\n\tconst { startShoppingButtonLabel } = attributes;\n\n\treturn (\n\t\t
      \n\t\t\t {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tstartShoppingButtonLabel: content,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tvariant={ getVariant( blockProps.className, 'contained' ) }\n\t\t\t\tstyle={ colorProps.style }\n\t\t\t/>\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a dynamic WordPress block empowering users to filter and showcase taxonomy terms using configurable search criteria and visual customization options for term and tag selection."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/terms-query/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/terms-query\",\n\t\"title\": \"Terms Query\",\n\t\"category\": \"theme\",\n\t\"description\": \"An advanced block that allows displaying taxonomy terms based on different query parameters and visual configurations.\",\n\t\"keywords\": [ \"terms\", \"taxonomy\", \"categories\", \"tags\", \"list\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"termQuery\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"perPage\": 10,\n\t\t\t\t\"taxonomy\": \"category\",\n\t\t\t\t\"order\": \"asc\",\n\t\t\t\t\"orderBy\": \"name\",\n\t\t\t\t\"include\": [],\n\t\t\t\t\"hideEmpty\": true,\n\t\t\t\t\"showNested\": false,\n\t\t\t\t\"inherit\": false\n\t\t\t}\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"templateSlug\" ],\n\t\"providesContext\": {\n\t\t\"termQuery\": \"termQuery\"\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"layout\": true,\n\t\t\"interactivity\": true\n\t}\n}\n\n\n// File: packages/block-library/src/terms-query/index.js\n/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {},\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/terms-query/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display a list of your most recent posts. that allows users to configure: categories, selected author, posts to show, and 15 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/latest-posts/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/latest-posts\",\n\t\"title\": \"Latest Posts\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display a list of your most recent posts.\",\n\t\"keywords\": [ \"recent posts\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"categories\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"object\"\n\t\t\t}\n\t\t},\n\t\t\"selectedAuthor\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"postsToShow\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"displayPostContent\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayPostContentRadio\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"excerpt\"\n\t\t},\n\t\t\"excerptLength\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 55\n\t\t},\n\t\t\"displayAuthor\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayPostDate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"postLayout\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"list\"\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"order\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"desc\"\n\t\t},\n\t\t\"orderBy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"date\"\n\t\t},\n\t\t\"displayFeaturedImage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"featuredImageAlign\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"left\", \"center\", \"right\" ]\n\t\t},\n\t\t\"featuredImageSizeSlug\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"thumbnail\"\n\t\t},\n\t\t\"featuredImageSizeWidth\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": null\n\t\t},\n\t\t\"featuredImageSizeHeight\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": null\n\t\t},\n\t\t\"addLinkToFeaturedImage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-latest-posts-editor\",\n\t\"style\": \"wp-block-latest-posts\"\n}\n\n\n// File: packages/block-library/src/latest-posts/index.js\n/**\n * WordPress dependencies\n */\nimport { postList as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a Gutenberg block enabling vertical spacing between content sections, with customizable height and width parameters for flexible layout control."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/spacer/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/spacer\",\n\t\"title\": \"Spacer\",\n\t\"category\": \"design\",\n\t\"description\": \"Add white space between blocks and customize its height.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"height\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"100px\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"orientation\" ],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-spacer-editor\",\n\t\"style\": \"wp-block-spacer\"\n}\n\n\n// File: packages/block-library/src/spacer/index.js\n/**\n * WordPress dependencies\n */\nimport { resizeCornerNE as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport transforms from './transforms';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/spacer/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, getSpacingPresetCssVar } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { height, width, style } = attributes;\n\tconst { layout: { selfStretch } = {} } = style || {};\n\t// If selfStretch is set to 'fill' or 'fit', don't set default height.\n\tconst finalHeight =\n\t\tselfStretch === 'fill' || selfStretch === 'fit' ? undefined : height;\n\treturn (\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that A collection of blocks that allow visitors to get around your site. with these attributes: ref, text color, custom text color, and 16 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/navigation/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/navigation\",\n\t\"title\": \"Navigation\",\n\t\"category\": \"theme\",\n\t\"allowedBlocks\": [\n\t\t\"core/navigation-link\",\n\t\t\"core/search\",\n\t\t\"core/social-links\",\n\t\t\"core/page-list\",\n\t\t\"core/spacer\",\n\t\t\"core/home-link\",\n\t\t\"core/site-title\",\n\t\t\"core/site-logo\",\n\t\t\"core/navigation-submenu\",\n\t\t\"core/loginout\",\n\t\t\"core/buttons\"\n\t],\n\t\"description\": \"A collection of blocks that allow visitors to get around your site.\",\n\t\"keywords\": [ \"menu\", \"navigation\", \"links\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"ref\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"textColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"rgbTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"backgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"rgbBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"showSubmenuIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"openSubmenusOnClick\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"overlayMenu\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"mobile\"\n\t\t},\n\t\t\"icon\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"handle\"\n\t\t},\n\t\t\"hasIcon\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"__unstableLocation\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"overlayBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customOverlayBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"overlayTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customOverlayTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"maxNestingLevel\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ]\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"textColor\": \"textColor\",\n\t\t\"customTextColor\": \"customTextColor\",\n\t\t\"backgroundColor\": \"backgroundColor\",\n\t\t\"customBackgroundColor\": \"customBackgroundColor\",\n\t\t\"overlayTextColor\": \"overlayTextColor\",\n\t\t\"customOverlayTextColor\": \"customOverlayTextColor\",\n\t\t\"overlayBackgroundColor\": \"overlayBackgroundColor\",\n\t\t\"customOverlayBackgroundColor\": \"customOverlayBackgroundColor\",\n\t\t\"fontSize\": \"fontSize\",\n\t\t\"customFontSize\": \"customFontSize\",\n\t\t\"showSubmenuIcon\": \"showSubmenuIcon\",\n\t\t\"openSubmenusOnClick\": \"openSubmenusOnClick\",\n\t\t\"style\": \"style\",\n\t\t\"maxNestingLevel\": \"maxNestingLevel\"\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"ariaLabel\": true,\n\t\t\"contentRole\": true,\n\t\t\"html\": false,\n\t\t\"inserter\": true,\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalSkipSerialization\": [ \"textDecoration\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": true,\n\t\t\t\"units\": [ \"px\", \"em\", \"rem\", \"vh\", \"vw\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowVerticalAlignment\": false,\n\t\t\t\"allowSizingOnChildren\": true,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"renaming\": false\n\t},\n\t\"editorStyle\": \"wp-block-navigation-editor\",\n\t\"style\": \"wp-block-navigation\"\n}\n\n\n// File: packages/block-library/src/navigation/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { navigation as icon } from '@wordpress/icons';\nimport { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\toverlayMenu: 'never',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Home' as in a website's home page.\n\t\t\t\t\tlabel: __( 'Home' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'About' as in a website's about page.\n\t\t\t\t\tlabel: __( 'About' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Contact' as in a website's contact page.\n\t\t\t\t\tlabel: __( 'Contact' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n\t__experimentalLabel: ( { ref } ) => {\n\t\tif ( ! ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst navigation = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\tref\n\t\t);\n\n\t\tif ( ! navigation?.title ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn decodeEntities( navigation.title );\n\t},\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/navigation/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tif ( attributes.ref ) {\n\t\t// Avoid rendering inner blocks when a ref is defined.\n\t\t// When this id is defined the inner blocks are loaded from the\n\t\t// `wp_navigation` entity rather than the hard-coded block html.\n\t\treturn;\n\t}\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce-product-elements block with customizable product id, is descendent of query loop, text align, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/rating-counter/block.json\n{\n\t\"name\": \"woocommerce/product-rating-counter\",\n\t\"title\": \"Product Rating Counter\",\n\t\"description\": \"Display the review count of a product\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"productId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"isDescendentOfQueryLoop\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"isDescendentOfSingleProductBlock\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDescendentOfSingleProductTemplate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"inserter\": false,\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"__experimentalSelector\": \".wc-block-components-product-rating-counter\"\n\t},\n\t\"usesContext\": [ \"query\", \"queryId\", \"postId\" ],\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"ancestor\": [ \"woocommerce/single-product\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/rating-counter/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport { useEffect } from '@wordpress/element';\nimport { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport { BlockAttributes } from './types';\nimport { useIsDescendentOfSingleProductBlock } from '../shared/use-is-descendent-of-single-product-block';\nimport { useIsDescendentOfSingleProductTemplate } from '../shared/use-is-descendent-of-single-product-template';\n\nconst Edit = (\n\tprops: BlockEditProps< BlockAttributes > & { context: Context }\n): JSX.Element => {\n\tconst { attributes, setAttributes, context } = props;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-woocommerce-product-rating-counter',\n\t} );\n\tconst blockAttrs = {\n\t\t...attributes,\n\t\t...context,\n\t\tshouldDisplayMockedReviewsWhenProductHasNoReviews: true,\n\t};\n\tconst isDescendentOfQueryLoop = Number.isFinite( context.queryId );\n\tconst { isDescendentOfSingleProductBlock } =\n\t\tuseIsDescendentOfSingleProductBlock( {\n\t\t\tblockClientId: blockProps?.id,\n\t\t} );\n\tlet { isDescendentOfSingleProductTemplate } =\n\t\tuseIsDescendentOfSingleProductTemplate();\n\n\tif ( isDescendentOfQueryLoop || isDescendentOfSingleProductBlock ) {\n\t\tisDescendentOfSingleProductTemplate = false;\n\t}\n\n\tuseEffect( () => {\n\t\tsetAttributes( {\n\t\t\tisDescendentOfQueryLoop,\n\t\t\tisDescendentOfSingleProductBlock,\n\t\t\tisDescendentOfSingleProductTemplate,\n\t\t} );\n\t}, [\n\t\tsetAttributes,\n\t\tisDescendentOfQueryLoop,\n\t\tisDescendentOfSingleProductBlock,\n\t\tisDescendentOfSingleProductTemplate,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign || '' } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
      \n\t\t\t\t\n\t\t\t
      \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a widgets block with customizable columns, block layout, feed u r l, and 7 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/rss/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/rss\",\n\t\"title\": \"RSS\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display entries from any RSS or Atom feed.\",\n\t\"keywords\": [ \"atom\", \"feed\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t},\n\t\t\"blockLayout\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"list\"\n\t\t},\n\t\t\"feedURL\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"itemsToShow\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"displayExcerpt\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayAuthor\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"displayDate\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"excerptLength\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 55\n\t\t},\n\t\t\"openInNewTab\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": false,\n\t\t\t\t\"margin\": false\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-rss-editor\",\n\t\"style\": \"wp-block-rss\"\n}\n\n\n// File: packages/block-library/src/rss/index.js\n/**\n * WordPress dependencies\n */\nimport { rss as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tfeedURL: 'https://wordpress.org',\n\t\t},\n\t},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Add a user’s avatar. that allows users to configure: user id, size, is link, link target"}, {"role": "assistant", "content": "// File: packages/block-library/src/avatar/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/avatar\",\n\t\"title\": \"Avatar\",\n\t\"category\": \"theme\",\n\t\"description\": \"Add a user’s avatar.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"userId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"size\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 96\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\", \"postId\", \"commentId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": true,\n\t\t\"alignWide\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"color\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"border\": \".wp-block-avatar img\",\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-avatar img\"\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-avatar-editor\",\n\t\"style\": \"wp-block-avatar\"\n}\n\n\n// File: packages/block-library/src/avatar/index.js\n/**\n * WordPress dependencies\n */\nimport { commentAuthorAvatar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a flexible Gutenberg block designed to embed images with comprehensive configuration options, including blob, url, alt, and 14 supplementary attribute settings for refined visual presentation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/image/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/image\",\n\t\"title\": \"Image\",\n\t\"category\": \"media\",\n\t\"usesContext\": [\n\t\t\"allowResize\",\n\t\t\"imageCrop\",\n\t\t\"fixedHeight\",\n\t\t\"postId\",\n\t\t\"postType\",\n\t\t\"queryId\"\n\t],\n\t\"description\": \"Insert an image to make a visual statement.\",\n\t\"keywords\": [ \"img\", \"photo\", \"picture\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"blob\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"local\"\n\t\t},\n\t\t\"url\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"src\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"alt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"alt\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"caption\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"figcaption\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"lightbox\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"enabled\": {\n\t\t\t\t\"type\": \"boolean\"\n\t\t\t}\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"img\",\n\t\t\t\"attribute\": \"title\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"href\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"rel\"\n\t\t},\n\t\t\"linkClass\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"class\"\n\t\t},\n\t\t\"id\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"height\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"aspectRatio\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"scale\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"sizeSlug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkDestination\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure > a\",\n\t\t\t\"attribute\": \"target\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"align\": [ \"left\", \"center\", \"right\", \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": {\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"border\": \".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder\",\n\t\t\"shadow\": \".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder\",\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-image img, .wp-block-image .components-placeholder\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"default\",\n\t\t\t\"label\": \"Default\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{ \"name\": \"rounded\", \"label\": \"Rounded\" }\n\t],\n\t\"editorStyle\": \"wp-block-image-editor\",\n\t\"style\": \"wp-block-image\"\n}\n\n\n// File: packages/block-library/src/image/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { image as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsizeSlug: 'large',\n\t\t\turl: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg',\n\t\t\t// translators: Caption accompanying an image of the Mont Blanc, which serves as an example for the Image block.\n\t\t\tcaption: __( 'Mont Blanc appears—still, snowy, and serene.' ),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tconst { caption, alt, url } = attributes;\n\n\t\t\tif ( ! url ) {\n\t\t\t\treturn __( 'Empty' );\n\t\t\t}\n\n\t\t\tif ( ! alt ) {\n\t\t\t\treturn caption || '';\n\t\t\t}\n\n\t\t\t// This is intended to be read by a screen reader.\n\t\t\t// A period simply means a pause, no need to translate it.\n\t\t\treturn alt + ( caption ? '. ' + caption : '' );\n\t\t}\n\t},\n\tgetEditWrapperProps( attributes ) {\n\t\treturn {\n\t\t\t'data-align': attributes.align,\n\t\t};\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'image',\n\t\t\tlabel: __( 'Image' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'url',\n\t\t\t\tcaption: 'caption',\n\t\t\t\talt: 'alt',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'href',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t\tdestination: 'linkDestination',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'alt',\n\t\t\tlabel: __( 'Alt text' ),\n\t\t\ttype: 'text',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'image' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/image/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\turl,\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tid,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\ttitle,\n\t\tmetadata: { bindings = {} } = {},\n\t} = attributes;\n\n\tconst newRel = ! rel ? undefined : rel;\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( {\n\t\t// All other align classes are handled by block supports.\n\t\t// `{ align: 'none' }` is unique to transforms for the image block.\n\t\talignnone: 'none' === align,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'is-resized': width || height,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst imageClasses = clsx( borderProps.className, {\n\t\t[ `wp-image-${ id }` ]: !! id,\n\t} );\n\n\tconst image = (\n\t\t\n\t);\n\n\tconst displayCaption =\n\t\t! RichText.isEmpty( caption ) ||\n\t\tbindings.caption ||\n\t\tbindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst figure = (\n\t\t<>\n\t\t\t{ href ? (\n\t\t\t\t\n\t\t\t\t\t{ image }\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\timage\n\t\t\t) }\n\t\t\t{ displayCaption && (\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n\n\treturn (\n\t\t
      \n\t\t\t{ figure }\n\t\t
      \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a customizable podcast block enabling users to choose and play episodes, with comprehensive configuration settings for podcast URL, episode selection, display quantity, and additional parameters."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/podcast-player\",\n\t\"title\": \"Podcast Player\",\n\t\"description\": \"Select and play episodes from a single podcast.\",\n\t\"keywords\": [ \"audio\", \"embed\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"anchor\": false,\n\t\t\"customClassName\": true,\n\t\t\"className\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"selectedEpisodes\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"itemsToShow\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 5\n\t\t},\n\t\t\"showCoverArt\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showEpisodeTitle\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showEpisodeDescription\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"primaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customPrimaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexPrimaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"secondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customSecondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexSecondaryColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"backgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hexBackgroundColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"exampleFeedData\": {\n\t\t\t\"type\": \"object\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"customPrimaryColor\": \"GREEN\",\n\t\t\t\"hexPrimaryColor\": \"GREEN\",\n\t\t\t\"exampleFeedData\": {\n\t\t\t\t\"title\": \"Jetpack Example Podcast\",\n\t\t\t\t\"link\": \"https://jetpack.com\",\n\t\t\t\t\"cover\": \"https://jetpackme.files.wordpress.com/2020/05/jetpack-example-podcast-cover.png?w=160\",\n\t\t\t\t\"tracks\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"3\",\n\t\t\t\t\t\t\"title\": \"3. Our third episode\",\n\t\t\t\t\t\t\"duration\": \"14:58\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"2\",\n\t\t\t\t\t\t\"title\": \"2. Interview with a special guest\",\n\t\t\t\t\t\t\"duration\": \"19:17\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"1\",\n\t\t\t\t\t\t\"title\": \"1. Welcome to Example Podcast\",\n\t\t\t\t\t\t\"duration\": \"11:25\"\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/edit.js\nimport { isWpcomPlatformSite } from '@automattic/jetpack-script-data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\twithColors,\n\tPanelColorSettings,\n\tContrastChecker,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tButton,\n\tExternalLink,\n\tPanelBody,\n\tPlaceholder,\n\tRangeControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\twithNotices,\n\tToggleControl,\n\tSpinner,\n\tComboboxControl,\n} from '@wordpress/components';\nimport { compose, withInstanceId } from '@wordpress/compose';\nimport { withDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useState, useRef, useReducer, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport debugFactory from 'debug';\nimport { debounce } from 'lodash';\nimport { applyFallbackStyles } from '../../shared/apply-fallback-styles';\nimport { maybeCopyElementsToSiteEditorContext } from '../../shared/block-editor-asset-loader';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport { fetchPodcastFeed, fetchTrackQuantity } from './api';\nimport metadata from './block.json';\nimport PodcastPlayer from './components/podcast-player';\nimport { PODCAST_FEED, EMBED_BLOCK } from './constants';\nimport { queueMusic } from './icons/';\nimport { podcastPlayerReducer, actions } from './state';\nimport { makeCancellable } from './utils';\n\nimport './editor.scss';\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst debug = debugFactory( 'jetpack:podcast-player:edit' );\nconst noop = () => {};\n\n// Support page link.\nconst supportUrl = isWpcomPlatformSite()\n\t? 'http://en.support.wordpress.com/wordpress-editor/blocks/podcast-player-block/'\n\t: 'https://jetpack.com/support/jetpack-blocks/podcast-player-block/';\n\nconst PodcastPlayerEdit = ( {\n\tinstanceId,\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations: { createErrorNotice, removeAllNotices },\n\tnoticeUI,\n\tprimaryColor: primaryColorProp,\n\tsetPrimaryColor,\n\tsecondaryColor: secondaryColorProp,\n\tsetSecondaryColor,\n\tfallbackTextColor,\n\tbackgroundColor: backgroundColorProp,\n\tsetBackgroundColor,\n\tfallbackBackgroundColor,\n\tisSelected,\n\treplaceWithEmbedBlock,\n} ) => {\n\t// Validated attributes.\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\tconst {\n\t\turl,\n\t\tselectedEpisodes,\n\t\titemsToShow,\n\t\tshowCoverArt,\n\t\tshowEpisodeTitle,\n\t\tshowEpisodeDescription,\n\t\texampleFeedData,\n\t} = validatedAttributes;\n\n\tconst playerId = `jetpack-podcast-player-block-${ instanceId }`;\n\n\tconst blockProps = useBlockProps();\n\tconst [ hasMigratedStyles, setHasMigratedStyles ] = useState( false );\n\tconst [ defaultMaxItems, setDefaultMaxItems ] = useState( 10 );\n\n\t// State.\n\tconst cancellableFetch = useRef( undefined );\n\tconst [ { selectedGuid, checkUrl, ...state }, dispatch ] = useReducer( podcastPlayerReducer, {\n\t\teditedUrl: url || '',\n\t\tisEditing: ! url && ! exampleFeedData,\n\t\tisLoading: false,\n\t\tfeedData: exampleFeedData || {},\n\t\tisInteractive: false,\n\t\tselectedGuid: selectedEpisodes?.[ 0 ]?.guid,\n\t\tcheckUrl: url || '',\n\t} );\n\n\tconst fetchFeed = useMemo(\n\t\t() =>\n\t\t\tdebounce( requestParams => {\n\t\t\t\tdispatch( { type: actions.START_FETCH } );\n\t\t\t\tcancellableFetch.current?.cancel();\n\t\t\t\tcancellableFetch.current = makeCancellable(\n\t\t\t\t\tfetchPodcastFeed( { ...requestParams, fetchEpisodeOptions: true } )\n\t\t\t\t);\n\n\t\t\t\tcancellableFetch.current.promise.then(\n\t\t\t\t\tresponse => {\n\t\t\t\t\t\tremoveAllNotices();\n\t\t\t\t\t\tif ( response?.isCanceled ) {\n\t\t\t\t\t\t\tdebug( 'Block was unmounted during fetch', response );\n\t\t\t\t\t\t\treturn; // bail if canceled to avoid setting state\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check what type of response we got and act accordingly.\n\t\t\t\t\t\tswitch ( response?.type ) {\n\t\t\t\t\t\t\tcase PODCAST_FEED:\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\turl: requestParams.url,\n\t\t\t\t\t\t\t\t\tselectedEpisodes: requestParams.guids.map( guid => ( { guid } ) ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn dispatch( { type: actions.FEED_RECEIVED, payload: response.data } );\n\t\t\t\t\t\t\tcase EMBED_BLOCK:\n\t\t\t\t\t\t\t\treturn replaceWithEmbedBlock();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\tif ( error?.isCanceled ) {\n\t\t\t\t\t\t\tdebug( 'Block was unmounted during fetch', error );\n\t\t\t\t\t\t\treturn; // bail if canceled to avoid setting state\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Show error and allow to edit URL.\n\t\t\t\t\t\tdebug( 'feed error', error );\n\t\t\t\t\t\tremoveAllNotices();\n\t\t\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t\t\t// Error messages already come localized.\n\t\t\t\t\t\t\terror.message ||\n\t\t\t\t\t\t\t\t// Fallback to a generic message.\n\t\t\t\t\t\t\t\t__( \"Your podcast couldn't be embedded. Please double check your URL.\", 'jetpack' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdispatch( { type: actions.START_EDITING } );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}, 300 ),\n\t\t[ replaceWithEmbedBlock, setAttributes, createErrorNotice, removeAllNotices ]\n\t);\n\n\t// Call once on mount or unmount (the return callback).\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcancellableFetch?.current?.cancel?.();\n\t\t};\n\t}, [] );\n\n\t// The Podcast player audio element requires wpmedialement styles.\n\t// These aren't available in the Site Editor context, so we have to copy them in.\n\tconst podCastPlayerRef = useCallback(\n\t\tnode => {\n\t\t\tif ( node !== null && ! hasMigratedStyles ) {\n\t\t\t\tmaybeCopyElementsToSiteEditorContext(\n\t\t\t\t\t[ 'link#mediaelement-css', 'link#wp-mediaelement-css' ],\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tsetHasMigratedStyles( true );\n\t\t\t}\n\t\t},\n\t\t[ hasMigratedStyles ]\n\t);\n\n\t// Load RSS feed initially and when the feed or selected episode changes.\n\tuseEffect( () => {\n\t\t// Don't do anything if no url is set.\n\t\tif ( '' === checkUrl ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfetchFeed( {\n\t\t\turl: checkUrl,\n\t\t\tguids: selectedGuid ? [ selectedGuid ] : [],\n\t\t} );\n\n\t\treturn () => cancellableFetch?.current?.cancel?.();\n\t}, [ fetchFeed, checkUrl, selectedGuid ] );\n\n\t// Retrieve tracks quantity to fetch; the jetpack_podcast_helper_tracks_quantity filter value.\n\tuseEffect( () => {\n\t\tfetchTrackQuantity().then( response => {\n\t\t\tsetDefaultMaxItems( response );\n\t\t} );\n\t}, [] );\n\n\t// Make sure itemsToShow is 1 when we have a selected episode\n\tuseEffect( () => {\n\t\tif ( selectedGuid && 1 !== itemsToShow ) {\n\t\t\tsetAttributes( { itemsToShow: 1 } );\n\t\t}\n\t}, [ selectedGuid, itemsToShow, setAttributes ] );\n\n\t// Bring back the overlay after block gets deselected.\n\tuseEffect( () => {\n\t\tif ( ! isSelected && state.isInteractive ) {\n\t\t\tdispatch( { type: actions.PREVENT_INTERACTIONS } );\n\t\t}\n\t}, [ isSelected, state.isInteractive ] );\n\n\t/**\n\t * Check if the current URL of the Podcast RSS feed is valid. If so, set the\n\t * block attribute and changes the edition mode. This function is bound to the\n\t * onSubmit event for the form.\n\t *\n\t * @param {object} event - Form on submit event object.\n\t */\n\tconst checkPodcastLink = event => {\n\t\tevent.preventDefault();\n\n\t\tif ( '' === state.editedUrl ) {\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Ensure URL has `http` appended to it (if it doesn't already) before we\n\t\t * accept it as the entered URL.\n\t\t */\n\t\tconst prependedURL = prependHTTP( state.editedUrl );\n\n\t\tif ( ! isURL( prependedURL ) ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\t__( \"Your podcast couldn't be embedded. Please double check your URL.\", 'jetpack' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Short-circuit feed fetching if we tried before, use useEffect otherwise.\n\t\t * @see {@link https://github.com/Automattic/jetpack/pull/15213}\n\t\t */\n\t\tif ( prependedURL === checkUrl ) {\n\t\t\t// Reset the feedData, so that we display the spinner.\n\t\t\tdispatch( { type: actions.CLEAR_FEED } );\n\t\t\tfetchFeed( {\n\t\t\t\turl: checkUrl,\n\t\t\t\tguids: selectedEpisodes[ 0 ]?.guid ? [ selectedEpisodes[ 0 ].guid ] : [],\n\t\t\t} );\n\t\t} else {\n\t\t\tdispatch( { type: actions.CHECK_URL, payload: prependedURL } );\n\t\t}\n\n\t\t/*\n\t\t * Also update the temporary `input` value in order that clicking `Replace`\n\t\t * in the UI will show the \"corrected\" version of the URL (ie: with `http`\n\t\t * prepended if it wasn't originally present).\n\t\t */\n\t\tdispatch( { type: actions.FINISH_EDITING, payload: prependedURL } );\n\t};\n\n\tlet content;\n\n\tif ( state.isEditing ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t{ noticeUI }\n\t\t\t\t\t dispatch( { type: actions.EDIT_URL, payload: editedUrl } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Learn more about embeds', 'jetpack' ) }\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t\n\t\t);\n\t}\n\n\t// With no tracks data, this is either the first load or the URL has changed\n\t// and we need the data to refresh before displaying the other controls.\n\telse if ( ! state.feedData.tracks?.length ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t} else {\n\t\tconst createColorChangeHandler = ( colorAttr, handler ) => color => {\n\t\t\tsetAttributes( { [ colorAttr ]: color } );\n\t\t\thandler( color );\n\t\t};\n\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t dispatch( { type: actions.START_EDITING } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Replace', 'jetpack' ) }\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{ ( ComboboxControl || 0 === selectedEpisodes.length ) && (\n\t\t\t\t\t\t\t setAttributes( { itemsToShow: selectedGuid ? 1 : value } ) }\n\t\t\t\t\t\t\t\tmin={ DEFAULT_MIN_ITEMS }\n\t\t\t\t\t\t\t\tmax={ defaultMaxItems }\n\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t\tdisabled={ !! selectedGuid }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ComboboxControl && (\n\t\t\t\t\t\t\t dispatch( { type: actions.SELECT_EPISODE, payload: guid } ) }\n\t\t\t\t\t\t\t\toptions={ state.feedData.options || [] }\n\t\t\t\t\t\t\t\tlabel={ __( 'Episode', 'jetpack' ) }\n\t\t\t\t\t\t\t\tonFilterValueChange={ noop }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t setAttributes( { showCoverArt: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t setAttributes( { showEpisodeTitle: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t setAttributes( { showEpisodeDescription: value } ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Disabled because the overlay div doesn't actually have a role or\n\t\t\t\t\t * functionality as far as the user is concerned. We're just catching\n\t\t\t\t\t * the first click so that the block can be selected without\n\t\t\t\t\t * interacting with the embed preview that the overlay covers.\n\t\t\t\t\t */ }\n\t\t\t\t\t{ /* eslint-disable jsx-a11y/no-static-element-interactions */ }\n\t\t\t\t\t{ ! state.isInteractive && ! state.isLoading && (\n\t\t\t\t\t\t dispatch( { type: actions.MAKE_INTERACTIVE } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-static-element-interactions */ }\n\t\t\t\t\t{ state.isLoading && (\n\t\t\t\t\t\t
      \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
      \n\t\t\t\t\t) }\n\t\t\t\t
      \n\t\t\t\n\t\t);\n\t}\n\n\treturn
      { content }
      ;\n};\n\nexport default compose( [\n\twithDispatch( ( dispatch, { clientId, attributes } ) => {\n\t\treturn {\n\t\t\treplaceWithEmbedBlock() {\n\t\t\t\tdispatch( 'core/block-editor' ).replaceBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tcreateBlock( 'core/embed', {\n\t\t\t\t\t\turl: attributes.url,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} ),\n\twithColors( 'backgroundColor', { primaryColor: 'color' }, { secondaryColor: 'color' } ),\n\twithNotices,\n\twithInstanceId,\n\tapplyFallbackStyles,\n] )( PodcastPlayerEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/podcast-player/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { url } = attributes;\n\tif ( ! url || url === '' ) {\n\t\treturn;\n\t}\n\n\tconst blockProps = useBlockProps.save();\n\treturn (\n\t\t\n\t\t\t{ url }\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display post author details such as name, avatar, and bio. that allows users to configure: text align, avatar size, show avatar, and 4 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/post-author/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-author\",\n\t\"title\": \"Author\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display post author details such as name, avatar, and bio.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"avatarSize\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 48\n\t\t},\n\t\t\"showAvatar\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showBio\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"byline\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\", \"postId\", \"queryId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"filter\": {\n\t\t\t\"duotone\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"filter\": {\n\t\t\t\"duotone\": \".wp-block-post-author .wp-block-post-author__avatar img\"\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-post-author-editor\",\n\t\"style\": \"wp-block-post-author\"\n}\n\n\n// File: packages/block-library/src/post-author/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postAuthor as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 350,\n\t\tattributes: {\n\t\t\tshowBio: true,\n\t\t\tbyline: __( 'Posted by' ),\n\t\t},\n\t},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a plugin that Adds infinite scrolling support to the front-end blog post view for themes, pulling the next set of posts automatically into view when the reader approaches the bottom of the page. with the following capabilities: settings api, enqueue scripts"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/modules/infinite-scroll/infinity.php\n 'scroll', // scroll | click\n\t\t\t'requested_type' => 'scroll', // store the original type for use when logic overrides it\n\t\t\t'footer_widgets' => false, // true | false | sidebar_id | array of sidebar_ids -- last two are checked with is_active_sidebar\n\t\t\t'container' => 'content', // container html id\n\t\t\t'wrapper' => true, // true | false | html class -- the html class.\n\t\t\t'render' => false, // optional function, otherwise the `content` template part will be used\n\t\t\t'footer' => true, // boolean to enable or disable the infinite footer | string to provide an html id to derive footer width from\n\t\t\t'footer_callback' => false, // function to be called to render the IS footer, in place of the default\n\t\t\t'posts_per_page' => false, // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page -- int | false to set based on IS type\n\t\t\t'click_handle' => true, // boolean to enable or disable rendering the click handler div. If type is click and this is false, page must include its own trigger with the HTML ID `infinite-handle`.\n\t\t);\n\n\t\tif ( self::$settings === null ) {\n\t\t\t$css_pattern = '#[^A-Z\\d\\-_]#i';\n\n\t\t\t$settings = $defaults;\n\t\t\t// Validate settings passed through add_theme_support()\n\t\t\t$_settings = get_theme_support( 'infinite-scroll' );\n\n\t\t\tif ( is_array( $_settings ) ) {\n\t\t\t\t// Preferred implementation, where theme provides an array of options\n\t\t\t\tif ( isset( $_settings[0] ) && is_array( $_settings[0] ) ) {\n\t\t\t\t\tforeach ( $_settings[0] as $key => $value ) {\n\t\t\t\t\t\tswitch ( $key ) {\n\t\t\t\t\t\t\tcase 'type':\n\t\t\t\t\t\t\t\tif ( in_array( $value, array( 'scroll', 'click' ), true ) ) {\n\t\t\t\t\t\t\t\t\t$settings['requested_type'] = $value;\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $settings['requested_type'];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'footer_widgets':\n\t\t\t\t\t\t\t\tif ( is_string( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = sanitize_title( $value );\n\t\t\t\t\t\t\t\t} elseif ( is_array( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = array_map( 'sanitize_title', $value );\n\t\t\t\t\t\t\t\t} elseif ( is_bool( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'container':\n\t\t\t\t\t\t\tcase 'wrapper':\n\t\t\t\t\t\t\t\tif ( 'wrapper' === $key && is_bool( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$value = preg_replace( $css_pattern, '', $value );\n\n\t\t\t\t\t\t\t\t\tif ( ! empty( $value ) ) {\n\t\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'render':\n\t\t\t\t\t\t\t\tif ( false !== $value && is_callable( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'footer':\n\t\t\t\t\t\t\t\tif ( is_bool( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t} elseif ( is_string( $value ) ) {\n\t\t\t\t\t\t\t\t\t$value = preg_replace( $css_pattern, '', $value );\n\n\t\t\t\t\t\t\t\t\tif ( ! empty( $value ) ) {\n\t\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'footer_callback':\n\t\t\t\t\t\t\t\tif ( is_callable( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = false;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'posts_per_page':\n\t\t\t\t\t\t\t\tif ( is_numeric( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = (int) $value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'click_handle':\n\t\t\t\t\t\t\t\tif ( is_bool( $value ) ) {\n\t\t\t\t\t\t\t\t\t$settings[ $key ] = $value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} elseif ( is_string( $_settings[0] ) ) {\n\t\t\t\t\t// Checks below are for backwards compatibility\n\n\t\t\t\t\t// Container to append new posts to\n\t\t\t\t\t$settings['container'] = preg_replace( $css_pattern, '', $_settings[0] );\n\n\t\t\t\t\t// Wrap IS elements?\n\t\t\t\t\tif ( isset( $_settings[1] ) ) {\n\t\t\t\t\t\t$settings['wrapper'] = (bool) $_settings[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Always ensure all values are present in the final array\n\t\t\t$settings = wp_parse_args( $settings, $defaults );\n\n\t\t\t// Check if a legacy `infinite_scroll_has_footer_widgets()` function is defined and override the footer_widgets parameter's value.\n\t\t\t// Otherwise, if a widget area ID or array of IDs was provided in the footer_widgets parameter, check if any contains any widgets.\n\t\t\t// It is safe to use `is_active_sidebar()` before the sidebar is registered as this function doesn't check for a sidebar's existence when determining if it contains any widgets.\n\t\t\tif ( function_exists( 'infinite_scroll_has_footer_widgets' ) ) {\n\t\t\t\t// @phan-suppress-next-line PhanUndeclaredFunction -- Checked above. See also https://github.com/phan/phan/issues/1204.\n\t\t\t\t$settings['footer_widgets'] = (bool) infinite_scroll_has_footer_widgets();\n\t\t\t} elseif ( is_array( $settings['footer_widgets'] ) ) {\n\t\t\t\t$sidebar_ids = $settings['footer_widgets'];\n\t\t\t\t$settings['footer_widgets'] = false;\n\n\t\t\t\tforeach ( $sidebar_ids as $sidebar_id ) {\n\t\t\t\t\tif ( is_active_sidebar( $sidebar_id ) ) {\n\t\t\t\t\t\t$settings['footer_widgets'] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tunset( $sidebar_ids );\n\t\t\t\tunset( $sidebar_id );\n\t\t\t} elseif ( is_string( $settings['footer_widgets'] ) ) {\n\t\t\t\t$settings['footer_widgets'] = (bool) is_active_sidebar( $settings['footer_widgets'] );\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Filter Infinite Scroll's `footer_widgets` parameter.\n\t\t\t *\n\t\t\t * @module infinite-scroll\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param bool $settings['footer_widgets'] Does the current theme have Footer Widgets.\n\t\t\t */\n\t\t\t$settings['footer_widgets'] = apply_filters( 'infinite_scroll_has_footer_widgets', $settings['footer_widgets'] );\n\n\t\t\t// Finally, after all of the sidebar checks and filtering, ensure that a boolean value is present, otherwise set to default of `false`.\n\t\t\tif ( ! is_bool( $settings['footer_widgets'] ) ) {\n\t\t\t\t$settings['footer_widgets'] = false;\n\t\t\t}\n\n\t\t\t// Ensure that IS is enabled and no footer widgets exist if the IS type isn't already \"click\".\n\t\t\tif ( 'click' !== $settings['type'] ) {\n\t\t\t\t// Check the setting status\n\t\t\t\t$disabled = '' === get_option( self::$option_name_enabled ) ? true : false;\n\n\t\t\t\t// Footer content or Reading option check\n\t\t\t\tif ( $settings['footer_widgets'] || $disabled ) {\n\t\t\t\t\t$settings['type'] = 'click';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Force display of the click handler and attendant bits when the type isn't `click`\n\t\t\tif ( 'click' !== $settings['type'] ) {\n\t\t\t\t$settings['click_handle'] = true;\n\t\t\t}\n\n\t\t\t// Store final settings in a class static to avoid reparsing\n\t\t\tself::$settings = $settings;\n\t\t}\n\n\t\t/**\n\t\t * Filter the array of Infinite Scroll settings.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param array $settings Array of Infinite Scroll settings.\n\t\t */\n\t\t$filtered_settings = apply_filters( 'infinite_scroll_settings', self::$settings );\n\n\t\t// Ensure all properties are still set.\n\t\treturn (object) wp_parse_args( $filtered_settings, $defaults );\n\t}\n\n\t/**\n\t * Number of posts per page.\n\t *\n\t * @uses self::wp_query, self::get_settings, apply_filters\n\t * @return int\n\t */\n\tpublic static function posts_per_page() {\n\t\t$settings = self::get_settings();\n\t\t$posts_per_page = $settings->posts_per_page ? $settings->posts_per_page : self::wp_query()->get( 'posts_per_page' );\n\t\t$posts_per_page_core_option = get_option( 'posts_per_page' );\n\n\t\t// If Infinite Scroll is set to click, and if the site owner changed posts_per_page, let's use that.\n\t\tif (\n\t\t\t'click' === $settings->type\n\t\t\t\t&& ( '10' !== $posts_per_page_core_option )\n\t\t) {\n\t\t\t$posts_per_page = $posts_per_page_core_option;\n\t\t}\n\n\t\t// Take JS query into consideration here.\n\t\t$posts_per_page_in_request = isset( $_REQUEST['query_args']['posts_per_page'] ) ? (int) $_REQUEST['query_args']['posts_per_page'] : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended\n\t\tif ( $posts_per_page_in_request > 0 &&\n\t\t\tself::MAX_ALLOWED_POSTS_PER_PAGE_ΙΝ_REQUEST >= $posts_per_page_in_request\n\t\t) {\n\t\t\t$posts_per_page = $posts_per_page_in_request;\n\t\t}\n\n\t\t/**\n\t\t * Filter the number of posts per page.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 6.0.0\n\t\t *\n\t\t * @param int $posts_per_page The number of posts to display per page.\n\t\t */\n\t\treturn (int) apply_filters( 'infinite_scroll_posts_per_page', $posts_per_page );\n\t}\n\n\t/**\n\t * Retrieve the query used with Infinite Scroll\n\t *\n\t * @global $wp_the_query\n\t * @uses apply_filters\n\t * @return object\n\t */\n\tpublic static function wp_query() {\n\t\tglobal $wp_the_query;\n\t\t/**\n\t\t * Filter the Infinite Scroll query object.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.2.1\n\t\t *\n\t\t * @param WP_Query $wp_the_query WP Query.\n\t\t */\n\t\treturn apply_filters( 'infinite_scroll_query_object', $wp_the_query );\n\t}\n\n\t/**\n\t * Has infinite scroll been triggered?\n\t */\n\tpublic static function got_infinity() {\n\t\t/**\n\t\t * Filter the parameter used to check if Infinite Scroll has been triggered.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 3.9.0\n\t\t *\n\t\t * @param bool isset( $_GET[ 'infinity' ] ) Return true if the \"infinity\" parameter is set.\n\t\t */\n\t\treturn apply_filters( 'infinite_scroll_got_infinity', isset( $_GET['infinity'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\t}\n\n\t/**\n\t * Is this guaranteed to be the last batch of posts?\n\t */\n\tpublic static function is_last_batch() {\n\t\t/**\n\t\t * Override whether or not this is the last batch for a request\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 4.8.0\n\t\t *\n\t\t * @param bool|null null Bool if value should be overridden, null to determine from query\n\t\t * @param object self::wp_query() WP_Query object for current request\n\t\t * @param object self::get_settings() Infinite Scroll settings\n\t\t */\n\t\t$override = apply_filters( 'infinite_scroll_is_last_batch', null, self::wp_query(), self::get_settings() ); // phpcs:ignore WordPress.WP.ClassNameCase.Incorrect -- False positive.\n\t\tif ( is_bool( $override ) ) {\n\t\t\treturn $override;\n\t\t}\n\n\t\t$entries = (int) self::wp_query()->found_posts;\n\t\t$posts_per_page = self::posts_per_page();\n\n\t\t// This is to cope with an issue in certain themes or setups where posts are returned but found_posts is 0.\n\t\tif ( 0 === $entries ) {\n\t\t\treturn ( ! is_countable( self::wp_query()->posts ) || ( count( self::wp_query()->posts ) < $posts_per_page ) );\n\t\t}\n\t\t$paged = max( 1, (int) self::wp_query()->get( 'paged' ) );\n\n\t\t// Are there enough posts for more than the first page?\n\t\tif ( $entries <= $posts_per_page ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Calculate entries left after a certain number of pages\n\t\tif ( $paged && $paged > 1 ) {\n\t\t\t$entries -= $posts_per_page * $paged;\n\t\t}\n\n\t\t// Are there some entries left to display?\n\t\treturn $entries <= 0;\n\t}\n\n\t/**\n\t * The more tag will be ignored by default if the blog page isn't our homepage.\n\t * Let's force the $more global to false.\n\t *\n\t * @param array $array - the_post array.\n\t * @return array\n\t */\n\tpublic function preserve_more_tag( $array ) {\n\t\tglobal $more;\n\n\t\tif ( self::got_infinity() ) {\n\t\t\t$more = 0; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- 0 = show content up to the more tag. Add more link.\n\t\t}\n\n\t\treturn $array;\n\t}\n\n\t/**\n\t * Add a checkbox field to Settings > Reading\n\t * for enabling infinite scroll.\n\t *\n\t * Only show if the current theme supports infinity.\n\t *\n\t * @uses current_theme_supports, add_settings_field, __, register_setting\n\t * @action admin_init\n\t * @return null\n\t */\n\tpublic function settings_api_init() {\n\t\tif ( ! current_theme_supports( 'infinite-scroll' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add the setting field [infinite_scroll] and place it in Settings > Reading\n\t\tadd_settings_field( self::$option_name_enabled, '' . esc_html__( 'Infinite Scroll Behavior', 'jetpack' ) . '', array( $this, 'infinite_setting_html' ), 'reading' );\n\t\tregister_setting( 'reading', self::$option_name_enabled, 'esc_attr' );\n\t}\n\n\t/**\n\t * HTML code to display a checkbox true/false option\n\t * for the infinite_scroll setting.\n\t */\n\tpublic function infinite_setting_html() {\n\t\t$settings = self::get_settings();\n\n\t\t// If the blog has footer widgets, show a notice instead of the checkbox\n\t\tif ( $settings->footer_widgets || 'click' === $settings->requested_type ) {\n\t\t\techo '';\n\t\t} else {\n\t\t\techo '';\n\t\t\t// translators: the number of posts to show on each page load.\n\t\t\techo '

      ' . esc_html( sprintf( _n( 'Shows %s post on each load.', 'Shows %s posts on each load.', self::posts_per_page(), 'jetpack' ), number_format_i18n( self::posts_per_page() ) ) ) . '

      ';\n\t\t}\n\t}\n\n\t/**\n\t * Does the legwork to determine whether the feature is enabled.\n\t *\n\t * @uses current_theme_supports, self::archive_supports_infinity, self::get_settings, add_filter, wp_enqueue_script, plugins_url, wp_enqueue_style, add_action\n\t * @action template_redirect\n\t * @return null\n\t */\n\tpublic function action_template_redirect() {\n\t\t// Check that we support infinite scroll, and are on the home page.\n\t\tif ( ! current_theme_supports( 'infinite-scroll' ) || ! self::archive_supports_infinity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$id = self::get_settings()->container;\n\n\t\t// Check that we have an id.\n\t\tif ( empty( $id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// AMP infinite scroll functionality will start on amp_load_hooks().\n\t\tif ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add our scripts.\n\t\twp_register_script(\n\t\t\t'the-neverending-homepage',\n\t\t\tAssets::get_file_url_for_environment(\n\t\t\t\t'_inc/build/infinite-scroll/infinity.min.js',\n\t\t\t\t'modules/infinite-scroll/infinity.js'\n\t\t\t),\n\t\t\tarray(),\n\t\t\tJETPACK__VERSION . '-is5.0.1', // Added for ability to cachebust on WP.com.\n\t\t\ttrue\n\t\t);\n\n\t\t// Add our default styles.\n\t\twp_register_style( 'the-neverending-homepage', plugins_url( 'infinity.css', __FILE__ ), array(), '20140422' );\n\n\t\t// Make sure there are enough posts for IS\n\t\tif ( self::is_last_batch() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add our scripts.\n\t\twp_enqueue_script( 'the-neverending-homepage' );\n\n\t\t// Add our default styles.\n\t\twp_enqueue_style( 'the-neverending-homepage' );\n\n\t\tadd_action( 'wp_footer', array( $this, 'action_wp_footer_settings' ), 2 );\n\n\t\tadd_action( 'wp_footer', array( $this, 'action_wp_footer' ), 21 ); // Core prints footer scripts at priority 20, so we just need to be one later than that\n\n\t\tadd_filter( 'infinite_scroll_results', array( $this, 'filter_infinite_scroll_results' ), 10, 3 );\n\t}\n\n\t/**\n\t * Initialize the Customizer logic separately from the main JS.\n\t *\n\t * @since 8.4.0\n\t */\n\tpublic function init_customizer_assets() {\n\t\t// Add our scripts.\n\t\twp_register_script(\n\t\t\t'the-neverending-homepage-customizer',\n\t\t\tAssets::get_file_url_for_environment(\n\t\t\t\t'_inc/build/infinite-scroll/infinity-customizer.min.js',\n\t\t\t\t'modules/infinite-scroll/infinity-customizer.js'\n\t\t\t),\n\t\t\tarray( 'jquery', 'customize-base' ),\n\t\t\tJETPACK__VERSION . '-is5.0.0', // Added for ability to cachebust on WP.com.\n\t\t\ttrue\n\t\t);\n\n\t\twp_enqueue_script( 'the-neverending-homepage-customizer' );\n\t}\n\n\t/**\n\t * Returns classes to be added to . If it's enabled, 'infinite-scroll'. If set to continuous scroll, adds 'neverending' too.\n\t *\n\t * @since 4.7.0 No longer added as a 'body_class' filter but passed to JS environment and added using JS.\n\t *\n\t * @return string\n\t */\n\tpublic function body_class() {\n\t\t$settings = self::get_settings();\n\t\t$classes = '';\n\t\t// Do not add infinity-scroll class if disabled through the Reading page\n\t\t$disabled = '' === get_option( self::$option_name_enabled ) ? true : false;\n\t\tif ( ! $disabled || 'click' === $settings->type ) {\n\t\t\t$classes = 'infinite-scroll';\n\n\t\t\tif ( 'scroll' === $settings->type ) {\n\t\t\t\t$classes .= ' neverending';\n\t\t\t}\n\t\t}\n\n\t\treturn $classes;\n\t}\n\n\t/**\n\t * In case IS is activated on search page, we have to exclude initially loaded posts which match the keyword by title, not the content as they are displayed before content-matching ones\n\t *\n\t * @uses self::wp_query\n\t * @uses self::get_last_post_date\n\t * @uses self::has_only_title_matching_posts\n\t * @return array\n\t */\n\tpublic function get_excluded_posts() {\n\n\t\t$excluded_posts = array();\n\t\t// loop through posts returned by wp_query call\n\t\tforeach ( self::wp_query()->get_posts() as $post ) {\n\t\t\tif ( ! $post instanceof \\WP_Post ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$orderby = isset( self::wp_query()->query_vars['orderby'] ) ? self::wp_query()->query_vars['orderby'] : '';\n\t\t\t$post_date = ( ! empty( $post->post_date ) ? $post->post_date : false );\n\t\t\tif ( 'modified' === $orderby || false === $post_date ) {\n\t\t\t\t$post_date = $post->post_modified;\n\t\t\t}\n\n\t\t\t// in case all posts initially displayed match the keyword by title we add em all to excluded posts array\n\t\t\t// else, we add only posts which are older than last_post_date param as newer are natually excluded by last_post_date condition in the SQL query\n\t\t\tif ( self::has_only_title_matching_posts() || $post_date <= self::get_last_post_date() ) {\n\t\t\t\tarray_push( $excluded_posts, $post->ID );\n\t\t\t}\n\t\t}\n\t\treturn $excluded_posts;\n\t}\n\n\t/**\n\t * In case IS is active on search, we have to exclude posts matched by title rather than by post_content in order to prevent dupes on next pages\n\t *\n\t * @uses self::wp_query\n\t * @uses self::get_excluded_posts\n\t * @return array\n\t */\n\tpublic function get_query_vars() {\n\n\t\t$query_vars = self::wp_query()->query_vars;\n\t\t// applies to search page only\n\t\tif ( true === self::wp_query()->is_search() ) {\n\t\t\t// set post__not_in array in query_vars in case it does not exists\n\t\t\tif ( false === isset( $query_vars['post__not_in'] ) ) {\n\t\t\t\t$query_vars['post__not_in'] = array();\n\t\t\t}\n\t\t\t// get excluded posts\n\t\t\t$excluded = self::get_excluded_posts();\n\t\t\t// merge them with other post__not_in posts (eg.: sticky posts)\n\t\t\t$query_vars['post__not_in'] = array_merge( $query_vars['post__not_in'], $excluded );\n\t\t}\n\t\treturn $query_vars;\n\t}\n\n\t/**\n\t * This function checks whether all posts returned by initial wp_query match the keyword by title\n\t * The code used in this function is borrowed from WP_Query class where it is used to construct like conditions for keywords\n\t *\n\t * @uses self::wp_query\n\t * @return bool\n\t */\n\tpublic function has_only_title_matching_posts() {\n\n\t\t// apply following logic for search page results only\n\t\tif ( false === self::wp_query()->is_search() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// grab the last posts in the stack as if the last one is title-matching the rest is title-matching as well\n\t\t$post = end( self::wp_query()->posts );\n\n\t\t// code inspired by WP_Query class\n\t\tif ( preg_match_all( '/\".*?(\"|$)|((?<=[\\t \",+])|^)[^\\t \",+]+/', self::wp_query()->get( 's' ), $matches ) ) {\n\t\t\t$search_terms = self::wp_query()->query_vars['search_terms'] ?? null;\n\t\t\t// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence\n\t\t\tif ( empty( $search_terms ) || ! is_countable( $search_terms ) || count( $search_terms ) > 9 ) {\n\t\t\t\t$search_terms = array( self::wp_query()->get( 's' ) );\n\t\t\t}\n\t\t} else {\n\t\t\t$search_terms = array( self::wp_query()->get( 's' ) );\n\t\t}\n\n\t\t// actual testing. As search query combines multiple keywords with AND, it's enough to check if any of the keywords is present in the title\n\t\t$term = current( $search_terms );\n\t\tif ( ! empty( $term ) && str_contains( $post->post_title, $term ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Grab the timestamp for the initial query's last post.\n\t *\n\t * This takes into account the query's 'orderby' parameter and returns\n\t * false if the posts are not ordered by date.\n\t *\n\t * @uses self::got_infinity\n\t * @uses self::has_only_title_matching_posts\n\t * @uses self::wp_query\n\t * @return string 'Y-m-d H:i:s' or false\n\t */\n\tpublic function get_last_post_date() {\n\t\tif ( self::got_infinity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! self::wp_query()->have_posts() ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// In case there are only title-matching posts in the initial WP_Query result, we don't want to use the last_post_date param yet\n\t\tif ( true === self::has_only_title_matching_posts() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$post = end( self::wp_query()->posts );\n\t\t$orderby = isset( self::wp_query()->query_vars['orderby'] ) ?\n\t\t\tself::wp_query()->query_vars['orderby'] : '';\n\t\t$post_date = ( ! empty( $post->post_date ) ? $post->post_date : false );\n\t\tswitch ( $orderby ) {\n\t\t\tcase 'modified':\n\t\t\t\treturn $post->post_modified;\n\t\t\tcase 'date':\n\t\t\tcase '':\n\t\t\t\treturn $post_date;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the appropriate `wp_posts` table field for a given query's\n\t * 'orderby' parameter, if applicable.\n\t *\n\t * @param object $query - an optional query object.\n\t * @uses self::wp_query\n\t * @return string or false\n\t */\n\tpublic function get_query_sort_field( $query = null ) {\n\t\tif ( empty( $query ) ) {\n\t\t\t$query = self::wp_query();\n\t\t}\n\n\t\t$orderby = isset( $query->query_vars['orderby'] ) ? $query->query_vars['orderby'] : '';\n\n\t\tswitch ( $orderby ) {\n\t\t\tcase 'modified':\n\t\t\t\treturn 'post_modified';\n\t\t\tcase 'date':\n\t\t\tcase '':\n\t\t\t\treturn 'post_date';\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Create a where clause that will make sure post queries return posts\n\t * in the correct order, without duplicates, if a new post is added\n\t * and we're sorting by post date.\n\t *\n\t * @global $wpdb\n\t * @param string $where - the where clause.\n\t * @param object $query - the query.\n\t * @uses apply_filters\n\t * @filter posts_where\n\t * @return string\n\t */\n\tpublic function query_time_filter( $where, $query ) {\n\t\tif ( self::got_infinity() ) {\n\t\t\tglobal $wpdb;\n\n\t\t\t$sort_field = self::get_query_sort_field( $query );\n\n\t\t\tif ( 'post_date' !== $sort_field ||\n\t\t\t! isset( $_REQUEST['query_args']['order'] ) || 'DESC' !== $_REQUEST['query_args']['order'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\t\t\t\treturn $where;\n\t\t\t}\n\n\t\t\t$query_before = isset( $_REQUEST['query_before'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['query_before'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\n\t\t\tif ( empty( $query_before ) ) {\n\t\t\t\treturn $where;\n\t\t\t}\n\n\t\t\t// Construct the date query using our timestamp\n\t\t\t$clause = $wpdb->prepare( \" AND {$wpdb->posts}.post_date <= %s\", $query_before );\n\n\t\t\t/**\n\t\t\t * Filter Infinite Scroll's SQL date query making sure post queries\n\t\t\t * will always return results prior to (descending sort)\n\t\t\t * or before (ascending sort) the last post date.\n\t\t\t *\n\t\t\t * @deprecated 14.0\n\t\t\t *\n\t\t\t * @module infinite-scroll\n\t\t\t *\n\t\t\t * @param string $clause SQL Date query.\n\t\t\t * @param object $query Query.\n\t\t\t * @param string $operator @deprecated Query operator.\n\t\t\t * @param string $last_post_date @deprecated Last Post Date timestamp.\n\t\t\t */\n\t\t\t$operator = '<';\n\t\t\t$last_post_date = isset( $_REQUEST['last_post_date'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['last_post_date'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes to the site\n\t\t\t$where .= apply_filters_deprecated( 'infinite_scroll_posts_where', array( $clause, $query, $operator, $last_post_date ), '14.0', '' );\n\t\t}\n\n\t\treturn $where;\n\t}\n\n\t/**\n\t * Let's overwrite the default post_per_page setting to always display a fixed amount.\n\t *\n\t * @param object $query - the query.\n\t * @uses is_admin, self::archive_supports_infinity, self::get_settings\n\t */\n\tpublic function posts_per_page_query( $query ) {\n\t\tif ( ! is_admin() && self::archive_supports_infinity() && $query->is_main_query() ) {\n\t\t\t$query->set( 'posts_per_page', self::posts_per_page() );\n\t\t}\n\t}\n\n\t/**\n\t * Check if the IS output should be wrapped in a div.\n\t * Setting value can be a boolean or a string specifying the class applied to the div.\n\t *\n\t * @uses self::get_settings\n\t * @return bool\n\t */\n\tpublic function has_wrapper() {\n\t\treturn (bool) self::get_settings()->wrapper;\n\t}\n\n\t/**\n\t * Returns the Ajax url\n\t *\n\t * @global $wp\n\t * @uses home_url, add_query_arg, apply_filters\n\t * @return string\n\t */\n\tpublic function ajax_url() {\n\t\t$base_url = set_url_scheme( home_url( '/' ) );\n\n\t\t$ajaxurl = add_query_arg( array( 'infinity' => 'scrolling' ), $base_url );\n\n\t\t/**\n\t\t * Filter the Infinite Scroll Ajax URL.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param string $ajaxurl Infinite Scroll Ajax URL.\n\t\t */\n\t\treturn apply_filters( 'infinite_scroll_ajax_url', $ajaxurl );\n\t}\n\n\t/**\n\t * Our own Ajax response, avoiding calling admin-ajax\n\t */\n\tpublic function ajax_response() {\n\t\t// Only proceed if the url query has a key of \"Infinity\"\n\t\tif ( ! self::got_infinity() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// This should already be defined below, but make sure.\n\t\tif ( ! defined( 'DOING_AJAX' ) ) {\n\t\t\tdefine( 'DOING_AJAX', true );\n\t\t}\n\n\t\t@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged\n\t\tsend_nosniff_header();\n\n\t\t/**\n\t\t * Fires at the end of the Infinite Scroll Ajax response.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t */\n\t\tdo_action( 'custom_ajax_infinite_scroll' );\n\t\tdie( '0' );\n\t}\n\n\t/**\n\t * Alias for renamed class method.\n\t *\n\t * Previously, JS settings object was unnecessarily output in the document head.\n\t * When the hook was changed, the method name no longer made sense.\n\t */\n\tpublic function action_wp_head() {\n\t\t$this->action_wp_footer_settings();\n\t}\n\n\t/**\n\t * Prints the relevant infinite scroll settings in JS.\n\t *\n\t * @global $wp_rewrite\n\t * @uses self::get_settings, esc_js, esc_url_raw, self::has_wrapper, __, apply_filters, do_action, self::get_query_vars\n\t * @action wp_footer\n\t */\n\tpublic function action_wp_footer_settings() {\n\t\tglobal $wp_rewrite;\n\t\tglobal $currentday;\n\n\t\t$settings = self::get_settings();\n\n\t\t// Default click handle text\n\t\t$click_handle_text = __( 'Older posts', 'jetpack' );\n\n\t\t// If a single CPT is displayed, use its plural name instead of \"posts\"\n\t\t// Could be empty (posts) or an array of multiple post types.\n\t\t// In the latter two cases cases, the default text is used, leaving the `infinite_scroll_js_settings` filter for further customization.\n\t\t$post_type = self::wp_query()->get( 'post_type' );\n\n\t\t// If it's a taxonomy, try to change the button text.\n\t\tif ( is_tax() ) {\n\t\t\t// Get current taxonomy slug.\n\t\t\t$taxonomy_slug = self::wp_query()->get( 'taxonomy' );\n\n\t\t\t// Get taxonomy settings.\n\t\t\t$taxonomy = get_taxonomy( $taxonomy_slug );\n\n\t\t\t// Check if the taxonomy is attached to one post type only and use its plural name.\n\t\t\t// If not, use \"Posts\" without confusing the users.\n\t\t\tif (\n\t\t\t\tis_a( $taxonomy, 'WP_Taxonomy' )\n\t\t\t\t&& is_countable( $taxonomy->object_type )\n\t\t\t\t&& ! empty( $taxonomy->object_type )\n\t\t\t\t&& count( $taxonomy->object_type ) < 2\n\t\t\t) {\n\t\t\t\t$post_type = $taxonomy->object_type[0];\n\t\t\t}\n\t\t}\n\n\t\tif ( is_string( $post_type ) && ! empty( $post_type ) ) {\n\t\t\t$post_type = get_post_type_object( $post_type );\n\n\t\t\tif ( is_object( $post_type ) && ! is_wp_error( $post_type ) ) {\n\t\t\t\tif ( isset( $post_type->labels->name ) ) {\n\t\t\t\t\t$cpt_text = $post_type->labels->name;\n\t\t\t\t} elseif ( isset( $post_type->label ) ) {\n\t\t\t\t\t$cpt_text = $post_type->label;\n\t\t\t\t}\n\n\t\t\t\tif ( isset( $cpt_text ) ) {\n\t\t\t\t\t/* translators: %s is the name of a custom post type */\n\t\t\t\t\t$click_handle_text = sprintf( __( 'More %s', 'jetpack' ), $cpt_text );\n\t\t\t\t\tunset( $cpt_text );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tunset( $post_type );\n\n\t\t// Base JS settings\n\t\t$js_settings = array(\n\t\t\t'id' => $settings->container,\n\t\t\t'ajaxurl' => esc_url_raw( self::ajax_url() ),\n\t\t\t'type' => esc_js( $settings->type ),\n\t\t\t'wrapper' => self::has_wrapper(),\n\t\t\t'wrapper_class' => is_string( $settings->wrapper ) ? esc_js( $settings->wrapper ) : 'infinite-wrap',\n\t\t\t'footer' => is_string( $settings->footer ) ? esc_js( $settings->footer ) : $settings->footer,\n\t\t\t'click_handle' => esc_js( $settings->click_handle ),\n\t\t\t'text' => esc_js( $click_handle_text ),\n\t\t\t'totop' => __( 'Scroll back to top', 'jetpack' ),\n\t\t\t'currentday' => $currentday,\n\t\t\t'order' => 'DESC',\n\t\t\t'scripts' => array(),\n\t\t\t'styles' => array(),\n\t\t\t'google_analytics' => false,\n\t\t\t'offset' => max( 1, self::wp_query()->get( 'paged' ) ), // Pass through the current page so we can use that to offset the first load.\n\t\t\t'history' => array(\n\t\t\t\t'host' => preg_replace( '#^http(s)?://#i', '', untrailingslashit( esc_url( get_home_url() ) ) ),\n\t\t\t\t'path' => self::get_request_path(),\n\t\t\t\t'use_trailing_slashes' => $wp_rewrite->use_trailing_slashes,\n\t\t\t\t'parameters' => self::get_request_parameters(),\n\t\t\t),\n\t\t\t'query_args' => self::get_query_vars(),\n\t\t\t'query_before' => current_time( 'mysql' ),\n\t\t\t'last_post_date' => self::get_last_post_date(),\n\t\t\t'body_class' => self::body_class(),\n\t\t\t'loading_text' => __( 'Loading new page', 'jetpack' ),\n\t\t);\n\n\t\t// Optional order param\n\t\tif ( isset( $_REQUEST['order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\t\t\t$order = strtoupper( sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\n\t\t\tif ( in_array( $order, array( 'ASC', 'DESC' ), true ) ) {\n\t\t\t\t$js_settings['order'] = $order;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Filter the Infinite Scroll JS settings outputted in the head.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param array $js_settings Infinite Scroll JS settings.\n\t\t */\n\t\t$js_settings = apply_filters( 'infinite_scroll_js_settings', $js_settings );\n\n\t\t/**\n\t\t * Fires before Infinite Scroll outputs inline JavaScript in the head.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t */\n\t\tdo_action( 'infinite_scroll_wp_head' );\n\n\t\t?>\n\t\t\n\t\tusing_permalinks() ) {\n\t\t\tglobal $wp;\n\n\t\t\t// If called too early, bail\n\t\t\tif ( ! isset( $wp->request ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Determine path for paginated version of current request\n\t\t\tif ( preg_match( '#' . preg_quote( $wp_rewrite->pagination_base, '#' ) . '/\\d+/?$#i', $wp->request ) ) {\n\t\t\t\t$path = preg_replace( '#' . preg_quote( $wp_rewrite->pagination_base, '#' ) . '/\\d+$#i', $wp_rewrite->pagination_base . '/%d', $wp->request );\n\t\t\t} else {\n\t\t\t\t$path = $wp->request . '/' . $wp_rewrite->pagination_base . '/%d';\n\t\t\t}\n\n\t\t\t// Slashes everywhere we need them\n\t\t\tif ( ! str_starts_with( $path, '/' ) ) {\n\t\t\t\t$path = '/' . $path;\n\t\t\t}\n\n\t\t\t$path = user_trailingslashit( $path );\n\t\t} else {\n\t\t\t// Clean up raw $_REQUEST input\n\t\t\t$path = array_map( 'sanitize_text_field', wp_unslash( $_REQUEST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- seems this is used for Google Analytics and browser history tracking.\n\t\t\t$path = array_filter( $path );\n\n\t\t\t$path['paged'] = '%d';\n\n\t\t\t$path = add_query_arg( $path, '/' );\n\t\t}\n\n\t\treturn empty( $path ) ? false : $path;\n\t}\n\n\t/**\n\t * Return query string for current request, prefixed with '?'.\n\t *\n\t * @return string\n\t */\n\tprivate function get_request_parameters() {\n\t\t$uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';\n\t\t$uri = preg_replace( '/^[^?]*(\\?.*$)/', '$1', $uri, 1, $count );\n\t\tif ( $count !== 1 ) {\n\t\t\treturn '';\n\t\t}\n\t\treturn $uri;\n\t}\n\n\t/**\n\t * Provide IS with a list of the scripts and stylesheets already present on the page.\n\t * Since posts may contain require additional assets that haven't been loaded, this data will be used to track the additional assets.\n\t *\n\t * @global $wp_scripts, $wp_styles\n\t * @action wp_footer\n\t */\n\tpublic function action_wp_footer() {\n\t\tglobal $wp_scripts, $wp_styles;\n\n\t\t$scripts = is_a( $wp_scripts, 'WP_Scripts' ) ? $wp_scripts->done : array();\n\t\t/**\n\t\t * Filter the list of scripts already present on the page.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.1.2\n\t\t *\n\t\t * @param array $scripts Array of scripts present on the page.\n\t\t */\n\t\t$scripts = apply_filters( 'infinite_scroll_existing_scripts', $scripts );\n\n\t\t$styles = is_a( $wp_styles, 'WP_Styles' ) ? $wp_styles->done : array();\n\t\t/**\n\t\t * Filter the list of styles already present on the page.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.1.2\n\t\t *\n\t\t * @param array $styles Array of styles present on the page.\n\t\t */\n\t\t$styles = apply_filters( 'infinite_scroll_existing_stylesheets', $styles );\n\n\t\t?>\n\t\t\n\t\ttype ) {\n\t\t\t$aria_live = 'polite';\n\t\t}\n\t\t?>\n\t\t\">\n\t\tdone,\n\t\t\t\tfunction ( $script_name ) use ( $initial_scripts ) {\n\t\t\t\t\t// Jetpack block scripts should always be sent, even if they've been\n\t\t\t\t\t// sent before. These scripts only run once on when loaded, they don't\n\t\t\t\t\t// watch for new blocks being added.\n\t\t\t\t\tif ( str_starts_with( $script_name, 'jetpack-block-' ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn ! in_array( $script_name, $initial_scripts, true );\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// If new scripts are needed, extract relevant data from $wp_scripts\n\t\t\tif ( ! empty( $new_scripts ) ) {\n\t\t\t\t$results['scripts'] = array();\n\n\t\t\t\tforeach ( $new_scripts as $handle ) {\n\t\t\t\t\t// Abort if somehow the handle doesn't correspond to a registered script\n\t\t\t\t\t// or if the script doesn't have `src` set.\n\t\t\t\t\t$script_not_registered = ! isset( $wp_scripts->registered[ $handle ] );\n\t\t\t\t\t$empty_src = empty( $wp_scripts->registered[ $handle ]->src );\n\t\t\t\t\tif ( $script_not_registered || $empty_src ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$before_handle = $wp_scripts->get_inline_script_data( $handle, 'before' );\n\t\t\t\t\t$after_handle = $wp_scripts->get_inline_script_data( $handle, 'after' );\n\n\t\t\t\t\t// Provide basic script data\n\t\t\t\t\t$script_data = array(\n\t\t\t\t\t\t'handle' => $handle,\n\t\t\t\t\t\t'footer' => ( is_array( $wp_scripts->in_footer ) && in_array( $handle, $wp_scripts->in_footer, true ) ),\n\t\t\t\t\t\t'extra_data' => $wp_scripts->print_extra_script( $handle, false ),\n\t\t\t\t\t\t'before_handle' => $before_handle,\n\t\t\t\t\t\t'after_handle' => $after_handle,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Base source\n\t\t\t\t\t$src = $wp_scripts->registered[ $handle ]->src;\n\n\t\t\t\t\t// Take base_url into account\n\t\t\t\t\tif ( strpos( $src, 'http' ) !== 0 ) {\n\t\t\t\t\t\t$src = $wp_scripts->base_url . $src;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Version and additional arguments\n\t\t\t\t\tif ( null === $wp_scripts->registered[ $handle ]->ver ) {\n\t\t\t\t\t\t$ver = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$ver = $wp_scripts->registered[ $handle ]->ver ? $wp_scripts->registered[ $handle ]->ver : $wp_scripts->default_version;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isset( $wp_scripts->args[ $handle ] ) ) {\n\t\t\t\t\t\t$ver = $ver ? $ver . '&' . $wp_scripts->args[ $handle ] : $wp_scripts->args[ $handle ];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Full script source with version info\n\t\t\t\t\t$script_data['src'] = add_query_arg( 'ver', $ver, $src );\n\n\t\t\t\t\t// Add script to data that will be returned to IS JS\n\t\t\t\t\tarray_push( $results['scripts'], $script_data );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Expose additional script data to filters, but only include in final `$results` array if needed.\n\t\tif ( ! isset( $results['scripts'] ) ) {\n\t\t\t$results['scripts'] = array();\n\t\t}\n\n\t\t/**\n\t\t * Filter the additional scripts required by the latest set of IS posts.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.1.2\n\t\t *\n\t\t * @param array $results['scripts'] Additional scripts required by the latest set of IS posts.\n\t\t * @param array|bool $initial_scripts Set of scripts loaded on each page.\n\t\t * @param array $results Array of Infinite Scroll results.\n\t\t * @param array $query_args Array of Query arguments.\n\t\t * @param WP_Query $wp_query WP Query.\n\t\t */\n\t\t$results['scripts'] = apply_filters(\n\t\t\t'infinite_scroll_additional_scripts',\n\t\t\t$results['scripts'],\n\t\t\t$initial_scripts,\n\t\t\t$results,\n\t\t\t$query_args,\n\t\t\t$wp_query\n\t\t);\n\n\t\tif ( empty( $results['scripts'] ) ) {\n\t\t\tunset( $results['scripts'] );\n\t\t}\n\n\t\t// Parse and sanitize the style handles already output\n\t\t$initial_styles = isset( $_REQUEST['styles'] ) && is_array( $_REQUEST['styles'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['styles'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended\n\n\t\tif ( is_array( $initial_styles ) ) {\n\t\t\tglobal $wp_styles;\n\n\t\t\t// Identify new styles needed by the latest set of IS posts\n\t\t\t$new_styles = array_diff( $wp_styles->done, $initial_styles );\n\n\t\t\t// If new styles are needed, extract relevant data from $wp_styles\n\t\t\tif ( ! empty( $new_styles ) ) {\n\t\t\t\t$results['styles'] = array();\n\n\t\t\t\tforeach ( $new_styles as $handle ) {\n\t\t\t\t\t// Abort if somehow the handle doesn't correspond to a registered stylesheet\n\t\t\t\t\tif ( ! isset( $wp_styles->registered[ $handle ] ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Provide basic style data\n\t\t\t\t\t$style_data = array(\n\t\t\t\t\t\t'handle' => $handle,\n\t\t\t\t\t\t'media' => 'all',\n\t\t\t\t\t);\n\n\t\t\t\t\t// Base source\n\t\t\t\t\t$src = $wp_styles->registered[ $handle ]->src;\n\n\t\t\t\t\t// Take base_url into account\n\t\t\t\t\tif ( strpos( $src, 'http' ) !== 0 ) {\n\t\t\t\t\t\t$src = $wp_styles->base_url . $src;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Version and additional arguments\n\t\t\t\t\tif ( null === $wp_styles->registered[ $handle ]->ver ) {\n\t\t\t\t\t\t$ver = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$ver = $wp_styles->registered[ $handle ]->ver ? $wp_styles->registered[ $handle ]->ver : $wp_styles->default_version;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isset( $wp_styles->args[ $handle ] ) ) {\n\t\t\t\t\t\t$ver = $ver ? $ver . '&' . $wp_styles->args[ $handle ] : $wp_styles->args[ $handle ];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Full stylesheet source with version info\n\t\t\t\t\t$style_data['src'] = add_query_arg( 'ver', $ver, $src );\n\n\t\t\t\t\t// Parse stylesheet's conditional comments if present, converting to logic executable in JS\n\t\t\t\t\tif ( isset( $wp_styles->registered[ $handle ]->extra['conditional'] ) && $wp_styles->registered[ $handle ]->extra['conditional'] ) {\n\t\t\t\t\t\t// First, convert conditional comment operators to standard logical operators. %ver is replaced in JS with the IE version\n\t\t\t\t\t\t$style_data['conditional'] = str_replace(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'lte',\n\t\t\t\t\t\t\t\t'lt',\n\t\t\t\t\t\t\t\t'gte',\n\t\t\t\t\t\t\t\t'gt',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'%ver <=',\n\t\t\t\t\t\t\t\t'%ver <',\n\t\t\t\t\t\t\t\t'%ver >=',\n\t\t\t\t\t\t\t\t'%ver >',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t$wp_styles->registered[ $handle ]->extra['conditional']\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Next, replace any !IE checks. These shouldn't be present since WP's conditional stylesheet implementation doesn't support them, but someone could be _doing_it_wrong().\n\t\t\t\t\t\t$style_data['conditional'] = preg_replace( '#!\\s*IE(\\s*\\d+){0}#i', '1==2', $style_data['conditional'] );\n\n\t\t\t\t\t\t// Lastly, remove the IE strings\n\t\t\t\t\t\t$style_data['conditional'] = str_replace( 'IE', '', $style_data['conditional'] );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Parse requested media context for stylesheet\n\t\t\t\t\tif ( isset( $wp_styles->registered[ $handle ]->args ) ) {\n\t\t\t\t\t\t$style_data['media'] = esc_attr( $wp_styles->registered[ $handle ]->args );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add stylesheet to data that will be returned to IS JS\n\t\t\t\t\tarray_push( $results['styles'], $style_data );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Expose additional stylesheet data to filters, but only include in final `$results` array if needed.\n\t\tif ( ! isset( $results['styles'] ) ) {\n\t\t\t$results['styles'] = array();\n\t\t}\n\n\t\t/**\n\t\t * Filter the additional styles required by the latest set of IS posts.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.1.2\n\t\t *\n\t\t * @param array $results['styles'] Additional styles required by the latest set of IS posts.\n\t\t * @param array|bool $initial_styles Set of styles loaded on each page.\n\t\t * @param array $results Array of Infinite Scroll results.\n\t\t * @param array $query_args Array of Query arguments.\n\t\t * @param WP_Query $wp_query WP Query.\n\t\t */\n\t\t$results['styles'] = apply_filters(\n\t\t\t'infinite_scroll_additional_stylesheets',\n\t\t\t$results['styles'],\n\t\t\t$initial_styles,\n\t\t\t$results,\n\t\t\t$query_args,\n\t\t\t$wp_query\n\t\t);\n\n\t\tif ( empty( $results['styles'] ) ) {\n\t\t\tunset( $results['styles'] );\n\t\t}\n\n\t\t// Lastly, return the IS results array\n\t\treturn $results;\n\t}\n\n\t/**\n\t * Runs the query and returns the results via JSON.\n\t * Triggered by an AJAX request.\n\t *\n\t * @global $wp_query\n\t * @global $wp_the_query\n\t * @uses current_theme_supports, get_option, self::wp_query, current_user_can, apply_filters, self::get_settings, add_filter, WP_Query, remove_filter, have_posts, wp_head, do_action, add_action, this::render, this::has_wrapper, esc_attr, wp_footer, sharing_register_post_for_share_counts, get_the_id\n\t */\n\tpublic function query() {\n\t\tif ( ! isset( $_REQUEST['page'] ) || ! current_theme_supports( 'infinite-scroll' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes to the site.\n\t\t\tdie( 0 );\n\t\t}\n\n\t\t// @todo see if we should validate this nonce since we use it to form a query.\n\t\t$page = (int) $_REQUEST['page']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- we're casting this to an int and not making changes to the site.\n\n\t\t// Sanitize and set $previousday. Expected format: dd.mm.yy\n\t\tif ( isset( $_REQUEST['currentday'] ) && is_string( $_REQUEST['currentday'] ) && preg_match( '/^\\d{2}\\.\\d{2}\\.\\d{2}$/', $_REQUEST['currentday'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput, WordPress.Security.NonceVerification.Recommended -- manually validating, no changes to site\n\t\t\tglobal $previousday;\n\t\t\t$previousday = $_REQUEST['currentday']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput\n\t\t}\n\n\t\t$post_status = array( 'publish' );\n\t\tif ( current_user_can( 'read_private_posts' ) ) {\n\t\t\tarray_push( $post_status, 'private' );\n\t\t}\n\n\t\t$order = isset( $_REQUEST['order'] ) && in_array( $_REQUEST['order'], array( 'ASC', 'DESC' ), true ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : 'DESC'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site.\n\n\t\t$query_args = array_merge(\n\t\t\tself::wp_query()->query_vars,\n\t\t\tarray(\n\t\t\t\t'paged' => $page,\n\t\t\t\t'post_status' => $post_status,\n\t\t\t\t'posts_per_page' => self::posts_per_page(), // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page\n\t\t\t\t'order' => $order,\n\t\t\t)\n\t\t);\n\n\t\t// 4.0 ?s= compatibility, see https://core.trac.wordpress.org/ticket/11330#comment:50\n\t\tif ( empty( $query_args['s'] ) && ! isset( self::wp_query()->query['s'] ) ) {\n\t\t\tunset( $query_args['s'] );\n\t\t}\n\n\t\t// By default, don't query for a specific page of a paged post object.\n\t\t// This argument can come from merging self::wp_query() into $query_args above.\n\t\t// Since IS is only used on archives, we should always display the first page of any paged content.\n\t\tunset( $query_args['page'] );\n\n\t\t/**\n\t\t * Filter the array of main query arguments.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.1\n\t\t *\n\t\t * @param array $query_args Array of Query arguments.\n\t\t */\n\t\t$query_args = apply_filters( 'infinite_scroll_query_args', $query_args );\n\n\t\tadd_filter( 'posts_where', array( $this, 'query_time_filter' ), 10, 2 );\n\n\t\t$infinite_scroll_query = new WP_Query();\n\t\t$GLOBALS['wp_the_query'] = $infinite_scroll_query;\n\t\t$GLOBALS['wp_query'] = $infinite_scroll_query;\n\n\t\t$infinite_scroll_query->query( $query_args );\n\n\t\tremove_filter( 'posts_where', array( $this, 'query_time_filter' ), 10 );\n\n\t\t$results = array();\n\n\t\tif ( have_posts() ) {\n\t\t\t// Fire wp_head to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer.\n\t\t\tob_start();\n\t\t\twp_head();\n\t\t\twhile ( ob_get_length() ) {\n\t\t\t\tob_end_clean();\n\t\t\t}\n\n\t\t\t$results['type'] = 'success';\n\n\t\t\t/**\n\t\t\t * Fires when rendering Infinite Scroll posts.\n\t\t\t *\n\t\t\t * @module infinite-scroll\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t */\n\t\t\tdo_action( 'infinite_scroll_render' );\n\t\t\t$results['html'] = ob_get_clean();\n\t\t\tif ( empty( $results['html'] ) ) {\n\t\t\t\t/**\n\t\t\t\t * Gather renderer callbacks. These will be called in order and allow multiple callbacks to be queued. Once content is found, no futher callbacks will run.\n\t\t\t\t *\n\t\t\t\t * @module infinite-scroll\n\t\t\t\t *\n\t\t\t\t * @since 6.0.0\n\t\t\t\t */\n\t\t\t\t$callbacks = apply_filters(\n\t\t\t\t\t'infinite_scroll_render_callbacks',\n\t\t\t\t\tarray( self::get_settings()->render ) // This is the setting callback e.g. from add theme support.\n\t\t\t\t);\n\n\t\t\t\t// Append fallback callback. That rhymes.\n\t\t\t\t$callbacks[] = array( $this, 'render' );\n\n\t\t\t\tforeach ( $callbacks as $callback ) {\n\t\t\t\t\tif ( false !== $callback && is_callable( $callback ) ) {\n\t\t\t\t\t\trewind_posts();\n\t\t\t\t\t\tob_start();\n\n\t\t\t\t\t\tadd_action( 'infinite_scroll_render', $callback );\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * This action is already documented above.\n\t\t\t\t\t\t * See https://github.com/Automattic/jetpack/pull/16317/\n\t\t\t\t\t\t * for more details as to why it was introduced.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tdo_action( 'infinite_scroll_render' );\n\n\t\t\t\t\t\t// Fire wp_head to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer.\n\t\t\t\t\t\twp_head();\n\n\t\t\t\t\t\t$results['html'] = ob_get_clean();\n\t\t\t\t\t\tremove_action( 'infinite_scroll_render', $callback );\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! empty( $results['html'] ) ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If primary and fallback rendering methods fail, prevent further IS rendering attempts. Otherwise, wrap the output if requested.\n\t\t\tif ( empty( $results['html'] ) ) {\n\t\t\t\tunset( $results['html'] );\n\t\t\t\t/**\n\t\t\t\t * Fires when Infinite Scoll doesn't render any posts.\n\t\t\t\t *\n\t\t\t\t * @module infinite-scroll\n\t\t\t\t *\n\t\t\t\t * @since 2.0.0\n\t\t\t\t */\n\t\t\t\tdo_action( 'infinite_scroll_empty' );\n\t\t\t\t$results['type'] = 'empty';\n\t\t\t} elseif ( $this->has_wrapper() ) {\n\t\t\t\t$wrapper_classes = is_string( self::get_settings()->wrapper ) ? self::get_settings()->wrapper : 'infinite-wrap';\n\t\t\t\t$wrapper_classes .= ' infinite-view-' . $page;\n\t\t\t\t$wrapper_classes = trim( $wrapper_classes );\n\t\t\t\t$aria_label = sprintf(\n\t\t\t\t\t/* translators: %1$s is the page count */\n\t\t\t\t\t__( 'Page: %1$d.', 'jetpack' ),\n\t\t\t\t\t$page\n\t\t\t\t);\n\n\t\t\t\t$results['html'] = '
      ' . $results['html'] . '
      ';\n\t\t\t}\n\n\t\t\t// Fire wp_footer to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer.\n\t\t\tob_start();\n\t\t\twp_footer();\n\t\t\twhile ( ob_get_length() ) {\n\t\t\t\tob_end_clean();\n\t\t\t}\n\n\t\t\tif ( 'success' === $results['type'] ) {\n\t\t\t\tglobal $currentday;\n\t\t\t\t$results['lastbatch'] = self::is_last_batch();\n\t\t\t\t$results['currentday'] = $currentday;\n\t\t\t}\n\n\t\t\t// Loop through posts to capture sharing data for new posts loaded via Infinite Scroll\n\t\t\tif ( 'success' === $results['type'] && function_exists( 'sharing_register_post_for_share_counts' ) ) {\n\t\t\t\tglobal $jetpack_sharing_counts;\n\n\t\t\t\twhile ( have_posts() ) {\n\t\t\t\t\tthe_post();\n\n\t\t\t\t\tsharing_register_post_for_share_counts( get_the_ID() );\n\t\t\t\t}\n\n\t\t\t\t// If sharing counts are not initialized for any reason, we initialize them here.\n\t\t\t\tif ( ! is_array( $jetpack_sharing_counts ) ) {\n\t\t\t\t\t$jetpack_sharing_counts = array();\n\t\t\t\t} else {\n\t\t\t\t\t// Filter out non-string and non-integer values to avoid warnings with array_flip.\n\t\t\t\t\t$flippable_jetpack_sharing_counts = array_filter(\n\t\t\t\t\t\t$jetpack_sharing_counts,\n\t\t\t\t\t\tfunction ( $value ) {\n\t\t\t\t\t\t\treturn is_string( $value ) || is_int( $value );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t$results['postflair'] = array_flip( $flippable_jetpack_sharing_counts ?? array() );\n\t\t\t}\n\t\t} else {\n\t\t\t/** This action is already documented in modules/infinite-scroll/infinity.php */\n\t\t\tdo_action( 'infinite_scroll_empty' );\n\t\t\t$results['type'] = 'empty';\n\t\t}\n\n\t\twp_send_json(\n\t\t\t/**\n\t\t\t * Filter the Infinite Scroll results.\n\t\t\t *\n\t\t\t * @module infinite-scroll\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param array $results Array of Infinite Scroll results.\n\t\t\t * @param array $query_args Array of main query arguments.\n\t\t\t * @param WP_Query $wp_query WP Query.\n\t\t\t */\n\t\t\tapply_filters( 'infinite_scroll_results', $results, $query_args, self::wp_query() ),\n\t\t\tnull, // @phan-suppress-current-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.\n\t\t\tJSON_UNESCAPED_SLASHES\n\t\t);\n\t}\n\n\t/**\n\t * Update the $allowed_vars array with the standard WP public and private\n\t * query vars, as well as taxonomy vars\n\t *\n\t * @global $wp\n\t * @param array $allowed_vars - the allowed variables array.\n\t * @filter infinite_scroll_allowed_vars\n\t * @return array\n\t */\n\tpublic function allowed_query_vars( $allowed_vars ) {\n\t\tglobal $wp;\n\n\t\t$allowed_vars += $wp->public_query_vars;\n\t\t$allowed_vars += $wp->private_query_vars;\n\t\t$allowed_vars += $this->get_taxonomy_vars();\n\n\t\tforeach ( array_keys( $allowed_vars, 'paged', true ) as $key ) {\n\t\t\tunset( $allowed_vars[ $key ] );\n\t\t}\n\n\t\treturn array_unique( $allowed_vars );\n\t}\n\n\t/**\n\t * Returns an array of stock and custom taxonomy query vars\n\t *\n\t * @global $wp_taxonomies\n\t * @return array\n\t */\n\tpublic function get_taxonomy_vars() {\n\t\tglobal $wp_taxonomies;\n\n\t\t$taxonomy_vars = array();\n\t\tforeach ( $wp_taxonomies as $t ) {\n\t\t\tif ( $t->query_var ) {\n\t\t\t\t$taxonomy_vars[] = $t->query_var;\n\t\t\t}\n\t\t}\n\n\t\t// still needed?\n\t\t$taxonomy_vars[] = 'tag_id';\n\n\t\treturn $taxonomy_vars;\n\t}\n\n\t/**\n\t * Update the $query_args array with the parameters provided via AJAX/GET.\n\t *\n\t * @param array $query_args - the query args.\n\t * @filter infinite_scroll_query_args\n\t * @return array\n\t */\n\tpublic function inject_query_args( $query_args ) {\n\t\t/**\n\t\t * Filter the array of allowed Infinite Scroll query arguments.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.6.0\n\t\t *\n\t\t * @param array $args Array of allowed Infinite Scroll query arguments.\n\t\t * @param array $query_args Array of query arguments.\n\t\t */\n\t\t$allowed_vars = apply_filters( 'infinite_scroll_allowed_vars', array(), $query_args );\n\n\t\t$query_args = array_merge(\n\t\t\t$query_args,\n\t\t\tarray(\n\t\t\t\t'suppress_filters' => false,\n\t\t\t)\n\t\t);\n\n\t\tif ( isset( $_REQUEST['query_args'] ) && is_array( $_REQUEST['query_args'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no site changes.\n\t\t\tforeach ( wp_unslash( $_REQUEST['query_args'] ) as $var => $value ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- no site changes, sanitized below.\n\t\t\t\tif ( in_array( $var, $allowed_vars, true ) && ! empty( $value ) ) {\n\t\t\t\t\t$query_args[ $var ] = filter_var( $value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $query_args;\n\t}\n\n\t/**\n\t * Rendering fallback used when themes don't specify their own handler.\n\t *\n\t * @uses have_posts, the_post, get_template_part, get_post_format\n\t * @action infinite_scroll_render\n\t */\n\tpublic function render() {\n\t\twhile ( have_posts() ) {\n\t\t\tthe_post();\n\n\t\t\tget_template_part( 'content', get_post_format() );\n\t\t}\n\t}\n\n\t/**\n\t * Allow plugins to filter what archives Infinite Scroll supports\n\t *\n\t * @uses current_theme_supports, is_home, is_archive, apply_filters, self::get_settings\n\t * @return bool\n\t */\n\tpublic static function archive_supports_infinity() {\n\t\t$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );\n\n\t\t// Disable when previewing a non-active theme in the customizer\n\t\tif ( is_customize_preview() && ! $GLOBALS['wp_customize']->is_theme_active() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Allow plugins to filter what archives Infinite Scroll supports.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param bool $supported Does the Archive page support Infinite Scroll.\n\t\t * @param object self::get_settings() IS settings provided by theme.\n\t\t */\n\t\treturn (bool) apply_filters( 'infinite_scroll_archive_supported', $supported, self::get_settings() );\n\t}\n\n\t/**\n\t * The Infinite Blog Footer\n\t *\n\t * @uses self::get_settings, self::archive_supports_infinity, self::default_footer\n\t * @return string or null\n\t */\n\tpublic function footer() {\n\t\tif ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$settings = self::get_settings();\n\n\t\t// Bail if theme requested footer not show\n\t\tif ( false === $settings->footer ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We only need the new footer for the 'scroll' type\n\t\tif ( 'scroll' !== $settings->type || ! self::archive_supports_infinity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( self::is_last_batch() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Display a footer, either user-specified or a default\n\t\tif ( false !== $settings->footer_callback && is_callable( $settings->footer_callback ) ) {\n\t\t\tcall_user_func( $settings->footer_callback, $settings );\n\t\t} else {\n\t\t\tself::default_footer();\n\t\t}\n\t}\n\n\t/**\n\t * Render default IS footer\n\t *\n\t * @uses __, wp_get_theme, apply_filters, home_url, esc_attr, get_bloginfo, bloginfo\n\t */\n\tprivate function default_footer() {\n\t\tif ( '' !== get_privacy_policy_url() ) {\n\t\t\t$credits = get_the_privacy_policy_link() . ' / ';\n\t\t} else {\n\t\t\t$credits = '';\n\t\t}\n\t\t$credits .= sprintf(\n\t\t\t'%1$s ',\n\t\t\t__( 'Proudly powered by WordPress', 'jetpack' )\n\t\t);\n\t\t$credits .= sprintf(\n\t\t\t/* translators: %1$s is the name of a theme */\n\t\t\t__( 'Theme: %1$s.', 'jetpack' ),\n\t\t\twp_get_theme()->Name\n\t\t);\n\t\t/**\n\t\t * Filter Infinite Scroll's credit text.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param string $credits Infinite Scroll credits.\n\t\t */\n\t\t$credits = apply_filters( 'infinite_scroll_credit', $credits );\n\n\t\t?>\n\t\t
      \n\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t
      \n\t\t
      \n\t\t $data ) {\n\t\t\tif ( 'mediaelement-core' === $data['handle'] ) {\n\t\t\t\t$mejs_settings = array(\n\t\t\t\t\t'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),\n\t\t\t\t\t'classPrefix' => 'mejs-',\n\t\t\t\t\t'stretching' => 'responsive',\n\t\t\t\t);\n\n\t\t\t\t$scripts_data[ $key ]['extra_data'] = sprintf(\n\t\t\t\t\t'window.%s = %s',\n\t\t\t\t\t'_wpmejsSettings',\n\t\t\t\t\twp_json_encode( apply_filters( 'mejs_settings', $mejs_settings ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn $scripts_data;\n\t}\n\n\t/**\n\t * Determines whether the legacy AMP Reader post templates are being used.\n\t *\n\t * @return bool\n\t */\n\tprivate function is_exempted_amp_page() {\n\t\tif ( is_singular( 'web-story' ) ) {\n\t\t\t// Ensure that is not injected after as generated by the Web Stories plugin.\n\t\t\treturn true;\n\t\t}\n\t\tif ( function_exists( 'amp_is_legacy' ) ) {\n\t\t\t// Available since AMP v2.0, this will return false if a theme like Twenty Twenty is selected as the Reader theme.\n\t\t\treturn amp_is_legacy();\n\t\t}\n\t\tif ( method_exists( 'AMP_Options_Manager', 'get_option' ) ) {\n\t\t\t// In versions prior to v2.0, checking the template mode as being 'reader' is sufficient.\n\t\t\treturn 'reader' === AMP_Options_Manager::get_option( 'theme_support' );\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Load AMP specific hooks.\n\t *\n\t * @return void\n\t */\n\tpublic function amp_load_hooks() {\n\t\tif ( $this->is_exempted_amp_page() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {\n\t\t\t$template = self::get_settings()->render;\n\n\t\t\tadd_filter( 'jetpack_infinite_scroll_load_scripts_and_styles', '__return_false' );\n\n\t\t\tadd_action( 'template_redirect', array( $this, 'amp_start_output_buffering' ), 0 );\n\t\t\tadd_action( 'shutdown', array( $this, 'amp_output_buffer' ), 1 );\n\n\t\t\tif ( is_string( $template ) && strpos( $template, '::' ) === false && is_callable( \"amp_{$template}_hooks\" ) ) {\n\t\t\t\tcall_user_func( \"amp_{$template}_hooks\" );\n\t\t\t}\n\n\t\t\t// Warms up the amp next page markup.\n\t\t\t// This should be done outside the output buffering callback started in the template_redirect.\n\t\t\t$this->amp_get_footer_template();\n\t\t}\n\t}\n\n\t/**\n\t * Start the AMP output buffering.\n\t *\n\t * @return void\n\t */\n\tpublic function amp_start_output_buffering() {\n\t\tob_start( array( $this, 'amp_finish_output_buffering' ) );\n\t}\n\n\t/**\n\t * Flush the AMP output buffer.\n\t *\n\t * @return void\n\t */\n\tpublic function amp_output_buffer() {\n\t\tif ( ob_get_contents() ) {\n\t\t\tob_end_flush();\n\t\t}\n\t}\n\n\t/**\n\t * Filter the AMP output buffer contents.\n\t *\n\t * @param string $buffer Contents of the output buffer.\n\t *\n\t * @return string|false\n\t */\n\tpublic function amp_finish_output_buffering( $buffer ) {\n\t\t// Hide WordPress admin bar on next page load.\n\t\t$buffer = preg_replace(\n\t\t\t'/id=\"wpadminbar\"/',\n\t\t\t'$0 next-page-hide',\n\t\t\t$buffer\n\t\t);\n\n\t\t/**\n\t\t * Get the theme footers.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 9.0.0\n\t\t *\n\t\t * @param array array() An array to store multiple markup entries to be added to the footer.\n\t\t * @param string $buffer The contents of the output buffer.\n\t\t */\n\t\t$footers = apply_filters( 'jetpack_amp_infinite_footers', array(), $buffer );\n\n\t\t/**\n\t\t * Filter the output buffer.\n\t\t * Themes can leverage this hook to add custom markup on next page load.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 9.0.0\n\t\t *\n\t\t * @param string $buffer The contents of the output buffer.\n\t\t */\n\t\t$buffer = apply_filters( 'jetpack_amp_infinite_output', $buffer );\n\n\t\t// Add the amp next page markup.\n\t\t$buffer = preg_replace(\n\t\t\t'~~',\n\t\t\t$this->amp_get_footer_template( $footers ) . '$0',\n\t\t\t$buffer\n\t\t);\n\n\t\treturn $buffer;\n\t}\n\n\t/**\n\t * Get AMP next page markup with the custom footers.\n\t *\n\t * @param string[] $footers The theme footers.\n\t *\n\t * @return string\n\t */\n\tprotected function amp_get_footer_template( $footers = array() ) {\n\t\tstatic $template = null;\n\n\t\tif ( null === $template ) {\n\t\t\t$template = $this->amp_footer_template();\n\t\t}\n\n\t\tif ( empty( $footers ) ) {\n\t\t\treturn $template;\n\t\t}\n\n\t\treturn preg_replace(\n\t\t\t'/%%footer%%/',\n\t\t\timplode( '', $footers ),\n\t\t\t$template\n\t\t);\n\t}\n\n\t/**\n\t * AMP Next Page markup.\n\t *\n\t * @return string\n\t */\n\tprotected function amp_footer_template() {\n\t\tob_start();\n\t\t?>\n\">\n\t\n\t
      \n\t\t\n\t
      \n\t
      \n\t\t\n\t
      \n\t
      \n\t\t%%footer%%\n\t
      \n
      \n\t\t $title,\n\t\t\t'url' => $url,\n\t\t\t'image' => $image,\n\t\t);\n\n\t\t/**\n\t\t * The next page settings.\n\t\t * An array containing:\n\t\t * - title => The title to be featured on the browser tab.\n\t\t * - url => The URL of next page.\n\t\t * - image => The image URL. A required AMP setting, not in use currently. Themes are welcome to leverage.\n\t\t *\n\t\t * @module infinite-scroll\n\t\t *\n\t\t * @since 9.0.0\n\t\t *\n\t\t * @param array $next_page The contents of the output buffer.\n\t\t */\n\t\treturn apply_filters( 'jetpack_amp_infinite_next_page_data', $next_page );\n\t}\n\n\t/**\n\t * Get the number of pages left.\n\t *\n\t * @return int\n\t */\n\tprotected static function amp_get_max_pages() {\n\t\tglobal $wp_query;\n\n\t\treturn (int) $wp_query->max_num_pages - (int) $wp_query->query_vars['paged'];\n\t}\n\n\t/**\n\t * Is the last page.\n\t *\n\t * @return bool\n\t */\n\tprotected static function amp_is_last_page() {\n\t\treturn 0 === static::amp_get_max_pages();\n\t}\n}\n\n/**\n * Initialize The_Neverending_Home_Page\n */\nfunction the_neverending_home_page_init() {\n\tif ( ! current_theme_supports( 'infinite-scroll' ) ) {\n\t\treturn;\n\t}\n\n\tnew The_Neverending_Home_Page();\n}\nadd_action( 'init', 'the_neverending_home_page_init', 20 );\n\n/**\n * Check whether the current theme is infinite-scroll aware.\n * If so, include the files which add theme support.\n */\nfunction the_neverending_home_page_theme_support() {\n\tif (\n\t\t\tdefined( 'IS_WPCOM' ) && IS_WPCOM &&\n\t\t\tdefined( 'REST_API_REQUEST' ) && REST_API_REQUEST &&\n\t\t\t! doing_action( 'restapi_theme_after_setup_theme' )\n\t) {\n\t\t// Don't source theme compat files until we're in the site's context\n\t\treturn;\n\t}\n\t$theme_name = get_stylesheet();\n\n\t/**\n\t * Filter the path to the Infinite Scroll compatibility file.\n\t *\n\t * @module infinite-scroll\n\t *\n\t * @since 2.0.0\n\t *\n\t * @param string $str IS compatibility file path.\n\t * @param string $theme_name Theme name.\n\t */\n\t$customization_file = apply_filters( 'infinite_scroll_customization_file', __DIR__ . \"/themes/{$theme_name}.php\", $theme_name );\n\n\tif ( is_readable( $customization_file ) ) {\n\t\trequire_once $customization_file;\n\t}\n}\nadd_action( 'after_setup_theme', 'the_neverending_home_page_theme_support', 5 );\n\n/**\n * Early accommodation of the Infinite Scroll AJAX request\n */\nif ( The_Neverending_Home_Page::got_infinity() ) {\n\t/**\n\t * If we're sure this is an AJAX request (i.e. the HTTP_X_REQUESTED_WITH header says so),\n\t * indicate it as early as possible for actions like init\n\t */\n\tif ( ! defined( 'DOING_AJAX' ) &&\n\t\tisset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) &&\n\t\tstrtoupper( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) === 'XMLHTTPREQUEST'\n\t) {\n\t\tdefine( 'DOING_AJAX', true );\n\t}\n\n\t// Don't load the admin bar when doing the AJAX response.\n\tshow_admin_bar( false );\n}\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php\n 'main',\n\t\t\t'footer' => 'page',\n\t\t)\n\t);\n}\nadd_action( 'after_setup_theme', 'jetpack_twentyfifteen_infinite_scroll_init' );\n\n/**\n * Enqueue CSS stylesheet with theme styles for Infinite Scroll.\n */\nfunction jetpack_twentyfifteen_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\twp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );\n\t\twp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentyfifteen_infinite_scroll_enqueue_styles', 25 );\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php\n 'main',\n\t\t\t'render' => 'jetpack_twentysixteen_infinite_scroll_render',\n\t\t\t'footer' => 'content',\n\t\t)\n\t);\n}\nadd_action( 'after_setup_theme', 'jetpack_twentysixteen_infinite_scroll_init' );\n\n/**\n * Custom render function for Infinite Scroll.\n */\nfunction jetpack_twentysixteen_infinite_scroll_render() {\n\twhile ( have_posts() ) {\n\t\tthe_post();\n\t\tif ( is_search() ) {\n\t\t\tget_template_part( 'template-parts/content', 'search' );\n\t\t} else {\n\t\t\tget_template_part( 'template-parts/content', get_post_format() );\n\t\t}\n\t}\n}\n\n/**\n * Enqueue CSS stylesheet with theme styles for Infinite Scroll.\n */\nfunction jetpack_twentysixteen_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\twp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );\n\t\twp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentysixteen_infinite_scroll_enqueue_styles', 25 );\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php\n 'content',\n\t\t\t'footer' => 'page',\n\t\t\t'footer_widgets' => jetpack_twentyeleven_has_footer_widgets(),\n\t\t)\n\t);\n}\nadd_action( 'init', 'jetpack_twentyeleven_infinite_scroll_init' );\n\n/**\n * Enqueue CSS stylesheet with theme styles for infinity.\n */\nfunction jetpack_twentyeleven_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\t// Add theme specific styles.\n\t\twp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentyeleven_infinite_scroll_enqueue_styles', 25 );\n\n/**\n * Do we have footer widgets?\n */\nfunction jetpack_twentyeleven_has_footer_widgets() {\n\t// Are any of the \"Footer Area\" sidebars active?\n\tif ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) {\n\t\treturn true;\n\t}\n\n\t// If we're on mobile and the Main Sidebar has widgets, it falls below the content, so we have footer widgets.\n\tif ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() && is_active_sidebar( 'sidebar-1' ) ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php\n 'content',\n\t\t\t'render' => 'jetpack_twentyten_infinite_scroll_render',\n\t\t\t'footer' => 'wrapper',\n\t\t\t'footer_widgets' => jetpack_twentyten_has_footer_widgets(),\n\t\t)\n\t);\n}\nadd_action( 'init', 'jetpack_twentyten_infinite_scroll_init' );\n\n/**\n * Set the code to be rendered on for calling posts,\n * hooked to template parts when possible.\n *\n * Note: must define a loop.\n */\nfunction jetpack_twentyten_infinite_scroll_render() {\n\tget_template_part( 'loop' );\n}\n\n/**\n * Enqueue CSS stylesheet with theme styles for infinity.\n */\nfunction jetpack_twentyten_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\t// Add theme specific styles.\n\t\twp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentyten_infinite_scroll_enqueue_styles', 25 );\n\n/**\n * Do we have footer widgets?\n */\nfunction jetpack_twentyten_has_footer_widgets() {\n\tif ( is_active_sidebar( 'first-footer-widget-area' ) ||\n\t\tis_active_sidebar( 'second-footer-widget-area' ) ||\n\t\tis_active_sidebar( 'third-footer-widget-area' ) ||\n\t\tis_active_sidebar( 'fourth-footer-widget-area' ) ) {\n\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php\n 'content',\n\t\t\t'footer' => 'page',\n\t\t\t'footer_widgets' => array( 'sidebar-1' ),\n\t\t)\n\t);\n}\nadd_action( 'after_setup_theme', 'jetpack_twentythirteen_infinite_scroll_init' );\n\n/**\n * Enqueue CSS stylesheet with theme styles for Infinite Scroll.\n */\nfunction jetpack_twentythirteen_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\twp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentythirteen_infinite_scroll_enqueue_styles', 25 );\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php\n 'main',\n\t\t\t'render' => 'jetpack_twentyseventeen_infinite_scroll_render',\n\t\t\t'footer' => 'content',\n\t\t\t'footer_widgets' => jetpack_twentyseventeen_has_footer_widgets(),\n\t\t)\n\t);\n}\nadd_action( 'init', 'jetpack_twentyseventeen_infinite_scroll_init' );\n\n/**\n * Custom render function for Infinite Scroll.\n */\nfunction jetpack_twentyseventeen_infinite_scroll_render() {\n\twhile ( have_posts() ) {\n\t\tthe_post();\n\t\tif ( is_search() ) {\n\t\t\tget_template_part( 'template-parts/post/content', 'search' );\n\t\t} else {\n\t\t\tget_template_part( 'template-parts/post/content', get_post_format() );\n\t\t}\n\t}\n}\n\n/**\n * Custom function to check for the presence of footer widgets or the social links menu\n */\nfunction jetpack_twentyseventeen_has_footer_widgets() {\n\tif ( is_active_sidebar( 'sidebar-2' ) ||\n\t\tis_active_sidebar( 'sidebar-3' ) ||\n\t\thas_nav_menu( 'social' ) ) {\n\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Enqueue CSS stylesheet with theme styles for Infinite Scroll.\n */\nfunction jetpack_twentyseventeen_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\twp_enqueue_style( 'infinity-twentyseventeen', plugins_url( 'twentyseventeen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20161219' );\n\t\twp_style_add_data( 'infinity-twentyseventeen', 'rtl', 'replace' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentyseventeen_infinite_scroll_enqueue_styles', 25 );\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php\n 'content',\n\t\t\t'footer' => 'page',\n\t\t\t'footer_widgets' => jetpack_twentytwelve_has_footer_widgets(),\n\t\t)\n\t);\n}\nadd_action( 'after_setup_theme', 'jetpack_twentytwelve_infinite_scroll_init' );\n\n/**\n * Enqueue CSS stylesheet with theme styles for infinity.\n */\nfunction jetpack_twentytwelve_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\t// Add theme specific styles.\n\t\twp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentytwelve_infinite_scroll_enqueue_styles', 25 );\n\n/**\n * Do we have footer widgets?\n */\nfunction jetpack_twentytwelve_has_footer_widgets() {\n\tif ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) {\n\t\tif ( is_front_page() && ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) ) ) {\n\t\t\treturn true;\n\t\t} elseif ( is_active_sidebar( 'sidebar-1' ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n\n// File: projects/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php\n 'content',\n\t\t\t'footer' => 'page',\n\t\t\t'footer_widgets' => jetpack_twentyfourteen_has_footer_widgets(),\n\t\t)\n\t);\n}\nadd_action( 'after_setup_theme', 'jetpack_twentyfourteen_infinite_scroll_init' );\n\n/**\n * Switch to the \"click to load\" type IS with the following cases\n * 1. Viewed from iPad and the primary sidebar is active.\n * 2. Viewed from mobile and either the primary or the content sidebar is active.\n * 3. The footer widget is active.\n *\n * @return bool\n */\nfunction jetpack_twentyfourteen_has_footer_widgets() {\n\tif ( function_exists( 'jetpack_is_mobile' ) ) {\n\t\tif ( ( User_Agent_Info::is_ipad() && is_active_sidebar( 'sidebar-1' ) )\n\t\t\t|| ( jetpack_is_mobile( '', true ) && ( is_active_sidebar( 'sidebar-1' ) || is_active_sidebar( 'sidebar-2' ) ) )\n\t\t\t|| is_active_sidebar( 'sidebar-3' ) ) {\n\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Enqueue CSS stylesheet with theme styles for Infinite Scroll.\n */\nfunction jetpack_twentyfourteen_infinite_scroll_enqueue_styles() {\n\tif ( wp_script_is( 'the-neverending-homepage' ) ) {\n\t\twp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'jetpack_twentyfourteen_infinite_scroll_enqueue_styles', 25 );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Construct a Gutenberg block mechanism specifically for presenting alternative content when database queries return empty or zero matching results."}, {"role": "assistant", "content": "// File: packages/block-library/src/query-no-results/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-no-results\",\n\t\"title\": \"No Results\",\n\t\"category\": \"theme\",\n\t\"description\": \"Contains the block elements used to render content when no query results are found.\",\n\t\"ancestor\": [ \"core/query\" ],\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"queryId\", \"query\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/query-no-results/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'No posts were found.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/query-no-results/save.js\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save() {\n\treturn ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block for displaying cart items with customizable options including class name, product description visibility, and locking mechanisms."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-cart-items/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-cart-items-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Cart Items\",\n\t\"description\": \"Shows cart items.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"disableProductDescriptions\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/checkout-order-summary-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-cart-items/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { isExperimentalBlocksEnabled } from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport type BlockAttributes = {\n\tclassName?: string;\n\tdisableProductDescriptions?: boolean;\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: BlockAttributes;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className = '', disableProductDescriptions = false } = attributes;\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
      \n\t\t\t{ /* For now this setting can only be enabled if you have experimental features enabled. */ }\n\t\t\t{ isExperimentalBlocksEnabled() && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisableProductDescriptions:\n\t\t\t\t\t\t\t\t\t\t! disableProductDescriptions,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block utilizing Gutenberg's framework that allows for selecting shipping or local pickup methods, with integrated attribute locking functionality."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-shipping-method-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Delivery\",\n\t\"description\": \"Select between shipping or local pickup.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/edit.tsx\n/* eslint-disable @wordpress/no-unsafe-wp-apis */\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { Icon, store, shipping } from '@wordpress/icons';\nimport { ADMIN_URL, getSetting } from '@woocommerce/settings';\nimport { LOCAL_PICKUP_ENABLED } from '@woocommerce/block-settings';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Button } from '@ariakit/react';\nimport { useShippingData } from '@woocommerce/base-context/hooks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { checkoutStore as checkoutStoreDescriptor } from '@woocommerce/block-data';\nimport ExternalLinkCard from '@woocommerce/editor-components/external-link-card';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport { RatePrice, getLocalPickupPrices, getShippingPrices } from './shared';\nimport type { minMaxPrices } from './shared';\nimport './style.scss';\nimport { defaultShippingText, defaultLocalPickupText } from './constants';\n\nconst LocalPickupSelector = ( {\n\tchecked,\n\trate,\n\tshowPrice,\n\tshowIcon,\n\ttoggleText,\n\tsetAttributes,\n\tonClick,\n}: {\n\tchecked: string;\n\trate: minMaxPrices;\n\tshowPrice: boolean;\n\tshowIcon: boolean;\n\ttoggleText: string;\n\tonClick: () => void;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ) => {\n\treturn (\n\t\t }\n\t\t\tclassName={ clsx( 'wc-block-checkout__shipping-method-option', {\n\t\t\t\t'wc-block-checkout__shipping-method-option--selected':\n\t\t\t\t\tchecked === 'pickup',\n\t\t\t} ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ showIcon === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\tsetAttributes( { localPickupText: value } )\n\t\t\t\t}\n\t\t\t\t__unstableDisableFormats\n\t\t\t\tpreserveWhiteSpace\n\t\t\t/>\n\t\t\t{ showPrice === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n};\n\nconst ShippingSelector = ( {\n\tchecked,\n\trate,\n\tshowPrice,\n\tshowIcon,\n\ttoggleText,\n\tsetAttributes,\n\tonClick,\n}: {\n\tchecked: string;\n\trate: minMaxPrices;\n\tshowPrice: boolean;\n\tshowIcon: boolean;\n\ttoggleText: string;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n\tonClick: () => void;\n} ) => {\n\tconst Price =\n\t\trate.min === undefined ? (\n\t\t\t\n\t\t\t\t{ __( 'calculated with an address', 'woocommerce' ) }\n\t\t\t\n\t\t) : (\n\t\t\t\n\t\t);\n\n\treturn (\n\t\t }\n\t\t\tclassName={ clsx( 'wc-block-checkout__shipping-method-option', {\n\t\t\t\t'wc-block-checkout__shipping-method-option--selected':\n\t\t\t\t\tchecked === 'shipping',\n\t\t\t} ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ showIcon === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\tsetAttributes( { shippingText: value } )\n\t\t\t\t}\n\t\t\t\t__unstableDisableFormats\n\t\t\t\tpreserveWhiteSpace\n\t\t\t/>\n\t\t\t{ showPrice === true && Price }\n\t\t\n\t);\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tallowCreateAccount: boolean;\n\t\tlocalPickupText: string;\n\t\tshippingText: string;\n\t\tshowPrice: boolean;\n\t\tshowIcon: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element | null => {\n\tuseEffect( () => {\n\t\tconst localPickupTitle = getSetting< string >(\n\t\t\t'localPickupText',\n\t\t\tattributes.localPickupText\n\t\t);\n\t\tsetAttributes( { localPickupText: localPickupTitle } );\n\t\t// Disable the exhaustive deps rule because we only want to run this on first mount to set the attribute, not\n\t\t// each time the attribute changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ setAttributes ] );\n\tconst { setPrefersCollection } = useDispatch( checkoutStoreDescriptor );\n\tconst { prefersCollection } = useSelect( ( select ) => {\n\t\tconst checkoutStore = select( checkoutStoreDescriptor );\n\t\treturn {\n\t\t\tprefersCollection: checkoutStore.prefersCollection(),\n\t\t};\n\t} );\n\tconst { showPrice, showIcon, className, localPickupText, shippingText } =\n\t\tattributes;\n\tconst {\n\t\tshippingRates,\n\t\tneedsShipping,\n\t\thasCalculatedShipping,\n\t\tisCollectable,\n\t} = useShippingData();\n\n\tif (\n\t\t! needsShipping ||\n\t\t! hasCalculatedShipping ||\n\t\t! shippingRates ||\n\t\t! isCollectable ||\n\t\t! LOCAL_PICKUP_ENABLED\n\t) {\n\t\treturn null;\n\t}\n\n\tconst changeView = ( method: string ) => {\n\t\tif ( method === 'pickup' ) {\n\t\t\tsetPrefersCollection( true );\n\t\t} else {\n\t\t\tsetPrefersCollection( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t

      \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Choose how this block is displayed to your customers.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

      \n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowIcon: ! showIcon,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowPrice: ! showPrice,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t\t

      \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Methods can be made managed in your store settings.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

      \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
      \n\t\t\t
      \n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tchangeView( 'shipping' );\n\t\t\t\t\t} }\n\t\t\t\t\tshowPrice={ showPrice }\n\t\t\t\t\tshowIcon={ showIcon }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\ttoggleText={ shippingText }\n\t\t\t\t/>\n\t\t\t\t {\n\t\t\t\t\t\tchangeView( 'pickup' );\n\t\t\t\t\t} }\n\t\t\t\t\tshowIcon={ showIcon }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\ttoggleText={ localPickupText }\n\t\t\t\t/>\n\t\t\t
      \n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Allow customers to add a note to their order. that allows users to configure: class name, lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-note-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Note\",\n\t\"description\": \"Allow customers to add a note to their order.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": false,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport './editor.scss';\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress theme block featuring adjustable link destination and text alignment settings for enhanced customization."}, {"role": "assistant", "content": "// File: packages/block-library/src/comment-edit-link/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-edit-link\",\n\t\"title\": \"Comment Edit Link\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"commentId\" ],\n\t\"attributes\": {\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t},\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": false,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-comment-edit-link\"\n}\n\n\n// File: packages/block-library/src/comment-edit-link/index.js\n/**\n * WordPress dependencies\n */\nimport { commentEditLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce-product-elements block with customizable text align"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/average-rating/block.json\n{\n\t\"name\": \"woocommerce/product-average-rating\",\n\t\"title\": \"Product Average Rating (Beta)\",\n\t\"description\": \"Display the average rating of a product\",\n\t\"apiVersion\": 3,\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"ancestor\": [ \"woocommerce/single-product\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t},\n\t\t\"__experimentalSelector\": \".wc-block-components-product-average-rating\"\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/average-rating/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport type { BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport interface BlockAttributes {\n\ttextAlign: string;\n}\n\nconst Edit = ( props: BlockEditProps< BlockAttributes > ): JSX.Element => {\n\tconst { attributes, setAttributes } = props;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-woocommerce-product-average-rating',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign || '' } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t\t
      \n\t\t\t\t\n\t\t\t
      \n\t\t\n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable class name, lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.json\n{\n\t\"name\": \"woocommerce/cart-order-summary-discount-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Discount\",\n\t\"description\": \"Shows the cart discount row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/cart-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Book a reservation with OpenTable. that allows users to configure: rid, style, iframe, and 4 more options"}, {"role": "assistant", "content": "// File: projects/plugins/jetpack/extensions/blocks/opentable/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/opentable\",\n\t\"title\": \"OpenTable\",\n\t\"description\": \"Book a reservation with OpenTable.\",\n\t\"keywords\": [ \"booking\", \"reservation\", \"restaurant\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": { \"align\": true, \"html\": false },\n\t\"attributes\": {\n\t\t\"rid\": {\n\t\t\t\"default\": [],\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"style\": {\n\t\t\t\"default\": \"standard\",\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"button\", \"standard\", \"wide\", \"tall\" ]\n\t\t},\n\t\t\"iframe\": {\n\t\t\t\"default\": true,\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"domain\": {\n\t\t\t\"default\": \"com\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"lang\": {\n\t\t\t\"default\": \"en-US\",\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"en-US\", \"fr-CA\", \"de-DE\", \"es-MX\", \"ja-JP\", \"nl-NL\", \"it-IT\" ]\n\t\t},\n\t\t\"newtab\": {\n\t\t\t\"default\": false,\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"negativeMargin\": {\n\t\t\t\"default\": false,\n\t\t\t\"type\": \"boolean\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"rid\": [ \"1\" ],\n\t\t\t\"style\": \"standard\",\n\t\t\t\"iframe\": true,\n\t\t\t\"domain\": \"com\",\n\t\t\t\"lang\": \"en-US\",\n\t\t\t\"newtab\": false,\n\t\t\t\"negativeMargin\": false\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/opentable/edit.js\nimport { isWpcomPlatformSite } from '@automattic/jetpack-script-data';\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport {\n\tInspectorControls,\n\tInspectorAdvancedControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tgetBlockDefaultClassName,\n\tregisterBlockStyle,\n\tunregisterBlockStyle,\n} from '@wordpress/blocks';\nimport {\n\tExternalLink,\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl,\n\tToggleControl,\n\twithNotices,\n} from '@wordpress/components';\nimport { useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { isEmpty, isEqual } from 'lodash';\nimport { getActiveStyleName } from '../../shared/block-styles';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\nimport { languageOptions, languageValues } from './i18n';\nimport RestaurantPicker from './restaurant-picker';\nimport { buttonStyle, getStyleOptions, getStyleValues } from './styles';\nimport usePrevious from './use-previous';\nimport { getAttributesFromEmbedCode } from './utils';\n\nimport './editor.scss';\n\nconst icon = getBlockIconComponent( metadata );\n\nfunction OpenTableEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\tname,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst defaultClassName = getBlockDefaultClassName( name );\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\n\tif ( ! isEqual( validatedAttributes, attributes ) ) {\n\t\tsetAttributes( validatedAttributes );\n\t}\n\n\tconst { align, rid, iframe, domain, lang, newtab, negativeMargin } = attributes;\n\tconst isPlaceholder = isEmpty( rid );\n\tconst selectedStyle = getActiveStyleName( getStyleOptions(), attributes.className );\n\tconst style = getActiveStyleName( getStyleOptions( rid ), attributes.className );\n\tconst prevStyle = usePrevious( style );\n\tconst __isBlockPreview = isEqual( rid, [ '1' ] );\n\n\tuseEffect( () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tif (\n\t\t\t! isPlaceholder &&\n\t\t\t! __isBlockPreview &&\n\t\t\t'wide' === style &&\n\t\t\t'wide' !== align &&\n\t\t\t'full' !== align\n\t\t) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'With the OpenTable block you may encounter display issues if you use its \"wide\" style with anything other than \"wide\" or \"full\" alignment. The wide display style may also not work well on smaller screens.',\n\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t);\n\t\t\tnoticeOperations.createNotice( { status: 'warning', content } );\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ __isBlockPreview, align, isPlaceholder, rid, style ] );\n\n\t// Don't allow button style with multiple restaurant IDs.\n\tuseEffect( () => {\n\t\tif ( 'button' === selectedStyle && Array.isArray( rid ) && rid?.length > 1 ) {\n\t\t\tsetAttributes( { className: '', style: '' } );\n\t\t}\n\t}, [ rid, selectedStyle, setAttributes ] );\n\n\t// Temporarily remove button block style if multiple restaurants are present.\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( Array.isArray( rid ) && rid?.length > 1 ) {\n\t\t\tunregisterBlockStyle( 'jetpack/opentable', [ 'button' ] );\n\t\t} else {\n\t\t\tregisterBlockStyle( 'jetpack/opentable', buttonStyle );\n\t\t}\n\t}, [ isSelected, rid ] );\n\n\tuseEffect( () => {\n\t\t// Reset wide alignment if switching from wide style.\n\t\tif ( 'wide' === prevStyle && 'wide' === align ) {\n\t\t\tsetAttributes( { align: '' } );\n\t\t}\n\n\t\t// If switching to wide style set wide alignment as well as it works better.\n\t\tif ( 'wide' === style && prevStyle && style !== prevStyle ) {\n\t\t\tsetAttributes( { align: 'wide' } );\n\t\t}\n\n\t\t// Need to force attribute to be updated after switch to using block styles\n\t\t// so it still meets frontend rendering expectations.\n\t\tsetAttributes( { style } );\n\t}, [ align, style, prevStyle, setAttributes ] );\n\n\tconst parseEmbedCode = embedCode => {\n\t\tconst newAttributes = getAttributesFromEmbedCode( embedCode );\n\t\tif ( ! newAttributes ) {\n\t\t\tnoticeOperations.removeAllNotices();\n\t\t\tnoticeOperations.createErrorNotice(\n\t\t\t\t<>\n\t\t\t\t\t{ __( 'We ran into an issue', 'jetpack' ) }\n\t\t\t\t\t
      \n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Please ensure this embed matches the one from your OpenTable account',\n\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t);\n\t\t}\n\n\t\tconst validatedNewAttributes = getValidatedAttributes( metadata.attributes, newAttributes );\n\t\tsetAttributes( validatedNewAttributes );\n\t\tnoticeOperations.removeAllNotices();\n\t};\n\n\tconst styleValues = getStyleValues( rid );\n\tconst getTypeAndTheme = fromStyle =>\n\t\trid?.length > 1\n\t\t\t? [ 'multi', 'button' !== fromStyle ? fromStyle : 'standard' ]\n\t\t\t: [\n\t\t\t\t\t'button' === fromStyle ? 'button' : 'standard',\n\t\t\t\t\t'button' === fromStyle ? 'standard' : fromStyle,\n\t\t\t ];\n\n\tconst blockPreview = styleOverride => {\n\t\tconst [ type, theme ] = getTypeAndTheme( styleOverride ? styleOverride : style );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tconst onPickerSubmit = input => {\n\t\tif ( Array.isArray( input ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\trid: input,\n\t\t\t\tstyle: input.length > 1 && 'button' === style ? 'standard' : style,\n\t\t\t} );\n\t\t} else {\n\t\t\tparseEmbedCode( input );\n\t\t}\n\t};\n\n\tconst inspectorControls = (\n\t\t<>\n\t\t\t\n\t\t\t\t setAttributes( { iframe: ! iframe } ) }\n\t\t\t\t\tclassName=\"is-opentable\"\n\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t/>\n\t\t\t\t{ 'button' === style && (\n\t\t\t\t\t setAttributes( { negativeMargin: ! negativeMargin } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t setAttributes( { lang: newLang } ) }\n\t\t\t\t\t\toptions={ languageOptions }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes( { newtab: ! newtab } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n\n\tconst supportLink = isWpcomPlatformSite()\n\t\t? 'https://en.support.wordpress.com/wordpress-editor/blocks/opentable-block/'\n\t\t: 'https://jetpack.com/support/jetpack-blocks/opentable-block/';\n\n\tconst blockPlaceholder = (\n\t\t\n\t\t\t\n\t\t\t
      \n\t\t\t\t\n\t\t\t\t\t{ __( 'Sign up for OpenTable', 'jetpack' ) }\n\t\t\t\t\n\t\t\t\t{ __( 'Learn more', 'jetpack' ) }\n\t\t\t
      \n\t\t\n\t);\n\n\tconst editClasses = clsx( {\n\t\t[ `is-style-${ style }` ]: ! isPlaceholder && styleValues.includes( style ),\n\t\t'is-placeholder': isPlaceholder,\n\t\t'is-multi': 'multi' === getTypeAndTheme( style )[ 0 ],\n\t\t[ `align${ align }` ]: align,\n\t\t'has-no-margin': negativeMargin,\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t{ noticeUI }\n\t\t\t
      \n\t\t\t\t{ ! isPlaceholder && inspectorControls }\n\t\t\t\t{ ! isPlaceholder ? blockPreview() : blockPlaceholder }\n\t\t\t
      \n\t\t
      \n\t);\n}\n\nexport default withNotices( OpenTableEdit );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block for seamlessly displaying Eventbrite event specifics and purchase options, utilizing input fields for event link, unique identifier, and design preferences."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/eventbrite/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/eventbrite\",\n\t\"title\": \"Eventbrite Checkout\",\n\t\"description\": \"Embed Eventbrite event details and ticket checkout.\",\n\t\"keywords\": [ \"events\", \"tickets\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": { \"html\": false, \"align\": true },\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"eventId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"style\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"inline\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"url\": \"https://www.eventbrite.com/e/test-event-tickets-123456789\",\n\t\t\t\"eventId\": 123456789,\n\t\t\t\"style\": \"modal\"\n\t\t},\n\t\t\"innerBlocks\": [\n\t\t\t{\n\t\t\t\t\"name\": \"jetpack/button\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"element\": \"a\",\n\t\t\t\t\t\"text\": \"Register\",\n\t\t\t\t\t\"uniqueId\": \"eventbrite-widget-id\"\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/eventbrite/edit.js\nimport { BlockControls, InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { Button, withNotices } from '@wordpress/components';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport testEmbedUrl from '../../shared/test-embed-url';\nimport metadata from './block.json';\nimport { EVENTBRITE_EXAMPLE_URL, URL_REGEX } from './constants';\nimport { ToolbarControls, InspectorControls } from './controls';\nimport EmbedForm from './form';\nimport Loader from './loader';\nimport InlinePreview from './preview';\nimport { convertToLink, eventIdFromUrl, normalizeUrlInput } from './utils';\n\nimport './editor.scss';\n\nconst innerButtonBlock = {\n\tname: 'jetpack/button',\n\tattributes: {\n\t\telement: 'a',\n\t\ttext: _x( 'Register', 'verb: e.g. register for an event.', 'jetpack' ),\n\t\tuniqueId: 'eventbrite-widget-id',\n\t},\n};\n\nexport const EventbriteEdit = props => {\n\tconst { attributes, noticeOperations, onReplace, setAttributes } = props;\n\tconst { url, style } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst [ editingUrl, setEditingUrl ] = useState( false );\n\tconst [ editedUrl, setEditedUrl ] = useState( attributes.url || '' );\n\tconst [ isResolvingUrl, setIsResolvingUrl ] = useState( false );\n\n\tconst cannotEmbed = ! isResolvingUrl && url && ! URL_REGEX.test( url );\n\n\tconst setErrorNotice = useCallback( () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t<>\n\t\t\t\t{ __( 'Sorry, this content could not be embedded.', 'jetpack' ) }{ ' ' }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}, [ noticeOperations, onReplace, editedUrl ] );\n\n\tconst setUrl = useCallback(\n\t\tstr => {\n\t\t\tif ( ! str || EVENTBRITE_EXAMPLE_URL === str || 'modal' === style ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst eventId = eventIdFromUrl( str );\n\n\t\t\tif ( ! eventId ) {\n\t\t\t\tsetErrorNotice();\n\t\t\t} else {\n\t\t\t\tconst newAttributes = {\n\t\t\t\t\teventId,\n\t\t\t\t\turl: str,\n\t\t\t\t};\n\n\t\t\t\ttestEmbedUrl( newAttributes.url, setIsResolvingUrl )\n\t\t\t\t\t.then( resolvedUrl => {\n\t\t\t\t\t\tconst newValidatedAttributes = getValidatedAttributes( metadata.attributes, {\n\t\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\t\turl: resolvedUrl,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetAttributes( newValidatedAttributes );\n\t\t\t\t\t\tsetEditedUrl( resolvedUrl );\n\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t} )\n\t\t\t\t\t.catch( () => {\n\t\t\t\t\t\tsetAttributes( { eventId: undefined, url: undefined } );\n\t\t\t\t\t\tsetErrorNotice();\n\t\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ style, noticeOperations, setErrorNotice, setAttributes, setEditedUrl, setIsResolvingUrl ]\n\t);\n\n\tuseEffect( () => {\n\t\tsetUrl( url );\n\t}, [ url, setUrl ] );\n\n\tlet content;\n\n\tif ( isResolvingUrl ) {\n\t\tcontent = ;\n\t} else if ( editingUrl || ! url || cannotEmbed ) {\n\t\tcontent = (\n\t\t\t setEditedUrl( e.target.value ) }\n\t\t\t\tonSubmit={ e => {\n\t\t\t\t\tif ( e ) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\n\t\t\t\t\tsetUrl( normalizeUrlInput( editedUrl ) );\n\t\t\t\t\tsetEditingUrl( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{ style === 'modal' ? (\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\n\t\t);\n\t}\n\n\treturn
      { content }
      ;\n};\n\nexport default withNotices( EventbriteEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/eventbrite/save.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { eventId, style, url } = attributes;\n\n\tif ( ! eventId ) {\n\t\treturn;\n\t}\n\n\tlet content;\n\n\tif ( style === 'modal' ) {\n\t\tcontent = ;\n\t} else if ( url ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t{ url }\n\t\t\t\n\t\t);\n\t}\n\n\tconst blockProps = useBlockProps.save();\n\treturn
      { content }
      ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a modular block that empowers users to dynamically render product grids by selecting specific attributes, defining display operators, and adjusting column configurations with multiple advanced options."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/products-by-attribute/block.json\n{\n\t\"name\": \"woocommerce/products-by-attribute\",\n\t\"title\": \"Products by Attribute\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display a grid of products with selected attributes.\",\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": false\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"attributes\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"attrOperator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"all\", \"any\" ],\n\t\t\t\"default\": \"any\"\n\t\t},\n\t\t\"columns\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"contentVisibility\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"image\": true,\n\t\t\t\t\"title\": true,\n\t\t\t\t\"price\": true,\n\t\t\t\t\"rating\": true,\n\t\t\t\t\"button\": true\n\t\t\t},\n\t\t\t\"properties\": {\n\t\t\t\t\"image\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"title\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"price\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"rating\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t},\n\t\t\t\t\"button\": {\n\t\t\t\t\t\"type\": \"boolean\",\n\t\t\t\t\t\"default\": true\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"orderby\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [\n\t\t\t\t\"date\",\n\t\t\t\t\"popularity\",\n\t\t\t\t\"price_asc\",\n\t\t\t\t\"price_desc\",\n\t\t\t\t\"rating\",\n\t\t\t\t\"title\",\n\t\t\t\t\"menu_order\"\n\t\t\t],\n\t\t\t\"default\": \"date\"\n\t\t},\n\t\t\"rows\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t},\n\t\t\"alignButtons\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"stockStatus\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/products-by-attribute/edit.tsx\n/**\n * External dependencies\n */\nimport { BlockControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tDisabled,\n\tToolbarGroup,\n\twithSpokenMessages,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport { Props } from './types';\nimport { ProductsByAttributeInspectorControls } from './inspector-controls';\nimport { ProductsByAttributeEditMode } from './edit-mode';\nimport { ProductsByAttributeBlock } from './block';\n\nexport const EditBlock = ( props: Props ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\n\tconst {\n\t\tattributes: { attributes },\n\t} = props;\n\n\tconst [ isEditing, setIsEditing ] = useState( ! attributes.length );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t setIsEditing( ! isEditing ),\n\t\t\t\t\t\t\tisActive: isEditing,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\n\t\t\t\n\t\t\t{ isEditing ? (\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t
      \n\t);\n};\n\nexport const Edit = withSpokenMessages( EditBlock );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a WordPress block to Display the number of products on the archive page or search result page."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-results-count/block.json\n{\n\t\"name\": \"woocommerce/product-results-count\",\n\t\"title\": \"Product Results Count\",\n\t\"description\": \"Display the number of products on the archive page or search result page.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"queryId\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-results-count/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nexport interface Attributes {\n\tclassName?: string;\n}\n\nconst Edit = () => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'woocommerce wc-block-product-results-count',\n\t} );\n\n\treturn (\n\t\t
      \n\t\t\t

      \n\t\t\t\t{ __( 'Showing 1-X of X results', 'woocommerce' ) }\n\t\t\t

      \n\t\t
      \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Collect your customer's shipping address. with these attributes: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-shipping-address-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping Address\",\n\t\"description\": \"Collect your customer's shipping address.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useCheckoutAddress } from '@woocommerce/base-context/hooks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport Block from './block';\nimport { AddressFieldControls } from '../../address-field-controls';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element | null => {\n\tconst { showShippingFields } = useCheckoutAddress();\n\n\tif ( ! showShippingFields ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a dynamic content block in WordPress that dynamically manages page visibility through configurable view count parameters and user engagement thresholds."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/repeat-visitor/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/repeat-visitor\",\n\t\"title\": \"Repeat Visitor\",\n\t\"description\": \"Control block visibility based on how often a visitor has viewed the page.\",\n\t\"keywords\": [ \"return\", \"visitors\", \"visibility\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"widgets\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false\n\t},\n\t\"attributes\": {\n\t\t\"criteria\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"after-visits\"\n\t\t},\n\t\t\"threshold\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 3\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"criteria\": \"after-visits\",\n\t\t\t\"threshold\": 3\n\t\t},\n\t\t\"innerBlocks\": [\n\t\t\t{\n\t\t\t\t\"name\": \"core/paragraph\",\n\t\t\t\t\"attributes\": \"This block will only appear to a visitor who visited the page three or more times.\"\n\t\t\t}\n\t\t]\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/repeat-visitor/constants.js\nexport const CRITERIA_AFTER = 'after-visits';\nexport const CRITERIA_BEFORE = 'before-visits';\nexport const DEFAULT_THRESHOLD = 3;\nexport const COOKIE_NAME = 'jp-visit-counter';\nexport const MAX_COOKIE_AGE = 6 * 30 * 24 * 60 * 60; // 6 months\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a design block with customizable label"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/tab/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"__experimental\": true,\n\t\"apiVersion\": 3,\n\t\"name\": \"core/tab\",\n\t\"title\": \"Tab\",\n\t\"description\": \"Content for a tab in a tabbed interface.\",\n\t\"version\": \"1.0.0\",\n\t\"category\": \"design\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"parent\": [ \"core/tabs\" ],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"html\": false,\n\t\t\"reusable\": false,\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": true,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowVerticalAlignment\": true,\n\t\t\t\"allowJustification\": true,\n\t\t\t\"allowOrientation\": true,\n\t\t\t\"allowSizingOnChildren\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"__experimentalFontFamily\": true\n\t\t\t},\n\t\t\t\"__experimentalSkipSerialization\": true\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"core/tab-label\": \"label\"\n\t},\n\t\"editorScript\": \"file:./index.js\",\n\t\"style\": \"file:./style-index.css\"\n}\n\n\n// File: packages/block-library/src/tab/index.js\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport icon from './icon';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/tab/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function Save( { attributes } ) {\n\tconst { anchor } = attributes;\n\n\tconst tabPanelId = anchor;\n\n\t// eslint-disable-next-line react-compiler/react-compiler\n\tconst blockProps = useBlockProps.save();\n\t// eslint-disable-next-line react-compiler/react-compiler\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\treturn
      ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a design block with customizable open by default"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/accordion-item/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/accordion-item\",\n\t\"title\": \"Accordion Item\",\n\t\"category\": \"design\",\n\t\"description\": \"Wraps the heading and panel in one unit.\",\n\t\"parent\": [ \"core/accordion\" ],\n\t\"allowedBlocks\": [ \"core/accordion-heading\", \"core/accordion-panel\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"blockGap\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": {\n\t\t\t\"allowEditing\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"contentRole\": true\n\t},\n\t\"attributes\": {\n\t\t\"openByDefault\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"default\",\n\t\"style\": \"wp-block-accordion-item\"\n}\n\n\n// File: packages/block-library/src/accordion-item/index.js\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport icon from './icon';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/accordion-item/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { openByDefault } = attributes;\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx( {\n\t\t\t'is-open': openByDefault,\n\t\t} ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
      ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display the total number of results in a query. that allows users to configure: display type"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/query-total/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-total\",\n\t\"title\": \"Query Total\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/query\" ],\n\t\"description\": \"Display the total number of results in a query.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"displayType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"total-results\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"queryId\", \"query\" ],\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-query-total\"\n}\n\n\n// File: packages/block-library/src/query-total/index.js\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport initBlock from '../utils/init-block';\nimport { queryTotal } from './icons';\n\n/* Block settings */\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: queryTotal,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a flexible date archive block that empowers users to personalize their archive view through configurable display settings like dropdown style, label, post count, and type."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/archives/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/archives\",\n\t\"title\": \"Archives\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display a date archive of your posts.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"displayAsDropdown\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showPostCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"monthly\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-archives-editor\"\n}\n\n\n// File: packages/block-library/src/archives/index.js\n/**\n * WordPress dependencies\n */\nimport { archive as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that renders hyperlinks for various content types, enabling precise control over link presentation and destination settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/read-more/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/read-more\",\n\t\"title\": \"Read More\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the link of a post, page, or any other content-type.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"text\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true,\n\t\t\t\t\"textDecoration\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-read-more\"\n}\n\n\n// File: packages/block-library/src/read-more/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { link as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Read more' ),\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a theme block with customizable text align, is link, link target"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/post-author-name/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-author-name\",\n\t\"title\": \"Author Name\",\n\t\"category\": \"theme\",\n\t\"description\": \"The author name.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false,\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"_self\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postType\", \"postId\" ],\n\t\"example\": {\n\t\t\"viewportWidth\": 350\n\t},\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-post-author-name\"\n}\n\n\n// File: packages/block-library/src/post-author-name/index.js\n/**\n * WordPress dependencies\n */\nimport { postAuthor as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\ttransforms,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Use blocks to create an \"Add to cart\" area that's customized for different product types, such as variable and grouped. with these attributes: is descendant of add to cart with options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options\",\n\t\"title\": \"Add to Cart + Options (Beta)\",\n\t\"description\": \"Use blocks to create an \\\"Add to cart\\\" area that's customized for different product types, such as variable and grouped. \",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"attributes\": {\n\t\t\"isDescendantOfAddToCartWithOptions\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\" ],\n\t\"providesContext\": {\n\t\t\"woocommerce/isDescendantOfAddToCartWithOptions\": \"isDescendantOfAddToCartWithOptions\"\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"viewScriptModule\": \"woocommerce/add-to-cart-with-options\",\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-style.css\",\n\t\"editorStyle\": \"file:../woocommerce/add-to-cart-with-options-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/index.tsx\n/**\n * External dependencies\n */\nimport { button } from '@wordpress/icons';\nimport { getPlugin, registerPlugin } from '@wordpress/plugins';\nimport { registerProductBlockType } from '@woocommerce/atomic-utils';\nimport type { BlockConfiguration } from '@wordpress/blocks';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport ProductTypeSelectorPlugin from './plugins';\nimport metadata from './block.json';\nimport AddToCartOptionsEdit from './edit';\nimport '../../base/components/quantity-selector/style.scss';\nimport type { Attributes } from './types';\n\n// Register a plugin that adds a product type selector to the template sidebar.\nconst PLUGIN_NAME = 'document-settings-template-selector-pane';\nif ( ! getPlugin( PLUGIN_NAME ) ) {\n\tregisterPlugin( PLUGIN_NAME, {\n\t\trender: ProductTypeSelectorPlugin,\n\t} );\n}\n\n// Register the block\nregisterProductBlockType< Attributes >(\n\t{\n\t\t...( metadata as BlockConfiguration< Attributes > ),\n\t\ticon: {\n\t\t\tsrc: ( { size }: { size?: number } ) => (\n\t\t\t\t\n\t\t\t\t\t{ button }\n\t\t\t\t\n\t\t\t),\n\t\t},\n\t\tedit: AddToCartOptionsEdit,\n\t\tsave: () => null,\n\t\tancestor: [ 'woocommerce/single-product' ],\n\t},\n\t{\n\t\tisAvailableOnPostEditor: true,\n\t}\n);\n\n// Remove the Add to Cart + Options template part from the block inserter.\naddFilter(\n\t'blocks.registerBlockType',\n\t'woocommerce/area_add-to-cart-with-options',\n\tfunction ( blockSettings, blockName ) {\n\t\tif ( blockName === 'core/template-part' ) {\n\t\t\treturn {\n\t\t\t\t...blockSettings,\n\t\t\t\tvariations: blockSettings.variations.map(\n\t\t\t\t\t( variation: { name: string } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tvariation.name === 'area_add-to-cart-with-options'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...variation,\n\t\t\t\t\t\t\t\tscope: [],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn variation;\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\treturn blockSettings;\n\t}\n);\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Displays the current category description. that allows users to configure: text align"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/category-description/block.json\n{\n\t\"name\": \"woocommerce/category-description\",\n\t\"title\": \"Product Category Description\",\n\t\"description\": \"Displays the current category description.\",\n\t\"category\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true\n\t\t},\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": true\n\t},\n\t\"usesContext\": [ \"termId\", \"termTaxonomy\" ]\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/category-description/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityProp } from '@wordpress/core-data';\nimport {\n\t// @ts-expect-error AlignmentControl is not exported from @wordpress/block-editor\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tPlainText,\n} from '@wordpress/block-editor';\ninterface Props {\n\tattributes: {\n\t\ttextAlign?: string;\n\t};\n\tsetAttributes: ( attrs: Partial< Props[ 'attributes' ] > ) => void;\n\tcontext: {\n\t\ttermId?: number;\n\t\ttermTaxonomy?: string;\n\t};\n}\n\nexport default function Edit( { attributes, setAttributes, context }: Props ) {\n\tconst { textAlign } = attributes;\n\tconst { termId, termTaxonomy } = context;\n\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termId ) return false;\n\t\t\t// @ts-expect-error canUser is not typed correctly\n\t\t\t// This use actually reflects the use seen in `core/post-title` block.\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'taxonomy',\n\t\t\t\tname: termTaxonomy || 'product_cat',\n\t\t\t\tid: termId,\n\t\t\t} );\n\t\t},\n\t\t[ termId, termTaxonomy ]\n\t);\n\n\tconst [ rawDescription = '', setDescription, fullDescription ] =\n\t\tuseEntityProp(\n\t\t\t'taxonomy',\n\t\t\ttermTaxonomy || 'product_cat',\n\t\t\t'description',\n\t\t\tString( termId )\n\t\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( { [ `has-text-align-${ textAlign }` ]: textAlign } ),\n\t} );\n\n\tlet descriptionElement = (\n\t\t

      { __( 'Category description', 'woocommerce' ) }

      \n\t);\n\n\tif ( termId ) {\n\t\tdescriptionElement = userCanEdit ? (\n\t\t\t\n\t\t\t\t\t( setDescription as ( v: string ) => void )( v )\n\t\t\t\t}\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* @ts-expect-error BlockControls typing */ }\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\n\t\t\t{ descriptionElement }\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "To craft a custom WordPress block specifically designed for rendering WooCommerce page content, enabling flexible configuration options for users."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/page-content-wrapper/block.json\n{\n\t\"name\": \"woocommerce/page-content-wrapper\",\n\t\"title\": \"WooCommerce Page\",\n\t\"description\": \"Displays WooCommerce page content.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"page\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"providesContext\": {\n\t\t\"postId\": \"postId\",\n\t\t\"postType\": \"postType\"\n\t},\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/page-content-wrapper/index.tsx\n/**\n * External dependencies\n */\nimport {\n\tregisterBlockType,\n\tInnerBlockTemplate,\n\tBlockAttributes,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { page } from '@wordpress/icons';\nimport { CHECKOUT_PAGE_ID, CART_PAGE_ID } from '@woocommerce/block-settings';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport './editor.scss';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: BlockAttributes;\n\tsetAttributes: ( attrs: BlockAttributes ) => void;\n} ) => {\n\tconst TEMPLATE: InnerBlockTemplate[] = [\n\t\t[ 'core/post-title', { align: 'wide', level: 1 } ],\n\t\t[ 'core/post-content', { align: 'wide' } ],\n\t];\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-woocommerce-page-content-wrapper',\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! attributes.postId && attributes.page ) {\n\t\t\tlet postId = 0;\n\n\t\t\tif ( attributes.page === 'checkout' ) {\n\t\t\t\tpostId = CHECKOUT_PAGE_ID;\n\t\t\t}\n\n\t\t\tif ( attributes.page === 'cart' ) {\n\t\t\t\tpostId = CART_PAGE_ID;\n\t\t\t}\n\n\t\t\tif ( postId ) {\n\t\t\t\tsetAttributes( { postId, postType: 'page' } );\n\t\t\t}\n\t\t}\n\t}, [ attributes, setAttributes ] );\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t
      \n\t);\n};\n\nregisterBlockType( metadata, {\n\ticon: {\n\t\tsrc: page,\n\t},\n\tedit: Edit,\n\tsave: () => ,\n\tvariations: [\n\t\t{\n\t\t\tname: 'checkout-page',\n\t\t\ttitle: __( 'Checkout Page', 'woocommerce' ),\n\t\t\tattributes: {\n\t\t\t\tpage: 'checkout',\n\t\t\t},\n\t\t\tisActive: ( blockAttributes, variationAttributes ) =>\n\t\t\t\tblockAttributes.page === variationAttributes.page,\n\t\t},\n\t\t{\n\t\t\tname: 'cart-page',\n\t\t\ttitle: __( 'Cart Page', 'woocommerce' ),\n\t\t\tattributes: {\n\t\t\t\tpage: 'cart',\n\t\t\t},\n\t\t\tisActive: ( blockAttributes, variationAttributes ) =>\n\t\t\t\tblockAttributes.page === variationAttributes.page,\n\t\t},\n\t],\n} );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a custom WordPress block that enables users to view and select from available product variations, facilitating direct addition to cart."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-variation-selector\",\n\t\"title\": \"Variation Selector (Beta)\",\n\t\"description\": \"Display any product variations available to select from and add to cart.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\" ],\n\t\"ancestor\": [ \"woocommerce/add-to-cart-with-options\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"viewScriptModule\": \"woocommerce/add-to-cart-with-options-variation-selector\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { ATTRIBUTE_ITEM_TEMPLATE } from './attribute/constants';\n\ninterface Attributes {\n\tclassName?: string;\n}\n\nexport default function AddToCartWithOptionsVariationSelectorEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { className } = props.attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: ATTRIBUTE_ITEM_TEMPLATE,\n\t\ttemplateLock: 'all',\n\t} );\n\n\treturn
      ;\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function AddToCartWithOptionsVariationSelectorSave() {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\t...blockProps,\n\t\trole: 'list',\n\t} );\n\treturn
      ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Show links for subscribers to login, logout, or manage their subscription. that allows users to configure: redirect to current, log in label, log out label, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/subscriber-login/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/subscriber-login\",\n\t\"title\": \"Subscriber Login\",\n\t\"description\": \"Show links for subscribers to login, logout, or manage their subscription.\",\n\t\"keywords\": [ \"login\", \"logout\", \"subscription\", \"member\", \"account\", \"user\" ],\n\t\"version\": \"0.0.1\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"anchor\": false,\n\t\t\"customClassName\": true,\n\t\t\"className\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"link\": true,\n\t\t\t\"gradients\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"redirectToCurrent\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"logInLabel\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"logOutLabel\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"showManageSubscriptionsLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"manageSubscriptionsLabel\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/subscriber-login/edit.js\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, BaseControl, TextControl } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { getValidatedAttributes } from '../../shared/get-validated-attributes';\nimport metadata from './block.json';\n\nfunction SubscriberLoginEdit( { attributes, setAttributes } ) {\n\tconst logInInputId = useInstanceId( TextControl, 'inspector-text-control' );\n\tconst logOutInputId = useInstanceId( TextControl, 'inspector-text-control' );\n\tconst manageSubscriptionsInputId = useInstanceId( TextControl, 'inspector-text-control' );\n\tconst blockProps = useBlockProps();\n\tconst validatedAttributes = getValidatedAttributes( metadata.attributes, attributes );\n\tconst {\n\t\tredirectToCurrent,\n\t\tlogInLabel,\n\t\tlogOutLabel,\n\t\tshowManageSubscriptionsLink,\n\t\tmanageSubscriptionsLabel,\n\t} = validatedAttributes;\n\n\treturn (\n\t\t
      \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t setAttributes( { redirectToCurrent: ! redirectToCurrent } ) }\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t setAttributes( { logInLabel: value } ) }\n\t\t\t\t\t\t\tvalue={ logInLabel }\n\t\t\t\t\t\t\tid={ logInInputId }\n\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t setAttributes( { logOutLabel: value } ) }\n\t\t\t\t\t\t\tvalue={ logOutLabel }\n\t\t\t\t\t\t\tid={ logOutInputId }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { showManageSubscriptionsLink: ! showManageSubscriptionsLink } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showManageSubscriptionsLink && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t setAttributes( { manageSubscriptionsLabel: value } ) }\n\t\t\t\t\t\t\t\tvalue={ manageSubscriptionsLabel }\n\t\t\t\t\t\t\t\tid={ manageSubscriptionsInputId }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\n\t\t\t{ logOutLabel || __( 'Log out', 'jetpack' ) }\n\t\t
      \n\t);\n}\n\nexport default SubscriberLoginEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a text block with customizable text align, content, level, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/heading/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/heading\",\n\t\"title\": \"Heading\",\n\t\"category\": \"text\",\n\t\"description\": \"Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.\",\n\t\"keywords\": [ \"title\", \"subtitle\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"content\": {\n\t\t\t\"type\": \"rich-text\",\n\t\t\t\"source\": \"rich-text\",\n\t\t\t\"selector\": \"h1,h2,h3,h4,h5,h6\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 2\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t},\n\t\t\"placeholder\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"anchor\": true,\n\t\t\"className\": true,\n\t\t\"splitting\": true,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"fitText\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__unstablePasteTextInline\": true,\n\t\t\"__experimentalSlashInserter\": true,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-heading-editor\",\n\t\"style\": \"wp-block-heading\"\n}\n\n\n// File: packages/block-library/src/heading/index.js\n/**\n * WordPress dependencies\n */\nimport { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Code is Poetry' ),\n\t\t\tlevel: 2,\n\t\t\ttextAlign: 'center',\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content, level } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasContent\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: heading level. */\n\t\t\t\t\t\t__( 'Level %s. Empty.' ),\n\t\t\t\t\t\tlevel\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. 1: heading level. 2: heading content. */\n\t\t\t\t\t\t__( 'Level %1$s. %2$s' ),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t\tcontent\n\t\t\t\t );\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/heading/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { textAlign, content, level } = attributes;\n\tconst TagName = 'h' + level;\n\n\tconst className = clsx( {\n\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t} );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WooCommerce block that allows dynamic HTML tag selection for flexible rendering."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews\",\n\t\"icon\": \"admin-comments\",\n\t\"title\": \"Product Reviews\",\n\t\"description\": \"Display a product's reviews\",\n\t\"category\": \"woocommerce\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"viewScriptModule\": \"woocommerce/product-reviews\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/edit.tsx\n/**\n * External dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useQueryLoopProductContextValidation } from '@woocommerce/base-hooks';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t// @ts-expect-error missing types.\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TEMPLATE from './template';\nimport { ProductReviewsEditProps } from './types';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst Edit = ( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n}: ProductReviewsEditProps ) => {\n\tconst { tagName: TagName = 'div' } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\tconst { hasInvalidContext, warningElement } =\n\t\tuseQueryLoopProductContextValidation( {\n\t\t\tclientId,\n\t\t\tpostType: context.postType,\n\t\t\tblockName: __( 'Product Reviews', 'woocommerce' ),\n\t\t} );\n\n\tif ( hasInvalidContext ) {\n\t\treturn warningElement;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* @ts-expect-error missing types */ }\n\t\t\t\n\t\t\t\t)', 'woocommerce' ),\n\t\t\t\t\t\t\tvalue: 'div',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ label: '
      ', value: 'section' },\n\t\t\t\t\t\t{ label: '
      \n\t);\n};\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\nimport { type BlockAttributes } from './types';\nimport { getProductFiltersCss } from './utils/get-product-filters-css';\n\nexport const Save = ( {\n\tattributes,\n}: {\n\tattributes: BlockAttributes;\n\tstyle: Record< string, string >;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx( 'wc-block-product-filters' ),\n\t\tstyle: getProductFiltersCss( attributes ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn
      ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a theme block with customizable query id, query, tag name, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/query/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query\",\n\t\"title\": \"Query Loop\",\n\t\"category\": \"theme\",\n\t\"description\": \"An advanced block that allows displaying post types based on different query parameters and visual configurations.\",\n\t\"keywords\": [ \"posts\", \"list\", \"blog\", \"blogs\", \"custom post types\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"queryId\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"query\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"perPage\": null,\n\t\t\t\t\"pages\": 0,\n\t\t\t\t\"offset\": 0,\n\t\t\t\t\"postType\": \"post\",\n\t\t\t\t\"order\": \"desc\",\n\t\t\t\t\"orderBy\": \"date\",\n\t\t\t\t\"author\": \"\",\n\t\t\t\t\"search\": \"\",\n\t\t\t\t\"exclude\": [],\n\t\t\t\t\"sticky\": \"\",\n\t\t\t\t\"inherit\": true,\n\t\t\t\t\"taxQuery\": null,\n\t\t\t\t\"parents\": [],\n\t\t\t\t\"format\": []\n\t\t\t}\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t},\n\t\t\"namespace\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"enhancedPagination\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"templateSlug\" ],\n\t\"providesContext\": {\n\t\t\"queryId\": \"queryId\",\n\t\t\"query\": \"query\",\n\t\t\"displayLayout\": \"displayLayout\",\n\t\t\"enhancedPagination\": \"enhancedPagination\"\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"layout\": true,\n\t\t\"interactivity\": true,\n\t\t\"contentRole\": true\n\t},\n\t\"editorStyle\": \"wp-block-query-editor\"\n}\n\n\n// File: packages/block-library/src/query/index.js\n/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {\n\t\tviewportWidth: 650,\n\t\tattributes: {\n\t\t\tnamespace: 'core/posts-list',\n\t\t\tquery: {\n\t\t\t\tperPage: 4,\n\t\t\t\tpages: 1,\n\t\t\t\toffset: 0,\n\t\t\t\tpostType: 'post',\n\t\t\t\torder: 'desc',\n\t\t\t\torderBy: 'date',\n\t\t\t\tauthor: '',\n\t\t\t\tsearch: '',\n\t\t\t\tsticky: 'exclude',\n\t\t\t\tinherit: false,\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/post-template',\n\t\t\t\tattributes: {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-title',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-date',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\t\t\t\targs: { field: 'date' },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-excerpt',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/query/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn ;\n}\n"}]}