Commit Graph

4 Commits

Author SHA1 Message Date
Saad Tarhi 230606c7f7 Highlight incompatible payment gateways (https://github.com/woocommerce/woocommerce-blocks/pull/7412)
* 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>
2022-12-28 17:30:46 +01:00
Saad Tarhi 5129341ee5 Show sidebar notices only when a WooCommerce block is selected (https://github.com/woocommerce/woocommerce-blocks/pull/7435)
We where running the "withSidebarNotices" HOC each time the
"editor.BlockEdit" hook is fired. The problem is that this hook is
fired on page editor scroll, when hovering over the blocks, when a
block preview is loading, etc.

So, we only want the "withSidebarNotices" HOC to be executed when a Woo
Block in selected!
2022-10-20 20:17:26 +01:00
Seghir Nadir 42f3ffefc9 Turn current page into the default Cart/Checkout page (https://github.com/woocommerce/woocommerce-blocks/pull/6867)
* 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
2022-08-29 09:35:05 +01:00
Thomas Roberts d45ef84219 Add dismissible compatibility notice to sidebar when editing Cart and Checkout (https://github.com/woocommerce/woocommerce-blocks/pull/6869)
* 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>
2022-08-12 15:23:08 +01:00