The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
docs: update documentation for wishlist and vendor notifications modules, including middleware setup and code generation instructions
Jakub Sieradzki41685dc00518
diff --git a/packages/registry/r/algolia.json b/packages/registry/r/algolia.jsonindex d5419b956..2a0a53b65 100644--- a/packages/registry/r/algolia.json+++ b/packages/registry/r/algolia.json@@ -6,7 +6,7 @@"algoliasearch"],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli codegen\n```",+ "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","categories": ["module","workflow",@@ -21,7 +21,7 @@},{"path": "algolia/modules/algolia/service.ts",- "content": "import {\n Action,\n Algoliasearch,\n BatchRequest,\n IndexSettings,\n SearchParams,\n SearchResponse,\n algoliasearch\n} from 'algoliasearch'\n\nimport { AlgoliaEntity, IndexType } from './types'\n\ntype ModuleOptions = {\n appId: string\n apiKey: string\n}\n\nexport const defaultProductSettings: IndexSettings = {\n searchableAttributes: [\n 'title',\n 'subtitle',\n 'tags.value',\n 'type.value',\n 'categories.name',\n 'collection.title',\n 'variants.title'\n ]\n}\n\nclass AlgoliaModuleService {\n private options_: ModuleOptions\n private algolia_: Algoliasearch\n\n constructor(_: unknown, options: ModuleOptions) {\n this.options_ = options\n this.algolia_ = algoliasearch(this.options_.appId, this.options_.apiKey)\n }\n\n getAppId() {\n return this.options_.appId\n }\n\n checkIndex(index: IndexType) {\n return this.algolia_.indexExists({\n indexName: index\n })\n }\n\n updateSettings(index: IndexType, settings: IndexSettings) {\n return this.algolia_.setSettings({\n indexName: index,\n indexSettings: settings\n })\n }\n\n batch(type: IndexType, toAdd: AlgoliaEntity[], toDelete: string[]) {\n const addRequests: BatchRequest[] = toAdd.map((entity) => {\n return {\n action: 'addObject' as Action,\n objectID: entity.id,\n body: entity\n }\n })\n\n const deleteRequests: BatchRequest[] = toDelete.map((id) => {\n return {\n action: 'deleteObject' as Action,\n objectID: id,\n body: {}\n }\n })\n\n const requests = [...addRequests, ...deleteRequests]\n\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests\n }\n })\n }\n\n batchUpsert(type: IndexType, entities: AlgoliaEntity[]) {\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests: entities.map((entity) => {\n return {\n action: 'addObject',\n objectID: entity.id,\n body: entity\n }\n })\n }\n })\n }\n\n batchDelete(type: IndexType, ids: string[]) {\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests: ids.map((id) => {\n return {\n action: 'deleteObject',\n objectID: id,\n body: {}\n }\n })\n }\n })\n }\n\n upsert(type: IndexType, entity: AlgoliaEntity) {\n return this.algolia_.addOrUpdateObject({\n indexName: type,\n objectID: entity.id,\n body: entity\n })\n }\n\n delete(type: IndexType, id: string) {\n return this.algolia_.deleteObject({\n indexName: type,\n objectID: id\n })\n }\n\n partialUpdate(\n type: IndexType,\n entity: Partial<AlgoliaEntity> & { id: string }\n ) {\n return this.algolia_.partialUpdateObject({\n indexName: type,\n objectID: entity.id,\n attributesToUpdate: { ...entity }\n })\n }\n\n search<T = Record<string, unknown>>(\n indexName: IndexType,\n params: SearchParams\n ): Promise<SearchResponse<T>> {\n return this.algolia_.searchSingleIndex<T>({\n indexName,\n searchParams: params\n })\n }\n}\n\nexport default AlgoliaModuleService\n",+ "content": "import {\n Action,\n Algoliasearch,\n BatchRequest,\n IndexSettings,\n SearchParams,\n SearchResponse,\n algoliasearch,\n} from \"algoliasearch\";\n\nimport { AlgoliaEntity, IndexType } from \"./types\";\n\ntype ModuleOptions = {\n appId: string;\n apiKey: string;\n};\n\nexport const defaultProductSettings: IndexSettings = {\n searchableAttributes: [\n \"title\",\n \"subtitle\",\n \"tags.value\",\n \"type.value\",\n \"categories.name\",\n \"collection.title\",\n \"variants.title\",\n ],\n};\n\nclass AlgoliaModuleService {\n private options_: ModuleOptions;\n private algolia_: Algoliasearch;\n\n constructor(_: unknown, options: ModuleOptions) {\n this.options_ = options;\n this.algolia_ = algoliasearch(this.options_.appId, this.options_.apiKey);\n }\n\n getAppId() {\n return this.options_.appId;\n }\n\n checkIndex(index: IndexType) {\n return this.algolia_.indexExists({\n indexName: index,\n });\n }\n\n updateSettings(index: IndexType, settings: IndexSettings) {\n return this.algolia_.setSettings({\n indexName: index,\n indexSettings: settings,\n });\n }\n\n batch(type: IndexType, toAdd: AlgoliaEntity[], toDelete: string[]) {\n const addRequests: BatchRequest[] = toAdd.map((entity) => {\n return {\n action: \"addObject\" as Action,\n objectID: entity.id,\n body: entity,\n };\n });\n\n const deleteRequests: BatchRequest[] = toDelete.map((id) => {\n return {\n action: \"deleteObject\" as Action,\n objectID: id,\n body: {},\n };\n });\n\n const requests = [...addRequests, ...deleteRequests];\n\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests,\n },\n });\n }\n\n batchUpsert(type: IndexType, entities: AlgoliaEntity[]) {\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests: entities.map((entity) => {\n return {\n action: \"addObject\",\n objectID: entity.id,\n body: entity,\n };\n }),\n },\n });\n }\n\n batchDelete(type: IndexType, ids: string[]) {\n return this.algolia_.batch({\n indexName: type,\n batchWriteParams: {\n requests: ids.map((id) => {\n return {\n action: \"deleteObject\",\n objectID: id,\n body: {},\n };\n }),\n },\n });\n }\n\n upsert(type: IndexType, entity: AlgoliaEntity) {\n return this.algolia_.addOrUpdateObject({\n indexName: type,\n objectID: entity.id,\n body: entity,\n });\n }\n\n delete(type: IndexType, id: string) {\n return this.algolia_.deleteObject({\n indexName: type,\n objectID: id,\n });\n }\n\n partialUpdate(\n type: IndexType,\n entity: Partial<AlgoliaEntity> & { id: string },\n ) {\n return this.algolia_.partialUpdateObject({\n indexName: type,\n objectID: entity.id,\n attributesToUpdate: { ...entity },\n });\n }\n\n search<T = Record<string, unknown>>(\n indexName: IndexType,\n params: SearchParams,\n ): Promise<SearchResponse<T>> {\n return this.algolia_.searchSingleIndex<T>({\n indexName,\n searchParams: params,\n });\n }\n}\n\nexport default AlgoliaModuleService;\n","type": "registry:api"},{diff --git a/packages/registry/r/registry.json b/packages/registry/r/registry.jsonindex f6eef77dc..d60e367cc 100644--- a/packages/registry/r/registry.json+++ b/packages/registry/r/registry.json@@ -480,7 +480,7 @@"description": "Customer wishlist with product bookmarking, pricing context, and store API endpoints.","dependencies": [],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nmercurjs codegen\n```",+ "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "wishlist/modules/wishlist/index.ts",@@ -562,7 +562,7 @@"description": "Vendor notification feed with bell icon in navbar and vendor API endpoint.","dependencies": [],"registryDependencies": [],- "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `mercur.config.ts`:\n\n```ts\nimport { defineConfig } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n components: {\n TopbarActions: './components/topbar-actions',\n },\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```",+ "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `vite.config.ts`:\n\n```ts\nimport { mercurDashboardPlugin } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n plugins: [\n react(),\n mercurDashboardPlugin({\n medusaConfigPath: '../../packages/api/medusa-config.ts',\n components: {\n TopbarActions: './src/components/topbar-actions',\n },\n }),\n ],\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "vendor-notifications/api/middlewares.ts",@@ -605,7 +605,7 @@"algoliasearch"],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli codegen\n```",+ "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "algolia/modules/algolia/index.ts",diff --git a/packages/registry/r/requests.json b/packages/registry/r/requests.jsonindex 1be1e1cbe..055190571 100644--- a/packages/registry/r/requests.json+++ b/packages/registry/r/requests.json@@ -22,7 +22,7 @@},{"path": "requests/workflows/requests/steps/validate-request-status.ts",- "content": "import { createStep } from \"@medusajs/framework/workflows-sdk\"\nimport { ContainerRegistrationKeys, MedusaError } from \"@medusajs/framework/utils\"\n\nimport { RequestStatus } from \"../../../types\"\n\ntype ValidateRequestStatusStepInput = {\n alias: string\n entity_id: string\n expected_status: RequestStatus | RequestStatus[]\n}\n\nexport const validateRequestStatusStep = createStep(\n \"validate-request-status\",\n async (input: ValidateRequestStatusStepInput, { container }) => {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n\n const {\n data: [entity],\n } = await query.graph({\n entity: input.alias,\n fields: [\"id\", \"custom_fields.*\"],\n filters: { id: input.entity_id },\n })\n\n if (!entity) {\n throw new MedusaError(MedusaError.Types.NOT_FOUND, \"Request not found\")\n }\n\n const status = (entity as any).custom_fields?.request_status\n\n const expected = Array.isArray(input.expected_status)\n ? input.expected_status\n : [input.expected_status]\n\n if (!expected.includes(status)) {\n throw new MedusaError(\n MedusaError.Types.INVALID_DATA,\n `Request status must be ${expected.join(\" or \")}, but is ${status}`\n )\n }\n }\n)\n",+ "content": "import { createStep } from \"@medusajs/framework/workflows-sdk\"\nimport { ContainerRegistrationKeys, MedusaError } from \"@medusajs/framework/utils\"\n\nimport { RequestStatus } from \"../../../types\"\nimport { Query } from \"@mercurjs/types\"\n\ntype ValidateRequestStatusStepInput = {\n alias: string\n entity_id: string\n expected_status: RequestStatus | RequestStatus[]\n}\n\nexport const validateRequestStatusStep = createStep(\n \"validate-request-status\",\n async (input: ValidateRequestStatusStepInput, { container }) => {\n const query = container.resolve<Query>(ContainerRegistrationKeys.QUERY)\n\n const {\n data: [entity],\n } = await query.graph({\n entity: input.alias,\n fields: [\"id\", \"custom_fields.*\"],\n filters: { id: input.entity_id },\n })\n\n if (!entity) {\n throw new MedusaError(MedusaError.Types.NOT_FOUND, \"Request not found\")\n }\n\n const status = (entity as any).custom_fields?.request_status\n\n const expected = Array.isArray(input.expected_status)\n ? input.expected_status\n : [input.expected_status]\n\n if (!expected.includes(status)) {\n throw new MedusaError(\n MedusaError.Types.INVALID_DATA,\n `Request status must be ${expected.join(\" or \")}, but is ${status}`\n )\n }\n }\n)\n","type": "registry:api"},{diff --git a/packages/registry/r/vendor-notifications.json b/packages/registry/r/vendor-notifications.jsonindex d60169fbc..f0e0eab03 100644--- a/packages/registry/r/vendor-notifications.json+++ b/packages/registry/r/vendor-notifications.json@@ -4,7 +4,7 @@"description": "Vendor notification feed with bell icon in navbar and vendor API endpoint.","dependencies": [],"registryDependencies": [],- "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `mercur.config.ts`:\n\n```ts\nimport { defineConfig } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n components: {\n TopbarActions: './components/topbar-actions',\n },\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```",+ "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `vite.config.ts`:\n\n```ts\nimport { mercurDashboardPlugin } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n plugins: [\n react(),\n mercurDashboardPlugin({\n medusaConfigPath: '../../packages/api/medusa-config.ts',\n components: {\n TopbarActions: './src/components/topbar-actions',\n },\n }),\n ],\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","categories": ["api","vendor"diff --git a/packages/registry/r/wishlist.json b/packages/registry/r/wishlist.jsonindex 631331bf8..028e21d87 100644--- a/packages/registry/r/wishlist.json+++ b/packages/registry/r/wishlist.json@@ -4,7 +4,7 @@"description": "Customer wishlist with product bookmarking, pricing context, and store API endpoints.","dependencies": [],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nmercurjs codegen\n```",+ "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","categories": ["module","workflow",diff --git a/packages/registry/registry.json b/packages/registry/registry.jsonindex f6eef77dc..d60e367cc 100644--- a/packages/registry/registry.json+++ b/packages/registry/registry.json@@ -480,7 +480,7 @@"description": "Customer wishlist with product bookmarking, pricing context, and store API endpoints.","dependencies": [],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nmercurjs codegen\n```",+ "docs": "## Configuration\n\nAdd the wishlist module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/wishlist',\n },\n]\n```\n\n## Middlewares\n\nAdd the wishlist middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { storeMiddlewares } from \"./store/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...storeMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the wishlist middleware imports and spread them into your existing `routes` array.\n\n## Run codegen\n\nAfter installing the block, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "wishlist/modules/wishlist/index.ts",@@ -562,7 +562,7 @@"description": "Vendor notification feed with bell icon in navbar and vendor API endpoint.","dependencies": [],"registryDependencies": [],- "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `mercur.config.ts`:\n\n```ts\nimport { defineConfig } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n components: {\n TopbarActions: './components/topbar-actions',\n },\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```",+ "docs": "## Vendor Notifications\n\nThis block adds vendor notifications: a bell icon in the navbar and a `GET /vendor/notifications` API endpoint.\n\n### 1. Notification Provider\n\nAdd the `seller_feed` channel to the local notification provider in `medusa-config.ts`:\n\n```ts\n{\n resolve: '@medusajs/medusa/notification',\n options: {\n providers: [\n {\n resolve: '@medusajs/medusa/notification-local',\n id: 'local',\n options: {\n channels: ['feed', 'seller_feed']\n }\n }\n ]\n }\n}\n```\n\n### 2. Middleware Setup\n\nImport `vendorNotificationMiddlewares` and add it to your `src/api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { vendorNotificationMiddlewares } from \"./vendor/notifications/middlewares\";\n\nexport default defineMiddlewares({\n routes: [\n // ...your existing middlewares,\n ...vendorNotificationMiddlewares,\n ],\n});\n```\n\n### 3. TopbarActions Component\n\nRegister the `TopbarActions` component in your vendor app's `vite.config.ts`:\n\n```ts\nimport { mercurDashboardPlugin } from '@mercurjs/dashboard-sdk'\n\nexport default defineConfig({\n plugins: [\n react(),\n mercurDashboardPlugin({\n medusaConfigPath: '../../packages/api/medusa-config.ts',\n components: {\n TopbarActions: './src/components/topbar-actions',\n },\n }),\n ],\n})\n```\n\n### 4. Sending Notifications\n\nCreate a subscriber to send notifications to sellers. Example (`src/subscribers/seller-product-notification.ts`):\n\n```ts\nimport type { SubscriberArgs, SubscriberConfig } from \"@medusajs/framework\"\nimport { ContainerRegistrationKeys, Modules } from \"@medusajs/framework/utils\"\n\nexport default async function handler({\n event: { data },\n container,\n}: SubscriberArgs<{ id: string }>) {\n const query = container.resolve(ContainerRegistrationKeys.QUERY)\n const notificationService = container.resolve(Modules.NOTIFICATION)\n\n // Example: look up the seller linked to a product\n const { data: [product] } = await query.graph({\n entity: \"product\",\n fields: [\"id\", \"title\", \"seller.*\"],\n filters: { id: data.id },\n })\n\n if (!product?.seller?.id) return\n\n await notificationService.createNotifications({\n to: product.seller.id,\n channel: \"seller_feed\",\n template: \"product-created\",\n data: {\n title: \"Product created\",\n description: `Your product \\\"${product.title}\\\" has been created.`,\n },\n })\n}\n\nexport const config: SubscriberConfig = {\n event: \"product.created\",\n}\n```\n\n### 5. Run codegen\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "vendor-notifications/api/middlewares.ts",@@ -605,7 +605,7 @@"algoliasearch"],"registryDependencies": [],- "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli codegen\n```",+ "docs": "## Configuration\n\nAdd the algolia module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/algolia',\n options: {\n appId: process.env.ALGOLIA_APP_ID,\n apiKey: process.env.ALGOLIA_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\n```\nALGOLIA_APP_ID=your_algolia_app_id\nALGOLIA_API_KEY=your_algolia_admin_api_key\n```\n\n## Middlewares\n\nAdd algolia middlewares to your `api/middlewares.ts`:\n\n```ts\nimport { defineMiddlewares } from \"@medusajs/medusa\";\nimport { algoliaMiddlewares } from \"./store/products/search/middlewares\";\n\nexport default defineMiddlewares({\n routes: [...algoliaMiddlewares],\n});\n```\n\nIf you already have a `middlewares.ts` file, merge the algolia middleware imports and spread them into your existing `routes` array.\n\n## Database Migrations\n\nAfter installing the block, run migrations for the new links:\n\n```bash\nnpx medusa db:migrate\n```\n\n## Run codegen\n\nAfter installing, regenerate SDK types:\n\n```bash\nnpx @mercurjs/cli@canary codegen\n```","files": [{"path": "algolia/modules/algolia/index.ts",