* Set max-height to avoid showing a big placeholder on longer titles
* Avoid showing placeholder when no there are no products
* Extract the placeholder to a separate component
* Adjust width
* Adjust border radius
* Pass the title to adjust the placeholder width/height
* Rename component
* Update filter by stock skeleton design
* Show skeleton only when is loading, otherwise it will show the loading state also after clicking on an option
* Add a static class name for the product details item instead of the translatable string
* Update Jest snapshot
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Add default page notice
* show notice all inner blocks
* support flow when page isnt saved
* switch from where we get the current post id
* update lock
* fix types
* update logic to support cart as well
* fix package.json
* update design and move away from wc.data
* restore notice
* handle older versions of WooCommerce
* fix package lock
* fix typo
* Reverse ordter of filter item name and close btn.
* Update layout & typography styles for block items
* Update chip ui view styles.
Additionally, add editor styles to have the editor match the rendered
frontend.
* Update additional remove button styles.
- Add hover state to remove button on chip layout.
- Update disabled styles to remove button in both layouts (mainly relevant
to the editor view).
* Adjust remove button colors.
Set hover states to shades of grey. Also set chip color and text to
match selected text color of the block.
* Update e2e test to account for new element order.
Since we're moving the remove button in the list view from the last
child node to the first child node, we need to adjust the expected order
of the active filter item text.
* Design and copy updates on the block settings
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Add and style Reset and Apply buttons
* Style the dropdown option
* Fix class and label
* Fix checkbox margin in editor
* Fix alignment
* Fix the reset button
* Disable Apply button when no changes have been made to the filter to improve UX
* Reduce vertical spacing between list items
* Style chips
* Don't reload on reset if filters have not been applied
* Fix heading styles on the front end
* Add chevron down to filter by attribute dropdown ui component
* Force FormTokenField to remount on reset
* Fix dropdown z-index
* Reduce apply button margin
* Fix styles for single token selection
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* Fix Product Query block hijacking all Query blocks queries
The Product Query block was adding a filter to Gutenberg's core
Query Loop block. When this filter was added once, it would from
then on apply to all other Query Loop blocks (or variations thereof)
on a page.
This change makes sure that:
1. No filters are added in the first place if our custom `__woocommerceVariationProps`
are not set.
2. The filter only gets run once.
* Update Filter by Stock controls and UI to include custom checkbox and settings.
* Include and style Filter by Stock reset button
* Make checkbox accessible via keyboard
* Update snapshot tests for Filter Products by Stock component
* Update E2E tests with new label value
* Update label test for Apply Filters in E2E tests
* Specify checkbox type so styles are not overridden in the editor
* Update E2E test label for filter button
* Update label selector to search for containing text rather than exact match
* Escape quotation marks for label query in E2E shopper tests for Filter by Stock
* Correct typo on Filter by Stock controls
* Replace custom checkbox with CheckboxControl component from the checkout package.
* Remove opacity on product count for checkbox label so its the same color as the label.
* Update snapshot tests with new component usage for filter by stock
* Update block title from Filter Products by Stock to Filter by Stock
* Update reset button behaviour to clear selections immediately regardless of whether the Apply Filters button is active or not.
* Pass option value as ID to satisfy E2E tests
* Update snapshot tests for stock filter
* Reset checked state on reset for when they have filters checked but not applied.
* Move `EditorBlock` to general `type-defs`
`EditorBlock` was scoped under the `featured-items` directory at the time of its creation. It is, however, a useful type that should be shared repo-wide. For this reason, I am moving it into the `blocks` type-defs and updating all the references.
* Define types for the Product Query block
Also defines a more generic `WooCommerceBlockVariation` type which should be also useful in the future to implement a similar pattern.
* Add Product Query utils
Add two utility functions:
1. `isWooQueryBlockVariation`: is used to check whether a given block is a variation of the core Query Loop block, and also one of the allowed variations within our repo. See: `QueryVariation` enum type.
2. `setCustomQueryAttribute`: is a shorthand to set an attribute within the variation query attribute.
* Refactor and cleanup the JS demo code
Specifically:
1. Creates a `constant.ts` file to store all shared constants. Currently, the default variation attributes.
2. Move the variations to their own directory. One file per variation.
3. Move the inspector controls into own file and create a conditional logic to allow showing only certain settings.
* Update webpack config
* Add ProductQuery class
* Fix `QueryVariation` enum
We had changed the Products on Sale variation slug to something else,
but we had forgotten to update the proper enum.
* Remove unused params from `update_query`
The filter we added to Gutenberg will pass the block and the page,
as we might need them in the future and we want to minimize the
amount of changes we'll have to do upstream.
However, we currently do not use those, so I removed
them from our own inner function.
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
* Add global styles to Product Categories List block in WC core (https://github.com/woocommerce/woocommerce-blocks/pull/6906)
* add side effect to package (https://github.com/woocommerce/woocommerce-blocks/pull/6904)
* Add _blank to terms link (https://github.com/woocommerce/woocommerce-blocks/pull/6908)
* Only show items if there are multiple packages in the cart (https://github.com/woocommerce/woocommerce-blocks/pull/6899)
* Price Filter Block Design update (https://github.com/woocommerce/woocommerce-blocks/pull/6877)
* make toggle control full width
* add inlineInput attribute
* add inlineInput sidebar setting
* add inlineInput help text
* style the filter button
* style price input
* wip: reset button
* clicking on reset button will reset the price query
* support inline input fields
* price text styling update
* fix reset button font size
* add loading placeholder to all elements
* fix filter button style
* update range slider thumb and track style
* fix loading placeholder for non empty query
* move reset button into FilterSubmitButton component
* try: render placeholder serverside
* update filter button label
* Revert "try: render placeholder serverside"
This reverts commit 98f08efdb8048b8f78c7476b774d1128c1d31295.
* remove LoadingPlaceholder component
* remove Price: prefix from the current displayed price range
* update labels
* extract reset button as a dedicated component
* update price text section
* update reset button behavior
* avoid breaking filter submit button style for other filter blocks
* rename block to Filter by Price
* fix e2e test
* remove border support
* adjust padding for elments
* rename panel title
* Make the inline option enabled by default and fix frontend rendering
* Make the `Price Range Selector` uppercase
* Show `Reset` button only when a selection has been made
* Revert the `save` change to avoid the 'Block Recovery Prompt'
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Release: 8.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6897)
* Empty commit for release pull request
* Bump version numbers and add changelog
* Add testing notes
* Add global styles to Product Categories List block in WC core
* add side effect to package
* Update testing instructions
* Empty commit
* Fix linting
* Update zip file with latest changes
* Fix linting
* Update changelog entries
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update version to 8.4.0-dev
* Empty commit for release pull request
* Add change log
* Add testing instructions
* Fix the version number in testing instructions
* Bumping version strings to new version.
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* make toggle control full width
* add inlineInput attribute
* add inlineInput sidebar setting
* add inlineInput help text
* style the filter button
* style price input
* wip: reset button
* clicking on reset button will reset the price query
* support inline input fields
* price text styling update
* fix reset button font size
* add loading placeholder to all elements
* fix filter button style
* update range slider thumb and track style
* fix loading placeholder for non empty query
* move reset button into FilterSubmitButton component
* try: render placeholder serverside
* update filter button label
* Revert "try: render placeholder serverside"
This reverts commit 98f08efdb8048b8f78c7476b774d1128c1d31295.
* remove LoadingPlaceholder component
* remove Price: prefix from the current displayed price range
* update labels
* extract reset button as a dedicated component
* update price text section
* update reset button behavior
* avoid breaking filter submit button style for other filter blocks
* rename block to Filter by Price
* fix e2e test
* remove border support
* adjust padding for elments
* rename panel title
* Make the inline option enabled by default and fix frontend rendering
* Make the `Price Range Selector` uppercase
* Show `Reset` button only when a selection has been made
* Revert the `save` change to avoid the 'Block Recovery Prompt'
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Remove all inbox notifications about cart and checkout blocks
* Remove feature flag check from CreateAccount class
* Remove feature plugin check to register PaymentsApi class
* Comment out is_feature_plugin_build function
We might need this later, so keeping it around seems useful.
* Remove feature plugin check when adding resource hints
* Import registerBlockType and use it over registerFeaturePLuginBlockType
* Ensure Cart and Checkout inner blocks register even if not feature plugin
* Comment out registerFeaturePluginBlockType
* Remove duplicate import
* Revert "Comment out registerFeaturePluginBlockType"
This reverts commit bec6ed899b68e26e836bde1c573d6066fb2bcc47.
* Align PHPDoc correctly
* Update feature flag doc to remove Cart and Checkout blocks + PaymentApi
* Add default page notice
* show notice all inner blocks
* support flow when page isnt saved
* switch from where we get the current post id
* update lock
* fix types
* Remove old compatibility notices from Cart and Checkout
* Move useCompatibilityNotice to sidebar-compatibility-notice directory
* Remove old CartCheckoutCompatibilityNotice
* Create sidebar compatibility notice hoc
* Add isCartOrCheckoutOrInnerBlock function
* Refactor defaultNotice to use new isCartOrCheckoutOrInnerBlock func
* Remove BlockSettings from checkout edit and export from checkout-shared
* Change so component still renders, it is just hidden with display: none
This is required because when it returns null the component gets skipped from being added to the Slot, then when it does return a component, then it gets rendered at the bottom of the Slot. By ensuring it always renders we can have it at the top all the time.
* Set the priorities of the hoc filters so compat notice renders first
* Make isCartOrCheckoutInnerBlock a hook
* Remove old compatibility notice related tests
* Remove BlockSettings from Cart
* Remove withDefaultNotice hoc
* Include DefaultNotice in compatibility notice
* Remove DefaultNotice from Checkout
* Rename withSidebarCompatibilityNotice to withSidebarNotices
This is because it includes the sidebar compatibility notice and the default notices
* Remove useIsCartOrCheckoutOrInnerBlock hook
* Remove compatibility notice code from tests
* Revert DefaultNotice back to the old one
* Remove unused components
* Remove withBlockSettings HOC and fix TS types
This is an abstraction that is no longer required, we can just include BlockSettings in the Cart and Checkout blocks
* Remove CartCheckoutFeedbackPrompt from BlockSettings
It will be included in sidebar-notices instead
* Fix TS Types in DefaultNotice
* Add BlockSettings to cart and checkout edit
* Editor: Add feedback box to the Cart & Checkout Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6881)
* Show "Feedback prompt" for all inner blocks
* Fix the "feedback" notice position for these blocks
The "checkout fields", "checkout billing address" and
"checkout shipping address" have the addressFields option which
gets rerendered and placed at the bottom of the inspector controls.
* Tidy up the address-fields hoc
* Use correct block name to check for billing or shipping address
* Revert "Editor: Add feedback box to the Cart & Checkout Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6881)"
This reverts commit 5f3d6cf15ce08d9c303e62ec3e0d0315ead1281f.
* Add hack to get feedback prompt to render last
* Fix TS errors for context and attributes
* Include CartCheckoutFeedbackPrompt in accountcontrols & addresscontrols
* Do not include feedback prompt if on an address block or contact info
* Remove unused hoc for address fields
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* POC about registering patterns
* POC load patterns from `/patterns` folder
* Change class name and remove unnecessary comment
* Add all four blocks to the filters pattern
* Add all 4 blocks to the block type to allow for transformations
* Add internal
* Improve filters name
* Extract regex to constants
* Add class description
* Rename and move class
* Fix wrong imports
* Address feedback
* Early return from condition
* Fix wrong block type
* Add a new structure and clearer steps for the WC Core PR release steps
* Apply suggestions from code review
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update .github/patch-initial-checklist.md
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Copy style-attributes file to desired directory.
Add a copy of the style-attributes file in blocks/hooks to the desired
base/hooks directory with the other hooks.
* Remove relative imports in favor of global aliases
Utilizes the custom global project aliases in place of using relative
imports.
Note: seeing some linting issues with the aliases. This seems to be the
case elsewhere so it is likely not a blocker for this effort, however,
it may be worth looking into as a follow-up.
* Adjust all imports to use @woocommerce/base-hooks.
Replace all instances of relative file paths to hooks/style-attributes
to use the custom global alias.
* Remove the hooks dir in `assets/js/blocks/`.
Now that everything is using the `@woocommerce/base-hooks` custom global
alias and we have the `style-attributes` hooks file in the base/hooks
directory, we no longer need the `style-attributes` hooks file in the
aforementioned `assets/js/blocks` directory.
* Split style-attributes.ts out into separate files.
Moved the four hooks in style-attributes.ts out into their own, separate
hook file to be consistent with the rest of our custom hooks.
Additionally, moved the helper function (parseStyle) out into a separate
export in base/utils.
* Add font-weight option to Mini Cart button text.
Need to repeat steps for icon SVG and cart item count.
* Add font-weight controls to mini-cart item count.
* Add better error handling to PHP style output.
Ensure style value is set for style item in the
get_font_weight_class_and_style attributes array before rendering it to
the output.
* Revert font-weight option for quantity badge.
Per conversation with @vivialice, it looks better for now to keep the
font weight adjustment capabilities to just the price and leave the cart
icon and count as-is.
* Move $typography_styles variable into markup fn.
To resolve merge conflicts and get everything in it's proper place, this
commit will move the $typography_styles variable into the
get_cart_price_markup() function from woocommerce/woocommerce-blocks#6796.
* Empty commit for release pull request
* Update 8.2.1 changelog
* Ensure onChange is set for radio buttons in SavedPaymentMethodOptions (https://github.com/woocommerce/woocommerce-blocks/pull/6825)
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add 8.2.1 testing steps
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Empty commit for release pull request
* Update 8.2.0 changelog
* Add 8.2.0 testing steps
* Fix typo in 8.2.0 testing steps
* Ensure package names display correctly if only one item is in package (https://github.com/woocommerce/woocommerce-blocks/pull/6815)
* Check package length >= 1 to show package name
* Check shipping rates length in order shipping packages slot
* Fix TS error where boolean value could be undefined
* Show items if there is more than one shipping rate
* Update 8.2.0 testing zip
* Bumping version strings to new version.
* Remove empty element from changelog
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add toggle control to sidebar in editor.
Adds a visibility toggle in the Mini Cart block's sidebar editor
settings for the block price.
* Update name of hasVisiblePrice attrubite.
Adjusts the name of the hasVisiblePrice attribute to hasHiddenPrice.
This seems a bit easier to reason about, where we can set the default
state of the visibility toggle to 'off'.
* Add conditional price rendering to server side.
Since this is a dynamic block, need to add the condidional attribute
state to the server-side render callback.
* Add price visibility setting to block frontend.
We need to prevent pricec from rendering when hidden setting is active
after the JS kicks in on the frontend (i.e., when the Mini Cart is
interacted with by the user).
* Fix logic error in frontend rendering conditional.
* Add unit tests for both show/hide price states.
* Check package length >= 1 to show package name
* Check shipping rates length in order shipping packages slot
* Fix TS error where boolean value could be undefined
* Show items if there is more than one shipping rate
* Check package length >= 1 to show package name
* Check shipping rates length in order shipping packages slot
* Fix TS error where boolean value could be undefined
* Show items if there is more than one shipping rate
* Try registering the "cart taxes" inner block
Registering server side. This example isn't working, but I'm pushing to
share it and see what's wrong with this implementation.
* Fix registering the cart taxes inner block issue
* Update translation script loading
* Remove unnecessary JS translation
The translation should work fine by getting the title & description from
the `block.json` file
* Put back the initial code in the 'Cart Taxes' inner block
We didn't provide the correct `block.json` file path server side,
that's why the `metadata` wasn't correctly registered
* Generate `block.json`files for inner blocks
This is the first step on fixing the missing translations of `metadata`
in `block.json` files
* Set the folder name exactly the same as the inner block name
We are doing this first test for the `Cart taxes` inner block.
The `Block` & its containing folder need to have the same name for:
- Consistency
- We use the `Block` name to get the file Path
* Update imports after folder renaming
* Get block name directly from the JSON metadata
Getting the block name from the JSON metadata is less error prone than
extracting it from the file path.
And no need to rename all our `inner-blocks` to get the correct
`block.json` path
* Revert folder naming change of `Cart taxes` inner block
Since we are getting the `block` name directly from the `block.json`
metadata instead of extracting it from the file path, there is no need
to keep their names in sync anymore
* Fix missing translations for the `Cart Subtotal` Block
* Register only the client-side settings on the client
When the block is registered on the server, you only need to register
the client-side settings on the client using the same block’s name.
See [docs](https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#javascript-client-side).
* Add schema validation to `block.json`
Development is improved by using a defined schema definition file.
Supported editors can provide help like tooltips, autocomplete, and
schema validation.
* Use the same `editor_script` as the parent block
This prevents WordPress from generating script tags to inexistant
inner blocks JS files
* Add C&C inner blocks in Cart.php & Checkout.php
This is a refactoring to keep the block types controller file less
overloaded
* Fix all Cart inner blocks missing translations
* Create the "AbstractInnerBlock" class
The "Inner Blocks" will use their parent's script, so no need to create
new scripts for each one of them
And, our "Inner Blocks" should always be registered using the metadata file
* Update the "Inner Blocks" PHP classes
* Fix PHP lint erros & update function description
* Fix missing translations bug for all Checkout Inner Blocks
* Update src/BlockTypes/Checkout.php
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* skip lazy loaded scripts
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add new icon for mini cart block (inserter).
See https://github.com/woocommerce/woocommerce-blocks/issues/6617.
* Adjust size of SVG
The new SVG was rendering a little bit smaller than the original icon.
Potentially because of the mask and the artboard size.
This commit adjusts the size to render at the same size as the original
version of the icon in the inserter.