* Update woocommerce shipping promo banner [wc-shipping-188] (#50970)
* Make sure the WC Shipping slug is used for installation
* Make sure the check to show banner metabox work for HPOS as well
* Make ShippingLabelBannerDisplayRules::order_has_shippable_products work with HPOS as well
* Remove Jetpack plugin specific checks in ShippingLabelBannerDisplayRules
* Use correct variable names for dotcom connection
* Fix comments
* Remove depenency on WCS&T for showing WC Shipping promo banner
* Remove WC Tax and WC Shipping from incompatible plugins
* Vary action button label if WCS&T is already installed
* Inject config and render label purchase app after activation
* Open the purchase modal after adding it to DOM
* Render Shipment tracking metabox
* Use a different headline when WCS&T is already installed
* Fix UX when a none-compatible WCS&T is already active
* Fix CSS linting issues
* Fix Jslint issues
* Improve around usage of localized variables
* Fix and update JS tests
* Address phpcs issues
* Delete metaboxes of compatible WCS&T
* Remove redundant variable assignment
* Remove css and js of WCS&T if a compatible version is installed
* Fix failing legacy PHPUnit tests
* Only open the new label purchase modal if WCS&T is not active
* Remove redundant code around TOS acceptance for showing the banner
* Remove redundant test for Jetpack version checking
* Make sure target passed to MutationObserver.observe is available
* Add changelog file
* Add openWcsModal to component's prototype
* Add more js unit tests
* Address PHP notice
* Remove redundant variable assignments
* Rename wcsPluginSlug to more clear wcShippingPluginSlug
* Add a link to plugins page if incompatible WCS&T is already installed
* Remove unused function parameters
* Fix API resource path
* Handle a case where none compatible version of WCShipping is installed
* Prep for cherry pick 50970
* Remove infant use statement
---------
Co-authored-by: Sam Najian <dev@najian.info>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
Co-authored-by: Sam Najian <sam.najian@automattic.com>
- Add code docs to the Analytics classes and make get_order_statuses non-internal.
Document analytics classes and some methods. Add simple examples of how to use it. Give a brief "why?" and "when?" answers. Add links between related classes.
- Replace `Automattic\WooCommerce\Admin\API\Reports\*\Query` classes with a single `GenericQuery` class.
- Reduce the amount of duplicated code in Analytics `DataStore`s.
- Reduce duplicated code in Analytics controllers
- Add `FilteredGetDataTrait`, `OrderAwareControllerTrait`, and `StatsDataStoreTrait` for extension developers to reuse while creating custom Analytics
- Add a `GenericQuery` to reduce duplicated code in Query classes.
Also, to expose it to community extensions for reuse.
- Use `GenericQuery` instead of duplicated `Query` classes
- Move caching code to shared `DataStore::get_data`
- Move intervals specific `initialize_queries` to shared Trait
- Move intervals checking logic to shared `StatsDataStoreTrait`
- Reuse `GenericController::prepare_item_for_response` for `Reports\Controller` subclasses
- Reuse `GenericController::get_collection_params` for `Reports\Controller` subclasses.
- Move `get_items` code to shared `GenericStatsController`
- Move shared paginable controllers `get_items` code to the generic class
- Move fields param to `GenericStatsController`
- Separate `OrderAwareControllerTrait` from `ReportController`
to allow specific Analytics Controllers to extend the `Generic(Stats)Controller` directly, without extending the `ReportController`, which is used to list reports.
It's meant not to change any behavior. However, due to unification, it did tweak a few things mostly from the developer perspective:
- Previously, only some controllers threw an error from `get_items` when the data was missing; some did not. Now controllers the following Controllers changed behavior to also for such an error:
- Coupons
- Customers
- Downloads
- Orders
- Products
- Taxes
- the error has one error code from all controllers:`woocommerce_rest_reports_invalid_response` (previously there were report-specific)
- `woocommerce_rest_reports_categories_invalid_response` -> `woocommerce_rest_reports_invalid_response`
- In Orders Controller, the `$orders_data['order_number'], $orders_data['total_formatted']` are set in the `prepare_item_for_response` method, not in the `get_items`So `prepare_item_for_response` function is expected to be called with bare data from Query
- In Products Controller extended-info is now sanitized in the `prepare_item_for_response` method, not in the `get_items`
- ⚠️ (breaking) Previosly some Controlers' `prepare_item_for_response` function was getting and expecting first argument to be casted to `object`, while the rest of controllers used data as returned from the Store. This PR unifies this behavior for
- `Coupons\Stats\Controller`
- `Taxes\Controller`
- `Taxes\Stats\Controller`
So, if you extend those classes and override `prepare_item_for_response` in a way that expects `object`, you will get an error. (I have not found such cases in the `all-plugins` repo.)
All `woocommerce_rest_prepare_report_*` filters remain intact and inconsistent for backward compatibility.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mik <mikkamp@users.noreply.github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* CYS - Move the ai/images endpoint to woocommerce admin API
* CYS - Move the `ai/patterns` endpoint to woocommerce admin API
* CYS - Move the `ai/product` endpoint to woocommerce admin API
* Add changefile(s) from automation for the following project(s): woocommerce
* Remove import
* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Add strict types
* Extract AI_CONTENT_GENERATED constant
* Move instance creating to where it's used
* Add try/catch and fix the on Patterns
* Use the base AIEndpoint class
* Fix endpoint
* Update comment return type
* Fix comments
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* CYS - Move the ai/images endpoint to woocommerce admin API
* CYS - Move the `ai/patterns` endpoint to woocommerce admin API
* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce
* Fix duplicated entries
* Use AI endpoint base class
* Remove unnecessary change
* Add strict types
* Remove unnecessary return type
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* Add changefile(s) from automation for the following project(s): woocommerce
* CYS - Move the ai/images endpoint to woocommerce admin API
* Add changefile(s) from automation for the following project(s): woocommerce
* Use constant and normalize site title values
* Add base AI Endpoint class
* Fix lint error
* Use the endpoint base class
* Revert change
* Add changefile(s) from automation for the following project(s): woocommerce
* Use ai endpoint class
* Add strict types
* Fix lint error
* Add strict type
* Fix lint and use ai endpoint base
* Fix lint
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* Add changefile(s) from automation for the following project(s): woocommerce
* Use constant and normalize site title values
* Add base AI Endpoint class
* Fix lint error
* Use the endpoint base class
* Revert change
* Add changefile(s) from automation for the following project(s): woocommerce
* Use ai endpoint class
* Add strict types
* Fix lint error
* Add strict type
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* Use constant and normalize site title values
* Add base AI Endpoint class
* Fix lint error
* Use the endpoint base class
* Revert change
* Add changefile(s) from automation for the following project(s): woocommerce
* Add strict types
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update Fiver Logo Maker LP link per request.
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add busy state
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com>
* Update core profiler continue button container
On desktop screens 900px and smaller, add a 140px tall container stuck to the bottom of the viewport
Add a transparent to solid white gradient to the container (top to bottom)
Vertically center align the continue button and dislaimer text inside the container
* Add docs
* Update style
* Add blueprint package
* Add blueprint to composer
* Register blueprint cli commands
* Add feature flag
* Add changefile(s) from automation for the following project(s): woocommerce
* Update packages/php/blueprint/src/Exporters/HasAlias.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Update packages/php/blueprint/src/Exporters/ExportInstallThemeSteps.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Update packages/php/blueprint/src/UseWPFunctions.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Set destination correctly
* Make sure the given path is within wp content dir
* Remove debug code
* Fix typo
* Fix typo
* Fix lint errors with README
* Move READMD.md from src to the root directory and add development.md
* Add run-unit-tests.sh
* Setup test env
* Create dirs recursively
* Remove debug code
* Update packages/php/blueprint/src/Util.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update packages/php/blueprint/src/ZipExportedSchema.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Check for steps key
* Use if statement
* Add hook comment for wooblueprint_exporters and wooblueprint_importers
* Fix plugin activation condition
* Check for download_link -- it can be empty
* Check to make sure a file was written
* Plugin must be deactivated before attemping to delete it
* Lint fixes
* Lint fixes
* blueprint - add rest api (#49765)
* Add blueprint rest api endpoint
* Rename process to import
* Add changefile(s) from automation for the following project(s): woocommerce
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Init.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Remove unavailable 2nd argument from get_param -- default values are already set from the rest api def.
* blueprint - add builder page (#49774)
* Add blueprint builder page
* Change to the correct endpoint
* Add changefile(s) from automation for the following project(s): woocommerce
* Note that the builder intro page is temporary
* Remove unused code
---------
Co-authored-by: github-actions <github-actions@github.com>
* blueprint - add blueprint settings page (#49775)
* Add blueprint settings page
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Fix broken test
* Lint fixes
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update unit test env
* Added composer scripts to setup and run tests
* Moved tests to Unit dir to make space for Integration tests later
* WIP Add tests
* Use full if statement
* Use the correct step names
* Use activate_plugin and wp_get_thmes from wp functions trait
* Skip inactive plugins
* Use plural for collections
* Add a comment for StepExporter
* Remove unused construct code
* Correct function return types
* Update packages/php/blueprint/src/Importers/ImportActivateTheme.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Use full if statement
* Make sure plugin is installed
* Use functions from trait
* Remove unused functions
* Pass $force_convert correctly
* Correctly assign $this->validator
* Fix lint issues
* Rename setOptions to setSiteOptions
* Do not use die() -- throw an exception instead
* Make sure slug is a valid WP plugin slug
* Remove hardcoded string with get_step_name()
* Fix lint issues
* Update json example files
* Removed woo-specific examples -- these should be placed in the core
* Updated the built-in steps to reflect the recent changes
* Update packages/php/blueprint/src/docs/json-examples/deletePlugin.json
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Rename to correct filename
* Set version number
* Use mime_content_type for checking mime type
* Catch all exceptions
* Only allow zip and json
* Remove unused function
* Remove unused functions
* Add PHPCS command and ruleset
* PHP lint fixes
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Init.php
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
* Add back removed functions
* blueprint - Add woo blueprint exporters and importers (#50057)
* Add woo blueprint exporters and importers
* Comment fix
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCSettings.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCSettings.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCSettings.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCSettings.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Add a test for ImportSetWCTaxRates
* Lint fixes
* Lint fixes
* Fix setWCShipping schema and data format
* Add woocommerce_default_country option
* Lint fixes
* Fix typo -- it should be decode, not encode
* Fix incorrect argument order
* Fix typo
* Export and import shipping method settings
* Lint fixes
* Lint fixes
* Type functions -- base PR has changed
---------
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Require admin for import and export
* Use mime type from $_FILES -- mime_content_type can return incorrect mime type depending on the system configuration
* Enable export button when backend errors out
* Enable export button when backend errors out
* Allow WooCommerce export
* Change copy text
* Remove redundant check
* Fix lint issues
* Fix lint issues
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Update Jetpack logic
* Removed use of jetpack-boost -- we no longer run the experiment
* Jetpack should be considered as selected if it is already installed
* Add changefile(s) from automation for the following project(s): woocommerce
* removed jetpack check because it's already checked prior
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: rjchow <me@rjchow.com>
* CYS: Improve opt in flow
* Add changefile(s) from automation for the following project(s): woocommerce
* fix import
* fix imports and remove not used functions
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: disable zoom out on fonts iframe
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: Fix autoscroll when a new block is added
* add E2E test
* Add changefile(s) from automation for the following project(s): woocommerce
* remove not necessary changes
* rename blockToScroll to insertedPattern
* add smooth scroll
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: fix survey tracking
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Customer Account - Maintain the size of the icon in smaller screens
* Hide overflow text
* Update logo and buttons color
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* Use constant and normalize site title values
* Add base AI Endpoint class
* Fix lint error
* Extract the ai title option name
---------
Co-authored-by: github-actions <github-actions@github.com>
* useZoomOut hook
* Update iframe with logic with zoomed out feature
* Add back in styling code for margins
* Spaces to tabs
* Device size toolbar
* Move zoom out state to context
* Rename variable
* Fork iframe component from Gutenberg
* Add getCompatibilityStyles needed for forked iframe
* Update usePopoverHandler iframe selector
* Remove zoom out context as its not needed
* Revert "Remove zoom out context as its not needed"
This reverts commit b29780d805.
* Add Zoom Out toggle to icons WIP
* Fix icon fill
* Update selectors to fix toolbar and sidebar pattern bugs
* Add comment to get getCompatibilityStyles file
* Update iframe comment
* Move device toolbar into its own component
* Resize and device changes
* Add prop to disable the resize handler
* Update toolbar to work with Zoom Out
* Hide changes behind feature gate so they dont impact design with AI flow
* Toolbar account for top device bar
* Add body class for with/without AI flow
* Adds changelog
* Fix typo
* Change TS comment to expect error
* Cleanup iframe with unneeded code
* Remove getcompatibilitystyles
* Remove device code from resizable frame
* Add ? operator
* Remove keydown code from iframe
* Fix toolbar scroll
* Pass deviceType as a prop to resizable frame
* Disable devicetoolbar whilst editor is loading
* Disable focus state
* Remove comment
* not disabled selector for button hover states
* Fix linting
* Remove unused fn
* Focus specific styles
* Update sidebar-navigation-screen-typography.tsx
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: improve CTA
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>