Commit Graph
9044 Commits
Author SHA1 Message Date
8a996a82a7 docs(): Add local development instructions in CONTRIBUTING.md (#13651)
* Add local development instructions in CONTRIBUTING.md

* Changes suggested by Shahed

* Update CONTRIBUTING.md

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Update CONTRIBUTING.md

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Update CONTRIBUTING.md

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

---------

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-10-03 11:01:13 -04:00
Nicolas GorgaandGitHub 40e396d5c3 docs(resources): Improve third party login (#13606)
* Remove harcoded email in create user payload, use user_metadata instead to resolve the field

* Execute prep command on book and resources projects

* Improve user_metadata comment as per Shahed's suggestion
2025-10-03 10:47:28 -04:00
Shahed NasserandGitHub 74fcc367c0 docs: add guide on storefront production optimization tips (#13682)
* docs: add guide on storefront production optimization tips

* add vale exception
2025-10-03 17:24:10 +03:00
Shahed NasserandGitHub ad46a86a8f docs: fix error when translating page (#13681) 2025-10-03 16:03:33 +03:00
Shahed NasserandGitHub fcb977a989 docs: remove mention of base64 requirement for api keys (#13679) 2025-10-03 14:10:16 +03:00
Shahed NasserandGitHub dd4b3315f3 docs: added refund details related to transactions (#13677) 2025-10-03 14:09:59 +03:00
Shahed NasserandGitHub a4757d462d docs: fixes to github solutions componen (#13676)
* docs: fixes to github solutions componen

* remove octokit dependency
2025-10-03 14:09:43 +03:00
Shahed NasserandGitHub 6ea97443de docs: improved analytics and tracking (#13671)
* docs: improved analytics and tracking

* remove detailed feedback component

* remove ignore build script for api reference

* improvements

* fix pathname
2025-10-03 13:33:48 +03:00
Shahed NasserandGitHub 50c1417378 docs: improve troubleshooting guide for pnpm (#13673)
* docs: improve troubleshooting guide for pnpm

* added pnpm link to installation guide
2025-10-03 13:09:01 +03:00
Adrien de PerettiandGitHub d58462c9c9 chore(): Caching improvements (#13660)
* chore(): Caching improvements

* Create proud-windows-sleep.md

* naming

* fix tests

* address feedback
2025-10-03 10:05:44 +02:00
Shahed NasserandGitHub 1789f3e257 docs: agentic commerce guide (#13657) 2025-10-03 08:54:39 +03:00
Shahed NasserandGitHub d29c2abbba docs: fix cursor MCP link (#13664)
* docs: fix cursor MCP link

* fix error

* fix vale error
2025-10-03 08:54:12 +03:00
Nicolas GorgaandGitHub 907fbc89a2 feat(medusa): include user_metadata in auth routes jwt (#13597)
**What**

Return provider specific user_metadata in jwt token returned by auth/[actor_type]/[auth_provider] routes.

**Why**

When implementing thrid party auth flows, to create the Medusa entity representing the actor type, you will need information obtained from the callback after the user consents. For google for example, you need the email, which so far is stored in the provider user_metadata property but is never returned in the http response.

This causes one to circumvent around this issue by creating an additional http route which gets the auth_identity from the auth_context object, to access the providers array and then look for the specific element matching the current auth_provider route.

**How**

Pass the auth_provider obtained from the route path param and pass it down to `generateJwtTokenForAuthIdentity` and inside it, find the provider matching the auth provider passed from route handler inside the auth identity `provider_identities` property. If found, assign its `user_metadata` value to the property of the same name in the payload of the token to be generated.

Now the user has the user_metadata property included in the obtained token and can use it's information to create the corresponding Medusa entity for the actor type in context. In the case of google and customer actor type, they would use `user_metadata.email` to call the create customer api endpoint.

**Testing**

Haven't found anywhere in the codebase where the http layer of /auth functionality is tested, but tested locally with debugger and test storefront to guarantee the user_metadata is returned as expected, all working correctly.

Fixes #13584 
CLOSES CORE-437 


---

> [!NOTE]
> Propagates auth provider to JWT generation and embeds provider-specific user_metadata in tokens returned by auth routes.
> 
> - **Auth JWT Payload**:
>   - `generateJwtTokenForAuthIdentity` now accepts optional `authProvider` and injects matching provider `user_metadata` into JWT payload.
> - **Auth Routes** (`auth/[actor_type]/[auth_provider]/*`):
>   - Pass `authProvider` from route params to JWT generator in `authenticate`, `register`, and `callback` handlers.
> - **Release**:
>   - Changeset adds patch for `@medusajs/medusa`.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4833faf84533ce7438bc37c15bd572f991988e69. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 18:21:50 +00:00
Shahed NasserandGitHub 4717ad9a59 docs: document preview limits in Cloud + general updates (#13661) 2025-10-02 19:17:50 +03:00
Adrien de PerettiandGitHub 8734866eb1 fix(): Transform map (#13655)
**What**
It seems that for some reason the weak map fail in some scenario, but after investigation, the usage of map would not have a bad impact as it will be released after the Distributed transaction if finished. Therefore, falling back to Map instead

FIXES https://github.com/medusajs/medusa/issues/13654

NOTE: Waiting for the user feedback as he is also using node 18. We also use the exact same pattern in all our core flows without issues 🤔
2025-10-02 15:54:11 +00:00
Leonardo BeniniandGitHub ea3d0100a9 feat(admin-bundler): forward env vars to plugin admin extensions (#13634)
* forward plugin envs

* mock process.env

* remove normalizedName

* strip prefix
2025-10-02 16:19:13 +02:00
Adrien de PerettiandGitHub 76aa4a48b3 fix(): workflows concurrency (#13645) 2025-10-02 11:11:38 -03:00
Nicolas GorgaandGitHub ca334b7cc1 fix(inventory): delete reservation item inventory level required quantity (#13633)
Fixes #13625


---

> [!NOTE]
> Ensure `reserved_quantity` is adjusted when deleting reservation items via `deleteReservationItems`, with new integration tests covering deletion and inventory updates.
> 
> - **Inventory Module Service (`packages/modules/inventory/src/services/inventory-module.ts`)**:
>   - Add `deleteReservationItems` API (and transactional `_` variant) that hard-deletes reservations, then updates related inventory levels via `adjustInventoryLevelsForReservationsDeletion`.
>   - Wire through event emission/manager decorators consistent with existing patterns.
> - **Integration Tests (`packages/modules/inventory/integration-tests/__tests__/inventory-module-service.spec.ts`)**:
>   - Add tests for `deleteReservationItems` to verify deletion by id and `reserved_quantity` adjustments on inventory levels.
>   - Minor import update to include `ReservationItemDTO`.
> - **Changeset**:
>   - Patch release note for `@medusajs/inventory` documenting the fix.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ac6641a9ec9543115504407f708f81bd427c3444. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 12:59:13 +00:00
Leonardo BeniniandGitHub 9c957e1da0 chore(core-flows): only allow published products in addToCartWorkflow (#13182)
Closes #13163 

I have a few questions about expected behaviour, since this currently breaks some tests:

- Many tests use the productModule to create products, with default status == "draft", and use the addToCart workflow which now throws. Should I change all breaking tests to specify status == "published" whne creating the product? The alternative would be to check the status in the store API route before the workflow but 1. it would be an extra query and 2. the addToCart workflow is only used in the store currently, and even if it was to be used admin-side, it still doesn't make sense to add a draft product to cart

- After this PR an unpublished product would give the same error as a variant that doesn't exist. While imho this is correct, the thrown error (for both) is "Items  do not have a price" which doesn't make much sense(i believe the workflows goes through with an empty variants list and then errors at the price check point). Should I throw a different error when a variant doesn't exists/isn't published?


---

> [!NOTE]
> Enforces that only variants from published products can be added to carts, adds status fetching, refines errors, and updates tests to use ProductStatus.PUBLISHED.
> 
> - **Core Flows**:
>   - addToCart: Validate variants exist and belong to `product.status = PUBLISHED`; throw clear `INVALID_DATA` when not found/unpublished.
>   - Data fetching: Include `product.status` in `cart` and `order` variant field selections.
> - **Tests/Fixtures**:
>   - Update integration tests to set `status: ProductStatus.PUBLISHED` when creating products and import `ProductStatus` where needed.
>   - Add cases for unpublished products and non-existent variants producing the new error message.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ca72532e957964d2d8e6bcecbb0905054c677ded. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 12:31:53 +00:00
William BouchardandGitHub bb08edd41f fix(medusa,file-local,file-s3,core-flows): fix csv parsing special characters (#13649)
* fix(): fix csv parsing special characters

* remove other tries

* tweak

* remove comments

* Create rude-mirrors-hang.md
2025-10-02 08:24:18 -04:00
Leonardo BeniniandGitHub 5c77b10fa6 fix(medusa): plugin:db:generate skip modules with no data models (#13652)
Currently the plugin:db:generate command panics if one of the modules doesn't define any data models. This makes it impossible to generate migrations if you have a mix of modules with and without data models.   
I added a simple check to skip these modules when creating the migrations.

Steps to repro:
```
npx create-medusa-app --plugin
cd my-medusa-plugin
# create a module with an empty service and no data models
npx medusa db:plugin:generate
```

Full error:
```
info:    Generating migrations...
info:    Generating migrations for module postmarkModuleService...
info:    ----------------------------------------------------------------------------
error:   defineMikroOrmCliConfig failed with: entities is required
Error: defineMikroOrmCliConfig failed with: entities is required
    at defineMikroOrmCliConfig (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/utils/src/modules-sdk/mikro-orm-cli-config-builder.ts:41:11)
    at generateMigrations (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/medusa/src/commands/plugin/db/generate.ts:124:26)
    at main (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/medusa/src/commands/plugin/db/generate.ts:49:11)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
```

I didnt bother with writing an issue since I had the fix ready and it's very small, but lmk if I should in the future
2025-10-02 12:05:40 +00:00
Adrien de PerettiandGitHub 8fb7e04be7 fix(): Fulfillment custom schema error on provider (#13656) 2025-10-02 14:01:54 +02:00
Riqwan ThamirandGitHub 71014bafa6 fix(medusa): fixes db setup command to not load connection before creating db (#13653) 2025-10-02 13:49:22 +02:00
Shahed NasserandGitHub 762cd445e0 docs: setup PostHog (#13659) 2025-10-02 14:45:10 +03:00
Shahed NasserandGitHub be651dd708 docs: fix typo in product feed guide (#13658) 2025-10-02 14:17:50 +03:00
9361f9c25a fix(index): preserve existing fields configuration (#13639) (#13640)
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-10-02 11:53:56 +02:00
Adrien de PerettiandGitHub 02b6d01382 chore(): Add instrumentation to deps (#13646)
* chore(): Add instrumentation to deps

* deps

* Create two-bikes-compare.md
2025-10-02 11:29:26 +02:00
Nicklas GellnerandGitHub 0aad694e64 docs: update costs description (#13647) 2025-10-01 17:43:59 +03:00
Shahed NasserandGitHub d1bbd8a7c1 docs: fix typo (#13643) 2025-10-01 17:41:18 +03:00
Shahed NasserandGitHub 01ac822e6b docs: update Cloud sign up link (#13648) 2025-10-01 17:29:17 +03:00
Shahed NasserandGitHub 30215e7292 docs: fix details about maximum quantity for promotions (#13642) 2025-10-01 13:37:28 +03:00
Shahed NasserandGitHub 05af008911 docs: add details about updating index module's data source (#13637)
* docs: add details about updating index module's data source

* small change
2025-10-01 10:26:11 +03:00
William BouchardandGitHub d30806533c fix(dashboard): create refund form broken when no payment id defined (#13631)
* fix(dashboard): create refund form broken when no payment id defined

* Create funny-donuts-destroy.md
2025-09-30 13:17:43 -04:00
b9d6f73320 Feat(): distributed caching (#13435)
RESOLVES CORE-1153

**What**
- This pr mainly lay the foundation the caching layer. It comes with a modules (built in memory cache) and a redis provider.
- Apply caching to few touch point to test

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-30 16:19:06 +00:00
Adrien de PerettiandGitHub 5b135a41fe fix(): workflow engine migration issue (#13629)
**What**
The extension creation have been pushed by mistake
2025-09-30 15:41:09 +00:00
Shahed NasserandGitHub 0c7cbfb2e7 feat(payment-stripe): Allow passing shared payment token in Stripe (#13632)
* feat(@medusajs/payment-stripe): Allow passing shared payment token in Stripe

* fix changeset
2025-09-30 18:40:36 +03:00
Shahed NasserandGitHub a1dd2de0de docs: general changes to Cloud docs (#13616)
* docs: document self serve

* docs: Cloud docs changes

* vale fixes

* vale error fix

* fixes

* added new sections

* generate
2025-09-30 18:37:04 +03:00
Adrien de PerettiandGitHub 70d855bd1b fix(): Module test runner lifecycle does not shutdown properly (#13628)
* fix(): Module test runner lifecycle does not shutdown properly

* Create late-feet-think.md
2025-09-30 17:06:05 +02:00
Adrien de PerettiandGitHub 9c7c1d48c7 fix(): Pricing preference context loss (#13626)
**What**
The context reference is being mutated by the repository leading to an empty context. Also, the filter is built from the pricing context instead of pricing context -> context leading to always fetch all preferences all the time
2025-09-30 12:38:04 +00:00
William BouchardandGitHub 087887fefb feat(core-flows): support ad hoc returns (#13598)
* feat(core-flows): support ad hoc returns

* fix: missing transform

* handle edge case

* refactor

* replace gte for gt

* cleanup

* weird bug fix

* add test

* Create quick-nails-kick.md

* stop sending empty strings

* add code to refund reason

* fix build

* fix tests

* handle code in dashboard

* fix tests

* more tests failing

* add reference and reference id to credit lieng

* rework create refund form
2025-09-30 07:38:50 -04:00
Shahed NasserandGitHub bd9ecd5e66 docs: updates to custom columns and build guides (#13624) 2025-09-30 10:01:58 +03:00
William BouchardandGitHub 9d3c71fefd fix(medusa): cart now returns 404 when not found (#13622)
FIXES #10218 
FIXES CORE-739
2025-09-30 06:49:17 +00:00
Shahed NasserandGitHub f970e1355a docs: general updates and fixes (#13620) 2025-09-30 08:45:30 +03:00
Shahed NasserandGitHub dda756dfaa docs: fix search not highlighting subheaders (#13619) 2025-09-29 15:24:39 +03:00
Shahed NasserandGitHub 4bbec480a9 docs: fix mobile menu not closing when clicking a link (#13618) 2025-09-29 15:23:50 +03:00
Shahed NasserandGitHub 97cc8fdc15 docs: fix pricing page on small devices (#13617) 2025-09-29 15:22:22 +03:00
Shahed NasserandGitHub da411e351a add missing generated files (#13609) 2025-09-29 09:46:18 +03:00
William BouchardandGitHub 5346079d47 chore(): create default refund reasons (#13591)
* chore(): create default refund reasons

* Create great-donuts-swim.md

* woops

* woopsie

* woopsie

* tests

* tests

* woopsie

* fml

* fix: comment
2025-09-28 10:07:48 +02:00
Carlos R. L. RodriguesandGitHub 9d8ed70130 feat(cli): servers and workers in cluster mode (#13601)
* feat(cli): servers and workers in cluster mode

* allow percentage
2025-09-28 10:06:18 +02:00
Shahed NasserandGitHub cbfe0a4e95 docs: improve docs contribution guidelines (#13605)
* docs: improve docs contribution guidelines

* fix build error

* fix build errors

* fix build

* fix build
2025-09-26 16:18:35 +03:00