Commit Graph

141 Commits

Author SHA1 Message Date
Thomas Roberts e2b8083883 Update `postcode-validator` to 3.8.15 to validate "new" Taiwanese postcodes (https://github.com/woocommerce/woocommerce-blocks/pull/10924) 2023-09-15 07:05:01 -07:00
Niels Lange 0c74f96e8f Add custom regex for validating Nicaraguan postal codes (https://github.com/woocommerce/woocommerce-blocks/pull/10928) 2023-09-15 03:16:04 +00:00
Hritik Chaudhary 4199533688 Fixed newly detected broken links (https://github.com/woocommerce/woocommerce-blocks/pull/10537)
* Update check-doc-links.yml

* Update check-doc-links.yml

* Update check-doc-links.yml

* Update check-doc-links.yml

* POC: Exclude releases folder from MD link check using “ignorePatterns”

* Update check-doc-links.yml to use tcort/markdown-link-check

* Update check-doc-links.yml to use existing config

* reverted check-doc-links-config.json

* fixed broken links

* fixed broken links and generated docs

* updated docs

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2023-08-22 11:51:18 +02:00
Mike Jolley 4fd16267be Refactor Push Changes Readability and Performance (https://github.com/woocommerce/woocommerce-blocks/pull/10315)
* Add local state to address-form

* Update test with valid postcode and required fields

* Push changes refactoring

* Avoid loops due to retrying same data

* Callbacks to prevent rerenders

* Move validation functions

* Filter incoming values to only those included as fields to prevent errors

* Keep track of country changes to prevent excessive updates of addressFormFields.

* Use helpers in test

* Fill company

* Revert local state in address form

* Update address form to remove validation handling for postcode (country clears the field).

* Revert "Update test with valid postcode and required fields"

This reverts commit 718a6006df24f6e957297ad4d1ef9d6f690793bd.

* Clear postcode when country changes if invalid

* Revalidate fields when country changes

* Comment for pick

* Revert unneccessary test change

* Revery moving of functions to reduce diff size

* Increase push timeout in tests

* Revert test changes
2023-08-09 18:24:51 +01:00
Mike Jolley 2d530a7d5e Refactor ValidatedTextInput and AddressForm usage (https://github.com/woocommerce/woocommerce-blocks/pull/10309)
* Refactor ValidatedTextInput and AddressForm usage

* Remove formatting from onChange

* update useeffect dependencies

* Update validation text

* Style fields without floats (https://github.com/woocommerce/woocommerce-blocks/pull/10310)
2023-08-03 12:02:20 +01:00
Albert Juhé Lluveras df3ff6793e Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831)
* Clean up blank lines

* Update Webpack config

* Update PHP logic to load block styles

* Style fixes

* Style fixes (II)

* Style fixes (III)

* Style fixes (IV)

* Fix missing stylesheets in the Site Editor

* Fix wrong return values in some PHP method docs

* Fix missing ProductPrice stylesheet causing 404 in tests

* Fix missing ProductGallery stylesheet causing 404 in tests
2023-07-04 13:06:48 +02:00
Paulo Arromba f1df8fb975 Add Cart/Checkout/Order-Received Templates (https://github.com/woocommerce/woocommerce-blocks/pull/9301)
* WIP: dirty attempt to dry run Cart & Checkout templates

* Added Cart and Checkout to the template hierarchies

* Merge branch 'trunk' into poc/cart_and_checkout_fse_templates

* Updated cart & Checkout templates

* Order Received FSE template (https://github.com/woocommerce/woocommerce-blocks/pull/8937)

* Order Received template bootstrap

* typo

* WIP: new block

* add logic here

* Order received classic template

* reverted constants.ts

* Added the post title (buggy)

* Corrected page title

* Updated constants.ts

* Fixed template typo

* removed placeholder for order received block

* add order-received template description

* updated placeholder description

* Formatting fixes

* Template description.

* replaced hardcoded string with OrderReceivedTemplate::SLUG

---------

Co-authored-by: Luigi <gigitux@gmail.com>

* Code formatting (https://github.com/woocommerce/woocommerce-blocks/pull/8350)

* Code formatting

* page_template_hierarchy priority to 1 (https://github.com/woocommerce/woocommerce-blocks/pull/9323)

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Migrate Cart and Checkout Pages to the Template Editor when using a FSE theme (https://github.com/woocommerce/woocommerce-blocks/pull/9339)

* Introduce woocommerce_blocks_template_content hook

* Migrate cart and checkout page content to the template editor

* Add redirection from edit page to edit template

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Removed header and footer from checkout template. (https://github.com/woocommerce/woocommerce-blocks/pull/9378)

* Removed header and footer from checkout template.

* Removed header and footer from checkout template migration

* Permalink solution for the checkout endpoint/template (https://github.com/woocommerce/woocommerce-blocks/pull/9406)

* Checkout endpoint work

* Move setting field to util

* Include link to edit the template

* Remove todo

* Refactor checkout templates to share logic (https://github.com/woocommerce/woocommerce-blocks/pull/9411)

* Sync endpoints with pages (https://github.com/woocommerce/woocommerce-blocks/pull/9426)

* Switch to page syncing

* Update settings descriptions

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Migrate pages to templates once (https://github.com/woocommerce/woocommerce-blocks/pull/9488)

* Migrate content on init, once

* Skip migration if page does not exist

* Put back HTML for header and footer parts

* Fix page redirect due to wrong ID

* fix loading template part

* Removed unnecessary var

* update cart and checkout html templates

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Include a notice to redirect user to template editor (https://github.com/woocommerce/woocommerce-blocks/pull/9508)

* Template Placeholder Design for the Order Received Template (https://github.com/woocommerce/woocommerce-blocks/pull/9602)

* Load frontend styles in editor iframe

* Update placeholder to include skeleton and updated icons

* Update classic template configs

* 1px border for .wp-block-woocommerce-classic-template__placeholder-copy

* Show copy on focus

* Sample data

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Add simplified header on checkout template (https://github.com/woocommerce/woocommerce-blocks/pull/9607)

* Added simplified header on checkout template

* Moved simplified header to template part

* updated constants.ts

* added template part to checkout.html

* Add missing translation

* frontpage_template_hierarchy no longer needed

* Allow plugin based template parts (https://github.com/woocommerce/woocommerce-blocks/pull/9667)

* Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates

* Synced templates on blockified folder

* Add blockified order-received.html

* removed WooCommerce prefix

* Refactor/rebrand order received template to order confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/9734)

* rebrand order received to order confirmation

* updated descriptions for templates

* updated descriptions for order confirmation placeholder

* Resolve merge conflict

* Resolve merge conflicts

* Resolve more merge conflicts after rebase

* Fix formatting

* Use patterns for localisation (https://github.com/woocommerce/woocommerce-blocks/pull/9883)

* e2e tests for cart and checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/9939)

* Merge branch 'trunk' into poc/cart_and_checkout_fse_templates

* Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates

* Resolve merge conflicts

* Add e2e for permalink settings

* Test that templates exist

* Add test to check that templates can be edited

* Add tests to confirm templates can be edited

* Ensure cart has contents before running tests on frontend views

* Commend out problem test

* Make sure search has multiple results

* Remove useThrottle - bad rebase

* Revert changes to docs after rebase

* Revert function call for noReviewsPlaceholder

* Bad rebase

* Reverts

* Remove revertTemplate

* Spacing

* Wait for networkidle after navigation

* Always wait for network

* Use button roles in site editor

* More specific button locator

* Update option comparison

* Fix template content

* Disable failing tests

* Disable failing classic template tests

* Use enterEditMode

* More enterEditMode usage

* enterEditMode

* Use test.skip

* More robust selectors

* Alt iframe selector

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Skip flakey test

---------

Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-06-29 14:41:22 +01:00
Niels Lange 0d94479bbe Update README.md 2023-06-16 13:59:30 +02:00
Tarun Vijwani f6a827b639 Fix Cambodian postal code validation (https://github.com/woocommerce/woocommerce-blocks/pull/9597)
-Fix the postal code validation for Cambodia to accept 6 digit postal code instead of 5 digit.
2023-05-26 17:56:55 +04:00
Albert Juhé Lluveras 2b6eef516b Update Mini-Cart block editor sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/9420)
* Update Mini-Cart block editor sidebar

* Rename Mini Cart block to Mini-Cart

* Update Mini-Cart block editor sidebar (II)

* Update two instances of mini-cart to uppercase
2023-05-11 14:52:03 +02:00
Tarun Vijwani e39a27bd74 Add theme-level global styles to Cart and Checkout block (https://github.com/woocommerce/woocommerce-blocks/pull/8809)
* Dummy commit to open a PR

* Revert the last change

* Ensure Checkout block supports the theme-level global styles for `Colors » Buttons` (https://github.com/woocommerce/woocommerce-blocks/pull/8844)

* Add GS support for button colors in Checkout block

* Sync button hover effect with GB

* Fix link margin/padding (https://github.com/woocommerce/woocommerce-blocks/pull/8908)

* Replace <AddToCartButton /> with <ProductButton /> (https://github.com/woocommerce/woocommerce-blocks/pull/8914)

* Add GS support for button typography in Checkout block (https://github.com/woocommerce/woocommerce-blocks/pull/8918)

* Ensure Checkout block supports the theme-level global styles for Typography » Buttons (https://github.com/woocommerce/woocommerce-blocks/pull/8892)

* Remove classname from cart image to avoid conflicts (https://github.com/woocommerce/woocommerce-blocks/pull/8898)

Co-authored-by: Niels Lange <info@nielslange.de>

* Use consistent and semantically correct HTML elements in the Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/9065)

* Allow button height to adjust

* Ensure to display full width heading background

* Inherit font style and font weight for headings

* Inherit font style and font weight for textarea

* Inherit font family and font weight for buttons

---------

Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-04-22 00:11:10 +04:00
Siddharth Thevaril b3acdea73c add cursor:pointer to checkbox and radio fields (https://github.com/woocommerce/woocommerce-blocks/pull/9102)
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-04-20 12:40:02 +07:00
Domenico Nusca 7dcb7768b2 decode entities for display in TextInput (https://github.com/woocommerce/woocommerce-blocks/pull/9117)
Co-authored-by: Domenico <dom@digitaltroop.net>
2023-04-19 17:53:26 +01:00
Alba Rincón 709a7a9add [Mini cart] Make the title customizable (https://github.com/woocommerce/woocommerce-blocks/pull/8905)
* Create the counter block and the header pattern

* Change the pattern to an inner block

* Allow customizing item counter block

* Rename block

* Allow removing the items counter block

* Add padding controls

* Preload new blocks

* Add title block back from the inserter

* Move h2 tag to the parent title

* Align items at the bottom

* Unify styles

* Add title class in the editor

* Prevent removing title blocks

* Disallow unlocking and inserter

* Disallowing moving blocks
2023-04-14 09:21:21 +02:00
Thomas Roberts e30c0f5463 Add `validateOnMount` prop to `ValidatedTextInput` (https://github.com/woocommerce/woocommerce-blocks/pull/8889)
* Add validateOnFirstFocus prop

* Only run validation on first focus if validateOnFirstFocus is true

* Rename validateOnFirstFocus to validateOnMount

* Set TotalsCoupon to not validate when the input is mounted

* Add tests for validation error handling

* Fix test that was not making a good assertion

* Add tests for validateOnMount functionality

* Clean up validateOnMount logic, make the code more readable & efficient
2023-04-11 01:50:59 -07:00
Thomas Roberts eea5ea3aad Prevent error when entering postcode for countries without specific validation rules (https://github.com/woocommerce/woocommerce-blocks/pull/8987)
* Allow countries not covered by postcode-validator to pass validaiton

* Add "skipPushCheck" option when filling billing and shipping details

* Allow albania as a shipping/selling country

* Add test to ensure adding a postcode for a country without rules works

* Remove skipPushCheck option

no longer needed
2023-04-10 03:13:23 -07:00
Mike Jolley 7a89cecb6b Feature Branch: Updated Shopper Notices (https://github.com/woocommerce/woocommerce-blocks/pull/8659)
* Notice banner component

* Snackbar support

* Switch to new components

* Finish snackbar implementation

* Summary notice

* Styling issues

* Fix text wrap in shipping calculator

* Storybook entries

* Docs and tests for NoticeBanner

* Framer motion to avoid components dependency

* Snackbar list stories

* Docs for snackbar list

* Update assets/js/base/components/notice-banner/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/components/notice-banner/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/components/notice-banner/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/components/notice-banner/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/components/notice-banner/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Types/docblocks

* Docs

* Update notice type

* Use NoticeBannerProps for type of noticeProps

* Raw html to fix notice encoding

* getClassNameFromStatus is unused

* Update position text

* Clarify notice text

* Fix hover style in whisper TT3 theme

* remove div styles

* Add new templates for legacy buyer notices in WooCommerce core (https://github.com/woocommerce/woocommerce-blocks/pull/8732)

* Add templates for legacy core notices

* Update src/Domain/Services/Notices.php

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Remove debugging code

* DRY get_notices_template

* Simplify error template

* Fix padding

* Only include new notices if using block cart/checkout

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Fix view box tag

* Hover and focus styles

* Styling when notices added via ajax

* Remove margin change

* Implement react-transition-group instead of framer (https://github.com/woocommerce/woocommerce-blocks/pull/8920)

* Add screenshots to docs

---------

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-04-05 13:43:03 +01:00
Alba Rincón 2d9519b3ba Add style to the `Mini Cart` buttons (https://github.com/woocommerce/woocommerce-blocks/pull/8776)
* Create new car button inner block

* Create new checkout button inner block

* Render inner buttons on the frontend

* Fix buttons size

* Add outline to the cart button

* Add color props

* Add urls

* Fix button classes

* Add classes to edit

* Start using editable button

* Add buttons to mini cart tempalte

* Reorder buttons in template

* Add cart & checkout buttons scripts

* Remove unnecessary divs

* Change checkout button block name

* Change cart button block name

* Add deprecation to the buttons

* Fix lint and inline save

* Remove commented out code and fix condition

* Render buttons if no children

* Change migrate condition

* Simplify condition

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

* Make props optional

* Add missing import

---------

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2023-03-23 16:55:53 +01:00
Albert Juhé Lluveras 5235f6c392 Allow themes to remove the Mini Cart title on overridden template parts (https://github.com/woocommerce/woocommerce-blocks/pull/8779)
* Allow themes to remove the Mini Cart title on overridden template parts

* Remove unused file
2023-03-22 08:23:52 +01:00
Niels Lange 83b5019e4d Add client side postcode validation (https://github.com/woocommerce/woocommerce-blocks/pull/8503)
* Add client side postcode validation

* Prevent server-side validation

* Adjust translation

* Only validate postcode if country is available

* Specify return type of isPostcode()

* Convert function to static variable set

* Refactor <ValidatedTextInput> for postcode validation

* Refactor customValidationHandler

* Use customValidationHandler as intermediate function

* Hyphenate file names

* Update packages/checkout/utils/validation/is-postcode.ts

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

* Normalise postcode on input

* Fix usage of out of date value from input field

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-03-14 19:37:28 +07:00
Thomas Roberts bee8a74150 Add `ExperimentalOrderLocalPickupPackages` Slot/Fill (https://github.com/woocommerce/woocommerce-blocks/pull/8636)
* Add ExperimentalOrderLocalPickupPackages slot fill

* Render ExperimentalOrderLocalPickupPackages in local pickup block

* Update docs to include ExperimentalOrderLocalPickupPackages

* Use LocalPickupSelect component when rendering local pickup options
2023-03-13 12:00:02 +00:00
Thomas Roberts aa83cae9bc Add filter to change proceed to checkout button text and URL (https://github.com/woocommerce/woocommerce-blocks/pull/8613)
* Fix up typescript of checkout filters

* Clear cached values when adding new filters

* Allow href on WPButton type

* Specify generic type of getSetting for checkout page link

* Apply filters to Proceed to Checkout button

* Add unit tests for proceed to checkout button and link filters

* Make cart extend a plain object

* Pass cart in args for proceed to checkout filters

* Add documentation for proceed to checkout filters

* Add unit test for multiple filter registration

* Change word to bump stuck GitHub actions

* Apply consistent casing to test names
2023-03-13 14:34:12 +07:00
Albert Juhé Lluveras 1d0adeed28 Replace react imports with wordpress/element (https://github.com/woocommerce/woocommerce-blocks/pull/8520)
* Replace react imports with wordpress/element

* Fix TS errors

* Update a couple of React type imports
2023-03-02 15:26:00 +01:00
Thomas Roberts 44715355aa Add link to PR that deprecated experimental functions (https://github.com/woocommerce/woocommerce-blocks/pull/8430)
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2023-02-15 13:00:42 +01:00
Thomas Roberts 3797418079 Graduate `__experimentalApplyCheckoutFilter` and `__experimentalRegisterCheckoutFilters` to stable. (https://github.com/woocommerce/woocommerce-blocks/pull/8346)
* Add wrapper for __experimentalRegisterCheckoutFilters and deprecate it

* Update internal references from __experimentalRegisterCheckoutFilters

* Add wrapper for deprecated __experimentalApplyCheckoutFilter

* Update references from `__experimentalApplyCheckoutFilter`
2023-02-13 03:30:09 -08:00
Thomas Roberts 73788d4378 Prevent coupon error being removed when blurring the input and fix tests (https://github.com/woocommerce/woocommerce-blocks/pull/8349)
* Prevent coupon error disappearing on blur if value unchanged

* Check for inline selector on coupon error

* Prevent coupon error disappearing on blur if value unchanged

* Check for inline selector on coupon error

* Update selector for coupon E2E test
2023-02-13 03:11:00 -08:00
Seghir Nadir 54ad47e53b Handle single notice issues (https://github.com/woocommerce/woocommerce-blocks/pull/8404)
* Capture notices from hidden block into siblings block

* switch to using a single context

* make change bwc

* support context as array in StoreNotice

* Handle single context use cases
2023-02-09 16:04:02 +01:00
Seghir Nadir b396584e50 Capture notices from hidden block into siblings block (https://github.com/woocommerce/woocommerce-blocks/pull/8390)
* Capture notices from hidden block into siblings block

* switch to using a single context

* make change bwc

* add tests

* support context as array in StoreNotice

* move filter logic to Notice component
2023-02-09 14:41:18 +01:00
Mike Jolley 435e341fe6 Expose cart errors as notices (https://github.com/woocommerce/woocommerce-blocks/pull/8162)
* Scroll to errors when interacting with radio buttons

* Fix full stop wrapping in checkout

* Make type guard for api response reusable

* Merge useShippingData  and useSelectShippingRate

Overlapping functionality and responsibility easily merged into a single hook.

* ShippingDataProvider Typescript

* Create errors when receiving errors via thunk

* Update DEFAULT_ERROR_MESSAGE

* Update tests since all errors are set via new action

* Correct SET_ERROR_DATA

* Update json error text and allow it to be dismissed

* Add back missing comment in types

* Put back typedef

* Allow Store Notice Containers to display subContexts without changing original context

* receiveError handles cart

* Update assets/js/data/cart/notify-errors.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/context/hooks/shipping/types.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Remove debug

* Revise type (remove as)

* rename to unregisteredSubContexts

* getNoticeContexts comment

* Add test for unregistered errors

* Update comment

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-01-19 16:40:52 +00:00
Mike Jolley db96991492 Custom validation messages using the field name/label (https://github.com/woocommerce/woocommerce-blocks/pull/8143)
* Custom validation strings using a new function named getValidityMessageForInput

* getValidityMessageForInput tests

* Added integration test for error message

* Clear value

* update test strings
2023-01-13 15:54:35 +00:00
Mike Jolley c611635179 Handle Local Pickup Selection in the Cart (https://github.com/woocommerce/woocommerce-blocks/pull/7958)
* Shipping and collection method block package support (https://github.com/woocommerce/woocommerce-blocks/pull/7383)

* Shipment wordage

* Hide panel if collection is not available for an item

* Update selection when displayed

* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)

* Register a blocks local pickup method globally

* Remove local pickup plucking from store api

* Multiple pickup locations

* Unused code

* Translate meta data

* Update UI to match zones table

* Description

* Handle new shipping method in client

* Improve location rendering

* Only split out pickup location methods

* Fix enabled toggle

* Show and hide shipping text in sidebar based on pickup

* No need for "from" when min and max are the same price

* Update sample data for the editor

* fix errors

* Force method/pickup in the checkout layout (https://github.com/woocommerce/woocommerce-blocks/pull/7910)

* Split up ShippingRatesControl for readability

* Alignment styling

* Split tidy packages for readability

* Combine hooks to prevent circular dependency

* Notice styling

* Conflict

* Hide notice with 1 package

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-12 15:42:43 +01:00
Mike Jolley 82e9155167 Rename collection to shipping to reflect the block purpose 2023-01-12 15:38:06 +01:00
Mike Jolley 23b175d246 Create Pickup Locations Block (https://github.com/woocommerce/woocommerce-blocks/pull/7316)
* prefersCollection controls shipping visibility

* Remove log

* Create skeleton pickup options block based on shipping methods

* Filter locations to local pickup methods

* Correct case of block name

* Location styling

* Pull pickup details from new core fields

* Fix linting warnings on new types

* Remove blocks_local_pickup check (this does not exist yet)

* Move enable_local_pickup_without_address so it works under all contexts

* Fix display of FREE when there are a mix of prices

* Remove undefined return value

* Update block descriptions

* fix message

* Correct case

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-12 15:35:57 +01:00
Nadir Seghir 9ee5b40186 Introduce shipping method toggle block 2023-01-12 15:34:44 +01:00
Niels Lange aae39f5266 Simplify @woocommerce/types imports (https://github.com/woocommerce/woocommerce-blocks/pull/8019)
* Simplify @woocommerce/types imports

* Fix TS errors
2022-12-23 18:59:02 +07:00
Mike Jolley ece76603bb Split out dismissible notices (https://github.com/woocommerce/woocommerce-blocks/pull/8018) 2022-12-22 14:15:33 +00:00
Mike Jolley 9e00b015fc New contexts for `StoreNoticesContainer` and notice grouping (https://github.com/woocommerce/woocommerce-blocks/pull/7711)
* Refactor Store Notices

Move snackbar hiding filter before notice creation

Implements showApplyCouponNotice

Refactor context providers

Use STORE_NOTICE_CONTEXTS

use refs to track notice containers

Refactor ref usage

Use existing noticeContexts

* Move new notice code to checkout package

* Combine store and snackbars

* Update noticeContexts imports

* Remove context provider

* Update data store

* Fix 502

* Add new error contexts

* Force types

* Unnecessary reorder of imports

* Fix global handling

* Document forceType

* Optional props are undefined

* Remove function name

* Missing condition

* Remove context prop

* Define ACTION_TYPES

* Remove controls

* Update assets/js/base/context/event-emit/utils.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* CONTACT_INFORMATION

* Remove ref from registerContainer

* Abstract container locating methods

* pass context correctly when displaying notices

* Remove debugging buttons

* Update filter usage - remove useMemo so filter can work inline

* Refactor existing error notices from the API (https://github.com/woocommerce/woocommerce-blocks/pull/7728)

* Update API type defs

* Move create notice utils

* Replace useCheckoutNotices with new contexts

* processCheckoutResponseHeaders should check headers are defined

* Scroll to error notices only if we're not editing a field

* Error handling utils

* processErrorResponse when pushing changes

* processErrorResponse when processing checkout

* remove formatStoreApiErrorMessage

* Add todo for cart errors

* Remove unused deps

* unused imports

* Fix linting warnings

* Unused dep

* Update assets/js/types/type-defs/api-response.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Add todo

* Use generic

* remove const

* Update array types

* Phone should be in address blocks

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update store name to wc/store/store-notices

* Fix assertResponseIsValid

* Funnel woocommerce_rest_invalid_email_address to the correct place

* woocommerce_rest_missing_email_address

* Move comments around

* Move data back into const

* Spacing

* Remove spacing

* Remove forced snack bar and styling

* Move notices within wrapper

* Remove type

* hasStoreNoticesContainer rename

* Group by status/context

* Remove global context

* Remove white space

* remove changes to simplify diff

* white space

* Move comment to typescript

* List style

* showApplyCouponNotice docs

* See if scrollIntoView exists

* fix notice tests

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-12-19 15:30:13 +00:00
Seghir Nadir b58c5beb3e Handle multiple packages coming from slots (https://github.com/woocommerce/woocommerce-blocks/pull/7829)
* Handle multiple packages coming from slots

* fix missing prop

* fix typo

* remove collapse param

* rename trinary to ternary
2022-12-15 15:17:22 +01:00
Mike Jolley bc17c19262 ValidatedTextInput fields should validate on mount (https://github.com/woocommerce/woocommerce-blocks/pull/7888)
* Validate on mount

* Update e2e text for email validation check

* Markdown linting
2022-12-08 12:14:14 +00:00
Mike Jolley 6c438acb5c Fixes validated text input tests (https://github.com/woocommerce/woocommerce-blocks/pull/7859) 2022-12-06 16:22:34 +00:00
Mike Jolley 7758ee05fe Improve inline validation to avoid invalid server pushes (https://github.com/woocommerce/woocommerce-blocks/pull/7755)
* Allows custom validation rules to be applied to fields - in this case, email address

* Add local state to only push valid changes

* Do not need required

* unused isString

* Move to push level

* Update packages/checkout/components/text-input/validated-text-input.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update packages/checkout/components/text-input/validated-text-input.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update packages/checkout/components/text-input/validated-text-input.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update packages/checkout/components/text-input/validated-text-input.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Validate when the data store changes

Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-12-06 13:13:21 +00:00
kmanijak 796e952b92 Align text sizing in filter blocks: chips, checkboxes, buttons, dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/7707)
* Align the font-size of checkbox-control component to the price slider amount

* Align the font-size of Price Slider Button to the price slider amount

* Align the font-size of Filter Reset Button to the price slider amount

* Align the font-size of Clear All Button to the price slider amount

* Align the font-size of Apply button in Editor to the price slider amount

* Align the font-size of Apply button in Frontend to the price slider amount

* Align the font-size of Price Slider Amount to the standard size

* Align the font-size of Active Filter chips to the price slider amount

* Align the font-size of Filter by Price (text) to the price slider amount

* Align the font-size of Filter by Attribute (dropdown) to the price slider amount

* Align the font-size of placeholder of Filter by Attribute (dropdown) to the price slider amount

* Change font-size for text in filters from font-size(smaller) to font-size(smaller)

As a result of discussion in PR it was agreed to check the styles with bigger font size hence the change

* Align the font-size of input text of Filter by Attribute (dropdown) to the price slider amount

* Change margin-right of checkbox-control to relative value so it better adapts to the fonts
2022-11-29 16:42:24 +01:00
Thomas Roberts 8087adc49d Move `StoreNoticesContainer` to `@woocommerce/blocks-checkout` package and add tests (https://github.com/woocommerce/woocommerce-blocks/pull/7558)
* Move StoreNoticesContainer to checkout package & convert to TS

* Update @types/wordpres__notices version

* Export StoreNoticesContainer from checkout package

* Remove PropTypes from StoreNoticesContainer

* Remove store-notices/index file

* Update import of StoreNoticesContainer

* Remove store notices export

* Add docblock to StoreNoticesContainer component

* Add tests for StoreNoticesContainer

* bot: update checkstyle.xml

* Fix typo and incorrect component name

* Update import for StoreNoticesContainer

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-17 05:33:58 -08:00
Thomas Roberts 32c402413a Update ValidatedTextInput TypeScript & move to `@woocommerce/blocks-checkout` (https://github.com/woocommerce/woocommerce-blocks/pull/7583)
* Move ValidatedTextInput and ValidationInputError to checkout package

* Include checkout package in tsconfig file

* Remove unnecessary index file

We export these components from packages/checkout/index.js instead

* Import ValidatedTextInput & ValidationInput error from checkout package

* Only add validationError.message when validationError is an object

* Explicitly add undefined to optional props

* Import isObject to test validationError

* Extend the HTML Input element attributes

* Use more performant useDispatch instead of dispatch

* Export component without withInstanceId hoc for testing

* Add tests for ValidatedTextInput

* bot: update checkstyle.xml

* Rename export of unwrapped component to have __

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-10 02:05:41 -08:00
Alba Rincón 6ca9f90c44 Fix ESLint errors (https://github.com/woocommerce/woocommerce-blocks/pull/7556)
* Add type to imports that need it

* Add type to imports that need it

* Fix the sanitize lint error

* Include missing dep

* Remove check from deps

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-02 17:46:14 +01:00
Alex Florisca 4a82b73baf Fix failing filter test (https://github.com/woocommerce/woocommerce-blocks/pull/7253) 2022-09-30 08:38:34 +07:00
Niels Lange c360c5654a Add filter for place order button label (https://github.com/woocommerce/woocommerce-blocks/pull/7154)
* WIP add filter for place order button label

* Solve TS issue

* Add display priority

* Refactor display priority

* WIP Implement useMemo()

* Try using a global cache

* Add docs for placeOrderLabel filter

* Update docs/third-party-developers/extensibility/checkout-block/available-filters.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Adjust docs

* Rename “placeOrderLabel” to “placeOrderButtonLabel”

* Update assets/js/types/type-defs/payments.ts

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-09-29 15:46:10 +07:00
Niels Lange 3d55668983 Create Cross-Sells product list (https://github.com/woocommerce/woocommerce-blocks/pull/6645)
* Create Cross-Sells product list

* Show “Read more” button for out-of-stock cross-sells products

* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/blocks/cart/cart-cross-sells-product-list/index.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Remove obsolete isLoading and placeholderRows

* Fix TS errors

* Rename crossSellsProduct to product

* Fix critical error

* Lock “Cart Cross-Sells products” inner block

* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.json

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>

* Prevent moving of the Cross-Sells block

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-09-21 13:04:15 +07:00
Niels Lange 2f52565c75 Correct broken *.md links (https://github.com/woocommerce/woocommerce-blocks/pull/7108) 2022-09-12 11:29:24 +07:00
Tom Cafferkey a07cc3c978 Update Filter by Stock block (https://github.com/woocommerce/woocommerce-blocks/pull/6883)
* Update Filter by Stock controls and UI to include custom checkbox and settings.

* Include and style Filter by Stock reset button

* Make checkbox accessible via keyboard

* Update snapshot tests for Filter Products by Stock component

* Update E2E tests with new label value

* Update label test for Apply Filters in E2E tests

* Specify checkbox type so styles are not overridden in the editor

* Update E2E test label for filter button

* Update label selector to search for containing text rather than exact match

* Escape quotation marks for label query in E2E shopper tests for Filter by Stock

* Correct typo on Filter by Stock controls

* Replace custom checkbox with CheckboxControl component from the checkout package.

* Remove opacity on product count for checkbox label so its the same color as the label.

* Update snapshot tests with new component usage for filter by stock

* Update block title from Filter Products by Stock to Filter by Stock

* Update reset button behaviour to clear selections immediately regardless of whether the Apply Filters button is active or not.

* Pass option value as ID to satisfy E2E tests

* Update snapshot tests for stock filter

* Reset checked state on reset for when they have filters checked but not applied.
2022-08-19 09:04:04 +01:00