* Remove no longer used __experimentalPersistItemToCollection function
* Add __experimentalDeRegisterPaymentMethod and __experimentalDeRegisterExpressPaymentMethod to feature flags doc
* generating changeset for pull request
* generating changeset for pull request
* Update readme changelog
* Update requirements
* Testing instructions
* Update zip file
* Update nonce outside of json parse
* Set logged in cookie on store api requests
* Update zip
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update @wordpress/components and @wordpress/base-styles
* Fix JS warning in Select/downshift
* Remove color definitions that are now imported from @wordpress/base-styles. Fixeswoocommerce/woocommerce-blocks#3311
* Use -unit values from @wordpress/base-styles. Fixeswoocommerce/woocommerce-blocks#3313
* Update snapshots
* Fix payment methods test
* Don't extract dependencies that are not available in WP 5.3
* Avoid extracting @wordpress/compose since last version doesn't have resize observer
* Remove unnecessary uses of @wordpress/compose in a frontend scripts
* Add missing spaces
* Remove Blocks version of ReserveStock Class
* When a cart item is removed, remove holds on stock
* Move maybe_release_stock to abstract
* Update ReserveStockException usage
* refactor and reorder checkout processing
* improve handling of checkout POST with mixed success:
- return coupon errors in a property
- don't throw from coupon validation:
- return info about errors to route handler
- tweak logic in route handler to prevent subsequent processing
- default payment result to fail to avoid accidental successful checkout
- in client, catch errors and new customer id:
- render any errors as notices - i.e. coupon error
- if a customer ID is included, push into store (so UI updates)
* fix linter whitespace issue from rebase merge
* fix MIA order validation/errors (due to rebase):
- reinstate thrown exception when validating order
- return exception was an experiment, now solved in woocommerce/woocommerce-blocks#3454
* hide "Create account" checkbox if account is created during an error response:
- update store with new user id
- remove stale response.errors handling;
- current approach (https://github.com/woocommerce/woocommerce-blocks/pull/3454) is to add data to error response
* show a notice informing user that they have signed up
* white space
* Handle header and update typedef
* Remove "errors" schema
* remove errors
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* refactor and reorder checkout processing
* move experimental order_processed hook as last step before payment:
+ flesh out docs - intention/purpose, introduced version, link to PR,
relationship to legacy hook
* return current user_id with checkout error responses, so UI can update
* clarify user id comment
* Add store API nonce to all responses
* catch new nonce & update store for POST /checkout errors
* ensure $order hook param and database are in sync
* fetchResponse->errorResponse
* Move payment method ID validation to schema
* Add the nonce inline
* Simplify error method
* Add todo for injection
* Hook docs
* Return user ID as a header instead of in error response
* Default to private methods
* Tidied processing logic/order save placement
* White space removal
* Remove duplicate comment
* Remove root slash
* Remove unused created variable
* Remove woocommerce_registration_error_email_exists filter in error message from API
* Move payment validation
* Moved comments
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* generating changeset for pull request
* generating changeset for pull request
* add changelog for version 3.9
* clear vendor folder before doing deploy script
* start testing docs
* more build script improvements
* Finish testing notes
* update testing docs
* Prevent exclude drafts filter being tree shaken (https://github.com/woocommerce/woocommerce-blocks/pull/3463)
* Reverse logic for hiding product name in checkout sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/3464)
The hasLink prop was removed from ProductName and disabled is used instead, this change makes the variable name more descriptive, and uses disabled to signal if the ProductName should link or not.
* update zip file
* tweak changelog
* add link to release post in changelog
* fix release date in readme.txt
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: opr <5656702+opr@users.noreply.github.com>
The hasLink prop was removed from ProductName and disabled is used instead, this change makes the variable name more descriptive, and uses disabled to signal if the ProductName should link or not.
* Reset product list padding
* Adjust placeholder color if css variable exists
This is 2021 specific but may become more prominant.
* FIx editor button styles in 2021
* Adjust button sizes based on columns
* Adjust padding
* Fix price slider styling in Twenty Twenty One
* Fix price slider styling in Twenty Twenty One
* Fix radio control styling in Twenty Twenty One and remove usage of mixin
* Force 0 padding on active filters list
* Hide spinner on cart's "proceed to checkout" button when page unloads
This is required because of a feature of Safari where the page state is saved, including all class names, when a transition occurs. Navigating using the back button restores the page to that cached state, so the spinner class remains on the button. Resetting the state just before the page gets cached stops this from happening.
* Change comment case to sentence case.
* Add catalog_visibility to CartItemSchema.php
This is used to get whether the product is visible in the catalogue, visible in the shop only, visible in search results only, or visible everywhere. We need to know this so we can pass it to the ProductImage and ProductName components.
* Remove links from CartLineItemRow if not visible in catalogue
Added catalog_visibility to lineItems prop, and when the product is not visible in the catalogue do not wrap product image in a link. Also pass down the hasLink prop to ProductName.
* Add hasLink prop to ProductName
When this prop is false we should not output the link around the product name. This is for when the product is hidden from the catalogue but we still want to show its name somewhere.
* Add tests and storybook for ProductName
* Add catalog_visibility check to OrderSummaryItem
When the catalogue visibility of a product is set to hidden or search, then the product name in the checkout sidebar should not be hyperlinked.
* Reverse logic for hiding link on product image & disabling link on name
Following a point from @budzanowski we do not need the hasLink prop, making use of disabled is probably a better idea.
* Remove tabindex from a in ProductName & output span if name is disabled
This change removes the need to pass a tabindex to the a in ProductName. This is because a disabled ProductName will now never output an a tag. When the ProductName is disabled a span is output instead, which has no tabindex by default.
This change also reverses the logic to decide whether the a or span should be output so as to make the code more readable and flow better.
* Update storybook and tests/snapshots for ProductName
* Correct docblock description
* Sync shipping address changes with billing data
* Update inline documentation
* Revert address sync because it fails when shipping is disabled explicitely
* Avoid loading shipping address from customer is shipping is disabled
* Rather than update order from the wc/store/checkout request, update the customer object
This is turn is synced to order, but also allows the cart calcultions to use the posted data. This means that taxes will be updated based on address data even if not displayed on the checkout.
* Add action that combines billing and shipping updates
* Add route for updating billing and shipping address
* Sync billing data to server on change
* Shared constants for billing data
* Skip address update if missing country
* Allow null values to skip formatting
* Add billing to cart schema
* Removed unwanted hooks from previous commit
* Decoding is handled in useStoreCart
* Remove hook
* Make shipping context hold state
* Make billing context hold state
* Add address processors
* Cart does not have billing
* Update tests, remove some unrelated changes affecting the diff
* Revert "Update inline documentation"
This reverts commit 0393f49316de3152c6dcf6fda1192c06a74f1b55.
* Make shippingRatesAreResolving conditonal based on API request
* Shared address processor in cart and checkout
* Rename REST endpoint
* CustomerDataProvider and hook
* Update shipping address type defs
* Rename customer address endpoint, and remove update-shipping
* Update tests
* Fix tests by restoring country validation
* typo
* Update assets/js/base/hooks/cart/use-store-cart.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Simplify debounce and request handling
* Remove state from address sync
This will mean billing is "forgotten" if using the checbox, but this greatly simplifies logic.
* Rename shipping rates loading to customer data loading
* Sync based on useStoreCart data
* Made cart API less strict on addresses
* Fix useCheckoutAddress sync
* Add note on currentShippingAsBilling
* Use incoming isCart
* Add more detailed inline comment for shippingAsBilling toggle event
* Combine customer billing and shipping ref
* Update address docblock
* Error handling in pluckAddress
* Fix cart response after rebase
* Update customer tests
* Update src/StoreApi/Routes/CartUpdateCustomer.php
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Pass disabled prop to FormStep in order-notes-step.js
This way we can add the disabled class to the div or fieldset rendered by FormStep.
* Add disabled class & style for disabled FormStep components
Allows us to style disabled elements that cannot have the disabled attribute (divs) the same way as disabled fieldsets are.
* Update test snapshot for FormStep
This is because we added a class to the div/fieldset element when it is disabled.
* Remove redundant selector from form-step styles
Because we now add the --disabled modifier to the class, we no longer need the disabled selector. The new class-name based selector covers both fieldsets and divs.
* Change style rules for checkout step headings
This is required because when the checkout heading text is too long it collided and overlapped the heading content due to its absolute position. In this commit we add a grey line to the left of the checkout step heading to ensure consistency with the checkout step container's styling.
* Remove position rule from checkout-step heading content
This was no longer needed as it nothing relied on the position of this element.
* Check price >= 30
* Force payment methods to react to order totals change
* Fix express payments reducer so it overwrites
* Fallback to 0 if undefined
* handle plain options passed to registerPaymentMethod:
- no need for a callback dance
- support the previous API: if a function is passed, call it as before
* update Stripe for new registerPaymentMethod interface
* update docs & all built-in payment methods to simpler API
* handle plain options arg to registerExpressPaymentMethod:
- add legacy fallback if passed a function
- update stripe express payment method
- update docs
- remove unused `assertValidPaymentMethodCreator` util
* use correct case for `JavaScript`
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* typedefs for payment registration options + tidies for regular methods
* typedef express payment options arg & tidy stripe/payment-request:
- use camelCase for config instance (not a constructor/type)
* mention typedefs in payment method dev docs
* use @wordpress/deprecated to warn if callback passed to payment register
* update unit tests for new payment method API
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Exclude checkout-draft orders from WC Admin reports
* Hook into order query args
* Add comments before applying filters
* Revert "Add comments before applying filters"
This reverts commit 83b695665c05a3a9e7669e8777080c6ff10d8421.
* Revert "Hook into order query args"
This reverts commit 94cec6c83cf5b5ce05cd106daf217c0b08f13a03.
* Hide draft orders from My Account > Orders
* Move filter to its own file
* Use custom plugin namespace for filter
* Remove custom fieldconfig for shipping calculator so required fields for shipping are collected
* If the store config requires an address before shipping, do not return rates or totals
Totals, calculated by the cart, would be set to 0 in this scenario which could lead to customer confusion (why is the rate $10 but shipping shown as $0?)
* The shipping total row is missing a border
* Revert "If the store config requires an address before shipping, do not return rates or totals"
This reverts commit f3a4f24f5785392eb43bfc69a5548d398c47d8bb.
* Add hasCalculatedShipping to schema and hooks
* Show shipping notices with updated wording based on if shipping has calculated yet or not
* Refactor shipping row display to use new API props
* Remove block level isShippingCostHidden
* fix test
* Correct the math in the shipping preview in cart
* Document null
* Remove test—this option no longer exists
* Remove unused settings/constants
* Strip tags from stripe error notices
* Revise abortPayment - this does not need to provide or handle responses
* Decode entities in responseData
* Correctly handle checkoutResponse props
* Show one error at a time from express methods
* Set ID to context to avoid need to manually define it
* Move feature flag PHP logic to a service class
* Add legacy methods
* Inject a FeatureGating class instance into Package
* Make is_experimental_build and is_feature_plugin_build methods non static
* initial prototype for ExtendRestApi
* return before assign
* fix phplint errors
* declare Throwable
* remove empty init
* return initial data if shape is not correct
* Add IDENTIFIER to schema classes
* refactor ExtendRestApi to not use filters
* remove extra check
* implement ExtendRestAPI injected into StoreAPI schemas
* use $extend instead of $extend_schema
* fix phpcs issues
* update schema
* fix data type
* address review
* fix object cast
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add `discount_type` to store api coupons endpoints
* add `discount_type` field to coupon API docs
* add comment documenting when discount_type appeared in API response
* fix unsupported types with operators warning for PHP 8 with cart item conditional checks
* verify draft order object instance before using
* ensure per_page value is cast to integer
* correctly account for categories value and type in conditional
* add more instanceof checks
* Correct variable name in array check
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add missing context docs for shouldCreateAccount
* shouldCreateAccount context docs
* No need to handle showOrderNotes in component—just don't render it
* Only render notes if needed
* Create PhoneNumber component to insert when needed
Currently our repository doesn't support node 14.x and this branch of node recently became LTS so GitHub actions now default to that version. This is an attempt to force a specific version of node for the action.
* account for registration enabled setting when creating accounts
* default to false instead of global setting for initial allowCreateAccount attribute
* consider global allows signup value for whether account creation checkbox shows
* include existing hook when determining if checkout signup is available:
- woocommerce_checkout_registration_enabled hook
* use public api for registration settings (via WC_Checkout)
* initial round of test fixes
* fix logic flaw exposed by tests and align tests with actual values in real use
* return early if WC_Checkout is not available
* remove temporary test group and uncomment new test.
* improve test method name
* fix comment to match new routine name
* ensure block shows login prompt when store disables checkout signup
* fix incorrect conditional order and cover with tests
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>