Merge branch 'trunk' into add/add-changelog-file-tool

This commit is contained in:
Néstor Soriano 2024-08-30 08:38:55 +02:00 committed by GitHub
commit 9f0fdde56c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
98 changed files with 132 additions and 96 deletions

View File

@ -53,6 +53,17 @@ Display the main product image.
- **Supports:** - **Supports:**
- **Attributes:** aspectRatio, height, imageSizing, isDescendentOfQueryLoop, isDescendentOfSingleProductBlock, productId, saleBadgeAlign, scale, showProductLink, showSaleBadge, width - **Attributes:** aspectRatio, height, imageSizing, isDescendentOfQueryLoop, isDescendentOfSingleProductBlock, productId, saleBadgeAlign, scale, showProductLink, showSaleBadge, width
## Product Price - woocommerce/product-price
Display the price of a product.
- **Name:** woocommerce/product-price
- **Category:** woocommerce-product-elements
- **Ancestor:** woocommerce/all-products,woocommerce/single-product,woocommerce/product-template,core/post-template
- **Parent:**
- **Supports:** ~~html~~
- **Attributes:** isDescendentOfQueryLoop, isDescendentOfSingleProductBlock, isDescendentOfSingleProductTemplate, productId, textAlign
## Product Details - woocommerce/product-details ## Product Details - woocommerce/product-details
Display a product's description, attributes, and reviews. Display a product's description, attributes, and reviews.

View File

@ -74,7 +74,7 @@
"post_title": "Blocks reference", "post_title": "Blocks reference",
"menu_title": "Blocks Reference", "menu_title": "Blocks Reference",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/building-a-woo-store/block-references.md", "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/building-a-woo-store/block-references.md",
"hash": "a33fe5766283aaa70154077692a180319110e133ad430bf8dda3032455bad45c", "hash": "329f17097ce67074a915d7814b2363e8b9e908910c1f7b196c8f4fd8594cc55c",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/building-a-woo-store/block-references.md", "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/building-a-woo-store/block-references.md",
"id": "1fbe91d7fa4fafaf35f0297e4cee1e7958756aed" "id": "1fbe91d7fa4fafaf35f0297e4cee1e7958756aed"
}, },
@ -1804,5 +1804,5 @@
"categories": [] "categories": []
} }
], ],
"hash": "0b0ae9b9ed454ab234a5f053f6efb37bafb3e90f1c98f6488263c019f552697b" "hash": "2ecf48b6181dae0526b3858df889bce4e6ee425e10f2c43d151771d845c5a948"
} }

View File

@ -0,0 +1,4 @@
Significance: minor
Type: tweak
Fix typo in initCustomFieldsToogle variable name

View File

@ -1,6 +1,6 @@
export { init as initCatalogVisibility } from './product-fields/catalog-visibility'; export { init as initCatalogVisibility } from './product-fields/catalog-visibility';
export { init as initCustomFields } from './product-fields/custom-fields'; export { init as initCustomFields } from './product-fields/custom-fields';
export { init as initCustomFieldsToogle } from './product-fields/custom-fields-toggle'; export { init as initCustomFieldsToggle } from './product-fields/custom-fields-toggle';
export { init as initCheckbox } from './generic/checkbox'; export { init as initCheckbox } from './generic/checkbox';
export { init as initCollapsible } from './generic/collapsible'; export { init as initCollapsible } from './generic/collapsible';
export { init as initConditional } from './generic/conditional'; export { init as initConditional } from './generic/conditional';

View File

@ -1,29 +0,0 @@
/**
* External dependencies
*/
import { BlockAttributes } from '@wordpress/blocks';
export const blockAttributes: BlockAttributes = {
productId: {
type: 'number',
default: 0,
},
isDescendentOfQueryLoop: {
type: 'boolean',
default: false,
},
textAlign: {
type: 'string',
default: '',
},
isDescendentOfSingleProductTemplate: {
type: 'boolean',
default: false,
},
isDescendentOfSingleProductBlock: {
type: 'boolean',
default: false,
},
};
export default blockAttributes;

