Commit Graph

141 Commits

Author SHA1 Message Date
Thomas Roberts 589f6923d6 Export `Button` and `Label` from `wc-blocks-checkout` package (https://github.com/woocommerce/woocommerce-blocks/pull/4406)
* Remove snackbar filtering

* Revert "Move Button and Label components to `@woocommerce/blocks-checkout` package (https://github.com/woocommerce/woocommerce-blocks/pull/4222)"

This reverts commit 983ce48cad.

* Export Label and Button from the wc-blocks-checkout package

* Reorder exports

This is so the diff is smaller in the PR

* Revert "Remove snackbar filtering"

This reverts commit 8e598436e871aa56f89740fbe6fbe522fd02db1d.
2021-07-02 10:24:07 +01:00
Thomas Roberts 93b750ee19 Change `couponName` filter to `coupons` and update documentation (https://github.com/woocommerce/woocommerce-blocks/pull/4312)
* Rework coupon filters to not be applied individually

* Add a `text` property to the coupons in the cart

This is needed to allow extensions to change the text without affecting the code.

* Output coupon text instead of code

* Add coupons filter documentation

* Add deprecation warning when extension uses couponName filter

* Change couponName filter to coupons

* Add label to Cart item definition

* Change coupon.text to coupon.label

* Update coupon.label in coupon aria-label

* Update image and coupon.text in docs

* Add filter registration example
2021-07-01 14:12:46 +01:00
Thomas Roberts 60b95041ff Fix error about duplicate keys in TotalsFees (https://github.com/woocommerce/woocommerce-blocks/pull/4360) 2021-06-17 08:49:45 +01:00
Mike Jolley 84718840d6 Update Express Payments Loading UI (https://github.com/woocommerce/woocommerce-blocks/pull/4228)
* Separate button spinner to separate component for reuse

* Use block checkout spinner in loading mask

* Block pointer events within loading mask

* Give the useRef within useShallowEqual a default value

This prevents the potential of having an undefined value returned.

* State setter and dispatch are stable

These do not need to be used as dependencies.

* Prevent re-renders of children when using loading mask.

This prevents children being rerendered and losing state. Loading styles are applied instead using a classname, but leaving the divs in place.

* Use memoization to to prevent excessive express payment rerenders

* Wrap express payment in loading mask

* Show loading state after submission

* remove eslint exclusion

* Move spinner to base components so it's available outside of the checkout package

* Avoid extra is-loading classname

* Update snaps/fix tests

* Remove memorization of payment method content due to stale data

* Express payment error handling

* Split up payment method context to make it more manageable

* Add blocking logic to cart

* Update snap

* Restore useRef

* Fix missing function removed by accident

* Fix setActivePaymentMethod and started status (so saved methods still allow express to be initialized)

* Loading Mask Todo

* Remove boolean shallow equals

* Missing dep

* Memoize typo

* Document changes in useStoreEvents

* Replace expressPaymentMethodActive

* setExpressPaymentError deprecation

* Only change status if an error is passed

* Track disabled state via useCheckoutSubmit

* useCallback on error message functions

* Fix mocks in test
2021-06-16 13:44:40 +01:00
Thomas Roberts a20f3425b1 Add cart/extensions endpoint to allow third party extensions to process server-side and get a new cart (https://github.com/woocommerce/woocommerce-blocks/pull/4298)
* Move text-input to checkout package

* Add support to TextInput for inputs with type number

* Add ExperimentalDiscountsMeta.Slot to Cart sidebar

* Add extra styles for Button and Panel components

* Add updateCartFromApi util to @woocommerce/blocks-checkout

* Change updateCartFromApi to TypeScript

* Stop passing contexts through the discounts slot fill

* Add CartExtensionsSchema class

* Add CartExtensions Route

* Add register_update_callback and get_update_callback fns

* Add extensionCartUpdate function

* Add applyExtensionCartUpdate action

* Make extensionCartUpdate use batching

* Add ExtensionCartUpdateArgs type definition

* Execute a success/error function after request in extensionCartUpdate

* Remove success and error functions

* Avoid including all schemas in CartExtensionsSchema instantiation

This is achieved by inheriting AbstractSchema and slightly modifying the way in which the latest cart data is returned from this endpoint.

* Update docs for extensionCartUpdate

* Handle errors from extension callbacks

* Throw better errors when incorrect namespace/functions are used

* Add tests for CartExtensions route,  ExtendRestApi update callback registration

* Add dummy get_properties method to CartExtensionsSchema
2021-06-07 12:16:47 +03:00
Thomas Roberts bafa5c2827 Add snackbar filter (https://github.com/woocommerce/woocommerce-blocks/pull/4313) 2021-06-07 11:41:33 +03:00
Thomas Roberts ffa77f26f7 Add Slot/Fill to discounts area in cart sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/4248)
* Move text-input to checkout package

* Pass validation props directly to ValidatedTextInput

* Import label relatively instead of from package

* Pass validation functions to ValidatedTextInput

This is so it doesn't need to get them from useValidationContext.

* Add InputProps to ValidatedTextInput

This will be used to control additional props on the input element of TextInput

* Spread inputProps onto <input> element of TextInput

* Export TextInput from @woocommerce/blocks-checkout

* Add @woocommerce/blocks-checkout package to tsconfig

* Allow styling to be applied to number inputs and when value is 0

* Make style order consistent

* Remove inputProps to rely on rest in TextInput

* Add specific prop for the inputErrorComponent

* Only disallow active state if value is 0 AND type is number

* Change all uses of ValidatedTextInput to also pass inputErrorComponent

* Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"

This reverts commit ec734b99c20c4d29fcf778714246fc406ee37eaf.

* Revert "Remove inputProps to rely on rest in TextInput"

This reverts commit 1fc64cca4002206423d1fa443ff2d60130ba1ea0.

* Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent""

This reverts commit 110e3606a996668be5a32698b634b7706d16cddc.

* Revert "Revert "Remove inputProps to rely on rest in TextInput""

This reverts commit aeb03526c44b3fcc97a719a18930d08157a80baf.

* Don't pass errorMessage to ValidatedTextInput

* Add DiscountsMetaSlot

* Add ExperimentalDiscountsMeta.Slot to Cart sidebar

* Add extra styles for Button and Panel components

* Export ExperimentalDiscountsMeta from checkout package

* Add updateCartFromApi util to @woocommerce/blocks-checkout

* Add comment to updateCartFromApi

* Change updateCartFromApi to TypeScript

* Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)"

This reverts commit ee9b2d20e0.

* Stop passing contexts through the discounts slot fill

* Allow ValidatedTextInput to be used for type=number

* Remove contexts from Discounts slot fill

* Update snapshots

* Stop `errorMessage` being spread onto input fields in checkout

* Add paths to tsconfig

* Remove contexts from Discounts slot

* Accept step min and max on ValidatedTextInput

* Remove "no-margin" option on buttons

* Remove spinners from input type number

* Remove `no-top-border` style from panel

* Prevent text in buttons from breaking in the middle of words

* Add checkout package to tsconfig file list

* Stop passing components through DiscountsMetaSlot
2021-06-04 09:44:26 +01:00
Thomas Roberts 1702a6c0c3 Check if there are tax lines before rendering the container for them (https://github.com/woocommerce/woocommerce-blocks/pull/4284) 2021-06-02 11:14:42 +01:00
Seghir Nadir 1b87589f82 remove usage of mustBeString (https://github.com/woocommerce/woocommerce-blocks/pull/4294) 2021-06-01 09:46:02 +01:00
Thomas Roberts 61755f0f01 Fix display of itemised taxes (https://github.com/woocommerce/woocommerce-blocks/pull/4279)
* Add price to itemised tax rates & hide Total when itemised taxes are on

* Update snapshots for taxes in sidebar
2021-05-26 14:04:42 +01:00
Thomas Roberts b187f9f466 Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)"
This reverts commit ee9b2d20e0.
2021-05-25 14:13:29 +01:00
Thomas Roberts ee9b2d20e0 Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)
* Move text-input to checkout package

* Pass validation props directly to ValidatedTextInput

* Import label relatively instead of from package

* Pass validation functions to ValidatedTextInput

This is so it doesn't need to get them from useValidationContext.

* Add InputProps to ValidatedTextInput

This will be used to control additional props on the input element of TextInput

* Spread inputProps onto <input> element of TextInput

* Export TextInput from @woocommerce/blocks-checkout

* Add @woocommerce/blocks-checkout package to tsconfig

* Allow styling to be applied to number inputs and when value is 0

* Make style order consistent

* Remove inputProps to rely on rest in TextInput

* Add specific prop for the inputErrorComponent

* Only disallow active state if value is 0 AND type is number

* Change all uses of ValidatedTextInput to also pass inputErrorComponent

* Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"

This reverts commit ec734b99c20c4d29fcf778714246fc406ee37eaf.

* Revert "Remove inputProps to rely on rest in TextInput"

This reverts commit 1fc64cca4002206423d1fa443ff2d60130ba1ea0.

* Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent""

This reverts commit 110e3606a996668be5a32698b634b7706d16cddc.

* Revert "Revert "Remove inputProps to rely on rest in TextInput""

This reverts commit aeb03526c44b3fcc97a719a18930d08157a80baf.

* Don't pass errorMessage to ValidatedTextInput
2021-05-20 17:56:56 +01:00
Thomas Roberts 26a84cedde Convert TextInput and ValidatedTextInput to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/4226)
* Change index file from base/context to .ts

This is to stop TS complaining when importing things from here.

* Convert ValidatedTextInput to TypeScript

* Convert TextInput to TypeScript

* Ensure Label accepts correct HTML Attributes Props

* Remove PropTypes from TextInput and ValidatedTextInput

No longer needed because of TypeScript

* Use correct error id to show validation message

* Use HTMLElement instead of a specific element type for LabelProps

* Update assets/js/base/components/text-input/validated-text-input.tsx

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

* Update assets/js/base/components/text-input/validated-text-input.tsx

* Use correct formatting in ValidatedTextInput

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-05-19 10:55:15 +01:00
Thomas Roberts 983ce48cad Move Button and Label components to `@woocommerce/blocks-checkout` package (https://github.com/woocommerce/woocommerce-blocks/pull/4222)
* Move Button to checkout package

* Move Label to Components Package
2021-05-18 09:10:31 +01:00
Thomas Roberts 57c5b0c532 Update design of cart and checkout sidebars (https://github.com/woocommerce/woocommerce-blocks/pull/4180)
* Update cart/coupon/shipping design

* Add order summary heading

* Move and style discounts on checkout sidebar

* Add rate to tax lines

* Ensure the option to display taxes itemised is available to Cart block

* Output individual tax items below the total & add styles for this

* Add success notice under coupon input on successful coupon addition

* Add border to bottom of Totals footer

* Show success message when adding coupon

* Add padding to cart item rows

* Add preview data to cart for when taxes are enabled

* Add rate to cart response type

* Add showRateAfterTaxName attribute to Cart block

* Add control to cart block to show rate percentage after rate name

* Add rate % in cart totals only if option is toggled on

* Pass showRateAfterTaxName attribute down to TotalsTaxes

* Add showRateAfterTaxName to Checkout block

* Add control to block editor for showRateAfterTaxName on Checkout

* Pass showRateAfterTaxName down to TotalsTaxes in Checkout

* Change label for showing tax rates in cart and checkout blocks

* Add test to ensure Taxes section shows in Cart block

* Add tests for cart sidebar and rate percentages

* Remove order summary title from checkout sidebar

* Check if taxes are enabled before rendering the option to show rate %s

* Add ShippingVia component to show the selected rate in sidebar

* Remove value from individual tax rates

* Remove bold from Shipping via label

* Remove coupon added successfully message

* Ensure panel headings that are h2s are the same colour as others

* Clean up eslint warnings

* Show rate %s by default

* Update snapshots following design changes

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-05-17 15:00:57 +01:00
Thomas Roberts 1dcbddc0bd Add checkout filter for coupon names (https://github.com/woocommerce/woocommerce-blocks/pull/4166)
* Make extensions optional, not all filters will need to pass this through

For example the CartCouponSchema has no option for extensibility (and I don't think it's needed at any rate) so extensions will always be an empty object. Rather than explicitly specifying this when running the filter, we can let it default to an empty object.

* Add filter for coupon code
2021-05-11 13:57:02 +01:00
Thomas Roberts 57b4215bce Add documentation for filters (https://github.com/woocommerce/woocommerce-blocks/pull/4167)
* Rename the argument in the CheckoutFilterFunction type

This only exists as an extra descriptive hint to anyone using this type, the value `label` was never used by anything so it does not need to be changed anywhere else.

* Create Available Filters document

* Add available filters to the extensibility README

* Update docs/extensibility/available-filters.md to fix typographical error

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

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-05-05 10:41:48 +01:00
Thomas Roberts bc750438c2 Convert Cart Table to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/4088)
* Convert CartLineItemsTitle to TypeScript

* Add type guards

* Change CartLineItemRow extension to .tsx

* Remove parseInt from price precision

This is because the API sends it as a number, so it will never be a string, so no need to parse it.

* Add dinero.js types

* Type QuantitySelector and add types for @wordpress/keycodes

* Make __experimentalApplyCheckoutFilter use generic types

* Add catalog_visibility type & change types of CartItem

* Add isNumber and isString to type guards

* Type ProductLowStockBadge

* Ensure type returned by a filter function is the same it received

* Include type guards and hooks in tsconfig

* Add more type safety to useStoreCartItemQuantity

* Make className optional on QuantitySelector

* Type CartLineItemRow

* Type CartLineItemsTable

* Type Cart

* Add extra keys to CartResponseItem

* Clean aria-hidden logic

* Export type-guards from module

* Use aliases to import types in CartLineItemRow

* Remove unused prop types and specify return type of function

* Specify return type of component

* Use JSX.Element instead of ReactNode

* Remove unused variables & set return type of components

* Remove PropTypes
2021-04-23 10:15:17 +01:00
Mike Jolley dbbb99d55e Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059)
* BLOCK SETTINGS: Remove unused constants/settings

* AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks

* Move checkout and cart block settings to checkout and cart blocktypes

* Move isShippingCalculatorEnabled to cart block

* Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting

* Move displayCartPricesIncludingTax to blocktypes, and implement getSetting

* Move block settings to core settings and blocktypes

* Fix namespace usage

* Move review settings

* move tag settings

* Keep productCount in core data

* Move min and default height

* Improve storePages code

* Move attributes to attribute filter block type

* Move $word_count_type outside of settings array

* Remove unneeded setting in preview data (shippingCostRequiresAddress)

* Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings

* DEFAULT_COLUMNS and ROWS to settings

* Move product columns/rows to block types

* Add grid settings to AllProducts block

* Correct default rows

* correct min rows default

* Move hasDarkEditorStyleSupport

* Move hideOutOfStockItems to block type settings

* Move build settings to inline script dependency

* Pass data through asset api and move restApiRoutes

* Export all core settings as constants

* Remove WORD_COUNT_TYPE from core settings

* Move some other core settings to assets

* Update constants

* Make settings use TypeScript

* Update CURRENT_USER_IS_ADMIN usage

* WORD_COUNT_TYPE

* REST_API_ROUTES

* REVIEW_RATINGS_ENABLED and SHOW_AVATARS

* Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants

* Remove MIN_HEIGHT

* Remove DEFAULT_HEIGHT

* PLACEHOLDER_IMG_SRC

* LIMIT_TAGS

* HAS_PRODUCTS

* HOME_URL

* HAS_TAGS

* COUPONS_ENABLED

* SHIPPING_ENABLED

* TAXES_ENABLED

* DISPLAY_ITEMIZED_TAXES

* SHIPPING_COST_REQUIRES_ADDRESS

* SHIPPING_STATES and SHIPPING_COUNTRIES

* STORE_PAGES

* ALLOWED_COUNTRIES

* ALLOWED_STATES

* SHIPPING_METHODS_EXIST

* PAYMENT_GATEWAY_SORT_ORDER

* CHECKOUT_SHOW_LOGIN_REMINDER

* CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP

* ATTRIBUTES

* DISPLAY_CART_PRICES_INCLUDING_TAX

* DISPLAY_CART_PRICES_INCLUDING_TAX

* update build for TS files

* fix build dir

* Move blocks build config params

* Move placeholderImgSrc to core settings

* Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration

* Move wordCountType to abstract block

* Remove WORD_COUNT_TYPE in favour of getSetting

* Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline

* Add wcBlocksConfig

* fix tests

* Remove unused $asset_data_registry

* remove console.log

* Move build settings to abstract block

* Trigger build again

* Move hydration back to regular hocs for compatibility with trunk (merge conflict)

* Removed wcSharedHocsConfig

* esc home url

* Update search fixture

* Update search snap

* 40000 timeout

* hasProducts -> productCount

* Product Count is part of blocks config

* update mocks

* Use version comparison to determine if batching is enabled

* Change isWpVersion

* scrollTo button
2021-04-22 12:37:27 +01:00
Mike Jolley 7556d47b5c Fix TwentyX styling issues for cart/checkout form fields (https://github.com/woocommerce/woocommerce-blocks/pull/4046)
* Fix checkbox styling in 2020 and 2017 themes by setting input font size

* 2017 button hover style fixes

* Fix editor dark inputs

* Restore dark color
2021-04-12 12:03:36 +02:00
Seghir Nadir e668fbf1b6 provide fallback for extensions when store didn't load yet (https://github.com/woocommerce/woocommerce-blocks/pull/4033) 2021-04-09 15:56:11 +01:00
Mike Jolley 9bdcbe0b4d Fix Circular Dependencies During Builds (https://github.com/woocommerce/woocommerce-blocks/pull/4025)
* Fix circular dependencies in Icons package

* CircularDependencyPlugin

* Fix deriveSelectedShippingRates CD

* Move useStoreNotices to context/hooks

* Move useStoreCart to base/context/hooks

* Move useStoreEvents to base/context/hooks

* Move collection/product hooks

* Move useStoreAddToCart

* Move useCustomerData

* move shipping hooks

* Move checkout and payment hooks

* Context should import hooks with relative paths

* Prevent circular dependency in store notices container components

* Move address fields to settings so they are shared

* Import PaymentMethod components direct

* relative import

* Fix select CD

* Move ValidationInputError

* Move components consumed by context

* Fix up internal imports in context

* fix CD in checkout package

* Separate providers

* Fixing context exports

* Fix base context hook import

* fix mocks

* Pass hooks to Slot Fills as Fill Props to avoid imports from base-context

* Export components, not hooks

* Pass props to ExperimentalOrderMeta

* Run CD plugin when using `npm start` only

* Rename CIRCULAR_DEPS to CHECK_CIRCULAR_DEPS

* Remove duplicate key from rebase

* Move packages component back to main file

* Remove dashicon module replacement

* Restore SVG import from package not external

* Move core locale handling to avoid impact settings package size

* Remove deleted file from rebase
2021-04-08 13:31:12 +01:00
Raluca Stan e187b9ef88 Update/typescript checkout shipping (https://github.com/woocommerce/woocommerce-blocks/pull/3925)
* Type shipping related hooks and packages

* Move component interface from shared shipping types file

* Fix Typescript import errors

* Type FormattedMonetaryAmountProps

* Change FormattedMonetaryAmountProps's value prop type

Looks like TotalsItem was the only on sending '-' as a value and it looks like it’s no longer passed through.

* Move `displayType` as a prop on FormattedMonetaryAmount

* Spacing

* Spacing

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-03-09 10:55:24 +00:00
Albert Juhé Lluveras 0e1b1e3579 Add types to packages directory (https://github.com/woocommerce/woocommerce-blocks/pull/3914)
* Add Typescript to Panel and Icon

* Fix Icon component import

* Convert packages/checkout/utils/validation/index to TypeScript

* Convert checkout registry to TypeScript

* Add return type to mustContain

* Add TypeScript to Totals components from @woocommerce/blocks-checkout

* Add TypeScript to @woocommerce/price-format

* Use types from @woocommerce/type-defs when possible

* Allow empty objects when loading

* Fix formatting in payment-method-data-context.js

* Add missing return types

* Fix up price warnings

* Fix more warnings in FormattedMonetaryAmount

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-03-05 14:03:48 +00:00
Thomas Roberts b6650ab0bc Replace uppercase Translators with translators & make comment style consistent (https://github.com/woocommerce/woocommerce-blocks/pull/3869)
* Replace uppercase Translators with translators

* Change comment style for all // translators instances
2021-02-19 11:58:44 +00:00
Albert Juhé Lluveras b2339bda5d Update Panel component class names to follow guidelines (https://github.com/woocommerce/woocommerce-blocks/pull/3860)
* Rename panel class names to follow correct guidelines

* Remove unused CSS

* Add docs page link
2021-02-17 14:48:53 +01:00
Seghir Nadir 30c2079af4 Enhance checkout filter system. (https://github.com/woocommerce/woocommerce-blocks/pull/3835)
* Add filter to extend product price

* Remove code targeting WC Subscriptions

* Rename filter

* Use extendibility API instead of filters

* Remove __EXPERIMENTAL_CART_ITEM_PRICE_FILTER from docs

* throw errors on validation

* Don't catch filter errors for admins

* Add tests

* wrap filter calls in memo

* pass extensions as top level prop

* abstract errors

* add jsdoc

* update tests

* review

* turn __experimentalApplyCheckoutFilter into a hook and move useMemo inside it

* revert name

* wrap getCheckoutFilters in useMemo

* refactor filter function so memozation is done inside components

* unify true instance

* fix rebase

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-02-17 14:01:20 +01:00
Albert Juhé Lluveras 7b829b8a82 Use cart item key instead of name as the React key in Package (https://github.com/woocommerce/woocommerce-blocks/pull/3814) 2021-02-10 12:37:58 +01:00
Albert Juhé Lluveras 1a97bf80b0 Replace filters with an extendibility API to hook into Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/3774)
* Replace filters with an extendibility API to hook into Cart and Checkout blocks

* Update docs

* Add a validate argument

* Add docs comments

* Add tests

* Add validation function

* Prefix validateElementOrString with __experimental

* Update experimental docs

* Typo

* Update comment

* Update JS docs

* Use an object for applyCheckoutFilter args

* Args doesn't need to be an object

* Wrap validation function execution in a try/catch block

* Only accept strings for the totalLabel filter

* Change applyCheckoutFilter signature
2021-02-09 17:54:38 +01:00
Albert Juhé Lluveras 77119d9a7e Update Cart and Checkout sidebar design (https://github.com/woocommerce/woocommerce-blocks/pull/3797)
* Fix ShippingRatesControl not honoring renderOption prop

* Update order summary design

* Updates TotalsCoupon design

* Update Cart block sidebar title design

* Make values bold and labels regular in Cart and Checkout sidebar

* Update styles of shipping rates selector and radio control

* Remove unnecessary overflow rule in Panel content

* Fix shipping options in Checkout block

* Add some Twenty Twenty One fixes

* Fix saved payment methods display

* Remove top spacing no longer necessary in order summary quantity badge

* turn Totals title to bold

* Move right padding from product name to item description

* Take left margin off list items in product details

This is because in themes where a left margin is applied to li elements, the product detail/addon gets indented and it does not sit flush with the edge of the product details container. Adding this rule to the main wc-block-components-product-details  rule will stop other themes indenting <li>s

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-09 09:10:45 +01:00
Seghir Nadir 1bd65bd948 Add guards to useSlot and move shared code to a new file. (https://github.com/woocommerce/woocommerce-blocks/pull/3772)
* guard against __experimentalUseSlot

* move slot to its own file

* remove todo

* add docblocks

* add docs to errorBoundary

* add docs
2021-02-08 12:37:55 +01:00
Seghir Nadir 99b78a1c9a add price package (https://github.com/woocommerce/woocommerce-blocks/pull/3790) 2021-02-04 15:30:28 +00:00
Darren Ethier b991486a84 Fix broken shipping Calculator (https://github.com/woocommerce/woocommerce-blocks/pull/3778)
* move shipping-rates-control and shipping totals back into base/components/cart-checkout

* fix notice styling

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-02-03 12:35:17 +01:00
Mike Jolley 6c3fe9e820 Move no rates logic to package (https://github.com/woocommerce/woocommerce-blocks/pull/3767) 2021-02-03 11:19:09 +01:00
Mike Jolley 7ae87ca367 Subscriptions Shipping Packages Integration Points (https://github.com/woocommerce/woocommerce-blocks/pull/3687)
* Expose schemas

* Accept strings for select shipping rate

* strings are allowed

* Refactor shipping package to hold it's own state

* Add extension data to cart hook

* Progress but state is broken

* Move state back to hook

* Progress but state is broken

* use shipping hook updates

* Fix re-render issue

* hide x1

* Shipping slot fill

* Working slot fills

* Do not export package

* Update extend usage in unit tests

* update mock test data

* Package per slotfill

* Resolved merge conflicts

* Update assets/js/blocks/cart-checkout/subscriptions-integration.js

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>

* rename slot

* deriveSelectedRates return doc

* useCallback in throwError

* final class ExtendRestApi

* spacing

* Move shipping rate selection to package level

* remove const for counts

* Remove schemas from extend

* unused use

* move to a single fill for packages

* add todos

* move subs code

* fix extra extensions

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-01-28 15:24:01 +01:00
Albert Juhé Lluveras 618a798998 Panel component: allow all kind of nodes as title (https://github.com/woocommerce/woocommerce-blocks/pull/3745)
* Allow all kind of nodes, not only React elements as Panel title

* Move period outside of link
2021-01-27 13:02:54 +01:00
Albert Juhé Lluveras 03b03380d3 Allow extensions to filter Total label (https://github.com/woocommerce/woocommerce-blocks/pull/3716)
* Allow extensions to filter totals label

* Add docs
2021-01-21 15:45:31 +01:00
Seghir Nadir 5b2b753100 Move Total components to checkout package (https://github.com/woocommerce/woocommerce-blocks/pull/3671)
* move items to package

* move components to package

* fix dep issue

* pass down classname

* move Panel and Price utils

* expose extensions

* fix import

* move cart call to inside slot

* fix unit tests

* fixes after rebase

* move ShippingRatesControl into packages/checkout

This fixes the `wc-blocks-checkout` circular dependency because `Package` was importing from `@woocommerce/checkout`.

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2021-01-20 21:35:53 +01:00
Mike Jolley 8c98c1eaac Support for multiple fee rows in the cart (https://github.com/woocommerce/woocommerce-blocks/pull/3678)
* Inject the routes controller

* Cart totals need to be calculated on cart routes or fees will be missing

* Add fees to schema and response

* Add fees to useStoreCart

* Fix styling of multiple fee rows

* Fix test shape
2021-01-13 16:57:42 +00: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