Commit Graph

159 Commits

Author SHA1 Message Date
Oliver Windall Juhl
08324355a4 chore: Patch bump all dependencies + minor bumps winston (#3185) 2023-02-07 19:15:29 +01:00
Riqwan Thamir
be0d36432a feat(medusa-js): added resources for product categories (#3157)
What:

JS client resources for product categories

Why:

To manage product categories and managing product-category relationship

How:

- adds a JS client resource for product categories.

RESOLVES CORE-1066
RESOLVES CORE-969
RESOLVES CORE-1061
2023-02-01 17:52:39 +00:00
Philip Korsholm
8f4c84121b feat(medusa): Add inventory for variants (#2970)
* initial get-inventory impl

* add inventory management to create-variant

* update create-variant endpoint

* move if statement

* use middleware for module checking

* add endpoint to medusa-js

* export return type from get-inventory

* add jsdoc

* revert create variant

* rename variable

* initial setInventoryPattern for variant and product endpoints

* remove cache

* sort imports

* add sales channel info to inventory calculations

* add missing import

* remove promise.all from single promise

* update oas

* initial feedback

* checkout joinLevels from develop

* add variant middleware

* add comments
2023-01-24 11:10:33 +01:00
Carlos R. L. Rodrigues
f65f590a27 feat: inventory items api (#2971)
What:
Admin endpoints to handle inventory items and their stock levels per location

FIXES: CORE-975

Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
2023-01-23 12:06:23 +00:00
olivermrbl
6481b0c357 chore(release): Publish 2023-01-18 18:48:57 +01:00
Kasper Fabricius Kristensen
150696de99 feat(medusa, medusa-js, medusa-react): Add endpoint to retrieve product tags from the storefront (#3051) 2023-01-18 10:47:15 +01:00
Kasper Fabricius Kristensen
cb25244007 hotfix(medusa-js, medusa-react): Fix issue with JS client bundle (#3038) 2023-01-16 17:44:24 +01:00
Shahed Nasser
e1292dca5f chore(medusa-js): changed README to link to the docs (#3024) 2023-01-13 15:20:03 +02:00
olivermrbl
a8bde8ba74 chore(release): Publish 2023-01-11 16:27:54 +01:00
Kasper Fabricius Kristensen
f6c81dab9e feat(medusa-js): Bundle package using Rollup (#2964) 2023-01-10 14:44:25 +01:00
Carlos R. L. Rodrigues
c07ffb6165 feat(medusa): Stock location module (#2907)
* feat: stock location module
2023-01-04 13:11:59 -03:00
olivermrbl
233d6904f8 chore(release): Publish 2022-12-22 15:54:20 +01:00
Patrick
7bb9cd6aff fix(medusa-js): missing devDependency was failing repo build task (#2804)
### What

Explicitly declare `@medusajs/medusa` as a devDependency for `@medusajs/medusa-js` client package.

### Why

With our latest version upgrade of `turbo`, peerDependencies aren't taken into account in the build graph. The recommendation is to also explicitly declare them in devDependencies.

### Test

* Run `yarn build --graph`
* Expect to see medusa-js having a dependency on medusa
```
"[root] @medusajs/medusa-js#build" -> "[root] @medusajs/medusa#build"
```
2022-12-14 16:46:08 +00:00
olivermrbl
8edf6a06ee Merge branch 'master' into develop 2022-12-14 14:47:23 +01:00
Jürgen
6531eb52ed docs: fixed typo in carts resource (#2798)
Co-authored-by: j.untch <j.untch@outlook.de>
2022-12-14 13:31:13 +02:00
olivermrbl
01d521ed40 chore(medusa-js): Version package + add missing changeset 2022-12-14 09:37:20 +01:00
olivermrbl
29135c0519 chore(release): Publish 2022-12-13 10:34:07 +01:00
Philip Korsholm
a6243618fe feat(medusa): Claim customer orders (#2710) 2022-12-08 17:48:49 +01:00
Carlos R. L. Rodrigues
15c667fbd3 feat(medusa,medusa-react): PaymentCollection support (#2659)
* chore: medusa react, order edit complete fix and single payment session
2022-12-07 12:39:35 -03:00
Frane Polić
3b2c929408 feat(medusa-js, medusa-react): PublishableKeys SC management (#2734) 2022-12-07 12:16:48 +01:00
Carlos R. L. Rodrigues
01a879ac94 chore: markAsAuthorized and payment collection tests (#2620)
* chore: markAsAuthorized and payment collection tests
2022-11-18 11:23:35 -03:00
Frane Polić
9eafde07fe feat(medusa-js): Register PublishableApiKey (#2616)
**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
2022-11-17 12:19:18 +00:00
Frane Polić
03fc9e18e9 feat(medusa, medusa-js, medusa-react): PublishableApiKey "update" endpoint & add "title" property (#2609)
**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_"
2022-11-16 04:35:22 +00:00
Carlos R. L. Rodrigues
ccfc5f666d feat(medusa-js): Add payment and payment collections clients (#2608) 2022-11-15 21:27:00 +01:00
Frane Polić
3de553c27f feat(medusa-js, medusa-react): PublishableApiKeys clients (#2582)
**What**
- add `PublishableApiKeys` endpoints to the `medusa-js` and `medusa-react` clients

--- 

RESOLVES CORE-791
DEPENDS ON https://github.com/medusajs/medusa/pull/2567
2022-11-15 15:41:58 +00:00
olivermrbl
a4dd26e137 chore(release): Publish 2022-11-09 19:34:59 +01:00
Patrick
7b0ceeffb4 feat: /store api product types (#2552)
## What
Allow users to fetch ProductTypes from the storefront API.

## Why
This endpoint will allow developers to implement better faceted product search in Medusa without the need for search plugin. Developers will be able to use this to render refinement lists based on types, like this:
![image](https://user-images.githubusercontent.com/116003638/200417828-863065de-3607-49db-bd72-62a6815129fa.png)

## How
Endpoint `GET /store/products/types` and `GET /store/product-types` (use [product types listing in admin](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/api/routes/admin/products/list-types.ts) as reference)

Support added in @medusajs/medusa-js
Support added in medusa-react

## Testing
Similar automated tests as `GET /admin/products/types` and `GET /admin/product-types`

---

Resolves CORE-699
2022-11-09 16:10:17 +00:00
olivermrbl
ee8a71c692 chore(release): Publish 2022-11-02 16:44:54 +01:00
Kasper Fabricius Kristensen
fcfb7d167b fix(medusa): Allow AddressPayload or string on DraftOrder creation (#1902) 2022-10-19 18:01:08 +02:00
Philip Korsholm
3c5e31c645 fix(medusa, medusa-file-*): Protected uploads for file services (#2433) 2022-10-18 10:46:47 +02:00
Adrien de Peretti
48411157b1 feat(medusa): Support batch remove resources on discount condition (#2444)
**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
2022-10-17 09:03:38 +00:00
Adrien de Peretti
765a2cccda Feat/add discount condition batch (#2430)
* 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
2022-10-13 16:34:06 +02:00
Adrien de Peretti
143f8543e5 feat(medusa, medusa-js, medusa-react): Support listing order edits (#2436)
* feat(medusa, medusa-js, medusa-react): Support listing order edits

* feat(medusa): Update OAS

* fix oas

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-10-13 14:44:08 +02:00
Kasper Fabricius Kristensen
69e579758f fix(medusa, medusa-js): Use price selection strategy for GET /admin/variants (#2270)
**What**
- Adds the use of price selection strategy to the endpoint `GET /admin/variants`
- Updates medusa-js to reflect this change (expanding the parameters).

**Testing**
- Adds a new integration test validating that returned variants are now of type PricedVariant, with the expected fields: original_price, calculated_price, etc.

**Why**
- Our current RMA flows (in our admin dashboard) relied heavily on simply using `order.tax_rate` to calculate variant prices in the different RMA menus. As taxes in Medusa, have become feature complete this approach had become very naive and has several potential issues. Moving the responsibility for calculating the correct prices guarantees that we always show the correct prices to admins.
2022-10-13 08:54:03 +00:00
olivermrbl
35df4962f8 chore(release): Publish 2022-10-10 18:02:50 +02:00
Philip Korsholm
642902aaeb feat(medusa-js, medusa-react): Support expand fields in order retrieval (#2353) 2022-10-06 13:58:46 +02:00
Philip Korsholm
00959f79bc Feat(medusa): remove item from order (#2273)
* 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
2022-09-30 09:48:18 +02:00
Adrien de Peretti
95c0dc653a feat(medusa, medusa-js, medusa-react): Implement store complete order… (#2275)
**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
2022-09-29 17:06:45 +00:00
Adrien de Peretti
2be00007b2 Feat(medusa, medusa-js, medusa-react): order edit confirmation (#2264)
**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
2022-09-29 08:00:48 +00:00
Frane Polić
884f36e8a8 feat: add a line item to an order edit (#2243)
**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
2022-09-28 11:51:13 +00:00
Adrien de Peretti
474e97252c Feat(medusa, medusa-js, medusa-react): order edit item update (#2246)
**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
2022-09-28 09:09:33 +00:00
Philip Korsholm
1807bff029 Feat(medusa): cancel order edit (#2240)
**What**
- cancel an order edit

Fixes CORE-500
2022-09-27 03:13:15 +00:00
Philip Korsholm
6da29c72c4 Feat(medusa): request order edit (#2239)
**What**
- Implement `admin/order-edits/:id/request`

Fixes CORE-499
2022-09-22 10:17:00 +00:00
Adrien de Peretti
14e808c724 feat(medusa, medusa-js, medusa-react): Implement item change deletion from an order edit (#2241) 2022-09-22 11:02:58 +02:00
Philip Korsholm
c661cc789b Feat/decline order edit (#2234)
**What**
- Decline an order edit from a store endpoint
- Refactor totals setting to a service method

Fixes CORE-502
2022-09-21 11:02:10 +00:00
Frane Polić
e1fe5ed094 feat(medusa): Update OrderEdit (#2220) 2022-09-19 13:29:12 +02:00
Adrien de Peretti
f7177c9033 feat(medusa): Implement premises of the creation flow of an order edit (#2187)
**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
2022-09-16 08:29:40 +00:00
sabakhilji
6132711eef fix(medusa-js): Use correct payload type in medusa-js (#2207) 2022-09-16 09:42:26 +02:00
Philip Korsholm
09627c01d3 feat(medusa): Support OrderEdit removal (#2204) 2022-09-16 08:39:40 +02:00
Adrien de Peretti
f863d28b9a feat(medusa): Implement premises of order edit retrieval (#2183)
**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
2022-09-15 09:12:20 +00:00