* Fix no products component prematurely being rendered
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Use useMemo to memoirize component element on re-renders
---------
Co-authored-by: github-actions <github-actions@github.com>
* Define the event
* Add action sending an event in PC store
* Add directives and context to Product Template li element
* Use on--click directive in ProductImage
* Use on--click directive in Product Title
* Use on--click directive in Product Button
* Add changelog
* Add E2E tests
* Update docs
* Update blocks reference and docs manifest
* Update m,anifest
* Fix mistake in docs
* Regenerate docs manifest
* Fix lint
* Extractb new tests to a separate file
* Product filters ensure we can add multiple instances
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add e2e tests to ensure multiple filters can be added
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add aria-label to checkout form landmark
* Remove aria-hidden from checkout form sub-titles
* Add aria-label to checkout form
* Add changelog file
* Remove aria-hidden from form-step snapshots
* Bump form-checkout template version
* Show product picker control in the editor when a product context is required but not provided
Enhanced the Product Collection block by introducing the `selectedReference` attribute and implementing a product picker control. This control appears in the editor when a product context is required but not provided in the current template/page/post.
1. **block.json**: Added `selectedReference` attribute of type `object`.
2. **constants.ts**: Included `selectedReference` in the `queryContextIncludes` array.
3. **EditorProductPicker.tsx**: Created a new component for selecting products within the editor.
4. **editor.scss**: Added styles for the new Editor Product Picker component.
5. **index.tsx**: Updated logic to determine the component to render, incorporating the new Editor Product Picker.
6. **types.ts**: Defined types for `selectedReference` and updated `ProductCollectionAttributes` interface.
This enhancement allows merchants to manually select a product for collections that require a product context, ensuring the block displays correctly even when the product context is not available in the current template/page/post.
- **Product Picker Control**: Utilizes the existing `ProductControl` component for selecting products. This component is displayed in the editor when a collection requires a product context but it doesn't exist in the current template/page/post.
* Update label on ProductControl component
* Implement dynamic UI state management for product collection block
- Introduced `ProductCollectionUIStatesInEditor` enum to define various UI states for the product collection block.
- Added `getProductCollectionUIStateInEditor` utility function to determine the appropriate UI state based on context.
- Updated `Edit` component to use `getProductCollectionUIStateInEditor` for dynamic state management.
- Refactored `ProductCollectionContent` to utilize the new Editor UI state management.
* Fix: Product picker isn't showing
* Fix: Preview label state isn't showing
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Refactor WooCommerceBlockLocation type
- Introduced specific interfaces for WooCommerceBlockLocation, including ProductLocation, ArchiveLocation, CartLocation, OrderLocation, and SiteLocation, to improve type safety and code clarity.
- Updated createLocationObject function to return a BaseLocation type.
- Refactored useSetPreviewState hook in product-collection utils:
- Extracted termId from location.sourceData for cleaner and more readable code.
- Replaced direct access of location.sourceData?.termId with termId variable.
* Remove fallback to 0 in case there may be a product with id 0
* Use optional chaining to avoid undefined errors
* Rename to
* Change order of arguments in function
* Pass boolean prop instead of making further recognition of the UI state in ProductCollectionContent
* Destructure props in component
* Rename to
* Update names in enum
* Rename to and change the structure to single number.
* Rename location to
* Add a method to choose a product in the product picker in Editor
* Add E2E tests
* Fix failing e2e tests by changing location to productCollectionLocation
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Don't allow selecting product variations
* Minor code refactoring
* Fix: Product control isn't showing products
**Before**
```tsx
const getRenderItemFunc = () => {
if ( renderItem ) {
return renderItem;
} else if ( showVariations ) {
return renderItemWithVariations;
}
return () => null;
};
```
As you can see above, `return () => null;` is returning a function which is causing the issue. This will render nothing in the list. I changed this to `return undefined;`. This way, we will use default render item function.
* Translate text in ProductPicker component
* Improve E2E test
* Use createInterpolateElement to safely render strong HTML tag
* Fix E2E tests
* Fix E2E tests
* Product Collection: Inspector control to change selected product (#50590)
* Add Linked Product Control to Product Collection Block Inspector Controls
- Introduced a new `LinkedProductControl` component in the Product Collection block's Inspector Controls.
- This control allows users to link a specific product to the product collection via a dropdown with a search capability.
- Added corresponding styles to `editor.scss`.
- Integrated a `useGetProduct` hook in the `utils.tsx` to fetch and manage the state of the linked product data, including handling loading states and errors.
- Updated the Inspector Controls to include the new Linked Product Control component, enhancing the block's customization options for users.
* Add E2E tests
* Hide product picker when product context is available
* Improve logic to hide Linked Product Control
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Remove hasError state from useGetProduct hook
* Rename isShowLinkedProductControl to showLinkedProductControl
* Convert jsxProductButton to ProductButton component
* Refactor jsxPopoverContent to LinkedProductPopoverContent component
* Improve UI of Linked Product Control
* Address PR feedback
* Fix E2E tests
---------
Co-authored-by: github-actions <github-actions@github.com>
* Rename isUsesReferencePreviewMode to isUsingReferencePreviewMode
* Change order of conditions in getProductCollectionUIStateInEditor
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add new prefix and suffix attributes
* Add editable prefix & suffix rich text fields
* Remove the uppercase style from prefix and suffix
* Render the prefix and suffix in the front end
* Fix lint errors
* Handle old sku block without prefix and suffix
* Improve the editor styles
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Use wp_kses_post to filter and format the suffix and perfix
* Address extra space when empty and better escaping
---------
Co-authored-by: github-actions <github-actions@github.com>
* Disable PC render when content empty unless no results block is present
* Introduce empty PC classname
* Add E2E test
* Add changelog entry
* Ensure the render is preserved as expected
* Do not render empty div
* Update tests
* Try a different logic
* Add hint to the docblock
* Remove obsolete e2e test
* Update render handler name to acknowledge context
* Fix tests failing due to recent v3 update
* Restore block interactivity
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Remove filter margins in the editor
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Remove small space after + sign
---------
Co-authored-by: github-actions <github-actions@github.com>
* Change cursor style of preview button to default
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Hover and active state shouldn't change background color of the preview button.
* Remove use of wp-block-woocommerce-product-collection class
---------
Co-authored-by: github-actions <github-actions@github.com>
* Not show reviews in the frontend when they are disabled at store or product level
* Add tests for single product template
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix typo
---------
Co-authored-by: github-actions <github-actions@github.com>
* Move register product collection tester e2e tests from product collection file to its own file
* Add changelog file
* Remove the unstable allTextContents usage
* Remove page.waitForTimeout because it doesn't validate that the button is hidden after exactly 1 second
* Remove page.waitForTimeout from 'Should display properly in Product Catalog template' e2e test
* Let's use one parent describe per file for good practice
* Keeping the structure flat
* Update Block References doc
* Move the Block References to public Docs
* Change the place Block Reference is generated to
* Add changelog
* Update docs manifest file
* Update manifest
* Add additional size units to product image element
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Render total blocks before fields on checkout
* Reverse checkout total blocks position on desktop
* Add changelog file
* Add conditional styles to reverse checkout blocks order
---------
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Update 1140.md
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update 1140.md
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Revert "Add new buttonAttributes API to style express checkout buttons coherently (#47899)"
This reverts commit 006fbc6714.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Update changelog
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Fix inline documentation typos in woocommerce-blocks
* Add changelog file
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Remove original changelog
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add variation to Product Filters Overlay Navigation
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Move Product Filters Overlay Navigation to correct position
* Hide block when it is outside the Product Filters template part
* Display Navigation block in the frontend
* Show the Product Filters Overlay Navigation on the frontend
* Add logic to hide Product Filters Overlay Navigation block on the frontend
* Hide block on the Overlay template part
* Fix eslint errors
* Update the block variation title
* Remove the `isActive` property from the block variations
* Use Product Filters block context
* Replace enum with const
* Remove unnecessary `StyleAttributesUtils`
* Rename context key
* Move BlockOverlayAttribute to the constants.ts file
* fix BlockOverlayAttribute import
* Fix import error
* Improve code for the shouldHideBlock method
* Remove unnecessary attributes property
* Fix error in ProductFiltersOverlay block
* Prevent block from being hidden on Product Filters template part
* Fix inspector controls when block is hidden
* Remove unnecessary import
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add context to type
* Clean up notifyerrors helpers
* Notify and clear top level cart errors
* changelog
* Make extensionCartUpdate surface the errors
* No automatic clearing of notice
* Handle generic errors only, add docs
* Rename param
* Fix linting in readme
* Update toc
* test coverage
* Unused import
* We're only dealing with arrays of errors so simplify logic