* feat: use context instead of state
* fix: temporary move the context to inner element for diffing to work
* fix: update context before navigation for optimistic UI
* Remove Reviews blocks Puppeteer tests
* Minor code cleanup
* Typos
* Create publishAndVisitPost() editor util
* Fix subcategories when importing products in Playwright and add reviews
* Add Reviews blocks tests in Playwright
* More typos
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Create a 'reviews' object in data.ts so we can store reviews data in one single place
* Update test so instead of creating a new post in each test, we go to the already-created post
* Add source comments to reviews data to match it with the script
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add price range filter to Product Collection block
This update introduces a price range filter feature to Product Collection. Changes include:
1. Constants Update:
- Added `priceRange` as undefined in `DEFAULT_QUERY` and `DEFAULT_FILTERS` in `constants.ts`.
2. Style Adjustments:
- Added CSS for `.wc-block-product-price-range-control` in `editor.scss` to align the input text to the end.
3. Component Integration:
- In `inspector-controls/index.tsx`, the `PriceRangeControl` component is now imported and integrated.
4. New Components:
- `PriceTextField.tsx` and `PriceRangeControl/index.tsx` have been created to handle price range inputs in the Product Collection block.
5. Backend Integration:
- `PriceRange` interface added in `types.ts` for type support.
- In `ProductCollection.php`, a filter (`add_price_range_filter`) is added to modify the main query based on the price range, including adjustments for tax considerations.
Overall, this enhancement allows users to filter products within a specific price range. The backend adjustments ensure that the filtering respects tax settings and displays accurate prices.
* Fix formatting
* Fix: Price range filter not working on Editor
* Improve: Share logic between Frontend & Editor
* Add changelog
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Remove duplicate changelog file
* Enhanced Input Control for Price Fields
Key changes include:
1. **Switch to Input Control**: Replaced the NumberControl component with the more versatile InputControl. This offers better handling of currency formatting and user input.
2. **Currency Formatting Logic**: Added robust logic for formatting numbers according to the currency settings. This includes handling thousand separators, decimal places, and currency symbols.
3. **String-to-Number Conversion**: Implemented a function to convert user-entered strings back to numbers, accounting for currency symbols and separators. This ensures accurate parsing of user input for processing.
4. **Input Handling Improvements**: Modified the onChange handlers for minimum and maximum price inputs. Now, they correctly handle edge cases like undefined or zero values, maintaining consistency in the user interface and data processing.
* Refactor price range query handling
1. Introduction of a new method `get_price_range_query_args()` to encapsulate the logic for handling price range queries, especially for the two edge cases:
- Prices excluding tax displayed including tax.
- Prices including tax displayed excluding tax.
2. Removal of direct conditionals in the `get_query_results()` method, replacing them with a call to the new `get_price_range_query_args()` method. This makes the code more modular and easier to understand.
This refactor enhances readability and maintainability of the code, ensuring that special cases in price range filtering are handled more effectively.
* Remove unnecessary suffix prop
* Refactor PriceTextField formatting logic for currency
1. Conditional application of thousand separators: The code now checks for the existence of `currency.thousandSeparator` before applying it. This prevents potential errors when the separator is undefined.
2. Simplified decimal separator handling: Introduced a fallback for the decimal separator, defaulting to a period ('.') if not specified by the currency settings.
3. Enhanced readability and documentation: Added comments to clarify the purpose of code blocks, especially where currency symbols are added or removed, and where value normalization occurs.
4. Function renaming for clarity: Renamed `formatValueWithCurrencySymbol` to `formatCurrency`, which better reflects its purpose.
* Fix onBlur issue with PriceTextField component
Refactored the PriceTextField component to utilize useState for better state management. This change introduces a local state variable, 'newValue', to store the current value. The state updates occur in the handleOnChange function, ensuring that the component's state is managed efficiently. Additionally, a new function, handleOnBlur, is implemented to handle the onBlur event, updating the component's state when focus is lost. The handleEnterKeyPress function captures the 'Enter' key press, providing a more user-friendly experience by allowing users to confirm their input with the Enter key.
* Fix linting error
---------
Co-authored-by: github-actions <github-actions@github.com>
* Trigger event experimental__woocommerce_blocks-cart-add-item in the SSR Product Button vis Interactivity API
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update code comment and add reference to the followup issue
---------
Co-authored-by: github-actions <github-actions@github.com>
* Don't access the keys of what is now just an array
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* docs: Compatibility Layer - update documentation about woocommerce_single_product_summary
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Reviews by Product block: fix encoded in input aria-label
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* add: active filters block
* update text domain
* chore: linting
* use template string instead of concat
* add experimental flag to register block type calls
* chore: update comments
* feat: register active rating filter data
* fix: unique navigation id when collection filters are added outside product collection
* fix: active filter rating id
* fix: return the href
* chore: phpcs
* Move the switch to classic shortcode block button to separate component
- Move modal component file from incompatible-extension-notice component folder to switch-to-classic-shortcode-button folder.
- Rename modal component file to model-content component file.
- Move the switch to classic shortcode block button to separate component folder
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update class names in switch-to-classic-shortcode-button component
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update plugins/woocommerce-blocks/assets/js/editor-components/switch-to-classic-shortcode-button/editor.scss
Co-authored-by: Niels Lange <info@nielslange.de>
* Refactor SwitchToClassicShortcodeButton component
* Fix css lint erros
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
* Introduce Additional Fields API for Checkout Block https://github.com/woocommerce/woocommerce-blocks/pull/12073
* revert test to what it was
* Default to text, if the type supplied is not supported throw an error
* Add type for options
* Return null if somehow the select made it through without options
* Make select fields type enum and add options to schema
* Lint fixes
* Update plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/address-form/address-form.tsx
Co-authored-by: Niels Lange <info@nielslange.de>
* Update plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFields.php
Co-authored-by: Niels Lange <info@nielslange.de>
* Update checks to log errors and fail gracefully
* Add field id to class names
* Fix lint error
* Fix short array use
* Introduce Additional Fields API for Checkout Block https://github.com/woocommerce/woocommerce-blocks/pull/12073
* Default to text, if the type supplied is not supported throw an error
* Lint fixes
* Introduce Additional Fields API for Checkout Block https://github.com/woocommerce/woocommerce-blocks/pull/12073
* add support for registering checkboxes
* remove extra error log
* add styling
* fix rebase conflit
* fix rebase conflit 2
* fix linter errors
* address review comments
* add warning for checkbox
* fix changes
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
* Remove padding for the products query with background
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
* First pass at Playwright test migration
* Set working directory
* Remove exec
* Configure the environment before testing
* Remove filter
* Update paths for tests
* Try explicitly stating working-directory
* Change tests directory
* Try running all tests
* Uncommented project
* Update commands to run tests
* Comment out env config
* Uncomment
* Changelog
* Set up multiple test configurations
* Update failing test
* Update paths for artifacts
* Update path to artifacts
* Path to results
* remove unnecessary file
* Skip translation E2E tests
Skipping translation tests until we fix the missing translations issues after we changed the domain to "woocommerce"
* Update the artifacts path
* Fix lint errors
---------
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Introduce Additional Fields API for Checkout Block https://github.com/woocommerce/woocommerce-blocks/pull/12073
* add changelog
* Auto load the Blocks/Domain/Services/functions.php file
* add changelog
* revert test to what it was
* Update text domain for translations
* Ensure address data is added on the cart block too
* fix lint problem
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Product Image Gallery: Add transform to Product Gallery block
* Single Product Template: Transform to blocks with new Product Gallery block
* Ensure we first check for block existance
* Add changelog
* Add/delete changelog file
* Migrate Puppeteer test action from Blocks repo
* Update file path
* Use pnpm
* Use npm
* Updates based on feedback
* Comment out paths for testing
* Fix paths with working directory
* Use pnpm
* Fix missing pnpms
* npm instead
* Do use pnpm
* Update command
* Blocks wp-env config
* Update paths, config files
* Run test commands from blocks
* Config update
* Uncomment paths so that e2e checks only run on Blocks
---------
Co-authored-by: Jon Lane <jon.lane@automattic.com>
* Fixed Blocks' `wp-env` Configuration
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
Similarly to `build:project`, a new `watch:build:project`
script will watch individual projects for changes. The
`watch:build` script has been updated so that it does
a deep watch in the same vein as `build`. We have also
hooked up tool-level watching for faster performance.
Having an explicit `"files"` definition will allow us to fingerprint
dependencies in `wireit` more granularly. This avoids problems
that can be caused by different source files and directories that
trigger a rebuild in a dependee before a dependent finishes.
We're adding this to _every_ package since they have their own
configuration and scripts to run. This also keeps them
isolated so that they can operate independently.
* convert first local pickup test
* Convert the second local pickup test
This test detected a bug. We will skip it for now and create a ticket to fix it!
* Remove old local pickup E2E tests
* Convert Payment Methods E2E tests
* Remove old payment methods tests
* Convert shipping/billing E2E tests
* Remove old shipping/billing E2E tests
* Add some line breaks for a better readability
* Update tests/e2e/tests/checkout/checkout-block.shopper.block_theme.side_effects.spec.ts
Co-authored-by: Niels Lange <info@nielslange.de>
* Fix ESLint errors
* Move E2E tests to the Checkout shopper file
* Fix ESLint error
* Convert Checkout Error Forms E2E tests
* Use guest user instead of logged in customer for Checkout Errors E2E tests
---------
Co-authored-by: Niels Lange <info@nielslange.de>
* Convert checkout place order E2E tests to Playwright
* Add "gotoMyAccount" method
* Create login/logout utility functions
* Use the existing "customer" test data
* Complete the place order test cases
* Fix "My Account" page title
* Fix rebase
* Reset My account page title
* Check for heading instead of the page title
* Check for heading in login/logout functions
* Fix all failing tests
* Add guest/customer/admin roles
* Update the auth setup
* Register the auth setup within Playwright
* Update testing cases
* Add generated auth files to .gitignore
* Tidy up comments
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove unnecessary comment
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update comments
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove unnecessary comment
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update comment for Guest case
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove confusing comment
* Remove another unnecessary comment
* Remove unnecessary Playwright project dependency
* Tidy up the file structure and constants
* Fix mixed up test descriptions
* Remove commented code
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove unnecessary function from frontend-utils
* Refactor testing cases
* Rename testing file
* Delete unused testing file
* Ensure we're logged out before trying to log in as a user
* Log out before each authentication setup step
* Ensure tests requiring admin are logged in
* Log in as admin during block theme setup
* Fix Playwright strict mode violation
* Run Multiple sign-in roles to the global-setup phase
In this step of the Playwright's setup, we can add the multiple sign-in
roles and keeping the admin logged by default.
This fixes the issue of failing tests `logged out` error.
* Remove unnecessary login as admin
* Remove "auth.setup" dependency since the logic lives in the global setup instead
* Remove unnecessary login as admin from test files
The admin profile is set by default
---------
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Add missing selectors to docs
- Add missing selectors for the following:
- data-store/checkout
- data-store/collections
- data-store/payment
- data-store/schema
* Fix markdown
* Fix getIncompatiblePaymentMethods selector description.
* Fix schema selectors information
* Fix additional spacing
* Add more information about the objects.
* Update checkout.md to use more descriptive
variable name for prefersCollection
* Update Features Flags and Experimental Interfaces doc with Collection Filters and its inner blocks
* Replace feature flag references with links to specific commit, not trunk
* Change border color to Gutenberg 100 for Cart and Checkout blocks
* Change form input color to Gutenberg 900 for Cart and Checkout blocks
* Fix additional border colors of Checkout block
* Update borders and form field colors in Cart Block
* Change border color to $universal-border-light
* Change border color for cart line items to $universal-border-light
* Change form input fields border color to $universal-border-dark
- Add $universal-border-dark color variable for woocommerce/woocommerce-blocks#1e1e1e on white.
* Fix colors of text area border and form steps
* Change form input fields border color to $universal-border-dark
- Add $universal-border-dark color variable for woocommerce/woocommerce-blocks#1e1e1e on white.
* Fix form steps
* Update universal dark border rgba value
- Update universal dark border rgba value from rgba(0, 0, 0, 0.882) to rgba(17, 17, 17, .80) to keep it consistent with universal-border colors
* Update $universal-border-light color
* Update the opacity of the borders
* Update the border color to rgba (17, 17, 17, 0.12)
* Roll back $universal-border-light value to the original value: 0.115
* Remove Opacity and pass it as argument in with-translucent-border
- We have with-translucent-border option that accepts border and opacity for pseudo elements.
* Remove additional spaces
* Replace with-translucent-border with normal border
- Since we're are not mixing the opacity to the border color so we don't need to use mixin with-translucent-border.
* Fix applied css and add low contrast Color usage details
- Fix minor CSS as per the standards.
- Add comments for universal border colors that they're low contrast colors and should be used for decorative elements only
* Fix border gap and double border for multiple shipping packages
* Fix payment method borders and Cart line items borders
- Change border bottom to border-top for cart line items.
- Fix payment method radio control borders.
* Fix local pickup border
- Local pickup was using with-translucent-borders so it has some opacity, changed it to border-bottom.
* Add border-bottom to cart items
* Remove additional border from Cart items
* Fix radio and checkbox borders as per the design
* Fix shipping method borders and background color as per the design.
* Force align left on the description for the local pickup options.
* Update border color in quantity selector component
* Fix Shipping options radio selection alignment
- Add left padding to wc-block-components-shipping-rates-control__package element.
* Update colors and variables
* Change checkbox and radio button colors
- Change checkbox and radio button colors from rgba(25, 23, 17, 0.3) to rgba(25, 23, 17, 0.48).
* Remove bottom property from express payment style
* Fix casting on Utils::wp_version_compare
* Fix linting issue
* Apply version number fix on current wp version
* Fix linter errors
* Fix linter errors
* CYS: Add DELETE private/ai/products endpoint
* Ensure the hash for the product is also updated on content reset.
---------
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Remove ADD_LABEL step for 'status: ready to merge'
This updates the workflow to remove the step for adding the 'status: ready to
merge' label.
Additionally, this adjusts the naming within the job to reflect the
change to the workflow.
* Remove entire workflow for Approved Pull Requests
Once Woo Blocks is merged into the monorepo, this workflow will no
longer be needed / relevant at all.
* Add missing actions to the documentation
- Add the missing actions to the following:
- data-store/cart
- data-store/checkout
- data-store/collections
- data-store/validation
* Move actions above selectors in Cart doc
* Add more info to cart actions
* Fix syntax of Cart actions examples
* Fix syntax and examples
- Use store name constant instead of strings
- Fix description and examples of collections document
* Add more info about the keys of objects and arrays
* Update billing address info in cart data
* Update parameter names and descriptions in
checkout.md and collections.md
* Update docs/third-party-developers/extensibility/data-store/checkout.md
Co-authored-by: Niels Lange <info@nielslange.de>
---------
Co-authored-by: Niels Lange <info@nielslange.de>
* Center align view all link
* Add thumbnail count specific styling
* Product Gallery Thumbnails: Improve the responsiveness of the View All overlay text
---------
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
* Change the default for Mini Cart block
The Block Hooks API currently doesn’t allow for setting the default state of the block injected into content so this ensures the mini-cart block has a better default state for injection. The current default (displaying total value in cart) takes up more width increasing the risk of poor layout.
* Utilize Block Hooks to automatically inject mini-cart block.
* include experimental prefix on filters
* Fix filter name.
* remove experimental prefix.
On thinking about this, I don’t think these need to be experimental. They are intentionally provided as escape hatches for hosts/themes that want to opt-in/out so we’ll have to support them when this is shipped (at least until its no longer needed!)
* fix variable name!
* fix unit tests because of new default
* remove another incorrect text expectation
Defaults for the block affect this expectation.
* fix E2E tests
* Mini Cart Block: improve E2E test
* fix: improve check for the Product Collection block
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Fix restriction preventing the update of products with AI-generated content after the 3rd attempt.
* use set_slug rather than wp_update_post for updating the product permalink.
---------
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Flush after updating all products, not after updating each of the products
Flushing is an expensive operation so we should run it carefully
* Remove the index param and add the last_product param to the Product endpoint.
---------
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Create add to custom fields documentation
* Update the checkout custom field docs
* Add back end steps and examples
* Make it clear that we are building a field block
* Update docs/third-party-developers/extensibility/rest-api/extend-rest-api-add-custom-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update docs/third-party-developers/extensibility/rest-api/extend-rest-api-add-custom-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update docs/third-party-developers/extensibility/rest-api/extend-rest-api-add-custom-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update docs/third-party-developers/extensibility/rest-api/extend-rest-api-add-custom-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Mention that the block will not render if parent isn't required
* Add more details about `seExtensionData`
* Add additional code examples for the backend
* Avoid extending store API inside an IntegrationInterface
* Add code example that invokes the extend store endpoint class
---------
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Limit number of visible incompatible extensions in sidebar notice
* Adjust link text
* Ensure text-decoration works in Safari
* Minor CSS tweaks
* Refactor constant names
* Adjust chevron position for opened state
* Revert "Adjust chevron position for opened state"
This reverts commit ff5142427738626837be887dd8d7e5d94c2432d4.
* Tweak the product prompt
To avoid creating products that are things that cannot be sold in stores (forests, people, etc.)
* Return error when images are not provided
* Check permalink and flush cache if not found
* Update the product slug with the new title
* Use wp_update_post to update the product
* Remove unused method
* Reorganise Columns controls and fix undefined problem in Product Collection settings
* Remove type condition in hasValue of Columns control
* Adjust the E2E tests locator to new changes
* Try env:restart instead of env:start
* Change env:restart to env:start again
* Try env:restart instead of env:start
* Change env:restart to env:start again
* Adjust heading level of cart and checkout template
* Replace button selector with label selector
* Try env:restart instead of env:start
* Change env:restart to env:start again
* Ensure to close welcome guide modal
* Adjust heading level of default template content
* Try env:restart instead of env:start
* Change env:restart to env:start again
* Try env:restart instead of env:start
* Change env:restart to env:start again
* Address existing TS issues
* View template in edit mode
* Keep certain tests skipped
* Fix broken tests after addressing TS issues
* Update extensibility doc
This PR adds a missing link to the Extensibility page for a new doc that was added about the migrated hood.
* Update docs/third-party-developers/extensibility/README.md
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
---------
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
* Convert to tsx and replace proptypes by ts definitions
* Fix imports
* Fix noReviewsPlaceholder type
* Fix ts errors
* Use createHigherOrderComponent in withReviews
* Revert hoc change
---------
Co-authored-by: Niels Lange <info@nielslange.de>
* Add HTML entity decoding for product names in Hand-Picked Products control
In the Hand-Picked Products control within the product-collection inspector controls, a function for decoding HTML entities in product names has been added.
- A new utility function `decodeHTMLEntities` has been implemented. This function decodes HTML entities in a string, ensuring that special characters are correctly displayed in their human-readable form.
- The `transformTokenIntoProductName` function has been updated to utilize `decodeHTMLEntities`. Now, when a product name is fetched (either directly as a token or via a product ID), the HTML entities within the name are decoded.
- This enhancement ensures that product names containing characters like ampersands or other HTML entities are accurately displayed in the UI.
This change improves the readability and accuracy of product names within the Hand-Picked Products control, enhancing the user experience for store managers using WooCommerce Blocks.
* Update label and hide description
This commit updates the `HandPickedProductsControl` component. Specifically, the user-facing label for product selection has been changed from 'Pick some products' to 'Hand-picked Products'. Additionally, the `__experimentalShowHowTo` property has been added with a `false` value, to hide description. Corresponding changes have been made in the E2E test file `product-collection.block_theme.spec.ts`, where the filter name is updated to match the new label.
* Refactor: Replace custom HTML entity decoder with `@wordpress/html-entities`
Rationale:
- The shift to `@wordpress/html-entities` aligns with standard WordPress practices, ensuring consistency across the platform.
- Enhances maintainability by relying on a well-supported library rather than custom code.
- Simplifies the codebase by removing a redundant utility function.
This change enhances the robustness of our code and aligns with best practices in WordPress development.
* Product Gallery Thumbnails: Refactor sizing in the editor and the front end
* Product Gallery Thumbnails: Change default vertical alignment to top and better control the width of the thumbnails
* Product Gallery Thumbnails: Fix thumbnails cropping based on the 'Crop images to fit' setting
* Product Gallery Thumbnails: Revert thumbnails styling from woocommerce/woocommerce-blocks#11665
* Product Gallery Thumbnails: Update the default value of the cropImages setting to false
* Product Gallery Thumbnails: Refactor sizing in the editor and the front end
* Product Gallery Thumbnails: Change default vertical alignment to top and better control the width of the thumbnails
* Product Gallery Thumbnails: Restrict the bottom position thumbnails width based on the total number of thumbnails set
* Product Gallery: Remove hardcoded width for Thumbnails and the Large Image and update the width inside of the Dialog
* Product Gallery Thumbnails: Introduce thumbnails scaling based on the number of thumbnails
* Product Gallery Thumbnails: Fix editor thumbnails scaling
* Product Gallery Thumbnails: Remove unused column gap variable
* Product Gallery Thumbnails: Fix styling for vertical images
* Product Gallery: Remove the unused editor.scss file
* Product Gallery: Fix the placement of the Thumbnails block in the block template
* Product Gallery Dialog: Reset changes to the dialog
* update @wordpress/e2e-test-utils-playwright package
* don't update node version
* remove waitForSiteEditorFinishLoading function
* use visitSiteEditor util
* Product Gallery Thumbnails: Add code comments
* Product Gallery Thumbnails E2E: Fix the test checking the default position of the thumbnails
* Product Gallery E2E: Fix the test checking if the cropping setting works correctly
* Product Gallery Thumbnails: Hide the Thumbnails block if there aren't at least 2 thumbnails to display
---------
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Add new ai/store-title endpoint to update the store title with an AI generated one
* Add StoreTitle schema
* Fix error to response param
* Fix var name and tweak prompt
* Update comment
* Replace it by Ai generated if it's the default title
* Return error if AI failed
* Return false if the title is not updated with an AI one
* Enable shrink columns option in Product Collection by default
* Improve tests about responsiveness
* Make regex allowing for floating pixels
* Related products should not use sticky and author attribute or have hardcoded queryId
* Bring back properties for Related Products as it's based on Propducts block, not Product Collection
* Enable shrink columns to fit by default in patterns
* validate coupon usage against user and email
* add checks for logged out user
* change to direct array call
* fix the query
* fix the query
* fix arrays
* fixe how id is fetched
* Make function private
* use implode instead of join
* coupon shouldnt be a pointer
* move ignore statement
* add comment about tentative usage
* Update src/StoreApi/Utilities/OrderController.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* better validation for user data
* remove unused variable
* bail early if we dont have limits
* add empty line after function
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Sync Interactivity API code with Gutenberg
* New store() API
* Store raw actions
* Update wc-interactivity-store implementation
* Replace `wc_store` with `wc_initial_state`
* Parse and populate initial state
* Allow store parts in `store()`
* Accept namespaces in directive paths
* Add $$namespace to directives' object values
* Make namespace parsing more robust
* Use DeepPartial type for store parts
* Do not pass `rawStore` to `afterLoad` callbacks
* Simplify `store()` a bit
* Implement `privateStore()`
* Sync context directive with Gutenberg
* Refactor scope and extract getters per scope
* Add namespace to getters and actions
* Remove current privateStore implementation
* Remove `afterLoad` option from `store`
* Use same proxy handlers for ns, getters and actions
* Set scope inside `evaluate`
* Refactor proxy handlers
* Improve types a bit
* Catch errors in async actions
* Implement stacks for scopes and namespaces
* Implement `getElement`
* Change directives object structure
* Remove unnecessary import
* Implement private stores
* Return value from sync actions
* Minor optimizations and improved comments
* Don't use async inside `data-wp-watch`
* Use a single Provider in context directive
* Remove DeepPartial type
* Do not check if element exists
* Add the `current` prop of state inside the scope
* Move getters outside scope
* Fix wc-key assignment
* Fix missing `navigate` in directives
* Fix namespace not being picked in the same element
* Deep merge raw stores instead of proxied ones
* Fix namespace assignment
* Allow forward slashes in namespaces
* Migration of Product Collection and Product Button blocks to the new `store()` API (https://github.com/woocommerce/woocommerce-blocks/pull/11558)
* Refactor Product Button with new store() API
* Use `wc_initial_state` in Product Button
* Fix namespace
* Remove unnecessary state
* Test namespaces in directive paths
* Add test context with namespace
* Simplify woo-test context
* Move addToCart and animations to a file
* Do not pass `rawStore` to `afterLoad` callbacks
* Move callbacks and actions back to the main file
Because the animation was broken.
* Remove selectors in favor of state
* Use default ns in `getContext` for state and actions
* Remove `afterLoad` callback
* Remove unnecessary ns
* Fix getContext in add-to-cart
* Replace namespace and delete unnecessary store
* Pass context types only once
* Use an alternative for requestIdleCallback
* Add previous react code for notices
* Add namespace to Product Collection block
* Replace getTextButton with getButtonText
* Add block name to the ProductCollection namespace
* fix style HTML code
* Remove circular deps error on the Interactivity API
* Product Gallery block: Migrate to new Interactivity API store (https://github.com/woocommerce/woocommerce-blocks/pull/11721)
* Migrate Product Gallery block to new Interactivity API store
* Fix some references
* Add missing data-wc-interactive
* Fix an additional namespace
* Remove unnecessary click handler
* Dialog working
* Refactor action names
* Reindex PHP array
There was some missing indexes, which turned the array into an object in JS.
* Remove unused event handlers
* Move next/previous logic to external function
* Move StorePart util to the types folder
* Rename namespace to `woocommerce/product-gallery`
* Undo product collection namespace renaming
* Remove unnecessary namespace
* Don't hide the large image on page load
* Minor refactorings
* Fix eslint error
* Fix php cs errors with spacing and double arrows alignment
* Disable no-use-before-define rule for eslint
* Disable @typescript-eslint/ban-types rule for eslint
* Fix parsed context error in e2e tests
* Fix context parser for Thumbnail image
* Move store to the top of the frontend file
* Add interactivity api utils to the @woocommerce/utils alias
* Replace deprecated event attribute
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: roykho <roykho77@gmail.com>
---------
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Fix error when closing product gallery dialog with keyboard escape key
* use wc_initial_state instead of wc_store
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Run E2E test suite on Twenty Twenty-Four
* Update TT4 download URL to the stable one
---------
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
This commit introduces the `get_block_type_style` method in the `ProductCollectionNoResults` class. This new method is designed to manage frontend style handling specifically for this block type. Currently, it returns null, indicating no specific styles are assigned at this stage.
* Update Interactivity API JS files
* Disable TS checks in the Interactivity API for now
* Add new SSR files
* Replace wp_ prefixes with wc_ ones
* Replace wp- prefix with wc-
* Replace guternberg_ prefix with woocommerce_
* Remove file comments from Gutenberg
* Rename files with `wp` prefix
* Fix code to load Interactivity API php files
* Remove TODO comments
* Replace @wordpress with @woocommerce
* Update Webpack configuration
* Fix directive prefix
* Remove interactivity folder from tsconfig exclude
* Add client-side navigation meta tag code
* Remove unneeded blocks.php file
* Fix store tag id
* Register Interactivity API runtime script
* Fix Interactivity API runtime registering
* Add Simple Price Filter block
* Remove all files related to directive processing in PHP
* Use values directly for SimplePriceFilter SSR
* Reset pages to 0 when changing filter
Note: we also need to do this with `/page/x`
* wip
* phpcs
* register price filter as inner block
* try: render block using save
* add types
* use min range var instead of 0
* inject dynamic data
* query price data in editor
* better injecting interactivity data
* remove rounding
* Product Collection Data endpoint doesn't care about current query so we remove the context for now
* extract data injecting as a method, possbily a trait in the future
* add sidebar setting
* duplicating the markup in php render callback for safety
* remove directive from edit component
* show prices without decimal
* use final class
* use sample collection data response
* prepare for multiple styles support
* use collection data from context
* cleanup props and props passing
* pass only necessary states
* retire heredoc in favor of late escaping
* reorganize style
* inherit style from current price filter react component, pre extract the component for multiple display style support
* keep minPrice smaller than max
* remove unnecessary active handler logic
* update folder structure
* avoid whitespace change
* clean up
* title
* move inspector to component folder, ready to be extracted to inner block
* block icon
* block name
* name
* use inner block for view
* inner block view switcher
* try: process data in Collection Filtes block only
* wip: query collection data from collection filters block only
* provide all context from collection filters block
* simplify context passing
* feat: use default attribute to define filter type of view block
* rename
* remove price block
* rename price slider to price, default price filter should be a slider
* type cleanup
* fix ancestor block name
* only passing the collection data down
* wip
* recusive
* editor preview
* refactor: data fetching, context passing, and code organization
* initial attribute filter block
* feat: attribute selector
* inspector control
* wip
* break the edit into smaller components
* wip: editor component
* extract checkbox list
* wip editor preview
* show count checkbox list
* fix param aggregation for attribute filter blocks
* post merge fix
* fix param aggregation for attribute filters
* fix: set correct selected attribute
* WIP checkbox list
* WIP checkbox list
* avoid action name conflicts
* Checkbox list front end
* phpcs
* update context on input, navigate on change
* fix: attribute selection
* dropdown
* remove isDeepEqual
* add: warning when attribute has no products or no attribute is selected
* update type
* update type
---------
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
* Fine-tune the prompts for generating product titles.
* Update the prompt for images.
* Update the prompts for generating content for patterns.
* Break down the pattern content generation into individual methods.
* Add character limit to prompts.
* Add character limit for a handful of titles.
* Add character limit to the title of the product-collection-4-columns pattern.
* Update the prompt to not add abbreviations
* Introduce the refine_returned_images_results method for AI to filter the images returned by Pexels
* Implement retry if the number of images returned by Pexels API is smaller than the number of images required by products and patterns.
* Update the prompt for the images search term.
* Fix AI image assignment for newly created products and improve performance.
* Ensure no additional dummy products are created or updated in simultaneous requests.
* Fix error on generating content for patterns for the first time and saving it to the post.
* Return error if the connection with AI failed.
* Update the prompt character limit for the Featured Category Triple pattern.
* Implement retry if the API connection with AI fails. Update the prompt to remove the length instruction. Add the last_business_description check to prevent duplicated API calls. Set a transient for images in case the request fails.
* Add retry for returning the refined search results. Update the prompt for defining the search term. Update error validation.
* Update the structure for fetching patterns content and reduce the number of requests.
* Break down the pattern ai content generation and assignment into multiple methods and introduce retry in case of failure.
* Update the structure for applying the AI generated content to patterns. Update the fetch and validation of ai responses and update the prompt to ensure longer texts are returned.
* Update the validation of the content returned by AI by verifying the array keys and ensuring the values are not empty. Additionally, the completion should be set.
* If for some reason AI didn't return the complete list of expected generated content, use the same the previous text from the same pattern as a replacement and avoid making an extra request to fetch just fetch a possible missing result.
* Update prompts for patterns.
* Make a single request to fetch all products data, implement retry for products and validation for the response returned by AI.
* Update the retries variable first within the patterns loop.
* Narrow down the AI content generation to only patterns that are part of the Assembler.
* Update the size of images and the prompt for AI generated content assigned to products.
* Don't make request to AI if the user provided a single word for their business description.
* Update the image assignment to products and remove the unused update_dummy_products method.
* Update the prompt for generating content for patterns.
* Update the prompt for products content generation and ensure that an error is returned if all requests fail.
* Update the prompt for patterns.
* Update the prompt for images.
* Update the prompt for images.
* Update prompt for button text.
* Don't schedule action for updating patterns content if the business description wasn't updated.
* add associative option when the local json is parsed
* Ensure the expected list of results matches the number or products to be updated.
* fix lint error
* Address CR.
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Add custom 'No Results' block for Product Collection
This commit introduces a new 'No Results' block, replacing the default core 'query-no-results' block within product collection block. The 'No Results' block provides a tailored experience for WooCommerce stores, displaying a custom message when no products are found in a query.
Key changes include:
- A new block type 'woocommerce/no-results' is registered with a complete configuration and content structure.
- Edit and save functions are implemented for the block, allowing for custom content and styles within the block editor and on the front end.
- Webpack entries are updated to include the new block in the build process.
- A PHP class NoResults is added for server-side rendering, which only displays the block when the product query returns no results, enhancing performance.
- The ProductCollectionUtils utility class is extended to support the new block's query needs.
The new block enriches the user experience by providing clearer communication when no products match the collection criteria and allows store owners to customize the message and presentation.
* Update description
* Rename 'no-results' block to 'product-collection-no-results'
Changes include:
- Updating the block name in `edit.tsx` within the `product-collection` directory.
- Modifying the block.json file in the `no-results` inner block to reflect the new name.
- Adjusting the className in `edit.tsx` for the `no-results` inner block.
- Altering the webpack entries in `webpack-entries.js` to recognize the new block name.
- Renaming the block in `NoResults.php` to align with this update.
This renaming aims to make the block's purpose more clear and to maintain a consistent naming scheme within our product collection blocks.
* Rename NoResults to ProductCollectionNoResults for clarity
This commit renames the `NoResults` class to `ProductCollectionNoResults`. The change aims to enhance clarity and specificity about the class's purpose, indicating that it specifically handles no-result scenarios within product collections.
Changes made:
- Renamed `NoResults.php` to `ProductCollectionNoResults.php`.
- Updated the class name from `NoResults` to `ProductCollectionNoResults` in the file.
- Modified the reference in `BlockTypesController.php` to use the new class name.
This renaming ensures better readability and understanding of the class's role in the context of product collections. The primary change is the renaming, with no significant alterations in the class functionality.
* Update No-Results Message Formatting in Product Collection Block
This commit simplifies the layout and message content for the 'No results found' message in the product collection block's no-results edit component. The changes include:
1. Removal of the full stop in the 'No results found' string for consistency.
2. Replacing the 'core/group' block with a 'core/paragraph' block.
3. Streamlining the message content to be more concise and integrated into fewer text blocks.
4. Direct links for 'clearing any filters' and navigating to the 'store's home' are now included in the same paragraph.
---------
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Fix strings in modal window
* Update assets/js/editor-components/incompatible-extension-notice/modal.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
---------
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>