View File

@ -0,0 +1,34 @@
{
"name": "woocommerce/product-price",
"version": "1.0.0",
"title": "Product Price",
"description": "Display the price of a product.",
"category": "woocommerce-product-elements",
"attributes": {
"productId": { "type": "number", "default": 0 },
"isDescendentOfQueryLoop": { "type": "boolean", "default": false },
"textAlign": { "type": "string", "default": "" },
"isDescendentOfSingleProductTemplate": {
"type": "boolean",
"default": false
},
"isDescendentOfSingleProductBlock": {
"type": "boolean",
"default": false
}
},
"usesContext": [ "query", "queryId", "postId" ],
"keywords": [ "WooCommerce" ],
"textdomain": "woocommerce",
"apiVersion": 3,
"supports": {
"html": false
},
"ancestor": [
"woocommerce/all-products",
"woocommerce/single-product",
"woocommerce/product-template",
"core/post-template"
],
"$schema": "https://schemas.wp.org/trunk/block.json"
}

View File

@ -1,17 +0,0 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { currencyDollar, Icon } from '@wordpress/icons';
export const BLOCK_TITLE: string = __( 'Product Price', 'woocommerce' );
export const BLOCK_ICON: JSX.Element = (
<Icon
icon={ currencyDollar }
className="wc-block-editor-components-block-icon"
/>
);
export const BLOCK_DESCRIPTION: string = __(
'Display the price of a product.',
'woocommerce'
);

View File

@ -2,33 +2,29 @@
* External dependencies * External dependencies
*/ */
import { registerBlockSingleProductTemplate } from '@woocommerce/atomic-utils'; import { registerBlockSingleProductTemplate } from '@woocommerce/atomic-utils';
import { currencyDollar, Icon } from '@wordpress/icons';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import sharedConfig from '../shared/config'; import sharedConfig from '../shared/config';
import edit from './edit'; import edit from './edit';
import attributes from './attributes';
import { supports } from './supports'; import { supports } from './supports';
import { import metadata from './block.json';
BLOCK_TITLE as title,
BLOCK_ICON as icon,
BLOCK_DESCRIPTION as description,
} from './constants';
const blockConfig = {
...sharedConfig,
title,
description,
usesContext: [ 'query', 'queryId', 'postId' ],
icon: { src: icon },
attributes,
supports,
edit,
};
registerBlockSingleProductTemplate( { registerBlockSingleProductTemplate( {
blockName: 'woocommerce/product-price', blockName: metadata.name,
blockSettings: blockConfig, blockMetadata: metadata,
blockSettings: {
...sharedConfig,
supports,
icon: (
<Icon
icon={ currencyDollar }
className="wc-block-editor-components-block-icon"
/>
),
edit,
},
isAvailableOnPostEditor: true, isAvailableOnPostEditor: true,
} ); } );

View File

