Commit Graph

1124 Commits

Author SHA1 Message Date
Frane Polić
95e89a39f3 feat(core-flows, types): try payment cancelation if cart complete fails in the webhook (#11832)
* fix: try compensating if cart complete fails, reorder process paymnet workflow steps

* fix: condition

* fix: feedback

* feat: changes to the compensation step

* fix: build

* fix: remove payment id as arg

* fix: when input

* chore: remove captures realtion, changeset

* fix: return lates payment object from authorize payment
2025-03-28 14:49:54 +01:00
Kasper Fabricius Kristensen
3dba58785f fix(dashboard,medusa,types): allow searching for promotion rule options (#12028)
* fix: allow searching for promotion rule options

* fix: allow searching for promotion rule options

* add changeset

* cleanup
2025-03-28 14:45:05 +01:00
Harminder Virk
b1b3b48474 feat: Set pricing context hook (#11891) 2025-03-28 15:17:52 +05:30
Riqwan Thamir
c870a7a1ba fix(utils,promotion): fix case where mutliple percentage promotions werent applied (#11992)
what:

- fix case where mutliple percentage promotions werent applied
2025-03-26 22:46:50 +00:00
Riqwan Thamir
1f8fab3636 feat(core-flows,types,order,cart): assign tax lines only to regular products (#11994)
what:

- assign tax lines only to regular products
2025-03-26 22:26:34 +00:00
Shahed Nasser
0cc306bf56 fix(js-sdk, types): fixes types and deprecate duplicate methods (#11975) 2025-03-25 16:37:30 +01:00
Carlos R. L. Rodrigues
01089d5bc8 chore(core-flows): price list skip when no data (#11977) 2025-03-25 10:55:30 -03:00
Shahed Nasser
768ea91e1b chore(js-sdk,types): add missing examples for JS SDK methods (#11934)
* chore(js-sdk,types): add TSDocs for calculate method

* added tsdocs for promotions

* finished adding examples

* fixes

* remove unused import
2025-03-25 14:55:54 +02:00
Shahed Nasser
c6f2f444ed fix(js-sdk): fix the return type of the promotion.listRules method (#11937) 2025-03-24 07:35:15 +01:00
Frane Polić
de8c034d1b feat(core-flows, types): calculated shipping in RMA flows (#11533)
* wip: calculated SO pricing in RMA flows

* fix: types

* chore: small refactor

* feat: caluclated shipping in return flow

* fix: module integrations

* fix: array containing

* feat: refresh shipping on update item quantity

* rm: log

* rm: log2

* feat: update interface, remove flag

* fix: revert change on OE for now

* fix: import

* feat: refactor flwos, cleanup cacluation cotext data model, wip exchanges

* feat: refreshing inbound/outbound shipping on items change

* feat: refresh exchange shipping on return item add, test

* feat: refresh shipping on exchange/return item remove

* fix: check optional

* feat: test recalculation on quantity update

* feat: calculated shipping on claims

* fix: comment

* wip: address comments

* fix: more remote query, fix build

* refactor: claim refresh workflow

* fix: remove throw option

* fix: deconstruct param

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-03-24 07:07:47 +01:00
Shahed Nasser
053326950d fix(js-sdk): fix the API route used in fulfillment.cancel method (#11936) 2025-03-21 15:08:44 +00:00
Harminder Virk
cab6f3a8ad feat: add support for accessing step results via context (#11907)
Fixes: FRMW-2934

This PR adds support for accessing the results of a hook using the `hook.getResult` method.
2025-03-21 10:15:38 +00:00
Stevche Radevski
c4f75ecbb2 feat: Add support for generating a cloud-ready config out of the box (#11850) 2025-03-21 09:21:38 +01:00
Frane Polić
8385a5e34d feat(core-flows): revisit fulfillment flow reservations and support inventory kit (#11790)
* feat: fulfillment flow with reservations and inventory kit

* fix: account for custom line items

* chore: cleanup, changeset

* fix: revert action check

* fix: deduplicate, test item qunatities, compute line item quantity from fulfillment items

* fix:

* fix: improve types

* fix: optimize fetched fileds in cancel fulfillment workflow

* fix: add a test case

* chore: update type
2025-03-19 13:15:24 +01:00
Harminder Virk
ff3885500c fix: hooks auto-generated types to have precise input options (#11886) 2025-03-18 15:41:01 +05:30
Shahed Nasser
0099c1e2e9 chore: added / improved tsdocs to cache, event, file, and notification modules (#11879)
* chore: added / improved tsdocs to cache, event, file, and notification modules

* small fixes
2025-03-18 09:07:32 +02:00
Riqwan Thamir
c3440e5e38 feat(medusa,types): add enabled plugins route (#11876) 2025-03-17 20:11:46 +01:00
Riqwan Thamir
9dd62d93bd feat(core-flows,types,utils): make payment optional when cart balance is 0 (#11872)
what:

- make payment optional when cart balance is 0
2025-03-17 19:03:22 +00:00
Riqwan Thamir
5ab15a2988 feat(dashboard,js-sdk,admin-shared): add customer addresses + layout change (#11871)
what:

- changes customer layout from 1 layout to 2
- adds ability to create and delete customer addresses
- adds 2 customer widget locations
- adds is_giftcard=false by default to products list

<img width="1663" alt="Screenshot 2025-03-08 at 21 34 02" src="https://github.com/user-attachments/assets/e66f05da-718c-4c25-81ce-67ba0a814ca3" />
2025-03-17 16:16:27 +00:00
Riqwan Thamir
cb6249320e fix(types,order,medusa): Create credit lines + hooks (#11569)
what:

- api/workflows to create credit lines
- hooks to enable extending credit lines
2025-03-17 15:20:59 +00:00
Carlos R. L. Rodrigues
0625f76cd4 chore(workflow-engine): export cancel method (#11844)
What:
  * Workflow engine exports the method `cancel` to revert a workflow.
2025-03-17 12:59:09 +00:00
Harminder Virk
cae47d9e49 feat: add check for uniqueness when creating links with isList=false (#11767) 2025-03-17 13:23:18 +05:30
OttavioCas
5e892e2f05 add no_notification to shipment created event (#11836) 2025-03-14 13:05:14 -03:00
Adrien de Peretti
fc652ea51e fix(workflow-engine-*): scheduled jobs interval (#11800)
**What**
Currently only cron pattern are supported by scheduled jobs, this can lead to issue. for example you set the pattern to execute every hours at minute 0 and second 0 (as it is expected to execute at exactly this constraint) but due to the moment it gets executed we our out of the second 0 then the job wont get executed until the next scheduled cron table execution.

With this pr we introduce the `interval` configuration which allows you the specify a delay between execution in ms (e.g every minute -> 60 * 1000 ms) which ensure that once a job is executed another one is scheduled for a minute later.

**Usage**
```ts
// jobs/job-1.ts
const thirtySeconds = 30 * 1000

export const config = {
  name: "job-1",
  schedule: {
    interval: thirtySeconds
  },
}
```
2025-03-13 15:05:13 +00:00
Stevche Radevski
e0109540fa feat: Change customer to account_holder to be one-to-many (#11803) 2025-03-12 16:05:38 +01:00
Shahed Nasser
76a0d8e1d8 chore(types): small fixes to locking TSDocs (#11823)
* chore(types): small fixes to locking TSDocs

* add missing return
2025-03-12 16:31:07 +02:00
Adrien de Peretti
72d2cf9207 fix(workflow-engines): race condition when retry interval is used (#11771) 2025-03-12 09:53:34 -03:00
Shahed Nasser
bed8918c31 chore(types): add tsdocs for locking module and provider (#11818) 2025-03-12 10:45:29 +02:00
Harminder Virk
375c4a5ab1 refactor: use module name as the snapshot name (#11802)
Fixes: FRMW-2930

This PR updates the MikroORM config to use the module name as the snapshot name when generating migration files. Otherwise, MikroORM defaults to the database name and every time you update the database name, it will create a new snapshot. 

Also, we migrate existing snapshot files to be same the new file name to avoid breaking changes.
2025-03-12 07:02:19 +00:00
Kasper Fabricius Kristensen
ec56a8bc85 fix(medusa,utils,test-utils,types,framework,dashboard,admin-vite-plugin,admin-bundler): Fix broken plugin dependencies in development server (#11720)
**What**
- Reworks how admin extensions are loaded from plugins.
- Reworks how extensions are managed internally in the dashboard project.

**Why**
- Previously we loaded extensions from plugins the same way we do for extension found in a users application. This being scanning the source code for possible extensions in `.medusa/server/src/admin`, and including any extensions that were discovered in the final virtual modules.
- This was causing issues with how Vite optimizes dependencies, and would lead to CJS/ESM issues. Not sure of the exact cause of this, but the issue was pinpointed to Vite not being able to register correctly which dependencies to optimize when they were loaded through the virtual module from a plugin in `node_modules`.

**What changed**
- To circumvent the above issue we have changed to a different strategy for loading extensions from plugins. The changes are the following:
  - We now build plugins slightly different, if a plugin has admin extensions we now build those to `.medusa/server/src/admin/index.mjs` and `.medusa/server/src/admin/index.js` for a ESM and CJS build.
  - When determining how to load extensions from a source we follow these rules:
    - If the source has a `medusa-plugin-options.json` or is the root application we determine that it is a `local` extension source, and load extensions as previously through a virtual module.
    - If it has neither of the above, but has a `./admin` export in its package.json then we determine that it is a `package` extension, and we update the entry point for the dashboard to import the package and pass its extensions a long to the dashboard manager.

**Changes required by plugin authors**
- The change has no breaking changes, but requires plugin authors to update the `package.json` of their plugins to also include a `./admin` export. It should look like this:

```json
{
  "name": "@medusajs/plugin",
  "version": "0.0.1",
  "description": "A starter for Medusa plugins.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "files": [
    ".medusa/server"
  ],
  "exports": {
    "./package.json": "./package.json",
    "./workflows": "./.medusa/server/src/workflows/index.js",
    "./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
    "./modules/*": "./.medusa/server/src/modules/*/index.js",
    "./providers/*": "./.medusa/server/src/providers/*/index.js",
    "./*": "./.medusa/server/src/*.js",
    "./admin": {
      "import": "./.medusa/server/src/admin/index.mjs",
      "require": "./.medusa/server/src/admin/index.js",
      "default": "./.medusa/server/src/admin/index.js"
    }
  },
}
```
2025-03-11 11:28:33 +00:00
olivermrbl
f1cac99316 chore: Version packages 2025-03-10 15:44:09 +01:00
Frane Polić
70eaaa9196 fix(core-flows): fulfillment reservation check (#11735) 2025-03-09 13:47:10 +01:00
Carlos R. L. Rodrigues
b7678983a9 chore(cart, core-flows): Improve tax lines algo management (#11715)
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2025-03-09 12:43:18 +00:00
Stevche Radevski
4b3869ef2c fix: Add created at and updated at dates to payment session (#11774) 2025-03-07 19:58:37 +00:00
Adrien de Peretti
20cd59e622 Fix(framework): http cors middleware order and options (#11765)
FIXES SUP-1101
also fixes https://github.com/medusajs/medusa/issues/11743

**What**
The store cors is currently applied after the ensure publishable API key middleware, in this pr the order is fixed and the cors will be applied first.
2025-03-07 10:45:00 +00:00
Riqwan Thamir
f00bb8efcf fix(core-flows): conditionally create, update or delete products when input is present (#11758)
what:

- runs create / update /delete workflows for bulk workflow conditionally

FIXES https://github.com/medusajs/medusa/issues/11749
depends on https://github.com/medusajs/medusa/pull/11756
2025-03-06 13:41:20 +00:00
Adrien de Peretti
84f991192e feat(workflows-sdk): Allow when then in parallelize (#11756)
**What**
Update typings to allow using when then inside parallelize
2025-03-06 13:23:37 +00:00
Oli Juhl
3b470f4142 chore: remove ranges on medusa packages (#11738) 2025-03-06 14:17:05 +01:00
Shahed Nasser
3256a1f740 chore(js-sdk): fix tsdocs for properties and methods (#11748) 2025-03-06 09:12:05 +02:00
Adrien de Peretti
cc1309d370 chore(product): Improve product normalization and fix http router with tracing (#11724)
**What**
- Improve product normalization and prevent over fetching data
- Fix HTTP router wrap handler with tracing enabled
2025-03-05 13:04:25 +00:00
olivermrbl
5d74ac3cc3 chore: Version packages 2025-03-04 14:11:37 +01:00
Adrien de Peretti
5d184ba0c8 chore(framework): Unified resource loading and exclude non js/ts files (#11707)
* chore(framework): Unified resource loading and exclude non js/ts files

* chore(framework): Unified resource loading and exclude non js/ts files

* chore(framework): Unified resource loading and exclude non js/ts files

* chore(framework): Unified resource loading and exclude non js/ts files

* chore(framework): Unified resource loading and exclude non js/ts files

* Create six-parrots-shave.md
2025-03-04 13:21:37 +01:00
Harminder Virk
aabbbb7292 feat: Replace existing router with the new implementation (#11646) 2025-03-04 17:22:20 +05:30
Carlos R. L. Rodrigues
7dbec10b3b fix(order): summary raw totals (#11712) 2025-03-04 11:01:12 +00:00
Avia-Code
cc829185f4 feat: added hook for createStockLocationsWorkflow (#11491)
What
This commit introduces the `stockLocationsCreated` hook to the `createStockLocationsWorkflow`.

Why
The hook was missing and necessary to improve the workflow's extensibility.

How
Added the `stockLocationsCreated` hook and updated related logic within the workflow.

Testing

1. Create new medusa project via create-medusa-app
2. Connect this custom branch of medusa to it
3. Create `src/workflows/hooks/stock-locations-created.ts` file with the following content:

```
import { createStockLocationsWorkflow } from "@medusajs/medusa/core-flows"

createStockLocationsWorkflow.hooks.stockLocationsCreated(
  (async ({ stockLocations, additional_data }, { container }) => {
    console.log({stockLocations})
  })
)
```
4. Create new admin account and create there a new stock location
5. The log should be displayed in terminal
2025-03-04 10:53:39 +00:00
Frane Polić
e23f204b7c fix(dashboard, core-flows, medusa): prevent creation of empty fulfillments (#11664) 2025-03-03 16:54:20 +00:00
Riqwan Thamir
ab96ad3b82 feat(utils): add error message when manager is not found in context (#11693) 2025-03-03 15:50:34 +01:00
Riqwan Thamir
51b0af193c fix(types,medusa): calculate taxes for original price (#11692) 2025-03-03 14:20:48 +01:00
Shahed Nasser
61a0e4f3cf chore(workflows-sdk): fix examples in TSDocs (#11689) 2025-03-03 12:20:21 +02:00
Adrien de Peretti
d1efad9bf0 chore(): Improve cart update line items (#11666)
**What**
Currently, we are potentially providing an array of selector/data leading to fetching data sequentially before running on update which will fetch data again in batch and perform the update. Now we can pass the data directly which includes the id already and only perform one bulk fetch + one bulk update.

This pr also include a fix on the inventory validation, currently, only the item to update inventory is being checked, with this pr we also check the inventory for the items that needs to be created
2025-03-03 10:06:40 +00:00