Commit Graph

778 Commits

Author SHA1 Message Date
Albert Juhé Lluveras 13e79f21b4 Fix product grid blocks markup & design inconsistencies (https://github.com/woocommerce/woocommerce-blocks/pull/2428)
* Fix Sale badge markup discrepancy. Fixes woocommerce/woocommerce-blocks#2107

* Fix product link markup discrepancy

* Use same class name for ratings markup in product grid blocks

* Remove editor specific class name for product title

* Unify price layout between product grid blocks and All Products block

* Change specificity raising classes to avoid editor class names

* Make small images fill the available width in product grid blocks

* Avoid increasing selector specificity in the frontend

* Undo AbstractProductGrid.php template changes

* Do not remove .wc-block-grid__product-rating__stars from CSS

* Add theming docs
2020-06-02 17:06:28 +02:00
Mike Jolley 28d516050e Add context support to Atomic Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/2592)
* Bulk rename InnerBlockConfiguration to InnerBlockLayout context

* Refactor button to use context and handle null product data

* Move preview data to context

* Update blocks to support context

* fix button

* Update assets/js/atomic/blocks/product/title/block.js

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* remove falsey check

* Update product retrieval code

* Update product prop usage

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-06-02 12:14:46 +01:00
Albert Juhé Lluveras a6da13920d Fix Cart sidebar styles after font size changes (https://github.com/woocommerce/woocommerce-blocks/pull/2593)
* Fix Cart sidebar styles after font size changes

* Margin/padding cleanup
2020-06-02 09:33:10 +02:00
Albert Juhé Lluveras 31b5f4e00c Fixes to Twenty Twenty product grid styles (https://github.com/woocommerce/woocommerce-blocks/pull/2573)
* Remove underline from discounted prices

* Fix position of on sale badge in Twenty Twenty

* Make sure we reset styles from Core

* Fix image on sale badge not correctly positioned

* Fix sale badge alignment when they are on in the right
2020-06-02 09:18:34 +02:00
Albert Juhé Lluveras 00b0a81874 Make filter font sizes named (https://github.com/woocommerce/woocommerce-blocks/pull/2594) 2020-06-01 06:45:40 +02:00
Mike Jolley 2361c5f52c Add "edit product" card to single product block sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/2585)
* Add edit product card

* Replace with div
2020-05-29 14:50:12 +01:00
Mike Jolley a5b09b7a43 Update atomic block structure (https://github.com/woocommerce/woocommerce-blocks/pull/2587)
* Move components to blocks dir

* Update import

* Create edit.js for each block

* Remove components/fix title

* Update imports

* Pass corect attributes on edit

* Import

* remove lightBlockWrapper
2020-05-29 14:49:56 +01:00
Mike Jolley 18480b0d68 Add layour editor to the single product block (https://github.com/woocommerce/woocommerce-blocks/pull/2586) 2020-05-29 12:28:04 +01:00
Albert Juhé Lluveras d1685bda7b Use named font sizes instead of values in px (https://github.com/woocommerce/woocommerce-blocks/pull/2533)
* Use named font sizes instead of values in px

* Convert rem mixin to em

* Remove unnecessary line-height

* 'Design' -> 'layout'

* Add comment to magic line-heihgt number

* Update a couple of class names to use BEM

* Use consistent name for SCSS variables

* Fix order summary line heights

* Update docs/contributors/coding-guidelines.md

Co-authored-by: Mike Jolley <mike.jolley@me.com>

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-05-29 12:16:33 +02:00
Mike Jolley 597c9ded72 Single Product Block Edit Mode (https://github.com/woocommerce/woocommerce-blocks/pull/2577)
* Previews

* Edit mode

* Remove preview alt text

* Remove unused styles
2020-05-28 12:41:10 +01:00
Albert Juhé Lluveras 0ba29d28d4 Update placeholder styles (https://github.com/woocommerce/woocommerce-blocks/pull/2456)
* Convert several default buttons to primary

* Align primary and tertiary buttons

* Align select controls of placeholders

* Don't force a placeholder background color

* Add border to placeholder lists

* Add work-around for SearchListComponent compatibility with last version of @wordpress/components
2020-05-28 12:20:47 +02:00
Mike Jolley 2dc0e8112a Create shared contexts handle for inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/2568)
* Create shared contexts

* At to jest config
2020-05-28 11:02:10 +01:00
Albert Juhé Lluveras bc51052b04 Checkout steps improvements (https://github.com/woocommerce/woocommerce-blocks/pull/2530)
* Don't render step heading content if there is no content

* Make checkout step headings h2

* Add empty alt value to form step counter
2020-05-27 16:48:23 +02:00
Mike Jolley a06aa1eb39 Create single product block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/2569)
* Create single product block placeholder

* test

* Placeholder frontend js

* Update imports

* Update src/BlockTypes/SingleProduct.php

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update src/BlockTypes/SingleProduct.php

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-05-27 15:45:18 +01:00
Mike Jolley b062a67faf Accept object parameters in renderFrontend util (https://github.com/woocommerce/woocommerce-blocks/pull/2567) 2020-05-27 11:11:30 +01:00
Darren Ethier a5b6061dcc Ensure all inline @todos in code are covered by issues and obsolete @todos removed. (https://github.com/woocommerce/woocommerce-blocks/pull/2557)
* Remove todos for colors (see woocommerce/woocommerce-blocks#1331)

* remove todo for payment method express payments placeholder

No placeholder is needed because we don’t want to show this at all if there are no payment methods setup (or initialized based on `canMakePayment`). The payment methods step will have instructions in the editor for users to setup their payment methods.

So this todo was invalid.

* Remove todo comment for useStoreOrder (see woocommerce/woocommerce-blocks#2555)

* remove obsolete todos for usePaymentMethodInterface

* changed todo into a Note for the useQueryState tests

With focused work happening on tests, this is better as a note that can be picked up when this file is touched again.

* remove obsolete todo from payment method registration validation

* remove todo covered by created issue (see woocommerce/woocommerce-blocks#2166)

* remove obsolete todo for stripe utils

* Convert todo to a Note for Checkout Block php registration

For now, I think having the comment block noting what is happening here is sufficient. Whether or not we extend the blocks to cover the other endpoints is something that will surface in future planning and putting in an issue right now coudl be premature (and likely just land the issue in the icebox)

* Remove todo related to ReserveStock covered by woocommerce/woocommerce-blocks#2556

* Remove todo in AbstractRoute covered by issue in WooCommerce project

see https://github.com/woocommerce/woocommerce/pull/26219 for the issue.

* Convert todo to note for wp_version check in Library class
2020-05-26 13:31:33 -04:00
Albert Juhé Lluveras 79359e7056 Fix Cart style discrepancies (editor-frontend) (https://github.com/woocommerce/woocommerce-blocks/pull/2486)
* Fix different heading size of Cart block between frontend and editor

* Increase Cart submit button specificity so styles are applied in the editor

* Ensure buttons don't inherit borders

* Simplify styles

* Create Title component

* Rename 'level' prop to 'headingLevel'
2020-05-25 18:45:38 +02:00
Darren Ethier ce1e334c56 Fix broken dynamic address fields dependent on locale for selected country. (https://github.com/woocommerce/woocommerce-blocks/pull/2547)
* add missing dependency

* Don’t include all defaultAddressFields in address field config
2020-05-25 07:00:26 -04:00
Darren Ethier a5bca5708c Reakit tab already handles selecting the default tab if it isn’t set. (https://github.com/woocommerce/woocommerce-blocks/pull/2545) 2020-05-22 15:32:41 -04:00
Darren Ethier 5668f58f2c Include `onSubmit` handler for CheckoutForm component. (https://github.com/woocommerce/woocommerce-blocks/pull/2532)
* include `onSubmit` handler for CheckoutForm component and implement

* remove redundant preventDefault
2020-05-22 10:51:38 -04:00
Albert Juhé Lluveras 6d1cb26d63 Import TwentyTwenty block styles from Core (https://github.com/woocommerce/woocommerce-blocks/pull/2513)
* Add TwentyTwenty styles from Core

* Increase product on sale selector specificity

* Add theme class name to admin

* Fix some more style discrepancies

* Use em instead of rem
2020-05-21 19:09:50 +02:00
Albert Juhé Lluveras a59966350d Align Product Categories List select and button (https://github.com/woocommerce/woocommerce-blocks/pull/2517) 2020-05-21 10:53:13 +02:00
Albert Juhé Lluveras 60c0ebfdb7 Fix misalignment between value and label in form components (https://github.com/woocommerce/woocommerce-blocks/pull/2518)
* Fix misalignment between value and label in form components

* Do the calculation in SCSS
2020-05-20 15:54:37 +02:00
Albert Juhé Lluveras 0dc7e9e6f1 Fix decimal ratings not correctly displayed (https://github.com/woocommerce/woocommerce-blocks/pull/2507)
* Fix decimal ratings not correctly displayed

* Fix aria label rounding ratings
2020-05-19 17:24:20 +02:00
Albert Juhé Lluveras 8f2003df4b Remove some unique font-size (https://github.com/woocommerce/woocommerce-blocks/pull/2498)
* Remove font-sizes which are already inherited

* Remove font sizes from buttons with no text

* Make summary item quantity font-size 12px
2020-05-19 08:06:35 -04:00
Albert Juhé Lluveras b18e2a7d0d Add notices docs (https://github.com/woocommerce/woocommerce-blocks/pull/2502)
* Query state docs fixes

* Add notices docs

* Improve format

* Typo

* Avoid repeating in each method that current context is used.
2020-05-19 07:40:48 -04:00
Albert Juhé Lluveras 1fea56d8cd Remove class 'button' from Button component (https://github.com/woocommerce/woocommerce-blocks/pull/2494) 2020-05-18 12:53:57 +02:00
Albert Juhé Lluveras d91de709df Remove ProductPreview component (https://github.com/woocommerce/woocommerce-blocks/pull/2499) 2020-05-18 11:20:00 +02:00
Seghir Nadir c48518de54 Use Reakit in payment tabs (https://github.com/woocommerce/woocommerce-blocks/pull/2371)
* WIP

* convert to reakit

* rebase and fix styling issues

* add forget initialTabName

* delete button and force manual select

* fix git diff problem in package-lock

* directly render tabs

* fix regression

* gaurd against unset values

* update reakit and guard against empty tabs
2020-05-15 14:55:17 -04:00
Darren Ethier 121cf0a893 swap rate pricing for preview data (https://github.com/woocommerce/woocommerce-blocks/pull/2496) 2020-05-15 11:07:24 -04:00
Darren Ethier 519ca4febd Fix Editor performance issues with checkout block. (https://github.com/woocommerce/woocommerce-blocks/pull/2495)
* add missing typedef

* make sure default shipping address is consistent with everywhere else

* fix test for new expectation
2020-05-15 08:48:45 -04:00
Albert Juhé Lluveras b59a6d56e3 Checkout block: fix error 'setIsSuppressed' in editor (https://github.com/woocommerce/woocommerce-blocks/pull/2492) 2020-05-15 07:09:36 -04:00
Darren Ethier e2d6e4a038 Fix shipping rate and address handling in Stripe payment request payment method. (https://github.com/woocommerce/woocommerce-blocks/pull/2484)
* fix dependencies

* refactor stripe payment-request to extract things into smaller units

- adds/fixes typedefs
- fixes dependencies
- improves logic.

* implement memoizing for functions.

* if same shipping address is selected, just call updateWith immediately

* add separate handler for failed shipping rate retrieval

* improve logic around shipping rate fail/success status

* add notice suppression logic to store notices.

- this is implemented in checkout processor to suppress notices when express payment methods are active.

* add error detection for shipping address errors and update the shipping status accordingly

* update type-def

* set billingData before shippingData

This is needed because of the shipping data and billing data sync logic in use-checkout-address.

* have to tighten dependencies to prevent unnecessary firing

With us now adding error status setters for shippping, the potential for the shipping status changes to trigger the effect went up. So tightening the dependencies to only the stati we care about prevent unnecessary effect calls.

* refactor event handlers to be named and remove all listeners.

This is an undocumented api on the stripe `paymentRequest.on` return value, but I’m trusting it will be relatively stable for this api.

The need for this is caused by the fact that without it, the listeners are re-registered on the paymentRequest event everytime the paymentRequest modal is closed and reopened.

* fix typo in doc block
2020-05-14 19:55:22 -04:00
Rua Haszard 89f843b2b7 respect stripe saved cards store setting (https://github.com/woocommerce/woocommerce-blocks/pull/2455)
* expose a allowSavedCards option to JS on stripe settings data

* hide 'save my card' checkbox if merchant disables saved cards

* use stripe allowSavedCards option to control "Save my card" checkbox

* (linter) remove unnecessary useEffect dependency:

- stripePromise const is defined outside component, so hook doesn't
depend on it

* clarify comment about saved cards and supports( tokenization )

* correct comment about save card merchant option - doesn't affect paying with previously saved payment methods

* use true boolean value for stripe allow saved cards setting:

previously was using woo option `yes no` style, other JS settings all use true bool

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>

* fix client side check now `allowSavedCards` is true boolean

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-05-15 11:35:17 +12:00
Mike Jolley e5c500c70d Only set to pristine when checkout is idle, not when idle status changes (https://github.com/woocommerce/woocommerce-blocks/pull/2485) 2020-05-14 18:18:18 -04:00
Albert Juhé Lluveras 11981947c5 Add CSS resets for better theme compatibility (https://github.com/woocommerce/woocommerce-blocks/pull/2478) 2020-05-14 11:07:21 +02:00
Darren Ethier a5a62359d7 Fix all shipping address changes in stripe payment request timing out with no rate update. (https://github.com/woocommerce/woocommerce-blocks/pull/2482)
* remove unnecessary shipping field and shipping fields setter

* remove a commented out block

* account for billingData having values but billingFields not when shipping address changes.
2020-05-13 20:05:09 -04:00
Mike Jolley 24035a1508 Update Stripe Method to display generic icon and text in label, with cards below (https://github.com/woocommerce/woocommerce-blocks/pull/2466)
* Support card alignment as a prop

* Add generic card icon to stripe

* Add icons to stripe content

* Update styles

* Label element with icon whitelist

* Update assets/js/base/components/payment-methods/payment-methods.js

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>

* Remove activePaymentMethod

* Remove spread operator

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-05-13 16:48:03 +01:00
Mike Jolley 2395137790 Ensure email and phone are persisted through `setBillingData` (https://github.com/woocommerce/woocommerce-blocks/pull/2477)
* Force inclusion of email and phone

* Update deps

* update deps
2020-05-13 15:39:26 +01:00
Darren Ethier 0f53b24f1a Fix regression for payment methods in incognito mode. (https://github.com/woocommerce/woocommerce-blocks/pull/2473)
* ensure we set initial tab if it’s not set

* set appropriate defaults for supports if we don’t have payment method configuration object yet.
2020-05-13 05:34:05 -04:00
Rua Haszard f822e8dbb5 Ensure order summary is displayed :) - (https://github.com/woocommerce/woocommerce-blocks/pull/2470)
correct logic for early bail while container width thing is setting up
2020-05-13 09:54:44 +12:00
Mike Jolley 9caf01c354 Update wp.editor references, bump min version support (https://github.com/woocommerce/woocommerce-blocks/pull/2434)
* Update wp.editor references to wp.blockEditor

* Bump min version requirment to 5.2

* Update packages

* Revert "Update packages"

This reverts commit 7565c83a14fe8efd2e7c52473eeeaa5f837fa9fb.

* Undo server side render import changes

* bump min wp version variable
2020-05-13 08:31:49 +12:00
Mike Jolley 9a7658179b Refactor `usePaymentMethodRegistration` to ensure payment methods are populated once initialization is true (https://github.com/woocommerce/woocommerce-blocks/pull/2467)
* Refactor usePaymentMethodRegistration so initialisation happens at same point as dispatch

* Update NoPaymentMethods conditonal

* Suggested changes to payment init
2020-05-12 12:40:08 -04:00
Rua Haszard fd91263986 Allow shopper to save Stripe payment method in user account for subsequent purchases (https://github.com/woocommerce/woocommerce-blocks/pull/2453)
* always default "save my card for next time" checkbox to unchecked:

This is based on the previous checkout behaviour.
I.e. the shopper has to actively opt-in to save their card.

* Implement "save payment method for next purchase" in checkout:

- send "save card" option using existing post key
  - wc-stripe-new-payment-method
- comment out inappropriate use of "save" when using a saved card (tbc)

* don't hard code the payment gateway name in 'save payment method' key

* refactor "save payment info" checkbox so payment methods can opt-in:

- Add options.allowSavePaymentToken to payment method
registration / config.
- Opt-in in Stripe CC, it allows saved cards.
- Remove render of "save my card" checkbox from Stripe CC UI component.
- Render "save my card" checkbox automatically in payment method tab
(based on allowSavePaymentToken option).
+ todo/follow up comments

* rejig "save my payment method" behaviour so it's generic:

- Any payment method that supports "save" can opt-in:
  - options.allowSavePaymentToken = true/false
  - handle `wc-XXX-new-payment-method` key server side to persist
- Add support in payment context/state reducer for storing checkbox
state, expose value and action via context
- Convert state flag to appropriate API key/value in payment processor
- Remove previous stripe-specific implementation
+ bonus add comment to payment context about preserving state in
PRISTINE action

* rename payment method "allow save" option, more consistent with UI

* remove last vestiges of gateway-specific "save card" impl:

- No need to pass CheckboxControl to payment methods; checkbox is
now handled automatically by checkout.
- Remove shouldSavePayment prop passing through various layers of
stripe payment processing code. (Now handled in context/processor.)

* change new option property name and shape. Also adds validation.

* update type-defs

* use more reliable `activePaymentMethod` for saved payment method

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-05-12 11:12:28 -04:00
Mike Jolley 73abba295e Use display table instead of flex in radio control group (https://github.com/woocommerce/woocommerce-blocks/pull/2461)
* Use display table instead of flex

* Target direct child span only
2020-05-12 15:17:02 +01:00
Albert Juhé Lluveras 53c64600a3 Remove Shipping totals editor.scss file (https://github.com/woocommerce/woocommerce-blocks/pull/2465) 2020-05-12 15:56:09 +02:00
Mike Jolley fae3028c8a Update labels to match frontend sorting dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/2462) 2020-05-12 11:05:38 +01:00
Darren Ethier 27508537f2 If product is changed for featured product block, update the link in the button. (https://github.com/woocommerce/woocommerce-blocks/pull/1894)
* If product is changed for featured product block, update the link in the button

* add handling to _only_ update the product url when the product is changed.
2020-05-12 05:08:53 -04:00
Albert Juhé Lluveras f09367b62f Add 'Handpicked Products' block keyword (https://github.com/woocommerce/woocommerce-blocks/pull/2463) 2020-05-12 10:47:57 +02:00
Mike Jolley 1d154364cb Introduce ContainerQueryContextProvider - hide order summary on mobile (https://github.com/woocommerce/woocommerce-blocks/pull/2432)
* Add ContainerQueryContextProvider

* Implement ContainerQueryContextProvider

* Rename based on feedback

* Update assets/js/type-defs/contexts.js

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/type-defs/contexts.js

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-05-11 17:07:22 +01:00