@ -6,7 +6,7 @@ import { store, getContext } from '@woocommerce/interactivity';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
type ActiveFiltersContext = { type ActiveFiltersContext = {
queryId: number; queryId: number;

View File

@ -8,7 +8,7 @@ import { HTMLElementEvent } from '@woocommerce/types';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
type AttributeFilterContext = { type AttributeFilterContext = {
attributeSlug: string; attributeSlug: string;

View File

@ -6,7 +6,7 @@ import { store, getContext } from '@woocommerce/interactivity';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
const getQueryParams = ( e: Event ) => { const getQueryParams = ( e: Event ) => {
const filterNavContainer = ( e.target as HTMLElement )?.closest( const filterNavContainer = ( e.target as HTMLElement )?.closest(

View File

@ -16,8 +16,8 @@ import type {
BlockContext, BlockContext,
BlockVariationTriggerType, BlockVariationTriggerType,
} from './types'; } from './types';
import { default as productFiltersIcon } from '../product-filters/icon'; import { default as productFiltersIcon } from '../../icon';
import { BlockOverlayAttribute as ProductFiltersBlockOverlayAttribute } from '../product-filters/constants'; import { BlockOverlayAttribute as ProductFiltersBlockOverlayAttribute } from '../../constants';
import './editor.scss'; import './editor.scss';
import { Inspector } from './inspector-controls'; import { Inspector } from './inspector-controls';

View File

@ -1,7 +1,7 @@
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { BlockOverlayAttributeOptions as ProductFiltersBlockOverlayAttributeOptions } from '../product-filters/types'; import { BlockOverlayAttributeOptions as ProductFiltersBlockOverlayAttributeOptions } from '../../types';
type BorderRadius = { type BorderRadius = {
bottomLeft: string; bottomLeft: string;

View File

@ -9,7 +9,7 @@ import { debounce } from '@woocommerce/base-utils';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
import type { PriceFilterContext, PriceFilterStore } from './types'; import type { PriceFilterContext, PriceFilterStore } from './types';
const getUrl = ( context: PriceFilterContext ) => { const getUrl = ( context: PriceFilterContext ) => {

View File

@ -8,7 +8,7 @@ import { DropdownContext } from '@woocommerce/interactivity-components/dropdown'
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
function getUrl( filters: Array< string | null > ) { function getUrl( filters: Array< string | null > ) {
filters = filters.filter( Boolean ); filters = filters.filter( Boolean );

View File

@ -9,7 +9,7 @@ import { CheckboxListContext } from '@woocommerce/interactivity-components/check
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { navigate } from '../../frontend'; import { navigate } from '../product-filter/frontend';
const getUrl = ( activeFilters: string ) => { const getUrl = ( activeFilters: string ) => {
const url = new URL( window.location.href ); const url = new URL( window.location.href );

View File

@ -85,40 +85,43 @@ const blocks = {
}, },
'single-product': {}, 'single-product': {},
'stock-filter': {}, 'stock-filter': {},
'product-filter': {
isExperimental: true,
},
'product-filters': { 'product-filters': {
isExperimental: true, isExperimental: true,
}, },
'product-filter': {
isExperimental: true,
customDir: 'product-filters/inner-blocks/product-filter',
},
'product-filters-overlay': { 'product-filters-overlay': {
isExperimental: true, isExperimental: true,
customDir: 'product-filters/inner-blocks/overlay',
}, },
'product-filters-overlay-navigation': { 'product-filters-overlay-navigation': {
isExperimental: true, isExperimental: true,
customDir: 'product-filters/inner-blocks/overlay-navigation',
}, },
'product-filter-stock-status': { 'product-filter-stock-status': {
isExperimental: true, isExperimental: true,
customDir: 'product-filter/inner-blocks/stock-filter', customDir: 'product-filters/inner-blocks/stock-filter',
}, },
'product-filter-price': { 'product-filter-price': {
customDir: 'product-filter/inner-blocks/price-filter', customDir: 'product-filters/inner-blocks/price-filter',
isExperimental: true, isExperimental: true,
}, },
'product-filter-attribute': { 'product-filter-attribute': {
customDir: 'product-filter/inner-blocks/attribute-filter', customDir: 'product-filters/inner-blocks/attribute-filter',
isExperimental: true, isExperimental: true,
}, },
'product-filter-rating': { 'product-filter-rating': {
customDir: 'product-filter/inner-blocks/rating-filter', customDir: 'product-filters/inner-blocks/rating-filter',
isExperimental: true, isExperimental: true,
}, },
'product-filter-active': { 'product-filter-active': {
customDir: 'product-filter/inner-blocks/active-filters', customDir: 'product-filters/inner-blocks/active-filters',
isExperimental: true, isExperimental: true,
}, },
'product-filter-clear-button': { 'product-filter-clear-button': {
customDir: 'product-filter/inner-blocks/clear-button', customDir: 'product-filters/inner-blocks/clear-button',
isExperimental: true, isExperimental: true,
}, },
'order-confirmation-summary': { 'order-confirmation-summary': {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Update /merchant tests (first five files), so they are passing against Pressable env.

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Product Price: migrate to block.json

View File

@ -1,5 +0,0 @@
Significance: patch
Type: fix
Comment: This is a further fix for #49583, which has not yet been released

View File

@ -0,0 +1,5 @@
Significance: patch
Type: update
Comment: Update the folder structure of new filter blocks.

View File

@ -16,6 +16,11 @@ config = {
'**/admin-marketing/**/*.spec.js', '**/admin-marketing/**/*.spec.js',
'**/admin-tasks/**/*.spec.js', '**/admin-tasks/**/*.spec.js',
'**/customize-store/**/*.spec.js', '**/customize-store/**/*.spec.js',
'**/merchant/command-palette.spec.js',
'**/merchant/create-cart-block.spec.js',
'**/merchant/create-checkout-block.spec.js',
'**/merchant/create-coupon.spec.js',
'**/merchant/create-order.spec.js',
], ],
grepInvert: /@skip-on-default-pressable/, grepInvert: /@skip-on-default-pressable/,
}, },

View File

@ -5,6 +5,7 @@ const {
insertBlock, insertBlock,
transformIntoBlocks, transformIntoBlocks,
publishPage, publishPage,
closeChoosePatternModal,
} = require( '../../utils/editor' ); } = require( '../../utils/editor' );
const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' );
@ -23,6 +24,8 @@ test.describe(
} ) => { } ) => {
await goToPageEditor( { page } ); await goToPageEditor( { page } );
await closeChoosePatternModal( { page } );
await fillPageTitle( page, testPage.title ); await fillPageTitle( page, testPage.title );
const wordPressVersion = await getInstalledWordPressVersion(); const wordPressVersion = await getInstalledWordPressVersion();
await insertBlock( page, 'Classic Cart', wordPressVersion ); await insertBlock( page, 'Classic Cart', wordPressVersion );

View File

@ -7,6 +7,7 @@ const {
transformIntoBlocks, transformIntoBlocks,
publishPage, publishPage,
openEditorSettings, openEditorSettings,
closeChoosePatternModal,
} = require( '../../utils/editor' ); } = require( '../../utils/editor' );
const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' );
@ -74,6 +75,8 @@ test.describe(
} ) => { } ) => {
await goToPageEditor( { page } ); await goToPageEditor( { page } );
await closeChoosePatternModal( { page } );
await fillPageTitle( page, testPage.title ); await fillPageTitle( page, testPage.title );
const wordPressVersion = await getInstalledWordPressVersion(); const wordPressVersion = await getInstalledWordPressVersion();
await insertBlock( page, 'Classic Checkout', wordPressVersion ); await insertBlock( page, 'Classic Checkout', wordPressVersion );

View File

@ -35,7 +35,15 @@ const test = baseTest.extend( {
coupon: async ( { api }, use ) => { coupon: async ( { api }, use ) => {
const coupon = {}; const coupon = {};
await use( coupon ); await use( coupon );
await api.delete( `coupons/${ coupon.id }`, { force: true } ); await api
.delete( `coupons/${ coupon.id }`, { force: true } )
.then( ( response ) => {
console.log( 'Delete successful:', response.data );
} )
.catch( ( error ) => {
console.log( 'Error response data:', error.response.data );
throw new Error( error.response.data );
} );
}, },
} ); } );

View File

@ -299,10 +299,17 @@ test.describe(
await page await page
.getByRole( 'textbox', { name: 'Postcode' } ) .getByRole( 'textbox', { name: 'Postcode' } )
.fill( '12345' ); .fill( '12345' );
// eslint-disable-next-line playwright/no-conditional-in-test
if (
await page
.getByRole( 'textbox', { name: 'Select an option…' } )
.isVisible()
) {
await page await page
.getByRole( 'textbox', { name: 'Select an option…' } ) .getByRole( 'textbox', { name: 'Select an option…' } )
.click(); .click();
await page.getByRole( 'option', { name: 'Florida' } ).click(); await page.getByRole( 'option', { name: 'Florida' } ).click();
}
await page await page
.getByRole( 'textbox', { name: 'Email address' } ) .getByRole( 'textbox', { name: 'Email address' } )
.fill( 'elbarto@example.com' ); .fill( 'elbarto@example.com' );