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:**
- **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
Display a product's description, attributes, and reviews.

View File

@ -74,7 +74,7 @@
"post_title": "Blocks reference",
"menu_title": "Blocks Reference",
"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",
"id": "1fbe91d7fa4fafaf35f0297e4cee1e7958756aed"
},
@ -1804,5 +1804,5 @@
"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 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 initCollapsible } from './generic/collapsible';
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
*/
import { registerBlockSingleProductTemplate } from '@woocommerce/atomic-utils';
import { currencyDollar, Icon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import sharedConfig from '../shared/config';
import edit from './edit';
import attributes from './attributes';
import { supports } from './supports';
import {
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,
};
import metadata from './block.json';
registerBlockSingleProductTemplate( {
blockName: 'woocommerce/product-price',
blockSettings: blockConfig,
blockName: metadata.name,
blockMetadata: metadata,
blockSettings: {
...sharedConfig,
supports,
icon: (
<Icon
icon={ currencyDollar }
className="wc-block-editor-components-block-icon"
/>
),
edit,
},
isAvailableOnPostEditor: true,
} );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -85,40 +85,43 @@ const blocks = {
},
'single-product': {},
'stock-filter': {},
'product-filter': {
isExperimental: true,
},
'product-filters': {
isExperimental: true,
},
'product-filter': {
isExperimental: true,
customDir: 'product-filters/inner-blocks/product-filter',
},
'product-filters-overlay': {
isExperimental: true,
customDir: 'product-filters/inner-blocks/overlay',
},
'product-filters-overlay-navigation': {
isExperimental: true,
customDir: 'product-filters/inner-blocks/overlay-navigation',
},
'product-filter-stock-status': {
isExperimental: true,
customDir: 'product-filter/inner-blocks/stock-filter',
customDir: 'product-filters/inner-blocks/stock-filter',
},
'product-filter-price': {
customDir: 'product-filter/inner-blocks/price-filter',
customDir: 'product-filters/inner-blocks/price-filter',
isExperimental: true,
},
'product-filter-attribute': {
customDir: 'product-filter/inner-blocks/attribute-filter',
customDir: 'product-filters/inner-blocks/attribute-filter',
isExperimental: true,
},
'product-filter-rating': {
customDir: 'product-filter/inner-blocks/rating-filter',
customDir: 'product-filters/inner-blocks/rating-filter',
isExperimental: true,
},
'product-filter-active': {
customDir: 'product-filter/inner-blocks/active-filters',
customDir: 'product-filters/inner-blocks/active-filters',
isExperimental: true,
},
'product-filter-clear-button': {
customDir: 'product-filter/inner-blocks/clear-button',
customDir: 'product-filters/inner-blocks/clear-button',
isExperimental: true,
},
'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-tasks/**/*.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/,
},

View File

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

View File

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

View File

@ -35,7 +35,15 @@ const test = baseTest.extend( {
coupon: async ( { api }, use ) => {
const 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
.getByRole( 'textbox', { name: 'Postcode' } )
.fill( '12345' );
await page
.getByRole( 'textbox', { name: 'Select an option…' } )
.click();
await page.getByRole( 'option', { name: 'Florida' } ).click();
// eslint-disable-next-line playwright/no-conditional-in-test
if (
await page
.getByRole( 'textbox', { name: 'Select an option…' } )
.isVisible()
) {
await page
.getByRole( 'textbox', { name: 'Select an option…' } )
.click();
await page.getByRole( 'option', { name: 'Florida' } ).click();
}
await page
.getByRole( 'textbox', { name: 'Email address' } )
.fill( 'elbarto@example.com' );