* Allow observers to set billingAddress by returning billingData
This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress
* Add tests for shippingAddress and paymentMethodData
* Add mocked __internalSetPaymentMethodData to correct object
It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.
* Re-add FieldValidationStatus type
* Add FieldValidationStatus back
* Remove empty file
* Import FieldValidationStatus from correct place
* Remove import of deleted types file
* Add isObserverResponse type guard
* Use error constant instead of magic string in event emitter
* Remove composite project tsconfig
* Add ObserverResponse type
* Add types to emitEventWithAbort
* Check if paymentmethod data is an object before dispatching
* Set types on observer responses
* Add validationErrors type guards
* Add tests for validation typeguards
* Add validation errors as option on observer response
* Add more granular observer response types
* Check observer response has correct types before dispatching actions
* Force type on deprecated billingData and shippingData
* Remove unnecessary comment
* Add wrapper for __experimentalRegisterCheckoutFilters and deprecate it
* Update internal references from __experimentalRegisterCheckoutFilters
* Add wrapper for deprecated __experimentalApplyCheckoutFilter
* Update references from `__experimentalApplyCheckoutFilter`
With WordPress 6.2, the inspector controls are going to be
tabbed into a “Styles” and “Setting” section (where applicable).
Previously, in order to display our Feedback Prompt at the bottom
of the controls, we had hooked it into the “Colors” section
as a temporary/hacky solution to the problem.
Now that the styles sections are all moved, the problem
doesn't really exist anymore, and we can just place it
at the bottom of the controls.
- Revert the label change to "Add a coupon" so that it will be merged to WC Core and translation for the new string will be available.
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Capture notices from hidden block into siblings block
* switch to using a single context
* make change bwc
* add tests
* support context as array in StoreNotice
* move filter logic to Notice component
* Fix the alert icon's name
* Add "status" to the Alert's API
* Update the incompatible gateways notice's design
* Set the list's bullet points from CSS
Currently, the Cart block doesn't fully support Global Styles,
so, in orderto avoid providing the users with a confusing
or broken experience, we have decided to remove it
for the time being, until proper support has been added.
* Add get_collectible_method_ids function
* Add collectibleMethodIds to asset data registry
* Check whether method id is pickup_location/in collectibleMethodIds
* Allow selectShippingRate to be called without a package id
* Prevent collectible methods showing in the main shipping area
* Remove unnecessary pluck and add pickup_location to returned array
* No longer insert pickup_location in collectibleMethodIds
* Allow third party methods to influence low/high collection price
* Update useShippingData to consider any collectible method
* Add hasSelectedLocalPickup to shipping types
* Add dependency to selectShippingRate in useShippingData
* Register collectibleMethodIds as a callback
This is so the shipping methods get change to register before this is called. Passing a callback to `add` means it won't be called until just before it is output.
* Update supports key to 'local_pickup'
* Rename utils/shipping-rates to TS
* Convert to TS, add isPackageRateCollectible & hasCollectableRate
* Add tests for hasCollectableRate and isPackageRateCollectible
* Update shipping controller to output only method names
* Make PickupLocation shipping method support local_pickup
* Set prefersCollection based on rate ID being collectible
* Remove need to retrieve settings and use helper function instead
* rename hasCollectableRate to hasCollectibleRate
* Use array_reduce and update comments in get_local_pickup_method_ids
* Switch order of array_unique and array_values
* Remove unneeded dependency
* Hyphenate local-pickup so it follows the same format as other features
* Update use of collectible to collectable
* Change supports feature to be hyphenated
* Update __internalSetExtensionData to require namespaces
* Test coverage for __internalSetExtensionData
* Rename of select is no longer needed
* Update doc
* Global Styles: Add support for text settings
* StyleAttributesUtils: Change function order
* Global Styles: Remove redundant isFeaturePluginBuild() from useTypographyProps().
* Add max-height to Mini Cart drawer.
By giving the Mini Cart contents a max height with the
-webkit-fill-available property, we can ensure that the browser chrome
is accounted for on mobile devices.
* Add `dvh` and keep `vh` as a fallback for height.
By adding `dvh`, we also account for non-webkit mobile browsers that
have the same hidden button issue.
See
https://github.com/woocommerce/woocommerce-blocks/pull/8351#pullrequestreview-1278867767
Keeping `vh` as a fallback, along with `-webkit-fill-available` gives us
the widest range of support.
* Store breadcrumbs block: Gate global styles added via experimental flags to the feature plugin.
* Rename the const to featurePluginSupport and invoke it on block registration.
* Address CR
* Initial structure for the breadcrumbs block
* ditch inline comment
* Fine-tune the store breadcrumbs
* Disable the breadcrumbs block for regular posts & pages
* Update the breadcrumbs block details.
* Add tests
* rely on sprintf to render the breadcrumb
* Ditch usesContext.
* Add a link to the breadcrumb editor preview
* Disable all pointer-events for the breadcrumb link in the editor preview
* Add the align attribute
* Use the Disabled component to prevent interactions and update the copy for the block description.
* Subscribe only to changes on core/block-editor
* Improve performance of useForcedLayou
This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.
* Check if templates synced before doing it again in useForcedLayout
* Style Book: Fix Featured Product and Featured Category Blocks
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Subscribe only to changes on core/block-editor
* Improve performance of useForcedLayou
This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.
* Check if templates synced before doing it again in useForcedLayout
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Add Interactivity API scripts
* Enqueue scripts if Products exists for testing
* Test client-side transitions
* Remove script enqueue
* Remove hpq dependency
* Update Interactivity scripts to latest version
* Remove interactivity scripts from core entries
* Create webpack config for interactivity api
A plugin for optional chaining is required as the repo uses Webpack 4 for now.
* Enqueue the directives runtime
* Updated wp directives code
* Use a filter to enque the directives runtime
* Remove base-interactivity alias for now
* Add path for modules inside base-interactivity
* Revert "Remove base-interactivity alias for now"
This reverts commit 7c6cbee372c65e430590d98c1819b6b4b0a97d93.
* Remove unnecessary filter and enqueue
* Update router code
* Update Interactivity location and alias
* Use hook `init` for script registering
Co-authored-by: Mario Santos <santosguillamot@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
* Refresh on back
* Move refresh code to a hook in useStoreCart
* Load mini cart scripts when page is invalid
* Update code comments
* refreshDataIfPersisted->refreshCachedCartData
* Avoid deprecated code
* Only notify if cart resolution has finished
* Fix tests to check for cart resolution
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Make Notice component color black
The Notice component text is not legible in dark themes since the background color
is light and and the text color is too. With this change we are setting the color
always to black for our blocks, so it's always legible.
* Make the text black for notices displayed on the editor
* Import editor.scss
* support partial updates
* revised error ids to reference in validation class
* Validate before push
* Fix logic + TS
* Avoid need for PUT by delaying validation/sanitization
* $cart change was not needed
* Revert changes in schema - fix is handled at route level
* Put back wc_do_deprecated_action
* Extra validation is not needed
* No need to export isValidAddressKey - its not used anywhere
* No longer using RouteException in customer update route
* Fix setting shipping to billing with changes
* Update error ids
* Only validate posted props
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Updated package-lock.json
* fixed method sig
* PHP versions matrix
* removed extra space
* renamed step
* Update E2E and coding standards to use PHP 8.0
* Un-linted unit-tests.yml. Github flows use 4 spaces indent, while our .editorconfig file enforces 2 spaces.
* Refactor unit-tests.yml
* Linted unit-tests.yml to proper 2 space indents
* Removed composer caching
* Test without hacky permissions step
* Concurrency disable.
Jobs renaming.
* Add step to install wp-env for PHP unit tests.
* Another try at fixing perms for wp-env
* Another try at fixing perms for wp-env
* Restore missing steps
* Move notices to corresponding context
* Change `errorMessageContext` to `context`
* Fix MD lint errors
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Allow observers to set billingAddress by returning billingData
This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress
* Add link to original PR
* Set billingAddress when observer errors
* Rename shippingData to shippingAddress
* Add isBillingAddress and isShippingAddress type guards
* Add tests for new type guards
* Only set billing and shipping if they are valid objects
* Add tests for __internalEmitPaymentProcessingEvent thunk
* Update deprecated version
* Return promise from this function to aid with testability
* Add tests for shippingAddress and paymentMethodData
* Ensure correct value is used to set shipping address
* Move test data out of tests to aid with reusability
* Improve success callback name
* Add mocked __internalSetPaymentMethodData to correct object
It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.
* Add test for failed observers
* Add test for mixed observers
* Add comments explaining the destructure & deprecation
The "Coupon code" text was changed to "Add a coupon" and it resulted in the failing of an e2e test as it couldn't find the translated text for "Coupon code". The translation for "Add a coupon" is not available so changing the text to "Apply a coupon code" until the next WC Core release since the translation for the text "Apply a coupon code" is already available.
* Product Rating: Transition from using CSS margin to Global Styles
* Product Rating: Re-add css margins for Product Rating inside of the All Products block.
* Product Rating: Change bottom margin to 1rem
* Product Rating: Re-add the Classic Template fix.
* Product Rating: Remove the Classic Template fix.
* Product Price: Transition from using CSS margin to Global Styles
* Product Price: Re-add css margins for Product Price inside of the All Products block.
* Product Price: Change bottom margin to 1rem
* Product Price: Fix the margin typescript declaration.
* Scroll to errors when interacting with radio buttons
* Fix full stop wrapping in checkout
* Make type guard for api response reusable
* Merge useShippingData and useSelectShippingRate
Overlapping functionality and responsibility easily merged into a single hook.
* ShippingDataProvider Typescript
* Create errors when receiving errors via thunk
* Update DEFAULT_ERROR_MESSAGE
* Update tests since all errors are set via new action
* Correct SET_ERROR_DATA
* Update json error text and allow it to be dismissed
* Add back missing comment in types
* Put back typedef
* Allow Store Notice Containers to display subContexts without changing original context
* receiveError handles cart
* Update assets/js/data/cart/notify-errors.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/context/hooks/shipping/types.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove debug
* Revise type (remove as)
* rename to unregisteredSubContexts
* getNoticeContexts comment
* Add test for unregistered errors
* Update comment
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Allow the context to be overridden when processing errors
* Export all error functions
* Allow customer data update if not editing fields
* removeNoticesWithContext Helper
* Hide rates when editing the address
* New update address logic
* Handle cancel for the form
* Block scaffolding
* Rename to store notices
* Register only in the site editor
* Update description
* Add woocommerce class
* Add tests
* Delete old test file
* Update notices message in the editor
* Remove customization
* Disable the block server side
* Fix TS error
* Add custom classes
* Reprashed test description
* Escape notices
* Remove unnecessary disabled component
* Only allow to insert the block once
* Improve class name
* Merge edit and block files
* Fix copy
* Simplify test case
* Remove align support
* Remove attributes
* Change editor markup
* Use the Notice component to display the notice placeholder on the editor
* Use sprintf to improve readability
* Inline component
* Remove styles and unregister scripts
* Use ordered placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Use info as the notices status
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix php lint error
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* WIP
* Render in editor and add styles
* Simplify select
* Undo change
* Update titles and description
* Wrapped text for translation
* Remove from products inner blocks
* Allow the block in the inserter
* Rename test file and add new tests for catalog-sorting block
* Register on the site editor only
* Fix tests
* Disable block server side
* Override the `enqueue_assets`
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix TS error
* Simplify edit
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Disable background color
* Add custom classes
* Remove alignment
* Inherit color and font properties
* Merge edit and block files
* Use sprintf to improve code readability
* Make fontsize small by default
* Add order placeholders and woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix floating issue
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Init setup to add a new block Results Count
* Render template part as a content of ResultsCount block
* Switch to template part rendering
* Rename the block to ProductResultsCount
* Fix typo in BlockTypesController
* Change the ProductResultsCount class name
* Remove Product Results Count block from Product Query template
* Improve the way Product Results Count is rendered in the editor
* Add prefix to places that missed renaming from ResultsCount to ProductResultsCount
* Remove unnecessary frontend.tsx file for ProductResultsCount
* Make sure global styles are applied and respected by Product Results Count block
* Make sure the Product Results Count is available inly in Product Catalog template
* Add basic tests to Product Results Count
* Remove empty line in style file
* Fix TS issue in Product Results Count
* Fix typo
* Override the enqueue_assets method to prevent unnecessary enqueue and 404 error on the frontend
* Add necessary property to block's metadata
* Address code review feedback
* Update description
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Remove disabled component
* Improve test description
* Merge edit and block files
* Remove align support
* Remove background support
* Simplify edit component
* Improve readability with sprintf and add custom class
* Simplify test case
* Add styles and order placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix markup to match with the frontend
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add coupon link instead of dropdown in Cart and Checkout blocks
* Fix state names used for displaying the link and coupon form
* Fix storybook for coupon block
* Fix unit test for coupon block
* Fix css and accessibility
* Fix coupon block position on Checkout
* Update e2e test cases for coupon block (https://github.com/woocommerce/woocommerce-blocks/pull/8022)
* Update e2e test cases for coupon block
* Fix perfomance test for coupon block
* Fix double await typo
* Fix perfomance test for coupon block
* Remove CSS
* Use classnames to add and remove classes
Improved the code to use classnames to add and remove classes. Also, moved the logic to handle click and submit to separate functions.
* Remove unused action and type action
* Derive the incompatible payment methods with selector
Instead of adding the incompatiblePaymentMethods to the payment state.
Let's simply derive it using a selector to keep a minimal state.
* Check compatibility with express payments
* Custom validation strings using a new function named getValidityMessageForInput
* getValidityMessageForInput tests
* Added integration test for error message
* Clear value
* update test strings
* Shipping and collection method block package support (https://github.com/woocommerce/woocommerce-blocks/pull/7383)
* Shipment wordage
* Hide panel if collection is not available for an item
* Update selection when displayed
* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)
* Register a blocks local pickup method globally
* Remove local pickup plucking from store api
* Multiple pickup locations
* Unused code
* Translate meta data
* Update UI to match zones table
* Description
* Handle new shipping method in client
* Improve location rendering
* Only split out pickup location methods
* Fix enabled toggle
* Show and hide shipping text in sidebar based on pickup
* No need for "from" when min and max are the same price
* Update sample data for the editor
* fix errors
* Force method/pickup in the checkout layout (https://github.com/woocommerce/woocommerce-blocks/pull/7910)
* Split up ShippingRatesControl for readability
* Alignment styling
* Split tidy packages for readability
* Combine hooks to prevent circular dependency
* Notice styling
* Conflict
* Hide notice with 1 package
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* add notice when there are existing enabled legacy local pickups
* Fix PHP warning
* Link though to the settings page
* Fix setting save
* Enabling this will produce duplicate options at checkout.
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Avoid duplicates in selected shipping method display
* Correct types
* Render pickup locations - not rates
* Always show "from" when there are multiple packages
* Pickup must be available for all packages
* Derive locations from rates
* Improve code style/docs
* Packagecount
* Introduce woocommerce_store_api_cart_select_shipping_rate
* Update docblock
* Move payment methods
* Setup entrypoints
* Sortable implementation
* Sortable
* Basic UI in place for settings
* Hydrate real settings
* Form updates values
* Styling and save button placement
* useSettings hook
* Prepare for save
* delete
* Add location button
* Remove className
* Conditional display of taxes
* Save via API
* Update general settings to designs
* Modal styles
* Style table
* Border colors and radius
* Added e2e tests
* use node 16
* Enqueue states in admin
* Use render from wordpress/element
* Missing handle style
* Enable translations
* Remove curried function
* Todo for inline settings
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Hide form step descriptions when empty unless block has focus
* Make editor style match frontend
* Add links to settings in sidebar
* update sample costs
* phpcs
* Shipment wordage
* Hide panel if collection is not available for an item
* Update selection when displayed
* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)
* Register a blocks local pickup method globally
* Remove local pickup plucking from store api
* Multiple pickup locations
* Unused code
* Translate meta data
* Update UI to match zones table
* Description
* Handle new shipping method in client
* Improve location rendering
* Only split out pickup location methods
* Fix enabled toggle
* Show and hide shipping text in sidebar based on pickup
* No need for "from" when min and max are the same price
* Update sample data for the editor
* prefersCollection controls shipping visibility
* Remove log
* Create skeleton pickup options block based on shipping methods
* Filter locations to local pickup methods
* Correct case of block name
* Location styling
* Pull pickup details from new core fields
* Fix linting warnings on new types
* Remove blocks_local_pickup check (this does not exist yet)
* Move enable_local_pickup_without_address so it works under all contexts
* Fix display of FREE when there are a mix of prices
* Remove undefined return value
* Update block descriptions
* fix message
* Correct case
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Remove cart notices before showing new ones
* bot: update checkstyle.xml
* Update deps for useEffect
* Remove outdated notices from mini cart
* Add comment to note that this functionality is also present in mini cart
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Convert tabs component to TypeScript
* Add tabs component story
* Add desciptions in comments to the Tab props
* Rename and export tabs component to display descriptions in Storybook
Renamed Tabs component to __Tabs as a sign it should not be used directly. Since we were using withInstanceId as the default export and were not exporting the Tabs component, Storybook could not retrieve the description and default values. We have renamed and exported the component to make sure Storybook can pick up the descriptions and default values.
* Rename exported Tabs component
Changed the exported Tabs component from __Tabs to __TabsWithoutInstanceId to make it more descriptive.
* Use local package rather than WP package in base components
* Missing type on imports
* Move hasSpecingStyleSupport inline to avoid polluting utils with the block-editor external
* Use local wordpress-block-editor import to avoid the external
* Add readme to base directory to warn against using editor/components externals
* Check functions exist
* Revert "Check functions exist"
This reverts commit ce95800b79ddb48369cd22d2b7854384db0d8891.
* Revert wordpress-block-editor import
* Add todos to the hooks that need refactoring
* Update assets/js/atomic/blocks/product-elements/button/supports.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/image/supports.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/rating/support.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/sale-badge/support.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/title/index.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Reference issue
* Update assets/js/base/README.MD
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* spacing
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* Remove the Products block from WP < 6.0
Too many APIs which are required for the Products block experience
are just plainly unavailable in versions lower than 6.0.
(cherry picked from commit ccfb1210bcbdb14ab52f6f240916fb4fcaa3ff18)
(cherry picked from commit 8c7bcce8218a83a9498943b23c971de1199bcad7)
* Wrap Checkout Edit in SlotFillProvider
Required to render Slot/Fills in the editor
* Remove editor check when rendering ExperimentalOrderShippingPackages
We want to render it in the editor and on the front end, so checking is no longer necessary
* Wrap Cart in SlotFillProvider when in editor
This is so Slot/Fills can be rendered in the preview
* Filter Rating Block > Prevent reload on select.
* Filter by Stock Block > Prevent reload on select.
* Disable debounce for the editor.
* Filter by Price Block > Prevent reload on select.
* Filter by Attribute Block > Prevent reload on select.
* Make the isEditor and isSelected params optional.
* Make isSelected optional.
* Address CR
* update to use isObject
* Set up incompatiblePaymentMethods in data store
* Save incompatible payment methods in data store
* Create the IncompatibilityPaymentGatewaysNotice
* Fix hidden notice bug
* Rename "paymentAdminLink" to GlobalPaymentMethod and move to types dir
* Add all registered methods to incompatiblePaymentMethods state
* Rename selector to getIncompatiblePaymentMethods
* Remove incompatible methods when adding available ones
* Remove unused reducer cases
* Stop adding incompatible methods now that we add them in default state
* Display incompatible methods in the notice from the data store
* Refactor incompatible payment gateways notice
* Update the incompatible extensions notice's design
* Hide Make as default notice
We hide this notice while the notification for incompatible payment
gateways is visible
* Hide the sidebar compatibility notice
Hide this notice while the notification for incompatible payment
gateways is visible. And show it otherwise.
* Capitalize the label for the button on the page settings notice
* Fix missing 'globalPaymentMethods' bug on frontend
* Highlight incompatible payments in sidebar
Highlight incompatible payment gateways within the Payment Options Block
* Rename the incompatible gateways notice's component
* Support plural and singular forms for the notice
* Update incompatible extensions notice's design
* Use the simplified types import
Co-authored-by: Niels Lange <info@nielslange.de>
* Add translation support to notice message
* Fix failing unit tests
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Niels Lange <info@nielslange.de>
* Display Add Review link in the All Products if there's no product rating in All Products and Products
* Apply the font-size mixin to the Add Review link
* Make Add review link NOT clickable in editor
* Improve styles of Rating component so they support alignment in product grids
* Render the block in the frontend
* Add icon style selector to Display settings
This adds an icon style selector in which users can choose the customer account link icon.
* Display on the frontend depending on the icon style
* Rename attributes
* Refactor block rendering
* Improve styling
* Add link to account settings
* Split css file
* Switch to SSR
* Add customer account block to header patterns
* Add customer account block to footer patterns
* Adapt minimal header to designs
* Adapt large header to designs
* Adapt header patterns to new designs and format code
* Adapt footer patterns to the designs
* Change display style for the essential header
* Increase alt icon size
* Make the icon resize with the label
* Adjust icon size on headers
* Add padding and move second row to the right
* Remove unused enum
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Add empty 'Customer Account' block
* Add edit to render the block on the editor
* Add Customer Account icon to @woocommerce/icons library
This icon is used in the Customer Account block.
* Use customerAccount icon in the Customer Account block
* Add Block Settings to Customer Account block
Add Typography and Color settings to the Customer Account block that can be used during Edit mode.
* Add Customer Account style icons
This adds the customer account style icons to be used by the customer account block.
* Render the block in the frontend
* Add Display setting to the Customer Account block
This setting allow users to choose if they want to include an icon with the customer account link.
* Add icon style selector to Display settings
This adds an icon style selector in which users can choose the customer account link icon.
* Display on the frontend depending on the icon style
* Rename attributes
* Refactor block rendering
* Improve styling
* Make the account link dynamic
* Add alignment menu
* Get dashboardUrl with getSettings and add fallback
* Add link to account settings
* Add tests
* Fix test
* Change display title
* Split css file
* Switch to SSR
* Add styles to the front end
* Address latest feedback
* Remove experimental flag
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Mini Cart block - added notice support woocommerce/woocommerce-blocks#6941
Mini Cart block - added notice support
* set isDismissible to true
* address feedback
* improve layout
* fix style and update close button label
* fix UI when the admin bar is visible
* Split out dismissible notices
* fix css
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add cart view switcher
* Attribute based switched POC
* Tidy up view handling
* Mini cart
* Not sure who clint is. Typo - rename to clientId
* Avoid string casting in TS
* Add margin to title
* Set custom source to prevent currentView saving to post content.
Note this also removes `save` which does not exist in Gutenberg.
* Remove higher order component from withViewSwitcher
* Import view switcher in main file
* Add to side effects
* Move view switcher import
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Add Mini Cart button styles to Button component
* Add wp-element-button class to Button component
* Don't load opinionated button styles in TT3 and Zaino
* Remove bold styles from Mini Cart buttons
* Refactor Store Notices
Move snackbar hiding filter before notice creation
Implements showApplyCouponNotice
Refactor context providers
Use STORE_NOTICE_CONTEXTS
use refs to track notice containers
Refactor ref usage
Use existing noticeContexts
* Move new notice code to checkout package
* Combine store and snackbars
* Update noticeContexts imports
* Remove context provider
* Update data store
* Fix 502
* Add new error contexts
* Force types
* Unnecessary reorder of imports
* Fix global handling
* Document forceType
* Optional props are undefined
* Remove function name
* Missing condition
* Remove context prop
* Define ACTION_TYPES
* Remove controls
* Update assets/js/base/context/event-emit/utils.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* CONTACT_INFORMATION
* Remove ref from registerContainer
* Abstract container locating methods
* pass context correctly when displaying notices
* Remove debugging buttons
* Update filter usage - remove useMemo so filter can work inline
* Refactor existing error notices from the API (https://github.com/woocommerce/woocommerce-blocks/pull/7728)
* Update API type defs
* Move create notice utils
* Replace useCheckoutNotices with new contexts
* processCheckoutResponseHeaders should check headers are defined
* Scroll to error notices only if we're not editing a field
* Error handling utils
* processErrorResponse when pushing changes
* processErrorResponse when processing checkout
* remove formatStoreApiErrorMessage
* Add todo for cart errors
* Remove unused deps
* unused imports
* Fix linting warnings
* Unused dep
* Update assets/js/types/type-defs/api-response.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add todo
* Use generic
* remove const
* Update array types
* Phone should be in address blocks
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update store name to wc/store/store-notices
* Fix assertResponseIsValid
* Funnel woocommerce_rest_invalid_email_address to the correct place
* woocommerce_rest_missing_email_address
* Move comments around
* Move data back into const
* Spacing
* Remove spacing
* Remove forced snack bar and styling
* Move notices within wrapper
* Remove type
* hasStoreNoticesContainer rename
* Group by status/context
* Remove global context
* Remove white space
* remove changes to simplify diff
* white space
* Move comment to typescript
* List style
* showApplyCouponNotice docs
* See if scrollIntoView exists
* fix notice tests
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Respect core settings for showing the Checkout block
* Add account creation option from core to checkout context provider
* Fix TS errors
* Adjust display logic of <LoginPrompt />
* Update assets/js/blocks/checkout/block.tsx
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Rename <LoginPrompt> to <MustLoginPrompt>
* Show space between login text and login link
* Fix TS error
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add receiveCart thunk
* Add mapCartResponseToCart helper
* Add getItemsPendingQuantityUpdate selector
* Update cart resolvers to be thunks
* Remove RECEIVE_CART action and replace with SET_CART_DATA
receiveCart will turn into a thunk.
* Add notifyQuantityChanges functions
* Remove receiveCart from action type definition, replace with setCartData
* Move apiFetchWithHeaders out of controls
This will just be a normal function since we'll be updating actions to thunks which will use this instead of a control.
* Include thunks in actions file
* Update receiveCart action to setCartData
* Update applyCoupon action to a thunk
* Update useStoreCartCoupons to get action from correct place
* Update StoreCartCoupon types
* Add types for Thunk and ThunkReturnType in mapped-types
* Change applyCoupon to a thunk
* Get applyCoupon, removeCoupon, receiveApplyingCoupon from useDispatch
This is to separate the concerns of actions vs. selectors. Previously the actions were fetched during useSelect which is not a pattern we use anywhere else in the codebase. Since we updated the MapToDispatch type, we can now get correctly typed thunks from the data store.
* Improve apiFetchWithHeaders typings
* Convert removeCoupon from generator to thunk
* Add applyCoupon and removeCoupon to CartAction type
* Remove unused old-style type-def
* Add receiveApplyingCoupon & receiveRemovingCoupon to StoreCartCoupon
* Correct issues with StoreCartCoupon type
These were not intended to reflect the actions in data store, rather the functions offered by the useStoreCartCoupons hook.
* Update applyExtensionCartUpdate to a thunk
* Update addItemToCart to thunk
* Add ResolveSelectFromMap type that works with thunks
* Add CartDispatchFromMap and CartResolveSelectFromMap types
We can add this to all data stores to get them working with thunks properly.
* Add docs and update generic name in ResolveSelectFromMap
* Add correct types for thunk resolvers in cart data store
* Update removeItemFromCart to thunk
* Update apiFetchWithHeaders to use generic
* Update selectShippingRate to thunk
* Update resolver tests to test correct thunk functionality
* Update updateCustomerData to thunk
* Update reducer test to reflect new action name
* Update comments on CartDispatchFromMap and CartResolveSelectFromMap
* Add quantity_limits to preview cart
* Make notices speak when shown
* Remove copilot comment
* Add isWithinQuantityLimits function
This is because we shouldn't show a notice if the quantity limits change, but the item's quantity is still OK.
* Add tests for notifyQuantityChanges
* Show notice when multiple_of is updated
* Update test to test for multiple_of changes
* Remove empty export
* Remove controls from cart data store
Not needed anymore since the exported value from the shared-controls file was empty.
* Export a control and async function for apiFetchWithHeaders
This is required because async functions cannot be called from sync generators.
* Use control version of apiFetchWithHeaders in the collections store
* Improve comments and remove incorrect TypeScript
* Update assets/js/data/cart/actions.ts
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update ResolveSelectFromMap to include selectors too
* Update TS in actions
* Use finally to remove duplicate code
* remove item pending delete/qty update after action runs in all cases
This will also reset the state when the request to remove it/change quantity errors
* Remove unnecessary type from param.
Not needed because we have TS now. The description can stay though, it is useful.
* Update snackbar wording to use active voice
* Remove old WP version check
* Set max quantity to high number instead of null
This would only happen in a niche case, and would require several TS changes to fix, so it's better to set it as a number here. 9999 should be high enough, and is the default quantity limit set below in get_product_quantity_limit
* Set code on woocommerce_rest_cart_invalid_key to 409
This is so the cart is returned in the response, so the client can update.
* Fix typo in comment and add CartSelectFromMap
* Remove unnecessary docblock
* Add getItemsPendingDelete selector
This is needed so we can show a notice for items that are unexpectedly removed from the cart. We need to know which ones are pending delete so we can skip showing the notice for them.
* Add type for notifyQuantityChanges args and change args to object
* Add notifyIfRemoved function
This will check items that have been removed and show a notice for them.
* Fix TS in receiveCart & pass itemsPendingDelete to notifyQuantiyChanges
* Update wording on removal notice
* Update types for notifyQuantityChanges args
* Update tests to reflect new wording and args being an object
* Check item is truth before running comparison of keys
* Update tests for unexpectedly and expectedly removed items
* Ignore print_r to satisfy phpcs
* Update PHP tests to reflect correct response code when deleting items
* Remove unnecessary controls and dispatch events directly from thunk
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Convert cart-checkout/totals/shipping component to TypeScript.
* Change hasRates tyep to boolean and fix renderOption type
* fix type for renderOption in ShippingRatesControlProps
* WIP: Make place order editable
* Remove obsolete undefined
* Wrap <ReturnToCartButton> within <Noninteractive>
* Rename const from submitButtonText to paymentMethodButtonLabel
* Simplify defaultValue logic
* Add type for lock attribute in isBlockLocked
* Add getMissingBlocks function
* Add findBlockPosition function
* Refactor useForcedLayout to use registry batch & insert multiple blocks
* Improve comment on getMissingBlocks function
* Fix the incorrect layout of Rating and Price in Classic Template
There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block
* Extend Filter by Stock Editor options with dropdown and single/multiple choice
* Add dropdown implementation for Filter by Stock Status
* Adjust font-sizes to the rest of the filters
* Add tests to Filter by Stock: dropdown and list variants
* Change test file extension from .js to .tsx, so it handles types as well
* Add E2E test to Filter by Stock checking if display style can be toggled
* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions
* Change the name of the filter blocks in the test files
* Remove unnecessary waiting step in E2E test for Filter by Stock
toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed
* Improve the STOCK_STATUS_OPTIONS type handling
* Extract onDropdownChange function instead of inline arrow function
* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single
* Make Cart and Checkout buttons editable
* Make shopping button editable
* Remove obsolete dot from the “Empty Mini Cart view” title
* Ensure to keep the existing styles
* Improve name of start shopping button label
* Prevent potential TS error
* Edit Proceed to Checkout button
* Don't allow empty button and remove console log
* extract default button label into a variable
* Feedback from Nadir & Niels
Co-authored-by: Niels Lange <info@nielslange.de>
* Product Query: First attempt at adding patterns
* Product Query: Update patterns and the default block template
* Product Query: And new and update existing patterns
* Product Query: Adjust layout of the Minimal Product Row pattern
* Product Query: Update pattern names
* Product Query: Polish spaces between blocks inside the patterns
* Product Query patterns: Link product titles and improve spacing between product elements
* Product Query patterns: Button font-size update
* Product Query patterns: Center the pagination
* Product Query patterns: Center the pagination for the default pattern
* Product Query patterns: Remove an empty column
* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern
* Rename the setting section to match Filter by Attribute
* Add Display Style toggle to the block settings
* Set list as a default value of displayStyle for Filter by Rating
* Add dropdown variant of Filter by Rating
* Extend the Editor settings with selectType: single or multiple
* Adjust the styles of a FormTokenField to other dropdown
* Align Editor settings order and wording between Filter by Attribute and Rating
* Fix the issue with cut off corners of dropdown borders
* Provide translated screen reader messages and placeholder
* Revert the label property, which is necessary to display checkbox list
* Make classname for Rating component optional and remove styling in Filter by Rating
* Cover the case when filter with zero products needs string methods for comparison
* Handle Typescript errors and add ts-ignore annotations when necessary
* Remove explicit key prop assignment in Rating component
* Remove leftover property in type definition
* Refactor JSX element extension with custom properties to more robust way with object copy
* Filter by rating tests (https://github.com/woocommerce/woocommerce-blocks/pull/7845)
* Filter by Rating tests:
- List single
- List multiple
- Dropdown single
- Dropdown multiple
* Adjust the font-size of Filter by Rating dropdown to the rest of the filters
* Fix E2E tests after the Editor settings label has been changed
* Improve sorting in Filter by Rating dropdown
With this change the order of options is always descending: in the chips, suggestions, active filters and URL
* Change the name of the filter blocks in the test files
* Prevent single dropdown input to overflow the wrapper
The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css
* Remove the unused styles of active options in Filter by Rating
Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then
* Change the approach of shared styles to fix the dropdown issue in filters
Instead of using direct classes, rewrite it to mixin and include in the filters
* Fix the Filter by Rating with Products block
The problem was with the Products block, that there was incorrect initial value of product ratings query
* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* A notice is now displayed in the editor whenever the Filter by Rating block is used in a store that has no products with ratings. Additionally, users can now preview/update the content, settings, and color for the filter even when the store doesn't have any ratings yet.
* Update hex color val to currentColor.
* Remove fill attributes on SVG
Having the fill attributes explicitly defined on the SVG was setting the
icon to purple in unexpected cases.
This also reverts the quick attempt to adjust CSS selector for a fix, as
it was the incorrect approach.
* Allows custom validation rules to be applied to fields - in this case, email address
* Add local state to only push valid changes
* Do not need required
* unused isString
* Move to push level
* Update packages/checkout/components/text-input/validated-text-input.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update packages/checkout/components/text-input/validated-text-input.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update packages/checkout/components/text-input/validated-text-input.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update packages/checkout/components/text-input/validated-text-input.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Validate when the data store changes
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Creates a new block variation based on the core “Post Excerpt” called “Product Summary”.
* Brands it as our old “Product Summary” atomic element.
* Creates a utility function to allow easy creation of such variations.
As much as we can, we should use core blocks when the functionality is mostly overlapping. In the case of the Post Title block, we don't need to add and maintain our own block most likely, so we should just brand the Post Title block instead.
This PR does the following:
* Creates a new block variation based on the core “Post Title” called “Product Title”.
* Brands it as our old “Product Title” atomic element.
* Use this variation as the default within the Product Query template.
* Also removes some old code used for variations before the namespace attribute was available on the core Query Loop and repurposes it to create this variation.
* Product Query: add Feedback Prompt in inspector
The prompt doesn't appear at the very bottom as there isn't
currently any straightforward way to do this in the block variation.
More investigation is required.
* Product Query: Change icon, description and name
* Product Query: switch to Feature plugin flag
* Add all currently available atomic blocks to the default Product Query template
* Update feature flags doc
* Change SKU and Stock Indicator feature flags
* Change feature flags docs
* Add title prop to the `FeedbackPrompt` and add a title to the Product Query one
* Hacky solution to display the feedback block at the bottom
The order of the inspector controls is set in Gutenberg.
We can hack our way down by hooking to the “color” group and
display our feedback there.
Other panels would be displayed below that if added, such as borders
and margin.
* Reduce Product Query default template
* Fix e2e tests after Product Query block name change (https://github.com/woocommerce/woocommerce-blocks/pull/7840)
* Product Query: Add a better default pattern (https://github.com/woocommerce/woocommerce-blocks/pull/7833)
* Product Query: Add a better default pattern
* Product Price: Add bottom margin
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
* Add product query support for Product Summary block
On the client side, when the Product Summary block is used within the product query block, the markup will be rendered on the server side - No javascript related to Product Summary block will be rendered.
* Update variable names for clarity & readability
* Escape all values in output string
* Fix custom style not working
More info: https://github.com/woocommerce/woocommerce-blocks/pull/7774#discussion_r1035909243
* Align the font-size of checkbox-control component to the price slider amount
* Align the font-size of Price Slider Button to the price slider amount
* Align the font-size of Filter Reset Button to the price slider amount
* Align the font-size of Clear All Button to the price slider amount
* Align the font-size of Apply button in Editor to the price slider amount
* Align the font-size of Apply button in Frontend to the price slider amount
* Align the font-size of Price Slider Amount to the standard size
* Align the font-size of Active Filter chips to the price slider amount
* Align the font-size of Filter by Price (text) to the price slider amount
* Align the font-size of Filter by Attribute (dropdown) to the price slider amount
* Align the font-size of placeholder of Filter by Attribute (dropdown) to the price slider amount
* Change font-size for text in filters from font-size(smaller) to font-size(smaller)
As a result of discussion in PR it was agreed to check the styles with bigger font size hence the change
* Align the font-size of input text of Filter by Attribute (dropdown) to the price slider amount
* Change margin-right of checkbox-control to relative value so it better adapts to the fonts
* Product Query: Fix pagination issue
* Product Query - Add support for the Filter By Price Block woocommerce/woocommerce-blocks#6790
Product Query - Add support for the Filter By Price Block
* fix query relation
* fix on sale query
* Product Query - Add support for the Filter By Attributes block woocommerce/woocommerce-blocks#6790
Product Query - Add support for the Filter By Attributes block
* fix bugged pagination and on-sale filter after refactor
* address feedback
* Product Query - Add support for the Filter By Stock Block woocommerce/woocommerce-blocks#6790
Product Query - Add support for the Filter By Stock Block
* Fix filter blocks: the data (e.g: max price or stock-status) match the variation woocommerce/woocommerce-blocks#7245
fix filter blocks: the data (e.g: max price or stock-status) match the variation
* rename allowControls to allowedControls
* add support to the global query
* fix eslint error
* bot: update checkstyle.xml
* Update src/BlockTypes/ProductQuery.php
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* fix global query generation
* bot: update checkstyle.xml
* try: refactor merge_queries
* remove debug code
* fix: unpack assoc array php 7.4
* try: refactor merge_queries to take any form of input without unpacking
and preparing the input arrays
* add missing query vars
* add feature flag
* updates comment
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Adds product query support for Category list block
On the client side, when the Category list block is used within the
product query bloc, the markup will be rendered on the server side -
No javascript related to Category list block will be rendered.
* bot: update checkstyle.xml
* Fix extra space after the category link
I used the solution from following link: https://css-tricks.com/fighting-the-space-between-inline-block-elements/#aa-remove-the-spaces
Here is the content from the above link:
The reason you get the spaces is because, well, you have spaces between the elements (a line break and a few tabs counts as a space, just to be clear). Minimized HTML will solve this problem, or one of these tricks:
```CSS
<ul>
<li>
one</li><li>
two</li><li>
three</li>
</ul>
```
or
```CSS
<ul>
<li>one</li
><li>two</li
><li>three</li>
</ul>
```
or with comments…
```CSS
<ul>
<li>one</li><!--
--><li>two</li><!--
--><li>three</li>
</ul>
```
They’re all pretty funky, but it does the trick.
* Fix custom style doesn't work on the frontend side
For more info, check this comment on the PR:
https://github.com/woocommerce/woocommerce-blocks/pull/7675#pullrequestreview-1179267957
In summary, user can set the custom styles like text color, link color, font size, font weight, line height using the editor sidebar.
These styles weren't showing on the frontend side.
* Add support for additional CSS class(es)
* Fix "custom style -> link color" not working
To understand the issue in more details please check following comment:
https://github.com/woocommerce/woocommerce-blocks/pull/7675#issuecomment-1319822535
* Fix classname undefined issue
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Rename Active Product Filters block to Active Filters
* Rename wc-block-active-product-filters__placeholder to wc-block-active-filters__placeholder
* Rename active filters fixture
* Add product query support for Sale badge block
On the client side, when the Sale badge block is used within the product query block, the markup will be rendered on the server side - No javascript related to Sale badge block will be rendered.
* Add support for additional CSS class(es)
ADDITIONAL CSS CLASS(ES)(available in advanced toggle in sidebar) should be added to the container div
* Convert preset to css variable for padding
We are getting padding value in preset format like this:
"var:preset|spacing|50"
Therefore I added a function to convert it to CSS variable like this:
"var(--wp--preset--spacing--50)"
i.e. "var:preset|spacing|50" -> "var(--wp--preset--spacing--50)"
* Add reference for preset to css variable conversion logic
* Add support for “Popular Presets” for PQ block
This commits achieves the following:
* Adds a section in the inspector control called “Popular Presets”,
which contains a dropdown with popular presets.
* Adds support for the first preset: “Best selling products”.
By selecting this, users can sort products by total sales.
* Switches the order of the custom inspector controls and the default
Query Loop inspector controls: our controls will be now on top
as per the latest design spec (see pdnLyh-2By-p2).
* Restricts the allowed Query parameters to the sort orders we want to
allow according to the latest design spec (disabling title and date).
* Removes the core “Order By” dropdown.
* Refactor `setCustomQueryAttribute` to `setQueryAttribute` because
since a few iterations, our custom query attributes are not deeply nested
anymore, and this function can be used for the normal query too.
* Add back-end support for sorting by Best Selling via the Product Query block
* Adds the `popularity` value as an allowed value for `orderby` on
`product` REST API calls.
* Handles the query differently if the `orderby` value is one among the
custom ones.
* Add clearValidationErrors to validation data store actions
* Add reducer case for CLEAR_VALIDATION_ERRORS
* Add tests for CLEAR_VALIDATION_ERRORS
* Add documentation for clearValidationErrors
* Deprecate clearAllValidationErrors in actions.ts
* Remove CLEAR_VALIDATION_ERRORS action and reducer case
* Update reducer test for clearAllValidationErrors
* Make error message in test describe the test better
* Update reducer to handle CLEAR_VALIDATION_ERRORS with no error passed
* Update documentation for validation data store
* Remove unnecessary linebreaks in documentation
* Moved all payment utils functions in a utils folder
* Delete as it's not being used
* bot: update checkstyle.xml
* bot: update checkstyle.xml
* Fix TS error
* bot: update checkstyle.xml
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Fix typo in HTML markup of ProductImage block placeholder
Typo caused rendering of incorrect HTML attributes: width and height of Product Image placeholder that were anyway ignored by the browser
* Remove inline styles (width and height) from ImagePlaceholder in ProductElements > Image block
Inline height took precedence over the inherited styles which made the placeholder image skewed (in loading and loaded state). Removal of those styles allows the ImagePlaceholder to adapt the height to the available space keeping the ratio or inherit the styles from the parent
* Remove inline styles (width and height) from placeholder image in ProductImage.php block
Inline styles applied to the placeholder image of ProductImage block were overriden by other styles with higher specificity, which made them redundant. Additionally, corresponding styles were removed from the placeholder image from Editor code as they caused UI glitches. Additional proof that it's safe to remove them is in the first commit in this branch, the purpose of which was to fix those styles as there was a typo which corrupted them and eventually inline width and height were ignored by the browser and not applied to the element
* Add test to check placeholder image renders without width and height inline attributes
This is to prevent adding inline width and height attributes so the sizing of the placeholder image is controlled by the inherited styles or element styles, in the same way as a regular product image
* Fix TypeScript errors in the block test file of Product Image
* Add generic alt text to placeholder image
Alt text added in this commit is a generic text, not description of the actual image. That's because the image itself is set externally through the settings and may change over time
* Revert adding placeholder image alt text and add comments to make the empty alt explicit
After a Github discussion: https://github.com/woocommerce/woocommerce-blocks/pull/7651\#discussion_r1019560494 it was decided the placeholder should NOT have alt text as it serves the purpose of decorative image. According to the guidelines decorative images should not have alt text: https://www.w3.org/WAI/tutorials/images/decorative/. Comments were added also to other places where it happens
* bot: update checkstyle.xml
Co-authored-by: Karol Manijak <karolm@Karols-MacBook-Pro.local>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>