Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

chore: v2.0.0-canary.3

vholikf7c089db9438
diff --git a/bun.lock b/bun.lock
index 3a12f029e..fc1f8e1dc 100644
--- a/bun.lock
+++ b/bun.lock
@@ -38,7 +38,7 @@
},
"packages/cli": {
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"bin": {
"mercurjs": "./dist/index.js",
},
diff --git a/package.json b/package.json
index 3338dabde..d3c074015 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "mercur-new",
+ "name": "mercur",
"private": true,
"scripts": {
"build": "turbo run build",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index c8bb4ae15..b207489df 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/client/package.json b/packages/client/package.json
index 15abe770f..198f3b77d 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/client",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.json
index c3fc1f805..eab549dd2 100644
--- a/packages/core-plugin/package.json
+++ b/packages/core-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/core-plugin",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/src/workflows/campaign/steps/link-seller-campaign.ts b/packages/core-plugin/src/workflows/campaign/steps/link-seller-campaign.ts
index 7cf8c81c8..0b83f4ff7 100644
--- a/packages/core-plugin/src/workflows/campaign/steps/link-seller-campaign.ts
+++ b/packages/core-plugin/src/workflows/campaign/steps/link-seller-campaign.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerCampaignStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerCampaignStepInput = {
export const linkSellerCampaignStep = createStep(
"link-seller-campaign",
async (input: LinkSellerCampaignStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.LINK)
const links = input.campaign_ids.map((campaignId) => ({
[Modules.PROMOTION]: {
@@ -31,7 +32,7 @@ export const linkSellerCampaignStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.campaign_ids.map((campaignId) => ({
[Modules.PROMOTION]: {
diff --git a/packages/core-plugin/src/workflows/cart/steps/prepare-adjustments-from-promotion-actions.ts b/packages/core-plugin/src/workflows/cart/steps/prepare-adjustments-from-promotion-actions.ts
index d1dccc296..aa5909c96 100644
--- a/packages/core-plugin/src/workflows/cart/steps/prepare-adjustments-from-promotion-actions.ts
+++ b/packages/core-plugin/src/workflows/cart/steps/prepare-adjustments-from-promotion-actions.ts
@@ -1,3 +1,4 @@
+import { Query } from "@medusajs/framework"
import {
AddItemAdjustmentAction,
AddShippingMethodAdjustment,
@@ -25,7 +26,7 @@ export const prepareSellerAdjustmentsFromPromotionActionsStep = createStep(
data: PrepareSellerAdjustmentsFromPromotionActionsStepInput,
{ container }
) => {
- const query = container.resolve(ContainerRegistrationKeys.QUERY)
+ const query: Query = container.resolve(ContainerRegistrationKeys.QUERY)
const { actions = [] } = data
diff --git a/packages/core-plugin/src/workflows/cart/steps/validate-seller-cart-items.ts b/packages/core-plugin/src/workflows/cart/steps/validate-seller-cart-items.ts
index 450e57d64..c8ad8f4a5 100644
--- a/packages/core-plugin/src/workflows/cart/steps/validate-seller-cart-items.ts
+++ b/packages/core-plugin/src/workflows/cart/steps/validate-seller-cart-items.ts
@@ -6,6 +6,7 @@ import {
} from "@medusajs/framework/types"
import { ContainerRegistrationKeys, MedusaError } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
+import { Logger } from "@medusajs/medusa"
import { SellerDTO } from "@mercurjs/types"
type ValidateSellerCartItemsStepInput = {
@@ -23,7 +24,7 @@ type ValidateSellerCartItemsStepInput = {
export const validateSellerCartItemsStep = createStep(
"validate-seller-cart-items",
(input: ValidateSellerCartItemsStepInput, { container }) => {
- const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
+ const logger: Logger = container.resolve(ContainerRegistrationKeys.LOGGER)
const itemsWithMissingSellers = input.cart.items.filter((item) => {
return !item.variant.product.seller?.id
diff --git a/packages/core-plugin/src/workflows/hooks/product-created.ts b/packages/core-plugin/src/workflows/hooks/product-created.ts
index b3f24fb35..d12ce01a3 100644
--- a/packages/core-plugin/src/workflows/hooks/product-created.ts
+++ b/packages/core-plugin/src/workflows/hooks/product-created.ts
@@ -2,6 +2,7 @@ import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
import { LinkDefinition } from "@medusajs/framework/types"
+import { Link, Query } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
createProductsWorkflow.hooks.productsCreated(
@@ -13,8 +14,8 @@ createProductsWorkflow.hooks.productsCreated(
)
}
- const link = container.resolve(ContainerRegistrationKeys.LINK)
- const query = container.resolve(ContainerRegistrationKeys.QUERY)
+ const link: Link = container.resolve(ContainerRegistrationKeys.LINK)
+ const query: Query = container.resolve(ContainerRegistrationKeys.QUERY)
const links: LinkDefinition[] = []
const inventoryLinks: LinkDefinition[] = []
@@ -77,7 +78,7 @@ createProductsWorkflow.hooks.productsCreated(
const { productLinks, inventoryLinks } = data
- const link = container.resolve(ContainerRegistrationKeys.LINK)
+ const link: Link = container.resolve(ContainerRegistrationKeys.LINK)
if (productLinks?.length) {
await link.dismiss(productLinks)
diff --git a/packages/core-plugin/src/workflows/hooks/product-variant-created.ts b/packages/core-plugin/src/workflows/hooks/product-variant-created.ts
index b1f3701c2..2af971227 100644
--- a/packages/core-plugin/src/workflows/hooks/product-variant-created.ts
+++ b/packages/core-plugin/src/workflows/hooks/product-variant-created.ts
@@ -2,6 +2,7 @@ import { createProductVariantsWorkflow } from "@medusajs/medusa/core-flows"
import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
import { LinkDefinition } from "@medusajs/framework/types"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
createProductVariantsWorkflow.hooks.productVariantsCreated(
@@ -13,8 +14,8 @@ createProductVariantsWorkflow.hooks.productVariantsCreated(
)
}
- const link = container.resolve(ContainerRegistrationKeys.LINK)
- const query = container.resolve(ContainerRegistrationKeys.QUERY)
+ const link: Link = container.resolve(ContainerRegistrationKeys.LINK)
+ const query: any = container.resolve(ContainerRegistrationKeys.QUERY)
const inventoryLinks: LinkDefinition[] = []
@@ -59,7 +60,7 @@ createProductVariantsWorkflow.hooks.productVariantsCreated(
const { inventoryLinks } = data
- const link = container.resolve(ContainerRegistrationKeys.LINK)
+ const link: Link = container.resolve(ContainerRegistrationKeys.LINK)
if (inventoryLinks?.length) {
await link.dismiss(inventoryLinks)
diff --git a/packages/core-plugin/src/workflows/inventory-item/steps/link-seller-inventory-item.ts b/packages/core-plugin/src/workflows/inventory-item/steps/link-seller-inventory-item.ts
index ed237ff4b..50c8d87b4 100644
--- a/packages/core-plugin/src/workflows/inventory-item/steps/link-seller-inventory-item.ts
+++ b/packages/core-plugin/src/workflows/inventory-item/steps/link-seller-inventory-item.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerInventoryItemStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerInventoryItemStepInput = {
export const linkSellerInventoryItemStep = createStep(
"link-seller-inventory-item",
async (input: LinkSellerInventoryItemStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = input.inventory_item_ids.map((inventoryItemId) => ({
[Modules.INVENTORY]: {
@@ -31,7 +32,7 @@ export const linkSellerInventoryItemStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.inventory_item_ids.map((inventoryItemId) => ({
[Modules.INVENTORY]: {
diff --git a/packages/core-plugin/src/workflows/price-list/steps/link-seller-price-list.ts b/packages/core-plugin/src/workflows/price-list/steps/link-seller-price-list.ts
index e086cfac4..306630cfd 100644
--- a/packages/core-plugin/src/workflows/price-list/steps/link-seller-price-list.ts
+++ b/packages/core-plugin/src/workflows/price-list/steps/link-seller-price-list.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerPriceListStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerPriceListStepInput = {
export const linkSellerPriceListStep = createStep(
"link-seller-price-list",
async (input: LinkSellerPriceListStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = input.price_list_ids.map((priceListId) => ({
[Modules.PRICING]: {
@@ -31,7 +32,7 @@ export const linkSellerPriceListStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.price_list_ids.map((priceListId) => ({
[Modules.PRICING]: {
diff --git a/packages/core-plugin/src/workflows/promotion/steps/link-seller-promotion.ts b/packages/core-plugin/src/workflows/promotion/steps/link-seller-promotion.ts
index 9054590cf..2c535433c 100644
--- a/packages/core-plugin/src/workflows/promotion/steps/link-seller-promotion.ts
+++ b/packages/core-plugin/src/workflows/promotion/steps/link-seller-promotion.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerPromotionStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerPromotionStepInput = {
export const linkSellerPromotionStep = createStep(
"link-seller-promotion",
async (input: LinkSellerPromotionStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = input.promotion_ids.map((promotionId) => ({
[Modules.PROMOTION]: {
@@ -31,7 +32,7 @@ export const linkSellerPromotionStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.promotion_ids.map((promotionId) => ({
[Modules.PROMOTION]: {
diff --git a/packages/core-plugin/src/workflows/shipping-option/steps/link-seller-shipping-option.ts b/packages/core-plugin/src/workflows/shipping-option/steps/link-seller-shipping-option.ts
index 9a28e3f0e..535c1a670 100644
--- a/packages/core-plugin/src/workflows/shipping-option/steps/link-seller-shipping-option.ts
+++ b/packages/core-plugin/src/workflows/shipping-option/steps/link-seller-shipping-option.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerShippingOptionStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerShippingOptionStepInput = {
export const linkSellerShippingOptionStep = createStep(
"link-seller-shipping-option",
async (input: LinkSellerShippingOptionStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = input.shipping_option_ids.map((shippingOptionId) => ({
[Modules.FULFILLMENT]: {
@@ -31,7 +32,7 @@ export const linkSellerShippingOptionStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.shipping_option_ids.map((shippingOptionId) => ({
[Modules.FULFILLMENT]: {
diff --git a/packages/core-plugin/src/workflows/shipping-profile/steps/link-seller-shipping-profile.ts b/packages/core-plugin/src/workflows/shipping-profile/steps/link-seller-shipping-profile.ts
index 04e1575f9..2468c7b37 100644
--- a/packages/core-plugin/src/workflows/shipping-profile/steps/link-seller-shipping-profile.ts
+++ b/packages/core-plugin/src/workflows/shipping-profile/steps/link-seller-shipping-profile.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
+import { Link } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
type LinkSellerShippingProfileStepInput = {
@@ -10,7 +11,7 @@ type LinkSellerShippingProfileStepInput = {
export const linkSellerShippingProfileStep = createStep(
"link-seller-shipping-profile",
async (input: LinkSellerShippingProfileStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = input.shipping_profile_ids.map((shippingProfileId) => ({
[Modules.FULFILLMENT]: {
@@ -31,7 +32,7 @@ export const linkSellerShippingProfileStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
const links = data.shipping_profile_ids.map((shippingProfileId) => ({
[Modules.FULFILLMENT]: {
diff --git a/packages/core-plugin/src/workflows/shipping-profile/workflows/create-seller-shipping-profiles.ts b/packages/core-plugin/src/workflows/shipping-profile/workflows/create-seller-shipping-profiles.ts
index a9f951869..13b780957 100644
--- a/packages/core-plugin/src/workflows/shipping-profile/workflows/create-seller-shipping-profiles.ts
+++ b/packages/core-plugin/src/workflows/shipping-profile/workflows/create-seller-shipping-profiles.ts
@@ -7,13 +7,13 @@ import {
import { CreateShippingProfileDTO } from "@medusajs/framework/types"
import { linkSellerShippingProfileStep } from "../steps"
+import { CreateShippingProfilesWorkflowOutput } from "@medusajs/types/dist/workflow/fulfillment"
type CreateSellerShippingProfilesWorkflowInput = {
shipping_profiles: CreateShippingProfileDTO[]
seller_id: string
}
-
-export const createSellerShippingProfilesWorkflow = createWorkflow(
+export const createSellerShippingProfilesWorkflow: ReturnType<typeof createWorkflow<CreateSellerShippingProfilesWorkflowInput, CreateShippingProfilesWorkflowOutput, any>> = createWorkflow(
"create-seller-shipping-profiles",
function (input: CreateSellerShippingProfilesWorkflowInput) {
const createdShippingProfiles = createShippingProfilesWorkflow.runAsStep({
diff --git a/packages/core-plugin/src/workflows/stock-location/steps/link-seller-stock-location.ts b/packages/core-plugin/src/workflows/stock-location/steps/link-seller-stock-location.ts
index 8c4bc6142..2194ec5ea 100644
--- a/packages/core-plugin/src/workflows/stock-location/steps/link-seller-stock-location.ts
+++ b/packages/core-plugin/src/workflows/stock-location/steps/link-seller-stock-location.ts
@@ -1,6 +1,7 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
import { MercurModules } from "@mercurjs/types"
+import { Link } from "@medusajs/framework/modules-sdk"
type LinkSellerStockLocationStepInput = {
seller_id: string
@@ -10,7 +11,7 @@ type LinkSellerStockLocationStepInput = {
export const linkSellerStockLocationStep = createStep(
"link-seller-stock-location",
async (input: LinkSellerStockLocationStepInput, { container }) => {
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.LINK)
const links = input.stock_location_ids.map((stockLocationId) => ({
[Modules.STOCK_LOCATION]: {
@@ -31,7 +32,7 @@ export const linkSellerStockLocationStep = createStep(
async (data, { container }) => {
if (!data) return
- const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK)
+ const remoteLink: Link = container.resolve(ContainerRegistrationKeys.LINK)
const links = data.stock_location_ids.map((stockLocationId) => ({
[Modules.STOCK_LOCATION]: {
diff --git a/packages/dashboard-sdk/package.json b/packages/dashboard-sdk/package.json
index fd1d2c646..c4d55d8d5 100644
--- a/packages/dashboard-sdk/package.json
+++ b/packages/dashboard-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-sdk",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-shared/package.json b/packages/dashboard-shared/package.json
index e947ee9f8..c222d4a39 100644
--- a/packages/dashboard-shared/package.json
+++ b/packages/dashboard-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-shared",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/registry/src/product-import-export/workflows/steps/get-seller-products.ts b/packages/registry/src/product-import-export/workflows/steps/get-seller-products.ts
index 892da381a..e35edecbe 100644
--- a/packages/registry/src/product-import-export/workflows/steps/get-seller-products.ts
+++ b/packages/registry/src/product-import-export/workflows/steps/get-seller-products.ts
@@ -1,5 +1,6 @@
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+import { Query } from "@medusajs/framework/modules-sdk"
type GetSellerProductsStepInput = {
seller_id: string
@@ -8,7 +9,7 @@ type GetSellerProductsStepInput = {
export const getSellerProductsStep = createStep(
"get-seller-products",
async (input: GetSellerProductsStepInput, { container }) => {
- const query = container.resolve(ContainerRegistrationKeys.QUERY)
+ const query = container.resolve<Query>(ContainerRegistrationKeys.QUERY)
const { data: relations } = await query.graph({
entity: "product_seller",
diff --git a/packages/registry/src/reviews/workflows/review/steps/create-review.ts b/packages/registry/src/reviews/workflows/review/steps/create-review.ts
index 06633a2f1..6cebd9b5a 100644
--- a/packages/registry/src/reviews/workflows/review/steps/create-review.ts
+++ b/packages/registry/src/reviews/workflows/review/steps/create-review.ts
@@ -2,12 +2,13 @@ import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils";
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk";
import { REVIEW_MODULE, ReviewModuleService, CreateReviewDTO } from "../../../modules/reviews";
+import { Link } from "@medusajs/framework/modules-sdk";
export const createReviewStep = createStep(
"create-review",
async (input: CreateReviewDTO, { container }) => {
const service = container.resolve<ReviewModuleService>(REVIEW_MODULE);
- const link = container.resolve(ContainerRegistrationKeys.LINK);
+ const link = container.resolve<Link>(ContainerRegistrationKeys.LINK);
const review = await service.createReviews(input);
diff --git a/packages/registry/src/reviews/workflows/review/steps/validate-review.ts b/packages/registry/src/reviews/workflows/review/steps/validate-review.ts
index b3eb62351..83003bd32 100644
--- a/packages/registry/src/reviews/workflows/review/steps/validate-review.ts
+++ b/packages/registry/src/reviews/workflows/review/steps/validate-review.ts
@@ -6,11 +6,12 @@ import { createStep } from "@medusajs/framework/workflows-sdk";
import { CreateReviewDTO } from "../../../modules/reviews";
import orderReview from "../../../links/order-review";
+import { Query } from "@medusajs/framework";
export const validateReviewStep = createStep(
"validate-review",
async (reviewToCreate: CreateReviewDTO, { container }) => {
- const query = container.resolve(ContainerRegistrationKeys.QUERY);
+ const query = container.resolve<Query>(ContainerRegistrationKeys.QUERY);
const {
data: [order],
diff --git a/packages/types/package.json b/packages/types/package.json
index 0968cdaf8..8addd5de2 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/types",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/package.json b/packages/vendor/package.json
index df5164900..e91920926 100644
--- a/packages/vendor/package.json
+++ b/packages/vendor/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.2",
+ "version": "2.0.0-canary.3",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/src/hooks/api/categories.tsx b/packages/vendor/src/hooks/api/categories.tsx
index 251871e95..437c2f008 100644
--- a/packages/vendor/src/hooks/api/categories.tsx
+++ b/packages/vendor/src/hooks/api/categories.tsx
@@ -8,6 +8,7 @@ import {
QueryKey,
UseInfiniteQueryOptions,
UseMutationOptions,
+ UseMutationResult,
UseQueryOptions,
useMutation,
useQuery,
@@ -17,6 +18,7 @@ import { queryClient } from "../../lib/query-client";
import { queryKeysFactory } from "../../lib/query-key-factory";
import { productsQueryKeys } from "./products";
import { useInfiniteList } from "../use-infinite-list";
+import { AdminProductCategoryResponse, HttpTypes } from "@mercurjs/types";
const CATEGORIES_QUERY_KEY = "categories" as const;
export const categoriesQueryKeys = queryKeysFactory(CATEGORIES_QUERY_KEY);
@@ -25,17 +27,18 @@ export const useProductCategory = (
id: string,
query?: Omit<
InferClientInput<typeof sdk.vendor.productCategories.$id.query>,
- "$id"
+ "$id"
>,
options?: UseQueryOptions<
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.productCategories.$id.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: categoriesQueryKeys.detail(id, query),
- queryFn: () => sdk.vendor.productCategories.$id.query({ $id: id, ...query }),
+ queryFn: () =>
+ sdk.vendor.productCategories.$id.query({ $id: id, ...query }),
...options,
});
@@ -48,7 +51,7 @@ export const useProductCategories = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.productCategories.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: categoriesQueryKeys.list(query),
@@ -79,7 +82,7 @@ export const useInfiniteCategories = (
number
>,
"queryFn" | "queryKey" | "initialPageParam" | "getNextPageParam"
- >
+ >,
) => {
return useInfiniteList({
queryKey: (params) => categoriesQueryKeys.list(params),
@@ -94,7 +97,7 @@ export const useCreateProductCategory = (
InferClientOutput<typeof sdk.vendor.productCategories.mutate>,
ClientError,
InferClientInput<typeof sdk.vendor.productCategories.mutate>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) => sdk.vendor.productCategories.mutate(payload),
@@ -118,7 +121,7 @@ export const useUpdateProductCategory = (
InferClientInput<typeof sdk.vendor.productCategories.$id.mutate>,
"$id"
>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) =>
@@ -143,7 +146,7 @@ export const useDeleteProductCategory = (
InferClientOutput<typeof sdk.vendor.productCategories.$id.delete>,
ClientError,
void
- >
+ >,
) => {
return useMutation({
mutationFn: () => sdk.vendor.productCategories.$id.delete({ $id: id }),
@@ -161,40 +164,47 @@ export const useDeleteProductCategory = (
});
};
-export const useUpdateProductCategoryProducts = (
+type UseUpdateProductCategoryProducts = (
id: string,
options?: UseMutationOptions<
InferClientOutput<typeof sdk.vendor.productCategories.$id.products.mutate>,
ClientError,
- Omit<
- InferClientInput<typeof sdk.vendor.productCategories.$id.products.mutate>,
- "$id"
- >
- >
-) => {
- return useMutation({
- mutationFn: (payload) =>
- sdk.vendor.productCategories.$id.products.mutate({ $id: id, ...payload }),
- onSuccess: (data, variables, context) => {
- queryClient.invalidateQueries({
- queryKey: categoriesQueryKeys.lists(),
- });
- queryClient.invalidateQueries({
- queryKey: categoriesQueryKeys.details(),
- });
- /**
- * Invalidate products list query to ensure that the products collections are updated.
- */
- queryClient.invalidateQueries({
- queryKey: productsQueryKeys.lists(),
- });
+ Omit<AdminProductCategoryResponse, "$id">
+ >,
+) => UseMutationResult<
+ InferClientOutput<typeof sdk.vendor.productCategories.$id.products.mutate>,
+ ClientError,
+ Omit<AdminProductCategoryResponse, "$id">
+>;
- queryClient.invalidateQueries({
- queryKey: productsQueryKeys.details(),
- });
+export const useUpdateProductCategoryProducts: UseUpdateProductCategoryProducts =
+ (id, options) => {
+ return useMutation({
+ mutationFn: (payload) =>
+ sdk.vendor.productCategories.$id.products.mutate({
+ $id: id,
+ ...payload,
+ }),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: categoriesQueryKeys.lists(),
+ });
+ queryClient.invalidateQueries({
+ queryKey: categoriesQueryKeys.details(),
+ });
+ /**
+ * Invalidate products list query to ensure that the products collections are updated.
+ */
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.lists(),
+ });
- options?.onSuccess?.(data, variables, context);
- },
- ...options,
- });
-};
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.details(),
+ });
+
+ options?.onSuccess?.(data, variables, context);
+ },
+ ...options,
+ });
+ };
diff --git a/packages/vendor/src/hooks/api/collections.tsx b/packages/vendor/src/hooks/api/collections.tsx
index 19ced764a..ceb31e6ae 100644
--- a/packages/vendor/src/hooks/api/collections.tsx
+++ b/packages/vendor/src/hooks/api/collections.tsx
@@ -8,6 +8,7 @@ import {
QueryKey,
UseInfiniteQueryOptions,
UseMutationOptions,
+ UseMutationResult,
UseQueryOptions,
useMutation,
useQuery,
@@ -27,7 +28,7 @@ export const useCollection = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.collections.$id.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: collectionsQueryKeys.detail(id),
@@ -44,7 +45,7 @@ export const useCollections = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.collections.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: collectionsQueryKeys.list(query),
@@ -75,7 +76,7 @@ export const useInfiniteCollections = (
number
>,
"queryFn" | "queryKey" | "initialPageParam" | "getNextPageParam"
- >
+ >,
) => {
return useInfiniteList({
queryKey: (params) => collectionsQueryKeys.list(params),
@@ -91,7 +92,7 @@ export const useUpdateCollection = (
InferClientOutput<typeof sdk.vendor.collections.$id.mutate>,
ClientError,
Omit<InferClientInput<typeof sdk.vendor.collections.$id.mutate>, "$id">
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) =>
@@ -110,7 +111,7 @@ export const useUpdateCollection = (
});
};
-export const useUpdateCollectionProducts = (
+type UseUpdateCollectionProducts = (
id: string,
options?: UseMutationOptions<
InferClientOutput<typeof sdk.vendor.collections.$id.products.mutate>,
@@ -119,7 +120,19 @@ export const useUpdateCollectionProducts = (
InferClientInput<typeof sdk.vendor.collections.$id.products.mutate>,
"$id"
>
+ >,
+) => UseMutationResult<
+ InferClientOutput<typeof sdk.vendor.collections.$id.products.mutate>,
+ ClientError,
+ Omit<
+ InferClientInput<typeof sdk.vendor.collections.$id.products.mutate>,
+ "$id"
>
+>;
+
+export const useUpdateCollectionProducts: UseUpdateCollectionProducts = (
+ id,
+ options,
) => {
return useMutation({
mutationFn: (payload) =>
@@ -143,47 +156,3 @@ export const useUpdateCollectionProducts = (
...options,
});
};
-
-export const useCreateCollection = (
- options?: UseMutationOptions<
- InferClientOutput<typeof sdk.vendor.collections.mutate>,
- ClientError,
- InferClientInput<typeof sdk.vendor.collections.mutate>
- >
-) => {
- return useMutation({
- mutationFn: (payload) => sdk.vendor.collections.mutate(payload),
- onSuccess: (data, variables, context) => {
- queryClient.invalidateQueries({
- queryKey: collectionsQueryKeys.lists(),
- });
-
- options?.onSuccess?.(data, variables, context);
- },
- ...options,
- });
-};
-
-export const useDeleteCollection = (
- id: string,
- options?: UseMutationOptions<
- InferClientOutput<typeof sdk.vendor.collections.$id.delete>,
- ClientError,
- void
- >
-) => {
- return useMutation({
- mutationFn: () => sdk.vendor.collections.$id.delete({ $id: id }),
- onSuccess: (data, variables, context) => {
- queryClient.invalidateQueries({
- queryKey: collectionsQueryKeys.lists(),
- });
- queryClient.invalidateQueries({
- queryKey: collectionsQueryKeys.detail(id),
- });
-
- options?.onSuccess?.(data, variables, context);
- },
- ...options,
- });
-};
diff --git a/packages/vendor/src/pages/categories/[id]/products/index.tsx b/packages/vendor/src/pages/categories/[id]/products/index.tsx
index e3fac89fb..e5937dc75 100644
--- a/packages/vendor/src/pages/categories/[id]/products/index.tsx
+++ b/packages/vendor/src/pages/categories/[id]/products/index.tsx
@@ -1,18 +1,18 @@
// Route: /categories/:id/products
-import { useParams } from "react-router-dom"
-import { RouteFocusModal } from "@components/modals"
-import { useProductCategory } from "@hooks/api"
-import { EditCategoryProductsForm } from "./edit-category-products-form"
+import { useParams } from "react-router-dom";
+import { RouteFocusModal } from "@components/modals";
+import { useProductCategory } from "@hooks/api";
+import { EditCategoryProductsForm } from "./edit-category-products-form";
export const Component = () => {
- const { id } = useParams()
+ const { id } = useParams();
const { product_category, isLoading, isError, error } = useProductCategory(
id!,
- { fields: "*products" }
- )
+ { fields: "*products" },
+ );
if (isError) {
- throw error
+ throw error;
}
return (
@@ -24,5 +24,5 @@ export const Component = () => {
/>
)}
</RouteFocusModal>
- )
-}
+ );
+};
diff --git a/templates/basic/apps/vendor/package.json b/templates/basic/apps/vendor/package.json
index 1aff735f2..2c0fc4c2e 100644
--- a/templates/basic/apps/vendor/package.json
+++ b/templates/basic/apps/vendor/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@medusajs/icons": "^2.13.0",
- "@mercurjs/dashboard-sdk": "2.0.0-canary.2",
- "@mercurjs/vendor": "2.0.0-canary.2",
+ "@mercurjs/dashboard-sdk": "2.0.0-canary.3",
+ "@mercurjs/vendor": "2.0.0-canary.3",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
diff --git a/templates/basic/packages/api/package.json b/templates/basic/packages/api/package.json
index f3ce02668..569c81912 100644
--- a/templates/basic/packages/api/package.json
+++ b/templates/basic/packages/api/package.json
@@ -36,8 +36,8 @@
"@medusajs/admin-shared": "^2.13.0",
"@medusajs/medusa": "^2.13.0",
"@medusajs/draft-order": "2.13.0",
- "@mercurjs/core-plugin": "2.0.0-canary.2",
- "@mercurjs/types": "2.0.0-canary.2",
+ "@mercurjs/core-plugin": "2.0.0-canary.3",
+ "@mercurjs/types": "2.0.0-canary.3",
"zod": "3.25.76"
},
"devDependencies": {