* 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>
* Add memoized/cached filter runs
* Add function to check equality of object's members
* Add function to check equality of arg and extensions vs prev values for a filter name
* Memoize/Cache values of previously run filters
* Add docs and null check to shallow equality check
* Update packages/checkout/filter-registry/index.ts
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Revise Storybook entries for Checkout Blocks/totals components
Revise Storybook entries for Checkout Blocks/totals components
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Fix a typo in the Item label value
* set disable value for description and disable control for 'showRateAfterTaxName' prop
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Add address-related items to wc/store/cart data store
* include shippingAsBilling in return value of useCustomerData
* Add useUpdateCustomerData hook
This allows us to have a single hook responsible for updating the customer information on the server.
* Add useUpdateCustomerData hook in Checkout block
* Remove the updating customer data work from the useCustomerData hook
* Remove shippingAsBilling from previousCustomerData ref type
* Add useShippingAsBillingCheckbox hook
* Control shippingAsBilling from single hook
* Remove checkbox handling from useCheckoutAddress
* Remove CustomerDataContext typedef
* Merge with woocommerce/woocommerce-blocks#5810 changes
* Move shipping as billing to checkout state context provider
* Unused import
* Subscribe to changes
* Only receiveCartContents when updating customer data via checkout
* Cache customerDataToUpdate
* rename debounced function
* Combine customerDataType and customerDataContextType
* Change case of CustomerDataType
* debouncedUpdateCustomerData typo
* Fix notice context
* Clean up inline docs for push changes
* Comment on dirty state
* Phone is always set
* shippingAddress is never undefined
* setBillingPhone
* receiveCartContents explanation
* Tweak customerData to avoid null
* useShippingAsBilling
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Pass context information about containing block to the existing Slots
* Fix images added to the Slots docs
* Use the parent's block name for the context prop passed to Slot fills
* Add links to single routes in main index woocommerce/woocommerce-blocks#4473
* Footer
* Feedback template
* Remove footer from existing MD files
* Add doc footer script
* Apply script to all docs
* Fix examples
* Remove atom icon
* Swap icon usage to WordPress package
* remove unused icons from library
* Use @wordpress/primitives
* Product cats block to listView
* On-sale to use percent instead of tag icon
* add to cart button use button icon
* on sale products block icon
* Handpicked products use stack icon
* Products by stock box icon
* Make sparkles woo purple
* Fix icon name
* Correct more tag name
* fix path to icons
* Update snaps
* Update readme to explain updated usage
* Import SVG and path from primitives
* Missing isFeaturePluginBuild
* Update assets/js/icons/README.md
Co-authored-by: Raluca Stan <raluca.stan@automattic.com>
* Update assets/js/icons/README.md
Co-authored-by: Raluca Stan <raluca.stan@automattic.com>
* Update assets/js/icons/README.md
Co-authored-by: Raluca Stan <raluca.stan@automattic.com>
* update lock
Co-authored-by: Raluca Stan <raluca.stan@automattic.com>
* Remove Storybook knobs
They are now fully replaced by controls
* Update Storybook to 6.4.9
* Add Storybook documentation and VSCode snippets
* Add VSCode snippets
* Convert stories from checkout packages and include them in Storybook
* add view switcher for mini cart contents block
* editor view switcher
* update mini cart template file
* render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
* update selector
* allow empty mini cart block to add all blocks
* fix tests; improve code style
* install @wordpress/block-editor package
* fix warning on frontend side
* block-editor package is not necessary
* merge attributes object
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Convert ReturnToCartButton component to TS
* Convert FormStep component to TS
* Remoe proptypes from FormStep and AddressFormn components
* Converted order-summary component to TS
* Convert product-price component to TS
* alias path to type-defs
* Fix errors
* Changes from Thomas feedback
* Change minPrice maxPrice logic to be more robust
* Changed types from inline to interface in ReturnToCartButton component
* Check for string type in order-summary-item
* add missing isString check
On the front-end, checkboxes with labels would look squished when the labels wrapped
on a second line. That was due to the flex container taking too much space for the label
as the checkbox minimum dimensions was set in `px` rather than `em`, making it work
differently depending on the relative font size.
* Reference the WooCommerce DEWP instead of WPDEWP
* Apply suggestions from code review
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Format with decimal and thousands, with tests
* Update packages/prices/utils/price.ts
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* move empty cart
* remove Cart and rename Cart i2 to Cart
* graduate blocks
* setup template migration from Cart i1 to Cart i2
* back to js so we have a good diff
* add migration
* fix bug in empty cart template
* add useForceLayout hook to edit
* migrate from old block to new block
* migrate styles
* respect align
* add tests
* Include latest cart line item improvements from cart-i1
* Missing changes from cart-i1
* Line items table should be disabled
* Fix e2e tests for cart i2
* update tests to adapt for inner blocks
* update select to resolveSelect to remove warning checker
* rename test/block to test/index
* move blocks to their own file
* undo rename to keep diff clean
* remove .tsx and update jest config
* Revert "update select to resolveSelect to remove warning checker"
This reverts commit 79d55de30edcfe36bbdfe7506df7a09460824f03.
* revert resolveControl
* Fix empty cart editor E2E test by scrolling to the view switch
* parse attributes for order summary block
* migrate attributes when resaving
* Update documentation
Automatic update after running npm run build:docs
* add align options to filled cart and empty cart
* append instead of replcae
* import style.scss in frontend
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* add handleMap
* remove useValidation from cart blocks
* add namespace options to docs
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* expand on the docblock
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* WIP getting to work on frontend
* restore frontend.tsx
* fix layout
* remove unit tests living where they shouldn't be living
* remove skeleton
* support emtpy cart in frontend
* remove extra todo
* use fragment instead of div
* Add empty cart event
* Remove extra fragment
* Remove i2 from build
* Remove i2 php registration
* Rename old checkout dir
* Rename i2 dir
* Migrate i1 to i2 code
* Register block metadata to fix frontend rendering when migrating to i2
* Register in correct order
* Missing styles
* add register-components to side effectful list
* wrong block class in e2e test
* wp prefix missing on selector
* Fix top level block test
* Reselect labels to work around rerendering
* missing empty cart styles
* Consolodate duplicate styles
* remove init code
* update selectBlockByName
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Update registry to register components with block JSON metadata
* Use updated registration API in sample block
* remove editorScript
* Rename area and allow forced blocks to do it's thing without defining a template manually
* More naming consistency
* Validate a registered checkout block has at least one valid parent
* Append forced blocks
* Fix child detection
* Improve render logic to remove clone element
* Areas instead of block names
* Revert "Areas instead of block names"
This reverts commit c8d68e6424313ed15ca1eb1f91a3edfc24d06a8d.
* revert area change
* Registration system
* Refactor block registration to handle components + forcing
* Remove need for atomic block registration
* add attributes to namespaced blocks only
* Update area names to new format
* Avoid passing custom props to DOM
* Put back usage of cloneelement for DOM elements
* correct case of innerBlockAreas
* Inline documentation for renderParentBlock
* Play nice with other attributes when registering forced blocks
* remove todo from sample block
* Add newsletter block
* Block registration
* Move provider/processor so separate them from context providers
* customData implementation for setting customData for requests
* Make data and schema callbacks optional in extendrestapi class
* schema_type should be data_type
* Allow checkout endpoint to be extended
* Support validation, sanitization, and defaults on nested REST properties
* Experimental endpoint data for newsletter field
* Add extension data to requests
* SET_EXTENSION_DATA
* Update types
* Add todo
* move check within hook function
* Remove newsletter block
This is because we're testing with the integration being done in a separate extension
* Delete newsletter subscription block
* Pass the result of hooks down to the children blocks
We need to do this to allow extension blocks to modify the extensionData (so they can send custom input to the REST api when submitting the checkout form).
* Remove newsletter signup block
* remove checkoutSubmitData
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Extract productPriceValidation out of the component
* Extract checkout filter args outside of component
* Remove unnecessary default fallback
* Mark ProductName optional props as not required
* Use an empty array constant for the filteredNotices default value when there are no notices
* Refactor Panel component so hidden contents are not rendered
* Prevent extensions changing on each call of __experimentalApplyCheckoutFilter if it was an empty object
* Add missing line break
* Update tests
* Change snackbarNotices filter to snackbarNoticeVisibility
* Add deprecation notice to snackbarNotices
* Rename noticesToDisplay to visibleNotices
* Update link in deprecated message
* Duplicate checkout block
* Contact information block
* form step block
* shipping address block
* Setup atomic blocks
* Container structure
* More formal steps rather than generic form step
* Add billing and shipping forms
* add checkout actions block
* add order note block
* Add order summary
* add payment block
* Add inspector controls for address fields
* frontend WIP
* move attributes
* wrap shipping with form step
* PhoneNumber to typescript
* Remove column block
* form steps
* move payment logic to frontend
* Express block
* inline payment block
* Add shipping method block
* Render inner blocks (not standalone blocks) and add classes to Atomic Block list on php side
* lazy again
* Add more wrappers from old frontend file
* add layout
* Checkout wrappers were missing
* Enqueue payment methods for new block
* Add missing classnames
* Move shipping as billing state to context provider
* express payments rendering
* try/block-registry
* Remove atomic components (unused)
* Fix attribute persistance due to template locking
* Fix shipping display when not needed
* Set correct parent blocks for inner blocks
* pass data to blocks
* demo/newsletter
* Skeleton styling
* only apply styles to loading state for now
* shipping method block frontend
* rename express block
* lock template
* fix ts warning for __webpack_public_path__
* Refactor to avoid duplicating atomic block logic
* remove changes in save method
* Add zones and shipping methods to the sidebar for the shipping inner block
Closeswoocommerce/woocommerce-blocks#4320
* Fix script handles
* Fix method display when there are none
* Add shipping phone
* Add phone to api and sync with billing correctly
* Clear hidden fields on load
* fix requirePhoneField property
* Enable shipping and billing phone fields
* readonly field support
* Handle context attributes
* Fix createInterpolateElement usage
* add totalswrapper
* Implement Terms and Conditions block for Checkout i2 (https://github.com/woocommerce/woocommerce-blocks/pull/4436)
* Setup atomic blocks
* frontend WIP
* Express block
* try/block-registry
* Set correct parent blocks for inner blocks
* Skeleton styling
* Refactor to avoid duplicating atomic block logic
* add block locking
* add terms and conditions block
* hardcore settings image
* lock blocks from being deleted
* hide original checkout block
* mark blocks as side effectful
* move variations to block register function
* prevent core checkout blocks from needlessly showing in the inserter
* enable checkout i1
* fix broken rebase
* move save back
* Localise default text
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add add-hoc Block locking from WooCommerce Blocks side. (https://github.com/woocommerce/woocommerce-blocks/pull/4454)
* add locking
* use subscribe instead
* fix condition
* add locking to blocks
* check if the item is not a text field
* Tidy up hacks CSS class handling
* Fix error if node is undefined
* Hide menu when move is disabled
* update package lock
* Add todo and fix issue where selector returns null
* split todos
* move todo
* edit comment
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Un-disable the billing checkbox in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/4457)
* Add missing Slot fill provider on frontend
Fixeswoocommerce/woocommerce-blocks#4441 by adding the slot fill provider to the checkout-i2 block.
* Use column style appender
* Add padding/styles to actions
* Add/update icon library
* Multiline checkbox alignment
* Icons and copy changes for i2 blocks
* Add terms by default
* Add notice if text is missing links (https://github.com/woocommerce/woocommerce-blocks/pull/4466)
* Swap variations for toggle
* Add payment settings to inspector
* Update package lock
* Add inline docs to block registry
* Add inner block areas below each form step.
This does not include the form step contents, just adds inner blocks after existing content. Moving content within the inner block area is a separate discussion.
This closeswoocommerce/woocommerce-blocks#4306
* Sample block registration + docs
* Add tests for registerCheckoutBlock
* Fix lazy component detection in tests
* Add basic transform between i1 and i2
* remove template lock todo
* Update scroll to top hoc
* Move shared settings to new context providers
Closeswoocommerce/woocommerce-blocks#4472
* Remove readonly field support (unused)
* Remove context code
* Experimental
* remove invalid typedef
* FIx scrolling on validation due to misplaced context provider
* Update assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Update comment to remove reference to phone
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Rename ScrollToTopComponent
* Add explicit list of expectedType in TypeScript definition
* Add todo to remove custom shipping phone handling
* Remove dangerouslySetInnerHTML in External Link Card Component
* Add ExternalLinkCard to storybook
* update todo wording
* Refactor withScrollToTop to remove useCallback and use typescript
* Support children on CheckboxControl, with added Typescript
* Spread getRegisteredBlocks return value
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add TotalsWrapper component and associated styling
* Add TotalsWrapper around the subtotal, fees and discount
* Remove margins/paddings/borders from sidebar elements
This is to allow TotalsWrapper to be the component responsible for handling spacing and borders.
* Update styles to allow components to be wrapped in TotalsWrapper
* Move TotalsWrapper to checkout package
* Wrap all parts of Cart sidebar in TotalsWrapper
* Remove border from coupon panel
* Add has-bottom-border option to TotalsWrapper
* Wrap checkout sidebar components in TotalsWrapper
* Remove border/padding from order summary
* Add hasValidFills function
This will be used to check if a Slot has any fills that return truthy values.
* Remove borderSize and hasBottomBorder props from TotalsWrapper
* Wrap Slots in TotalsWrapper
* Update hasValidFills to check length of array
* Update tests and snapshots
* Only render tax totals if tax is more than 0
* 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.
* 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
* 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
* 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
* 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
* Move type defs
* Move type guards
* Fix imports
* Extract prepareTotalItems to TS file
* usePaymentMethodInterface as TS file
* Fix TS props
* Fix currency type defs
* Add return type to usePaymentMethodInterface
* Add key prop to CartTotalItem
* Fixed up js tests
* Move SymbolPosition into type-defs package
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* 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
* 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>
* 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>
* 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
* Add type defs for customer
Taken from 194ecccf78/assets/js/type-defs/customer.ts
* Convert ShippingCalculatorAddress to TypeScript
* Convert ShippingCalculator to TypeScript
* Convert ShippingLocation to TypeScript
* Allow packageId to be a number or string in useSelectShippingRate(s)
* Convert ShippingRatesControl to TypeScript
* Convert ShippingOptionsStep to TypeScript
* Allow package_id to be a string or number
This is because of Subscriptions using strings for package IDs
* Change to use CartShippingRateItemShippingRate instead of Rate
* Add extra props to PackageProps type
* Make ShippingAddress have the correct type
* Use CartShippingRateItemShippingRate instead of Rate
* Remove Rate type
* Set return types to JSX.Element
* Change type of props.renderOption in ShippingRatesControl
* Remove customer type defs and relocate aliases to default-address-fields
* Add EnteredAddress type
* Import EnteredAddress from new location
* Remove unnecessary eslint ignore
* Remove unused variable
* Remove confusing use of word Item in Shipping types
* Remove confusing use of word Item in Shipping types
* 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>
* 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
* 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
* 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
* 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
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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
* 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>