With these changes:
- If an observer returns an object wthout a type property an error is thrown and the emitter is aborted with an error type response.
- For anything else returned from an observer, it’s discarded.
Tests are updated for the new expectations
* Move validation calls to checkout API class
* Validate before payment
* Support additional error data
* Add coupon validation before payment, and hide hashes from user
* Implement validation and recalculation
* Abstract notice handler and implement legacy filters
* Handle generic cart item errors
* strip tags from coupon error messages woocommerce/woocommerce-blocks#2212
* Ensure item errors are surfaced when coupons are removed
* Fix wrong value passed to hook
* fix broken checkout when no payment method is there
* try fixing unit test errors
* if preview data has a receiveCart function use it, otherwise default to an anononymous function
* fix tests
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Convert woo notices into exceptions when processing legacy payments
* Prevent console errors when a message is not returned in the response
* include top level message property to capture REST error messages
* include capturing rest error messages on afterProcessing action
* clear notices before exception
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* fix broken validation error handling after submit
* Add handling for when there are no observers for payment processing or all observers just return true.
* cheque no longer needs to hook into event emitter
* account for no data on complete status handling in reducer
* add handling for either no observers or all observers returning true for onAfterProcessingWithSuccess emitter
* Handle errors when loading payment methods
* Use an error boundary
* Fix missing initial state in block error boundary
* Cleanup
* Only show internal user messages if it's admin or in editor
* Fixes
* Add friendly error message
* factor out editor preview data for saved payment methods to previews
* add missing imports lost in rebase
* use editorcontext to provide preview data to payment method context
* remove unused `activePaymentMethod` prop in CheckoutProvider and PaymentMethodDataProvider
* don't set the preview saved card as the default
* fix js error with cart in editor - fix EditorContext, pass previewData:
- editor context preview prop has changed;
- update cart to pass { previewCart } in previewData prop
- correctly destructure cart from previewData in useStoreCart hook
- correct typedefs
- EditorProvider props.previewData - now just Object
- similar for EditorDataContext
- correct default for activePaymentMethod state - empty string as before
* preselect 'use a new payment method' in checkout block editor preview
* update unit tests for changes to editor context
* remove stripe.js registration because it is lazy loaded via the library used.
* refactor payment method registration to preserve registration order.
* register payment method asset handles as dependency on editor script as well.
* initial mapping out of stripe payment intents
* rename checkout processing statuses to be clearer
* Add new status and refactor checkout complete behaviour.
* Make sure payment result data is included in checkout processing response
* add payment intent handling
Still testing
* make sure promise is returned
* include site url with endpoint
* modify setComplete status to optionally receive redirectUrl for changing in state at the same time as setting status
* fix typo in property retrieval
* add error handling for after checkout processing event
* add notices area for payment methods
* implement error handling for stripe intents
* hook into stripe error processing and include error in payment response
* clear notices so they don’t show in block and merge payment details
* add notice handling to payment context
* modify error processing in checkout processor
* handle errors with fallback in checkout state context
* hook into after processing for stripe cc error handling
* set checkout to idle status if before processing emitters result in error
* Add emit response type-defs and normalize expectations for observer responses
* improve doc block
* switch checkoutIsComplete check to checkoutAfterProcessing for payment complete status change
* remove unneeded event emitters and consolidate some logic
* fix idle status set logic
* remove logic server side for getting payment method from paymentdata
* ensure stripe accounts for payment request type payment methods
* make sure legacy payment method handling always runs last
* add processedPaymentMethodId to payment method data context state
* switch checkout processor to use new processedPaymentMethod id for submission
* implement returning paymentMethodId from payment-request-express
* include paymentMethodId in stripe cc success return value
* include paymentMethodId in cheque success return value
* add active payment method setting and handling via checkout
express payment methods still need to implement:
- onClick when their button is clicked
- onClose when the express payment interface is closed (cancelled etc).
* don’t expose setActivePaymentMethod on the payment method interface
* remove/fix artifacts from earlier iterations of the pull
* rename `id` property to `name` property for payment method registration
* Revert "include paymentMethodId in cheque success return value"
This reverts commit fe4ee8aced6d67bbd9033263ce61844349d18250.
* Revert "include paymentMethodId in stripe cc success return value"
This reverts commit 359a1f0089866110ec204182f8ffa14ab099c425.
* Revert "implement returning paymentMethodId from payment-request-express"
This reverts commit 117c68980b0876dee0acc78cec7754ccfe2a9bb1.
* Revert "switch checkout processor to use new processedPaymentMethod id for submission"
This reverts commit c38a05b63626dfc1336c7bb0e86417b798a803d6.
* Revert "add processedPaymentMethodId to payment method data context state"
This reverts commit 3d7923e7297f3c76efde536d26eaf68464ba9583.
* improve isSuccess response check and variable name
* implement paymentMethodId config option
* doh php ain’t javascript
* add missing dependency from rebase
* use cart data to provide country and currency_code
* remove files that likely got added back in from a bad rebase.
* modify canMakePayment config property so it must be a function
* Feed cart data to registered payment methods `canMakePayment` function.
This can then be used by payment methods for determining whether to show the payment method or not.
* implement new canMakePayment signature for cheque
Now canMakePayment doesn’t need to be a promise (payment method registry will handle wrapping all values in a promise to treat them as promises.
* implement canMakePayment as a function
* add logic allowing payment method to be overridden via payment data in request
* hook in to trigger server side processing of stripe payment request
* improvements to shipping data context
- memoize event emitters
- split up emitted events (reduces how often events trigger)
- Include whether rate is being selected in exported data.
* expose `isSelectingRate` value to payment method interface
* fix typo in shipping emitters for emitter type
* include setting of shipping data in payment method success status call
- this also requires changing the nested order of providers in checkout provider
* fix priority logic for event emitters.
- lower priority is supposed to fire before higher priority.
* normalize postal code for comparisons
* move normalize functions into stripe-utils folder
* refactor stripePromise so that it provides a specific instance to each payment method.
This also provides it as a prop to the pm components.
* renadme apple pay express to payment request express
This adds full support for the stripe payment request api instead of just applePay (so GooglePay, MicrosoftPay and ApplePay are now supported).
Also adds numerous fixes to internal logic.
* add handling to skip core checkout validation logic if express payment method is handling payment
Express payment methods have their own internal validation so this removes the need for checkout validating fields. This is also necessary because checkout validation breaks the flow when making a payment using express payment methods because of the order of the flow for these methods.
* splitting out emmitter effects for checkout and improving logic
Splitting up effects limits the potential for firing off emitters more than needed.
* remove unnecessary ref definitions
* fix on cancel action erroring for payment request modal
* ensure unique stripe object for component and canPay
* set default total label if one isn’t configured on the server
* fix order of state changes
* simplify condition
* remove unnecessary dependency
* normalize to uppercase too
* simplify can make payment conditional
* update comment blocks
* remove calculating as a checkout status (making it separate)
* include checkout is calculating for determining whether to flip payment status to process
* only change payment method state for status changes if needed
* fix reducer for shipping state
* include checkoutIsCalculating for determining whether to show validation errors in checkout block
* change where currentStatus is defined
* fix bug with saved payment method option
* Counting helpers for shipping rates and packages
* Use new helpers
* Make shipping calculator use shipping context directly
* Totals should use current address
* Avoid useShippingRates
* Return rates and other items from useShippingRatse in useStoreCart instead
* Update tests
* Merge conflict
* Merge conflict
* move preview to editor data and alias it no nothing in frontend builds
* seperate context and provider
* pass previewData as a prop to provider
* address comments
* Add customer ID to checkout API response
* Add customer ID to checkout context
* Show/hide remember payment checkbox based on checkout context
* Pass via payment interface instead
* Missing commas
* Make validation errors appear
* Make validation errors appear all at once
* Simplify diff
* Expose shippingErrorStatus from shipping context
* Memoize currentErrorStatus
* Pass currentErrorStatus to observers
* Add missing type-def property
* Fix typo in constant name
* Refactor emitEvent so false responses don't return true
* Make onCheckoutProcessing observers return errorMessage and validationErrors properties
* remove usage of paymentstatus dispatcher from apple pay
* add type-def for payment data response objects
* make sure shape of payment data for stripe cc is as server expects
* include payment data in checkout processor request
* fix bug that got reintroduced in rebase
* rename typedef
* Add interface for setting an express payment error notice.
* fix typedefs
* remove usage of paymentstatus dispatcher from stripe cc
* remove usage of paymentstatus dispatcher from apple pay
* remove any existing express payment notice on click
* revert buggy change with abort payment call
- also ensure that completePayment sets applePayProcessing to false
* Allow for priority to be set on event emitters
* Add payment event emitters
* add new actions/status to checkout state context
* implement event emitters in payment data context
* refactor checkout state context to use new actions in event emitters
* refactor checkout processor to handle new event emitters
* fix type-defs for registered payment methods
* register observer for cheque payment method integration
* add inline todo
* fix sort
* fix tests and add test for priority usage in event emitters
* remove todo and just add explanatory comment
* condense sort logic
* lowercase test description
* abstract emitter callback to reduce code
* don’t process passed in errors if it’s undefined
* improve error response expectation for payment processing event observer
* Hook up checkout validation with context
* Make sure hasValidationErrors is up to date in onCheckoutProcessing
* Move validation check inside CheckoutProcessor's processCheckout
* Make sure all checkout form fields have a unique ID
* Don't clear checkout context errors in shipping context
* Move CheckoutProcessor to the top so scrollToTop works
* Do not disable Place Order Button if there are errors
* Split checkValidation and processCheckout in Checkout Provider
* Refactor event emitter to use Maps
* Save payment method errors to validation context
* Show an notice when a payment method has an error
* Make sure JS errors during payment are displayed
* Remove error notice when payment method doesn't return an error anymore
* Make sure payment methods know if shipping and billing addresses are the same
* Make sure checkout is only processed if payment methods didn't fail
* Make sure state input also has an id
* Clear input and select errors on unmount
* Pass id to CountryInput and StateInput
* Fix function name
* Add missing default context values
* Move onCheckoutCompleteError effect to CheckoutBlock
* Remove conditional from shipping setHasError
* Rename and move existing checkout provider to checkout-state provider.
This allows us to re-use the interface exposed on this provider for cart and checkout blocks.
* refactor checkout provider to implement the new checkout state provider.
* Add Cart provider and export
* fix type-defs
* fix editor context provider and ensure all `isEditor` checks come from this provider
* fix type definition
* implement cart provider
* add selecting rate resolution state to the cart store
* expose whether rate is being selected on useSelectShippingRate
* Cleanup and refactor ShippingDataProvider
- remove un-needed component and move shipping rates into context provider
- remove error handling (currently the ui/ux for the checkout should result in no errors and any api errors are non-recoverable).
- Add logic for shipping rate selection into context provider and add event emitters for it.
- increment/decrement checkout calculation counts when shipping rates are being selected.
* dispatch checkout error if there is an error
* disable place order button if checkout is calculating or has error
* update doc block
* fix convention for js comment blocks
* CheckoutProcessing work
add missing memoization and implement useRef strategically
This prevents effects from firing unnecessarily.
Tweak assets registration
Order hydration and checkout/ endpoint updates
Fix error handling
Error handling
* Missing isset in stripe
* Fedeback
* rename draft order ID action
* Todos
* Make Product Price component accessible
* Render checkout form step number before the content instead of after
* Announce changes in the Shipping Rates Control results
* Render product name before product price in the Checkout sidebar
* Verify error element id exists before using it in describedBy
* Avoid reading 'Choose a shipping method' if no shipping methods are available
* Hide product image from screen readers if there is no alt text and make link not focusable
* Move Checkout block buttons below the sidebar
* Simplify selector
* Remove ternary to make code easier to understand
* Fix rebase issue
* Fix step number not visible for payment methods
* Server side changes for payment method integrations
Including adding a stripe class temporarily
* update needed npm packages (and add some types)
* updates to contexts
* remove stepContent from payment config for payment methods
* update payment method interface and typedefs
Exposing a components property to pass along components that payment methods can use (so we keep styles consistent for them)
* add apple pay and stripe cc integration and remove paypal
* remove save payment checkbox from checkout block
It is handled by payment methods.
* Include an id prop for tabs
* fix activePaymentMethod pass through on rendered payment method element
also adds an id for the rendered tab
* add styles for payment method fields
If payment methods use these classes for their fields then the styles will get applied. It _could_ allow for consistent styling, we may have to provide design documentation for this?
These are styles in cases where payment methods have to use elements provided by the gateway (eg. Stripe elements). In future iterations we could look at providing components to payment methods to use (if they aren’t restricted by the gateway).
* fix rebase conflict
* do a test payment request for applePay to determine if the current browser supports it
* don’t console.error for stripe loading.
* Fix placeholder errors in the editor
* improve styling and add missing validation for inline card element
* update pacakge-lock
* rename payment-methods-demo folder to payment-methods-extension
* expose checkbox control on payment method interface
* export payment-methods-extension to it’s own asset build
This allows us to more accurately demonstrate how payment extensions would hook in to the blocks.
* don’t enqueue a style that doesn’t exist
* add full stop to comments and remove obsolete comment blcok
* fix spacing
* switch `activeContent` to `content` for payment method registration config
* Checkout class tidyup
* CheckoutProcessor placeholder
* ShippingMethodDataX to ShippingDataX
* Remove billing from checkout provider
* Remove billing data hook
* Remove billing from payment methods state
* Update typedefs
* Billing context
* Fix billing and shipping context persistence bugs
* Remove address form change
* Move phone back; another PR can deal with this
* Remove unused state
* Add saved-payment-method options handling and improve payment method registration initialization
* add server side exposure of saved customer payment methods
* fix reducer for express payment method state
* fix default for customerPaymentMethods
* Add line pricing for cart items in the API (https://github.com/woocommerce/woocommerce-blocks/pull/1979)
* Add line pricing for cart items
* Update checkout linePrice
* Fix tests
* Update schema - add dinero
* Implement dinero in cart totals
* Update preview and remove line totals
* Update package lock
* Update checkout review
* Fix preview and default data shapes
* return first and last name in shipping address
* remove shippingAsBilling option from editor settings
* remove billing data from store
* move to context
* hook billing to hook and sync with shipping
* add email to billingData
* hydrate billing data
* some refactors
* move hydrated billing data to reducer initial state and fix stale dependencies
* fix stale useCallback
* better checks in php types
* get isEditor from context
* update typedefs
* skip state update if nothing changed
* fix rebase
* update snapshots
* rebase package
* wrap setEmail in useCallback
* remove ValidationContextProvider
* fix docs
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add Checkout form validation
* Add back validation when filling the address without having set a country
* Split TextInput and Select so they can be used with or without validation
* Cleanup
* Only display the missing country error if city, state or postcode are entered
* Fix CSS specificity conflict
* Remove unnecessary semicolon
* Rename areThereValidationErrors to hasValidationErrors
* restructure event-emit directory and convert emitters to promises
- also add emitEventWithAbort function
* implement event emitters as promises
* clean up logic
- return from for loop
- define response as const on each iteration.
- return true if loop completes successfully.
* rename event_emit folder to event-emit
* add errormessage handling to countryinput (along with storybook)
* add types for react
* Add validation context and implement
* implement validation context for country field validation
* tweak ValidationInputError so that it can receive property name for getting error from
* improve storybook webpack config to pull from tsconfig.json
* update storybook story to cover changes with context
* Wrap Checkout Provider with Validation Context Provider
* add screen-reader-text style to storybook
* add styles for input error validation to text input
* improve styling for ValidationInputError component
* add validation error handling to TotalsCouponCode component
And story
* make sure errors are cleared on successful receive/remove item
* dispatch loading cancellation on catching errors
This is needed because loading would be cancelled before the error is thrown so any error handling after the thrown error will not be able to rely on loading.
* implement validation setting for coupon errors
* add error color to labels on inputs too
* fix borders back and force border color
* remove extra structure and improve validation error with alignment for coupon code
* add aria-describedby for text inputs
* add back in validation context provider to fix rebase issue
* rework validation so it works for both checkout and cart
* Some styling tweaks
* more style fixes
* remove unnecessary method
* make sure new function is included in context defaults
* package.lock update? seems harmless so rolling with it.
* add snackbarnotices to notices system
* implement snackbar notices for coupon code ui
* improve styles with mobile styles as well
* some more css fixes
* use native filter
* remove usage of lodash filter and dont’ output container if there are no regular notices
* remove unnecessary duplication of styles
- load default snackbar styles from WordPress components
- override for frontend to make them fixed to the window (including mobile treatement).
* simplify css class generation (save some bytes)
* improve proptypes definition
h/t: @aljullu
* consistent style handle name
* increase bundle size budget
* Move cart attributes to attributes file
* Stop feedback prompt jumping around; consolodate strings
* Update option labels and descriptions
* Match checkout save function
* hasShippingRate helper
* Refactor full cart/frontend views for shipping calc
* Add hasShippingAddress to useShippingRates hook
* Initial shipping calculator in totals row implementation
* Create cart context
* Update preview data to match API response
* Use context provider for cart
* Provide default cart item for placeholder with correct shape
* Remove outdated shape validation from cartlineitemrow
* Use preview data in editor context
* Tidy up components
* Tests/lint
* Update assets/js/base/components/totals/totals-shipping-item/has-shipping-rate.js
Co-Authored-By: Seghir Nadir <nadir.seghir@gmail.com>
* No need to camel case previewdata
* Use isValidElement
* Implement EditorContext
* Use select if no post is given
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* add isEditor to checkotu context and implement in provider usage
* modify configuration expectations for payment method registration api
* update registration of payment methods in demo
* implement new configuration in payment method components
* fix argument order and update jsdocs
- restructures `@woocommerce/base-context` imports so it pulls from `index.js` in the `base/context` folder. That way tree-shaking will be used if possible. This also helps with organizing the folder structure a bit better for the new contexts.
- Fixes all the various imports through the code due to the above change.
- Adds `CheckoutContextProvider`, `useCheckoutContext` and related files.
- Adds `PaymentMethodDataProvider`, `usePaymentMethodDataContext` and related files.
- Adds `ShippingMethodDataProvider`, `useShippingMethodDataContext` and related files.
- Adds typedefs used for the various context interfaces.
* Working on store provider
* Working on store provider
* Reducer implementation
* Implement core/notices
* Add notices to store coupon hook with context
* Improve store notice text and styling
* Improve JS side API for notices
* Wrap functions with context additon
* Update test to []
* Implement props feedback and useInstanceId
* Update assets/js/base/context/store-notices-context.js
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* Update assets/js/base/context/store-notices-context.js
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* remove instance id
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add Feedback Prompt in Cart & Checkout blocks sidebar
* Add border
* Move getInspectorControls out of the component function
* Move feedback prompt to a HOC
* Add @todo comment to feedback link
* Use filter for withFeedbackPrompt
* Export withFeedbackPrompt from hocs index.js
* Typo
* Try moving the feedback texts to context
* Revert "Try moving the feedback texts to context"
This reverts commit 21f889b021ceea6fef722efab9663799829bc769.
* Revert "Use filter for withFeedbackPrompt"
This reverts commit 96bba029d61a383eafa2c0a1c08f7988e319b50d.
* Set feedback text in the HOC function
* Use arrow-function to simplify code
* Refactor
* 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).
* ensure useProductLayoutContext actually returns the context!
* add query state context and export provider and hook.
* implement useQueryStateContext in existing querySTate hooks and refactor other implementations
* add back in documentation removed in rebase
* default layout context to empty string (no need to add additional classes by default
* fix jsdoc
* add a context value validator and tests
This handles validation incoming value prop on a context provider with an object.
* implement context validator and fix related bugs
* rename context to better match it’s purpose
* correct spelling
* Update assets/js/base/context/utils.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* tighten up the iteration
* Inital block creation
* Update labels
* Columns, rows, sample data json
* Output data from API
* thumbnail_html
* Split into smaller components of grid
* Price handling
* Image handling
* Remove !
* frontend
* Work on cart api
* Cart error handling and product type conditions
* innerblock progress
* Implement layoutConfig as set from innerblocks shape.
Note:
- this is just a poc
- where things are configured likely needs changed
- will still need to work out how this gets persisted for the frontend and how things get displayed there (but likely will work fairly similar in terms of mapping to components).
* use correct prop name
* Working edit button
* Clean up block controls and edit view
* Add link with innerblocks
* update link description
* correctly handle components with inner blocks as children
* Re-organise atomic components and blocks into own directories
* Unique keys for components
* Fix default layout when inserting block for first time
* Working layoutconfig save
* Save attributes
* Move sale badge to image component
* Add disabled to render preview and blocks
* icons
* Editor view styling
* Update withComponetId to stop component ID incrementing too many times
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* Improve key generation
* done/cancel buttons on edit
* Create withProducts HOC for All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/994)
* Create withProducts HOC for All Products block
* Add order select and pagination to All Products block
* Go to first page when changing order
* Add HOC test
* Make sure block is updated whem columns/rows change in the editor
* Fix 'SALE' badge positioning
* Remove unnecessary key
* Honor 'perPage' value when generating placeholders
* Make placeholder sizes match rendered block item
* Several CSS improvements
* Remove unused CSS properties
* Move getProducts to hocs utils
* Remove All Products sample-data.json
* Fix order select wrong margin in the editor
* Refactor how loading image gets its size
* Clear products when loadProducts start
* Enhance pagination logic
* Fix placeholder width
* Fix regular_price check
* Set product link max-width
* Implement querystrings for the All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/997)
* Implement querystrings for the All Products block
* Create withWindow HOC
* Add with-window tests
* Use renderFrontend util in All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1003)
* Add with-window tests
* Use renderFrontend util in All Products block
* Rename properties and components from 'order' to 'sort' (https://github.com/woocommerce/woocommerce-blocks/pull/1012)
* Rename properties and components from 'order' to 'sort'
* Rename onOrderChange to onSortChange
* Remove unnecessary stylint-disable-line (https://github.com/woocommerce/woocommerce-blocks/pull/1016)
* Create withBrowserLocation and withBrowserHistory HOC (https://github.com/woocommerce/woocommerce-blocks/pull/1022)
* Create withBrowserWindowProp HOC
* Remove unnecessary expect's
* Always pass window prop to propMap if it exists
* Scroll to top when switching pages in All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1011)
* Scroll to top when switching pages in All Pages block
* Improve keyboard navigation in the All Products block
* Create withScrollToTop HOC
* Fix variable name typo
* Update paths with aliases
* Avoid first and last page being included in pagination 'pagesToDisplay' (https://github.com/woocommerce/woocommerce-blocks/pull/1015)
* Update lock
* constants
* linting
* Clean up styling
* Prettier
* Block options for title/image
* Prettier
* Remove shared content controls
* Update atomic block descriptions
* Summary block
* Prettier
* Impoved template edit appearance and added inline tips
* Apply prettier
* Reset and cancel buttons
* Improved keys
* Tweak tip placement
* Remove incorrect comments
* Remove disabled ofr non interactive elements
* Fragment not needed
* Update assets/js/atomic/components/product-list/title/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Move componentId hoc
* Comment
* Implement onImageLoaded
* Pagination: disable first/last page if they are active (https://github.com/woocommerce/woocommerce-blocks/pull/1041)
* Update assets/js/atomic/components/product-list/rating/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Sale badges refactoring
Adds sale badges blocks and improves how the default blocks are defined.
* revert changes in withComponentId
* fix flexbox alignment
* Create withQueryStringValues HOC and use it in ProductGrid component (https://github.com/woocommerce/woocommerce-blocks/pull/1040)
* Create withQueryStringValues HOC and use it in ProductGrid component
* Add tests
* Add comment explaining urlParameterSuffix
* Don't destructure props if only used once
* Move dependencies check outside the HOC
* Update test description
* Remove HOCs no longer used
* Update assets/js/atomic/blocks/product-list/image/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update assets/js/atomic/components/product-list/sale-badge/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update assets/js/atomic/utils/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update assets/js/atomic/utils/index.js
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* Feedback
* Grid to List
* Improved badge handling
* update package-lock after merge from master
* Add wp.data store for schema and lists. (https://github.com/woocommerce/woocommerce-blocks/pull/1008)
* install @wordpress/data-controls and deepFreeze
* add schema store
* add query-state store
* add collections store
* add bundle entry point (and export store keys and constants)
* add master README.md for new stores
* add bundle configuration and register asset php side
* Add missing param name
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* code style fixes
* remove unnecessary period from test description
* Simplify conditional
* reorder imports (code style)
* reorder imports and codestyle
* refactor using lodash for state utils
* reorder imports
* reorder imports
* reorder dependencies
* reorder dependnecies an remove duplication block
* remove errant tab
* reorder dependencies
* Modify collections store to add headers to the store state. (https://github.com/woocommerce/woocommerce-blocks/pull/1073)
* add control for getting unparsed response from apiFetch
* Modify action so it recieves a response object.
* modify reducer to handle response object
* improve selectors to make headers accessible
- modifys existing `getCollection` to retrieve items from state.
- adds `getCollectionHeader` selector
* update resolvers to handle full response from request
- also adds resolver for `getCollectionHeader`
* update docs for changes
* Improve spacing in doc
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Fix spacing in inline docs
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* change `getFromState` to receive an object instead of arguments list.
* Prepare All Products block to accept extension inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1047)
* Simplify BLOCK_MAP
* Prepare All Products block to accept extension inner blocks
* Change filter name
* Update filter name
* Add check that block exists in BLOCK_MAP
* Create REVERSED_BLOCK_MAP instead of searching blocks each time
* Change how child blocks are registered for All Products block
* Refactor All Products block so reverse map isn't needed
* Remove getDefaultBlocks
* Make sure getRegisteredInnerBlocks always returns an object and add checks to registerInnerBlock
* Add missing blockName arg
* Add inline docs to block registry
* Move 'blockName' prop to context
* Typos
* Improve registerInnerBlock error messages and create a validation function
* Refactor context
* Rename validateOption to assertOption
* refactor where new context lives and add alias for base-context
* fix doc block
* remove todo block (there’s an issue for it)
* rename context
* Update assets/js/atomic/components/product-list/sale-badge/index.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* HeadingToolbar comment
* Tweak bool comparison
* Improve how default layouts are set so all blocks can be removed and the no-content message is correct
* Sale centering
* Fix default template
* Product example switch to preview
* Update preview schema and image data to match latest schema
* Add @woocommerce/atomic-components alias
* Alias for previews to prevent need for relative paths
* Drop `align` for sale block
Align disrupts other blocks in unexpected and unavoidable ways. Drop support so the sale block is a block level item.
* Rename atomic components and blocks (and create ProductLayoutContext) (https://github.com/woocommerce/woocommerce-blocks/pull/1089)
* rename atomic blocks and components to be more generic (drop list)
* create new context for productlayout and implement provider
* Rename ProductSalesBadge to ProductSaleBadge
* Add php5.3 restriction for All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1090)
* enable legacy builds and add handling for AllProducts to be wp5.3 only
* fix legacy builds
* Prevent filemtime notice
* Implement new data stores with All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1067)
* add new hooks and tests and alias for hooks
* various fixes for stores after implementation tests
* implement new stores for ProductList component
* add doc blocks for useStoreProducts hooks
* fix typo in property on returned object