**What**
- Fixes an issue where query keys weren't invalidated on successful mutations.
**How**
- Update `buildOptions` function to be called per `QueryKey` instead of passing them all as a single query key, resulting in no matches found.
- Fixes imports that aren't compatible with ESM modules.
**What**
- register a publishable API key through `medusa-js` i.e. define the key that will be sent with each request
**How**
- introduce KeyManager class which is used to share keys between medusa-js objects.
**Usage**
1. Set the key through the `Medusa` config
2. Set the key through `KeyManager` dynamically:
```ts
import { KeyManager } from "medusa-js"
KeyManager.registerPublishableApiKey("pk_123")
```
---
RESOLVES CORE-794
**What**
- update PK endpoint
- medusa-js/react implementation
- add a title property to the entity
- update the migration file
- pass a title on create
- list PKs by title
- update the client libs with new param signatures
- change id prefix to: "pk_"
**what**
- Add support to remove resources by batch on discount conditions
- Add support on medusa-js and medusa-react
**Tests**
- Add integration tests to validate that the resources have been deleted and the length is the one expected
- Add unit tests on medusa react
FIXES CORE-609
* feat(medusa): Allow to add items to a discount condition by batch + cleanup of discounts and discount conditions end points
* style(medusa): cleanup catch and log
* feat(medusa-react, medusa-js): Add support to add item batch to discount condition
* cleanup
* cleanup
* rename items to resources
* fix(medusa-js): url
* Create fast-suns-repair.md
* update naming
* tests(integration): Update tests to reflect API changes
* feat(medusa): Delete a condition should be idempotent on discount and condition
* revert
* wait for update to order edit model
* delete line item tests
* create remove method for lineitem with tax lines
* add remove item tests
* split delete allocation tests into two: more and less than total
* remove unused import
* cleanup
* add medusa-js and react endpoints
* pr feedback fixes
* linting
* remove unused relation from query
* remove removed-event and unused imports
* add await
**What**
Allow a customer to complete a requested order edit.
**Test**
- Unit tests complete flow
- Unit tests medusa react
- Integration tests of order edit completion
FIXES CORE-501
**what**
Support confirm of an order edit:
Upon confirmation, the items of the original order are detached and the items from the order edit are attached to the order.
The order total is recomputed with the correct total which can defer from the paid_total and refundable_amount (based on the paid_total)
**Tests**
- Unit tests medusa-js and medusa-react as well as the core
- Integration test of the confirmation flow which check that the order edit is properly confirmed and can be confirmed idempotently. Also validate the totals and that the order items correspond to the order edit items. Also validate the order totals.
FIXES CORE-498
**What**
- Implement adding a line item to order (edit)
**How**
- _by implementing the following "flow"_
- generate a line item
- computing line item adjustments for that line item
- creating tax lines
- creating a change record
**Testing**
- **_integration tests_**
- check if line item and order item change objects are created (with correct tax lines)
- line item adjustments are generated if
- fixed discount is applied to cart
- percentage discount is applied
- **_unit tests_**
- ensure that methods from Inventory, LineItem, LineItemAdjustment etc. services are called
---
RESOLVES CORE-495
**what**
Support `updateLineItem` which does the following:
- If no item change exist then create a new one and attaches the clone item with the adjustments and tax lines
- if an item change exists then delete/create adjustments and tax lines and update the cloned item quantity
**Tests**
- Unit tests core + client
- integration tests
- When no item change already exists
- When an item change already exists
FIXES CORE-497
**What**
- Implements the admin create end point
- Service implementation of the create method and the retrieveActive as well as the totals computation
- Improve compute line items
- client
- medusa-js api
- medusa-react mutations hooks
**Tests**
- Unit tests of the create end points
- Unit tests of the service create method
- Integration tests for admin that also take into account totals computations
- client
- medusa-js tests
- medusa-react hooks tests
FIXES CORE-491
**What**
- Implements the admin/store retrieval end point
- Service implementation of the retrieve method
- Service implementation of the computeLineItems method which aggregates the right line item based on the changes that are made
- client
- medusa-js api
- medusa-react queries hooks
**Tests**
- Unit tests of the retrieval end points
- Unit tests of the service retrieve method and computeLineItems
- Integration tests for admin/store
- client
- medusa-js tests
- medusa-react hooks tests
FIXES CORE-492
**What**
Wrap all actions that require the usage of an atomic phase into a transaction from the handler
**Info**
The following end points have been removed since that they rely on non existing stuff and can't be used and are not used
admin - create-order
admin - delete order metadata
admin - set region metadata
admin - remove region metadata
Fixes CORE-358
* feat(medusa): Migrate and fix order service
* fix(medusa): Order service pass Payment instead of the session:
* fix(medusa): Remove unnecessary method in the client library
* test(medusa): Fix unit tests
* test(medusa): Fix unit tests
* fix(medusa): Typo
* test(meduas): fix unit test
* feat(medusa): Update base service used and missing transaction
* test(meduas): fix unit test
* fix(medusa): cleanup and missing transaction
* fix(medusa): missing withTransaction on some mocks
* feat(medusa): Update order service method visibility
* include feedback
* feat(medusa); revert order payment status"
* test(medusa): fix unit
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
What
Support sales channel remove product batch in medusa, medusa-js and medusa-react
How
By implementing a new endpoint and the associated service method as well as the repository methods.
Medusa-js new removeProductd method in the resource
Medusa-react new hook in the mutations
Tests
Endpoint test
Service test
Integration test
Hook tests
Fixes CORE-292
**What**
Support sales channel list in medusa, medusa-js and medusa-react
**How**
By implementing a new endpoint and the associated service method as well as the repository methods.
Medusa-js new list method in the resource
Medusa-react new hook in the queries
**Tests**
Endpoint test
Service test
Integration test
Hook tests
Fixes CORE-280
**What**
- Add tag to indicate methods are part of an experimental feature under development
**Why**
- To notify developers because we cant support featureflags in the same way from the client side libraries.
### What
At the moment, it is not possible to not invalidate any queries>
Example, when we want to Create a new signed url, it does not require to invalidate any of the queries.
But the way it is done in the buildOptions, require to give either a key or an array of keys.
### How
The behaviour for empty array is to invalidate all the queries and here we would like to be able to just pass undefined in order to not trigger the invalidation. The update allow the arg to be optional and check for undefined explicitly before choosing the invalidation