* 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
* Feature gate PaymentApi
* Improve payment method missing dependencies error message so it's clear it only affects blocks
* Add PaymentApi feature flags to list of feature flags in docs
* modify emitEventWithAbort to change return value
`emitEventWithAbort` now returns an array of responses up to the first response that triggered an error or fail response instead of aborting on success responses too.
* update add to cart form context provider
* update checkout state context provider
* update payment method data context provider
* update tests and fix thrown error handling.
* 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>
* Update package-lock.json
* Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059)
* 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
* Rename product backorder badge to tsx
* Rename Policies component to tsx
* Convert Product badge to TS
* Convert Product Details to TypeScript
* Convert ProductImage to TypeScript
* Convert ProductLowStockBadge to TypeScript
* Move ItemData into ProductResponse type def file
* Add type defs directory to tsconfig
* Import types for ProductResponseItemData in ProductDetails
* Convert ProductMetaData to TypeScript
* Convert ProductSaleBadge to TypeScript
* Type component props to their interfaces
* Ensure components have an explicit return type of JSX.Element set
* Export PLACEHOLDER_IMG_SRC as string
* Add null to component return type
* Import PLACEHOLDER_IMG_SRC from correct location
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Convert Button to TypeScript
* Add alias of @types/wordpress__components
* Make ButtonProps extend the wp/components button's base props
* Update package-lock.json
* Extend Button.ButtonProps instead of only BaseProps
* Add return type to Button component
* Add emptyHiddenAddressFields function
* Add tests for emptyHiddenAddressFields
* Remove address fields that should be hidden before processing checkout
* Empty hidden address fields before displaying in shipping calculator
* Refactor emptyHiddenAddressFields so we only iterate once
* Fix test for emptyHiddenAddressFields
* Import default address fields from @woocommerce/settings
* Import emptyHiddenAddressFields
* Copy address first before emptying fields
* Modify address directly instead of copying it
* Copy address variable instead of mutating it directly
* Add files to TS project
* Return the new address rather than the parameter
* Don't clean address fields in the presentation layer
* Clean address in useStoreCart before it gets sent to components
* 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
* Add When to employ end to end (E2E) testing doc
* Add links to documentation for RTL and puppeteer
* Update docs/testing/when-to-employ-e2e-testing.md
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update when-to-employ-e2e-testing.md
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>