Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Mercur Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-mercur-knowledge-patch)
---
name: mercur-knowledge-patch
description: Mercur
version: null
license: MIT
metadata:
author: Nevaberry
---
# Mercur Knowledge Patch
Use this skill when building or upgrading Mercur marketplaces, integrating their
APIs, extending Admin or Vendor panels, or configuring checkout and payouts.
The references contain the detailed guidance and version-specific behavior.
## Reference index
| Reference | Topics |
| --- | --- |
| [Architecture and Setup](references/architecture-and-setup.md) | Runtime, migrations, core plugin, scaffolding, storefront, telemetry |
| [Blocks and CLI](references/blocks-and-cli.md) | Official blocks, registry commands, templates, local guides |
| [Dashboards and Typed Client](references/dashboards-and-client.md) | Authentication, typed client, routing, layouts, forms, widgets |
| [Orders, Commissions, and Returns](references/orders-commissions-and-returns.md) | Payout migration, settlements, split payments, checkout, shipping, returns |
| [Search and Engagement](references/search-and-engagement.md) | Index migration, filters, caching, Algolia, promotions, reviews, messaging |
| [Sellers, Catalog, and Inventory](references/sellers-catalog-and-inventory.md) | Seller access, onboarding, regions, approvals, offers, inventory, events |
## Upgrade changes
### Runtime, validation, and migrations
Mercur v2.4.0 uses Medusa 2.22.0 and requires Node 22.22+. The release recommends
Node 24.22.1+ or 22.23.4+ for the October security updates. Run the migrations for
payout tables, seller region links, order-group metadata, and nullable seller
lead times. Mercur v2.4.1 uses Medusa 2.22.3: `BigNumber` and `MathBN` throw on
invalid input, and malformed `bodyParser.sizeLimit` throws when the route is hit.
For the Zod 4 upgrade, change single-argument `z.record(value)` calls in custom
validators to supply key and value schemas, such as `z.record(z.string(), z.number())`.
For v2.4.1, run `medusa db:migrate` to create and backfill the writable
`offer_seller` and `offer_product` links and hash existing member invites. Then
trigger `POST /admin/index/sync` to ingest existing sellers and offers.
### Stripe connector and payout API migration
Replace `@mercurjs/payout-stripe-connect` with `@mercurjs/stripe-connector-plugin`.
Configure the payout module with
`@mercurjs/stripe-connector-plugin/providers/payout-stripe-connect`.
If using the plugin's payment provider, add `pp_stripe-connector_<id>` to regions.
Use `createOrderPayoutsWorkflow` in place of `createPayoutWorkflow`. In custom
`IPayoutProvider` implementations, rename `createPayoutAccount` to
`createAccount` and implement the now-required `retrieveAccount` and `reversePayout`.
Core uses one provider per marketplace, one payout per seller order, and one
reversal per subsequent refund. A connector or project integration schedules
payout runs, which reevaluate `on_hold` orders. The migration changes existing
`PayoutStatus.CANCELED` rows to `PayoutStatus.ABORTED`.
### Panel authentication and removed UI exports
Admin and Vendor use bearer tokens and keep independent logins on a shared API
host. Users must sign in again after upgrading. In custom page clients, remove
cookie-session `credentials: 'include'` and use `getAuthHeaders()` from
`@mercurjs/admin` or `@mercurjs/vendor` as request headers.
Replace the removed `Notifications` export with a widget in `topbar.after` if a
panel needs a notifications bell. Both panels expose `topbar.before` and
`topbar.after`; the built-in Cmd/Ctrl+N shortcut is removed.
### Shipping and storefront API changes
The operator manages shipping profiles; vendors can read and select them.
Vendor `POST` and `DELETE` on `/vendor/shipping-profiles`, the `seller_id` filter
on `GET /admin/shipping-profiles`, and `shipping-profile-seller-link` are removed.
`POST /store/carts/:id/line-items` returns `400` when requests include `unit_price`
or `compare_at_unit_price`. Remove both: Mercur derives line prices from offers.
`GET /store/order-groups` returns `400` for explicit
`orders.items.variant.product` requests; use `orders.items.product_handle` and
`orders.items.product_title`. The default field selection is accepted.
### Seller lifecycle and region access
Use lifecycle endpoints for `status` and `status_reason`, removed from
`POST /admin/sellers/:id`. Editing `is_premium` requires `sellers.premium:edit`.
Suspended or terminated sellers can access only `GET /vendor/sellers/me` in the
Vendor API. Enable seller roles and permissions explicitly when used:
```ts
withMercur({ featureFlags: { rbac: true } })
```
Set the default region for new sellers under Settings → Store. Assign existing
sellers from the seller page or `POST /admin/sellers/:id/regions` with
`{ "add": ["reg_…"] }`. Vendor region lists contain assigned regions only;
unassigned region details return `404`, and setting offer or shipping prices
there returns `400`.
### Product changes and offer eligibility
`DELETE /admin/products/:id` uses the product change pipeline and returns an
error while a change is pending. Deletion soft-deletes seller offers.
With `product_request` enabled, Products → Inbox lists new proposals and pending
edits or deletions. Edits to draft and proposed products apply immediately.
`createOffersWorkflow` rejects products restricted to other sellers and products
rejected by the operator. Products without a seller link remain open to all
sellers. A published, allowlisted product restricted to other stores is hidden
from its creator once the restriction applies.
## Common development tasks
### Core, blocks, and CLI
`@mercurjs/core-plugin` supplies Custom Fields and cart, order, pricing, and vendor
workflows that projects can extend, hook into, or replace. Registry blocks copy
source into the project, including modules, links, workflows, API routes, and UI
extensions. CLI operations include:
```bash
mercurjs init
mercurjs search -q "payment"
mercurjs view reviews
mercurjs add reviews wishlist vendor-chat
mercurjs diff reviews
mercurjs codegen
```
Templates include `.ai/skills/migration-guide` for 1.x to 2.0 migration procedures.
See [Blocks and CLI](references/blocks-and-cli.md) for registry IDs and other guides.
### Route-generated client
`@mercurjs/client` exports `createClient` and `InferClientOutput`. Types generated
by `mercurjs codegen` type inputs and outputs. Dynamic path parameters use `$param`
segments and are passed in the argument object:
```ts
// sdk is the project's initialized client.
const products = await sdk.admin.products.query({ limit: 10 })
const product = await sdk.admin.products.$id.query({ $id: "prod_123" })
await sdk.admin.products.$id.delete({ $id: "prod_123" })
```
Use `.mutate()` for a route's typed mutation input. `ClientError` exposes the API
error `code` so storefronts can branch when handling API refusals.
### Split checkout, payments, and settlements
Cart payment capture gives each seller order a payment collection and captured
payment for its share of the same charge, for captures starting in v2.3.6. Use
standard Medusa refund and cancellation routes or workflows; refunds are capped
at the order's share. Cancellation before capture preserves the authorization
for the cart's other orders.
In v2.4.1, checkout retries reuse an order group left by a crash. Failed
completion cancels or refunds payment, including payments captured by webhook.
`setOrderStatus` on `completeCartWithSplitOrdersWorkflow` sets initial seller-order
status. Both panels lock fulfillment, editing, returns, exchanges, claims,
captures, and refunds for `requires_action` orders and provide a status filter.
The Stripe connector supplies scheduled jobs and nets payouts, reversals, and
operator adjustments in settlements per seller and currency. See
[Orders, Commissions, and Returns](references/orders-commissions-and-returns.md)
for commission providers, payout state, credits, and payment hooks.
### Offer pricing, availability, and lead times
Offer prices must exceed zero and accept a decimal comma. The Create offers form
skips variants without a price. `GET /store/offers` subtracts reserved stock from
availability. Add-to-cart checks combined demand per inventory item; v2.4.1
rejects adding a second offer for a variant already in the cart.
`effective_leadtime_to_ship` uses the offer value, then seller store value, then
the marketplace default in Settings → Marketplace. New sellers have
`default_leadtime_to_ship: null`; existing sellers inherit the marketplace default
by clearing their value. Restore explicit values of `2` cleared by the v2.3.9
canary migration.
### Dashboard extensions
Both panels use the Vite plugin from `@mercurjs/dashboard-sdk`.
`src/pages/users/[id]/page.tsx` registers `/users/:id`. Plugins, the Medusa project,
and the host app can contribute routes, widgets, `layouts/`, `_layouts.ts`, and
`_navigation.ts`, with later layers taking precedence in that order.
Use custom-fields `list` and `forms` to hide, replace, or add columns and fields
on embedded tables, spreadsheet grids, and built-in forms. The seller `onboarding`
form zone can add, remove, reorder, or make step tabs optional. Use `RichTextEditor`
and `RichText` from `@mercurjs/dashboard-shared` for product descriptions.
### Indexing, caching, and storefront prices
Product lists in Admin, Vendor, and Store, and the Store offer list, use the
Medusa index for cross-module filters. Indexed Admin and Vendor product lists
return an exact `count`.
In v2.4.1, `withMercur` enables the Medusa Caching Module. Product-list TTLs are
300 seconds for Store and 60 for Admin and Vendor. The default store is in-memory
per instance; `projectConfig.redisUrl` enables shared Redis caching. Disable with:
```ts
withMercur({ featureFlags: { caching: false } })
```
The Next 16 storefront uses Cache Components and fetches catalog prices
anonymously, so customer-group prices appear only in the cart. Set
`NEXT_PUBLIC_BASE_URL` for canonical and structured-data URLs.
### Telemetry controls
The server sends a startup event and daily heartbeat by default; the CLI reports
command and flag names, exit code, and duration, with values limited to boolean
or fixed-choice flags. Telemetry is disabled in CI, with `NODE_ENV=test`, and in
worker processes. `MERCUR_TELEMETRY_DEBUG=true` prints payloads instead of sending.
Opt out with `MERCUR_DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or:
```ts
withMercur({ projectConfig: { mercur: { telemetry: false } } })
```