Commit Graph

2233 Commits

Author SHA1 Message Date
Mike Jolley cf9dc1b6bf Fix Twenty Twenty One Button and Placeholder Styling (https://github.com/woocommerce/woocommerce-blocks/pull/3443)
* Reset product list padding

* Adjust placeholder color if css variable exists

This is 2021 specific but may become more prominant.

* FIx editor button styles in 2021

* Adjust button sizes based on columns

* Adjust padding
2020-11-23 14:21:36 -05:00
Albert Juhé Lluveras 5a38fca235 Fix Twenty Twenty One Price filter, Active filters and radio control styling (https://github.com/woocommerce/woocommerce-blocks/pull/3444)
* Fix price slider styling in Twenty Twenty One

* Fix price slider styling in Twenty Twenty One

* Fix radio control styling in Twenty Twenty One and remove usage of mixin

* Force 0 padding on active filters list
2020-11-23 17:30:27 +01:00
opr a7461de3b3 Hide spinner on cart block's "Proceed to Checkout" link when page unloads (https://github.com/woocommerce/woocommerce-blocks/pull/3436)
* Hide spinner on cart's "proceed to checkout" button when page unloads

This is required because of a feature of Safari where the page state is saved, including all class names, when a transition occurs. Navigating using the back button restores the page to that cached state, so the spinner class remains on the button. Resetting the state just before the page gets cached stops this from happening.

* Change comment case to sentence case.
2020-11-23 13:20:04 +00:00
opr fcfe5ee7dc Stop hidden products from being linked in cart and checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/3415)
* Add catalog_visibility to CartItemSchema.php

This is used to get whether the product is visible in the catalogue, visible in the shop only, visible in search results only, or visible everywhere. We need to know this so we can pass it to the ProductImage and ProductName components.

* Remove links from CartLineItemRow if not visible in catalogue

Added catalog_visibility to lineItems prop, and when the product is not visible in the catalogue do not wrap product image in a link. Also pass down the hasLink prop to ProductName.

* Add hasLink prop to ProductName

When this prop is false we should not output the link around the product name. This is for when the product is hidden from the catalogue but we still want to show its name somewhere.

* Add tests and storybook for ProductName

* Add catalog_visibility check to OrderSummaryItem

When the catalogue visibility of a product is set to hidden or search, then the product name in the checkout sidebar should not be hyperlinked.

* Reverse logic for hiding link on product image & disabling link on name

Following a point from @budzanowski we do not need the hasLink prop, making use of disabled is probably a better idea.

* Remove tabindex from a in ProductName & output span if name is disabled

This change removes the need to pass a tabindex to the a in ProductName. This is because a disabled ProductName will now never output an a tag. When the ProductName is disabled a span is output instead, which has no tabindex by default.

This change also reverses the logic to decide whether the a or span should be output so as to make the code more readable and flow better.

* Update storybook and tests/snapshots for ProductName
2020-11-23 13:03:08 +00:00
renovate[bot] f6c8d91b9d Update dependency @testing-library/jest-dom to v5.11.6 (https://github.com/woocommerce/woocommerce-blocks/pull/3418)
* Update dependency @testing-library/jest-dom to v5.11.6

* update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2020-11-20 14:24:01 -05:00
renovate[bot] 756aae0be2 Update Node.js to v12.19.1 (https://github.com/woocommerce/woocommerce-blocks/pull/3417)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-20 14:03:53 -05:00
Darren Ethier 36d4123ba2 if express payment is active, don’t show payment method options (https://github.com/woocommerce/woocommerce-blocks/pull/3432) 2020-11-20 12:45:12 -05:00
Mike Jolley 76b62f514c Refresh PaymentRequest after cancelling payment to prevent addresses remaining populated on repeat attempts (https://github.com/woocommerce/woocommerce-blocks/pull/3430)
* Re-init after a cancelation

* Remove empty data when normalising

* combine conditonals

* Move callbacks within effect
2020-11-20 11:40:58 -05:00
Mike Jolley 849e351a0e Sync shipping address with billing address when shipping address fields are disabled (https://github.com/woocommerce/woocommerce-blocks/pull/3358)
* Correct docblock description

* Sync shipping address changes with billing data

* Update inline documentation

* Revert address sync because it fails when shipping is disabled explicitely

* Avoid loading shipping address from customer is shipping is disabled

* Rather than update order from the wc/store/checkout request, update the customer object

This is turn is synced to order, but also allows the cart calcultions to use the posted data. This means that taxes will be updated based on address data even if not displayed on the checkout.

* Add action that combines billing and shipping updates

* Add route for updating billing and shipping address

* Sync billing data to server on change

* Shared constants for billing data

* Skip address update if missing country

* Allow null values to skip formatting

* Add billing to cart schema

* Removed unwanted hooks from previous commit

* Decoding is handled in useStoreCart

* Remove hook

* Make shipping context hold state

* Make billing context hold state

* Add address processors

* Cart does not have billing

* Update tests, remove some unrelated changes affecting the diff

* Revert "Update inline documentation"

This reverts commit 0393f49316de3152c6dcf6fda1192c06a74f1b55.

* Make shippingRatesAreResolving conditonal based on API request

* Shared address processor in cart and checkout

* Rename REST endpoint

* CustomerDataProvider and hook

* Update shipping address type defs

* Rename customer address endpoint, and remove update-shipping

* Update tests

* Fix tests by restoring country validation

* typo

* Update assets/js/base/hooks/cart/use-store-cart.js

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

* Simplify debounce and request handling

* Remove state from address sync

This will mean billing is "forgotten" if using the checbox, but this greatly simplifies logic.

* Rename shipping rates loading to customer data loading

* Sync based on useStoreCart data

* Made cart API less strict on addresses

* Fix useCheckoutAddress sync

* Add note on currentShippingAsBilling

* Use incoming isCart

* Add more detailed inline comment for shippingAsBilling toggle event

* Combine customer billing and shipping ref

* Update address docblock

* Error handling in pluckAddress

* Fix cart response after rebase

* Update customer tests

* Update src/StoreApi/Routes/CartUpdateCustomer.php

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

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-11-20 15:13:35 +00:00
opr 5ded3a9058 Ensure "Add a note to your order" section is styled correctly when disabled (https://github.com/woocommerce/woocommerce-blocks/pull/3427)
* Pass disabled prop to FormStep in order-notes-step.js

This way we can add the disabled class to the div or fieldset rendered by FormStep.

* Add disabled class & style for disabled FormStep components

Allows us to style disabled elements that cannot have the disabled attribute (divs) the same way as disabled fieldsets are.

* Update test snapshot for FormStep

This is because we added a class to the div/fieldset element when it is disabled.

* Remove redundant selector from form-step styles

Because we now add the --disabled modifier to the class, we no longer need the disabled selector. The new class-name based selector covers both fieldsets and divs.
2020-11-20 10:48:26 +00:00
opr 897abcb73a Prevent checkout step heading text overlapping actual heading on small viewports (https://github.com/woocommerce/woocommerce-blocks/pull/3425)
* Change style rules for checkout step headings

This is required because when the checkout heading text is too long it collided and overlapped the heading content due to its absolute position. In this commit we add a grey line to the left of the checkout step heading to ensure consistency with the checkout step container's styling.

* Remove position rule from checkout-step heading content

This was no longer needed as it nothing relied on the position of this element.
2020-11-20 10:44:24 +00:00
Mike Jolley caaf9e14c2 Improve Stripe (chrome pay) express payment method availability (https://github.com/woocommerce/woocommerce-blocks/pull/3424)
* Check price >= 30

* Force payment methods to react to order totals change

* Fix express payments reducer so it overwrites

* Fallback to 0 if undefined
2020-11-20 10:10:04 +00:00
Bartosz Budzanowski 4cf3bf214b Use latest ( tracked ) patch releases. (https://github.com/woocommerce/woocommerce-blocks/pull/3406) 2020-11-19 12:23:38 +01:00
Rua Haszard 8395954c7a Support a plain js config argument to payment method registration APIs (https://github.com/woocommerce/woocommerce-blocks/pull/3404)
* handle plain options passed to registerPaymentMethod:
- no need for a callback dance
- support the previous API: if a function is passed, call it as before

* update Stripe for new registerPaymentMethod interface

* update docs & all built-in payment methods to simpler API

* handle plain options arg to registerExpressPaymentMethod:
- add legacy fallback if passed a function
- update stripe express payment method
- update docs
- remove unused `assertValidPaymentMethodCreator` util

* use correct case for `JavaScript`

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

* typedefs for payment registration options + tidies for regular methods

* typedef express payment options arg & tidy stripe/payment-request:
- use camelCase for config instance (not a constructor/type)

* mention typedefs in payment method dev docs

* use @wordpress/deprecated to warn if callback passed to payment register

* update unit tests for new payment method API

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-11-19 11:06:33 +13:00
renovate[bot] adea8e33e4 Update dependency reakit to v1.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3421)
* Update dependency reakit to v1.3.0

* update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2020-11-18 16:38:29 +01:00
Albert Juhé Lluveras 3f01676d16 Exclude checkout-draft orders from WC Admin reports and My Account > Orders (https://github.com/woocommerce/woocommerce-blocks/pull/3379)
* Exclude checkout-draft orders from WC Admin reports

* Hook into order query args

* Add comments before applying filters

* Revert "Add comments before applying filters"

This reverts commit 83b695665c05a3a9e7669e8777080c6ff10d8421.

* Revert "Hook into order query args"

This reverts commit 94cec6c83cf5b5ce05cd106daf217c0b08f13a03.

* Hide draft orders from My Account > Orders

* Move filter to its own file

* Use custom plugin namespace for filter
2020-11-18 10:11:37 +01:00
Albert Juhé Lluveras e3163dc00d Add FeatureGating parameter to Package in tests (https://github.com/woocommerce/woocommerce-blocks/pull/3413) 2020-11-17 12:25:38 +00:00
Mike Jolley ec22a5c6c4 Cart and checkout should respect the global "Hide shipping costs until an address is entered" setting (https://github.com/woocommerce/woocommerce-blocks/pull/3383)
* Remove custom fieldconfig for shipping calculator so required fields for shipping are collected

* If the store config requires an address before shipping, do not return rates or totals

Totals, calculated by the cart, would be set to 0 in this scenario which could lead to customer confusion (why is the rate $10 but shipping shown as $0?)

* The shipping total row is missing a border

* Revert "If the store config requires an address before shipping, do not return rates or totals"

This reverts commit f3a4f24f5785392eb43bfc69a5548d398c47d8bb.

* Add hasCalculatedShipping to schema and hooks

* Show shipping notices with updated wording based on if shipping has calculated yet or not

* Refactor shipping row display to use new API props

* Remove block level isShippingCostHidden

* fix test

* Correct the math in the shipping preview in cart

* Document null

* Remove test—this option no longer exists

* Remove unused settings/constants
2020-11-17 11:58:38 +00:00
Mike Jolley 7b9898deeb Fix cart block isLarge console error in the editor when running WordPress 5.6 beta (https://github.com/woocommerce/woocommerce-blocks/pull/3408)
* Remove isLarge prop from Button component

* More isLarge button
2020-11-17 11:07:26 +00:00
Mike Jolley 582d9e87fc Show Express Payment Method Error Notices after Payment Failure (https://github.com/woocommerce/woocommerce-blocks/pull/3410)
* Strip tags from stripe error notices

* Revise abortPayment - this does not need to provide or handle responses

* Decode entities in responseData

* Correctly handle checkoutResponse props

* Show one error at a time from express methods

* Set ID to context to avoid need to manually define it
2020-11-17 10:51:27 +00:00
Albert Juhé Lluveras 6753023e08 Move feature flag PHP logic to a service class (https://github.com/woocommerce/woocommerce-blocks/pull/3343)
* Move feature flag PHP logic to a service class

* Add legacy methods

* Inject a FeatureGating class instance into Package

* Make is_experimental_build and is_feature_plugin_build methods non static
2020-11-17 08:46:12 +01:00
Albert Juhé Lluveras 624a8601bc Fix: orders not being placed when paying with an Express payment method from the Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/3403)
* Fix Express payment methods in Cart block

* Create a draft order inside get_draft_order_object() if the ID doesn't match a draft order
2020-11-16 13:12:56 +00:00
Seghir Nadir a576ba8d67 Introduce ExtendRestApi (https://github.com/woocommerce/woocommerce-blocks/pull/3356)
* initial prototype for ExtendRestApi

* return before assign

* fix phplint errors

* declare Throwable

* remove empty init

* return initial data if shape is not correct

* Add IDENTIFIER to schema classes

* refactor ExtendRestApi to not use filters

* remove extra check

* implement ExtendRestAPI injected into StoreAPI schemas

* use $extend instead of $extend_schema

* fix phpcs issues

* update schema

* fix data type

* address review

* fix object cast

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-11-16 13:31:27 +01:00
Rua Haszard 32b7d31c63 Expose `discount_type` in Store API coupon endpoints (https://github.com/woocommerce/woocommerce-blocks/pull/3399)
* add `discount_type` to store api coupons endpoints

* add `discount_type` field to coupon API docs

* add comment documenting when discount_type appeared in API response
2020-11-16 10:30:08 +13:00
Darren Ethier 4a488efb56 Fix incorrect usage of static method in Stripe payment method integration (https://github.com/woocommerce/woocommerce-blocks/pull/3400)
* bump phpcs compat check to php 7

* implement order_meta adjustment directly.
2020-11-14 11:04:48 -05:00
Bartosz Budzanowski ca8fe37e89 Print wordpress version in e2e tests. (https://github.com/woocommerce/woocommerce-blocks/pull/3401) 2020-11-14 14:52:30 +01:00
Darren Ethier 5d4fde02f1 fix package-lock.json 2020-11-13 10:37:19 -05:00
Darren Ethier 0363856256 update package-lock (needed after all recent renovate updates). 2020-11-13 08:26:45 -05:00
renovate[bot] 663bdcddbf Update dependency react-test-renderer to v17 (https://github.com/woocommerce/woocommerce-blocks/pull/3393)
* Update dependency react-test-renderer to v17

* Update package-lock.json

* Update dependencies order.

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
2020-11-11 20:08:29 +01:00
renovate[bot] dcb90c1a26 Update dependency mini-css-extract-plugin to v1 (https://github.com/woocommerce/woocommerce-blocks/pull/3392)
* Update dependency mini-css-extract-plugin to v1

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
2020-11-11 19:08:40 +01:00
renovate[bot] ffc76ddbdf Update dependency promptly to v3.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3391)
* Update dependency promptly to v3.2.0

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
2020-11-11 19:02:29 +01:00
renovate[bot] d83f2c37e0 Update dependency core-js to v3.7.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3389)
* Update dependency core-js to v3.7.0

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
2020-11-11 18:56:27 +01:00
renovate[bot] 2b64c0eaec Update dependency eslint to v7.13.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3390)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-11 18:52:41 +01:00
renovate[bot] 9059525d3c Update dependency @types/react to v16.9.56 (https://github.com/woocommerce/woocommerce-blocks/pull/3388)
* Update dependency @types/react to v16.9.56

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
2020-11-11 18:51:53 +01:00
Darren Ethier e1b3bae4b4 Add note about internal notifications of release and fix smoke test link. 2020-11-11 09:39:26 -05:00
Darren Ethier 28d38890d3 add note about posting to internal slack and fix smoke testing link. 2020-11-11 09:37:40 -05:00
budzanowski 3f9aed0fb0 Update to 3.9.0-dev version. 2020-11-10 17:30:55 +01:00
github-actions[bot] 062e0b0226 Release: 3.8.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3384)
* generating changeset for pull request

* Update changelog for the 3.8.0 release.

* Update testing instructions.

* Update testing documentation.
2020-11-10 17:12:25 +01:00
Darren Ethier 2727acc6b9 Fix PHP8 Unsupported Types with Operators warnings for PHP8 (https://github.com/woocommerce/woocommerce-blocks/pull/3381)
* fix unsupported types with operators warning for PHP 8 with cart item conditional checks

* verify draft order object instance before using

* ensure per_page value is cast to integer

* correctly account for categories value and type in conditional

* add more instanceof checks

* Correct variable name in array check

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-11-09 15:55:31 -05:00
Darren Ethier 07e9e679cf update checklists to include reference to `#woo-core-releases` slack channel. 2020-11-09 15:50:54 -05:00
Gerhard Potgieter c770098cd6 Add WordPress.org assets folder and add latest assets. (https://github.com/woocommerce/woocommerce-blocks/pull/3377) 2020-11-09 08:07:15 -05:00
Mike Jolley f1df45ddd2 Show the phone number field in the billing section when shipping is disabled in settings (https://github.com/woocommerce/woocommerce-blocks/pull/3376)
* Add missing context docs for shouldCreateAccount

* shouldCreateAccount context docs

* No need to handle showOrderNotes in component—just don't render it

* Only render notes if needed

* Create PhoneNumber component to insert when needed
2020-11-09 11:00:31 +00:00
Mike Jolley 5a450fc142 Change delimiter used for spltChunks from tilde to hyphens (https://github.com/woocommerce/woocommerce-blocks/pull/3360)
* Change delimiter used for chunks to hyphens

* Add automaticNameDelimiter to all configs
2020-11-09 10:44:58 +00:00
Darren Ethier e09444c525 Force node 12 for action (https://github.com/woocommerce/woocommerce-blocks/pull/3380)
Currently our repository doesn't support node 14.x and this branch of node recently became LTS so GitHub actions now default to that version. This is an attempt to force a specific version of node for the action.
2020-11-06 10:49:19 -05:00
Darren Ethier ea4cd86c69 Release 3.7.1 2020-11-05 08:16:05 -05:00
Darren Ethier f3fdbd7b59 Fix account creation bugs (https://github.com/woocommerce/woocommerce-blocks/pull/3371)
* account for registration enabled setting when creating accounts

* default to false instead of global setting for initial allowCreateAccount attribute

* consider global allows signup value for whether account creation checkbox shows

* include existing hook when determining if checkout signup is available:
- woocommerce_checkout_registration_enabled hook

* use public api for registration settings (via WC_Checkout)

* initial round of test fixes

* fix logic flaw exposed by tests and align tests with actual values in real use

* return early if WC_Checkout is not available

* remove temporary test group and uncomment new test.

* improve test method name

* fix comment to match new routine name

* ensure block shows login prompt when store disables checkout signup

* fix incorrect conditional order and cover with tests

Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
2020-11-05 15:22:43 +13:00
renovate[bot] f11cd7a50f Update dependency @stripe/stripe-js to v1.11.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3365)
* Update dependency @stripe/stripe-js to v1.11.0

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-11-04 17:36:45 +01:00
renovate[bot] f50f510f63 Update storybook monorepo to v6.0.28 (https://github.com/woocommerce/woocommerce-blocks/pull/3369)
* Update storybook monorepo to v6.0.28

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-11-04 15:10:06 +01:00
renovate[bot] ebe7023a75 Update dependency html-react-parser to v0.14.1 (https://github.com/woocommerce/woocommerce-blocks/pull/3368)
* Update dependency html-react-parser to v0.14.1

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-11-04 15:09:55 +01:00
renovate[bot] bd98a5b30e Update dependency @types/react to v16.9.55 (https://github.com/woocommerce/woocommerce-blocks/pull/3367)
* Update dependency @types/react to v16.9.55

* Update package-lock.json

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2020-11-04 15:09:48 +01:00