Commit Graph

6069 Commits

Author SHA1 Message Date
Nicolas Gorga
28fae96cee fix(core-flows): Avoid throwing if no prices found for variant when adding to cart custom price item (#14528)
* Avoid throwing prices not found error when line item is custom unit price

* Add changeset

* Avoid throwing upo variant price validation for custom priced item variants
2026-01-13 14:58:41 -03:00
Adrien de Peretti
55d2a70470 feat(config): Default event worker concurrency to 3 on cloud (#14477)
* feat(config): Default event worker concurrency to 3 on cloud

* Create dirty-pears-smell.md

* fix test
2026-01-13 09:26:02 +01:00
Adrien de Peretti
7307a5e63f feat(events): Implement default priority-based event processing (#14476)
* feat(events): Set internal events default priority to lowest, default events to 100 and order placed to 10

* Create swift-months-rush.md

* improvements

* improvements

* improvements

* fix condition

* doc

* fix tests

* fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-12 16:05:42 +01:00
Shahed Nasser
5f90cd0650 feat(create-medusa-app): add support for pnpm and specifying package manager (#14443)
* feat(create-medusa-app): add support for pnpm and specifying package manager

* fixes

* add medusa command method

* add tests for package manager

* fix duplicate messages

* throw if chosen package manager is not available

* better package manager and version detector

* add debug message

* fix version detection

* fix for yarn v3

* fix migration command

* yarn v3 fix

* remove .yarn directory for non-yarn package managers

* run npm ci to validate npm installation

* fixes

* fixes

* remove corepack line

* remove if condition
2026-01-12 12:55:26 +02:00
erbold-bu
514cc329f8 feat: added mn-MN to the default list of locales (#14487)
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2026-01-12 09:14:17 +01:00
Lukas Krisikaitis
e91ce2ee4b feat(locales): add lt-LT to the default list of locales (#14518) 2026-01-12 09:07:00 +01:00
Nicolas Gorga
6cbbd033e4 chore(order): Add missing OrderItem GraphQL schema fields (#14459)
* Add missing grapqhl schema fields to order item

* Add changeset
2026-01-10 13:22:24 -03:00
Shahed Nasser
1ca3516a5c feat(deps,framework): add zod as framework dependency (#14441)
## Summary

**What** — What changes are introduced in this PR?

Export Zod as a dependency of `@medusajs/framework`.

Closes DX-2414

**Why** — Why are these changes relevant or necessary?  

Zod is an essential part of Medusa development. We use it in the core and developers use it in their customizations.

Developers using pnpm won't have access to Zod, as it's not a top-level dependency. While they can install any version, since Zod is an essential aspect of our framework, it's more convenient that we export it and make it accessible to developers.

**How** — How have these changes been implemented?

1. Add Zod as a dependency in `@medusajs/deps` and export it in `@medusajs/framework`
2. Change imports of Zod across projects to import from `@medusajs/framework` and remove the Zod dependency.

> Note: this change doesn't cover admin extensions (and our related packages), as they're not related to the Medusa framework and using Zod in them isn't part of the conventions we document.

Developers can import Zod like this now:

```ts
import { z } from "@medusajs/framework/zod"
```

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

Use the following import in a Medusa project to create an validate zod schemas:

```bash
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
import { z } from "@medusajs/framework/zod"

export const PostCustomSchema = z.object({
  name: z.string(),
})

type PostCustomSchema = z.infer<typeof PostCustomSchema>

export async function POST(
  req: MedusaRequest<PostCustomSchema>,
  res: MedusaResponse
) {
  res.json({
    message: `Hello, ${req.validatedBody.name}`
  })
}

// in middleware
import { defineMiddlewares, validateAndTransformBody } from "@medusajs/framework/http"
import { PostCustomSchema } from "./admin/custom/route"

export default defineMiddlewares({
  routes: [
    {
      matcher: "/custom",
      middlewares: [validateAndTransformBody(PostCustomSchema)],
    },
  ],
})
```

---

## Examples

-

---

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x] I have linked the related issue(s) if applicable

---

## Additional Context

-
2026-01-09 13:20:01 +00:00
Pedro Guzman
19f274523c add cloud auto-login (#14488) 2026-01-09 13:26:25 +01:00
github-actions[bot]
8fee89d622 chore: Version Packages (#14483)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-09 12:52:13 +01:00
Adrien de Peretti
233ec261be fix: Add schema only flag on Medusa app loader (#14502)
* fix(build): Introduce a schema only flag for more heavy light weight loading

* fix(build): cleanup and tests

* Create shy-snails-raise.md

* fix(build): cleanup
2026-01-09 12:21:28 +01:00
Adrien de Peretti
08c55e7035 feat(DML): Add a new translatable property modifier applicable on text (#14494)
* feat(DML): Add a new translatable property modifier applicable on text

* feat(DML): Add a new translatable property modifier applicable on text

* feat(DML): Add a new translatable property modifier applicable on text

* Create gold-bobcats-decide.md

* feat(DML): Add a new translatable property modifier applicable on text

* feat(DML): Add a new translatable property modifier applicable on text

* simplification
2026-01-09 10:13:25 +01:00
Adrien de Peretti
bb599a26de feat(medusa-app): Link initialization should respect migrationOnly flag (#14493)
* feat(medusa-app): Link initialization should respect migrationOnly flag

* Create cyan-taxis-behave.md
2026-01-08 15:13:32 +01:00
Adrien de Peretti
568742826f feat(): Add modules options autocomplete to medusa config (#14465)
* feat(): Add modules options autocomplete to medusa config

* feat(): Add modules options autocomplete to medusa config

* Create great-lies-decide.md

* feat(): Add modules options autocomplete to medusa config
2026-01-07 21:24:35 +01:00
Carlos R. L. Rodrigues
b2245cc672 chore(rbac): user link and utils (#14320) 2026-01-07 10:40:15 -03:00
Carlos R. L. Rodrigues
1bfde8dc57 feat(rbac): role-based access control module (#14310) 2026-01-07 05:36:39 -03:00
github-actions[bot]
229fc6f8fd chore: Version Packages (#14331)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-06 16:21:52 +01:00
Adrien de Peretti
d54589751c feat(translation): Improve translation alert in empty languages state (#14464)
**What**
When there is no languages configured, the translation page will show a proper alert on the page that is more visible and actionable
2026-01-06 15:04:23 +00:00
Shahed Nasser
b300a93345 fix(create-medusa-app): fix version option not working with Next.js storefront (#14462)
1. Fix error when passing `--version` and installing Next.js storefront. The error is because the UI package doesn't follow the same versioning as other Medusa packages, so this will skip updating the version of the UI package.
2. Other: added error logging for installation errors
2026-01-06 14:40:54 +00:00
Shahed Nasser
60f68ff492 chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460) 2026-01-06 15:26:23 +02:00
Shahed Nasser
ab7b04dbc9 fix(js-sdk): add metadata parameter to request body type of reset-password route (#14458)
* fix(js-sdk): add metadata parameter to request body type

* update changeset
2026-01-06 12:36:29 +01:00
Adrien de Peretti
0ffd790109 feat(translation): Add support for locale to the graph query (#14454)
* feat(translation): Add support for locale to the graph query

* feat(translation): Add support for locale to the graph query

* feat(translation): Add support for locale to the graph query

* feat(translation): fix import

* fix

* cleanup

* fix context in product routes

* Create dull-onions-punch.md
2026-01-06 12:29:27 +01:00
Adrien de Peretti
0490a1c67f feat(translation): Order translastable entities ordered alphabetically (#14451)
Order translastable entities ordered alphabetically
<img width="1178" height="759" alt="Screenshot 2026-01-06 at 08 41 43" src="https://github.com/user-attachments/assets/2eaa2f9c-07c7-46b1-b2ff-3a0660b575d8" />
2026-01-06 10:35:06 +00:00
Adrien de Peretti
d9bc2767c1 feat(translation): Update wording in translation list for translation… (#14453)
* feat(translation): Update wording in translation list for translation count

* Create great-dolls-burn.md
2026-01-06 11:27:49 +01:00
Nicolas Gorga
9cad05c8df chore(medusa): add missing fields and filters to product variants endpoint (#14448)
## Summary

**What** — What changes are introduced in this PR?

Add missing filters like `ean, upc, barcode` and fields like `thumbnail` to product variants endpoints.

**Why** — Why are these changes relevant or necessary?  

We had a disconnection between the allowed filters and fields for variants in the products endpoint and in the product variants endpoint.

**How** — How have these changes been implemented?

Avoid this issue in the future by removing redundant definitions for fields and filters for variants in the products and variants endpoints, consolidating them in the variants endpoint and implementing imports in the products endpoint. Add missing fields/filters to product variants endpoint.

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.

fixes SUP-2872
2026-01-06 09:46:38 +00:00
Adrien de Peretti
9d2c78db4e fix(translation): omit id from types properties (#14445)
* fix(translation): omit id from types properties

* Create dry-toes-lay.md
2026-01-05 20:24:37 +01:00
Nicolas Gorga
8055a79c52 fix(core-flows): conditionally create customer on order email update if unset (#14264)
* Find or create customer on order email update when order email is unset

* Tests

* Add changeset
2026-01-05 16:12:42 +01:00
Nicolas Gorga
a464e9d907 fix(core-flows): Avoid checking inventory items on fulfillment cancel for unmanaged inventory variants (#14177)
* Avoid checking existent inventory item on fulfillment cancellation for variants without managed inventory

* Add changeset

* Dismiss existent variant inventory links when updating to unmanaged inventory

* Update input type and step name

* Dismiss inventory when variant is updated to unmanaged inventory

* Review changes

* Fix

* Fix

* Comments

* Include Map to avoid iterating unnecessarily
2026-01-05 16:11:23 +01:00
Riqwan Thamir
43305a562c feat(medusa,utils,core-flows): add reset password metdata (#14417)
## Summary

**What**

Adds metadata field for reset password route that allows passing data from caller that can be found in the subscriber. 

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable


---

> [!NOTE]
> Introduces optional request `metadata` for reset-password and propagates it through to event subscribers.
> 
> - Accepts `metadata` in `ResetPasswordRequest` validator and `reset-password` route; forwards it to `generateResetPasswordTokenWorkflow`
> - Workflow now accepts `metadata` and includes it in emitted `auth.password_reset` event data
> - Updates event docs to mention `metadata` field
> - Adds integration test verifying `metadata` is emitted in the password reset event
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7f9855feabed284336e8872eebfb18fe3bd320db. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2026-01-02 12:41:26 +00:00
Frane Polić
d06729d0d1 fix(dashboard): form reset for across allocation (#14369)
**What**
- fix an issue where switching between `across` promotion types in the create form wouldn't set `max_quantity` to null which would cause the create request to fail

---

CLOSES https://github.com/medusajs/medusa/issues/14365


---

> [!NOTE]
> Prevents invalid `max_quantity` when switching templates to an *across* allocation in the promotion creation flow.
> 
> - In `create-promotion-form.tsx`, after applying template defaults, explicitly sets `application_method.max_quantity` to `null` if `application_method.allocation` is `"across"` to avoid resetting it to `1`
> - Adds a changeset entry for `@medusajs/dashboard` patch release
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5b08c77fee741ec5de399b4f1f9e245ba69b5bee. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-02 10:46:50 +00:00
Nicolas Gorga
242f1d7d7f feat(dashboard,draft-order): Remove hardcoded strings and replace with translations in draft orders list page (#14400)
## Summary

**What** — What changes are introduced in this PR?

Add translations management to draft orders list page.

**Why** — Why are these changes relevant or necessary?  

We were using hardcoded English strings.

**How** — How have these changes been implemented?

Remove hardcoded strings and replace them with dynamic translations.

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.

closes #14377
2026-01-02 10:44:42 +00:00
Nicolas Gorga
bf4cc12545 feat(core-flows,utils): Shipping options workflow events emission (#14388)
* Shipping options workflow events type

* Emit shipping options workflow events

* add changeset
2026-01-02 11:28:29 +01:00
Oli Juhl
7e3ed913a6 chore: Create publishable API key as part of the defaults (#14356)
* wip

* chore: fix tests

* Create tiny-carrots-bathe.md
2026-01-02 11:27:03 +01:00
Nicolas Gorga
11de7e3e34 feat(translation,core-flows): translate remaining core entities and sync shipping option <> method translations (#14358)
* Get translated shipping options step

* Apply translations on shipping options list methods.

* Pass shipping option naem when refreshing cart shipping methods, so if locale changed, we update the name

* Update translatable fields config

* Cart shipping method update translation tests

* Shipping options translations tests

* Add changeset

* Update order shipping method translations on update

* Remove unnecessary workflow and use step instead

* Translate shipping method on order edit

* Use new update shipping methods tranlsations step

* Draft order shipping method translation sync

* Translate shipping method on order exchange

* Translate returns shipping methods

* Translate claims shipping methods

* Remove unnecessary check

* Early return

* Fix import

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-02 11:26:06 +01:00
Oli Juhl
5f807ee657 chore: Ensure isolated order deletion (#14405)
## Summary

Ensure that address deletion during order deletion is handled correctly with respect to cascading deletes. Currently, when deleting an order that does not have a shipping or billing address, we incorrectly attempt to delete all order addresses. This happens because `undefined` address IDs are not handled properly during deletion.

More specifically, when deleting an order without addresses, the following method is called with these arguments:
```ts
await deleteOrderAddresses([undefined, undefined])
```
This triggers deletion of all order addresses.

To make matters worse, because we have a cascade delete defined from order addresses to orders, the same call also deletes all associated orders.

The root cause is the following filtering logic:
```ts
const orderAddressIds = orders
      .map((order) => [order.shipping_address_id, order.billing_address_id])
      .flat(1)
```

For orders without addresses, this produces `[undefined, undefined]` as input filter, which our delete methods interpret as:
```ts
await delete({ '$or': [ { id: undefined }, { id: undefined } ] })
```

This effectively translates to “delete all addresses.”

In this PR, we make two changes to prevent this going forward:
1. Filter out undefined address IDs before attempting deletion
2. Remove the cascade delete from address to order, as this is an aggressive constraint

The latter change is open for discussion, but cascading deletes from a child entity to a parent is slightly off IMO. Let me know your thoughts.

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


---

> [!NOTE]
> Strengthens order deletion to avoid unintended cascades and validates behavior with tests.
> 
> - Update FK constraints in migration to `ON DELETE SET NULL` for `order.shipping_address_id` and `order.billing_address_id` (was `CASCADE`)
> - In `order-module-service.ts` `deleteOrders`, filter falsy address IDs and conditionally batch-delete `order_address`/`order_change` via `promiseAll`
> - Add integration tests `integration-tests/__tests__/delete-order.spec.ts` covering deletion of orders and associated entities, deleting orders without addresses (no cross-order impact), and address deletion setting `NULL` on the order
> - Add changeset marking `@medusajs/order` patch
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8e4ab59af407ec865f73fbf286ec93e710915c8e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2026-01-02 10:16:29 +00:00
Pedro Guzman
001923da2b feat: add Medusa Cloud OAuth provider (#14395)
* feat: add Medusa Cloud OAuth provider

* add Cloud login button

* fetch whether cloud auth is enabled through api

* allow unregistered to get session

* handle existing users

* address PR comments

* prevent double execution

* a few more fixes

* fix callback url

* fix spelling

* refresh session

* 200 instead of 201

* only allow cloud identities to create user

* fix condition
2025-12-30 17:30:10 +01:00
Shahed Nasser
4ac7b72d10 fix(dashboard): fix customer details page crashing when their order is refunded (#14413)
1. Fix the customer details page crashing when a customer's order is fully refunded. The error was originating from the payment collections of the order not being retrieved, since they're being used to calculate the refunded total.
2. Other: fix country not showing as well due to incorrectly trying to retrieving and access the shipping address's country

Closes #14409
2025-12-29 09:38:21 +00:00
Shahed Nasser
89a0adc612 fix(types): add missing completed_at property for carts (#14412) 2025-12-29 11:08:37 +02:00
Carlos R. L. Rodrigues
d347e369ce fix(medusa,framework): HMR file watch (#14390) 2025-12-27 15:52:38 +01:00
Nicolas Gorga
caa561badf feat(dashboard): Add first and last name inputs to update order shipping and billing address forms (#14394)
* Add first_name and last_name to order edit addresses forms

* Add changeset
2025-12-27 15:49:50 +01:00
Shahed Nasser
6380c1fdf4 fix(medusa): allow passing null to cart API routes (#14381)
Allow passing `null` as the locale for cart API route, as `optional` only allow passing `undefined`.
2025-12-22 08:51:01 +00:00
Adrien de Peretti
b21a599d11 feat(): Translation settings + user configuration + admin hook and js sdk + dashboard (#14355)
* feat(): Translation settings + user configuration

* feat(): Translation settings + user configuration

* Create gentle-bees-grow.md

* add entities end point

* add entities end point

* add admin hook and js sdk method

* update changeset

* fix tests

* fix tests

* rm unnecessary copy

* update dashboard to use the new resources

* update dashboard to use the new resources

* update dashboard to use the new resources

* allow type inference through interface augmentation in the defineConfig of medusa-config

* allow type inference through interface augmentation in the defineConfig of medusa-config

* exclude id and _id props

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-19 15:29:48 +01:00
Shahed Nasser
365468d3da chore: fix TSDocs of total fields to be accurate (#14367) 2025-12-19 15:16:55 +02:00
Irakli
1c89acc536 feat: added ka-GE to the default list of locales (#14364) 2025-12-19 12:48:57 +01:00
Adrien de Peretti
ee8d7221da Revert "add generated .medusa/types to local plugins (#13777)" (#14361)
This reverts commit 125694626e.
2025-12-19 11:10:38 +01:00
Adrien de Peretti
181d5fa671 feat(): Auto generated types generation upon build (#14337)
* feat(): Auto generated types generation upon build

* Create happy-steaks-cheer.md

* test(): default types true

* improvements

* improvements

* improvements

* improvements

* improvements
2025-12-19 10:13:17 +01:00
Leonardo Benini
125694626e add generated .medusa/types to local plugins (#13777)
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-12-19 07:01:15 +01:00
Adrien de Peretti
fb6a6b52fa fix(order): Prevent fetching all db adjustments when no items are pre… (#14351)
* fix(order): Prevent fetching all db adjustments when no items are present

* Create funny-suns-think.md
2025-12-18 15:21:32 +01:00
0xFl4g
0277062fec fix(translation): prevent duplicate locale error on server restart (#14345)
The translation module's defaults loader throws a warning on every server
restart after the first run because the upsert method uses `id` as the
unique key, but defaultLocales only contains `code` and `name`.

This causes the upsert to always attempt creation, which fails on the
unique `code` constraint with: "Locale with code: en-US, already exists."

Fix: Fetch existing locales first and map their IDs into defaultLocales
so upsert can properly identify existing records and update them.
2025-12-18 11:56:18 +01:00
Shahed Nasser
92d240d749 fix(medusa): fix type of product variant request param (#14342)
Fix type argument for requests which is necessary for generating OpenAPI specs

## Why

The `StoreVariantListRequest` type used in the `/store/product-variants` route doesn't match the convention of other routes since it doesn't accept a type parameter for the query (or body, but here that's not necessary). This makes it difficult for us to infer the query parameter type of the request.

This change would adapt the `StoreVariantListRequest` to match other conventions in our API routes so that we can generate correct OAS for docs
2025-12-17 16:20:54 +00:00