v2.4.0
medusajs/medusav2.4.0Jan 27, 2025by olivermrbl
AI Summary
This release introduces Plugins, a new DataTable component, and upgrades MikroORM from v5 to v6.
Key Highlights
- Introduction of Plugins as customizable npm packages.
- Upgrade of MikroORM to v6.
- New DataTable component added to UI library.
- New translations added to Admin (Macedonian, Romanian, Chinese, etc.).
- One-to-one relations now generate unique indexes instead of unique constraints.
New Features
- Add DataTable block
- Add support for creating payment methods to payment module
- Refactor Users table to use the new DataTable block
- Product type & tag store missing endpoints
Full Release Notes
<!--

# v2.4.0
This release introduces Plugins and a DataTable component, as well as upgrades MikroORM from v5 to v6.
CMS_BREAK -->
## Highlights
### Plugins
This release introduces Plugins. Plugins are customizations distributed as npm packages. A plugin can do everything a regular Medusa application can, including defining HTTP routes and workflows, registering subscribers, exporting custom modules, or defining links between modules.
Read our [documentation on Plugins](https://docs.medusajs.com/learn/fundamentals/plugins) to learn more.
### MikroORM V6 upgrade
This release marks the completion of the migration of all core modules to the Data Model API. As part of this effort, we’ve upgraded our MikroORM dependency from V5 to V6, as V5 has entered maintenance mode. You can read more about the upgrade [here](https://mikro-orm.io/docs/upgrading-v5-to-v6).
While this upgrade introduced breaking changes, none of them will impact user projects directly. The only required action is upgrading the MikroORM dependencies in your project.
**Required actions**
Upgrade the following dependencies in your `package.json` alongside your Medusa packages:
```diff
"dependencies": {
- "@mikro-orm/core": "5.9.7",
- "@mikro-orm/knex": "5.9.7",
- "@mikro-orm/migrations": "5.9.7",
- "@mikro-orm/postgresql": "5.9.7",
+ "@mikro-orm/core": "6.4.3",
+ "@mikro-orm/knex": "6.4.3",
+ "@mikro-orm/migrations": "6.4.3",
+ "@mikro-orm/postgresql": "6.4.3",
...
"devDependencies": {
- "@mikro-orm/cli": "5.9.7",
+ "@mikro-orm/cli": "6.4.3",
...
```
Update your lock-file by installing the dependencies:
```bash
npm install // use your preferred package manager
```
### DataTable component
This release adds an opinionated DataTable component to `@medusajs/ui`. The DataTable component is an opinionated implementation of our [Table](https://docs.medusajs.com/ui/components/table) component and `@tanstack/react-table`. It simplifies the setup of tables with advanced features such as pagination, sorting, filtering, row selection, and commands.
Read more about the DataTable and learn how to set it up [in our documentation](https://docs.medusajs.com/ui/components/data-table).
### New translations added to Admin
This release adds Macedonian, Romanian, Chinese, Persian, Czech, Arabic, and Mongolian to supported languages in Medusa Admin.
### Change in behavior of one-to-one relation
This release updates the generated SQL of the one-to-one relation in our Data Model API. Until now, defining a one-to-one relation would generate a unique constraint. Unique constraints do not account for soft-deleted rows, so new rows with the same foreign key as a previously deleted row cannot be inserted. With this release, one-to-one relations will generate a unique index instead to ensure that the uniqueness is only enforced on non-deleted rows.
## Features
* feat(ui,dashboard): Add DataTable block by @kasperkristensen in https://github.com/medusajs/medusa/pull/10024
* feat: Add translations for Macedonian by @sradevski in https://github.com/medusajs/medusa/pull/11039
* feat: Add support for creating payment methods to payment module by @sradevski in https://github.com/medusajs/medusa/pull/11063
* feat(dashboard): Refactor Users table to use the new DataTable block by @kasperkristensen in https://github.com/medusajs/medusa/pull/11058
* feat(medusa,product,types): product type & tag store missing endpoints by @fPolic in https://github.com/medusajs/medusa/pull/11057
## Bugs
* fix(medusa): use correct request and response types for batch location levels route by @shahednasser in https://github.com/medusajs/medusa/pull/11055
* fix(dashboard,js-sdk,types): Remove redundant body for markAsDelivered by @kasperkristensen in https://github.com/medusajs/medusa/pull/10964
* fix(framework): migration scripts regexp by @adrien2p in https://github.com/medusajs/medusa/pull/11072
* fix(create-medusa-app): fix database name from input not used in setup by @shahednasser in https://github.com/medusajs/medusa/pull/11071
* fix(promotion): eval conditions for rules are made accurate by @riqwan in https://github.com/medusajs/medusa/pull/10915
* fix(event): Subscriber ID miss usage by @adrien2p in https://github.com/medusajs/medusa/pull/11047
* fix: Unique constraint should account for soft deleted records by @adrien2p in https://github.com/medusajs/medusa/pull/11048
* fix(dashboard): Use date util to properly format date in order details view by @kasperkristensen in https://github.com/medusajs/medusa/pull/11073
* fix(core-flows): change some types to interfaces by @shahednasser in https://github.com/medusajs/medusa/pull/11061
* fix: Flaky behavior of Yalc by @thetutlage in https://github.com/medusajs/medusa/pull/11084
* fix(admin-bundler): Fix Vite imports to prevent deprecation warnings by @kasperkristensen in https://github.com/medusajs/medusa/pull/11086
* fix(dashboard): Persist variant_rank by @kasperkristensen in https://github.com/medusajs/medusa/pull/11074
* fix(ui): Fix position of Checkbox indicator by @kasperkristensen in https://github.com/medusajs/medusa/pull/11075
* fix(dashboard): Add global errorElement by @kasperkristensen in https://github.com/medusajs/medusa/pull/10981
* fix: Medusa package version should use ~ instead of ^ by @adrien2p in https://github.com/medusajs/medusa/pull/11077
* fix(fulfillment): migration so rules by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/11109
* fix(fulfillment): migration so rules by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/11113
* fix: switch from tsc watch to chokidar by @thetutlage in https://github.com/medusajs/medusa/pull/11110
* fix(admin-bundler): Optimize tanstack/react-query by @kasperkristensen in https://github.com/medusajs/medusa/pull/11112
* fix(dashboard): Format i18n schema with Prettier by @kasperkristensen in https://github.com/medusajs/medusa/pull/11107
* fix(core-flows, dashboard): handling fulfillment rules by @fPolic in https://github.com/medusajs/medusa/pull/11111
* fix(medusa,cli): Resources not correctly loaded when running the migration scripts by @adrien2p in https://github.com/medusajs/medusa/pull/11108
## Documentation
* docs: add search to workflows reference by @shahednasser in https://github.com/medusajs/medusa/pull/11054
* docs: fixes for core workflows reference by @shahednasser in https://github.com/medusajs/medusa/pull/11056
* docs: fix types with arguments not showing correct properties by @shahednasser in https://github.com/medusajs/medusa/pull/11062
* chore(order): dml by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/10292
* docs: added note in API reference clarifying what schemas are by @shahednasser in https://github.com/medusajs/medusa/pull/11116
* docs: update list of routes accepting additional data by @shahednasser in https://github.com/medusajs/medusa/pull/11119
* docs: add a note about installing tanstack query as a dev dependency by @shahednasser in https://github.com/medusajs/medusa/pull/11123
* docs-util: fix incorrect workflow extracted in OAS by @shahednasser in https://github.com/medusajs/medusa/pull/11120
* docs: clarify condition / variable manipulation restriction for workflows and steps by @shahednasser in https://github.com/medusajs/medusa/pull/11125
* typo by @devduttabain in https://github.com/medusajs/medusa/pull/11128
* docs: document workflow retention by @shahednasser in https://github.com/medusajs/medusa/pull/11138
* docs: add troubleshooting for cloudflare s3 by @shahednasser in https://github.com/medusajs/medusa/pull/11143
* docs: fix sidebar items not showing if they have same title in API reference by @shahednasser in https://github.com/medusajs/medusa/pull/11122
* docs: generate sidebar for main docs by @shahednasser in https://github.com/medusajs/medusa/pull/11139
* docs: fix current sidebar not found by @shahednasser in https://github.com/medusajs/medusa/pull/11155
## Chores
* chore(ui): add tsdocs for DataTable components by @shahednasser in https://github.com/medusajs/medusa/pull/11087
* chore(utils): patch unique index migration by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/11136
## Other Changes
* docs: how to add new admin route under existing route by @eugenepro2 in https://github.com/medusajs/medusa/pull/10652
* fix(dashboard): create sales channel toast type by @Avia-Code in https://github.com/medusajs/medusa/pull/11019
* feat: Add translations for Mongolian by @sanchir2011 in https://github.com/medusajs/medusa/pull/11085
* refactor(ui-preset): replace defaultTheme import by @pnodet in https://github.com/medusajs/medusa/pull/11041
* add support to arabic by @gharbi-mohamed-dev in https://github.com/medusajs/medusa/pull/11088
* Add Romanian translation by @python27tt in https://github.com/medusajs/medusa/pull/10890
* feat: add translation for zh-CN by @leosin in https://github.com/medusajs/medusa/pull/10757
* Add Persian (fa) translations for the admin dashboard by @behrouz-shafaati in https://github.com/medusajs/medusa/pull/11091
* feat: add Czech language translation by @TomasKliner in https://github.com/medusajs/medusa/pull/11127
* product categories hooks by @noubase in https://github.com/medusajs/medusa/pull/11093
## New Contributors
* @sanchir2011 made their first contribution in https://github.com/medusajs/medusa/pull/11085
* @pnodet made their first contribution in https://github.com/medusajs/medusa/pull/11041
* @python27tt made their first contribution in https://github.com/medusajs/medusa/pull/10890
* @leosin made their first contribution in https://github.com/medusajs/medusa/pull/10757
* @behrouz-shafaati made their first contribution in https://github.com/medusajs/medusa/pull/11091
* @devduttabain made their first contribution in https://github.com/medusajs/medusa/pull/11128
* @TomasKliner made their first contribution in https://github.com/medusajs/medusa/pull/11127
* @noubase made their first contribution in https://github.com/medusajs/medusa/pull/11093
**Full Changelog**: https://github.com/medusajs/medusa/compare/v2.3.1...v2.4.0