Commit Graph

3953 Commits

Author SHA1 Message Date
Riqwan Thamir f22e063ed8 test: fix existing integration tests and add a new test that validates regions inclusion and validity 2022-12-07 16:42:32 +01:00
Riqwan Thamir d4e565b0b9 fix: regions are changed from an optional to required field
A discount should always be associated to atleast 1 region - we validate it against the region in the cart service.

Adding a request parameter validation to pass in atleast one regionID in an array of regions will ensure that regionID will be validated as a part of the discount service and fail if its not a valid region ID.
2022-12-07 16:42:32 +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
Adrien de Peretti 42d9c7222b feat(medusa): Performance improvements of Carts domain (#2648)
**What**

I have created a new method on the cart service which is `addLineItems`, allowing a user to add one or multiple items in an optimized way. Also updated the `generate` method from the line item service which now also accept a object data or a collection of data which. Various places have been optimized and cache support has been added to the price selection strategy.

The overall optimization allows to reach another 9000% improvement in the response time as a median (Creating a cart with 6 items):

|   | Min (ms)  | Median (ms)  | Max (ms)  | Median Improvement (%)
|---|:-:|---|---|---|
| Before optimisation  | 1200  | 9999 | 12698  |  N/A
| After optimisation | 63  | 252  | 500  | 39x
| After re optimisation | 56 | 82  | 399  | 121x
| After including addressed feedback | 65 | 202  | 495  | 49x

FIXES CORE-722
2022-12-07 14:39:12 +00:00
Frane Polić 3b2c929408 feat(medusa-js, medusa-react): PublishableKeys SC management (#2734) 2022-12-07 12:16:48 +01:00
Frane Polić 322d462311 feat(medusa): PublishableApiKeys SC scopes (#2590)
**What**
-  add/ remove sales channels to/from PublishableApiKey in batch
- associate created cart with SC defined by PK
- filter products if PK with SC association is present
- retrieve a list of sales channels for a PK
- implement 3 new middleware
  - `extendRequestParams`
    -  _extend req object with PK scopes (a list of sales channels) if a publishable key is present in the header of the request_
  - `validateProductSalesChannelAssociation`
    -  _validate if the passed product id belongs to a SC from the PK's scope_
  - `validateSalesChannelParam`
    -  _validate that passed SC ids in the req body/query are within the scope of the PK_

**How**
- The general idea was to reuse existing logic in the controller layer which expects `sales_channel_id` array to be passed. The middleware sets associated SC ids in the request context if a PK is present. These ids are then merged in the controller and passed to the service layer.

**TODO**
- filter response from the search endpoint (CORE-824)

**Testing**
- _integration tests_
  - add sales channels to the publishable API key scope
  - remove sales channels from the publishable API key scope
  - returns products from a specific channel associated with a publishable key
  - returns products from multiples sales channels associated with a publishable key
  - returns all products if PK is not passed
  - returns all products if passed PK doesn't have associated channels
  - should assign sales channel to order on cart completion if PK is present in the header
  - list sales channels from the publishable api key
  -  throws because sales channel in query/body is not in the scope of passed PK 

---

**Discussion**
- what about the other endpoints (e.g. GET /store/product/:id - do we return 404 if the product is not in the SC associated with passed PK)
- what about products search route
- what about `/admin/products` & `/admin/orders` routes (do we add the middleware there as well)

---

RESOLVES CORE-792
RESOLVES CORE-793
RESOLVES CORE-816
2022-12-07 07:50:20 +00:00
Shahed Nasser 8efae2dfcf docs: added details about admin analytics in usage documentation (#2733) 2022-12-06 18:14:07 +02:00
Shahed Nasser 2ffeaf567f docs: delete unused doc files (#2732) 2022-12-06 18:13:38 +02:00
chemicalkosek 5bd2faa02b docs: fix import path in medusa-react README (#2731) 2022-12-06 17:26:13 +02:00
Shahed Nasser 7363cae339 docs: Added Manage Discounts using Admin APIs doc (#2730) 2022-12-06 16:43:13 +02:00
Patrick 4cb93e37df chore(docs): remove unused files from www directory (#2722) 2022-12-05 10:52:34 -05:00
Patrick 621a37cb68 chore(docs): remove unused files from www directory 2022-12-05 10:23:09 -05:00
Patrick 65456252a1 chore(docs): remove www/reference directory from codebase 2022-12-05 10:23:09 -05:00
Adrien de Peretti 1b21af87ab chore(medusa-core-utils): Migrate to TS (#2670) 2022-12-05 10:21:04 +01:00
Philip Korsholm 406354c97e chore(workflows): Update trigger-staging-release.yml (#2718) 2022-12-04 15:42:27 +01:00
Shahed Nasser f19e4de636 docs: added Use Discounts in Checkout documentation (#2717) 2022-12-02 16:10:54 +02:00
Patrick 1dc816039c chore(oas): explicitly declare type:object on schemas with properties (#2712)
### What

OAS: Explicitly declare type:object on schemas with properties.

### Why

While not officially required, schemas with properties should have their type explicitly declared as "object". Omitting the type translates to type: any with properties XYZ. The ambiguity can lead to issues when using code generators.

### How

Multiple regex searches to identify schemas missing type: object. Manually edit each schema. Spot check generated OAS.

### Testing
- Ran OAS validator.
- Ran docs build script

### Proof
![Screen Shot 2022-12-01 at 1 46 13 PM](https://user-images.githubusercontent.com/116003638/205137671-7a6770dd-4f9b-456c-99a6-ac654f6d0f59.png)


RESOLVES CORE-847
2022-12-02 13:51:16 +00:00
Shahed Nasser c729921180 docs: fixes to discounts documentation percentage (#2711)
* docs: fixes to discounts documentation

* docs: added a note about regions for fixed discount
2022-12-01 17:37:56 +02:00
Shahed Nasser b54405e3de docs: added Discounts Architecture documentation (#2709)
* docs: added discounts architecture documentation

* docs: fix tooltip text showing in the copied text

* docs: added missing link
2022-12-01 16:08:27 +02:00
Shahed Nasser 6cea109caa docs: added user guide for Manage Discounts (#2706) 2022-11-30 19:24:34 +02:00
Shahed Nasser 7bee40c6f3 docs: added Create a Discount user guide (#2705) 2022-11-30 17:32:43 +02:00
Philip Korsholm 761ea8383d chore(workflow): Ignore changes in ./github folder in staging release trigger 2022-11-30 13:59:27 +01:00
Philip Korsholm b023d846c3 Feat(Medusa): Trigger staging deployment (#2695)
* initial implementation of trigger action

* rename access token

* update paths ignore
2022-11-30 13:59:26 +01:00
Sebastian Rindom 198fe78c13 fix: allow passing idempotency key to service layer create (#2701)
**What**

Allow DraftOrders to be created with an IdempotencyKey. 

Note this doesn't implement idempotency for the DraftOrder create endpoint but allows the service layer to ingest the key and store it in the database. This is a preliminary step to being able to support an idempotent API request.
2022-11-30 09:23:59 +00:00
Philip Korsholm 0764c6f994 chore(workflow): Ignore changes in ./github folder in staging release trigger 2022-11-30 09:39:12 +01:00
github-actions[bot] daa31b78f6 chore(docs): Removed Docs Announcement Bar (automated) (#2700)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
2022-11-30 09:57:41 +02:00
Shahed Nasser 663e262cc4 docs: added deploy to railway docs (#2697) 2022-11-29 19:16:18 +02:00
Philip Korsholm ea193b6830 Feat(Medusa): Trigger staging deployment (#2695)
* initial implementation of trigger action

* rename access token

* update paths ignore
2022-11-29 16:46:28 +01:00
Shahed Nasser 657ada6fb0 docs: added credentials option to fetch examples (#2694) 2022-11-29 17:21:19 +02:00
Philip Korsholm 70a8d3450f fix(medusa): Use correct auth middleware in GET /store/auth (#2687)
* use correct authentication middleware

* remove guard from get-session since it's guarded by middleware doing the same check

* Add integration tests

* Create lazy-swans-agree.md

Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-11-29 15:46:55 +01:00
Shahed Nasser a917b0a109 docs: small fixes across the documentation (#2692)
* docs: various bug fixes

* docs: add the import in other storage plugins

* docs: fixed the placement of manual taxes doc
2022-11-29 16:29:55 +02:00
Shahed Nasser 0c8bdf4dad docs: fixed error in code in override price selection (#2689) 2022-11-29 14:54:17 +02:00
github-actions[bot] 4f3a7c9048 chore(docs): Generated Entities Reference (automated) (#2680)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
2022-11-28 13:11:03 +02:00
Harsh Mangalam da7ea8c5d4 docs: fix customer last name type (#2641) 2022-11-28 12:50:03 +02:00
Shahed Nasser 2db038cd82 docs: fixed tooltip causing overflow in codeblocks (#2679) 2022-11-28 11:03:11 +02:00
github-actions[bot] 6aee2e2265 chore(docs): Generated Services Reference (automated) (#2663)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2022-11-28 11:02:51 +02:00
github-actions[bot] d9f9d7ac28 chore(docs): Generated Entities Reference (automated) (#2661)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2022-11-28 11:02:34 +02:00
github-actions[bot] ee14155eb7 chore(docs): Generated JS Client Reference (automated) (#2660)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2022-11-28 11:02:11 +02:00
github-actions[bot] 3cee0bc8fc chore(docs): Generated API Reference (#2649)
Co-authored-by: kodiakhq[bot] <kodiakhq[bot]@users.noreply.github.com>
2022-11-28 10:59:43 +02:00
Adrien de Peretti e18b59de66 chore: Update Awilix to v8 (#2668) 2022-11-25 13:56:22 +01:00
Adrien de Peretti ed121922b0 fix(medusa): Order service legacy decorate totals should add totals to items (#2667)
For some reason, probably a conflict, the legacy decorate totals does not attach the totals to the line items
https://github.com/medusajs/medusa/pull/2546/files

FIXES CORE-832

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-11-24 18:31:45 +00:00
olivermrbl 2bfc55ced5 chore: Correct changeset for #2666 2022-11-24 17:44:10 +01:00
Adrien de Peretti 63d2a0eb1b fix(strip): Hooks import was wrong (#2666)
* fix(strip): Hooks import was wrong

* Create nervous-insects-switch.md
2022-11-24 16:16:35 +01:00
github-actions[bot] 546577a81a chore(docs): Generated Docs Announcement Bar (automated) (#2662) 2022-11-24 11:49:22 +01:00
olivermrbl 105c689298 chore(release): Publish 2022-11-24 11:42:04 +01:00
olivermrbl acb289e369 Merge branch 'master' into develop 2022-11-23 10:23:09 +01:00
dependabot[bot] 604badf71d chore(deps): bump loader-utils from 1.4.0 to 1.4.2 in /www/docs (#2653)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 15:40:48 +01:00
olivermrbl 7d86ab6055 merge master into develop 2022-11-22 13:56:58 +01:00
dependabot[bot] 1a2d5e6309 chore(deps): bump socket.io-parser from 4.0.4 to 4.0.5 in /www/reference (#2652)
Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 4.0.4 to 4.0.5.
- [Release notes](https://github.com/socketio/socket.io-parser/releases)
- [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-parser/compare/4.0.4...4.0.5)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 13:51:36 +01:00
dependabot[bot] d4b41629cc chore(deps): bump loader-utils from 1.4.0 to 1.4.2 in /www/reference (#2651)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 13:47:54 +01:00