* adds toolbar option to remove custom image
removing custom image will reset it back to the default
product image if available
* update copy as per discussion
went with just Reset as it is commonly used in WordPress
and will have translation available
* 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>
* fix Global Styles for Product Image, Product Category List and Product Tag List blocks
fix Global Styles for Product Image, Product Category List and Product Tag List blocks
* Block style font-size was applying wrong value for fontSize
* Add missing __experimentalSkipSerialization to Category List
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.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 wc-block-mini-cart__contents class for the Mini Cart block woocommerce/woocommerce-blocks#5418
Add wc-block-mini-cart__contents class for the Mini Cart block
* removed comment
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* Rating Product block: add support for global style woocommerce/woocommerce-blocks#4965
Rating Product block: add support for global style
* add feature flag
* fix import after merge
* fix global style css generation
* restore css for classic product rating html element
* don't apply the global style to PHP blocks
* remove registration
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* move hooks in a specific folder
* Tag List block: add support for global style woocommerce/woocommerce-blocks#4965
Tag List Block: add support for global style
* add feature flag
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* Enable global style for category list block woocommerce/woocommerce-blocks#4965
Enable global style for category list block
* fix import after merge
* add save function
* add feature flag
* Convert radio component to TS and support uncontrolled components
* Further radio control to typescript changes
* Combine useSelectShippingRate and useSelectShippingRates
* Remove useSelectShippingRate hook
* Move local radio checked state to PackageRates
* This is a Controlled component - update inline docs
* useSelectShippingRates -> useSelectShippingRate rename
* Add the correct appender button for non empty groups
* Revert "Add the correct appender button for non empty groups"
This reverts commit 4b41d7d7f82461813b3464d1b4f931c442bce3be.
* Force position relative for custom InnerBlocks.ButtonBlockAppender appenders.
Removing InnerBlocks.ButtonBlockAppender from renderAppender = {InnerBlocks.ButtonBlockAppender } results in the black appender button beeing shown only when the block is selected, and we need the appender to be visible by default.
* Remove api hydration for the Mini Cart Block woocommerce/woocommerce-blocks#5729
Remove api hydration for the Mini Cart Block
* fix PHP error
* send event when the button is clicked
* fix import order
* Add hover & focus styles for component buttons
We are using an old version of the "@wordpress/component" package,
that's why we are not getting the latest style fixes from Gutenberg.
The reason to not using the latest version is that we had some issues
with the bundle size.
The current solution is to set our own focus & hover styles
* Replace raw value with Sass variable
* Fix hover style for the mini cart block
We don't have the outlined button yet. This styles is unique for the
mini cart button.
To refactor this code, maybe we should create a reusable outlined button
* Add variant to the Woo Block Button component
To refactor our code, adding a "variant" prop looks logical since we are
have already "contained" & "outlined" buttons. So, for future need for an
outlined button, no need to manually apply the same style again.
The "contained" variant is set by default for legacy reasons. Our Button
component was first built as a contained one.
* Fix height difference: oulined & contained buttons
The outlined buttons have more height because of the added border value.
To fix it we can replace the border with the inner shadow.
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* Expose products settings in wcSettings
For the time being we expose only what is used by the blocks
which is `cartRedirectAfterAdd`. In the future more can be added
as needed. Setting is accessible via `getSetting( 'productsSettings' )`.
We namespace the settings under productsSettigns to reflect
the domain and how settings are organised in Woo admin and to
inform that this is an object with more settings within.
This setting normally was available **only** if AJAX add to cart was set
as a js global `wc_add_to_cart_params.cart_redirect_after_add`.
By accessing the option directly we ensure it’s exposed
to blocks regardless of if AJAX option is enabled.
* update AddToCartButton to respect cartRedirectAfterAdd
This adds the redirect directly on the AddToCartButton after succesful
add to cart action. This follows convention that redirects or other side
effects shouldn’t happen as part of the action but rather be part of the
control that triggers such flow.
* Add stories for Button component woocommerce/woocommerce-blocks#5250
Add stories for Button component
Co-authored-by: gigitux <gigitux@gmail.com>
* Button: Change With Spinner story title to Loading
When output with php the block had correct accessibility on
the frontend but in the editor or when rendered as block
the correct aria label was missing because of misspelled
aria-label attribute.
Also fixed wrong value type provided for tabIndex in editor
while at it.
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* move hooks in a specific folder
* fix crash on WP 5.8
* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965
Featured Category block: Add support for global style
* fix border color
* Attribute Filter block: enable global style woocommerce/woocommerce-blocks#4965
Attribute Filter block: enable global style woocommerce/woocommerce-blocks#4965
* fix eslint error
* fix test
* add comments about !important
fixeswoocommerce/woocommerce-blocks#5674 - item edit relied on data from @woocommerce/previews
productsPreview which was missing mock data for product category
* 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>
* fix: add wrapper for empty mini cart contents inner blocks. Allow inner content to be scrollable
* fix overflow issue for the editor
* add padding for the empty cart view
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* move hooks in a specific folder
* fix crash on WP 5.8
* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965
Featured Category block: Add support for global style
* fix border color
* Featured Product block: enable global style woocommerce/woocommerce-blocks#4965
Featured Product block: enable global style
* fix border color
* fix eslint error
* fix opacity
* fix border radius
* fix opacity
* disable font-size support
* restore height for featured product and featured category
* Add inner wrapper div in td.wc-block-cart-item__product
Adding this wrapper element is necessary in order to be able to "fake" item grouping in a theme-agnostic manner: https://user-images.githubusercontent.com/1783726/118831630-97855600-b8c8-11eb-8906-c7f9ada769e7.png
* Whoops
* Remove classnames function
* Update indentation for QuantitySelector
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Update payment-method-data-context tests to use userEvent
* Update mini cart block tests to use userEvent
* Update payment methods tests to use userEvent
* Add fake items fixture
* Add test for rendering items in sidebar
* Add test for items with addons
* Add textContentMatcherAccrossSiblings helper
This is needed to match text when it's spread over a few elements
* Add test to ensure subtotal renders correctly
* Add test to ensure discounts are rendered correctly
* Add test to ensure fees are shown correctly
* Add test to check coupon entry form isn't present when coupons disabled
* Add more mock data to useStoreCart
* Mock useShippingDataContext
* Rename useStoreCartValue to useStoreCartReturnValue
* Remove unnecessary coupon button test
This should be tested within the TotalsCoupon component
* Add tests for shipping presence
* Add test for coupons
* Remove cart items fixtures
These are no longer needed
* Move the findByText utils to the utils folder
* Move inner blocks test to correct directory
* Add block title to AbstractBlock class
* Add block title to Checkout block
* Include all block.json files in tsconfig
* Add get_block_title method to Checkout.php
* Remove redundant block_title field
* Add block.json and remove static attributes from attributes.ts
* Register block using attributes from block.json
* Add metadata_path to AbstractBlock
* Add function to AssetsApi to get the metadata path from the plugin root
* Register the block using metadata if it's set in the block's class
* Remove get_block_title method
* Only add supports and attributes to the block when not registering with metadata
* Change get_block_metadata to get_block_metadata_path
* Change indentation to tabs in block.json
* Update comment to clarify why attributes and supports are set later
* Check if path to metadata is not empty instead of set and not empty
* Move checkout block out of cart-checkout directory
* Update get_block_metadata_path function to find block.json automatically
* Remove metadata path from AbstractBlock
* Check if there's a metadata file and register blocks with metadata if so
* Move deprecated attributes out of metadata and into attributes.ts
* Re-add deprecated attributes to checkout index
* Move order notes test
* Move test for checkout phone number in edito
* Fix indentation in checkout/block.json
* Move checkout terms tests
* Try forcing storefront theme in e2e tests
* Revert "Try forcing storefront theme in e2e tests"
This reverts commit 5b0fd47a2c39aadb0141a4ed28cbc0e6baa89625.
* Try capturing screenshot on test failures
* Try uploading error in try catch
* Try uploading artefacts on error
* Test uploading artefacts
* Screenshot just before looking for edit post layout
* Revert "Screenshot just before looking for edit post layout"
This reverts commit 61dff027789ce13a0d84e7b6f11e431637c5a450.
* Revert "Test uploading artefacts"
This reverts commit adf5cc55bcdb677f889bf5a62803b4150d98e665.
* Revert "Try uploading artefacts on error"
This reverts commit 7441a832a113a95fef89cc1b8db6dc79271be516.
* Revert "Try uploading error in try catch"
This reverts commit ca412ce505d56286b164f588a201a451f6bceeb6.
* Revert "Try capturing screenshot on test failures"
This reverts commit 0de6e97df19b116091a7bb3b8652713867d2d80f.
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
* Install @wordpress/block-editor package
* Add test for checkout terms frontend block
* Add tests for checkout terms in editor
* Add tests for Checkout Terms in editor
* Use void 0 as function's return type
* Update tests to use toBeInTheDocument and split checkbox test in two
* Use void 0 for empty function
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* move hooks in a specific folder
* fix crash on WP 5.8
* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965
Featured Category block: Add support for global style
* fix border color
* fix opacity
* fix border radius
* fix order rules css
* Prevent third party blocks from breaking the entire checkout block
* Fixed types and block error boundary around forced blocks
* Move InnerBlocksComponentWrapper and remove extra }
* Allow HTML nodes to be rendered in the component tree, not just eleents
* Reset redirectUrl to blank if not included in response.
* Force redirect URL for successful responses
* Revert "Force redirect URL for successful responses"
This reverts commit 61aae8b459843237b5428be8fa0cdb9500cd0485.
* Restore correct font style when the block is loaded in the editor
Restore correct font style when the block is loaded in the editor
* fix style on Twenty Twenty theme
* Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block
Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block
* add feature flag
* fix lint errors
* fix global style bugs on Product Title block
* Fix default stockStatusOptions in tag and attribute blocks
These should be an array of keys, not objects.
* Fix stockStatus definition on PHP side
* Swap state to debounce.
* Improve presentation of stock filters
* Remove state usage for display options
* Remove debounce
* Consistent panel titles
* Set attribute of legacy template block when block is inserted
* Allow inserter on Woo templates only
* Allow correct legacy block straight from the inserter
* Use WP Data store outside component to register block
* Pass in all attribute data when registering block
* Accommodate templates targetted at specific products or taxonomies
* Replace beginsWith with startsWith
* Replace test data with production data
* Conditionally use stores selector if it exists
* Unsubscribe if the store does not exist
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* Stock indicator block: add support for global style woocommerce/woocommerce-blocks#4965
Stock indicator block: add support for global style
* fix import after merge
* Product title: add support global style woocommerce/woocommerce-blocks#4965
* add specific type
* add custom save function
* Summary Product block: add support for global style woocommerce/woocommerce-blocks#4965
Summary Product block: add support for global style
* add color global style under feature flag
* fix import after merge
* fix typo
* add min and step to Store API
* add min and step support
* typo
* Update assets/js/base/components/quantity-selector/index.tsx
* Update assets/js/base/components/quantity-selector/index.tsx
* Fix debounce callback
* Style qty input to show steps
* Implement quantity_limits in API
* Quantity validation
* Update product API
* Normalize on + -
* Separate add to cart events from cart item events in regards to limits
* Prevent qty change for editable line items
* Unify filters
* Remove step number indicator from buttons ¯\_(ツ)_/¯
* Normalize on mount
* Update docs
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* add align wide and full support for legacy template block
* fix PHP warning
* add a comment on get_markup_with_classes_by_attributes
* rename function
* add align wide and full support for legacy template block
* fix PHP warning
* add a comment on get_markup_with_classes_by_attributes
* rename function
* fix regex
* update regex
* update regex
* fix code styling
* Don't allow to insert negative values on input for Filter Products By Price block woocommerce/woocommerce-blocks#2695
Don't allow to insert negative values on input for Filter Products By Price block
* renaming util functions and add comments
Legacy blocks were previous locked for removal to avoid unintended
consequences. However, this would lock the ability to move the block within
other e.g. layout blocks and unnecessarily limit merchant customization ability.
Now that we have reverted this decision, merchants could delete this block,
which is likely **not** what they want to do. While we investigate other, more
long-term, solutions, we are adding a warning notice.
Refs woocommerce/woocommerce-blocks#5180. Fixeswoocommerce/woocommerce-blocks#5207.
* Rename legacy blocks to avoid confusion with the term “Template”
* Fix duplicated error notices
StoreNoticeProvider is already being used within Block component. This
removal prevents duplicated error notices within the Payment Options
section
* Move StoreNoticeProvider from payment block
Remove StoreNoticeProvider from payment block and move it to the parent
frontend block to avoid unnecessarily loading the notice provider
* Add clear and fill input test util
* Add tests for Filter Products by Price
* Add class name to filter products by price block in editor
* Update wp-env
* Fix formatting
* Update lock
* Revert "Update lock"
This reverts commit f4e809e000430eea3972c94fd2aea0a19ba6961b.
* Create product attributes during setup
* Remove product attributes during teardown
* Add attributes in fixture-data
* Add two new products, for attribute testing
* Load attributes into store and apply them to products
* Add class to Filter by Attribute when editing
This is so it can be targeted in E2E tests more easily.
* Add tests for Filter Product by Attribute
* Fix formatting in attribute-filter.test.js
* Add tests for active filters block
* Add doc block for ensuteCleanAttributes
* Update wording of title test in all filter block E2E
* Update test wording to read better
* Update snapshots
* Use pptr-testing-library selectors to click elements
This makes the tests easier to reason with, and lets us take a step back from the implementation details (classnames etc.)
* Add saveOrPublish test util
* Use pptr-testing-library selectors to click elements in attribute filter
* Use pptr-testing-library selectors to click elements in price filter
* Add `puppeteer-testing-library`
* Use puppeteer-testing-library API to look for H6 button
* Use correct argument in jest-puppeteer.dev.config
* Update package.json & package-lock.json
* remove tests for 5.3
* remove snapshots
* Remove ensureCleanAttributes
* Remove puppeteer-testing-library, install missing expect-puppeteer package and update tests
The puppeteer-testing-library, although added by gutenberg is not actively used.
I have removed it and realised that the added functionality can be easily replaced by expect-puppeteer.
This is a package that we specify in the jest configuration but it was not part of our package.json.
The selectors from puppeteer-testing-library have been replaced with .toClick and the utility clearAndFillInput with .toFill
The Filter by Attribute block has been skiped until tests are fixed.
* Add back setupPageSettings to jest setup
* Fix filter by attribute block test
* Fix linting error
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Add isCheckout prop to NoShippingPlaceholder and TotalsShipping
* Pass isCheckout to TotalsShipping in Checkout sidebar
* Show the NoShippingPlaceholder if no rates are found
* Show better error message when no shipping is available in checkout
* 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 full documentation to the component props in Storybook
* Fix `FormattedMonetaryAmount` TypeScript errors
Since this component is passing on props to `NumberFormat`,
it needs to extend all of its original props, except for `onValueChange`
which we wrap in order to accept only `number`s.
* Convert `constrainRangeSliderValues` to TypeScript
* Add docs to `Currency` types
* Convert `PriceSlider` to TypeScript
*Note:* All TypeScript errors were fixed during the conversion,
except for the IE workaround which wasn't clear to me at this time.
Opened an issue: woocommerce/woocommerce-blocks#5276
* Fix Price Slider story (https://github.com/woocommerce/woocommerce-blocks/pull/5253)
* Migrate stories for `ProductName` to latest Storybook
Also add props documentation and add named export.
* Migrate stories for `ProductName` to latest Storybook. Also add props
documentation and add named export.
* Migrate `TotalsFooterItem` to TypeScript and latest Storybook
* Add a `LooselyMustHave` utility type.
* Export `allSettings` so that they can be manipulated in stories and tests
* Implement a way to easily define and reuse Storybook controls
Implement a currency control for a common use-case of selecting currencies.
It currently implements EUR and USD as they have different properties.
* Migrate `TotalsDiscount` to TypeScript and implement stories
* Migrate `TotalsCoupon` to TypeScript and fix stories
* Change Coupon name within Storybook
* Nicer handling of removal of a coupon from Storybook
It now dynamically calculates the discount from the actual coupons.
* Clarify docs for STARTED
* Clarify docs for setActivePaymentMethod
* Remove useActivePaymentMethod hook (this held state for active methods and tokens)
* Update type defs
* Enhance setActivePaymentMethod action to accept method data
* SET_ACTIVE_PAYMENT_METHOD action
* Add setActivePaymentMethod dispatcher and make "started" status only
* Update setActivePaymentMethod usage in express methods
* Set radio control defaults
* Consolodate tokens and methods
* Update assets/js/base/context/providers/cart-checkout/payment-methods/reducer.ts
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Spacing
* Split saved cards tests from regular, since saved cards are checked by default
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* 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>
* Fix link to edit the Mini Cart template part in WP 5.9
* Use wp_is_block_theme() function
* Add protection against overwriting isSiteEditorAvailable setting
* Rename isSiteEditorAvailable to isBlockTheme
* Update icon of legacy template block
* Display legacy block template color in Woo purple
* Display icons in white when block being selected within list view
* ship component stories for storybook
* Refactor RemovableChip for Storybook
* Implement lucio feedback changes
* RemovableChip is part of the Chip story
* Typedefs and cartData for the payment interface
* fix case on noticeContexts
* typeof for enums
* immutable note
* Add cartData to docs table
* Rebase docs
* Update packages to latest Storybook deps
* Migrate `ReadMore` component and its utils to TypeScript
* Add type definitions for `trim-html` package
* Migrate `ReadMore` stories to newest Storybook
Fixeswoocommerce/woocommerce-blocks#5254
* WIP
* Converted block-error-boundary to TS
* Convert CheckboxList to TS
* Converted Chip and Removable Chip components to TS
* Change type to React.FC<T>
* Fix tests
* Implement Lucio feedback
* Mini Cart block: Add label for tax when it should be visible in accordance with WC settings woocommerce/woocommerce-blocks#4849
Mini Cart block: Add label for tax when it should be visible in accordance with WC settings
* improve the tax label handling
* fix code after conflict
* fix tax label handling when it is added the first product
* add another check for avoid PHP error
* rename variables; add test for the function getSettingWithCoercion
* add margin-right for tax-label; add test to check if type guard works correctly
* Convert `ErrorPlaceholder` and `ErrorMessage` to TypeScript
* Add stories for `ErrorPlaceholder` and `ErrorMessage` (https://github.com/woocommerce/woocommerce-blocks/pull/5255)
Stories include:
* Default generic error
* API error
* Unknown error
* Error without possibility to retry
* Base Error atom
Where applicable, the **Retry** button will not only trigger the appropriate
action, but also simulate the loading state of the error component.
* Update references to `ErrorMessage` component to leave the file extension out
Fixwoocommerce/woocommerce-blocks#5255
Refs woocommerce/woocommerce-blocks#5249
* Add global style for product categories list block woocommerce/woocommerce-blocks#4965
Add global style for product categories list block
* add support for link color
* add feature flag
* fix code style and PHP warning
* update doc comment
* remove empty space
* refactor StyleAttributesUtils (https://github.com/woocommerce/woocommerce-blocks/pull/5277)
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Mini Cart Block: add link to edit template part from sidebar woocommerce/woocommerce-blocks#5186
Mini Cart Block: add link to edit template part from sidebar
* fix e2e tests
* Product details metadata now accepts as a default prop, with as an optional alternative
* Updated product details test snapshot
* Don't overwrite key prop
* One of key or value must be entered in ProductItemResponseData type
* 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
Within the editor, the checkbox appeared aligned at the bottom of the paragraph, while
on the front-end it would appear aligned at the top. The alignment was actually correct
but a top margin was assigned to checkboxes in the backend.
Instead of removing that globally, this commit resets it for checkboxes within the checkout
block.
* Fix wrong event prefix in doc comment
* Make className prop in CartLineItemsTableProps optional
* Mini Cart as template part
* Remove BlockTemplatePartsController and instead use BlockTemplatesController
* Remove old code
* Clean up frontend rendering
* Update tests
* Improve if clause
* Fix wrong tests title
* Fix wrong variable name
* Make sure Mini Cart contents block is unmounted whem mini cart closes or unmounts
* Remove unnecessary waitFor
* Fix PaymentMethodDataProvider wrong children type
* TypeScript fixes
* Make comment shorter
* Remove test code
* Fix contant unmounts of Mini Cart contents block
* Fix wrong template_type passed
* Set Template part area to 'uncategorized'
* Set Template part area to the correct value
* Move template dir check outside loop
Previously, our legacy template block was locked to prevent the users from
removing it. The block could however be removed by erasing the parent, so
this change allows the user to directly remove the block itself.
Also:
Closeswoocommerce/woocommerce-blocks#5163Closeswoocommerce/woocommerce-blocks#5109
* Fix error on the Cart block
* Created a cartIsHydrated variable in useStoreCart hook and used this to update the billing address in the internal state of the useCustomerData hook
* Fix the country is required error on the Cart page using refs
* Separate api calls to update shipping and billingUpdate billing and shipping addresses only when needed in API calls
* Remove redundant check for customerDataToUpdate
* remove use of refs in initial values
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Added a placeholder to the product search block editor to indicate that the user can change the placeholder on the front end
* Changed the placeholder to be translatable
* Improve title for edit button woocommerce/woocommerce-blocks#1689
Improve title for edit button
* fix edit title for Product By Attribute and All Products blocks
* Add cartItemClass filter for cart line items
* Add cartItemClass, originally implemented in 96f18443bc
* add filter to order summary items
Co-authored-by: Manos Psychogyiopoulos <psyx@somewherewarm.net>
* Bump dependencies to fix e2e on m1 macs
* Disable welcome guide more reliably - see 3da717b8d0/packages/e2e-test-utils/src/create-new-post.js
* Update selectors and fixture data for cart block
* unused dep
* Remove duplicate block wrapper
* Remove unused jest configuration files
* More robust click in view switcher test
* Revert fixture data change
* Remove withRestApiHydration
* Preload checkout data via setting - server data is required for this block
* Handle cart hydration using createPreloadingMiddleware which removes the need for HOCs
* Rename variable
* Remove withStoreCartApiHydration and timestamp checking
* Empty test file
* Add the Archive Product block template
* Use template slug if no template title is set
* Add page icon as per design
* Add the basic archive product block template
* Legacy Template block
* Return render_single_product value
* Make placeholder text translatable
* Don't allow removing the block
* Update block title
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Add inline note around displayWithTax to clarify why prices change
* update snaps
* Snap update
* Clarify docs further for displayCartPricesIncludingTax
* Update assets/js/previews/cart.ts
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Make Mini Cart block react to removed_from_cart events
* Move listening to add to cart and remove from cart events to the useStoreCart hook
* Add tests
* 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 classname support to accepted payment methods block
* add classname support to express payment methods block
* add classname support to cart items block
* add classname support to cart line items block
* add classname support to order summary block
* add classname support to totals block
* add classname support to empty cart block
* add classname support to filled cart block
* add classname support to proceed to checkout block
* type edit
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.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>
* Convert sharedConfig and Title blockConfig to TS
* Convert constants.tsx to TS
* Convert attributes.js to TS
* Amend attributes.ts record type
* Convert title component edit.js to TS
* Convert title component block.js to TS
* Amend product name index.tsx to prevent TS errors in product title block.tsx
* Amend product-name and base tsconfig
* Add rel to ProductName component element
* Replace ReactElement with JSX.Element
* Move TagName component to outside of the main component
* Add HTMLAttributes import
* WIP: Add props to TagName component
* Fix TagName typing
* Update TagName interface
* Replace ReactElement typing with JSX.Element
* Code review feedback amends
* Replace return type undefined to void
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
* Pass classname from DOM to react components
* Actions Block ClassName support
* Form step field classname support
* Payment block className support
* Classname support for fields and totals
* Order summary classname support
* Classname support for order note block
* Express payment classname support
* Terms block custom class
* Let useBlockProps handle class in actions block
* 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>
* Remove icons from checkout button
* Add new block type
* Register new block
* Remove unused attribute
* Add to new template
* Remove duplicate attributes
* Update Inner Block handling to use consistent appender and unlock payment methods
* Add dark mode inputs toggle to top level block
* Remove top level attributes which moved to inner blocks
* Remove unused components
* Pass down hasDarkControls and currentView via context props
* Update default empty template on server side
* template->registeredBlocks wording
* useForcedLayout: insert in correct place
* Remove test div
* Clarify inline docs
* Apply changes to cart block