Commit Graph

1608 Commits

Author SHA1 Message Date
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
renovate[bot] d6779c4a8b Update dependency autoprefixer to v9.8.0 (https://github.com/woocommerce/woocommerce-blocks/pull/2511)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-20 14:41:55 +01:00
renovate[bot] 6fce572f3a Update dependency eslint-plugin-jest to v23.13.1 (https://github.com/woocommerce/woocommerce-blocks/pull/2512)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-20 14:41:36 +01:00
renovate[bot] dd18c75163 Update dependency @types/jest to v25.2.3 (https://github.com/woocommerce/woocommerce-blocks/pull/2509)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-20 14:29:11 +01: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
Darren Ethier 989ec4a673 Fix version for workflow 2020-05-18 16:12:19 -04:00
Darren Ethier 9c8059dfab Create project-management-automations.yml
Hook up the woocommerce project management automations with the todo automation.
2020-05-18 16:09:32 -04:00
Mike Jolley 13bf17559a Add 2.5.16 changelog 2020-05-18 18:10:35 +02:00
Albert Juhé Lluveras 89b94e7cf2 Bumping version strings to new version. 2020-05-18 17:21:41 +02: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
renovate[bot] 199231f94a Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/2501)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-18 11:06:17 +01: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 631a07dbf2 Add docs for CSS specificity (https://github.com/woocommerce/woocommerce-blocks/pull/2479)
* Add docs for CSS specificity

* Update docs/contributors/coding-guidelines.md

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

* Update docs/contributors/coding-guidelines.md

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

* Update docs/contributors/coding-guidelines.md

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

* Update docs/contributors/coding-guidelines.md

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

* Update docs/contributors/coding-guidelines.md

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

* Update docs/contributors/coding-guidelines.md

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

* Remove 'popular' from title

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-05-14 12:03:43 +02: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
renovate[bot] 9e4755ad04 Update dependency @octokit/graphql to v4.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/2472)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-13 15:24:14 +01:00
renovate[bot] 425b039dee Update dependency eslint-plugin-jest to v23.11.0 (https://github.com/woocommerce/woocommerce-blocks/pull/2476)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-13 15:23:51 +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
renovate[bot] 21fe9d05bc Update dependency @types/react to v16.9.35 (https://github.com/woocommerce/woocommerce-blocks/pull/2475)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-13 10:30:59 +01:00
renovate[bot] 0dff6c6b95 Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/2471)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-13 10:30:16 +01: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
Seghir Nadir 4cc81731fc Account for middlewares as effectful code (https://github.com/woocommerce/woocommerce-blocks/pull/2469) 2020-05-13 09:46:43 +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 22d8d02463 Avoid const and let in inline JS (https://github.com/woocommerce/woocommerce-blocks/pull/2464) 2020-05-12 15:17:45 +01: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
Darren Ethier 4ad741329b Fix saved payment method selection not working for purchases. (https://github.com/woocommerce/woocommerce-blocks/pull/2425)
* fix arguments

* only set payment status to pristine if it isn’t already successful

* add server side handling for saved tokens

* ensure correct gateway is selected when using saved card:
- reset the active payment method when user selects saved payment method
(card); this ensures that the correct gateway is used when switching
from another gateway to a saved card

* enhance radiocontrol to receive option specific change events.

* implement specific option change events

This commit:

- ensures selecting a saved payment option updates active payment method for the selected option.
- Sets the saved token key for the selected option correctly.

* remove unnecessary php side code

* fix bug with default saved payment option not applying:

When the payment options are initialised, we now call the onChange
handler for the default (`is_default`) option. This triggers payment
success() so checkout succeeds with default payment method, even if user
doesn't touch payment options.

* fix effect dependencies

Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
2020-05-11 09:29:57 -04:00
Seghir Nadir 39199778f8 fix broken cart styles in Editor (https://github.com/woocommerce/woocommerce-blocks/pull/2448)
* fix broken cart styles in Editor

* remove rule.
2020-05-11 13:12:47 +01:00
renovate[bot] f6ca3f30e4 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/2454)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-11 13:11:56 +01:00
Darren Ethier e7781ba407 Fixes regression with payment method validation (https://github.com/woocommerce/woocommerce-blocks/pull/2450)
* add typedefs for store notice context

* improve useStoreNotices hook so returned interfaces are fairly constant

* fix dependencies, defaults, and add types

* fix dependencies

* fix dependencies

* improve functions exposed on validation context so they are more constant

* fixing dependencies

* normalize tokenId to string everywhere

Assuming the token is a number is a bad idea because it is feasible that source for some payment methods could be a string. Also when retrieved as an input value, the id will be a string anyways.
2020-05-10 19:41:10 -04:00
Darren Ethier ea3d817db1 Fix multiple extra stripe createSource requests than necessary (https://github.com/woocommerce/woocommerce-blocks/pull/2444)
* refactor to move payment processing into it’s own effect

- this is the first step in trying to improve the createSource behaviour.

* memoize setValidationErrors so onPaymentProcessing event effect doesn’t re-run unnecessarily.

* Update assets/js/payment-method-extensions/payment-methods/stripe/credit-card/use-payment-processing.js

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

* fix docs alignment

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-05-08 11:32:20 -04:00
Mike Jolley 657e5005ff Fix X-WC-Store-API-Nonce updates (https://github.com/woocommerce/woocommerce-blocks/pull/2429)
* Move store api nonce js to separate middleware entry

* Make middleware a depedency of block-data

* Build
2020-05-08 10:39:03 -04:00
Brent Shepherd 976556748b Fix PayPay file name (https://github.com/woocommerce/woocommerce-blocks/pull/2443) 2020-05-08 12:42:58 +01:00