Commit Graph

471 Commits

Author SHA1 Message Date
Frane Polić
8472460f53 feat: Payment module package setup (#6059) 2024-01-11 16:41:40 +01:00
Adrien de Peretti
a9b4214503 chore(utils, product): Attempt to simplify module scripts export (#6021) 2024-01-09 20:20:05 +01:00
olivermrbl
aea85893e2 chore: Release 2024-01-09 18:46:24 +01:00
Kasper Fabricius Kristensen
f868775861 chore: move next admin packages to core repo (#5983)
**What**
- Move packages for `next` version of admin to core repo

**Other**
- Since this PR introduces packages that depend on Vite 5, it also introduces @types/node@^20. We have never had a direct dependency on the types package for Node, and as far as I can see that has resulted in us using the types from Node.js@8, as those are a dependency of one of our dependencies. With the introduction of @types/node@^20, two of our packages had TS errors because they were using the NodeJS.Timer type, which was deprecated in Node.js@14. We should add specific @types/node packages to all our packages, but I haven't done so in this PR to keep it as clean as possible.
- Q: @olivermrbl I've added the new packages to the ignore list for changeset, is this enough to prevent them from being published?
2024-01-08 09:26:46 +00:00
Oli Juhl
99a4f94db5 feat(medusa-payment-stripe): Add delay to Stripe webhook (#5838)
**What**
- Migrate Stripe plugin to use API Routes + Subscribers
- Change the behaviour of Stripe webhook
Instead of processing webhook events immediately, we fire an event to perform the work in the background. The primary reason for changing the webhook is that the previous implementation led to occasional conflicts due to a race condition between the client's and the webhook's request to complete a cart. Now, we emit an event with a configurable delay (defaults to 2s) to prevent this from happening

This approach was preferred over adding a timeout directly to the webhook execution, as it is generally best practice to respond to a webhook event immediately after receiving it.
2024-01-05 12:37:53 +00:00
Philip Korsholm
d16d10619d Feat(medusa-test-utils, utils, pricing, product, link-modules): upgrade mikro orm version to latest (#5985)
* update mikro-orm version

* add changeset

* update product tests

* add optional number serializer util

* upgrade cart mikro-orm versions

* clean up test
2024-01-02 17:11:55 +01:00
Oli Juhl
925feea04a feat(cart): Add cart module package (#5982)
* feat: Add CartModule foundation

* remove migration

* fix ts issue

* Create hot-dingos-pay.md
2024-01-02 15:59:23 +01:00
Philip Korsholm
6d1e3cc028 feat(types,module-sdk): setup authentication module skeleton (#5943)
**What**
- add authentication module skeleton
2023-12-21 06:56:20 +00:00
Riqwan Thamir
3f6d79961d feat(types,modules-sdk): basic module setup for promotions (#5920)
RESOLVES CORE-1580
2023-12-20 12:21:13 +00:00
olivermrbl
9623fcafe6 chore: Release 2023-12-14 15:31:50 +01:00
Kasper Fabricius Kristensen
591ba2388d fix(ui): Bump cva and minor type fixes (#5818)
**What**
- Bumps `class-variance-authority` to new beta version - `cva@beta`.
- Updates all usages of `cva` to new API.
- Clear up the naming of types in `usePrompt`

**Why**
- A bug in how `class-variance-authority` exported its types mean that we were relying on patching the package to ensure that the correct types made it into the build of our UI package. This was important to ensure intellisense for component variants, such as `<Button size="large" />`. Previously in the UI monorepo, having the patch was enough to ensure that the correct types made it into the build, but that was not the case after we moved the design system to the core repo. The issue with types is fixed in the `@1` version of `cva` which is currently in beta. I have pinpointed the version to the current beta version to ensure stability despite the package currently being in beta.
2023-12-07 20:13:44 +00:00
pepijn-vanvlaanderen
a53ae1e29b feat(medusa): Replace Node Redis with ioredis (#5656)
* Replaced Node Redis with ioredis

* Update express.ts
2023-12-06 09:10:56 +01:00
Riqwan Thamir
c4deeee481 fix(modules-sdk): add graphql dependency to modules-sdk (#5750) 2023-11-28 17:11:44 +00:00
olivermrbl
cf0939aab2 chore: Release 2023-11-27 16:45:56 +00:00
olivermrbl
a982e60a0e chore: Bump lock-file 2023-11-27 08:28:09 +00:00
Adrien de Peretti
ddbeed4ea6 chore(workflows, core-flows): Split workflows tooling and definitions (#5705) 2023-11-24 13:55:48 +00:00
olivermrbl
adc60e519c chore: Release 2023-11-21 08:52:26 +00:00
olivermrbl
ebf63dffc4 chore(medusa-oas-cli,medusa-source-shopify): Remove workspace versions 2023-11-20 18:24:30 +00:00
olivermrbl
03e56aed74 chore: Release 2023-11-10 10:38:47 +01:00
Kasper Fabricius Kristensen
e3f1da92db fix(admin-ui, ui): Align @types/react versions across UI packages (#5596)
* fix: Align @types/react versions across UI packages

* update codeowners
2023-11-10 08:31:30 +01:00
Adrien de Peretti
f90ba02087 feat(utils): Introduce promiseAll util (#5543) 2023-11-08 08:48:48 +01:00
Kasper Fabricius Kristensen
e4ce2f4e07 chore(ui,icons,ui-preset,toolbox): Move design system packages to monorepo (#5470) 2023-11-07 22:17:44 +01:00
olivermrbl
0af6e5534b chore: Release 2023-11-01 08:24:54 +01:00
Oli Juhl
65639cb8c1 fix(integration-tests): Add missing deps + timeout to repos test (#5506) 2023-10-31 12:18:55 +01:00
Philip Korsholm
148f537b47 feat(medusa): integrate pricing module to core (#5304)
* add pricing integraiton feature flag

* init

* first endpoint

* cleanup

* remove console.logs

* refactor to util and implement across endpoints

* add changeset

* rename variables

* remove mistype

* feat(medusa): move price module integration to pricing service (#5322)

* initial changes

* chore: make product service always internal for pricing module

* add notes

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>

* nit

* cleanup

* update to object querying

* update cart integration test

* remove uppercase currency_code

* nit

* Feat/admin product pricing module reads (#5354)

* initial changes to list prices for admin

* working price module implementation of list prices

* nit

* variant pricing

* redo integration test changes

* cleanup

* cleanup

* fix unit tests

* [wip] Core <> Pricing - price updates  (#5364)

* chore: update medusa-app

* wip

* get links and modules working with migration

* wip

* chore: make test pass

* Feat/rule type utils (#5371)

* initial rule type utils

* update migration script

* chore: cleanup

* ensure prices are always decorated

* chore: use seed instead

* chore: fix oas conflict

* region id add to admin price read!

---------

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>

* pr feedback

* create remoteQueryFunction type

* fix merge

* fix loaders issue

* Feat(medusa, types, pricing): pricing module migration script (#5409)

* add migration script for money amounts in pricing module

* add changeset

* rename file

* cleanup imports

* update changeset

* add check for pricing module and ff

* feat(medusa,workflows,types): update prices on product and variant update (#5412)

* wip

* chore: update product prices through workflow

* chore: cleanup

* chore: update product handler updates prices for variants

* chore: handle reverts

* chore: address pr comments

* chore: scope workflow handlers to flag handlers

* chore: update return

* chore: update db url

* chore: remove migration

* chore: increase jest timeout

* Feat(medusa): update migration and initDb to run link-migrations (#5437)

* initial

* loader update

* more progress on loaders

* update integration tests and remote-query loader

* remove helper

* migrate isolated modules

* fix test

* fix integration test

* update with pr feedback

* unregister medusa-app

* re-register medusaApp

* fix featureflag

* set timeout

* set timeout

* conditionally run link-module migrations

* pr feedback 1

* add driver options for db

* throw if link is not defined in migration script

* pass config module directly

* include container in migrate command

* chore: increase timeout

* rm redis from api integration tests to test

* chore: temporarily skip tests

* chore: undo skips + add timeout for workflow tests

* chore: increase timeout for order edits

* re-add redis

* include final resolution

* add sharedcontainer to medusaapp loader

* chore: move migration under run command

* try removing redis_url from api tests

* chore: cleanup server on process exit

* chore: clear container on exit

* chore: adjustments

* chore: remove consoles

* chore: close express app on finish

* chore: destroy pg connection on shutdown

* chore: skip

* chore: unskip test

* chore: cleanup container pg connection

* chore: skip

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-10-30 14:42:17 +01:00
Kasper Fabricius Kristensen
b69f182571 fix(admin-ui): modify webpack config to prevent throwing sourcemap errors (#5484) 2023-10-30 12:06:58 +01:00
Kasper Fabricius Kristensen
ea2ee343f0 fix(admin-ui): PriceList bulk editor fixes (#5456)
* fix: rounding on decimal numbers, wrap in form

* add changeset

* fix: decimal numbers in product details

* fix: resolve an issue where double clicking an already selected cell would freeze it
2023-10-26 09:56:36 +02:00
olivermrbl
26833a48a0 chore: Bump @medusajs/medusa-js + medusa-react 2023-10-20 08:32:38 +02:00
olivermrbl
b38f73726d chore: Release 2023-10-19 16:01:56 +02:00
Kasper Fabricius Kristensen
e04927a3cb fix(admin-ui): Price list domain fixes (#5339)
**Fixes**
- Fixes an issue where click the Delete button on a table item in the Price List overview would also navigate to the Price Lists page
- Fixes an issue where Region prices were not showing which region they belong to in the Bulk Editor
- Fixes an issue where the wrong widgets were being injected into the Price List domain

**Improvements**
- Align label for Expiry date field
- Add form validation to require setting the prices of at least one product variant when creating or adding prices to a Price List.
- Show a prompt warning if prices have not been set for all selected products in the create and add product flows.
2023-10-12 08:34:46 +00:00
Sebastian Rindom
66413d094e feat: move create inventory to @medusajs/workflows (#5301)
**Why**
- We have some workflow-like flows in @medusajs/medusa. These should be moved over to the workflows package.
- Inventory Items <> Variant currently assume a 1-1 mapping. There should be support for a many-to-many mapping.

**What**
- PR introduces a feature flag for supporting many-to-many mappings for inventory and variants.
- Deletes legacy transaction handler in @medusajs/medusa.
- Adjusts existing createInventoryItems handler to remove dependency on variant data.

**Unkowns**
~~1. Couldn't find an existing test for the CreateProduct workflow. It should be tested that this still works as expected.~~
2. Have removed transaction managers as we should move to handling consistency through orchestration tooling. Are we ready for that?
2023-10-11 18:01:56 +00:00
olivermrbl
441844ed89 chore: Release 2023-10-06 08:45:49 -07:00
Kasper Fabricius Kristensen
0f34e0f381 feat(admin-ui, medusa, medusa-react, medusa-js): Price List UI revamp (#5233)
* progress on cleanup

* rm forceMount

* close modal on succesful submit

* fix: invalidate price list query on useAdminCreatePriceListPrices

* sync translation keys

* add last translations

* sync translation keys

* improve tabbing between cells

* add comment

* fix: remove double variant, set collision boundary on column dropdown

* add widgets

* update lock file

* decrease details info size, and add missing status update function

* sync translation keys

* add snapshots and remove min/max

* add missing filter menu for customer groups table

* add translation keys for filter menu

* rm unused code

* Create tall-apricots-run.md

* Update tall-apricots-run.md

* fix: discard invalid paste values

* add translation keys

* bump snapshots + minor fixes

* rm console.log

* bump snapshots

* bump ui packages, and add missing tax inclusive display in New form

* update lock file

* fix filter menu

* update snapshot

* update ui package and fix sub menu position

---------

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-10-06 08:22:25 -07:00
Shahed Nasser
0350eeb0a1 docs: create typedoc theme and plugins for references (#5297)
* update typedoc and its plugins

* refactor existing typedoc configurations

* added new typedoc plugin and themes

* added more customization options

* added more customization options

* refactored doc-utils to a workspace

* fix tsconfig

* update README files

* remove comments

* revert type changes

* remove dependencies no longer needed

* removed modules action
2023-10-05 12:09:42 +03:00
Adrien de Peretti
eeceec791c feat(utils,modules-sdk): Remote query object to string array (#5216)
**What**
- transform remote query object back to string array
- get all fields and fields from given relations from a GraphQL schema

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2023-10-03 17:54:41 +00:00
olivermrbl
6c6895888c chore: Release 2023-09-29 14:33:17 -04:00
Carlos R. L. Rodrigues
b3f1135fba chore(medusa): link modules as medusa dependency (#5208) 2023-09-26 08:20:29 -04:00
David Preininger
2caff2efc7 feat(medusa): Authentication overhaul (#4064)
* implemented bearer auth

* changed naming strat

* changed session auth to not use jwt

* typo

* changed auth header prefix for admin api token auth

* fixed supporting functions to work with new session type

* removed database calls for bearer auth improving performance

* removed unused deps

* changed auth in tests

* added integration tests

* Accepted suggested change

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* Typo

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* more typos

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* proper formatting

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed endregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed startregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* fixed admin JWT integration test

* added more fixes to integration tests

* Update OAS

* Create fluffy-donkeys-hope.md

* created API reference for new auth

* implemented getToken in medusa-js

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* deleted files which should be autogenerated

* Update fluffy-donkeys-hope.md

* JSDoc update

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

* added missing route exports

* implemented runtime domain safety in jwt token manager

* fixed jwt manager

* lint get-token files

* Update fluffy-donkeys-hope.md

* Revert "deleted files which should be autogenerated"

This reverts commit cd5e86623b822e6a6ac37322b952143ccc493df9.

* Revert "Apply suggestions from code review"

This reverts commit f02f07ce58fd9fcc2dfc80cadbb9df2665108d65.

* Revert "created API reference for new auth"

This reverts commit c9eafbb36453f5cf8047c79e94f470cb2d023c7d.

* renamed header for sending api access tokens

* medusa-js - changed apiKey header

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
2023-09-25 13:57:44 -04:00
olivermrbl
a81a8835ca chore: Release 2023-09-21 09:23:05 +02:00
olivermrbl
a37e0b44d4 chore: Release 2023-09-18 18:58:27 +02:00
Frane Polić
4dd11c8867 fix(admin-ui): modal pointer events (#5113) 2023-09-18 15:07:59 +02:00
olivermrbl
7dcb82468f chore: Release 2023-09-15 17:14:26 +02:00
Kasper Fabricius Kristensen
cb67760f71 fix(admin,admin-ui): copy public folder as part of admin build (#5057)
**What**
- Copies `/public` folder into Admin build
- Updates the version of `dotenv` to match the version used in other Medusa dependencies. This will prevent errors when trying to link the `admin` package into a local repository for testing.
2023-09-15 09:47:11 +00:00
Geoffroy Empain
afd4e72cdf feat(admin-ui): Multi-language support (#4962) 2023-09-12 14:53:48 +02:00
Adrien de Peretti
6273b4b160 feat(utils, module-sdk, medusa): Extract pg connection utils to utils package (#4961) 2023-09-11 12:10:40 +02:00
olivermrbl
40d9c9479c chore: Release 2023-09-08 14:27:56 +02:00
Oli Juhl
d3d8f0bf58 chore(admin, medusa-payment-stripe): Fix deps (#4987) 2023-09-08 13:55:03 +02:00
Riqwan Thamir
c3dba06948 fix(modules-sdk, orchestration): add missing dependencies + fix default handling in medusa-app & remote query (#4930) 2023-09-07 07:53:46 +00:00
Riqwan Thamir
87bade096e fix(utils, product, pricing, link-modules): add missing dependencies for utils + fix migration path issue (#4915)
* fix: add missing dependencies for utils

* chore: migration path is set from the calling package

* chore: update changeset
2023-08-31 09:16:02 +02:00
Carlos R. L. Rodrigues
4d16acf5f0 feat(link-modules,modules-sdk, utils, types, products) - Remote Link and Link modules (#4695)
What:
- Definition of all Modules links
- `link-modules` package to manage the creation of all pre-defined link or custom ones

```typescript
import { initialize as iniInventory } from "@medusajs/inventory";
import { initialize as iniProduct } from "@medusajs/product";

import {
  initialize as iniLinks,
  runMigrations as migrateLinks
} from "@medusajs/link-modules";

await Promise.all([iniInventory(), iniProduct()]);


await migrateLinks(); // create tables based on previous loaded modules

await iniLinks(); // load link based on previous loaded modules

await iniLinks(undefined, [
  {
    serviceName: "product_custom_translation_service_link",
    isLink: true,
    databaseConfig: {
      tableName: "product_transalations",
    },
    alias: [
      {
        name: "translations",
      },
    ],
    primaryKeys: ["id", "product_id", "translation_id"],
    relationships: [
      {
        serviceName: Modules.PRODUCT,
        primaryKey: "id",
        foreignKey: "product_id",
        alias: "product",
      },
      {
        serviceName: "custom_translation_service",
        primaryKey: "id",
        foreignKey: "translation_id",
        alias: "transalation",
        deleteCascade: true,
      },
    ],
    extends: [
      {
        serviceName: Modules.PRODUCT,
        relationship: {
          serviceName: "product_custom_translation_service_link",
          primaryKey: "product_id",
          foreignKey: "id",
          alias: "translations",
          isList: true,
        },
      },
      {
        serviceName: "custom_translation_service",
        relationship: {
          serviceName: "product_custom_translation_service_link",
          primaryKey: "product_id",
          foreignKey: "id",
          alias: "product_link",
        },
      },
    ],
  },
]); // custom links
```

Remote Link

```typescript
import { RemoteLink, Modules } from "@medusajs/modules-sdk";

// [...] initialize modules and links

const remoteLink = new RemoteLink();

// upsert the relationship
await remoteLink.create({ // one (object) or many (array)
  [Modules.PRODUCT]: {
    variant_id: "var_abc",
  },
  [Modules.INVENTORY]: {
    inventory_item_id: "iitem_abc",
  },
  data: { // optional additional fields
    required_quantity: 5
  }
});

// dismiss (doesn't cascade)
await remoteLink.dismiss({ // one (object) or many (array)
  [Modules.PRODUCT]: {
    variant_id: "var_abc",
  },
  [Modules.INVENTORY]: {
    inventory_item_id: "iitem_abc",
  },
});

// delete
await remoteLink.delete({
  // every key is a module
  [Modules.PRODUCT]: {
    // every key is a linkable field
    variant_id: "var_abc", // single or multiple values
  },
});

// restore
await remoteLink.restore({
  // every key is a module
  [Modules.PRODUCT]: {
    // every key is a linkable field
    variant_id: "var_abc", // single or multiple values
  },
});

```

Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com>
2023-08-30 14:31:32 +00:00