* Create a relation between the product type and the product block template
* Add 'patterns' to name the kind of products that can be created for a specific template
* Resolve template using its id as a template query param
* Rename ProductEditPattern to ProductTemplate
* Rename get_patterns hook to woocommerce_product_editor_get_product_templates
* Return the list of templates to the client
* Set layout template events as array
* Register the layout template based on the product template or the post type in case of product variations
* Registering non supported product types
* Create and register the woocommerce/product-details-section-description block
* Add the product type to the section description
* Create product type selector
* Fix menu item style
* Highlight selected menu item
* Set the selected product template
* Set product template title to lowercase in the content description
* Rename blocks by blockTemplates under the AbstractBlockTemplate class
* Rename to woocommerce_product_editor_product_templates filter
* Remove product_template_ prefix from the supported_product_types map
* Rename get_formatted to to_JSON and convert the props to client side like
* Refactor get_product_templates
* Fix icon resolution
* Add a confirmation modal for unsupported product templates
* Add changelog files
* Remove product types using for testing
* Fix redirection when changing to a non supported product template
* Set the change button state to busy when it is saving the product
* Fix php linter errors
* Fix rebase conflict
* Move ProductTemplate to Automattic\WooCommerce\Admin\Features\ProductBlockEditor namespace
* Add the to_json definition to the BlockTemplateInterface
* Create default product template by custom product type if it does not have a template associated yet
* Fix some comments and product template creation validation
* Add support to load the product template icon from an external resource
* Fix php linter
* Fix the changelog description
* Update class-wc-gateway-bacs.php
Fix typo in textdomain
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Use clientHeight to set the correct marginTop -- height is not a valid property
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Show the ai offline modal independently from the onboarding tour
* Add changefile(s) from automation for the following project(s): woocommerce
* Remove log
* Fix tests
* Add customizing parameter to avoid showing the aioffline modal when customizing
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add `date_type` parameter to revenue stats API for overriding the date type column.
* Update coding styles.
* Add changelog.
* Validate `date_type` value with strict matching.
* Add test cases for passing a valid/invalid `date_type` parameter.
* Remove extra validation on `date_type` value as it's already validated at the API level.
* Check for each allowed value of `date_type` in the test case.
* Fixed count() warning on invalid data supplied by the filter.
* Add changefile(s) from automation for the following project(s): woocommerce
* Removed unnecessary if
* Ordered comment to match if-clause
* Clean up old notice styles
* Adjust vertical marging for error list items on TT theme
* Add changefile(s) from automation for the following project(s): woocommerce
* Delete obsolete CSS file
---------
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>
* Better align excluded order statuses with WC Reports
* Update Tracks data to match updated customer order history count
* Add changelog
* Clarify code comment
* Exclude `checkout-draft` for block checkout/API orders.
* Remove unecessary array_map
Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>
* Use existing method to get un-prefixed order statuses
---------
Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>
* Add utm_category to discover page
* Fix product category URL params
* Add changefile(s) from automation for the following project(s): woocommerce
* Update productCategory to productGroup in Discover and NoResults components
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: Simran <simran.kaur@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
* use `method_title` for the email to the admin as that is better suited for an admin context
* do not require the title to be set in the updated option
* add the changelog file
* adjust the test, too
* appease the linter
* CYS - select the right font with AI offline
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - reset products and pattern when the site doesn't have AI generated content
* Add changefile(s) from automation for the following project(s): woocommerce
* fix lint
---------
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>
* Installer url API
* Redirect if installer not available
* Remove paid product autoinstall support
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add logging and admin noticing for rest api usages
Two new settings are added (UI in the Legacy API settings page):
- woocommerce_legacy_api_log_enabled
- woocommerce_legacy_api_usage_notice_enabled
When any of the two are enabled, legacy API usages are stored
in two options, 'wc_legacy_rest_usages' and 'wc_legacy_rest_last_usage'.
'wc_legacy_rest_usages' is a dictionary keyed by user agent,
each entry is in turn a dictionary keyed by request route,
items are arrays containing first and last usage dates as well
as total usages count (API version is logged too but for simplicity
it's not used to key the data).
'wc_legacy_rest_last_usage' contains the entry for the last usage,
regardless of user agent and route. It's used to display the notice.
When 'woocommerce_legacy_api_usage_notice_enabled' is enabled,
and the 'wc_legacy_rest_last_usage' option exists, an admin notice
displaying its contents is shown.
* Add changelog file
* Linting fixes
* Fix unit test
* Simplify the approach to logging/noticing:
- Remove settings
- Use a transient instead of an option for temporary data
- Store temporary data by user agent but not by route
- Make the admin notice dismissable
- Don't log now show the notice if the legacy REST API extension
is installed and active
- Add a filter to explicitly disable the logging
* Small fixes, including a missing "exit" after request processing
* Apply suggestions from code review
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
* Fix linting issues
* Update the warning text under the "Enable legacy REST API" setting
* Change the rules to display the notice.
Now it won't appear if the transient isn't available
or if the Legacy REST API is disabled (or if the Legacy REST API
extension is active, as before); but if the user hasn't
explicitly dismissed the notice it will appear again if the transient
is recreated or the Legacy REST API is enabled again.
---------
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
* Add the source type / origin of "Web admin" for orders created in admin
* Include "Web admin" in values for Order information metabox
* Include "Web admin" value for the Order information metabox
* Use the Order Origin meta value in the Origin column of the Orders table
* Add web admin and direct as origin values, and a flag for un/translated
* Use the untranslated origin_label value in Tracks
* Don't store the origin label in the database to allow better l10n
* Lowercase origin label in Tracks
* Empty label and Direct or Web admin as source for orders table column
* Better Tracks customer order count and include customer status
* Add changelog
* Update test to expect Unknown
* Remove short ternary
* Change OA meta box title to Order Attribution
* Use native order method `get_total_refunded`
* Simplify origin labels - use the same value for Orders Edit and table
* Correct imprecise doc comment.
* Improve customer order count and total spend calculation
* Make default label "Unknown" (for pre-OA orders, for example)
* Update tests to match new labels
* Hide Marketplace feature toggle UI
* Ensure marketplace feature is active in DB on all sites
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Remove duplicated text
* Add changefile(s) from automation for the following project(s): woocommerce
---------
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>
* Adds missing aria-label and tabindex HTML attributes to the Help tip element for "Product data" on "Add new product" page.
* Escape HTML tags
* Added changelog
* Update comment
* Amend method for selecting "New attribute" placeholder.
* Restore use of `getByRole()` and select first instance (two are being matched, in some cases).
* Use last match (in some test runs, `getByRole()` is unexpectedly matching more than 1 heading.
---------
Co-authored-by: Sagar Tamang <mi5t4n@gmail.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>