Commit Graph

934 Commits

Author SHA1 Message Date
Albert Juhé Lluveras 2c8d85d18d Cart & Checkout blocks: print all item data and update variation designs (https://github.com/woocommerce/woocommerce-blocks/pull/3665)
* Cart and Checkout blocks: show all item data and update variations design

* Add class with detail name to product details
2021-01-12 11:04:53 +01:00
David Levin f97c5b8264 Update input colors and alignment (https://github.com/woocommerce/woocommerce-blocks/pull/3597)
* update input colors for dark and light mode + tweak padding and alignment

* update light input dropdown text color

* Fix lint errors

* Fix  package lock.

* Use input-text-active for select options

* Make sizes responsive in radio control

* Unify border colors of text inputs, checkboxes and radio controls

* Unify radio control sizes in mobile/desktop

Co-authored-by: David Levin <davidlevin@Davids-MacBook-Pro-2.local>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-01-12 10:09:47 +01:00
Seghir Nadir 3d218d1f8e introduce SlotFill for Sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/3361)
* add plugin area

* add invisible errorBoundary

* introduce slot

* change name to OrderMeta

* fix rebase

* refactor slotFill

* wip

* create checkout file

* fix lint issues

* remove custom checkout package

* rebase with trunk

* remove redudant code and move slotfill

* fix wrong import

* switch to wc.blocksCheckout

* update package name

* fix broken import
2021-01-11 13:12:26 +01:00
Albert Juhé Lluveras b4a37aebd6 Create @woocommerce/checkout to export components to a global (https://github.com/woocommerce/woocommerce-blocks/pull/3654)
* add plugin area

* add invisible errorBoundary

* introduce slot

* change name to OrderMeta

* fix rebase

* wip

* create checkout file

* Import ExperimentalOrderMeta from @woocommerce/checkout

* Rename wc-checkout-packages handle to wc-blocks-checkout

* Only import wc-blocks-checkout in the feature plugin

* Move checkout package to packages folder

* Add @woocommerce/blocks-checkout to tsconfig

* Move TotalsItem to @woocommerce/checkout

* Use Fragment short syntax

* Remove example code

* Honor renderError prop in BlockErrorBoundary

* Rename error boundary

* Add example code

This reverts commit 9b6af7178cbef05589779ef7f5a750d53e7fc8cf.

* Revert "Add example code"

This reverts commit 2f50349692f53c5bb143516365eee7a98d580dfd.

* Add @woocommerce/blocks-checkout to jest config

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-01-07 13:02:21 +01:00
Albert Juhé Lluveras fb5c0f3af2 Add tests to AddressForm (https://github.com/woocommerce/woocommerce-blocks/pull/3621)
* Remove unnecessary async key in read more tests

* Add tests to AddressForm component
2021-01-06 10:22:51 +01:00
Darren Ethier f9d05163f9 Add "you don't need lodash/underscore" eslint rule (https://github.com/woocommerce/woocommerce-blocks/pull/3634)
* add you don’t need lodash eslint plugin

* handle lodash.omit eslint errors

- storybook and webpack config implementations were just ignored.
- shared/validation/index.js was converted to use ES6 destructuring to eliminate usage.

* remove lodash assign usage

* convert lodash isNan to Number.isNan

* ignore lodash.flatten lint error for now

* remove usage of lodash.isNil

* add exclusions for lodash rules in main eslintrc file rather than per file.
2021-01-05 08:58:18 -05:00
Bartosz Budzanowski ed612e6e09 Remove setSettings. (https://github.com/woocommerce/woocommerce-blocks/pull/3607)
* Remove setSettings.

* No deprecated warrning from setSettings so we should not expect it.
2021-01-05 14:09:07 +01:00
Albert Juhé Lluveras de2796ca4e Convert saved payment methods token to a string (https://github.com/woocommerce/woocommerce-blocks/pull/3627)
* Allow integers in payment_data values

* Revert "Allow integers in payment_data values"

This reverts commit b7f2ca4a5b696091afe796f47e84f584a0b27d9e.

* Enforce payment tokens to be strings
2021-01-05 10:51:23 +01:00
Seghir Nadir 3d92a61102 Fix nonce issues when adding product to cart from All Products (https://github.com/woocommerce/woocommerce-blocks/pull/3598)
* Products extend cart route

* load cart in products
2020-12-24 12:00:51 +01:00
Seghir Nadir 863275bf6b sync shipping with billing when shipping is disabled (https://github.com/woocommerce/woocommerce-blocks/pull/3593)
* sync shipping with billing when shipping is disabled

* default to billing data if shipping is disabled
2020-12-23 16:10:13 +01:00
Rua Haszard 34f364e708 respect merchant setting for Stripe CC `title`: (https://github.com/woocommerce/woocommerce-blocks/pull/3568)
- expose title setting to client and use in UI
2020-12-23 08:52:37 +13:00
Albert Juhé Lluveras 257c970726 Don't add the hidden class name to elements with the hidden attribute (https://github.com/woocommerce/woocommerce-blocks/pull/3582)
* Revert "Add 'hidden' class name when using the 'hidden' attribute"

This reverts commit 0332e33a60a516506718e8ed4659e45d32dc80a4.

* Add styles for hidden panel content

* Add docs about account for the hidden attribute in styles

* Update docs/theming/README.md

Co-authored-by: Rua Haszard <rua.haszard@automattic.com>

Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
2020-12-22 10:26:59 +01:00
Seghir Nadir a713e56c7a use ReplaceMediaFlow in featured category and feature product (https://github.com/woocommerce/woocommerce-blocks/pull/3579)
* use ReplaceMediaFlow in featured category

* use ReplaceMediaFlow in featured product

* remove redudant prop
2020-12-21 17:09:10 +01:00
Seghir Nadir 94d8d580a2 Fix isDefault on Buttons and switch Toolbar with ToolbarGroup (https://github.com/woocommerce/woocommerce-blocks/pull/3577)
* Fix isDefault notice

* fix Toolbar to ToolbarGroup
2020-12-21 17:03:54 +01:00
Seghir Nadir 800f3c9624 Fix direct call to setState in EditProductSearch body (https://github.com/woocommerce/woocommerce-blocks/pull/3578) 2020-12-21 16:56:58 +01:00
Bartosz Budzanowski 9cfa54579d Fix data type used for paymentData.paymentMethods handling. (https://github.com/woocommerce/woocommerce-blocks/pull/3576)
* Fix data type for used paymentData.paymentMethods.

* This check is no longer necessary.
2020-12-21 16:32:59 +01:00
Albert Juhé Lluveras 7ea0aa4fbc Use em for coupon code button height (https://github.com/woocommerce/woocommerce-blocks/pull/3575) 2020-12-21 14:49:43 +01:00
Albert Juhé Lluveras 4197cfdb2d Add 'hidden' class name when using the 'hidden' attribute (https://github.com/woocommerce/woocommerce-blocks/pull/3569) 2020-12-21 14:47:51 +01:00
Albert Juhé Lluveras 5d01c8d781 Merge markup from Product Title atomic block and ProductName component (https://github.com/woocommerce/woocommerce-blocks/pull/3562)
* Merge markup from ProductTitle atomic block and ProductName component

* Add test

* Remove duplicate decodeEntities call

* Minor improvements
2020-12-21 14:45:27 +01:00
Albert Juhé Lluveras e3d97d7387 Fix Fees not visible in Cart & Checkout blocks when order doesn't need shipping (https://github.com/woocommerce/woocommerce-blocks/pull/3521) 2020-12-21 14:15:27 +01:00
Albert Juhé Lluveras 28ffe1be49 Replace IconButton component with Button (https://github.com/woocommerce/woocommerce-blocks/pull/3547)
* Replace IconButton component with Button

* Fix All Products editor.scss file not included by Webpack
2020-12-21 14:11:13 +01:00
Bartosz Budzanowski e2e934ec46 Remove customer saved payment methods from context if they are not enabled. (https://github.com/woocommerce/woocommerce-blocks/pull/3551)
* For gateways with disabled saved payment metods, don't show saved items in context.

* Fix style.

* Update name.

* Simplify and fix.

* Whitespace.

* Revert for another PR.

* Formatting fix.
2020-12-21 12:07:31 +01:00
Mike Jolley 55f0bc73a6 Fix Address Validation in the Store API and client (https://github.com/woocommerce/woocommerce-blocks/pull/3552)
* Trim input values before validation on Checkout

* Fixes required field checking at schema level

* Require country during checkout and ensure values are formatted

* Add handling for rest_invalid_param messages

* Remove prepare_address_fields - handled by schema

* Add address validation to OrderController

* Implement address validation

* Error errors from all endpoints more gracefully

* update non-true description

* required prop

* Update tests

* Fix equalityFn so updates are triggered when address changes

* Remove debounce so fields update if context changes

* Update src/StoreApi/Schemas/AbstractAddressSchema.php

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

* Add missing wp_unslash

* Validate allowed countries should block checkout if no countries are allowed

* Type in locale variable

* Update assets/js/base/utils/errors.js

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

* Fix validator calls

* Remove refererence

* Restore onChange order

* eslint fix

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-12-17 14:52:44 +00:00
Thomas Roberts ef081ef8a2 Fix select inputs when dark mode is enabled in Twenty Twenty-One (https://github.com/woocommerce/woocommerce-blocks/pull/3554)
* Add CSS rules for dark mode theme setting in Twenty Twenty-One

This is required because the theme may be set to dark mode independently of the browser. The reason we need two rules for this is because the checkout block can be set to have dark mode inputs too, so this rule doesn't need to apply then.

* Add theme-specific class for Twenty Twenty-One
2020-12-16 16:01:46 +00:00
Albert Juhé Lluveras 56485d6da5 Rename version compare functions to isWpVersion and isWcVersion and add docblocks (https://github.com/woocommerce/woocommerce-blocks/pull/3548)
* Add docblocks to compareWithWpVersion and compareWithWooVersion

* Rename functions to isWpVersion and isWcVersion
2020-12-15 16:10:24 +01:00
Mike Jolley 6e66799414 Update usage of legacy packages (inc. ServerSideRender) (https://github.com/woocommerce/woocommerce-blocks/pull/3541)
* Use the @wordpress/server-side-render package

* Add @wordpress/server-side-render dependency

* Update requiredPackagesInWPLegacy for 5.4 support

* Update package lock
2020-12-14 11:55:05 +00:00
Mike Jolley f459ad664c Switch to Fragment Short Syntax (`<>`) (https://github.com/woocommerce/woocommerce-blocks/pull/3536)
* Replace Fragment with shorthand

* Update eslint rules for short fragment syntax
2020-12-14 11:54:34 +00:00
Albert Juhé Lluveras 02174c5431 Add stories to Cart & Checkout totals components (https://github.com/woocommerce/woocommerce-blocks/pull/3533)
* Add stories to Cart & Checkout totals components

* Create @woocommerce/knobs alias

* Update TotalsFooterItem default values so they are in line with other stories
2020-12-14 09:15:50 +01:00
Albert Juhé Lluveras baa97e528f Update minimum required WP version to 5.4 (https://github.com/woocommerce/woocommerce-blocks/pull/3537)
* Update minimum required WP version to 5.4

* Remove WP legacy version check in blocks registration

* Remove no longer needed version check
2020-12-10 15:39:04 +01:00
Rua Haszard 87d9b01dfb Add storybook demo for CheckboxControl (https://github.com/woocommerce/woocommerce-blocks/pull/3030)
* story for CheckboxControl aka Checkbox

* Rename exported story to Default and use correct component name

This keeps our stories more consistent
2020-12-10 10:38:26 +00:00
Albert Juhé Lluveras 8d9d98d8e9 Add missing experimental functions to the feature flags page (https://github.com/woocommerce/woocommerce-blocks/pull/3522)
* Remove no longer used __experimentalPersistItemToCollection function

* Add __experimentalDeRegisterPaymentMethod and __experimentalDeRegisterExpressPaymentMethod to feature flags doc
2020-12-09 15:10:57 +01:00
Albert Juhé Lluveras bc40247d70 Rename Cart & Checkout totals components (https://github.com/woocommerce/woocommerce-blocks/pull/3520)
* Rename TotalsCouponCodeInput to TotalsCoupon

* Rename SubtotalsItem to Subtotal

* Rename TotalsDiscountItem to TotalsDiscount

* Rename TotalsFeesItem to TotalsFess

* Rename TotalsFooterItem folder

* Rename TotalsItem folder

* Rename TotalsShippingItem to TotalsShipping

* Rename TotalsTaxesItem to TotalsTaxes
2020-12-09 08:29:34 +01:00
github-actions[bot] dc5ad5701d Release: 4.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3509)
* generating changeset for pull request

* generating changeset for pull request

* Update readme changelog

* Update requirements

* Testing instructions

* Update zip file

* Update nonce outside of json parse

* Set logged in cookie on store api requests

* Update zip

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-12-08 13:40:40 +00:00
Seghir Nadir 231d49406a Introduce pluginArea in Cart and Checkout (https://github.com/woocommerce/woocommerce-blocks/pull/3498)
* add plugin area

* add invisible errorBoundary

* move PluginArea to CheckoutProvider
2020-12-04 10:52:52 +01:00
Bartosz Budzanowski 2293e41f1d Fix:3501 Omit keys in `customerPaymentMethods` that have an empty list as a value. (https://github.com/woocommerce/woocommerce-blocks/pull/3502)
* Don't add empty methods key.
2020-12-03 19:33:33 +01:00
Albert Juhé Lluveras 2e5bcca7c6 Update @wordpress/components to v. 11.1.1 and @wordpress/base-styles to v. 3.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/3457)
* Update @wordpress/components and @wordpress/base-styles

* Fix JS warning in Select/downshift

* Remove color definitions that are now imported from @wordpress/base-styles. Fixes woocommerce/woocommerce-blocks#3311

* Use -unit values from @wordpress/base-styles. Fixes woocommerce/woocommerce-blocks#3313

* Update snapshots

* Fix payment methods test

* Don't extract dependencies that are not available in WP 5.3

* Avoid extracting @wordpress/compose since last version doesn't have resize observer

* Remove unnecessary uses of @wordpress/compose in a frontend scripts

* Add missing spaces
2020-12-03 14:04:25 +01:00
Rua Haszard ce6dd93e7b Handle change to logged-in status in checkout API AJAX requests (https://github.com/woocommerce/woocommerce-blocks/pull/3429)
* refactor and reorder checkout processing

* improve handling of checkout POST with mixed success:
- return coupon errors in a property
- don't throw from coupon validation:
  - return info about errors to route handler
  - tweak logic in route handler to prevent subsequent processing
  - default payment result to fail to avoid accidental successful checkout
- in client, catch errors and new customer id:
  - render any errors as notices - i.e. coupon error
  - if a customer ID is included, push into store (so UI updates)

* fix linter whitespace issue from rebase merge

* fix MIA order validation/errors (due to rebase):
- reinstate thrown exception when validating order
- return exception was an experiment, now solved in woocommerce/woocommerce-blocks#3454

* hide "Create account" checkbox if account is created during an error response:
- update store with new user id
- remove stale response.errors handling;
  - current approach (https://github.com/woocommerce/woocommerce-blocks/pull/3454) is to add data to error response

* show a notice informing user that they have signed up

* white space

* Handle header and update typedef

* Remove "errors" schema

* remove errors

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-12-02 14:27:28 +00:00
Rua Haszard 0cb3b3d9a8 refactor and reorder checkout processing (https://github.com/woocommerce/woocommerce-blocks/pull/3454)
* refactor and reorder checkout processing

* move experimental order_processed hook as last step before payment:
+ flesh out docs - intention/purpose, introduced version, link to PR,
relationship to legacy hook

* return current user_id with checkout error responses, so UI can update

* clarify user id comment

* Add store API nonce to all responses

* catch new nonce & update store for POST /checkout errors

* ensure $order hook param and database are in sync

* fetchResponse->errorResponse

* Move payment method ID validation to schema

* Add the nonce inline

* Simplify error method

* Add todo for injection

* Hook docs

* Return user ID as a header instead of in error response

* Default to private methods

* Tidied processing logic/order save placement

* White space removal

* Remove duplicate comment

* Remove root slash

* Remove unused created variable

* Remove woocommerce_registration_error_email_exists filter in error message from API

* Move payment validation

* Moved comments

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2020-12-02 12:22:42 +00:00
Albert Juhé Lluveras 5683ed1e54 Fix c notice close button color in Twenty Twenty One dark mode (https://github.com/woocommerce/woocommerce-blocks/pull/3472) 2020-12-02 13:09:57 +01:00
Albert Juhé Lluveras 281cc99291 Create IE11 SCSS mixin (https://github.com/woocommerce/woocommerce-blocks/pull/3473) 2020-12-01 09:04:52 +01:00
Albert Juhé Lluveras 0b2112c3d5 Prevent exclude drafts filter being tree shaken (https://github.com/woocommerce/woocommerce-blocks/pull/3463) 2020-11-25 13:46:13 +01:00
opr 704fab02d6 Reverse logic for hiding product name in checkout sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/3464)
The hasLink prop was removed from ProductName and disabled is used instead, this change makes the variable name more descriptive, and uses disabled to signal if the ProductName should link or not.
2020-11-25 12:39:02 +00:00
opr 404e669f72 Change left margin of notice's dismiss icon to auto (https://github.com/woocommerce/woocommerce-blocks/pull/3455)
This is needed to ensure the dismiss icon in notices will always be as far over to the right of the parent container as possible.
2020-11-25 11:50:59 +00:00
Albert Juhé Lluveras 94064c1597 Fix checkbox and textarea styles in Twenty Twenty One when it has dark controls (https://github.com/woocommerce/woocommerce-blocks/pull/3450)
* Fix textarea styles in Twenty Twenty One when has dark controls

* Fix checkbox styles in Twenty Twenty One when has dark controls
2020-11-23 15:20:31 -05:00
Albert Juhé Lluveras e125dfd97b Fix radio controls and checkboxes in Twenty Twenty One dark theme (https://github.com/woocommerce/woocommerce-blocks/pull/3446)
* Fix radio controls in Twenty Twenty One dark theme

* Fix checkbox control in Twenty Twenty One dark theme
2020-11-23 14:43:36 -05:00
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
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