{"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\n\t);\n\n\treturn (\n\t\t
\n\t);\n};\n\nexport const 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 that facilitates gathering customer contact information, providing flexible control over data entry and access restrictions."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-contact-information-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Contact Information\",\n\t\"description\": \"Collect your customer's contact information.\",\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-contact-information-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 { ADMIN_URL } from '@woocommerce/settings';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\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 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} ): JSX.Element => {\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'Account creation and guest checkout settings 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);\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, show counts, min rating, is preview"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/rating-filter/block.json\n{\n\t\"name\": \"woocommerce/product-filter-rating\",\n\t\"title\": \"Rating Filter\",\n\t\"description\": \"Enable customers to filter the product collection by rating.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [],\n\t\"supports\": {\n\t\t\"interactivity\": true,\n\t\t\"color\": {\n\t\t\t\"background\": false,\n\t\t\t\"text\": true\n\t\t}\n\t},\n\t\"ancestor\": [ \"woocommerce/product-filters\" ],\n\t\"usesContext\": [ \"query\", \"filterParams\" ],\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\"minRating\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"0\"\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/product-filters/inner-blocks/rating-filter/edit.tsx\n/**\n * External dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport {\n\tuseQueryStateByKey,\n\tuseQueryStateByContext,\n\tuseCollectionData,\n} from '@woocommerce/base-context/hooks';\nimport { getSettingWithCoercion } from '@woocommerce/settings';\nimport { isBoolean } from '@woocommerce/types';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { withSpokenMessages } from '@wordpress/components';\nimport type { BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { previewOptions } from './preview';\nimport { getActiveFilters } from './utils';\nimport { Inspector } from './components/inspector';\nimport { getAllowedBlocks } from '../../utils/get-allowed-blocks';\nimport { EXCLUDED_BLOCKS } from '../../constants';\nimport { Notice } from '../../components/notice';\nimport type { Attributes } from './types';\nimport { InitialDisabled } from '../../components/initial-disabled';\nimport RatingStars from './components/rating-stars';\n\nconst RatingFilterEdit = ( props: BlockEditProps< Attributes > ) => {\n\tconst { attributes, setAttributes, clientId } = props;\n\n\tconst { isPreview, showCounts, minRating } = attributes;\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: __( 'Rating', '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 [ queryState ] = useQueryStateByContext();\n\n\tconst { data: collectionFilters, isLoading: filteredCountsLoading } =\n\t\tuseCollectionData( {\n\t\t\tqueryRating: true,\n\t\t\tqueryState,\n\t\t\tisEditor: true,\n\t\t} );\n\n\tconst [ displayedOptions, setDisplayedOptions ] = useState(\n\t\tisPreview ? previewOptions : []\n\t);\n\n\tconst isLoading =\n\t\t! isPreview && filteredCountsLoading && displayedOptions.length === 0;\n\n\tconst initialFilters = useMemo(\n\t\t() => getActiveFilters( 'rating_filter' ),\n\t\t[]\n\t);\n\n\tconst [ productRatingsQuery ] = useQueryStateByKey(\n\t\t'rating',\n\t\tinitialFilters\n\t);\n\n\t/**\n\t * Compare intersection of all ratings\n\t * and filtered counts to get a list of options to display.\n\t */\n\tuseEffect( () => {\n\t\tif ( filteredCountsLoading || isPreview ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t! collectionFilters?.rating_counts ||\n\t\t\tcollectionFilters?.rating_counts?.length === 0\n\t\t) {\n\t\t\tsetDisplayedOptions( previewOptions );\n\t\t\treturn;\n\t\t}\n\n\t\tconst minimumRating =\n\t\t\ttypeof minRating === 'string' ? parseFloat( minRating ) : 0;\n\n\t\t/*\n\t\t * Process the ratings counts:\n\t\t * - Sort the ratings in descending order\n\t\t * Todo: consider to handle this in the API request\n\t\t * - Filter out ratings below the minimum rating\n\t\t * - Map the ratings to the format expected by the filter component\n\t\t */\n\t\tconst productsRating = collectionFilters?.rating_counts?.length\n\t\t\t? collectionFilters.rating_counts\n\t\t\t\t\t.sort( ( a, b ) => b.rating - a.rating )\n\t\t\t\t\t.filter( ( { rating } ) => rating >= minimumRating )\n\t\t\t\t\t.map( ( { rating, count }, index ) => ( {\n\t\t\t\t\t\tlabel: ,\n\t\t\t\t\t\tariaLabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %d: rating value. Example: Rated 4 out of 5. */\n\t\t\t\t\t\t\t__( 'Rated %d out of 5', 'woocommerce' ),\n\t\t\t\t\t\t\trating\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: rating?.toString(),\n\t\t\t\t\t\tselected: index === 0,\n\t\t\t\t\t\tcount,\n\t\t\t\t\t} ) )\n\t\t\t: [];\n\n\t\tsetDisplayedOptions( productsRating );\n\t}, [\n\t\tshowCounts,\n\t\tisPreview,\n\t\tcollectionFilters,\n\t\tfilteredCountsLoading,\n\t\tproductRatingsQuery,\n\t\tminRating,\n\t] );\n\n\tif ( ! filteredCountsLoading && displayedOptions.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst hasFilterableProducts = getSettingWithCoercion(\n\t\t'hasFilterableProducts',\n\t\tfalse,\n\t\tisBoolean\n\t);\n\n\tif ( ! hasFilterableProducts ) {\n\t\treturn null;\n\t}\n\n\tconst showNoProductsNotice =\n\t\t! filteredCountsLoading && ! collectionFilters.rating_counts?.length;\n\n\treturn (\n\t\t<>\n\t\t\t\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t{ showNoProductsNotice && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\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\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\n\t\t\t\t\t\t\t{ children }\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( RatingFilterEdit );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/rating-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": "Create a woocommerce block with customizable pagination arrow"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews-pagination\",\n\t\"title\": \"Reviews Pagination\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews\" ],\n\t\"allowedBlocks\": [\n\t\t\"woocommerce/product-reviews-pagination-previous\",\n\t\t\"woocommerce/product-reviews-pagination-numbers\",\n\t\t\"woocommerce/product-reviews-pagination-next\"\n\t],\n\t\"description\": \"Displays a paginated navigation to next/previous set of product reviews, when applicable.\",\n\t\"textdomain\": \"woocommerce\",\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\"reviews/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}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t// @ts-expect-error useInnerBlocksProps is not exported from @wordpress/block-editor\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tWarning,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { ReviewsPaginationArrowControls } from './reviews-pagination-arrow-controls';\nimport './editor.scss';\n\nconst TEMPLATE = [\n\t[ 'woocommerce/product-reviews-pagination-previous' ],\n\t[ 'woocommerce/product-reviews-pagination-numbers' ],\n\t[ 'woocommerce/product-reviews-pagination-next' ],\n];\n\ntype Props = BlockEditProps< { paginationArrow: string | number | undefined } >;\n\nexport default function Edit( {\n\tattributes: { paginationArrow },\n\tsetAttributes,\n\tclientId,\n}: Props ) {\n\tconst hasNextPreviousBlocks = useSelect(\n\t\t( select ) => {\n\t\t\t// TODO: remove the @ts-expect-error comment and typecast for innerBlock once we upgrade @wordpress/block-editor types version.\n\t\t\t// @ts-expect-error We're using an outdated types of `@wordpress/block-editor`, so the property 'getBlocks' does not exist on type returned by select.\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\t\t\t/**\n\t\t\t * Show the `paginationArrow` control only if a\n\t\t\t * Product Reviews Pagination Next or Product Reviews Pagination Previous\n\t\t\t * block exists.\n\t\t\t */\n\t\t\treturn innerBlocks?.find( ( innerBlock: { name: string } ) => {\n\t\t\t\treturn [\n\t\t\t\t\t'woocommerce/product-reviews-pagination-previous',\n\t\t\t\t\t'woocommerce/product-reviews-pagination-next',\n\t\t\t\t].includes( innerBlock.name );\n\t\t\t} );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\t// Get the Discussion settings\n\tconst pageComments = useSelect( ( select ) => {\n\t\t// @ts-expect-error We're using an outdated types of `@wordpress/block-editor`, so the property 'getSettings' does not exist on type returned by select.\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings?.pageComments;\n\t}, [] );\n\n\t// If paging comments is not enabled in the Discussion Settings then hide the pagination\n\t// controls. We don't want to remove them from the template so that when the user enables\n\t// paging comments, the controls will be visible.\n\tif ( ! pageComments ) {\n\t\treturn (\n\t\t\t\n\t\t\t\t{ __(\n\t\t\t\t\t'Product Reviews Pagination block: paging comments is disabled in the Discussion Settings',\n\t\t\t\t\t'woocommerce'\n\t\t\t\t) }\n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasNextPreviousBlocks && (\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\tpaginationArrow: 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/>\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\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination/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": "Develop a block for Shows the subtotal, fees, discounts, shipping and taxes. 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/cart/inner-blocks/cart-order-summary-totals/block.json\n{\n\t\"name\": \"woocommerce/cart-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/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-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.CART_ORDER_SUMMARY_TOTALS\n\t);\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/cart-order-summary-subtotal-block', {}, [] ],\n\t\t[ 'woocommerce/cart-order-summary-fee-block', {}, [] ],\n\t\t[ 'woocommerce/cart-order-summary-discount-block', {}, [] ],\n\t\t[ 'woocommerce/cart-order-summary-shipping-block', {}, [] ],\n\t\t[ 'woocommerce/cart-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 Display the order confirmation shipping 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/shipping-wrapper/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-shipping-wrapper\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping Address Section\",\n\t\"description\": \"Display the order confirmation shipping 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\t\"default\": \"Shipping\"\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/shipping-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-shipping-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": "Build a Gutenberg block that Display a list of related posts. with these attributes: post layout, display author, display date, 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/related-posts/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/related-posts\",\n\t\"title\": \"Related Posts\",\n\t\"description\": \"Display a list of related posts.\",\n\t\"keywords\": [ \"similar content\", \"linked\", \"connected\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\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\t\"align\": [ \"wide\", \"full\" ]\n\t},\n\t\"attributes\": {\n\t\t\"postLayout\": {\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\": false\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\"displayThumbnails\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\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\"postsToShow\": {\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\"postLayout\": \"grid\",\n\t\t\t\"displayAuthor\": false,\n\t\t\t\"displayDate\": true,\n\t\t\t\"displayThumbnails\": true,\n\t\t\t\"displayContext\": false,\n\t\t\t\"postsToShow\": 2\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/related-posts/edit.js\nimport { useModuleStatus } from '@automattic/jetpack-shared-extension-utils';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { Path, SVG } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { LoadingPostsGrid } from '../../shared/components/loading-posts-grid';\nimport { getEditorType, SITE_EDITOR } from '../../shared/get-editor-type';\nimport metadata from './block.json';\nimport { RelatedPostsBlockControls, RelatedPostsInspectorControls } from './controls';\nimport { useRelatedPosts } from './hooks/use-related-posts';\nimport { useRelatedPostsStatus } from './hooks/use-status-toggle';\nimport { InactiveRelatedPostsPlaceholder } from './inactive-placeholder';\nimport './editor.scss';\n\nconst featureName = metadata.name.replace( 'jetpack/', '' );\n\nexport const MAX_POSTS_TO_SHOW = 6;\n\nfunction PlaceholderPostEdit( props ) {\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t{ props.isInSiteEditor\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Preview unavailable in site editor. The post title will appear normally on your site.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\"Preview unavailable: you haven't published enough posts with similar content.\",\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t ) }\n\t\t\t\n\t\t\t{ props.displayThumbnails && (\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\n\t\t\t{ props.displayDate && (\n\t\t\t\t
\n\t);\n}\n\nexport default function RelatedPostsEdit( { attributes, setAttributes } ) {\n\tconst { displayAuthor, displayContext, displayDate, displayThumbnails, postLayout, postsToShow } =\n\t\tattributes;\n\n\tconst blockProps = useBlockProps();\n\t// Related Posts can be controlled by a module on self-hosted sites.\n\tconst { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =\n\t\tuseModuleStatus( featureName );\n\t// They can also be toggled via an option on WordPress.com Simple.\n\tconst { isEnabled, enable, isFetchingStatus, isUpdatingStatus } = useRelatedPostsStatus();\n\n\tconst isChangingRelatedPostsStatus = isChangingStatus || isUpdatingStatus;\n\n\tconst { posts, isLoading: isLoadingRelatedPosts } = useRelatedPosts( isEnabled );\n\n\tconst isInSiteEditor = SITE_EDITOR === getEditorType();\n\n\tconst { instanceId } = useInstanceId( RelatedPostsEdit );\n\n\tlet content;\n\n\tif ( isLoadingModules || isFetchingStatus || isLoadingRelatedPosts ) {\n\t\tcontent = ;\n\t} else if ( ! isModuleActive || ! isEnabled ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else {\n\t\t// To prevent the block from crashing, we need to limit ourselves to the\n\t\t// posts returned by the backend - so if we want 6 posts, but only 3 are\n\t\t// returned, we need to limit ourselves to those 3 and fill in the rest\n\t\t// with placeholders.\n\t\t//\n\t\t// Also, if the site does not have sufficient posts to display related ones\n\t\t// (minimum 10 posts), we also use this code block to fill in the\n\t\t// placeholders.\n\t\tconst previewClassName = 'jp-relatedposts-i2';\n\t\tconst displayPosts = [];\n\t\tfor ( let i = 0; i < postsToShow; i++ ) {\n\t\t\tif ( posts[ i ] ) {\n\t\t\t\tdisplayPosts.push(\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdisplayPosts.push(\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\t}\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\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\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\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 woocommerce-product-elements block with customizable product id, is descendent of query loop, is descendent of single product template, 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/atomic/blocks/product-elements/summary/block.json\n{\n\t\"name\": \"woocommerce/product-summary\",\n\t\"icon\": \"page\",\n\t\"title\": \"Product Summary\",\n\t\"description\": \"Display a short description about 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\"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\t\"isDescendantOfAllProducts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showDescriptionIfEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"summaryLength\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"linkText\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\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\"text\": true,\n\t\t\t\"background\": 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\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"textAlign\": 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\"__experimentalSelector\": \".wc-block-components-product-summary\"\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\"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/summary/index.ts\n/**\n * External dependencies\n */\nimport type { BlockAttributes } from '@wordpress/blocks';\nimport { registerProductBlockType } from '@woocommerce/atomic-utils';\nimport { isEmptyObject } from '@woocommerce/types';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport { BLOCK_ICON as icon } from './constants';\nimport save from '../save';\nimport metadata from './block.json';\nimport './upgrade';\n\nconst deprecated = [\n\t{\n\t\tsave,\n\t\tmigrate: ( attributes: BlockAttributes ) => {\n\t\t\t// We don't deprecate attributes, but adding new ones.\n\t\t\t// For backwards compatibility, some new attributes require\n\t\t\t// different defaults than new ones.\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tshowDescriptionIfEmpty: true,\n\t\t\t\tsummaryLength: 150,\n\t\t\t};\n\t\t},\n\t\tisEligible: ( attributes: BlockAttributes ) =>\n\t\t\tisEmptyObject( attributes ),\n\t},\n];\n\nconst blockConfig = {\n\t...metadata,\n\n\ticon: { src: icon },\n\tdeprecated,\n\tedit,\n\tsave,\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": "Build a WordPress block to Display a product’s SKU, categories, tags, 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: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/product-meta/block.json\n{\n\t\"name\": \"woocommerce/product-meta\",\n\t\"title\": \"Product Meta\",\n\t\"icon\": \"product\",\n\t\"description\": \"Display a product’s SKU, categories, tags, and more.\",\n\t\"category\": \"woocommerce-product-elements\",\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},\n\t\"keywords\": [ \"WooCommerce\" ],\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/atomic/blocks/product-elements/product-meta/edit.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { InnerBlockTemplate } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './editor.scss';\n\nconst Edit = () => {\n\tconst TEMPLATE: InnerBlockTemplate[] = [\n\t\t[\n\t\t\t'core/group',\n\t\t\t{ layout: { type: 'flex', flexWrap: 'nowrap' } },\n\t\t\t[\n\t\t\t\t[ 'woocommerce/product-sku' ],\n\t\t\t\t[\n\t\t\t\t\t'core/post-terms',\n\t\t\t\t\t{\n\t\t\t\t\t\tprefix: __( 'Category: ', 'woocommerce' ),\n\t\t\t\t\t\tterm: 'product_cat',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\t'core/post-terms',\n\t\t\t\t\t{\n\t\t\t\t\t\tprefix: __( 'Tags: ', 'woocommerce' ),\n\t\t\t\t\t\tterm: 'product_tag',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t],\n\t\t],\n\t];\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\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 custom WordPress block that helps customers navigate store layouts and parent page relationships, featuring configurable typography and alignment settings for improved user experience."}, {"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/breadcrumbs/block.json\n{\n\t\"name\": \"woocommerce/breadcrumbs\",\n\t\"title\": \"Store Breadcrumbs\",\n\t\"description\": \"Enable customers to keep track of their location within the store and navigate back to parent pages.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"contentJustification\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"fontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"small\"\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t}\n\t},\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\"color\": {\n\t\t\t\"background\": false,\n\t\t\t\"link\": true\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\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalFontWeight\": 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},\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/breadcrumbs/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Disabled } from '@wordpress/components';\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-breadcrumbs',\n\t} );\n\n\treturn (\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": "Craft a customizable WordPress block enabling the collection of customer contact details with configurable 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-contact-information-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-contact-information-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Contact Information\",\n\t\"description\": \"Collect your customer's contact information.\",\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-contact-information-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 { ADMIN_URL } from '@woocommerce/settings';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\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 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} ): JSX.Element => {\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'Account creation and guest checkout settings 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);\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 theme block with the ability to dynamically modify and personalize comment identification 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-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 This block is deprecated. Please use the Avatar block instead. with these attributes: width, height"}, {"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-avatar/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/comment-author-avatar\",\n\t\"title\": \"Comment Author Avatar (deprecated)\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"This block is deprecated. Please use the Avatar block instead.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"width\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 96\n\t\t},\n\t\t\"height\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 96\n\t\t}\n\t},\n\t\"usesContext\": [ \"commentId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"inserter\": false,\n\t\t\"__experimentalBorder\": {\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},\n\t\t\"color\": {\n\t\t\t\"background\": 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\"__experimentalSkipSerialization\": true,\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}\n\n\n// File: packages/block-library/src/comment-author-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};\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 block for rendering cart shipping information with integrated user-configurable lock settings 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: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json\n{\n\t\"name\": \"woocommerce/checkout-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/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-shipping/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} ): 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 Gutenberg block that Create structured content in rows and columns to display information. with these attributes: has fixed layout, caption, head, 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/table/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/table\",\n\t\"title\": \"Table\",\n\t\"category\": \"text\",\n\t\"description\": \"Create structured content in rows and columns to display information.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"hasFixedLayout\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\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\"head\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [],\n\t\t\t\"source\": \"query\",\n\t\t\t\"selector\": \"thead tr\",\n\t\t\t\"query\": {\n\t\t\t\t\"cells\": {\n\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\"default\": [],\n\t\t\t\t\t\"source\": \"query\",\n\t\t\t\t\t\"selector\": \"td,th\",\n\t\t\t\t\t\"query\": {\n\t\t\t\t\t\t\"content\": {\n\t\t\t\t\t\t\t\"type\": \"rich-text\",\n\t\t\t\t\t\t\t\"source\": \"rich-text\",\n\t\t\t\t\t\t\t\"role\": \"content\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tag\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"default\": \"td\",\n\t\t\t\t\t\t\t\"source\": \"tag\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"scope\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"scope\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"align\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"data-align\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"colspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"colspan\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"rowspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"rowspan\"\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\t\"body\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [],\n\t\t\t\"source\": \"query\",\n\t\t\t\"selector\": \"tbody tr\",\n\t\t\t\"query\": {\n\t\t\t\t\"cells\": {\n\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\"default\": [],\n\t\t\t\t\t\"source\": \"query\",\n\t\t\t\t\t\"selector\": \"td,th\",\n\t\t\t\t\t\"query\": {\n\t\t\t\t\t\t\"content\": {\n\t\t\t\t\t\t\t\"type\": \"rich-text\",\n\t\t\t\t\t\t\t\"source\": \"rich-text\",\n\t\t\t\t\t\t\t\"role\": \"content\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tag\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"default\": \"td\",\n\t\t\t\t\t\t\t\"source\": \"tag\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"scope\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"scope\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"align\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"data-align\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"colspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"colspan\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"rowspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"rowspan\"\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\t\"foot\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": [],\n\t\t\t\"source\": \"query\",\n\t\t\t\"selector\": \"tfoot tr\",\n\t\t\t\"query\": {\n\t\t\t\t\"cells\": {\n\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\"default\": [],\n\t\t\t\t\t\"source\": \"query\",\n\t\t\t\t\t\"selector\": \"td,th\",\n\t\t\t\t\t\"query\": {\n\t\t\t\t\t\t\"content\": {\n\t\t\t\t\t\t\t\"type\": \"rich-text\",\n\t\t\t\t\t\t\t\"source\": \"rich-text\",\n\t\t\t\t\t\t\t\"role\": \"content\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tag\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"default\": \"td\",\n\t\t\t\t\t\t\t\"source\": \"tag\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"scope\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"scope\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"align\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"data-align\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"colspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"colspan\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"rowspan\": {\n\t\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\t\"source\": \"attribute\",\n\t\t\t\t\t\t\t\"attribute\": \"rowspan\"\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\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": true,\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\"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\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\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\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"selectors\": {\n\t\t\"root\": \".wp-block-table > table\",\n\t\t\"spacing\": \".wp-block-table\"\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"regular\",\n\t\t\t\"label\": \"Default\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{ \"name\": \"stripes\", \"label\": \"Stripes\" }\n\t],\n\t\"editorStyle\": \"wp-block-table-editor\",\n\t\"style\": \"wp-block-table\"\n}\n\n\n// File: packages/block-library/src/table/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable 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\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\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\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jaco Pastorius' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\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\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Betty Carter' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\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\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Bebo Valdés' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\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\tviewportWidth: 450,\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/table/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__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = clsx( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\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 lets users effortlessly insert and adjust Google Calendar displays by specifying the calendar's web address and visual dimensions."}, {"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-calendar/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/google-calendar\",\n\t\"title\": \"Google Calendar\",\n\t\"description\": \"Embed a Google Calendar.\",\n\t\"keywords\": [ \"events\", \"dates\", \"schedule\", \"appointments\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": { \"align\": true, \"alignWide\": true, \"html\": false },\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"height\": {\n\t\t\t\"type\": \"integer\",\n\t\t\t\"default\": 600\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"url\": \"https://calendar.google.com/calendar/embed?src=jb4bu80jirp0u11a6niie21pp4%40group.calendar.google.com&ctz=America/New_York\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/google-calendar/edit.js\nimport { isWpcomPlatformSite } from '@automattic/jetpack-script-data';\nimport { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { getBlockDefaultClassName } from '@wordpress/blocks';\nimport { Placeholder, SandBox, Button, ExternalLink, withNotices } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport metadata from './block.json';\nimport GoogleCalendarInspectorControls from './controls';\nimport { URL_REGEX, parseEmbed } from './utils';\n\nconst icon = getBlockIconComponent( metadata );\n\nexport function GoogleCalendarEdit( props ) {\n\tconst {\n\t\tattributes: { url, height },\n\t\tisMobile,\n\t\tisSelected,\n\t\tname,\n\t\tnoticeOperations,\n\t\tnoticeUI,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst blockProps = useBlockProps();\n\n\tconst [ editedEmbed, setEditedEmbed ] = useState( url || '' );\n\tconst [ editingUrl, setEditingUrl ] = useState( false );\n\tconst [ interactive, setInteractive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected && interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\tsetInteractive( false );\n\t\t}\n\t}, [ isSelected, interactive ] );\n\n\tconst hideOverlay = () => {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tsetInteractive( true );\n\t};\n\n\tconst setErrorNotice = () => {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(\n\t\t\t__(\n\t\t\t\t\"Your calendar couldn't be embedded. Please double check your URL or Embed Code. Please note, you need to use the 'Public URL' or 'Embed Code', the 'Shareable Link' will not work.\",\n\t\t\t\t'jetpack'\n\t\t\t)\n\t\t);\n\t};\n\n\tconst handleEmbed = event => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tconst newAttributes = parseEmbed( editedEmbed.trim() );\n\n\t\tif ( ! URL_REGEX.test( newAttributes.url ) ) {\n\t\t\tsetErrorNotice();\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( newAttributes );\n\t\tsetEditingUrl( false );\n\t\tnoticeOperations.removeAllNotices();\n\t};\n\n\tconst getEditForm = formClassName => (\n\t\t\n\t);\n\n\tconst defaultClassName = getBlockDefaultClassName( name );\n\tconst iframeHeight = isMobile ? '300' : height;\n\n\tconst html = ``;\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
{ permissionsLink }
\n\t\t\t\t\t\t
\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
\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\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{\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"}]}
{"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
\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
;\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);\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\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);\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);\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);\n}\n\nexport default PaymentButtonsEdit;\n\n\n// File: projects/plugins/jetpack/extensions/blocks/payment-buttons/save.js\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst className = clsx( {\n\t\t'has-custom-font-size': !! attributes?.fontSize || attributes?.style?.typography?.fontSize,\n\t} );\n\tconst blockProps = useBlockProps.save( { className: className } );\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 code snippets that respect your spacing and tabs. that allows users to configure: content"}, {"role": "assistant", "content": "// File: packages/block-library/src/code/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/code\",\n\t\"title\": \"Code\",\n\t\"category\": \"text\",\n\t\"description\": \"Display code snippets that respect your spacing and tabs.\",\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\": \"code\",\n\t\t\t\"__unstablePreserveWhiteSpace\": true,\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\" ],\n\t\t\"anchor\": 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\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\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\"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\"width\": true,\n\t\t\t\t\"color\": true\n\t\t\t}\n\t\t},\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\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"style\": \"wp-block-code\"\n}\n\n\n// File: packages/block-library/src/code/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { code 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: Preserve \\n markers for line breaks\n\t\t\tcontent: __(\n\t\t\t\t'// A “block” is the abstract term used\\n// to describe units of markup that\\n// when composed together, form the\\n// content or layout of a page.\\nregisterBlockType( name, settings );'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\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: 'content',\n\t\t\tlabel: __( 'Code' ),\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/code/save.js\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { escape } from './utils';\n\nexport default function save( { attributes } ) {\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-focused block that provides intuitive page display settings, empowering users to customize their content presentation within the WordPress 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: 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": "Create a WordPress block that enables view frequency-based visibility controls, allowing customization of visibility criteria and threshold limits for page access."}, {"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 WordPress block designed to showcase product ratings, enabling customization of product identification, query loop relationship, 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/rating/block.json\n{\n\t\"name\": \"woocommerce/product-rating\",\n\t\"icon\": \"info\",\n\t\"title\": \"Product Rating\",\n\t\"description\": \"Display the average rating 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\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false,\n\t\t\t\"link\": false,\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\"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\"\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/rating/index.ts\n/**\n * External dependencies\n */\nimport type { BlockConfiguration } from '@wordpress/blocks';\nimport { registerProductBlockType } from '@woocommerce/atomic-utils';\n\n/**\n * Internal dependencies\n */\nimport save from '../save';\nimport edit from './edit';\nimport { BLOCK_ICON as icon } from './constants';\nimport metadata from './block.json';\n\nconst blockConfig: BlockConfiguration = {\n\t...metadata,\n\ticon: { src: icon },\n\tedit,\n\tsave,\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": "Build a Gutenberg block that Display additional checkout fields from the 'contact' and 'order' locations. 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/additional-fields-wrapper/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-additional-fields-wrapper\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Additional Fields\",\n\t\"description\": \"Display additional checkout fields from the 'contact' and 'order' locations.\",\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/additional-fields-wrapper/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport {\n\tORDER_FORM_FIELDS,\n\tCONTACT_FORM_FIELDS,\n} from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\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\t\tclassName: 'wc-block-order-confirmation-additional-fields-wrapper',\n\t} );\n\n\tconst additionalFields = {\n\t\t...ORDER_FORM_FIELDS,\n\t\t...CONTACT_FORM_FIELDS,\n\t};\n\n\tif ( Object.entries( additionalFields ).length === 0 ) {\n\t\treturn null;\n\t}\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-additional-fields',\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 block for Displays the next posts page link. that allows users to configure: label"}, {"role": "assistant", "content": "// File: packages/block-library/src/query-pagination-next/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/query-pagination-next\",\n\t\"title\": \"Next Page\",\n\t\"category\": \"theme\",\n\t\"parent\": [ \"core/query-pagination\" ],\n\t\"description\": \"Displays the next posts 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\": [\n\t\t\"queryId\",\n\t\t\"query\",\n\t\t\"paginationArrow\",\n\t\t\"showLabel\",\n\t\t\"enhancedPagination\"\n\t],\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/query-pagination-next/index.js\n/**\n * WordPress dependencies\n */\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};\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 designed to render the principal product image with comprehensive attribute options, including toggles for link display, sale badge presentation, alignment, and several supplementary configuration choices."}, {"role": "assistant", "content": "// 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": "Construct a WooCommerce block that supports a configurable CSS class identifier and implements locking functionality."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.json\n{\n\t\"name\": \"woocommerce/checkout-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/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-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": "Design a custom Gutenberg block that serves as a fallback display for scenarios where no search or query results are available."}, {"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-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": "Build a WordPress block to Block: a8c/starscape"}, {"role": "assistant", "content": "// File: blocks/starscape/src/index.js\n/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport StarsIcon from './icon';\nimport attributes from './attributes';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nexport function registerBlock() {\n\tregisterBlockType( 'a8c/starscape', {\n\t\tapiVersion: 3,\n\t\ttitle: __( 'Starscape', 'starscape' ),\n\t\tdescription: __( 'Create content with stars in motion.', 'starscape' ),\n\t\ticon: ,\n\t\tcategory: 'widgets',\n\t\tsupports: {\n\t\t\tclassName: true,\n\t\t\talign: [ 'wide', 'full' ],\n\t\t\tcolor: {\n\t\t\t\theading: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t\tbackground: false,\n\t\t\t\tgradients: false,\n\t\t\t},\n\t\t\thtml: false,\n\t\t\tlayout: {\n\t\t\t\tallowJustification: false,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tpadding: true,\n\t\t\t\tmargin: [ 'top', 'bottom' ],\n\t\t\t\tblockGap: true,\n\t\t\t\t__experimentalDefaultControls: {\n\t\t\t\t\tpadding: true,\n\t\t\t\t\tblockGap: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tattributes,\n\t\tedit,\n\t\tsave,\n\t\tdeprecated,\n\t} );\n}\n\n\n// File: blocks/starscape/src/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Starscape from './starscape';\nimport { genStars, genAnimations } from './utils';\n\nfunction StarscapeSave( { attributes } ) {\n\tconst {\n\t\tbackground,\n\t\tcolor,\n\t\tintensity,\n\t\tdensity,\n\t\tspeed,\n\t\tminHeight,\n\t\tareaWidth,\n\t\tareaHeight,\n\t\ttagName,\n\t} = attributes;\n\n\tconst starStyles = genStars( { color, density, areaWidth, areaHeight } );\n\tconst animationStyles = genAnimations( { speed } );\n\n\tconst blockProps = useBlockProps.save( {\n\t\tstyle: { background, minHeight, overflow: 'hidden' },\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\tclassName: 'wp-block-a8c-starscape__inner',\n\t} );\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n}\n\nexport default StarscapeSave;\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 previous product review'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: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination-previous/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-reviews-pagination-previous\",\n\t\"title\": \"Reviews Previous Page\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews-pagination\" ],\n\t\"description\": \"Displays the previous product review's page link.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"reviews/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: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/reviews-pagination-previous/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, PlainText } from '@wordpress/block-editor';\nimport { BlockEditProps } from '@wordpress/blocks';\n\nconst arrowMap = {\n\tnone: '',\n\tarrow: '←',\n\tchevron: '«',\n};\n\ntype Props = BlockEditProps< { label: string } > & {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tcontext: { 'reviews/paginationArrow': string };\n};\n\nexport default function Edit( {\n\tattributes: { label },\n\tsetAttributes,\n\tcontext: { 'reviews/paginationArrow': paginationArrow },\n}: Props ) {\n\tconst displayArrow = arrowMap[ paginationArrow as keyof typeof arrowMap ];\n\treturn (\n\t\t event.preventDefault() }\n\t\t\t{ ...useBlockProps() }\n\t\t>\n\t\t\t{ displayArrow && (\n\t\t\t\t\n\t\t\t\t\t{ displayArrow }\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\tsetAttributes( { label: newLabel } )\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 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/status/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-status\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Status\",\n\t\"description\": \"Display a \\\"thank you\\\" message, or a sentence regarding the current order status.\",\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\"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/status/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-status',\n\t} );\n\n\treturn (\n\t\t
\n\t\t\t
{ __( 'Order received', 'woocommerce' ) }
\n\t\t\t
\n\t\t\t\t{ __(\n\t\t\t\t\t'Thank you. Your order has been received.',\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 woocommerce block with customizable taxonomy, show counts, display style, and 3 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/taxonomy-filter/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-taxonomy\",\n\t\"title\": \"Taxonomy Filter\",\n\t\"description\": \"Enable customers to filter the product collection by selecting one or more taxonomy terms, such as categories, brands, or tags.\",\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\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"product_cat\"\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\": \"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\"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}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/taxonomy-filter/edit.tsx\n/**\n * External dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport { withSpokenMessages } from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCollectionData } from '@woocommerce/base-context/hooks';\nimport { objectHasProp } from '@woocommerce/types';\n\n/**\n * Internal dependencies\n */\nimport { TaxonomyFilterInspectorControls } from './inspector';\nimport { termOptionsPreview } from './constants';\nimport { EditProps } from './types';\nimport { getAllowedBlocks } from '../../utils/get-allowed-blocks';\nimport { EXCLUDED_BLOCKS } from '../../constants';\nimport type { FilterOptionItem } from '../../types';\nimport { InitialDisabled } from '../../components/initial-disabled';\nimport { Notice } from '../../components/notice';\nimport { getTaxonomyLabel } from './utils';\nimport { sortFilterOptions } from '../../utils/sort-filter-options';\n\n// Create hierarchical structure: parents followed by their children\nfunction createHierarchicalList(\n\tterms: FilterOptionItem[],\n\tsortOrder: string\n) {\n\tconst children = new Map();\n\n\t// First: categorize terms\n\tterms.forEach( ( term ) => {\n\t\tif ( ! children.has( term.parent ) ) {\n\t\t\tchildren.set( term.parent, [] );\n\t\t}\n\t\tchildren.get( term.parent ).push( term );\n\t} );\n\n\t// Next: sort them\n\tchildren.keys().forEach( ( key ) => {\n\t\tchildren.set(\n\t\t\tkey,\n\t\t\tsortFilterOptions( children.get( key ), sortOrder )\n\t\t);\n\t} );\n\n\t// Last: build hierarchical list\n\tconst result: FilterOptionItem[] = [];\n\tfunction addTermsRecursively(\n\t\ttermList: FilterOptionItem[],\n\t\tdepth = 0,\n\t\tvisited = new Set< number >()\n\t) {\n\t\tif ( depth > 10 ) {\n\t\t\treturn;\n\t\t}\n\t\ttermList.forEach( ( term ) => {\n\t\t\tif ( ! term.id || visited.has( term.id ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvisited.add( term.id );\n\t\t\tresult.push( { ...term, depth } );\n\t\t\tconst termChildren = children.get( term.id ) || [];\n\t\t\tif ( termChildren.length > 0 ) {\n\t\t\t\taddTermsRecursively( termChildren, depth + 1, visited );\n\t\t\t}\n\t\t} );\n\t}\n\n\taddTermsRecursively( children.get( 0 ) );\n\treturn result;\n}\n\nconst Edit = ( props: EditProps ) => {\n\tconst { attributes: blockAttributes } = props;\n\n\tconst {\n\t\ttaxonomy,\n\t\tisPreview,\n\t\tdisplayStyle,\n\t\tshowCounts,\n\t\tsortOrder,\n\t\thideEmpty,\n\t} = blockAttributes;\n\n\tconst [ termOptions, setTermOptions ] = useState< FilterOptionItem[] >(\n\t\tisPreview\n\t\t\t? sortFilterOptions( [ ...termOptionsPreview ], sortOrder )\n\t\t\t: []\n\t);\n\tconst [ isOptionsLoading, setIsOptionsLoading ] = useState< boolean >(\n\t\t! isPreview\n\t);\n\n\t// Fetch taxonomy terms using WordPress core data\n\tconst { taxonomyTerms, isTermsLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isPreview || ! taxonomy ) {\n\t\t\t\treturn { taxonomyTerms: [], isTermsLoading: false };\n\t\t\t}\n\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst selectArgs = {\n\t\t\t\tper_page: 15,\n\t\t\t\thide_empty: hideEmpty,\n\t\t\t\torderby: 'name',\n\t\t\t\torder: 'asc',\n\t\t\t};\n\t\t\treturn {\n\t\t\t\ttaxonomyTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', taxonomy, selectArgs ) || [],\n\t\t\t\tisTermsLoading: ! hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\ttaxonomy,\n\t\t\t\t\tselectArgs,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ taxonomy, hideEmpty, isPreview ]\n\t);\n\n\t// Fetch taxonomy counts using the updated useCollectionData hook\n\tconst { data: filteredCounts, isLoading: isFilterCountsLoading } =\n\t\tuseCollectionData( {\n\t\t\tqueryTaxonomy: isPreview ? undefined : taxonomy,\n\t\t\tqueryState: {},\n\t\t\tisEditor: true,\n\t\t} );\n\n\tuseEffect( () => {\n\t\tif ( isPreview ) {\n\t\t\t// In preview mode, use the preview data directly\n\t\t\tsetTermOptions(\n\t\t\t\tsortFilterOptions( [ ...termOptionsPreview ], sortOrder )\n\t\t\t);\n\t\t\tsetIsOptionsLoading( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isTermsLoading || isFilterCountsLoading ) {\n\t\t\tsetIsOptionsLoading( true );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! taxonomyTerms.length ) {\n\t\t\tsetTermOptions( [] );\n\t\t\tsetIsOptionsLoading( false );\n\t\t\treturn;\n\t\t}\n\n\t\t// Get taxonomy counts from the API response\n\t\tconst taxonomyCounts =\n\t\t\tobjectHasProp( filteredCounts, 'taxonomy_counts' ) &&\n\t\t\tArray.isArray( filteredCounts.taxonomy_counts )\n\t\t\t\t? filteredCounts.taxonomy_counts\n\t\t\t\t: [];\n\n\t\t// Process the terms\n\t\tconst processedTerms = taxonomyTerms.reduce(\n\t\t\t( acc: FilterOptionItem[], term ) => {\n\t\t\t\tconst count =\n\t\t\t\t\ttaxonomyCounts.find( ( item ) => item.term === term.id )\n\t\t\t\t\t\t?.count || 0;\n\n\t\t\t\t// If hideEmpty is true and count is 0, exclude this term\n\t\t\t\tif ( hideEmpty && count === 0 ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\n\t\t\t\tacc.push( {\n\t\t\t\t\tlabel: term.name,\n\t\t\t\t\tvalue: term.slug,\n\t\t\t\t\tselected: false,\n\t\t\t\t\tcount,\n\t\t\t\t\tid: term.id,\n\t\t\t\t\tparent: term.parent || 0,\n\t\t\t\t} );\n\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[]\n\t\t);\n\n\t\t// Create hierarchical structure then apply sorting\n\t\tconst hierarchicalTerms = createHierarchicalList(\n\t\t\tprocessedTerms,\n\t\t\tsortOrder\n\t\t);\n\t\tsetTermOptions( hierarchicalTerms );\n\t\tsetIsOptionsLoading( false );\n\t}, [\n\t\ttaxonomy,\n\t\ttaxonomyTerms,\n\t\tfilteredCounts,\n\t\tsortOrder,\n\t\thideEmpty,\n\t\tisPreview,\n\t\tisTermsLoading,\n\t\tisFilterCountsLoading,\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: getTaxonomyLabel( taxonomy ),\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 = isPreview\n\t\t? false\n\t\t: isTermsLoading || isFilterCountsLoading || isOptionsLoading;\n\n\tif ( ! taxonomy )\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 a taxonomy 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\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Taxonomy label.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'There are no products associated with %s.',\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\tgetTaxonomyLabel( taxonomy )\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\nconst withThemeProvider = WrappedComponent => props => (\n\t\n\t\t\n\t\n);\n\nexport default compose( [\n\twithColors(\n\t\t{ emailFieldBackgroundColor: 'backgroundColor' },\n\t\t{ buttonBackgroundColor: 'backgroundColor' },\n\t\t{ textColor: 'color' },\n\t\t'borderColor'\n\t),\n\twithFontSizes( 'fontSize' ),\n\tapplyFallbackStyles,\n\twithThemeProvider,\n] )( SubscriptionEdit );\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 date on which the review was posted. with these attributes: format, is link"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-date/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-review-date\",\n\t\"title\": \"Review Date\",\n\t\"category\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-reviews\" ],\n\t\"description\": \"Displays the date on which the review was posted.\",\n\t\"textdomain\": \"woocommerce\",\n\t\"attributes\": {\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\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"commentId\" ],\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: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-date/edit.tsx\n/**\n * External dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport type { BlockEditProps } from '@wordpress/blocks';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t// @ts-expect-error - Experimental component\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\n\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n}: BlockEditProps< {\n\tformat: string;\n\tisLink: boolean;\n} > & {\n\tcontext: { commentId: number };\n} ) {\n\tconst blockProps = useBlockProps();\n\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-expect-error - the type of useEntityProp is not correct\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Review Date', 'block title', 'woocommerce' );\n\t}\n\n\tlet reviewDate =\n\t\tdate instanceof Date ? (\n\t\t\t\n\t\t) : (\n\t\t\t\n\t\t);\n\n\tif ( isLink ) {\n\t\treviewDate = (\n\t\t\t event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ reviewDate }\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( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\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\n\t\t\t\n\t\t\t
{ reviewDate }
\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 utilizing AI technology to convert voice input directly into a publishable post, incorporating a content attribute for seamless text generation."}, {"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/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
\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 widgets block with customizable ingredients, steps"}, {"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/recipe/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/recipe\",\n\t\"title\": \"Recipe (Beta)\",\n\t\"description\": \"Add images, ingredients and cooking steps to display an easy to read recipe.\",\n\t\"keywords\": [],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"widgets\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": [ \"full\", \"wide\" ],\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},\n\t\"attributes\": {\n\t\t\"ingredients\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"steps\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/recipe/edit.js\n/**\n * External dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nfunction RecipeEdit( { className } ) {\n\tconst RECIPE_TEMPLATE = [\n\t\t[ 'jetpack/recipe-hero' ],\n\t\t[\n\t\t\t'core/heading',\n\t\t\t{\n\t\t\t\tlevel: 2,\n\t\t\t\tplaceholder: __( 'Recipe Title', 'jetpack' ),\n\t\t\t\tclassName: 'wp-block-jetpack-recipe-title',\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t'core/separator',\n\t\t\t{\n\t\t\t\tcolor: '--wp--custom--color--foreground',\n\t\t\t\tclassName: 'is-style-wide',\n\t\t\t\tstyle: 'wide',\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\tplaceholder: __( 'Recipe Description', 'jetpack' ),\n\t\t\t\tclassName: 'wp-block-jetpack-recipe-description',\n\t\t\t},\n\t\t],\n\t\t[ 'jetpack/recipe-details', {} ],\n\t\t[\n\t\t\t'core/columns',\n\t\t\t{},\n\t\t\t[\n\t\t\t\t[\n\t\t\t\t\t'core/column',\n\t\t\t\t\t{\n\t\t\t\t\t\twidth: '33.33%',\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'core/heading',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\t\t\t// translators: Ingredients heading for a recipe block.\n\t\t\t\t\t\t\t\tcontent: __( 'Ingredients', 'jetpack' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[ 'jetpack/recipe-ingredients-list' ],\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\t'core/column',\n\t\t\t\t\t{\n\t\t\t\t\t\twidth: '66.66%',\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'core/heading',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\t\t\t// translators: Instructions heading for a recipe block.\n\t\t\t\t\t\t\t\tcontent: __( 'Instructions', 'jetpack' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[ 'jetpack/recipe-steps' ],\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);\n};\n\nexport default RecipeSave;\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 Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here. with these attributes: headings, only include current page, max level, ordered"}, {"role": "assistant", "content": "// File: packages/block-library/src/table-of-contents/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/table-of-contents\",\n\t\"title\": \"Table of Contents\",\n\t\"category\": \"design\",\n\t\"description\": \"Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.\",\n\t\"keywords\": [ \"document outline\", \"summary\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"headings\": {\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\"onlyIncludeCurrentPage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"maxLevel\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"ordered\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"ariaLabel\": true,\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\"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\"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-table-of-contents\"\n}\n\n\n// File: packages/block-library/src/table-of-contents/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents 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;\n\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/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\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/table-of-contents/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\nexport default function save( {\n\tattributes: { headings = [], ordered = true },\n} ) {\n\tif ( headings.length === 0 ) {\n\t\treturn null;\n\t}\n\tconst ListTag = ordered ? 'ol' : 'ul';\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 Gutenberg block for Display the Large Image of a product."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-gallery/inner-blocks/product-gallery-large-image/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-gallery-large-image\",\n\t\"title\": \"Large Image\",\n\t\"description\": \"Display the Large Image of a product.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\", \"hoverZoom\", \"fullScreenOnClick\" ],\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"ancestor\": [ \"woocommerce/product-gallery\" ],\n\t\"viewScriptModule\": \"woocommerce/product-gallery-large-image\",\n\t\"editorStyle\": \"file:../woocommerce/product-gallery-large-image-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-gallery/inner-blocks/product-gallery-large-image/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport const Edit = () => {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wc-block-product-gallery-large-image__inner-blocks',\n\t\t},\n\t\t{\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t}\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t'wc-block-product-gallery-large-image wc-block-editor-product-gallery-large-image',\n\t} );\n\n\treturn (\n\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/inner-blocks/product-gallery-large-image/save.tsx\n/**\n * External dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport const Save = () => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: 'wc-block-product-gallery-large-image__inner-blocks',\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 text block with customizable content, text align"}, {"role": "assistant", "content": "// File: packages/block-library/src/verse/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/verse\",\n\t\"title\": \"Verse\",\n\t\"category\": \"text\",\n\t\"description\": \"Insert poetry. Use special spacing formats. Or quote song lyrics.\",\n\t\"keywords\": [ \"poetry\", \"poem\" ],\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\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\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\"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\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": 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\"__experimentalTextDecoration\": 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\"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\"radius\": true,\n\t\t\t\"width\": true,\n\t\t\t\"color\": 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-verse\",\n\t\"editorStyle\": \"wp-block-verse-editor\"\n}\n\n\n// File: packages/block-library/src/verse/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { verse 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\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Verse block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'WHAT was he doing, the great god Pan,\\n\tDown in the reeds by the river?\\nSpreading ruin and scattering ban,\\nSplashing and paddling with hoofs of a goat,\\nAnd breaking the golden lilies afloat\\n With the dragon-fly on the river.'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\tedit,\n\tsave,\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/verse/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 } = attributes;\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 Gutenberg block representing an Accordion Panel, ensuring it supports configurable attributes including block restrictions, template controls, initial expansion, and selection mechanism."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-panel/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/accordion-panel\",\n\t\"title\": \"Accordion Panel\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Accordion Panel\",\n\t\"example\": {},\n\t\"__experimental\": true,\n\t\"parent\": [ \"woocommerce/accordion-item\" ],\n\t\"supports\": {\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradient\": true\n\t\t},\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\"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\": true\n\t},\n\t\"attributes\": {\n\t\t\"allowedBlocks\": {\n\t\t\t\"type\": \"array\"\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\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\": \"woocommerce\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-panel/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);\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-panel/save.js\n/**\n * External dependencies\n */\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n} from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\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\treturn (\n\t\t
\n\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": "Develop a Gutenberg block to display the cart subtotal, incorporating a class name and lock attribute for customization and 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-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": "Develop a WordPress block that visually presents the currently applied filter selections."}, {"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": "Craft a WordPress block enabling product grid price range filtering with customizable options including class configuration, input field display, inline input mode, and two additional settings."}, {"role": "assistant", "content": "// 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);\n}\n\nexport default function MaybeDisabledEdit( props ) {\n\t// The block transformations menu renders a block preview popover using real blocks\n\t// for transformation. The block previews do not play nicely with useEffect and\n\t// updating content after a resolved API call. To disarm the block preview, we can\n\t// check to see if the block is being rendered within a Disabled context, and set\n\t// the isPreview flag accordingly.\n\treturn (\n\t\t\n\t\t\t{ isDisabled => {\n\t\t\t\treturn (\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/premium-content/save.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\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": "Build a block feature for displaying curated site recommendations that lets users personalize presentation through avatar display, description visibility, link opening preferences, and two extra configuration choices."}, {"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);\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": "Build a Gutenberg block that Show all product categories as a list or dropdown. with these attributes: align, has count, has image, 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/product-categories/block.json\n{\n\t\"name\": \"woocommerce/product-categories\",\n\t\"title\": \"Product Categories List\",\n\t\"category\": \"woocommerce\",\n\t\"description\": \"Show all product categories as a list or dropdown.\",\n\t\"keywords\": [ \"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\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"background\": false,\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}\n\t},\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hasCount\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"hasImage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"hasEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isDropdown\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"isHierarchical\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"showChildrenOnly\": {\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\"hasCount\": true,\n\t\t\t\"hasImage\": 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/product-categories/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 { ProductCategoriesBlockProps } from './types';\n\nexport default function ProductCategoriesEdit(\n\tprops: ProductCategoriesBlockProps\n): 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 Display a grid of your newest products. that allows users to configure: columns, rows, align buttons, and 7 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-new/block.json\n{\n\t\"name\": \"woocommerce/product-new\",\n\t\"title\": \"Newest Products\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display a grid of your newest products.\",\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\"categories\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"catOperator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"any\"\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\t\"editMode\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\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},\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-new/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { ProductNewestBlock } from './block';\nimport { ProductNewestBlockProps } from './types';\n\nexport const Edit = (\n\tprops: unknown & ProductNewestBlockProps\n): 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": "Create a widgets block with customizable comments to show, display avatar, display date, display 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/latest-comments/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/latest-comments\",\n\t\"title\": \"Latest Comments\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display a list of your most recent comments.\",\n\t\"keywords\": [ \"recent comments\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"commentsToShow\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 5,\n\t\t\t\"minimum\": 1,\n\t\t\t\"maximum\": 100\n\t\t},\n\t\t\"displayAvatar\": {\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\"displayContent\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"excerpt\",\n\t\t\t\"enum\": [ \"none\", \"excerpt\", \"full\" ]\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": 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\t\"link\": true\n\t\t\t}\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\": {\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-latest-comments-editor\",\n\t\"style\": \"wp-block-latest-comments\"\n}\n\n\n// File: packages/block-library/src/latest-comments/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 deprecated from './deprecated';\n\nconst { name } = metadata;\n\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": "Craft a personalized Gutenberg block specifically designed with the identifier a8c/event, implementing custom functionality and design."}, {"role": "assistant", "content": "// File: blocks/event/src/index.js\n/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Icon } from './icons';\nimport Edit from './edit';\nimport Save from './save';\n\nexport function registerBlock() {\n\tregisterBlockType( 'a8c/event', {\n\t\ttitle: __( 'Event', 'event' ),\n\t\tdescription: __( 'Show the time and location of an event.', 'event' ),\n\t\ticon: ,\n\t\tcategory: 'widgets',\n\t\tsupports: {\n\t\t\talign: [ 'center', 'wide' ],\n\t\t},\n\t\texample: {\n\t\t\tattributes: {\n\t\t\t\teventTitle: 'Digging for Treasure',\n\t\t\t\teventLocation: 'Treasure Island',\n\t\t\t\teventStart: '1783-11-14T12:00:00',\n\t\t\t\teventImageId: 1,\n\t\t\t\teventImageURL:\n\t\t\t\t\t'https://upload.wikimedia.org/wikipedia/commons/thumb/0/03/TI-treasure.jpg/366px-TI-treasure.jpg',\n\t\t\t\teventImageAlt: 'Treasure',\n\t\t\t\tfocalPoint: {\n\t\t\t\t\tx: '0.30',\n\t\t\t\t\ty: '0.40',\n\t\t\t\t},\n\t\t\t\tcustomBackgroundColor: '#d4c5af',\n\t\t\t\talign: 'wide',\n\t\t\t},\n\t\t},\n\t\tattributes: {\n\t\t\teventTitle: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\teventLocation: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\teventStart: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\teventImageId: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\teventImageURL: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\teventImageAlt: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\tfocalPoint: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomTextColor: {\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/event/src/save.js\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tInnerBlocks,\n\tRichText,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { getSettings, dateI18n } from '@wordpress/date';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DateSelect from './date-select';\n\nconst Save = ( { attributes } ) => {\n\tconst settings = getSettings();\n\n\tconst classNames = [\n\t\tgetColorClassName( 'color', attributes.textColor ),\n\t\tgetColorClassName( 'background-color', attributes.backgroundColor ),\n\t];\n\tconst style = {\n\t\tcolor: attributes.customTextColor,\n\t\tbackgroundColor: attributes.customBackgroundColor,\n\t};\n\tconst imgStyle = {\n\t\tbackgroundImage:\n\t\t\tattributes.eventImageURL && `url(${ attributes.eventImageURL })`,\n\t\tbackgroundPosition:\n\t\t\tattributes.focalPoint &&\n\t\t\t`${ attributes.focalPoint.x * 100 }% ${ attributes.focalPoint.y *\n\t\t\t\t100 }%`,\n\t\tbackgroundSize: 'cover',\n\t};\n\n\treturn (\n\t\t
\n\t\t);\n\t}\n\n\treturn (\n\t\t\n\t\t\t{ commentTree &&\n\t\t\t\tcommentTree.map(\n\t\t\t\t\t(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommentId,\n\t\t\t\t\t\t}: {\n\t\t\t\t\t\t\tcommentId: number;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tindex: number\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\t\t\n\t);\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-reviews/inner-blocks/review-template/save.tsx\n/**\n * External dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function ReviewTemplateSave() {\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 extension allowing seamless product variation browsing and selection, with integrated cart functionality for immediate purchase."}, {"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-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": "Implement a Gutenberg block for Display a group of products that can be added to the cart."}, {"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/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-grouped-product-selector\",\n\t\"title\": \"Grouped Product Selector (Beta)\",\n\t\"description\": \"Display a group of products that can be added to the 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-grouped-product-selector\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { type BlockEditProps } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { GROUPED_PRODUCT_ITEM_TEMPLATE } from './product-item/constants';\n\ninterface Attributes {\n\tclassName?: string;\n}\n\nexport default function AddToCartWithOptionsGroupedProductSelectorEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { className } = props.attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: GROUPED_PRODUCT_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/grouped-product-selector/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function AddToCartWithOptionsGroupedProductSelectorSave() {\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": "Engineer a versatile block mechanism for rendering post comments that provides flexible configuration options for tag naming and legacy 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/comments/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments\",\n\t\"title\": \"Comments\",\n\t\"category\": \"theme\",\n\t\"description\": \"An advanced block that allows displaying post comments using different visual configurations.\",\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\"legacy\": {\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\"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\"editorStyle\": \"wp-block-comments-editor\",\n\t\"usesContext\": [ \"postId\", \"postType\" ]\n}\n\n\n// File: packages/block-library/src/comments/index.js\n/**\n * WordPress dependencies\n */\nimport { postComments as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/comments/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag, legacy } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\t// The legacy version is dynamic (i.e. PHP rendered) and doesn't allow inner\n\t// blocks, so nothing is saved in that case.\n\treturn legacy ? null : ;\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": "Implement a Gutenberg block for Block: a8c/bauhaus-centenary"}, {"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/bauhaus-centenary/src/index.js\n/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Edit from './edit';\nimport Save from './save';\nimport { BauhausIcon } from './icon';\n\nexport const registerBlock = () => {\n\tregisterBlockType( 'a8c/bauhaus-centenary', {\n\t\ttitle: 'Bauhaus Centenary',\n\t\tdescription: __( 'Celebrate the centenary of the design school', 'bauhaus-centenary' ),\n\t\ticon: BauhausIcon,\n\t\tcategory: 'widgets',\n\t\tsupports: {\n\t\t\talign: true,\n\t\t},\n\t\tattributes: {\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'center',\n\t\t\t},\n\t\t\tcaption: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\theight: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tdefault: 128,\n\t\t\t},\n\t\t\tcategory: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tfill1Color: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tfill2Color: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tfill3Color: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tyear: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '1919',\n\t\t\t},\n\t\t},\n\t\tedit: ( props ) => ,\n\t\tsave: ( props ) => ,\n\t} );\n};\n\n\n// File: blocks/bauhaus-centenary/src/save.js\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, getColorClassName } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport categories from './categories';\n\nconst Save = ( { attributes, className } ) => {\n\tconst Category = categories[ attributes.category ];\n\n\tconst style = {\n\t\tbackgroundColor: attributes.customBackgroundColor,\n\t};\n\n\tconst classNames = classnames(\n\t\tclassName,\n\t\t{ [ `align${ attributes.align }` ]: attributes.align },\n\t\tgetColorClassName( 'background-color', attributes.backgroundColor ),\n\t);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t{ ! RichText.isEmpty( attributes.caption ) && }\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 WordPress block to Add a way of selecting a child product within the Grouped Product block. Depending on the type of product and its properties, this might be a button, a checkbox, or a link."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-grouped-product-item-selector\",\n\t\"title\": \"Grouped Product: Item Selector (Beta)\",\n\t\"description\": \"Add a way of selecting a child product within the Grouped Product block. Depending on the type of product and its properties, this might be a button, a checkbox, or a link.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\" ],\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\"inserter\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-grouped-product-item-selector-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/edit.tsx\n/**\n * External dependencies\n */\nimport { useProductDataContext } from '@woocommerce/shared-context';\nimport { Disabled, Spinner } from '@wordpress/components';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { isProductResponseItem } from '@woocommerce/entities';\n\n/**\n * Internal dependencies\n */\nimport QuantityStepper from '../../components/quantity-stepper';\n\nconst CTA = () => {\n\tconst { isLoading, product } = useProductDataContext();\n\n\tif ( isLoading || ! isProductResponseItem( product ) ) {\n\t\treturn ;\n\t}\n\n\tconst {\n\t\tpermalink,\n\t\tadd_to_cart: productCartDetails,\n\t\thas_options: hasOptions,\n\t\tis_purchasable: isPurchasable,\n\t\tis_in_stock: isInStock,\n\t\tsold_individually: soldIndividually,\n\t} = product;\n\n\tif ( ! hasOptions && isPurchasable && isInStock ) {\n\t\tif ( soldIndividually ) {\n\t\t\treturn (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\t\treturn ;\n\t}\n\n\treturn (\n\t\t\n\t\t\t{ productCartDetails?.text || __( 'Add to Cart', 'woocommerce' ) }\n\t\t\n\t);\n};\n\nexport default function ProductItemCTAEdit() {\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t'wc-block-add-to-cart-with-options-grouped-product-item-selector',\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"}]}
{"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 rating display block that provides flexibility in setting product details, including its ID, query loop hierarchy, text positioning, and two supplementary 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: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/rating/block.json\n{\n\t\"name\": \"woocommerce/product-rating\",\n\t\"icon\": \"info\",\n\t\"title\": \"Product Rating\",\n\t\"description\": \"Display the average rating 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\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": false,\n\t\t\t\"link\": false,\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\"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\"\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/rating/index.ts\n/**\n * External dependencies\n */\nimport type { BlockConfiguration } from '@wordpress/blocks';\nimport { registerProductBlockType } from '@woocommerce/atomic-utils';\n\n/**\n * Internal dependencies\n */\nimport save from '../save';\nimport edit from './edit';\nimport { BLOCK_ICON as icon } from './constants';\nimport metadata from './block.json';\n\nconst blockConfig: BlockConfiguration = {\n\t...metadata,\n\ticon: { src: icon },\n\tedit,\n\tsave,\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": "Craft a custom Gutenberg block designed to showcase post or page URLs, incorporating configurable attributes for content display and link targeting behavior."}, {"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": "Develop a block for Display a grid of your top rated products. that allows users to configure: columns, rows, align buttons, 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: plugins/woocommerce/client/blocks/assets/js/blocks/product-top-rated/block.json\n{\n\t\"name\": \"woocommerce/product-top-rated\",\n\t\"title\": \"Top Rated Products\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"Display a grid of your top rated products.\",\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\"categories\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"default\": []\n\t\t},\n\t\t\"catOperator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"any\"\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\t\"editMode\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\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\": \"rating\"\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-top-rated/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { ProductTopRatedBlock } from './block';\nimport { Props } from './types';\n\nexport const Edit = ( props: unknown & Props ): 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 WooCommerce block featuring configurable locking functionality that allows users to customize access and security settings."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/block.json\n{\n\t\"name\": \"woocommerce/proceed-to-checkout-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Proceed to Checkout\",\n\t\"description\": \"Allow customers proceed to Checkout.\",\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\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport EditableButton from '@woocommerce/editor-components/editable-button';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport PageSelector from '@woocommerce/editor-components/page-selector';\nimport { CART_PAGE_ID } from '@woocommerce/block-settings';\n\n/**\n * Internal dependencies\n */\nimport { defaultButtonLabel } from './constants';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tcheckoutPageId: number;\n\t\tclassName: string;\n\t\tbuttonLabel: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { checkoutPageId = 0, buttonLabel } = attributes;\n\tconst { current: savedCheckoutPageId } = useRef( checkoutPageId );\n\n\tconst currentPostId = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! savedCheckoutPageId ) {\n\t\t\t\tconst store = select( 'core/editor' );\n\t\t\t\treturn store.getCurrentPostId();\n\t\t\t}\n\t\t\treturn savedCheckoutPageId;\n\t\t},\n\t\t[ savedCheckoutPageId ]\n\t);\n\n\treturn (\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 WordPress block to Let your visitors send you messages with the tap of a button."}, {"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/send-a-message/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/send-a-message\",\n\t\"title\": \"Send A Message\",\n\t\"description\": \"Let your visitors send you messages with the tap of a button.\",\n\t\"keywords\": [ \"whatsapp\", \"messenger\", \"contact\", \"support\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false\n\t},\n\t\"attributes\": {},\n\t\"example\": {}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/send-a-message/edit.js\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\nexport default function SendAMessageEdit() {\n\tconst blockProps = useBlockProps();\n\t// Default template is single WhatsApp block until we offer\n\t// more services\n\tconst DEFAULT_TEMPLATE = [ [ 'jetpack/whatsapp-button', {} ] ];\n\tconst ALLOWED_BLOCKS = [ 'jetpack/whatsapp-button' ];\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 Display the order details section. that allows users to configure: 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/totals-wrapper/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-totals-wrapper\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Totals Section\",\n\t\"description\": \"Display the order details 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/totals-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-totals',\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": "Build a Gutenberg block that Display a post's comments form. with these attributes: text align"}, {"role": "assistant", "content": "// File: packages/block-library/src/post-comments-form/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-comments-form\",\n\t\"title\": \"Comments Form\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display a post's comments form.\",\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\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\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\"editorStyle\": \"wp-block-post-comments-form-editor\",\n\t\"style\": [\n\t\t\"wp-block-post-comments-form\",\n\t\t\"wp-block-buttons\",\n\t\t\"wp-block-button\"\n\t],\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"textAlign\": \"center\"\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/post-comments-form/index.js\n/**\n * WordPress dependencies\n */\nimport { postCommentsForm 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 WordPress block that renders a taxonomy term name with customizable text alignment, heading level, and optional linking 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: packages/block-library/src/term-name/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-name\",\n\t\"title\": \"Term Name\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the name of a taxonomy term.\",\n\t\"keywords\": [ \"term title\" ],\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\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\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\"levelOptions\": {\n\t\t\t\"type\": \"array\"\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\"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},\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-name\"\n}\n\n\n// File: packages/block-library/src/term-name/index.js\n/**\n * WordPress dependencies\n */\nimport { termName 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": "Create a WordPress block displaying post terms with customizable alignment, separator, and additional configurable parameters for flexible term 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/post-terms/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/post-terms\",\n\t\"title\": \"Post Terms\",\n\t\"category\": \"theme\",\n\t\"description\": \"Post terms.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"term\": {\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\"separator\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \", \"\n\t\t},\n\t\t\"prefix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"suffix\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\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\"style\": \"wp-block-post-terms\"\n}\n\n\n// File: packages/block-library/src/post-terms/index.js\n/**\n * WordPress dependencies\n */\nimport { postCategories as icon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport enhanceVariations from './hooks';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/template-part',\n\t\tenhanceVariations\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": "Develop a block for Create a break between ideas or sections with a horizontal separator. that allows users to configure: opacity, tag 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: packages/block-library/src/separator/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/separator\",\n\t\"title\": \"Separator\",\n\t\"category\": \"design\",\n\t\"description\": \"Create a break between ideas or sections with a horizontal separator.\",\n\t\"keywords\": [ \"horizontal-line\", \"hr\", \"divider\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"opacity\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"alpha-channel\"\n\t\t},\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"hr\", \"div\" ],\n\t\t\t\"default\": \"hr\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"center\", \"wide\", \"full\" ],\n\t\t\"color\": {\n\t\t\t\"enableContrastChecker\": false,\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"background\": 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\"margin\": [ \"top\", \"bottom\" ]\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\": \"default\", \"label\": \"Default\", \"isDefault\": true },\n\t\t{ \"name\": \"wide\", \"label\": \"Wide Line\" },\n\t\t{ \"name\": \"dots\", \"label\": \"Dots\" }\n\t],\n\t\"editorStyle\": \"wp-block-separator-editor\",\n\t\"style\": \"wp-block-separator\"\n}\n\n\n// File: packages/block-library/src/separator/index.js\n/**\n * WordPress dependencies\n */\nimport { separator 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 transforms from './transforms';\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\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\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/separator/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity, tagName: Tag } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\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 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/checkout/inner-blocks/checkout-pickup-options-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-pickup-options-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Pickup Method\",\n\t\"description\": \"Shows local pickup locations.\",\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-pickup-options-block/edit.tsx\n/* eslint-disable @wordpress/no-unsafe-wp-apis */\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { useSelect } from '@wordpress/data';\nimport { checkoutStore as checkoutStoreDescriptor } from '@woocommerce/block-data';\nimport { LOCAL_PICKUP_ENABLED } from '@woocommerce/block-settings';\nimport { Disabled } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\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} ): JSX.Element | null => {\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 { className } = attributes;\n\n\tif ( ! prefersCollection || ! LOCAL_PICKUP_ENABLED ) {\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\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 Block that displays the checkout button when the Mini-Cart has products. that allows users to configure: lock, checkout button label"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-checkout-button-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-checkout-button-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Proceed to Checkout Button\",\n\t\"description\": \"Block that displays the checkout 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\"checkoutButtonLabel\": {\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/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-checkout-button-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport EditableButton from '@woocommerce/editor-components/editable-button';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { defaultCheckoutButtonLabel } from './constants';\nimport { getVariant } from '../utils';\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\tcheckoutButtonLabel: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-mini-cart__footer-checkout' ),\n\t} );\n\tconst { checkoutButtonLabel } = attributes;\n\n\treturn (\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 custom WordPress block that introduces adjustable white space between elements, featuring configurable height and width attributes for precise spacing management."}, {"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 Describe in a few words what this site is about. This is important for search results, sharing on social media, and gives overall clarity to visitors. with these attributes: text align, level, level options"}, {"role": "assistant", "content": "// File: packages/block-library/src/site-tagline/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/site-tagline\",\n\t\"title\": \"Site Tagline\",\n\t\"category\": \"theme\",\n\t\"description\": \"Describe in a few words what this site is about. This is important for search results, sharing on social media, and gives overall clarity to visitors.\",\n\t\"keywords\": [ \"description\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\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\": 0\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},\n\t\"example\": {\n\t\t\"viewportWidth\": 350,\n\t\t\"attributes\": {\n\t\t\t\"textAlign\": \"center\"\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\"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\"contentRole\": 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\"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-tagline-editor\",\n\t\"style\": \"wp-block-site-tagline\"\n}\n\n\n// File: packages/block-library/src/site-tagline/index.js\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport icon from './icon';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\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": "Create a Gutenberg block for Displays the description of the 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-description/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/product-description\",\n\t\"title\": \"Product Description\",\n\t\"description\": \"Displays the description of the product.\",\n\t\"category\": \"woocommerce\",\n\t\"textdomain\": \"woocommerce\",\n\t\"usesContext\": [ \"postId\", \"postType\", \"queryId\" ],\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\"supports\": {\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"layout\": true,\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\"dimensions\": {\n\t\t\t\"minHeight\": 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\": 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\"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\": false,\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\"__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}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-description/edit.tsx\n/**\n * External dependencies\n */\nimport { useQueryLoopProductContextValidation } from '@woocommerce/base-hooks';\nimport {\n\tRecursionProvider,\n\tuseBlockProps,\n\tuseHasRecursion,\n\tWarning,\n} from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { ProductDescriptionEditProps } from './types';\n\nfunction Placeholder( { layoutClassNames } ) {\n\tconst blockProps = useBlockProps( { className: layoutClassNames } );\n\treturn (\n\t\t
\n\t\t\t
\n\t\t\t\t{ __(\n\t\t\t\t\t'This block displays the product description. When viewing a product page, 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);\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\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};\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);\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\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\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>\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\": \"