* Use the term attribute sort order for the "Filter by attribute" block
* Allow `id` and `name_num` orderby values
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Sync Interactivity API code with Gutenberg
* New store() API
* Store raw actions
* Update wc-interactivity-store implementation
* Replace `wc_store` with `wc_initial_state`
* Parse and populate initial state
* Allow store parts in `store()`
* Accept namespaces in directive paths
* Add $$namespace to directives' object values
* Make namespace parsing more robust
* Use DeepPartial type for store parts
* Do not pass `rawStore` to `afterLoad` callbacks
* Simplify `store()` a bit
* Implement `privateStore()`
* Sync context directive with Gutenberg
* Refactor scope and extract getters per scope
* Add namespace to getters and actions
* Remove current privateStore implementation
* Remove `afterLoad` option from `store`
* Use same proxy handlers for ns, getters and actions
* Set scope inside `evaluate`
* Refactor proxy handlers
* Improve types a bit
* Catch errors in async actions
* Implement stacks for scopes and namespaces
* Implement `getElement`
* Change directives object structure
* Remove unnecessary import
* Implement private stores
* Return value from sync actions
* Minor optimizations and improved comments
* Don't use async inside `data-wp-watch`
* Use a single Provider in context directive
* Remove DeepPartial type
* Do not check if element exists
* Add the `current` prop of state inside the scope
* Move getters outside scope
* Fix wc-key assignment
* Fix missing `navigate` in directives
* Fix namespace not being picked in the same element
* Deep merge raw stores instead of proxied ones
* Fix namespace assignment
* Allow forward slashes in namespaces
* Migration of Product Collection and Product Button blocks to the new `store()` API (https://github.com/woocommerce/woocommerce-blocks/pull/11558)
* Refactor Product Button with new store() API
* Use `wc_initial_state` in Product Button
* Fix namespace
* Remove unnecessary state
* Test namespaces in directive paths
* Add test context with namespace
* Simplify woo-test context
* Move addToCart and animations to a file
* Do not pass `rawStore` to `afterLoad` callbacks
* Move callbacks and actions back to the main file
Because the animation was broken.
* Remove selectors in favor of state
* Use default ns in `getContext` for state and actions
* Remove `afterLoad` callback
* Remove unnecessary ns
* Fix getContext in add-to-cart
* Replace namespace and delete unnecessary store
* Pass context types only once
* Use an alternative for requestIdleCallback
* Add previous react code for notices
* Add namespace to Product Collection block
* Replace getTextButton with getButtonText
* Add block name to the ProductCollection namespace
* fix style HTML code
* Remove circular deps error on the Interactivity API
* Product Gallery block: Migrate to new Interactivity API store (https://github.com/woocommerce/woocommerce-blocks/pull/11721)
* Migrate Product Gallery block to new Interactivity API store
* Fix some references
* Add missing data-wc-interactive
* Fix an additional namespace
* Remove unnecessary click handler
* Dialog working
* Refactor action names
* Reindex PHP array
There was some missing indexes, which turned the array into an object in JS.
* Remove unused event handlers
* Move next/previous logic to external function
* Move StorePart util to the types folder
* Rename namespace to `woocommerce/product-gallery`
* Undo product collection namespace renaming
* Remove unnecessary namespace
* Don't hide the large image on page load
* Minor refactorings
* Fix eslint error
* Fix php cs errors with spacing and double arrows alignment
* Disable no-use-before-define rule for eslint
* Disable @typescript-eslint/ban-types rule for eslint
* Fix parsed context error in e2e tests
* Fix context parser for Thumbnail image
* Move store to the top of the frontend file
* Add interactivity api utils to the @woocommerce/utils alias
* Replace deprecated event attribute
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: roykho <roykho77@gmail.com>
---------
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Fix error when closing product gallery dialog with keyboard escape key
* use wc_initial_state instead of wc_store
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Add transforms for checkout block
* Block to shortcode switcher in notice
* cart transforms
* Fix target block for switching
* Remove switcher UI for classic cart/checkout
* Set isPreview when generating block preview in switcher
* Onboarding task
* Action on click
* Focus on block after replacement
* Update notice styling and wording
* Undo functionality
* Look for woocommerce/classic-shortcode when determining if task list item should display
* Enable focus on the cart/checkout block when visiting from the task list
* Classic Cart/Checkout Updated Title
* Add missing translations
* Refactor modal content to avoid sprintf
* Improve pickBlockClientId
* Tracks events for switching to classic shortcode block
* TaskList support for non-block themes
* Updated placeholder to work on non-white page backgrounds
* Find blocks using findBlock utility
* Add TabbableContainer for buttons
* Add align to wrapper
* Update modal content
* Update modal usage
* Removed undo link when converting from classic shortcode
* Check if block was selected
* Revert "Removed undo link when converting from classic shortcode"
This reverts commit 2babbab4c1e69861a0371ff745e85d80ff6bbab1.
* update snackbar text
The main aim of this PR was to convert the product-control component to TypeScript. However, since the component is coupled with many other parts (it is itself wrapped into 4 HOCs), many refactoring changes were needed to make the types work.
In particular:
* Add `convertProductResponseItemToSearchItem` utility function
The function allows to clean up the `ProductResponseItem` in order
to make its shape compatible with the `SearchListItem`, instead of
passing the entire object.
Because data from the object might need to be used in certain
circumstance (e.g. render functions), the data is now allowed to be
scoped within a `details` key.
This commit also converts `utils/products` to TypeScript.
* Fix `ProductResponseItem` type missing `slug`
The `slug` is returned by the API but didn't appear in the type def.
* Improve certain HOCs types
The `withSearchedProducts` and `withTransformSingleSelectToMultipleSelect`
HOCs are now typed in such a way that it is clear what incoming props
they expect and what they inject.
* Refactor `ProductAttrributeTermControl` for further type safety
Make sure that `count` is always a `number` as required by the
component types.
* Refactor `search-list-control.tsx` and `item.tsx`
The new `SearchItem` allows for the `details` key to be passed.
All the components are now aware of it.
* Add support for filter blocks
This commit updates the `ProductCollection` block implementation to add support for filter blocks, including the Price filter, Attributes filter, Rating filter, and In stock filter.
The changes include:
1. Adding a new property `$attributes_filter_query_args` to store the query arguments related to the filter by attributes block.
2. Adding a new method `add_support_for_filter_blocks()` to enable support for filter blocks. This method sets the necessary asset data to enable filtering and refreshes the page when a filter is applied.
3. Adding new methods to handle specific filter queries, including `get_filter_by_price_query()`, `get_filter_by_attributes_query()`, `get_filter_by_stock_status_query()`, and `get_filter_by_rating_query()`. These methods generate the respective queries based on the applied filters.
4. Refactoring the `get_final_query_args()` method to include the newly added filter queries using the `get_queries_by_applied_filters()` method.
These changes enhance the functionality of the `ProductCollection` block by allowing users to filter products based on price, attributes, rating, and stock status.
* Go to first page when filters are updated
* Enhance ProductCollection block to support filter blocks
This commit enhances the ProductCollection block to support various filter blocks such as Price filter block, Attributes filter block, Rating filter block, and In stock filter block.
The `build_query` method has been refactored into two separate methods: `build_frontend_query` and `get_final_frontend_query` to make the code more modular and readable. The `add_support_for_filter_blocks` method has been modified to support the generation of product IDs for filter blocks.
The method `update_rest_query` has been renamed to `update_rest_query_in_editor` for better clarity and understanding of its function. Similarly, `get_final_query_args` has been refactored to include the `$is_exclude_applied_filters` parameter which helps in generating product IDs for the filter blocks.
Moreover, the filter hook `pre_render_block` has been added to support the filtering of blocks before they are rendered.
This update will enhance the user experience by providing more filtering options in the ProductCollection block.
* Remove changes related to redirect to 1st page
* Go to first page when filters are updated
This commit refactors the changeUrl function in the `filters.ts` file. The purpose of this refactor is to remove the page number from the URL whenever filters are changed. This ensures that the user is always taken to the first page of results.
The commit includes the following changes:
- Added comments explaining the different page number formats in the URL.
- Updated the `newUrl` parameter by removing the page number using regular expressions.
- The page is then reloaded with the updated URL using `window.location.href`.
These changes improve the URL handling in the `changeUrl` function and enhance the user experience when interacting with filters.
* Optimize URL updates to prevent unnecessary page reloads
This commit optimizes the `changeUrl` utility function to prevent unnecessary page reloads.
Changes:
1. It checks if there are no query parameters in the URL and the URL ends with a '?'.
2. If these conditions are met, it removes the trailing '?' from the URL.
The reason for this change is that a '?' in the URL typically indicates that query parameters will follow. If there are no query parameters, the '?' is unnecessary and can cause the page to reload, which can negatively affect performance. Therefore, by removing the '?', we prevent this unnecessary page reload.
* Simplify trailing '?' removal in URL handling
This commit simplifies the removal of trailing '?' characters from URLs.
The previous implementation checked if there were any query parameters
before removing a trailing '?'.
However, upon review, it was determined that this check was unnecessary,
as a trailing '?' could be removed safely even if query parameters were
present, without any negative impact.
This change simplifies the code and prevents unnecessary computation
checking for the existence of query parameters.
* Convert summary/utils to TS
* Add @wordpress/wordcount type defs
* Move trimWords, trimCharacters, remoteTags & appendMoreText to own file
* Add tests for trimWords and related functions
* Trim payment method description if it is longer than 30 words
* Add show child categories only toggle to Product Categories block
* Check if current page is a template editor before adding the toggle
* Show current category if show_children is enabled and its the last category in the hierarchy
* Update comment
* Fix typo
* Remove forward slash
* Add is-widget-editor utility and enable feature for block usage in widget editor
* Don't render anything if the child only option is enabled and there are no children
Implements the ProductSelector advanced filter within the “Products (Beta)” block.
The filter allows the merchant to narrow down the exact products to which all
subsequent filters will be applied, mirroring the functionality of the existing
“Hand-picked Products” plus all the other functionalities available
from the “Products (Beta)” block.
* Replace single quote with the encoded version %27 for URL comparison
This is required as as removeQueryArgs() function uses decodeURIcomponent method which doesn't encode single quotes (') while it was still encoded in the original URL (%27). So when the single quote was in a query param, for example as a search term, it caused endless redirection loop.
* Replace single quote with the encoded version %27 for URL comparison in Filter by Rating
* refactor the solution so it encodes the href rather than decode the newly created URL
* Refactor the normalisation
* Add tests to normalisation function
* Add CartCheckoutUtils class
This class will store reusable methods relating to Cart/Checkout Blocks, i.e. whether they are used on the Cart/Checkout page.
* Update ShippingController to use the new CartCheckoutUtils function
This will reduce code duplication when checking if the Cart/Checkout blocks are in use on the Cart/Checkout page.
* Add filter to remove shipping settings when Cart/Checkout are default
* Ensure setting displays correctly if cart is default but not checkout
* Add tests to ensure core shipping settings update correctly
* Add setCartCheckoutPages function to update set the cart/checkout page
* Force shipping to be enabled if the Checkout block is in use.
* Add filter to override cost requires address option
* Add shippingCostRequiresAddress option
* Check if the address is required before showing rates
* Show shipping rates in editor
* Add shippingCostRequiresAddress attribute to shipping methods block
* Update frontend type to show shippingCostRequiresAddress is a prop
* Add control to toggle shippingCostRequiresAddress option
* Show address notice in the correct scenario
* Send shippingCostRequiresAddress to Block in front end context
* Add e2e test for editor control
* Add e2e tests for shipping options on the front end
* Add updateAttributeInSiblingBlock function
* Add shippingCostRequiresAddress to shipping method block
* Ensure attribute is updated in both blocks when editing
* In Shipping Methods Block, show correct component based on block setting
* Show correct block in editor
* Remove broken test from PR
* Clean up updateAttributeInSiblingBlock
* Add setCartCheckoutPages function to update set the cart/checkout page
* Add tests to ensure core shipping settings update correctly
* Add isAddressComplete function
Borrowed from woocommerce/woocommerce-blocks#8141
* Check if the address is required before showing rates
* Show shipping rates in editor
* Show address notice in the correct scenario
* Add e2e tests for shipping options on the front end
* Ensure errorId is passed to StateInput
* Add fullShippingAddressPushed action to wc/store/cart
* Add fullShippingAddressPushed case to reducer
* Ensure fullShippingAddressPushed is set when initialising cart store
* Add fullShippingAddressPushed selector and default state entry
* Add shippingAddressHasValidationErrors util function
* Do not overwrite addresses when selecting a rate
* Set whether full address has been pushed when saving address changes
* In Shipping Methods Block, show correct component based on block setting
* Don't show from price if rates should be hidden until address entered
* Check city validation errors to assert if shipping address is valid
* Rename merchant.js to merchant.ts
* Move local pickup functions to common merchant util
* Update local pickup tests to use common merchant utils
* Add test to ensure setting toggles in both blocks
* Add navigating to settings and saving in merchant util
* Create addPickupLocation merchant util
* Add test for local pickup and require full address
* Make sure correct conditions are met to show shipping options
* Ensure checkbox is checked during local pickup tests
* Unset the checkbox when tests are finished running
* Update checkout block fixture
* Prevent error in unit tests
* Import validation store key from constants
Required because importing from the index causes the validation data store to register twice
* Update checkout terms test to wait for button not to be disabled
* Revert "Add isAddressComplete function"
This reverts commit 9967dc0d4f10cf638859ae085e6f4cc2901dd299.
This PR is meant to improve the UI and UX behind the Attributes filter
within the Inspector Controls of the “Products (Beta)“ block.
Also included:
* Refactor `useProductAttributes` hook
* Move it into the shared hooks.
* Fetch both terms AND attributes via the API (previously,
we got the attributes from the settings, but we'd get
partial objects compared to the API? Maybe a follow-up
to this could be to check why the attributes stored in
the settings are incomplete?)
* Make sure the return values match the ones expected
from search items.
* Remove attribute-related types from PQ directory
* Improve functionality of `SearchListControl`
* Allow the search input to be a Token based input.
* Allow for search input to search even collapsed properties.
* Use core `CheckboxControl` instead of radio buttons for
items having children (includes undeterminated state).
* Enable removal of tokens from the input
* Improve styles:
* Refactor classnames for `SearchItem`.
* Add more semantic classes.
* Align count label and caret to the right.
* Make caret switch direction on expanded.
* `cursor: pointer` on collapsible items.
* Indent children of collapsible items.
* Correctly pass through class names to search item
* Enable keyboard navigation for collapsible items
* Add link to manage attributes
* Change label inside the inspector controls
* Make search list attached when token type
* Implement more sophisticated behavior of parent checkbox
* If indeterminate or unchecked, it will check all children.
* If checked, it will uncheck all children.
* Remove hardcoded `isSingle` from `expandableSearchListItem`
* Use local package rather than WP package in base components
* Missing type on imports
* Move hasSpecingStyleSupport inline to avoid polluting utils with the block-editor external
* Use local wordpress-block-editor import to avoid the external
* Add readme to base directory to warn against using editor/components externals
* Check functions exist
* Revert "Check functions exist"
This reverts commit ce95800b79ddb48369cd22d2b7854384db0d8891.
* Revert wordpress-block-editor import
* Add todos to the hooks that need refactoring
* Update assets/js/atomic/blocks/product-elements/button/supports.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/image/supports.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/rating/support.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/sale-badge/support.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Update assets/js/atomic/blocks/product-elements/title/index.ts
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Reference issue
* Update assets/js/base/README.MD
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* spacing
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: kmanijak <karol.manijak@automattic.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>
* 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>
* Remove object from sanitizeHTML return value
* Import sanitizeHTML from utils
* Fix dangerously set inner HTML format
* Update package-lock
* Update package-lock
* Update package-lock
* Update @types/dompurify version
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* price-filter: update URL when filtering products of All Products block.
* active-filters: update the URL when removing price filter
* price-filter: prevent update query on PHP templates when changing prices
* active-filters: on PHP templates, remove filter only triggers the page reload
* price-filter: update comments and naming to reflect new URL behavior
* stock-filter: update url when filtering for All Products block
* attribute-filter: update the URL when filtering for All Products block
* attribute-filter: fix: uncheck all filter doesn't clear the URL
* attribute-filter: fix: endless page reload when filtering for PHP template
* attribute-filter: correctly set the defaults and update the filter query from URL
* fix: filter URL containing stock status doesn't work on homepage
* price-filter: fix issue with URL on All Products
The price slider doesn't reset after removing price filter from the Active Filters block if the initial price filter is set from URL
* ref: passing document.title to pushState is unnecessary
* use replaceState to avoid changing browser history
* extract change URL logic
* wip: convert attribute filter to ts
* change query to optional
* update SearchListControlProps and SearchListItemType
* get default attribute from metadata
* update types
* convert attributes utils to ts
* convert attribute query utils to ts
* fix type error, remove type casting
* revert type change for SearchListItemType
* apply new format
Also:
* Refactored some composed components into one inclusive HOC,
called `withUpdateButtonAttributes`.
* The HOC `withTransformSingleSelectToMultipleSelect` allows for the wrong
type to be passed to its wrapped component: if a single element is
passed, that is wrapped into an array.
This didn't play well with TypeScript which obviously complains about
the wrong type being passed to the component.
So we now allow for arrays to be passed as props and ignored by the HOC
* Move redirect logic to its own callback
* Update comment for updateAttributeFilter
* Remove condition for updating state for active filters only when filter button is not available
* Replace onSubmit with updateAttributeFilter
* Update logic lost in merge
* Replace checked stateful data with activeFilters data from URL
* Remove catalog_visibility from filteredCounts useCollectionData query for PHP templates
* Enable Attribute Filter block to work with the PHP rendered Classic Template block
* Check for presence of option before rendering it
* improve filter product by attribute
* fix pagination problem
* fix check when two filter block with same attribute are used
* fix filter by stock for PHP templates
* fix naming and comment
* Update filter key in ClassicTemplate
* Update stock filter block for PHP templates when the filter button is enabled
* Remove unused useEffect and fix ESLint error
* Set active stock filter and track using local state
* ESLint fix
* Remove unncessary dependencies from useEffect
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* Enable Attribute Filter block to work with the PHP rendered Classic Template block
* Check for presence of option before rendering it
* improve filter product by attribute
* fix pagination problem
* fix check when two filter block with same attribute are used
Co-authored-by: Luigi <gigitux@gmail.com>
* Add support for overlay color and duotone
* Add support for custom inner padding
* Wrap all block experimental features in `isFeaturePluginBuild`
* Fix resizable container min height
The container now resizes if, e.g., padding is increased, and can't be resized down
with the handle to a height lower than it's minimum size determined by content and
padding box.
* Fix resizable handle not being fully visible
Previously, `overflow: hidden` was needed because the height constraint and
padding could push the content out of the container. Now this should not be
possible.
* Add an option to the block to decide how is the image fitted to the container
* Make useStoreNotices interact directly with the store
* Get/set error notices directly in store in paymentMethodDataContext
* Add hasNoticesOfType util
* Remove useStoreNotices and interact directly with data store
* Create/remove notices directly in store
* Remove tests for useStoreNotices
* Add tests for notices util
* Use setIsSuppressed from useStoreNoticesContext
* remove useStoreNotices hook
* Update context typedef to define only isSuppressed and setIsSuppressed
* Remove all values from StoreNoticesContext besides setIsSuppressed
* Wrap Cart and Checkout blocks in StoreNoticesProvider (for isSuppressed)
* Make StoreNoticesContainer a named export
This is required so we can import it from @wooommerce/base-context
* Change addErrorNotice to createErrorNotice to match store action
* Remove unnecessary StoreNoticeProviders and pass only context to container
* Accept a context in StoreNoticesContainer
* Pass relevant context to StoreNoticesContainer
* Add function to remove notices by status
* Prevent checkout from breaking when removing notices during processing
* Prevent TS error about not included path
* Add StoreNoticesContainer to single product block
* Add StoreNoticesContainer to All Products Block
* Ensure errors are shown when using All Products & Single Product Blocks
* Add a context arg to removeNoticesByStatus
* Use correct contexts for all products and single product block
* Update tests to reflect new context argument
* Re-add missing block file for order-summary
* Remove block file for order-summary
* Send context to useStoreCartCoupons to show errors correctly
* Un-used PropTypes import
* Avoid global and use ownerDocument
* receiveCart return type
* ignoreRestSiblings when destructuring for @typescript-eslint/no-unused-vars
* Replace lodash find
* Use global rather than window
* Remove lodash map
* move rule to overrides
* 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
* convert eslint config to use @woocommerce/eslint-plugin
- removes unnecessary dependencies
- adds e2e-tests/specs to eslint ignore (they are automatically generated)
- turns off rules that will be handled in subsequent pulls (to avoid a mammoth changeset for review).
- NOTE: prettier config needs left in because of a bug with the existing version of `@wordpress/eslint-plugin` pulled in (fixed in https://github.com/WordPress/gutenberg/pull/25068) so I left the file for now.
* prettier fixes.
* remove obsolete plugin and fixes for eslint update
This branch brings an update to eslint which also changes some syntax with plugins. So this commit:
- fixes featuer-flag plugin syntax.
- removed obsolete dependency-group plugin (which is now in the `@woocommerce/eslint-plugin` configuration.
* add to-do comment
* fixes for test runs
- this also converts our e2e test scripts to use `wp-script test:e2e`, an advantage of this is it will load CHROMIUM on demand for the e2e test run.
* fixes for test runs
- this also converts our e2e test scripts to use `wp-script test:e2e`, an advantage of this is it will load CHROMIUM on demand for the e2e test run.
* include prettier alias as a dependency
This has to be done because prettier is installed with storybook and thus the alias setup in `@wordpress/scripts` is over-ridden by the storybook import.
* another attempt at e2e-test-fix
* add some debugging and temporarily just add one e2e config test for travis
* more debugging
* try installing full puppeteer and see if fixes
* fix package-lock?
* setupSettings separately from other fixture loading
* add debugging of files
* add another console.log (hopefully trigger travis)
* split out blockPage creation to it’s own as well
* fixed! remove debugging and re-enable travis configs for entire test suite
* fix config and rename e2e-tests to e2e
- fixes the failing product-search test
- tests/e2e-tests was redundant, I changed to `tests/e2e` (this follows a file pattern change made in woocommerce core as well).
* add todo for some eslint properties
* remove unnecessary early function execution
* revert earlier commit and remove duplicate call to createBlockPages
* Create useShippingAsBilling attribute
* Fix missing prop
* Refactor FormStep so stepNumber is generated by CSS instead of being passed as a prop
* Add billing address form
* Add text before controls
* Remove old @todo comment
* Update NPM packages
* Switch JSON dependencies to new PHP files
* include->require
* include->require
* Remove from package and run audit fix
* Update wp-prettier
* Use version from asset file
* Fix eslint issues and test failures
* Update OriginalComponent docblocks
* Props are objects, not arrays
* Array to Object
* fix tests throwing unhandled rejection errors in node.
These tests were all testing Promise.rejects but then not properly catching the reject in the assertions.
* exclude rule for no short array syntax allowed
This is a WordPress core standard that we choose to ignore because it’s silly in our context to follow that rule (and we’re being consistent with WooCommerce Admin).
* Helper to get namespace routes from the REST Api
* Add routes to store settings
* HydrateRestApiData component
* Correct usage of useSelect
* Remove lodash
* Move code to HOC
* Basic block construction
* Register on PHP side
* wc-active-filters script
* Price utils
* Refactor price slider so state reflects the query
Moves some logic from the component to the block so that min and max price can change (via query) and be reflected by the price sliders.
This allows the active filters block to change the query and have those new values reflected by the slider.
* Fix type checking of numbers
* Styles for filter block
* Improved attribute helper for getting attribute taxonomy data from ID/taxonomy
* Refactor attribute filter to use updateAttributeFilter helper
* Disable checkboxes when loading to avoid multiple queries
* Add todos - this is blocked
* Remove checked state from Attribute Filter so it gets updated from the store (https://github.com/woocommerce/woocommerce-blocks/pull/1170)
* isLoading check
* active price filtering rendering
* Block heading
* Implement block options; chip display with clear button
* Clear all should remove all attributes
* Enable previews
* Introduce a component to look up terms from slugs using collections (which are cached)
* Correct all docblocks
* activePriceFilters null return
* renderRemovableListItem
* Remove useMemo for hasFilters
* Switch classnames notation
* Ensure slug is array in removeAttributeFilterBySlug
* null -> undefined return types for attributes
* Remove fragment
* Check we have a termObject in ActiveAttributeFilters
* Refactor formatPriceRange return statements
* Ensure query array index will exist
* Only sort when adding a query
* Remove aria-label with dupe text
* hasFilters is function
* Update useQueryStateByKey usage
* More doc block fixes
* Update getAttributeFromTaxonomy return and docblock
* getAttributeFromID return/docblock