* Remove summary from API
* Add wordCountType to assets
* Update packages
* Remove summary from test data
* Featured product uses short desc
* Pass description instead of summary
* Use new Summary Component
* Component and tests
* Increased versititilty of methods
* Update assets/js/base/components/cart-checkout/product-summary/index.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Extra tests for html tags
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Bump package version for testing
* New install routine and db version
* Revert "Bump package version for testing"
This reverts commit c3fee55a34e75429b731cd7a2cc07e841010df6d.
* Update bootstrap to ensure blocks is installed properly before tests are ran
* Restore errors after install
* Use enabled method instead of comparing db version
* Moved installer code to admin_init
* Tweak test bootstrap
* Remove unused wc/blocks/cart endpoint
* remove unused withProducts hoc
* Remove getProducts util
* Use store API products endpoint in product blocks
* Remove product endpoint tests
* Remove controller
* Switch attributes endpoint to store api
* Refactor withAttributes to use store API
* Migrate tags and cats to store API
* MIgrate variations to store api
* Migrate reviews to store API
* Drop dedicated variation endpoint
* Move tests
* Move cart init
* Fix reviews
* Comment out broken tests
* Remove old class based with-attributes test
* `use` is never relative - absolute is always used so backslash is not needed
* Move process_legacy_payment code to rest api class
* Move storeapi directory
* Updated namespaces and moved tests
* Return updated cart if there is a conflict (409 response) e.g. item no longer exists
* Receive updated carts
* Update tests and coupon handling
* Further rewording
* Switch add to cart events to useStoreCart hook
* Add to cart endpoint
* Inject dependenct schemas
* Feedback, cart items are based on product schema
* Variable typo
* Move hook to base
* Update totals correcrly
* Update tests to use schema/routes class
* Update tests to correctly use schema
* Remove type hint to prevent strict standards error
* 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
* 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>
* Disable authentication for the Store API completely.
This may also resolvewoocommerce/woocommerce-blocks#1991
* Add nonce handling to the abstract route
* Default state
* Add shared controls including nonce api fetch
* Use shared controls
* Hydrate inital nonce
* Update data stores
* Update nonce validation
* Fix tests by setting nonces
* Remove print_r debug
* Revert useStoreCart change
* Add nonce middleware
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* Switch back to apiFetchWithHeaders
* Docs
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add checkout skeleton as loading state and remove placeholder text from save method
* Hide skeleton when not loading
* add loading class
* Update snap
* Add back icon
* Add cart URL constant
* Add button components
* Implement button components into checkout
* Update checkout styles to match mockup incl updates to margins and padding
* Add options to control return to cart link
* Use checkout context
* Update snapshot
* Update context
* href
* Color/arrow styling
* Implement select instead of open URL field
* Add notice and updated settings control
* Show notice conditonally
* Store permalinks to avoid extra API requests, and get pages via API
* Update snapshots
* Fix double layout conflict
* Switch back to ID and add permalink via block setting
* snaps
* Fix snapshot; add default shape for pages
* Feedback
* Better undefined handling
* Update assets/js/blocks/cart-checkout/checkout/block.js
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Remove CartShippingRates endpoint
This was moved to the /cart endpoint
* Unused customer endpoint
* Split controllers into routes
* Update/fix tests
* Add draft order ID property to the Cart schema.
* Fix status check
* cart/order-create endpoint
* Placeholder for checkout endpoint
* Resolve merge conflict
* Update classes to match master
* Use correct schema
* 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>
* Remove CartShippingRates endpoint
This was moved to the /cart endpoint
* Unused customer endpoint
* Split controllers into routes
* Update/fix tests
* Create RouteException and single handler per route
* Move exception to cart controller
* add various hooks and improve hooks folder structure
- Also restructures hooks directory to make things a bit more organized
- Add useStoreOrder placeholder (followed up in future pull)
- Add useBillingData hook.
* implement usePaymentMethodInterface hook in payment method components
* remove obsolete hooks and implement new checkout context hooks
- add useCheckoutSubmit which exposes checkout submit button interface
- add useCheckoutRedirectUrl which exposes checkout redirect url interface
* add alias for `@woocommerce/base-utils` to jest config
* use consistent variable names for payment method id
- `useStoreCartItemQuantity` now receives the cartItem instead of the `cartItemKey` as an argument. I didn't notice in previous reviews how it's used in the context where we already have a cartItem so implementing this reduces complexity and makes the hook more precise for it's purpose.
- Add `backorders_allowed` to the CartItem schema for the API. This allows for client to have correct logic for maximum quantity when this value is true.
- Implement the above in the `CartLineItemRow` so that quantity picker is limited by the amount of stock remaining if that is available (`lowStockRemaining`) and the `backorders_allowed` is false.
- maximum quantity is currently hardcoded to a (filtered) value of `99` when other conditions don't apply (see related issue in woocommerce/woocommerce-blocks#1913)
* Add expires column to table
* Use core class if it exists.
* Add Exception class
* Update for currcurrency
* Update tests to handle exception
* Add back legacy stock handling
* Update comments
* add select shipping endpoint to router
* add select shipping method
* add selected rates to cart
* better select rates
* move schema function to seperate function
* move validation to Cart Controller
* fix wrong session key
* Update shipping/cart endpoints (https://github.com/woocommerce/woocommerce-blocks/pull/1833)
* Items should not have keys in API response
* Include package ID in response (this is just a basic index)
* /cart/select-shipping-rate/package_id
* Add package_id to package array
* Update responses and add shipping-rates to main cart endpoint
* update-shipping endpoint
* Add querying selected shipping rate to the store (https://github.com/woocommerce/woocommerce-blocks/pull/1829)
* add selecting shipping to store
* directly call useSelectShippingRate
* refactor cart keys transformation to reducer
* remove selecting first result and accept selecting
* move update shipping to new endpoint
* pass selected rates down
* select shipping right directly and fix editor issues
* fix some broken prop types
* key -> package id
* Update and fix cart/shipping-rate tests
* fix case for when rates are set
* Update useShippingRates test
* add args to rest endpoint
* move selecting shipping rate logic to hook
* fix some naming issues
* update propTypes
* update action call
* fully watch cart state
* address review issues
* fix prop type issues
* fix issue with rates not loading in checkout
* remove extra package for shipping
* move ShippingCalculatorOptions to outside
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* ensure cart totals update when items are removed (prototype):
- return complete cart object from DELETE cart/items/:key
- use receiveCart on client to update whole cart including total
* move API endpoint for removing cart items to cart controller:
- returns full cart schema so should be part of cart controller
- is now a POST request with param - not strict REST
- fix up client action to use new API
* move API test for removing cart items (API has moved)
* use correct path for remove API in tests (doh!)
* add extra API test for remove_cart_item with bad key => 404 (experiment)
* experiment: delete test_remove_cart_item, does test_remove_bad_cart_item work?
* reinstate test_remove_cart_item with single valid request
* remove unnecessary newline
* tidy comments in PHP api tests, rerun travis?
* remove test_remove_cart_item which may be causing problems
* reinstate troublesome remove cart item api test (experiment):
- see if this works now travis issue is resolved
* whitespace
* show correct total when changing cart item quantity:
- move update cart item quantity API to cart controller
- & return full cart response
- update js action to new API route & receive full cart response
* simplify test_remove_cart_item API test - now just tests a valid remove succeeds
* remove test_update_item (API has moved) +
+ experimentally remove test_remove_bad_cart_item
- testing if cart remove tests interact with each other
* fix tests (🤞) - pass params in body, not as query params
* reinstate test for re-deleting same item
* update API docs - update/delete cart item have moved to /cart
* add response data checks to new cart API tests:
- extra protection against expected 404 "false positives"
* reinstate API test for changing cart item quantity
* fix remove cart item body tests - MIA items return error code, not cart
* fix test - quantity param is int not string
* attempt fix 404ing test_update_item:
- only allow POST, remove trailing `/`
- align array equals for good measure :)
* fix action for update-item - method=POST, now takes body params
* fix response body asserts in test_update_item
* reinstate update_item and delete_item on CartItems controller
* typos + examples in new cart items API docs
* reorder previous cart item docs to minimise diff/churn
* reinstate tabs in docs response example
* Fix background overlap of feedback box
* TS notices
* Add company name toggle
* Implement new attributes and toggles in editor
* Handle field config in address component
* Remove other hoc rule from tsconfig
* map -> forEach
* Remove return from forEach
* Export and extend field config
* Fix optional text for all field types
* unit text
* Update snapshot
* fix broken e2e test - update snapshot for checkout block:
- new `use-shipping-as-billing` data attr
* add package.json script for updating e2e test snapshots
* basic e2e tests for cart block:
- can add block, confirm editor markup matches snapshot
- can only insert one cart block
* add basic tests for checkout block:
- can add & matches snapshot
- can only add one block
* confirm single-cart test works, by allowing multiple cart blocks :)
* Revert "confirm single-cart test works, by allowing multiple cart blocks :)"
This reverts commit aae10046f37bc53bf11d8d2e1deb626d53654f71.
* Persist previous shipping rates while loading
* Refactor ShippingRatesControl LoadingMask
* Show package name
* Simplify CSS to avoid using the adjacent selector
* Add comment to explain why 'selected' is hardcoded in the editor
* Rename package 'index' to 'key'
* Move coupon code for API requests to body - fixes issues with coupon codes containing special characters
* Use wc_format_coupon_code when applying/removing coupons via the cart endpoint
* Add tests
* useStoreCartCoupons hook
* Apply coupon w/ basic error handling for the fetch
* Basic store specifically for cart data
* Working on error states
* Show error on coupon fail
* removeCoupon action
* Added extra endpoints for more efficient cart queries
* Apply/remove coupons working
* Track applying/removing state
* StoreCartCoupon typedef
* Use coupon code on index
* Remove custom controls definition
* Adjust storecartcoupons mapper and remove ref
* Move cartData defaults and remove ref
* Call API directly, avoid schema lookup
* Improved selectors
* StoreCart typedef
* Split up cart state data and add more typedefs
* Add API tests for apply/remove coupon
* Jest tests
* Move default cart data to constant
* Comment indentation
* Create ShippingMethodsControl component
* Hook up shipping methods to API
* Add support for several packages
* Add tests to useShippingRates
* Fix shipping_rates property name
* Only show the products list if there are several packages
* Use <FormattedMonetaryAmount> to display shipping rate prices
* Make 'country' optional in CartShippingRates
* Make CartShippingRate API return currency info
* Minor improvements
* Fix shipping fields hidden in editor
* Fix missing currency in Checkout shipping rates selector
* Add links to issues in @todo comments
* Improve ShippingRatesControl useEffect
* Remove unnecessary tab
* Remove unnecessary id in RadioControl
* API: Add error when country is invalid
* Debounce shipping rates API requests
* 'Country key' -> 'Country code'
* Don't display radio input when there is only one option
* Add message when there are no results
* Minor enhacements
* Remove unnecessary Fragment
* Simplify RadioControlOption export
* Refactor 'renderOptions' and split it into several components
* Prevent Card sidebar from taking too much width
* Move country request check outside of the loop
* Fix failing test
* add docker files
* get tests to work
* remove irrelevant files
* add woocommerce as a dep
* remove eslintignore for tests
* undo travis chages till another PR
* remove local utils and call them directly from woocommerce
* remove travis db
* Block snapshot
* Test than the block can be inserted and interacted with
* Add snapshop
* Update snapshot
* rebase on master
* add a build script for just doing npm build on e2e tests
* just run build for e2e test job
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add docker files
* get tests to work
* remove irrelevant files
* change userAgent to chrome
* add woocommerce as a dep
* add jest to eslint
* remove eslintignore for tests
* undo travis chages till another PR
* remove local utils and call them directly from woocommerce
* update deps
* add setup files to run tests
* export default wp link
* wait for select before selecting
* remove travis db
* ignore e2e tests in unit testing
* add tests
* add docker commands
* always run composer
* Make it possible to import directly from '@woocommerce/e2e-tests/utils'
* remove installing woocommerce via composer.
* add more docker npm scripts
* add custom docker config for wp-cli
* add changes to docker-composer.yml
Includes reading environment variables from `.env`
* revert customizations to .travis.yml
* move main docker file for the wordpress container to bin
* fix travis config
* rename wp install for travis builds back to original name
* use a version of docker-compose that travis supports
* add minor change to try and force travis test run
* fix incorrect command
* copy composer lock from master
* only run phpcs on /src directory
* give time for host to spin up for e2e tests
* increase sleep for waiting on container
* make sure plugin is built before running tests
* sigh fix improper command usage
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* Audit atomic block labels
* Add summary, descrtiption, and short description to API and use for summary block
* Add summary to cart item api
* Respect short description
* Tweak label of summary block
* Revert product rating label
* One description vs 3
* Update sample content with more appropriate values, and match in cart items sample
* Move summary generation to class
* Tests
* Prevent extending `ProductSummary`
* Tweak $paragraph handling
* More accurate word counting
* add tear down for filter
* Add schema validation helper
* Add tests for cart item schema
* Fix schema errors found by tests
* Add tests and fix validation for remaining store API endpoints
* Tweak response for nested diffs
* Array syntax
* Improved nesting and type validation for schema
* Implement and fix type checking across test suite
* Type validation fixes
* Fix null comparison
* Fix array handling
* Switch to number type and support in validation
* Test the tests
* Update tests to use objects which match schema, avoiding JSON encode/decode
* Checkout/order WIP schema
* Add _address suffix for billing/shipping
* Rename schema, update endpoints, create tests
* Fix POST in test
* Fix test response checks
* Stock reservation and draft order status
* Add todo for shipping lines
* Readme
* Rename address fields in readme
* 10 min timeout of stock
* Fix broken test
* Update src/RestApi/StoreApi/Controllers/CartOrder.php
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* Add typehinting where possible
* Remove explicit pass by reference
* Further typehinting
* Clarify todo comment
* Validate product instances
* Specific phpcs exclusion rule
* Exclusion rule
* Move ReserveStock code to class
* Correct shipping-rates schema to shipping_rates
* Save shipping rates and lines if included with request
* Insert todo for shipping rate code
* Calculate shipping and selected shipping from order properties, not global cart properties
* Prevent error when shipping is not needed
* Update API readme
* Added tests for stock reserve class
* Fixes conflicts with draft statuses
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add schema/GET endpoint
* Customer data updates + create tests
* Update docs
* Unused method
* Use ID from the customer object, rather than checking logged in user
* PHP 5.6 incompatibility
* Correct docblock
* Implement coupons endpoint with add/delete/get functionality
* Add totals
* Use money formatting
* Added tests for new endpoints
* Add coupons to main cart endpoint and update docs to match
* Fix indenting in readme
* is_a to instanceof
* Update coupon_exists logic
* Documentation/tidy class
* Update currency responses for coupon totals w/ tests
* Consistent currency data and formatting for product prices
* Consistent get_store_currency_properties usage
* Update tests with schema changes
* min_price and max_price to subunit format
* Product query of min and max prices using subunit
* Cart item totals
* Collection data schema object and currency data inclusion
* Handle subunits and new API in product prices
* Update price slider to format numbers using library and new API responses for subunits
* Product query of min and max prices using subunit
* Fix indents in readme
* Add todo for currency formatting
* Handle step for subunits, fixes min/max constraints
* Handle subunit conversion on display, using consistent currency object and wrapped NumberFormat component.
* Prettier ran
* Update usePriceConstraints tests so rounding doesn't make all values be 0
* Rename to minorUnitValue
* Move currencyToNumberFormat to index file
* siteCurrencySettings to constant rather than function
* remove cents term
* cents->minor unit
* typo in todo note
* Switch to FormattedMonetaryAmount
* Formatting
* wrong case
* Typo
* Save previous constraint while loading
* Add tests for formatPrice
* Small code refactor
* Refactor usePriceConstraints to DRY and add tests
* Add base-hooks to jest config
* Implement basic version of MoneyValue with decimal conversion
* Implement MoneyValue in cart classes
* Add minor unit to schema
* Update tests
* Add tests
* Tweak minor unit description
* Replace pow
* Dump rounding mode and use constant values
* Only return strings
* prepare_money_response method
* Update types back to string
* Remove unnecessary parentheses
* Feedback; force integer rounding mode to prevent notices
* add more pricing detail to cart line items api:
- total line price, before any coupon/discount
- saving, aka discount amount (if any)
- boolean if saving > 0
* add new cart price info properties to schema
* tidy field naming – line subtotal=pre discounts, line total=discounted
* remove saving / discount fields from API – could be calculated on client
* return numbers (not string) for price fields
* rename API field "price" to product price for clarity
* fix schema type for total fields (now float)
* Total descriptions in schema
* Format all costs as strings to follow core rest api
* Add totals to cart schema
* Update tests
* tax_lines
* Update Domain/Package so plugin file is not required, only a path.
* remove WC_BLOCKS_PLUGIN_FILE constant and add more inline docs
* Update tests
* Remove WC_BLOCKS_PLUGIN_FILE constant
* restore back-compat switch
* update woocommerce/components dependency to latest version
* fix bug in AssetDataRegistry and add tests to guard against regressions
* Add context for collection data query
* Introduce useCollectionData hook
* Implement hook in filter blocks
* Update API to handle nuances of counts instead of client side
* Clone requests so original is untouched
* Prevent dupe requests is working
* Cleanup
* Update assets/js/base/hooks/use-collection-data.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Update assets/js/base/hooks/use-collection-data.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Feedback
* Remove context
* 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
* 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
* install directory-named-webpack-plugin
* create new plugin for fallback legacy imports
* implement webpack configuration for fallback legacy imports and legacy builds
Note: legacy builds are currently disabled, we can enable by just commenting out when we need them.
* removed unused webpack plugin experimented with in earlier iteration
* prettier fixes
* add legacy folder with readme for explanation
* add some info on legacy builds to `CONTRIBUTING.md`
* refactor imports to use new aliases
* fix link in doc
* update jest test config for new aliases
* use native string.startsWith instead of custom function
* reformat file for spacing/code style
* add slash to alias
* clean up webpack config and make things more dry
* update indent style for json files to be tab not spaces
- adjusts editorconfig rules
- reformat jest.config.json
* simplify conditional
* Add dependency injection container for blocks
* Add new Pacakge and Bootstrap classes.
- Bootstrap for bootstrapping the plugin.
- Package will replace `src/Package` and added as a dependency for any classes needing package info.
* Introduce AssetsDataRegistry for managing asset data
* refactor existing classes to use new DIC and Asset Data Registry
- this is the bare minimum needed to make this pull viable.
- further refactors will be done in more atomic smaller pulls for easier review.
* add new settings handling and export `@woocommerce/settings` as an alias to wc.wcSettings
- the export is exposed php side on the `wc-settings` handle.
* Remove unnecessary concatenation
* Fix typos and improve doc blocks
* fix php linting issue
* Use better escaping function.
* improve jsdoc spacing
* improve test assertion
* use fully qualified class names in bootstrap
* improve comment block to account for dynamic version string replace on build
* handle exceptions a bit differently
* correct dependency reference in webpack config
* remove blank lines
* fix doc block comment alignment
* Various doc/grammar/spacing fixes from code review.
Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
* improve naming, documentation and logic of filter callbacks
While this is intended for sanitization/validation, the callback ultimately provides flexibility for filtering the value before returning or setting in state so `filter` is a better name for this.
* Install prettier
* Reformat all files
* Add prettier to precommit hook
* Update prettier settings to match Gutenberg code standards
* Reformat files with new settings
* Improve legibility in some line breaks
* Add inline settings script later than init
* Rename to shared-settings for clarity - other extensions filter these
* Implement block settings
* tweak used hooks
* update comment
* Shared settings should be dependency
* Make Webpack output shared and block settings (https://github.com/woocommerce/woocommerce-blocks/pull/918)
* export new @woocommerce/settings external on `wc.blockSettings` global
- This handles reading data from the dom and assigning it to the global used in all packages dependent on `@woocommerce/settings` which is registered as an external pointing to the global.
- ensures that server data is only loaded on a route if needed.
* switch all direct imports of constants to use new `@woocommerce/settings` external
* enqueu new `wc-block-settings` script and attach inline data to it.
* fix test configuration and adjust test to use new external
* fix bad merge resolution after rebase
* switch constants import to `@woocommerce/settings` external after rebase
* reorder imports for convention
* improve method name
- adds bundlesize package and travis config to run it on pulls (reports size as a check on pulls)
- reconfigure travis configuration so that jobs are split by task for easier review/reporting
- Fix failing phpunit tests exposed as a result of the travis reconfiguration
- Fix legit fail exposed by failing phpunit test in products REST endpoint (permissions related)
- Don't abort plugin initialization when detecting no build asset file but still throw notice (necessary to ensure php tests run in travis because we don't build js/css assets unnecessarily for those tests)
* Create Package class and use in main plugin file
* Move and refactor library class - split asset methods into new Assets class.
* Add jetpack autoloader dependency
* fix tests
* Update from master
* Update testing framework
* Update package name
* Classname changes from master
* Indent
* Update grid blocks preview to match width of products on the front end
* Remove max-width from CSS, set it on the preview itself so we can use the dynamic theme width
* Override block thumbnail width for multiple column layouts
Previously larger thumbnails would cause multiple column layouts to break and wrap early. This enforces the column width for those cases
* Add the thumbnail size to images, to prevent larger images in multiple col layouts
* Update snapshot to new preview markup
* Add catalog_visibility param to products api
This adds a catalog_visibility=visible option to the product api which
will filter out any products that are excluded from the catalog.
* Add product_visibility phpunit test
* Add catalog_visibility for catalog, search, hidden
* Fix util js test
The util js test checks for query parameters, so this adds the
category_visibility = 'visible' param.
* Updated for comments
1. Added collection params
2. moved catalog_visibility default with others
* Add placeholder image for product preview
This adds the designated placeholder image url from settings into the
wcSettings global for the blocks to use. Then uses the placeholder url
when a product doesn't have any images.
* Updated based on review notes
Using `$block_settings` instead of `$settings`
Using '' alt tag
Updated snapshot
* Add the placeholder global to test that it passes through to the preview
* Add products by attributes tests
* Add new properties to Products endpoint args
Allows for requesting a combination of attribute terms across different attributes.
* Unskip working tests
* Included PHPCS and git hooks
* Fixed coding standards
* New Products endpoint
* Fixed product controller schema
* Improved products controller schema and response
* New product categories controller
* Updated REST API base to match WooCommerce authentication
* Fixed products/categories endpoint
* Better docblock
* Product attributes controller
* Product attribute terms controller
* Update REST API urls
* Reverted PHPCS changes
* Check permission only once while fetching posts
* Included raw price
* Included sku to products endpoint response
* Fixed endpoints in unit test
* Fixed routes in unit tests
* Check and use subscriber, contributor and author rules in unit tests
* Add travis to run JS & CSS linting, JS tests, and PHPUnit tests
* Move API initiation out of the gutenberg/files check
So that php tests run without having to build the JS files
* Add very basic product endpoint tests
* Fix stylelint issues in CSS
* Remove e2e setup, replace with dependency setup
* Add missing install step
* Remove cache for now
* Add specific `har-validator` dependency because v 5.1.2 has disappeared
* Only run npm install for the JS test job
* Check for installed plugins
* Update install location
* Fix typo in plugin name
* Check the BRANCH variable, rather than TRAVIS_PULL_REQUEST_BRANCH, which is only set on PR runs
* Remove debug command
* A change to trigger CI
* Set the expected node & npm versions
* Remove copy-pasted command, does not apply