* make active filters block work with PHP templates
* use getSettingWithCoercion
* redirect to the base url when clicking Clear All link
* fix: eslint error and warning
* Move redirect logic to its own callback
* Update comment for updateAttributeFilter
* Remove condition for updating state for active filters only when filter button is not available
* Replace onSubmit with updateAttributeFilter
* Update logic lost in merge
* Replace checked stateful data with activeFilters data from URL
* Remove catalog_visibility from filteredCounts useCollectionData query for PHP templates
* Set the min and max price from the URL to make the active filters work with PHP templates
* Extract price formatting into a separate function
* Rename the `hasSetPriceDefault` variable and improve comments
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
* Enable Attribute Filter block to work with the PHP rendered Classic Template block
* Check for presence of option before rendering it
* improve filter product by attribute
* fix pagination problem
* fix check when two filter block with same attribute are used
* fix filter by stock for PHP templates
* fix naming and comment
* Update filter key in ClassicTemplate
* Update stock filter block for PHP templates when the filter button is enabled
* Remove unused useEffect and fix ESLint error
* Set active stock filter and track using local state
* ESLint fix
* Remove unncessary dependencies from useEffect
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* Enable more options for the Featured Category block
* Fix the focal point picker
* Fix the resizeable handle
* Fix the overlay and move to own section
* Enable gradient and duotone
* Add padding and fix min height
* Export ConstrainedResizeable from Featured Product
* Wrap duotone in feature plugin flag
* Add support for `border-radius`
* Change prop order
* Add SSR for new options on Featured Category block
* Optional chaining on border radius
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
* Add default to overlay and height
* Optional chaining on border radius for Featured Product block
* Fix gradient persistence and default overlay discrepacies
* Explicitly add box-sizing to the featured-product/category wrapper
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
* Add correct context to checkout and cart errors from API
* Correct typo in add-to-cart context
* Add correct context in add to cart form
* Add correct context in add to cart form
* Add correct context in Checkout State
* Enable Attribute Filter block to work with the PHP rendered Classic Template block
* Check for presence of option before rendering it
* improve filter product by attribute
* fix pagination problem
* fix check when two filter block with same attribute are used
Co-authored-by: Luigi <gigitux@gmail.com>
* Add support for overlay color and duotone
* Add support for custom inner padding
* Wrap all block experimental features in `isFeaturePluginBuild`
* Fix resizable container min height
The container now resizes if, e.g., padding is increased, and can't be resized down
with the handle to a height lower than it's minimum size determined by content and
padding box.
* Fix resizable handle not being fully visible
Previously, `overflow: hidden` was needed because the height constraint and
padding could push the content out of the container. Now this should not be
possible.
* Add an option to the block to decide how is the image fitted to the container
* Register missing C & C inner blocks and update fallback template for older C & C versions
This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.
* Revert changes to Checkout.php, we don't need to test for inner blocks
* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"
This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.
* Fix the returned template for older Checkout block iterations
* Fix Cart and Checkout templates to accommodate the Summary order inner blocks
* Hide coupon form div from inner blocks if coubons are not enabled
* Fix checkout coupon tests in checkout
They have been written for logged in user
* Fix Order Summary Heading inner block's default text
* Update comments with better wording
* Revert "Hide coupon form div from inner blocks if coubons are not enabled"
This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.
* Remove the ToggleButtonControl in favor of ToggleGroupControl
* Remove ESLint errors. Use experimental feature as this is low risk
* Fix the 'Expected preceding comment block' ESLint error
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Make useStoreNotices interact directly with the store
* Get/set error notices directly in store in paymentMethodDataContext
* Add hasNoticesOfType util
* Remove useStoreNotices and interact directly with data store
* Create/remove notices directly in store
* Remove tests for useStoreNotices
* Add tests for notices util
* Use setIsSuppressed from useStoreNoticesContext
* remove useStoreNotices hook
* Update context typedef to define only isSuppressed and setIsSuppressed
* Remove all values from StoreNoticesContext besides setIsSuppressed
* Wrap Cart and Checkout blocks in StoreNoticesProvider (for isSuppressed)
* Make StoreNoticesContainer a named export
This is required so we can import it from @wooommerce/base-context
* Change addErrorNotice to createErrorNotice to match store action
* Remove unnecessary StoreNoticeProviders and pass only context to container
* Accept a context in StoreNoticesContainer
* Pass relevant context to StoreNoticesContainer
* Add function to remove notices by status
* Prevent checkout from breaking when removing notices during processing
* Prevent TS error about not included path
* Add StoreNoticesContainer to single product block
* Add StoreNoticesContainer to All Products Block
* Ensure errors are shown when using All Products & Single Product Blocks
* Add a context arg to removeNoticesByStatus
* Use correct contexts for all products and single product block
* Update tests to reflect new context argument
* Re-add missing block file for order-summary
* Remove block file for order-summary
* Send context to useStoreCartCoupons to show errors correctly
* Rename `Product Title` `Content` panel to `Link settings`
* Rename toggle `Link to Product Page` to `Make title a link`
* Remove help text
* Add `rel` and `linkTarget` to the `Product Title` settings
* Add `rel` and `linkTarget` to the `Product Title` block
* Only add the `target` attribute if the title is rendered as a link
* Keep the `nofollow` in rel as it was before
* Make `linkTarget` and `rel` optional
To not change the html generated for other components also using `ProductName`
* Add tests fotr the `Title` component
* Improve rel condition
* Extract `linkRel` variable
* Remove unnecessary undefined
* Remove the default value for `linkTarget`
Since it is the default behavior of the browsers, we don't need it.
* Remove the `nofollow` rel value
It was decided to remove it since it's a link to internal pages.
See the PR discussion for more context.
* Remove the `rel` option
It does not have much sense to have it since it's always an internal link.
See the PR discussion for more context.
* Clean-up `rel` related code
* Sub/Total/Fee inner blocks
* Row blocks within the inner block
* Update icons
* Resolve stying issues
* Remove old block
* Pin totals row
* Locking logic update
* Heading inner block
* Refactor where inner blocks are defined
* Add todos
* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.
* Improve frontend registration of components using new entrypoint
* Experiment- external block context
* Revert "Experiment- external block context"
This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.
* Duplicate inner blocks to avoid conflicts with context
* Remove todo
* Rename block dir
* Some test fixes
* Fix import
* fix import
* linting
* Remove unused attributes
* Optional classname
* fix coupons import
* fix shipping mocks
* Styling
* Fix selectors in e2e tests
* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary
Because, removing them was:
- a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency
* Reuse the TotalsWrapper component for C& C blocks inner blocks
This component was removed in this PR, but we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Prevent accessing the first element of the `parentProduct` array if empty
* Include all products regardless of their `stock_status`
By default, the `/wc/store/v1/products` endpoint does not return products with
`outofstock` stock status. We want the users to be able to select any product
regardless of its stock status, we need to explicitly request them using the
`stock_status` query param.
* Use the optional chaining operator
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
* upgrade wordpress/scripts to 22.3
* update jest config/setup
* add explicit-exports-references plugin
to handle payment-method-config.tsx spying on external methods
the way code is output now changed and tests like this would not
work anymore as transpilet files were no longer using exports but
local references to methods.
* missing snapshot
* make cart-products E2E test more stable
* surppress eslint error in test file
* fix css stylelint issues
* update eslint-plugin-woocommerce eslint package
* remove temp test:e2e:start script
* re-run
* add stylelint as recommended extension
* remove redundant types (provided by packages now)
* patch update @testing-library/jest-dom
* Filter Products by Attribute: Fix dropdown search case sensitivity handling
* Refactor the dropdown search logic and add an isCaseSensitive option
* Dropdown search: Match against the name rather than value
* Clean up and refactor the search dropdown code
* Create the CurrencyCode and use it for the currency `code` instead of the type `string`
Using the CurrencyCode type, the allowed values for the `code` property are restricted
to the ISO 4217 codes and not any string.
* Add and remove some currency codes to match the ones on WooCommerce
The WooCommerce supported list can be found here: https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/wc-core-functions.php#L475
* Use CurrencyCode type on CurrencyInfo and CurrencyResponse instead of string
The internal ID has been kept after a comment by @tjcafferkey. This causes a
bit of inconsistency in the internal code, but it was deemed that it would have
been better as users who have customized templates using this
blocks ID will have saved this in their database, and it would result
in a corrupt block when loaded, and we didn't want to support both IDs at the
moment.
Otherwise, most other references to the legacy template, are now using the word
“classic”.
Co-authored-by: Alba Rincón <alba@albasauatticmbp.home>
* Make shipping address field optional on checkout routes
* Make update_customer_from_request use billing for shipping if omitted
* making shipping optional when needed
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Change `shippingRatesLoading` to `isLoadingRates`
* Revert isLoadingRates back to old name in payment method interface
* Update docs with correct names returned by usePaymentMethodInterface
* Update TS to name the selectShippingRate method correctly
* Change method name on usePaymentMethodInterface back
* Product Ratings: Add font size and spacing support
* Fix useTypographyProps hook
* Set SkipSerialization for Ratings block props
* Add additional hasSpacingStyleSupport check for the spacing
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
* Remove X- Prefixes from custom headers
* Fix docs
* Handle deprecated X-WC-Store-API-Nonce header if received
* Send old nonce until future version removes this
* Add todo and cut off date
* wc_deprecated_argument
* Update todo name
* typo
* Back compat in batch
* Flip Nonce logic to make it easier to support both in client bw compat logic
* Remove not used attributes woocommerce/woocommerce-blocks#5952
remove not used attributes
* remove not necessary jsdoc comments
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
* Remove expected warnings from test suite
* Switch dispatch and select usage to `controls`, from `@wordpress/data`
* Wrap render with act
* resolveSelect to wait for resolution
* resolveSelect
* Change atomic blocks to not use custom webpack build paths
we want to always load lazy loaded components from their default paths
to avoid having to handle importing components in different ways for
regular and atomic component packages
* Add footer parts to test themes
The Site Editor is expecting the footer parts to be there or it will try to
load them anyways and throw a 404. It's not breaking, but it's polluting
the console.
* Use REST API to tear down the templates
Previously, we used a util called `trashAllPosts` which navigated to the post UI
and deleted all the posts to tear down any side-effects of template editing tests.
However, with a [recent change](14e20f72b5),
WP Core removed the UI for those and that made our tests meet a 500 error.
Using the REST API should also make everything faster.
* Remove deprecated pupeteer waitFor usage
was still present in attribute-filter.test.js
* Update package-lock.json
* pin package versions
* Unify all atomic blocks to register on php side
* Remove Atomic Blcoks chunk_translation handling from AllBlocks
Before it was responsible for enabling translations for all the atomic blocks
* Add per atomic block chunk_translation registration
* update @wordpress/e2e-test-utils to 6.0.2
* add optional puppeteer
* pin workflows node version to 16.13.2
* upgrade package-lock
* upgrade package-lock
* set react and react-dom as peerDeps
* remove atomic block registration
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Luigi <gigitux@gmail.com>
* Tax is displayed correctly e2e test
* Add extra utils to shopper
* add single e2e test script oin package.json
* Feedback changes from Niels
* Test tax is correct on summary page
* Check if CI test passes
* Longer timeout for tax test
* change timeout in jest config
* increate jest timeout
* Test
* Test
* Test
* setTimeout outside of tests to 120000
* Address raluca's feedback and timeout everywheregaa
* Increase timeout on for search box
* set jest timeout to 120000
* Raluca's suggestions
* Debug
* Increase search timeout to 5000
* Only run Tax e2e tests in CI for quicker debug - REMOVE THIS
* use waitforSelector
* 30s delay for toMatchElement
* Let'shope this works
* Remove toMatchElement
* waitForSelector
* Run debug test only
* Debug tax test
* debug taxes
* shopper using toMatchElement again
* Remove the 30000 timeout delay from toMatchElement
* Run all tests but only once
* Remove tax test
* Revert "Remove tax test"
This reverts commit 7db34120e1e91f4fd26514fdb9525cac2a6066bb.
* Delete the minicart test
* Revert "Revert "Remove tax test""
This reverts commit 31dd654e52f37fcd02ccd25336958248bef495c6.
* Revert "Delete the minicart test"
This reverts commit 5595f0834a975d097a300bc0c7cbf643caa8b764.
* tax test
* block addToCart
* Put back block functions
* Refactor block.addToCart
* mini-cart e2e test uses shopper.block.emptyCart()
* only run shopper tests in CI
* Run frontend and shopper tests and change waitFor -> waitForTimeout
* Run frontend tests in CI
* Run CI e2e tests again
* Skip legacy template blocks
* Skip legacy template test but run all others
* Switch to storefront instead of twentytwentyone after legacy-template-blocks tests finish
* Tidy up
* fix typo
* Fix ESLint issue
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* Add feature gate for the global styles for Product Sale Badge block woocommerce/woocommerce-blocks#6007
Add feature gate for the global styles for Product Sale Badge block
* add a check for the spacing support
* Add address-related items to wc/store/cart data store
* Add useUpdateCustomerData hook
This allows us to have a single hook responsible for updating the customer information on the server.
* Add useUpdateCustomerData hook in Checkout block
* Remove shippingAsBilling from previousCustomerData ref type
* Add useShippingAsBillingCheckbox hook
* Remove checkbox handling from useCheckoutAddress
* Merge with woocommerce/woocommerce-blocks#5810 changes
* Move shipping as billing to checkout state context provider
* Subscribe to changes
* Cache customerDataToUpdate
* Combine customerDataType and customerDataContextType
* Fix notice context
* Clean up inline docs for push changes
* Add useShippingData hook
* Add shipping related selectors to cart store
* Update useShippingDataContext to useCustomerData hook
* Update uses of useShippingDataContext to get data from hook instead
* Remove rogue linebreak
* Re-add linebreak
* Re-add linebreak, remove shippingAsBilling
* Re-add linebreak
* Use useShippingData and useCustomerData instead of context
* Fix fromEntriesPolyfill to use number or undefined as an index option
* Convert derive-selected-shipping-rates to TS
* Add SelectShippingRateType
* Get needsShipping from new hook and not context
* Get address data from useCustomerData instead of useShippingDataContext
* Move selectedRates, selectShippingRate and isSelectingRate
* Remove items from ShippingDatacontext that are available in data stores
* Get shipping data from stores, not context in payment method interface
* Consider shipping rates to be loading if customer data is updating
* Get rates from useShippingData hook instead of context
* Fix incorrect TypeScript types and incorrectly named destructure
* Move useShippingData into shipping folder
* Update tests to mock useShippingData instead of context
* Remove empty string fallback from shipping phone
* Get types from Cart declaration instead of Picking them
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* templates README and block-template-controller README
* Add execution scenario to block template controller readme
* Amend return value to block template controller readme
* Add source file link to block template controller docs
* LegacyTemplate.php overview
* Legacy Template JavaScript block README
* Update requirements of templates feature
* Doc updates based on feedback, and change Legacy Template references to Classic Template in anticipation of naming convention updates
* Update classic-template.md README
* Reword part of the add_block_templates section
* Update assets/js/blocks/legacy-template/README.md
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Update docs/readme.md
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Update docs/templates/README.md
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Update docs/templates/README.md
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Update README for blocktemplatecontroller
* Review feedback for Woo FSE technical documentation
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Add margin support on the Product Image block woocommerce/woocommerce-blocks#5671
Add margin support on the Product Image block
* fix tests
* more specific selector
* update mixin
* Add Global Styles support to product price block
- This comes sat a cost of losing control over regular vs sale price
- This includes refactor of attribute from align to textAlign
which is a reserved supports feature attribute and textAlign is
used across the Gutenberg project
* Add experimentalSelector and register as PHP block
This is required to make the GlobalStyles work inside of
the InnerContent block. Ie. All Products block.
* move sharedConfig supports outside of isFeaturePluginBuild check
* restore regularPriceClassName
* remove douplicated block registration on php side
* Add Global Styles support for the Add To Cart Button block woocommerce/woocommerce-blocks#5666
Add Global Styles support for the Add To Cart Button block
* remove support to font size
* try: fix the style override issue for add to cart button (https://github.com/woocommerce/woocommerce-blocks/pull/5843)
* restore typography support
* fix font weight
* add support for font weight
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* adds toolbar option to remove custom image
removing custom image will reset it back to the default
product image if available
* update copy as per discussion
went with just Reset as it is commonly used in WordPress
and will have translation available
* Add address-related items to wc/store/cart data store
* include shippingAsBilling in return value of useCustomerData
* Add useUpdateCustomerData hook
This allows us to have a single hook responsible for updating the customer information on the server.
* Add useUpdateCustomerData hook in Checkout block
* Remove the updating customer data work from the useCustomerData hook
* Remove shippingAsBilling from previousCustomerData ref type
* Add useShippingAsBillingCheckbox hook
* Control shippingAsBilling from single hook
* Remove checkbox handling from useCheckoutAddress
* Remove CustomerDataContext typedef
* Merge with woocommerce/woocommerce-blocks#5810 changes
* Move shipping as billing to checkout state context provider
* Unused import
* Subscribe to changes
* Only receiveCartContents when updating customer data via checkout
* Cache customerDataToUpdate
* rename debounced function
* Combine customerDataType and customerDataContextType
* Change case of CustomerDataType
* debouncedUpdateCustomerData typo
* Fix notice context
* Clean up inline docs for push changes
* Comment on dirty state
* Phone is always set
* shippingAddress is never undefined
* setBillingPhone
* receiveCartContents explanation
* Tweak customerData to avoid null
* useShippingAsBilling
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* fix Global Styles for Product Image, Product Category List and Product Tag List blocks
fix Global Styles for Product Image, Product Category List and Product Tag List blocks
* Block style font-size was applying wrong value for fontSize
* Add missing __experimentalSkipSerialization to Category List
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
* Pass context information about containing block to the existing Slots
* Fix images added to the Slots docs
* Use the parent's block name for the context prop passed to Slot fills
* Add wc-block-mini-cart__contents class for the Mini Cart block woocommerce/woocommerce-blocks#5418
Add wc-block-mini-cart__contents class for the Mini Cart block
* removed comment
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* Rating Product block: add support for global style woocommerce/woocommerce-blocks#4965
Rating Product block: add support for global style
* add feature flag
* fix import after merge
* fix global style css generation
* restore css for classic product rating html element
* don't apply the global style to PHP blocks
* remove registration
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* move hooks in a specific folder
* Tag List block: add support for global style woocommerce/woocommerce-blocks#4965
Tag List Block: add support for global style
* add feature flag
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* Enable global style for category list block woocommerce/woocommerce-blocks#4965
Enable global style for category list block
* fix import after merge
* add save function
* add feature flag
* Convert radio component to TS and support uncontrolled components
* Further radio control to typescript changes
* Combine useSelectShippingRate and useSelectShippingRates
* Remove useSelectShippingRate hook
* Move local radio checked state to PackageRates
* This is a Controlled component - update inline docs
* useSelectShippingRates -> useSelectShippingRate rename