-
Notifications
You must be signed in to change notification settings - Fork 219
Convert checkout state context provider to Typescript #4200
Conversation
Annoyingly, even with git move this hasn't shown the diff properly :( |
Noticed a missing change so moved this back in progress until I review. |
Size Change: +1.41 kB (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
Sorted. There were 2 similar methods in my old PR and in trunk. I've consolidated them into one. |
5f0485f
to
6648e99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smoke test was fine, no errors. Just left a couple of comments but I don't think they're blocking.
assets/js/base/context/providers/cart-checkout/checkout-state/actions.ts
Show resolved
Hide resolved
} as PaymentResultDataType; | ||
|
||
// payment_result is present in successful responses. | ||
if ( 'payment_result' in response ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be wise to add additional checks about what response
is here? Or are we always guaranteed an object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to always be an object—everywhere I see usage of setAfterProcessing
it's dealing with objects. Those files are not typed yet.
Just noting I've got an in progress review on this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really impressive update here Mike 👏🏻 . I especially like how you've reorganized the provider a bit and did things like creating useEventEmitters
so you can isolate the code and memoization specific to it inside the custom hook and outside of the provider. There's some great improvements in readability here.
I do have some concerns noted in my comments primarily around:
- apparent changes in behaviour for dispatched actions in the
setAfterProcessing
dispatcher. - apparent changes in behaviour in some of the reducer logic for various actions.
Some of my feedback might expose my newness to TS but I did try to validate some of my thinking via TS playground first.
I haven't tested this PR at all.
assets/js/base/context/providers/cart-checkout/checkout-state/actions.ts
Outdated
Show resolved
Hide resolved
assets/js/base/context/providers/cart-checkout/checkout-state/constants.ts
Outdated
Show resolved
Hide resolved
assets/js/base/context/providers/cart-checkout/checkout-state/event-emit.ts
Show resolved
Hide resolved
// payment_result is present in successful responses. | ||
if ( 'payment_result' in response ) { | ||
paymentResult.paymentStatus = response.payment_result.payment_status; | ||
paymentResult.redirectUrl = response.payment_result.redirect_url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently response.payment_result.redirect_url
might not be present? So CheckoutResponseSuccess
should probably have this defined as optional (see comment I left with that type) and thus there would need to be a check to make sure it's present here.
paymentResult.redirectUrl = response.payment_result.redirect_url; | |
paymentResult.redirectUrl = response.payment_result?.redirect_url; |
Of course if you've discovered that redirectUrl
is always in the response then this should be fine, but this does significantly change behaviour because prior to this the redirectUrl
was only used if it was non-truthy:
Won't the change in this PR mean that if a paymentResult.redirectUrl
is set to an empty string then whatever is set as the redirectUrl in the state will get cleared given the reducer now explicitly checks for undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dispatch( actions.setProcessingResponse( paymentResult ) ); | ||
dispatch( actions.setAfterProcessing() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate the cleanup around the logic here however it appears there's some changes. One of the major changes here is that paymentResult
is always created with defaults and setProcessingResponse
action is always dispatched.
While I did notice that the reducer has the following change:
case ACTION.SET_PROCESSING_RESPONSE:
newState = {
...state,
processingResponse: ( data as PaymentResultDataType ) || null,
};
break;
It still appears to me that processing response will never be null after this event fires because paymentResult
always has defaults (due to the returned value from getPaymentResultFromCheckoutResponse
)?
Some changes that I can think of as a result:
Previous | Now |
---|---|
state only updated twice if an observer returned a response with a payment_result property |
state is always updated twice regardless if the observer is not a payment method updating payment related state |
there is optional handling for payment method data that may be provided by the observer subscribed to the event | it is assumed there's always payment method data for updating in the state (if the response doesn't have it, default values are used). |
I realize I might have read the code wrong or missed something here - I'm hoping you can point that out to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old code may have lead you to think there was a mistake here, but I'm fairly confident there is not.
setAfterProcessing
is passed an API response. This is either an error response or a success response.
We know that a successful response will always contain the payment_result
property. This is part of the API schema. So in this case, state is updated.
An error response always contains the message
property. You can see here, the old code took this and manually set payment_result
and then updated state. https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/a5add04cd927090c356136eaf2920b4d6f1827cc/assets/js/base/context/providers/cart-checkout/checkout-state/index.js#L186-L196
getPaymentResultFromCheckoutResponse
has just consolidated the above into a single function with an expected shape and a fallback error message if the response was invalid.
Am I missing something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Explanation helps. I think I missed that setAfterProcessing
is currently only called by the checkout processor (which is passing in the API response). There is the assumption that going forward checkout processor will be the only consumer of this dispatcher though. I think the addition of type safety here with TypeScript could help with this though?
case ACTION.SET_PROCESSING_RESPONSE: | ||
newState = { | ||
...state, | ||
processingResponse: ( data as PaymentResultDataType ) || null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in another comment, I don't see how null
would ever get set here with the current implementation of the action dispatched on this reducer?
Also I'm not quite clear on how as
used here affects the condition. Does this mean if data
is present (and not undefined) it will be set on processingResponse
asserted as the type of PaymentResultDataType
or with this type of construct is this a way of using TypeScript to assert if data
is of the PaymentResultDataType
and if it's not, set to null
(used as a typeguard)? I couldn't find any documentation on it and when I tried an example in TS playground it looks like as long as data
is an object, processingResponse
will get set to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the null can be removed.
The as PaymentResultDataType
tells Typescript that data is of that type, rather than Record<string, unknown>
- the reducer function accepts various different types of data:
data?:
| Record< string, unknown >
| Record< string, never >
| PaymentResultDataType;
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts
Outdated
Show resolved
Hide resolved
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts
Show resolved
Hide resolved
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts
Show resolved
Hide resolved
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts
Show resolved
Hide resolved
eb27848
to
4d2d6b8
Compare
Investigate why redirectURL could be non-truthy and wheth...Investigate why redirectURL could be non-truthy and whether this would cause a bug if multiple gateways were used for payment e.g. 1st set the redirect URL but failed, and then the 2nd did not provide a redirect URL and succeeded. https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/dd70b86396e04a98e26531bb397069bf7474b029/assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts#L69-L80🚀 This comment was generated by the automations bot based on a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing all my feedback Mike! I'm relying on yours and Thomas's testing of the pr and giving my 👍🏻 for the code. Really great work on this!
Did a final smoke test with free orders, paid orders, and express payment (stripe, in edge) and all appears to be working :) Merging! |
* git move to ts files * Type the checkout state provider * Restore for loop for error handling * Types not needed * Consolodate response handling * Unused import * Fix defaults for onCheckoutAfterProcessingWithSuccess etc * Type useEmitResponse and remove isObject checks * useEmitResponse as const * Check that redirectUrl is string * Define actions as const * data.redirectUrl should be truthy * Add redirectURL todo item as followup * remove null fallback
commit 4fccfd8 Merge: 8012b2b e7bd0e6 Author: groguo <[email protected]> Date: Fri Aug 20 13:17:42 2021 +0000 Merge from trunk commit 8012b2b Author: grogou <[email protected]> Date: Fri Aug 20 16:53:56 2021 +0400 Escape statuses for sql query Co-authored-by: Thomas Roberts <[email protected]> commit 304348a Author: grogou <[email protected]> Date: Fri Aug 20 16:53:18 2021 +0400 Allow custom stock statuses Co-authored-by: Thomas Roberts <[email protected]> commit b2f01e4 Author: groguo <[email protected]> Date: Wed Jul 28 06:22:04 2021 +0000 Bring back removed css commit caafffd Author: grogou <[email protected]> Date: Tue Jul 27 23:35:15 2021 +0400 Update assets/js/blocks/stock-filter/block.js Co-authored-by: Thomas Roberts <[email protected]> commit ae381de Author: groguo <[email protected]> Date: Thu Jul 15 06:50:06 2021 +0000 Fixed preview part for stock and attribute filters commit 7df5fea Author: grogou <[email protected]> Date: Wed Jul 14 20:15:05 2021 +0400 Update index.js commit af0294c Author: groguo <[email protected]> Date: Wed Jul 14 15:43:06 2021 +0000 Review suggestion changes commit 16da253 Author: groguo <[email protected]> Date: Wed Jul 14 15:40:52 2021 +0000 Linter fix commit 594125a Author: groguo <[email protected]> Date: Wed Jul 14 15:37:41 2021 +0000 Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query commit 94a54e3 Author: groguo <[email protected]> Date: Wed Jul 14 15:21:51 2021 +0000 Created new component for Filters elements labels commit e3d7fb2 Author: aaron <[email protected]> Date: Wed Jun 2 11:57:06 2021 +0400 Fix label includ path commit c9e3d02 Author: Seghir Nadir <[email protected]> Date: Tue Jun 1 09:46:02 2021 +0100 remove usage of mustBeString (#4294) commit b892339 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 31 16:07:59 2021 +0100 Lock file maintenance (#4290) Co-authored-by: Renovate Bot <[email protected]> commit 6de68e4 Author: Thomas Roberts <[email protected]> Date: Thu May 27 12:57:49 2021 +0100 Check if product can be added to cart before adding ajax class to button (#4265) commit a1ccaf4 Author: Thomas Roberts <[email protected]> Date: Wed May 26 16:10:43 2021 +0100 Update version for next release commit 24f882f Author: Thomas Roberts <[email protected]> Date: Wed May 26 15:42:21 2021 +0100 Bumping version strings to new version. commit e1fd082 Author: Thomas Roberts <[email protected]> Date: Wed May 26 15:31:37 2021 +0100 Update link to testing zip commit 35521e5 Author: Thomas Roberts <[email protected]> Date: Wed May 26 14:04:42 2021 +0100 Fix display of itemised taxes (#4279) * Add price to itemised tax rates & hide Total when itemised taxes are on * Update snapshots for taxes in sidebar commit 7f3a1e6 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 08:52:31 2021 +0000 Update dependency downshift to v6.1.3 (#4272) Co-authored-by: Renovate Bot <[email protected]> commit 593ef2b Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 05:04:55 2021 +0000 Update dependency @types/react to v16.14.8 (#4270) Co-authored-by: Renovate Bot <[email protected]> commit 21f16d6 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 03:47:54 2021 +0000 Update dependency @woocommerce/e2e-utils to v0.1.5 (#4271) Co-authored-by: Renovate Bot <[email protected]> commit 444256e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 02:30:17 2021 +0000 Update dependency @types/lodash to v4.14.170 (#4269) Co-authored-by: Renovate Bot <[email protected]> commit 5f9df57 Author: Thomas Roberts <[email protected]> Date: Tue May 25 15:31:03 2021 +0100 Create 5.2.0 testing notes commit 45abda6 Author: Thomas Roberts <[email protected]> Date: Tue May 25 14:52:37 2021 +0100 Update package.json npm ci was not working correctly this will fix it. commit c3daa6c Author: Thomas Roberts <[email protected]> Date: Tue May 25 14:26:32 2021 +0100 Update changelog and WC tested up to commit 6128309 Author: Thomas Roberts <[email protected]> Date: Thu May 20 17:56:56 2021 +0100 Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (#4238)" This reverts commit 15c1779. commit 193267b Author: Mike Jolley <[email protected]> Date: Tue May 25 12:49:13 2021 +0100 Add key to each `CartTotalItem` (#4240) * Move type defs * Move type guards * Fix imports * Extract prepareTotalItems to TS file * usePaymentMethodInterface as TS file * Fix TS props * Fix currency type defs * Add return type to usePaymentMethodInterface * Add key prop to CartTotalItem * Fixed up js tests * Move SymbolPosition into type-defs package Co-authored-by: Thomas Roberts <[email protected]> commit c15e512 Author: Seghir Nadir <[email protected]> Date: Tue May 25 10:46:28 2021 +0100 Fix duplicate plugins by using wp.components global in the editor. (#4211) * fix duplicate slotProvider * load file on demand * add comment and load components in blocks as well * add todo block commit e2cf0ba Author: Thomas Roberts <[email protected]> Date: Tue May 25 08:43:46 2021 +0100 Hide "including X in taxes" when the amount of tax is 0 (#4262) * Hide "including x in taxes" if tax amount is 0 * Add jest types to tsconfig * Move SHOW_TAXES into component body This is to make the code more testable and allows us to change values. There's no significant performance impact because of this change. * Add tests and snapshots for TotalsFooterItem commit 9b44c88 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 24 18:14:37 2021 +0100 Update dependency @octokit/graphql to v4.6.2 (#4230) Co-authored-by: Renovate Bot <[email protected]> commit 4973132 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 24 16:40:05 2021 +0100 Lock file maintenance (#4253) Co-authored-by: Renovate Bot <[email protected]> commit b7eabf5 Author: Michael P. Pfeiffer <[email protected]> Date: Fri May 21 09:53:46 2021 +0200 Block Widgets: hide legacy widgets with a feature-complete block equivalent (#4237) * Block Widgets: hide legacy widgets with block equivalent * Unhide Products and Products by Rating widgets commit 47556b9 Author: Michael P. Pfeiffer <[email protected]> Date: Fri May 21 09:52:27 2021 +0200 Block Widgets: hide All Products and Filter blocks in the Customizer (#4225) commit 208b212 Author: Thomas Roberts <[email protected]> Date: Thu May 20 17:56:56 2021 +0100 Move `TextInput` to checkout package and allow it to be used for input type=number (#4238) * Move text-input to checkout package * Pass validation props directly to ValidatedTextInput * Import label relatively instead of from package * Pass validation functions to ValidatedTextInput This is so it doesn't need to get them from useValidationContext. * Add InputProps to ValidatedTextInput This will be used to control additional props on the input element of TextInput * Spread inputProps onto <input> element of TextInput * Export TextInput from @woocommerce/blocks-checkout * Add @woocommerce/blocks-checkout package to tsconfig * Allow styling to be applied to number inputs and when value is 0 * Make style order consistent * Remove inputProps to rely on rest in TextInput * Add specific prop for the inputErrorComponent * Only disallow active state if value is 0 AND type is number * Change all uses of ValidatedTextInput to also pass inputErrorComponent * Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent" This reverts commit ec734b9. * Revert "Remove inputProps to rely on rest in TextInput" This reverts commit 1fc64cc. * Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"" This reverts commit 110e360. * Revert "Revert "Remove inputProps to rely on rest in TextInput"" This reverts commit aeb0352. * Don't pass errorMessage to ValidatedTextInput commit 55f5bfd Author: Mike Jolley <[email protected]> Date: Thu May 20 15:07:12 2021 +0100 Create LICENSE (#4235) commit 0b10f75 Author: Albert Juhé Lluveras <[email protected]> Date: Thu May 20 10:58:59 2021 +0200 Update @woocommerce/components (#4100) * Add isCompact prop to components using SearchListControl * Update @woocommerce/components to 6.1.2 * Remove legacy CSS code * Add some CSS rules to override conflicting editor styles * Replace showCount prop with has-count class name * Create ExpandableSearchListItem component * Refactor ProductControl so it uses ExpandableSearchListItem * Update @woocommerce/components to 6.2.0 * Fix @woocommerce/components builds breaking * Fix a11y of expandable item list children * Set categories to an empty array by default * Render compact control in Attribute filter sidebar * Add countLabel to ProductAttributeTermControl * Fix ProductTagControl selected items * Use sentence case for countLabel * Fix wrong margins in block editor * Fix checkbox alignment * Update package-lock.json * Fix withCategories test * Fix JS error in Filter Products by Attribute block * Make input ids unique commit 587be17 Author: Thomas Roberts <[email protected]> Date: Wed May 19 10:55:15 2021 +0100 Convert TextInput and ValidatedTextInput to TypeScript (#4226) * Change index file from base/context to .ts This is to stop TS complaining when importing things from here. * Convert ValidatedTextInput to TypeScript * Convert TextInput to TypeScript * Ensure Label accepts correct HTML Attributes Props * Remove PropTypes from TextInput and ValidatedTextInput No longer needed because of TypeScript * Use correct error id to show validation message * Use HTMLElement instead of a specific element type for LabelProps * Update assets/js/base/components/text-input/validated-text-input.tsx Co-authored-by: Albert Juhé Lluveras <[email protected]> * Update assets/js/base/components/text-input/validated-text-input.tsx * Use correct formatting in ValidatedTextInput Co-authored-by: Albert Juhé Lluveras <[email protected]> commit 731c75e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 07:36:46 2021 +0000 Update dependency @testing-library/react-hooks to v5.1.3 (#4233) Co-authored-by: Renovate Bot <[email protected]> commit ef6ad88 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 04:36:44 2021 +0000 Update dependency @types/lodash to v4.14.169 (#4234) Co-authored-by: Renovate Bot <[email protected]> commit 096463e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 03:46:21 2021 +0000 Update dependency @testing-library/react to v11.2.7 (#4232) Co-authored-by: Renovate Bot <[email protected]> commit 8722839 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 02:48:45 2021 +0000 Update dependency @stripe/react-stripe-js to v1.4.1 (#4231) Co-authored-by: Renovate Bot <[email protected]> commit 2f7e8ed Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 01:32:34 2021 +0000 Pin dependency @types/wordpress__deprecated to 2.4.2 (#4229) Co-authored-by: Renovate Bot <[email protected]> commit 72e851a Author: Raluca Stan <[email protected]> Date: Tue May 18 15:09:30 2021 +0200 Fix e2e checkout tests and adjust jest setup (#4216) * Fix checkout test - make tests independent & test also for empty cart case - make sure the Order summary is expanded with a better selector * Remove unnecessary localStorage operations from tests * Go to cart page before removing an item from cart * Remove logging observing before tests This removes unnecessary console.log interception. A big part of the logic was done for Puppeteer 1.6.1, but since 3.0.0 message.text() returns string. We allow console.error messages to surface in our tests. Although they don't cause the test to fail it might be a good addition for debugging purposes. commit 7b7119c Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue May 18 11:27:27 2021 +0100 Lock file maintenance (#4212) Co-authored-by: Renovate Bot <[email protected]> commit 5f84e7d Author: Mike Jolley <[email protected]> Date: Tue May 18 10:37:31 2021 +0100 Convert checkout state context provider to Typescript (#4200) * git move to ts files * Type the checkout state provider * Restore for loop for error handling * Types not needed * Consolodate response handling * Unused import * Fix defaults for onCheckoutAfterProcessingWithSuccess etc * Type useEmitResponse and remove isObject checks * useEmitResponse as const * Check that redirectUrl is string * Define actions as const * data.redirectUrl should be truthy * Add redirectURL todo item as followup * remove null fallback commit fccc72b Author: Thomas Roberts <[email protected]> Date: Tue May 18 09:10:31 2021 +0100 Move Button and Label components to `@woocommerce/blocks-checkout` package (#4222) * Move Button to checkout package * Move Label to Components Package commit 0b91fbe Author: Thomas Roberts <[email protected]> Date: Mon May 17 15:00:57 2021 +0100 Update design of cart and checkout sidebars (#4180) * Update cart/coupon/shipping design * Add order summary heading * Move and style discounts on checkout sidebar * Add rate to tax lines * Ensure the option to display taxes itemised is available to Cart block * Output individual tax items below the total & add styles for this * Add success notice under coupon input on successful coupon addition * Add border to bottom of Totals footer * Show success message when adding coupon * Add padding to cart item rows * Add preview data to cart for when taxes are enabled * Add rate to cart response type * Add showRateAfterTaxName attribute to Cart block * Add control to cart block to show rate percentage after rate name * Add rate % in cart totals only if option is toggled on * Pass showRateAfterTaxName attribute down to TotalsTaxes * Add showRateAfterTaxName to Checkout block * Add control to block editor for showRateAfterTaxName on Checkout * Pass showRateAfterTaxName down to TotalsTaxes in Checkout * Change label for showing tax rates in cart and checkout blocks * Add test to ensure Taxes section shows in Cart block * Add tests for cart sidebar and rate percentages * Remove order summary title from checkout sidebar * Check if taxes are enabled before rendering the option to show rate %s * Add ShippingVia component to show the selected rate in sidebar * Remove value from individual tax rates * Remove bold from Shipping via label * Remove coupon added successfully message * Ensure panel headings that are h2s are the same colour as others * Clean up eslint warnings * Show rate %s by default * Update snapshots following design changes Co-authored-by: Mike Jolley <[email protected]> commit 0464883 Author: Albert Juhé Lluveras <[email protected]> Date: Sun May 16 20:00:06 2021 +0200 Don't default to fallback in getSetting if value is falsy (#4202) commit f95f12d Author: Mike Jolley <[email protected]> Date: Sun May 16 18:59:32 2021 +0100 Fix es lint warnings (#4206) * Un-used PropTypes import * Avoid global and use ownerDocument * receiveCart return type * ignoreRestSiblings when destructuring for @typescript-eslint/no-unused-vars * Replace lodash find * Use global rather than window * Remove lodash map * move rule to overrides commit db589e7 Author: Raluca Stan <[email protected]> Date: Sun May 16 19:41:34 2021 +0200 Fix cart and checkout frontend e2e tests (#4199) * Wip: fix e2e fe tests * Test that navigation ends * Fix waitForNavigation * comment out failing php test * click the dom element * Ensure navigation happens by waiting for it. Test page title. * remove skip and update docs * Revert "comment out failing php test" This reverts commit 7c40e8c. * Fix USD from merge conflict * Add missing check for page title * Try page.waitForFunction for text search * test to see checkout page title is correct * test checkout page url on CI * unde jest config change * Fix assertion for checkout page * remove extra localStorage item remove call Co-authored-by: Mike Jolley <[email protected]> Co-authored-by: Nadir Seghir <[email protected]> commit b9b66f9 Author: Mike Jolley <[email protected]> Date: Thu May 13 11:49:39 2021 +0100 Set order status to pending when no payment is needed (#4186) commit 8ed63f7 Author: Mike Jolley <[email protected]> Date: Thu May 13 11:21:21 2021 +0100 Remove the need for the `canMakePayment` callback in the editor context (#4188) * Force can pay true in editor context * Update docs commit 90499cb Author: Mike Jolley <[email protected]> Date: Thu May 13 11:20:37 2021 +0100 Sync customer data during checkout with draft orders. (#4197) * Update store when email changes * Add pluckEmail helper and convert to TS * improve guard * sync draft order with customer data commit a813c93 Author: Albert Juhé Lluveras <[email protected]> Date: Thu May 13 12:14:15 2021 +0200 Set default store currency to USD in tests (#4203) commit b140893 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu May 13 10:16:04 2021 +0200 Update dependency config to v3.3.6 (#4195) Co-authored-by: Renovate Bot <[email protected]> commit d68bb11 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu May 13 10:15:35 2021 +0200 Update dependency cssnano to v4.1.11 (#4196) Co-authored-by: Renovate Bot <[email protected]> commit beadbab Author: Seghir Nadir <[email protected]> Date: Wed May 12 13:32:05 2021 +0100 Add cart data to filters (#4164) * add cart data to filters * add extensions back to footer filter commit c10fdf2 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 12 13:04:44 2021 +0100 Pin dependency lodash to 4.17.21 (#4193) Co-authored-by: Renovate Bot <[email protected]> commit f92aac5 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 12 13:04:13 2021 +0100 Update dependency chalk to v4.1.1 (#4194) Co-authored-by: Renovate Bot <[email protected]> commit 27cff51 Author: Mike Jolley <[email protected]> Date: Wed May 12 13:02:26 2021 +0100 Should be using value rather than name (#4187) commit 560972a Author: Thomas Roberts <[email protected]> Date: Tue May 11 13:57:02 2021 +0100 Add checkout filter for coupon names (#4166) * Make extensions optional, not all filters will need to pass this through For example the CartCouponSchema has no option for extensibility (and I don't think it's needed at any rate) so extensions will always be an empty object. Rather than explicitly specifying this when running the filter, we can let it default to an empty object. * Add filter for coupon code commit 556ceb4 Author: Thomas Roberts <[email protected]> Date: Tue May 11 11:45:02 2021 +0100 Check if variation data is iterable before formatting (#4182) commit 4279db8 Author: Darren Ethier <[email protected]> Date: Mon May 10 11:21:01 2021 -0400 update package-lock (version change mostly) commit f71b24a Author: Darren Ethier <[email protected]> Date: Mon May 10 11:16:58 2021 -0400 update version string to dev version commit 7f9c1b2 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon May 10 11:14:05 2021 -0400 Release: 5.1.0 (#4185) * Empty commit for release pull request * Add changelog * update testing notes * Bumping version strings to new version. Co-authored-by: github-actions <[email protected]> Co-authored-by: Darren Ethier <[email protected]> commit 80c2735 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 10 14:38:04 2021 +0200 Lock file maintenance (#4184) Co-authored-by: Renovate Bot <[email protected]> commit 90074cf Author: Thomas Roberts <[email protected]> Date: Mon May 10 10:03:30 2021 +0100 Convert shipping components to typescript (#4135) * Add type defs for customer Taken from https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/194ecccf780afe16843a894bb2e988509a0746df/assets/js/type-defs/customer.ts * Convert ShippingCalculatorAddress to TypeScript * Convert ShippingCalculator to TypeScript * Convert ShippingLocation to TypeScript * Allow packageId to be a number or string in useSelectShippingRate(s) * Convert ShippingRatesControl to TypeScript * Convert ShippingOptionsStep to TypeScript * Allow package_id to be a string or number This is because of Subscriptions using strings for package IDs * Change to use CartShippingRateItemShippingRate instead of Rate * Add extra props to PackageProps type * Make ShippingAddress have the correct type * Use CartShippingRateItemShippingRate instead of Rate * Remove Rate type * Set return types to JSX.Element * Change type of props.renderOption in ShippingRatesControl * Remove customer type defs and relocate aliases to default-address-fields * Add EnteredAddress type * Import EnteredAddress from new location * Remove unnecessary eslint ignore * Remove unused variable * Remove confusing use of word Item in Shipping types * Remove confusing use of word Item in Shipping types commit 3f1be39 Author: Albert Juhé Lluveras <[email protected]> Date: Mon May 10 10:00:14 2021 +0200 Feature gate PaymentApi (#4176) * Feature gate PaymentApi * Improve payment method missing dependencies error message so it's clear it only affects blocks * Add PaymentApi feature flags to list of feature flags in docs commit ed7eded Author: Darren Ethier <[email protected]> Date: Fri May 7 16:39:28 2021 -0400 Improvements to `emitEventWithAbort`. (#4158) * modify emitEventWithAbort to change return value `emitEventWithAbort` now returns an array of responses up to the first response that triggered an error or fail response instead of aborting on success responses too. * update add to cart form context provider * update checkout state context provider * update payment method data context provider * update tests and fix thrown error handling. commit 2be9a4e Author: Raluca Stan <[email protected]> Date: Fri May 7 15:50:55 2021 +0200 Add lodash as a devDependency (#4179) commit 69b3679 Author: Seghir Nadir <[email protected]> Date: Wed May 5 12:59:30 2021 +0100 Don't clear email and phone fields when using separate billing address. (#4162) * preseve-billing-data * pluck empty email and phone * add issue number commit 2140147 Author: Raluca Stan <[email protected]> Date: Wed May 5 13:52:27 2021 +0200 Fix/cart backend test (#4153) * Fix backend cart e2e test * Adjust test structure * Fix e2e checkout backend test. Make sure the confirmation window is closed commit f8d9b90 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 10:08:45 2021 +0000 Update dependency @stripe/stripe-js to v1.14.0 (#4170) Co-authored-by: Renovate Bot <[email protected]> commit 2391a40 Author: Thomas Roberts <[email protected]> Date: Wed May 5 10:41:48 2021 +0100 Add documentation for filters (#4167) * Rename the argument in the CheckoutFilterFunction type This only exists as an extra descriptive hint to anyone using this type, the value `label` was never used by anything so it does not need to be changed anywhere else. * Create Available Filters document * Add available filters to the extensibility README * Update docs/extensibility/available-filters.md to fix typographical error Co-authored-by: Mike Jolley <[email protected]> Co-authored-by: Mike Jolley <[email protected]> commit f4af89b Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 08:10:24 2021 +0000 Update dependency @woocommerce/e2e-utils to v0.1.4 (#4172) Co-authored-by: Renovate Bot <[email protected]> commit 6c9e786 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 03:31:52 2021 +0000 Update dependency @types/react to v16.14.6 (#4171) Co-authored-by: Renovate Bot <[email protected]> commit 3ba4d9e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 02:23:13 2021 +0000 Update babel monorepo (#4169) Co-authored-by: Renovate Bot <[email protected]> commit 35f71df Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue May 4 14:07:05 2021 +0100 Lock file maintenance (#4163) Co-authored-by: Renovate Bot <[email protected]> commit 4c65211 Author: grogou <[email protected]> Date: Wed Apr 28 14:09:28 2021 +0000 Coped package-lock.json from trunk commit 703cb65 Author: grogou <[email protected]> Date: Wed Apr 28 14:00:32 2021 +0000 Reverted package-lock.json ( downgraded node version to 12 ) commit 41dfd79 Author: grogou <[email protected]> Date: Wed Apr 28 11:12:45 2021 +0000 Pre pull request clean up code commit 75fc62e Author: grogou <[email protected]> Date: Tue Apr 27 13:03:24 2021 +0000 Added Stock Status filter commit e7bd0e6 Author: grogou <[email protected]> Date: Fri Aug 20 16:53:56 2021 +0400 Escape statuses for sql query Co-authored-by: Thomas Roberts <[email protected]> commit 29c8493 Author: grogou <[email protected]> Date: Fri Aug 20 16:53:18 2021 +0400 Allow custom stock statuses Co-authored-by: Thomas Roberts <[email protected]> commit 63ecd04 Author: groguo <[email protected]> Date: Wed Jul 28 06:22:04 2021 +0000 Bring back removed css commit 27e0233 Author: grogou <[email protected]> Date: Tue Jul 27 23:35:15 2021 +0400 Update assets/js/blocks/stock-filter/block.js Co-authored-by: Thomas Roberts <[email protected]> commit 136c32d Author: groguo <[email protected]> Date: Thu Jul 15 06:50:06 2021 +0000 Fixed preview part for stock and attribute filters commit ef89751 Author: grogou <[email protected]> Date: Wed Jul 14 20:15:05 2021 +0400 Update index.js commit a63dbce Author: groguo <[email protected]> Date: Wed Jul 14 15:43:06 2021 +0000 Review suggestion changes commit 6b0f5d2 Author: groguo <[email protected]> Date: Wed Jul 14 15:40:52 2021 +0000 Linter fix commit 791b38b Author: groguo <[email protected]> Date: Wed Jul 14 15:37:41 2021 +0000 Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query commit 1a7a002 Author: groguo <[email protected]> Date: Wed Jul 14 15:21:51 2021 +0000 Created new component for Filters elements labels commit d9b7fae Author: aaron <[email protected]> Date: Wed Jun 2 11:57:06 2021 +0400 Fix label includ path commit 5311584 Merge: 92a0da3 413a4e0 Author: aaron <[email protected]> Date: Wed Jun 2 11:52:48 2021 +0400 Merge remote-tracking branch 'core/trunk' into add/stock-filter # Conflicts: # package-lock.json commit d8e6dab Merge: 42beb9b 4343b96 Author: grogou <[email protected]> Date: Fri Apr 30 12:28:09 2021 +0400 Merge pull request #1 from woocommerce/trunk Fork update commit 92a0da3 Author: grogou <[email protected]> Date: Wed Apr 28 14:09:28 2021 +0000 Coped package-lock.json from trunk commit ae0d12b Author: grogou <[email protected]> Date: Wed Apr 28 14:00:32 2021 +0000 Reverted package-lock.json ( downgraded node version to 12 ) commit 5e0c7f9 Author: grogou <[email protected]> Date: Wed Apr 28 11:12:45 2021 +0000 Pre pull request clean up code commit 105b3f7 Author: grogou <[email protected]> Date: Tue Apr 27 13:03:24 2021 +0000 Added Stock Status filter
commit 4a14c226b739f3d88f99647206627ff351ef01ad Merge: 8cc7acd 4fccfd8 Author: Thomas Roberts <[email protected]> Date: Fri Aug 20 16:06:19 2021 +0100 Merge branch 'add/stock-filter' of git://github.com/NovemBit/woocommerce-gutenberg-products-block-fork into NovemBit-add/stock-filter commit 4fccfd8 Merge: 8012b2b e7bd0e6 Author: groguo <[email protected]> Date: Fri Aug 20 13:17:42 2021 +0000 Merge from trunk commit 8012b2b Author: grogou <[email protected]> Date: Fri Aug 20 16:53:56 2021 +0400 Escape statuses for sql query Co-authored-by: Thomas Roberts <[email protected]> commit 304348a Author: grogou <[email protected]> Date: Fri Aug 20 16:53:18 2021 +0400 Allow custom stock statuses Co-authored-by: Thomas Roberts <[email protected]> commit b2f01e4 Author: groguo <[email protected]> Date: Wed Jul 28 06:22:04 2021 +0000 Bring back removed css commit caafffd Author: grogou <[email protected]> Date: Tue Jul 27 23:35:15 2021 +0400 Update assets/js/blocks/stock-filter/block.js Co-authored-by: Thomas Roberts <[email protected]> commit ae381de Author: groguo <[email protected]> Date: Thu Jul 15 06:50:06 2021 +0000 Fixed preview part for stock and attribute filters commit 7df5fea Author: grogou <[email protected]> Date: Wed Jul 14 20:15:05 2021 +0400 Update index.js commit af0294c Author: groguo <[email protected]> Date: Wed Jul 14 15:43:06 2021 +0000 Review suggestion changes commit 16da253 Author: groguo <[email protected]> Date: Wed Jul 14 15:40:52 2021 +0000 Linter fix commit 594125a Author: groguo <[email protected]> Date: Wed Jul 14 15:37:41 2021 +0000 Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query commit 94a54e3 Author: groguo <[email protected]> Date: Wed Jul 14 15:21:51 2021 +0000 Created new component for Filters elements labels commit e3d7fb2 Author: aaron <[email protected]> Date: Wed Jun 2 11:57:06 2021 +0400 Fix label includ path commit c9e3d02 Author: Seghir Nadir <[email protected]> Date: Tue Jun 1 09:46:02 2021 +0100 remove usage of mustBeString (#4294) commit b892339 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 31 16:07:59 2021 +0100 Lock file maintenance (#4290) Co-authored-by: Renovate Bot <[email protected]> commit 6de68e4 Author: Thomas Roberts <[email protected]> Date: Thu May 27 12:57:49 2021 +0100 Check if product can be added to cart before adding ajax class to button (#4265) commit a1ccaf4 Author: Thomas Roberts <[email protected]> Date: Wed May 26 16:10:43 2021 +0100 Update version for next release commit 24f882f Author: Thomas Roberts <[email protected]> Date: Wed May 26 15:42:21 2021 +0100 Bumping version strings to new version. commit e1fd082 Author: Thomas Roberts <[email protected]> Date: Wed May 26 15:31:37 2021 +0100 Update link to testing zip commit 35521e5 Author: Thomas Roberts <[email protected]> Date: Wed May 26 14:04:42 2021 +0100 Fix display of itemised taxes (#4279) * Add price to itemised tax rates & hide Total when itemised taxes are on * Update snapshots for taxes in sidebar commit 7f3a1e6 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 08:52:31 2021 +0000 Update dependency downshift to v6.1.3 (#4272) Co-authored-by: Renovate Bot <[email protected]> commit 593ef2b Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 05:04:55 2021 +0000 Update dependency @types/react to v16.14.8 (#4270) Co-authored-by: Renovate Bot <[email protected]> commit 21f16d6 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 03:47:54 2021 +0000 Update dependency @woocommerce/e2e-utils to v0.1.5 (#4271) Co-authored-by: Renovate Bot <[email protected]> commit 444256e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 26 02:30:17 2021 +0000 Update dependency @types/lodash to v4.14.170 (#4269) Co-authored-by: Renovate Bot <[email protected]> commit 5f9df57 Author: Thomas Roberts <[email protected]> Date: Tue May 25 15:31:03 2021 +0100 Create 5.2.0 testing notes commit 45abda6 Author: Thomas Roberts <[email protected]> Date: Tue May 25 14:52:37 2021 +0100 Update package.json npm ci was not working correctly this will fix it. commit c3daa6c Author: Thomas Roberts <[email protected]> Date: Tue May 25 14:26:32 2021 +0100 Update changelog and WC tested up to commit 6128309 Author: Thomas Roberts <[email protected]> Date: Thu May 20 17:56:56 2021 +0100 Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (#4238)" This reverts commit 15c1779. commit 193267b Author: Mike Jolley <[email protected]> Date: Tue May 25 12:49:13 2021 +0100 Add key to each `CartTotalItem` (#4240) * Move type defs * Move type guards * Fix imports * Extract prepareTotalItems to TS file * usePaymentMethodInterface as TS file * Fix TS props * Fix currency type defs * Add return type to usePaymentMethodInterface * Add key prop to CartTotalItem * Fixed up js tests * Move SymbolPosition into type-defs package Co-authored-by: Thomas Roberts <[email protected]> commit c15e512 Author: Seghir Nadir <[email protected]> Date: Tue May 25 10:46:28 2021 +0100 Fix duplicate plugins by using wp.components global in the editor. (#4211) * fix duplicate slotProvider * load file on demand * add comment and load components in blocks as well * add todo block commit e2cf0ba Author: Thomas Roberts <[email protected]> Date: Tue May 25 08:43:46 2021 +0100 Hide "including X in taxes" when the amount of tax is 0 (#4262) * Hide "including x in taxes" if tax amount is 0 * Add jest types to tsconfig * Move SHOW_TAXES into component body This is to make the code more testable and allows us to change values. There's no significant performance impact because of this change. * Add tests and snapshots for TotalsFooterItem commit 9b44c88 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 24 18:14:37 2021 +0100 Update dependency @octokit/graphql to v4.6.2 (#4230) Co-authored-by: Renovate Bot <[email protected]> commit 4973132 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 24 16:40:05 2021 +0100 Lock file maintenance (#4253) Co-authored-by: Renovate Bot <[email protected]> commit b7eabf5 Author: Michael P. Pfeiffer <[email protected]> Date: Fri May 21 09:53:46 2021 +0200 Block Widgets: hide legacy widgets with a feature-complete block equivalent (#4237) * Block Widgets: hide legacy widgets with block equivalent * Unhide Products and Products by Rating widgets commit 47556b9 Author: Michael P. Pfeiffer <[email protected]> Date: Fri May 21 09:52:27 2021 +0200 Block Widgets: hide All Products and Filter blocks in the Customizer (#4225) commit 208b212 Author: Thomas Roberts <[email protected]> Date: Thu May 20 17:56:56 2021 +0100 Move `TextInput` to checkout package and allow it to be used for input type=number (#4238) * Move text-input to checkout package * Pass validation props directly to ValidatedTextInput * Import label relatively instead of from package * Pass validation functions to ValidatedTextInput This is so it doesn't need to get them from useValidationContext. * Add InputProps to ValidatedTextInput This will be used to control additional props on the input element of TextInput * Spread inputProps onto <input> element of TextInput * Export TextInput from @woocommerce/blocks-checkout * Add @woocommerce/blocks-checkout package to tsconfig * Allow styling to be applied to number inputs and when value is 0 * Make style order consistent * Remove inputProps to rely on rest in TextInput * Add specific prop for the inputErrorComponent * Only disallow active state if value is 0 AND type is number * Change all uses of ValidatedTextInput to also pass inputErrorComponent * Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent" This reverts commit ec734b9. * Revert "Remove inputProps to rely on rest in TextInput" This reverts commit 1fc64cc. * Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"" This reverts commit 110e360. * Revert "Revert "Remove inputProps to rely on rest in TextInput"" This reverts commit aeb0352. * Don't pass errorMessage to ValidatedTextInput commit 55f5bfd Author: Mike Jolley <[email protected]> Date: Thu May 20 15:07:12 2021 +0100 Create LICENSE (#4235) commit 0b10f75 Author: Albert Juhé Lluveras <[email protected]> Date: Thu May 20 10:58:59 2021 +0200 Update @woocommerce/components (#4100) * Add isCompact prop to components using SearchListControl * Update @woocommerce/components to 6.1.2 * Remove legacy CSS code * Add some CSS rules to override conflicting editor styles * Replace showCount prop with has-count class name * Create ExpandableSearchListItem component * Refactor ProductControl so it uses ExpandableSearchListItem * Update @woocommerce/components to 6.2.0 * Fix @woocommerce/components builds breaking * Fix a11y of expandable item list children * Set categories to an empty array by default * Render compact control in Attribute filter sidebar * Add countLabel to ProductAttributeTermControl * Fix ProductTagControl selected items * Use sentence case for countLabel * Fix wrong margins in block editor * Fix checkbox alignment * Update package-lock.json * Fix withCategories test * Fix JS error in Filter Products by Attribute block * Make input ids unique commit 587be17 Author: Thomas Roberts <[email protected]> Date: Wed May 19 10:55:15 2021 +0100 Convert TextInput and ValidatedTextInput to TypeScript (#4226) * Change index file from base/context to .ts This is to stop TS complaining when importing things from here. * Convert ValidatedTextInput to TypeScript * Convert TextInput to TypeScript * Ensure Label accepts correct HTML Attributes Props * Remove PropTypes from TextInput and ValidatedTextInput No longer needed because of TypeScript * Use correct error id to show validation message * Use HTMLElement instead of a specific element type for LabelProps * Update assets/js/base/components/text-input/validated-text-input.tsx Co-authored-by: Albert Juhé Lluveras <[email protected]> * Update assets/js/base/components/text-input/validated-text-input.tsx * Use correct formatting in ValidatedTextInput Co-authored-by: Albert Juhé Lluveras <[email protected]> commit 731c75e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 07:36:46 2021 +0000 Update dependency @testing-library/react-hooks to v5.1.3 (#4233) Co-authored-by: Renovate Bot <[email protected]> commit ef6ad88 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 04:36:44 2021 +0000 Update dependency @types/lodash to v4.14.169 (#4234) Co-authored-by: Renovate Bot <[email protected]> commit 096463e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 03:46:21 2021 +0000 Update dependency @testing-library/react to v11.2.7 (#4232) Co-authored-by: Renovate Bot <[email protected]> commit 8722839 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 02:48:45 2021 +0000 Update dependency @stripe/react-stripe-js to v1.4.1 (#4231) Co-authored-by: Renovate Bot <[email protected]> commit 2f7e8ed Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 19 01:32:34 2021 +0000 Pin dependency @types/wordpress__deprecated to 2.4.2 (#4229) Co-authored-by: Renovate Bot <[email protected]> commit 72e851a Author: Raluca Stan <[email protected]> Date: Tue May 18 15:09:30 2021 +0200 Fix e2e checkout tests and adjust jest setup (#4216) * Fix checkout test - make tests independent & test also for empty cart case - make sure the Order summary is expanded with a better selector * Remove unnecessary localStorage operations from tests * Go to cart page before removing an item from cart * Remove logging observing before tests This removes unnecessary console.log interception. A big part of the logic was done for Puppeteer 1.6.1, but since 3.0.0 message.text() returns string. We allow console.error messages to surface in our tests. Although they don't cause the test to fail it might be a good addition for debugging purposes. commit 7b7119c Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue May 18 11:27:27 2021 +0100 Lock file maintenance (#4212) Co-authored-by: Renovate Bot <[email protected]> commit 5f84e7d Author: Mike Jolley <[email protected]> Date: Tue May 18 10:37:31 2021 +0100 Convert checkout state context provider to Typescript (#4200) * git move to ts files * Type the checkout state provider * Restore for loop for error handling * Types not needed * Consolodate response handling * Unused import * Fix defaults for onCheckoutAfterProcessingWithSuccess etc * Type useEmitResponse and remove isObject checks * useEmitResponse as const * Check that redirectUrl is string * Define actions as const * data.redirectUrl should be truthy * Add redirectURL todo item as followup * remove null fallback commit fccc72b Author: Thomas Roberts <[email protected]> Date: Tue May 18 09:10:31 2021 +0100 Move Button and Label components to `@woocommerce/blocks-checkout` package (#4222) * Move Button to checkout package * Move Label to Components Package commit 0b91fbe Author: Thomas Roberts <[email protected]> Date: Mon May 17 15:00:57 2021 +0100 Update design of cart and checkout sidebars (#4180) * Update cart/coupon/shipping design * Add order summary heading * Move and style discounts on checkout sidebar * Add rate to tax lines * Ensure the option to display taxes itemised is available to Cart block * Output individual tax items below the total & add styles for this * Add success notice under coupon input on successful coupon addition * Add border to bottom of Totals footer * Show success message when adding coupon * Add padding to cart item rows * Add preview data to cart for when taxes are enabled * Add rate to cart response type * Add showRateAfterTaxName attribute to Cart block * Add control to cart block to show rate percentage after rate name * Add rate % in cart totals only if option is toggled on * Pass showRateAfterTaxName attribute down to TotalsTaxes * Add showRateAfterTaxName to Checkout block * Add control to block editor for showRateAfterTaxName on Checkout * Pass showRateAfterTaxName down to TotalsTaxes in Checkout * Change label for showing tax rates in cart and checkout blocks * Add test to ensure Taxes section shows in Cart block * Add tests for cart sidebar and rate percentages * Remove order summary title from checkout sidebar * Check if taxes are enabled before rendering the option to show rate %s * Add ShippingVia component to show the selected rate in sidebar * Remove value from individual tax rates * Remove bold from Shipping via label * Remove coupon added successfully message * Ensure panel headings that are h2s are the same colour as others * Clean up eslint warnings * Show rate %s by default * Update snapshots following design changes Co-authored-by: Mike Jolley <[email protected]> commit 0464883 Author: Albert Juhé Lluveras <[email protected]> Date: Sun May 16 20:00:06 2021 +0200 Don't default to fallback in getSetting if value is falsy (#4202) commit f95f12d Author: Mike Jolley <[email protected]> Date: Sun May 16 18:59:32 2021 +0100 Fix es lint warnings (#4206) * Un-used PropTypes import * Avoid global and use ownerDocument * receiveCart return type * ignoreRestSiblings when destructuring for @typescript-eslint/no-unused-vars * Replace lodash find * Use global rather than window * Remove lodash map * move rule to overrides commit db589e7 Author: Raluca Stan <[email protected]> Date: Sun May 16 19:41:34 2021 +0200 Fix cart and checkout frontend e2e tests (#4199) * Wip: fix e2e fe tests * Test that navigation ends * Fix waitForNavigation * comment out failing php test * click the dom element * Ensure navigation happens by waiting for it. Test page title. * remove skip and update docs * Revert "comment out failing php test" This reverts commit 7c40e8c. * Fix USD from merge conflict * Add missing check for page title * Try page.waitForFunction for text search * test to see checkout page title is correct * test checkout page url on CI * unde jest config change * Fix assertion for checkout page * remove extra localStorage item remove call Co-authored-by: Mike Jolley <[email protected]> Co-authored-by: Nadir Seghir <[email protected]> commit b9b66f9 Author: Mike Jolley <[email protected]> Date: Thu May 13 11:49:39 2021 +0100 Set order status to pending when no payment is needed (#4186) commit 8ed63f7 Author: Mike Jolley <[email protected]> Date: Thu May 13 11:21:21 2021 +0100 Remove the need for the `canMakePayment` callback in the editor context (#4188) * Force can pay true in editor context * Update docs commit 90499cb Author: Mike Jolley <[email protected]> Date: Thu May 13 11:20:37 2021 +0100 Sync customer data during checkout with draft orders. (#4197) * Update store when email changes * Add pluckEmail helper and convert to TS * improve guard * sync draft order with customer data commit a813c93 Author: Albert Juhé Lluveras <[email protected]> Date: Thu May 13 12:14:15 2021 +0200 Set default store currency to USD in tests (#4203) commit b140893 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu May 13 10:16:04 2021 +0200 Update dependency config to v3.3.6 (#4195) Co-authored-by: Renovate Bot <[email protected]> commit d68bb11 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu May 13 10:15:35 2021 +0200 Update dependency cssnano to v4.1.11 (#4196) Co-authored-by: Renovate Bot <[email protected]> commit beadbab Author: Seghir Nadir <[email protected]> Date: Wed May 12 13:32:05 2021 +0100 Add cart data to filters (#4164) * add cart data to filters * add extensions back to footer filter commit c10fdf2 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 12 13:04:44 2021 +0100 Pin dependency lodash to 4.17.21 (#4193) Co-authored-by: Renovate Bot <[email protected]> commit f92aac5 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 12 13:04:13 2021 +0100 Update dependency chalk to v4.1.1 (#4194) Co-authored-by: Renovate Bot <[email protected]> commit 27cff51 Author: Mike Jolley <[email protected]> Date: Wed May 12 13:02:26 2021 +0100 Should be using value rather than name (#4187) commit 560972a Author: Thomas Roberts <[email protected]> Date: Tue May 11 13:57:02 2021 +0100 Add checkout filter for coupon names (#4166) * Make extensions optional, not all filters will need to pass this through For example the CartCouponSchema has no option for extensibility (and I don't think it's needed at any rate) so extensions will always be an empty object. Rather than explicitly specifying this when running the filter, we can let it default to an empty object. * Add filter for coupon code commit 556ceb4 Author: Thomas Roberts <[email protected]> Date: Tue May 11 11:45:02 2021 +0100 Check if variation data is iterable before formatting (#4182) commit 4279db8 Author: Darren Ethier <[email protected]> Date: Mon May 10 11:21:01 2021 -0400 update package-lock (version change mostly) commit f71b24a Author: Darren Ethier <[email protected]> Date: Mon May 10 11:16:58 2021 -0400 update version string to dev version commit 7f9c1b2 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon May 10 11:14:05 2021 -0400 Release: 5.1.0 (#4185) * Empty commit for release pull request * Add changelog * update testing notes * Bumping version strings to new version. Co-authored-by: github-actions <[email protected]> Co-authored-by: Darren Ethier <[email protected]> commit 80c2735 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 10 14:38:04 2021 +0200 Lock file maintenance (#4184) Co-authored-by: Renovate Bot <[email protected]> commit 90074cf Author: Thomas Roberts <[email protected]> Date: Mon May 10 10:03:30 2021 +0100 Convert shipping components to typescript (#4135) * Add type defs for customer Taken from https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/194ecccf780afe16843a894bb2e988509a0746df/assets/js/type-defs/customer.ts * Convert ShippingCalculatorAddress to TypeScript * Convert ShippingCalculator to TypeScript * Convert ShippingLocation to TypeScript * Allow packageId to be a number or string in useSelectShippingRate(s) * Convert ShippingRatesControl to TypeScript * Convert ShippingOptionsStep to TypeScript * Allow package_id to be a string or number This is because of Subscriptions using strings for package IDs * Change to use CartShippingRateItemShippingRate instead of Rate * Add extra props to PackageProps type * Make ShippingAddress have the correct type * Use CartShippingRateItemShippingRate instead of Rate * Remove Rate type * Set return types to JSX.Element * Change type of props.renderOption in ShippingRatesControl * Remove customer type defs and relocate aliases to default-address-fields * Add EnteredAddress type * Import EnteredAddress from new location * Remove unnecessary eslint ignore * Remove unused variable * Remove confusing use of word Item in Shipping types * Remove confusing use of word Item in Shipping types commit 3f1be39 Author: Albert Juhé Lluveras <[email protected]> Date: Mon May 10 10:00:14 2021 +0200 Feature gate PaymentApi (#4176) * Feature gate PaymentApi * Improve payment method missing dependencies error message so it's clear it only affects blocks * Add PaymentApi feature flags to list of feature flags in docs commit ed7eded Author: Darren Ethier <[email protected]> Date: Fri May 7 16:39:28 2021 -0400 Improvements to `emitEventWithAbort`. (#4158) * modify emitEventWithAbort to change return value `emitEventWithAbort` now returns an array of responses up to the first response that triggered an error or fail response instead of aborting on success responses too. * update add to cart form context provider * update checkout state context provider * update payment method data context provider * update tests and fix thrown error handling. commit 2be9a4e Author: Raluca Stan <[email protected]> Date: Fri May 7 15:50:55 2021 +0200 Add lodash as a devDependency (#4179) commit 69b3679 Author: Seghir Nadir <[email protected]> Date: Wed May 5 12:59:30 2021 +0100 Don't clear email and phone fields when using separate billing address. (#4162) * preseve-billing-data * pluck empty email and phone * add issue number commit 2140147 Author: Raluca Stan <[email protected]> Date: Wed May 5 13:52:27 2021 +0200 Fix/cart backend test (#4153) * Fix backend cart e2e test * Adjust test structure * Fix e2e checkout backend test. Make sure the confirmation window is closed commit f8d9b90 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 10:08:45 2021 +0000 Update dependency @stripe/stripe-js to v1.14.0 (#4170) Co-authored-by: Renovate Bot <[email protected]> commit 2391a40 Author: Thomas Roberts <[email protected]> Date: Wed May 5 10:41:48 2021 +0100 Add documentation for filters (#4167) * Rename the argument in the CheckoutFilterFunction type This only exists as an extra descriptive hint to anyone using this type, the value `label` was never used by anything so it does not need to be changed anywhere else. * Create Available Filters document * Add available filters to the extensibility README * Update docs/extensibility/available-filters.md to fix typographical error Co-authored-by: Mike Jolley <[email protected]> Co-authored-by: Mike Jolley <[email protected]> commit f4af89b Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 08:10:24 2021 +0000 Update dependency @woocommerce/e2e-utils to v0.1.4 (#4172) Co-authored-by: Renovate Bot <[email protected]> commit 6c9e786 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 03:31:52 2021 +0000 Update dependency @types/react to v16.14.6 (#4171) Co-authored-by: Renovate Bot <[email protected]> commit 3ba4d9e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed May 5 02:23:13 2021 +0000 Update babel monorepo (#4169) Co-authored-by: Renovate Bot <[email protected]> commit 35f71df Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue May 4 14:07:05 2021 +0100 Lock file maintenance (#4163) Co-authored-by: Renovate Bot <[email protected]> commit 4c65211 Author: grogou <[email protected]> Date: Wed Apr 28 14:09:28 2021 +0000 Coped package-lock.json from trunk commit 703cb65 Author: grogou <[email protected]> Date: Wed Apr 28 14:00:32 2021 +0000 Reverted package-lock.json ( downgraded node version to 12 ) commit 41dfd79 Author: grogou <[email protected]> Date: Wed Apr 28 11:12:45 2021 +0000 Pre pull request clean up code commit 75fc62e Author: grogou <[email protected]> Date: Tue Apr 27 13:03:24 2021 +0000 Added Stock Status filter commit e7bd0e6 Author: grogou <[email protected]> Date: Fri Aug 20 16:53:56 2021 +0400 Escape statuses for sql query Co-authored-by: Thomas Roberts <[email protected]> commit 29c8493 Author: grogou <[email protected]> Date: Fri Aug 20 16:53:18 2021 +0400 Allow custom stock statuses Co-authored-by: Thomas Roberts <[email protected]> commit 63ecd04 Author: groguo <[email protected]> Date: Wed Jul 28 06:22:04 2021 +0000 Bring back removed css commit 27e0233 Author: grogou <[email protected]> Date: Tue Jul 27 23:35:15 2021 +0400 Update assets/js/blocks/stock-filter/block.js Co-authored-by: Thomas Roberts <[email protected]> commit 136c32d Author: groguo <[email protected]> Date: Thu Jul 15 06:50:06 2021 +0000 Fixed preview part for stock and attribute filters commit ef89751 Author: grogou <[email protected]> Date: Wed Jul 14 20:15:05 2021 +0400 Update index.js commit a63dbce Author: groguo <[email protected]> Date: Wed Jul 14 15:43:06 2021 +0000 Review suggestion changes commit 6b0f5d2 Author: groguo <[email protected]> Date: Wed Jul 14 15:40:52 2021 +0000 Linter fix commit 791b38b Author: groguo <[email protected]> Date: Wed Jul 14 15:37:41 2021 +0000 Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query commit 1a7a002 Author: groguo <[email protected]> Date: Wed Jul 14 15:21:51 2021 +0000 Created new component for Filters elements labels commit d9b7fae Author: aaron <[email protected]> Date: Wed Jun 2 11:57:06 2021 +0400 Fix label includ path commit 5311584 Merge: 92a0da3 413a4e0 Author: aaron <[email protected]> Date: Wed Jun 2 11:52:48 2021 +0400 Merge remote-tracking branch 'core/trunk' into add/stock-filter # Conflicts: # package-lock.json commit d8e6dab Merge: 42beb9b 4343b96 Author: grogou <[email protected]> Date: Fri Apr 30 12:28:09 2021 +0400 Merge pull request #1 from woocommerce/trunk Fork update commit 92a0da3 Author: grogou <[email protected]> Date: Wed Apr 28 14:09:28 2021 +0000 Coped package-lock.json from trunk commit ae0d12b Author: grogou <[email protected]> Date: Wed Apr 28 14:00:32 2021 +0000 Reverted package-lock.json ( downgraded node version to 12 ) commit 5e0c7f9 Author: grogou <[email protected]> Date: Wed Apr 28 11:12:45 2021 +0000 Pre pull request clean up code commit 105b3f7 Author: grogou <[email protected]> Date: Tue Apr 27 13:03:24 2021 +0000 Added Stock Status filter
I've pulled all the Typescript changes from #3983 into this new PR. This is only typing, and fixing issues as a result of that.
Once merged, Ill make the rest of the changes in #3983 in a fresh PR.
How to test the changes in this Pull Request:
Requires checkout smoke test; try to get validation errors, send incorrect data on submission, and test payment/placing orders.