* Move Button, StoreNotice and StoreNoticesContainer components into the components package
* Delete the button folder and leave alias in index.ts
* Update references from @woocommerce/blocks-checkout to @woocommerce/blocks-components
* Add checks to see if getCartData finished before rendering address
* Prevent block error due to excessive updates of customValidation
* Do not condense address in admin and handle phone field
* Add missing showPhoneField for billing
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* 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
* 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>
* 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
* 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
* 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
* 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
* 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>
* 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>
* Add ExperimentalOrderLocalPickupPackages slot fill
* Render ExperimentalOrderLocalPickupPackages in local pickup block
* Update docs to include ExperimentalOrderLocalPickupPackages
* Use LocalPickupSelect component when rendering local pickup options
* 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
* Add wrapper for __experimentalRegisterCheckoutFilters and deprecate it
* Update internal references from __experimentalRegisterCheckoutFilters
* Add wrapper for deprecated __experimentalApplyCheckoutFilter
* Update references from `__experimentalApplyCheckoutFilter`
* 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
* 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
* 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
* 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>
* Custom validation strings using a new function named getValidityMessageForInput
* getValidityMessageForInput tests
* Added integration test for error message
* Clear value
* update test strings
* 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>
* 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>
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* 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.
* Check package length >= 1 to show package name
* Check shipping rates length in order shipping packages slot
* Fix TS error where boolean value could be undefined
* Show items if there is more than one shipping rate
* Sub/Total/Fee inner blocks
* Row blocks within the inner block
* Update icons
* Resolve stying issues
* Remove old block
* Pin totals row
* Locking logic update
* Heading inner block
* Refactor where inner blocks are defined
* Add todos
* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.
* Improve frontend registration of components using new entrypoint
* Experiment- external block context
* Revert "Experiment- external block context"
This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.
* Duplicate inner blocks to avoid conflicts with context
* Remove todo
* Rename block dir
* Some test fixes
* Fix import
* fix import
* linting
* Remove unused attributes
* Optional classname
* fix coupons import
* fix shipping mocks
* Styling
* Fix selectors in e2e tests
* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary
Because, removing them was:
- a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency
* Reuse the TotalsWrapper component for C& C blocks inner blocks
This component was removed in this PR, but we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>