@mercurjs/docs 2.2.1 → 2.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/home.mdx +107 -0
- package/content/learn/architecture.mdx +168 -83
- package/content/learn/introduction.mdx +161 -56
- package/content/learn/migration-to-2-0.mdx +187 -0
- package/content/learn/why-mercur.mdx +91 -0
- package/content/platform/attribute/concepts/attribute-types.mdx +59 -0
- package/content/platform/attribute/concepts/global-vs-inline.mdx +50 -0
- package/content/platform/attribute/concepts/variant-axes.mdx +61 -0
- package/content/platform/attribute/guides/attach-attributes-to-a-product.mdx +69 -0
- package/content/platform/attribute/guides/create-a-variant-axis.mdx +83 -0
- package/content/platform/attribute/guides/create-an-attribute.mdx +81 -0
- package/content/platform/attribute/overview.mdx +87 -0
- package/content/platform/attribute/reference/data-models.mdx +56 -0
- package/content/platform/attribute/reference/events.mdx +41 -0
- package/content/platform/attribute/reference/links.mdx +45 -0
- package/content/platform/attribute/reference/service.mdx +49 -0
- package/content/platform/attribute/reference/workflows.mdx +45 -0
- package/content/platform/catalog/concepts/master-products.mdx +54 -0
- package/content/platform/catalog/concepts/product-seller-allowlist.mdx +48 -0
- package/content/platform/catalog/concepts/status-lifecycle.mdx +58 -0
- package/content/platform/catalog/concepts/variants-categories-collections.mdx +49 -0
- package/content/platform/catalog/guides/allowlist-stores.mdx +59 -0
- package/content/platform/catalog/guides/create-a-master-product.mdx +70 -0
- package/content/platform/catalog/guides/publish-or-reject-a-product.mdx +79 -0
- package/content/platform/catalog/overview.mdx +90 -0
- package/content/platform/catalog/reference/data-models.mdx +66 -0
- package/content/platform/catalog/reference/events.mdx +41 -0
- package/content/platform/catalog/reference/links.mdx +44 -0
- package/content/platform/catalog/reference/service.mdx +52 -0
- package/content/platform/catalog/reference/workflows.mdx +40 -0
- package/content/platform/commission/concepts/order-commission-lines.mdx +65 -0
- package/content/platform/commission/concepts/rule-matching.mdx +86 -0
- package/content/platform/commission/concepts/rules-and-rates.mdx +84 -0
- package/content/platform/commission/guides/batch-update-rules.mdx +58 -0
- package/content/platform/commission/guides/create-a-rate.mdx +72 -0
- package/content/platform/commission/guides/refresh-order-commission-lines.mdx +55 -0
- package/content/platform/commission/overview.mdx +86 -0
- package/content/platform/commission/reference/data-models.mdx +75 -0
- package/content/platform/commission/reference/events.mdx +58 -0
- package/content/platform/commission/reference/links.mdx +45 -0
- package/content/platform/commission/reference/service.mdx +51 -0
- package/content/platform/commission/reference/workflows.mdx +40 -0
- package/content/platform/offer/concepts/pricing-and-inventory.mdx +72 -0
- package/content/platform/offer/concepts/shipping.mdx +48 -0
- package/content/platform/offer/concepts/what-is-an-offer.mdx +65 -0
- package/content/platform/offer/guides/bulk-create-offers.mdx +84 -0
- package/content/platform/offer/guides/create-an-offer.mdx +83 -0
- package/content/platform/offer/guides/manage-offer-inventory.mdx +53 -0
- package/content/platform/offer/overview.mdx +84 -0
- package/content/platform/offer/reference/data-models.mdx +56 -0
- package/content/platform/offer/reference/events.mdx +39 -0
- package/content/platform/offer/reference/links.mdx +60 -0
- package/content/platform/offer/reference/service.mdx +53 -0
- package/content/platform/offer/reference/workflows.mdx +38 -0
- package/content/platform/order-group/concepts/computed-totals.mdx +59 -0
- package/content/platform/order-group/concepts/order-splitting.mdx +61 -0
- package/content/platform/order-group/concepts/the-order-group.mdx +64 -0
- package/content/platform/order-group/guides/list-order-groups.mdx +67 -0
- package/content/platform/order-group/guides/retrieve-an-order-group.mdx +63 -0
- package/content/platform/order-group/guides/split-a-cart.mdx +58 -0
- package/content/platform/order-group/overview.mdx +83 -0
- package/content/platform/order-group/reference/data-models.mdx +40 -0
- package/content/platform/order-group/reference/events.mdx +37 -0
- package/content/platform/order-group/reference/links.mdx +45 -0
- package/content/platform/order-group/reference/service.mdx +50 -0
- package/content/platform/order-group/reference/workflows.mdx +39 -0
- package/content/platform/payout/concepts/account-lifecycle.mdx +75 -0
- package/content/platform/payout/concepts/accounts-and-onboarding.mdx +70 -0
- package/content/platform/payout/concepts/payout-pipeline.mdx +99 -0
- package/content/platform/payout/guides/create-a-payout-account.mdx +59 -0
- package/content/platform/payout/guides/process-a-provider-webhook.mdx +74 -0
- package/content/platform/payout/guides/start-provider-onboarding.mdx +50 -0
- package/content/platform/payout/overview.mdx +86 -0
- package/content/platform/payout/reference/data-models.mdx +61 -0
- package/content/platform/payout/reference/events.mdx +48 -0
- package/content/platform/payout/reference/links.mdx +36 -0
- package/content/platform/payout/reference/service.mdx +53 -0
- package/content/platform/payout/reference/workflows.mdx +32 -0
- package/content/platform/product-edit/concepts/change-actions.mdx +66 -0
- package/content/platform/product-edit/concepts/change-pipeline.mdx +69 -0
- package/content/platform/product-edit/concepts/status-and-auto-confirm.mdx +66 -0
- package/content/platform/product-edit/guides/confirm-or-decline-a-change.mdx +76 -0
- package/content/platform/product-edit/guides/edit-a-product.mdx +74 -0
- package/content/platform/product-edit/guides/request-a-revision.mdx +54 -0
- package/content/platform/product-edit/overview.mdx +85 -0
- package/content/platform/product-edit/reference/data-models.mdx +65 -0
- package/content/platform/product-edit/reference/events.mdx +47 -0
- package/content/platform/product-edit/reference/links.mdx +39 -0
- package/content/platform/product-edit/reference/service.mdx +43 -0
- package/content/platform/product-edit/reference/workflows.mdx +49 -0
- package/content/platform/review/concepts/product-vs-seller-reviews.mdx +63 -0
- package/content/platform/review/concepts/ratings-and-moderation.mdx +64 -0
- package/content/platform/review/concepts/the-review-model.mdx +56 -0
- package/content/platform/review/guides/compute-aggregate-ratings.mdx +57 -0
- package/content/platform/review/guides/create-a-review.mdx +55 -0
- package/content/platform/review/guides/moderate-a-review.mdx +58 -0
- package/content/platform/review/guides/respond-to-a-review.mdx +61 -0
- package/content/platform/review/overview.mdx +87 -0
- package/content/platform/review/reference/data-models.mdx +36 -0
- package/content/platform/review/reference/events.mdx +61 -0
- package/content/platform/review/reference/links.mdx +43 -0
- package/content/platform/review/reference/service.mdx +54 -0
- package/content/platform/review/reference/workflows.mdx +31 -0
- package/content/platform/store/concepts/lifecycle.mdx +62 -0
- package/content/platform/store/concepts/store-entity.mdx +53 -0
- package/content/platform/store/concepts/team.mdx +50 -0
- package/content/platform/store/guides/create-a-store.mdx +55 -0
- package/content/platform/store/guides/manage-the-team.mdx +55 -0
- package/content/platform/store/guides/moderate-a-store.mdx +59 -0
- package/content/platform/store/overview.mdx +86 -0
- package/content/platform/store/reference/data-models.mdx +89 -0
- package/content/platform/store/reference/events.mdx +43 -0
- package/content/platform/store/reference/links.mdx +71 -0
- package/content/platform/store/reference/service.mdx +51 -0
- package/content/platform/store/reference/workflows.mdx +35 -0
- package/content/references/api/admin/commission-rates/create-commission-rate.mdx +1 -1
- package/content/references/api/admin/commission-rates/list-commission-rates.mdx +2 -2
- package/content/references/api/admin/commission-rates/update-commission-rate.mdx +1 -1
- package/content/references/api/admin/offers/batch-create-offers.mdx +3 -3
- package/content/references/api/admin/order-groups/list-order-groups.mdx +1 -1
- package/content/references/api/admin/product-attributes/create-attribute-value.mdx +2 -2
- package/content/references/api/admin/product-attributes/create-product-attribute.mdx +1 -1
- package/content/references/api/admin/product-attributes/update-product-attribute.mdx +1 -1
- package/content/references/api/admin/product-changes/confirm-product-change.mdx +1 -1
- package/content/references/api/admin/products/batch-product-attributes.mdx +1 -1
- package/content/references/api/admin/products/create-product.mdx +1 -1
- package/content/references/api/admin/products/preview-product.mdx +1 -1
- package/content/references/api/admin.mdx +4 -5
- package/content/references/api/conventions.mdx +9 -7
- package/content/references/api/store/carts/add-line-item.mdx +1 -1
- package/content/references/api/store/offers/list-offers.mdx +1 -1
- package/content/references/api/store/order-groups/list-order-groups.mdx +1 -1
- package/content/references/api/store.mdx +4 -13
- package/content/references/api/vendor/members/accept-member-invite.mdx +1 -1
- package/content/references/api/vendor/offers/batch-create-offers.mdx +4 -0
- package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +2 -0
- package/content/references/api/vendor/offers/create-offer.mdx +13 -1
- package/content/references/api/vendor/offers/list-offers.mdx +4 -0
- package/content/references/api/vendor/offers/retrieve-offer.mdx +4 -0
- package/content/references/api/vendor/offers/update-offer.mdx +12 -0
- package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +1 -1
- package/content/references/api/vendor/products/batch-product-attributes.mdx +1 -1
- package/content/references/api/vendor/products/create-product-variant.mdx +1 -1
- package/content/references/api/vendor/products/create-product.mdx +1 -1
- package/content/references/api/vendor/products/delete-product.mdx +1 -1
- package/content/references/api/vendor/products/update-product.mdx +1 -1
- package/content/references/api/vendor/sellers/create-seller.mdx +2 -2
- package/content/references/api/vendor/sellers/list-sellers.mdx +1 -1
- package/content/references/api/vendor.mdx +6 -5
- package/content/references/configuration.mdx +16 -33
- package/content/references/overview.mdx +34 -52
- package/content/references/panel-extensions/create-page.mdx +194 -0
- package/content/references/panel-extensions/custom-fields.mdx +256 -0
- package/content/references/panel-extensions/overview.mdx +102 -0
- package/content/references/panel-extensions/widgets.mdx +212 -0
- package/content/resources/ai/mcp.mdx +2 -2
- package/content/resources/ai/overview.mdx +21 -16
- package/content/resources/ai/skills.mdx +67 -0
- package/content/resources/best-practices/api-routes.mdx +55 -43
- package/content/resources/best-practices/custom-fields.mdx +116 -92
- package/content/resources/best-practices/frontend.mdx +62 -50
- package/content/resources/best-practices/module-links.mdx +48 -34
- package/content/resources/best-practices/modules.mdx +53 -27
- package/content/resources/best-practices/overview.mdx +45 -17
- package/content/resources/best-practices/subscribers-and-jobs.mdx +37 -24
- package/content/resources/best-practices/types.mdx +38 -23
- package/content/resources/best-practices/workflows.mdx +33 -21
- package/content/resources/customization/custom-fields.mdx +15 -15
- package/content/resources/customization/extend-a-workflow.mdx +7 -4
- package/content/resources/customization/extending-panels.mdx +55 -52
- package/content/resources/deployment/medusa-cloud.mdx +21 -20
- package/content/resources/deployment/self-host.mdx +123 -0
- package/content/resources/integrations/overview.mdx +38 -0
- package/content/resources/integrations/stripe-connect.mdx +39 -38
- package/content/resources/tutorials/add-a-block.mdx +25 -18
- package/content/resources/tutorials/add-a-widget.mdx +32 -23
- package/content/resources/tutorials/add-order-detail-button.mdx +33 -20
- package/content/resources/tutorials/attributes-and-variant-axes.mdx +28 -27
- package/content/resources/tutorials/build-a-block.mdx +26 -15
- package/content/resources/tutorials/custom-api-route.mdx +32 -20
- package/content/resources/tutorials/custom-panel-page.mdx +21 -12
- package/content/resources/tutorials/customize-navigation.mdx +30 -23
- package/content/resources/tutorials/extend-forms-and-tables.mdx +36 -28
- package/content/resources/tutorials/extend-onboarding.mdx +38 -35
- package/content/resources/tutorials/master-products-and-offers.mdx +28 -23
- package/content/telemetry.mdx +3 -3
- package/content/user-guide/admin/attributes/how-tos/create-an-attribute.mdx +64 -0
- package/content/user-guide/admin/attributes/how-tos/manage-possible-values.mdx +40 -0
- package/content/user-guide/admin/attributes/overview.mdx +22 -0
- package/content/user-guide/admin/commissions/how-tos/create-a-commission-rule.mdx +63 -0
- package/content/user-guide/admin/commissions/how-tos/edit-the-global-commission.mdx +48 -0
- package/content/user-guide/admin/commissions/how-tos/manage-a-commission-rule.mdx +45 -0
- package/content/user-guide/admin/commissions/overview.mdx +25 -0
- package/content/user-guide/admin/overview.mdx +20 -12
- package/content/user-guide/admin/product-requests/how-tos/review-a-new-product.mdx +58 -0
- package/content/user-guide/admin/product-requests/how-tos/review-a-product-edit.mdx +48 -0
- package/content/user-guide/admin/product-requests/overview.mdx +25 -0
- package/content/user-guide/vendor/offers/how-tos/create-an-offer.mdx +59 -0
- package/content/user-guide/vendor/offers/how-tos/update-prices-and-stock.mdx +40 -0
- package/content/user-guide/vendor/offers/overview.mdx +22 -0
- package/content/user-guide/vendor/onboarding.mdx +79 -0
- package/content/user-guide/vendor/orders/how-tos/fulfill-an-order.mdx +49 -0
- package/content/user-guide/vendor/orders/how-tos/mark-an-order-as-delivered.mdx +33 -0
- package/content/user-guide/vendor/orders/how-tos/process-a-return.mdx +42 -0
- package/content/user-guide/vendor/orders/how-tos/refund-an-order.mdx +38 -0
- package/content/user-guide/vendor/orders/how-tos/ship-an-order.mdx +40 -0
- package/content/user-guide/vendor/orders/overview.mdx +31 -0
- package/content/user-guide/vendor/overview.mdx +23 -12
- package/content/user-guide/vendor/products/how-tos/edit-a-product.mdx +44 -0
- package/content/user-guide/vendor/products/how-tos/submit-a-product.mdx +63 -0
- package/content/user-guide/vendor/products/overview.mdx +22 -0
- package/llms.txt +176 -142
- package/package.json +1 -1
- package/content/learn/concepts.mdx +0 -84
- package/content/learn/installation.mdx +0 -117
- package/content/learn/mirakl-alternative.mdx +0 -86
- package/content/migration/from-1-x-to-2-0.mdx +0 -152
- package/content/migration/from-2-0-to-2-1.mdx +0 -105
- package/content/migration/overview.mdx +0 -58
- package/content/references/api/store/search/search.mdx +0 -136
- package/content/references/modules/commission.mdx +0 -106
- package/content/references/modules/custom-fields.mdx +0 -45
- package/content/references/modules/media.mdx +0 -55
- package/content/references/modules/offer.mdx +0 -64
- package/content/references/modules/payout.mdx +0 -121
- package/content/references/modules/product-attribute.mdx +0 -111
- package/content/references/modules/product-edit.mdx +0 -80
- package/content/references/modules/search.mdx +0 -112
- package/content/references/modules/seller.mdx +0 -175
- package/content/references/panel-extension-api.mdx +0 -337
- package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +0 -48
- package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +0 -36
- package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +0 -39
- package/content/references/workflows/cart/update-cart-seller-promotions.mdx +0 -42
- package/content/references/workflows/commission/batch-commission-rules.mdx +0 -49
- package/content/references/workflows/commission/create-commission-rates.mdx +0 -41
- package/content/references/workflows/commission/delete-commission-rates.mdx +0 -34
- package/content/references/workflows/commission/refresh-order-commission-lines.mdx +0 -30
- package/content/references/workflows/commission/update-commission-rates.mdx +0 -35
- package/content/references/workflows/media/set-category-images.mdx +0 -41
- package/content/references/workflows/media/set-collection-images.mdx +0 -41
- package/content/references/workflows/member/accept-member-invite.mdx +0 -33
- package/content/references/workflows/member/add-seller-member.mdx +0 -30
- package/content/references/workflows/member/create-member-invites.mdx +0 -34
- package/content/references/workflows/member/delete-member-invite.mdx +0 -24
- package/content/references/workflows/member/remove-seller-member.mdx +0 -28
- package/content/references/workflows/member/resend-member-invite.mdx +0 -28
- package/content/references/workflows/member/update-member-role.mdx +0 -28
- package/content/references/workflows/member/update-member.mdx +0 -35
- package/content/references/workflows/offer/batch-offer-inventory-items.mdx +0 -62
- package/content/references/workflows/offer/create-offers.mdx +0 -65
- package/content/references/workflows/offer/delete-offers.mdx +0 -35
- package/content/references/workflows/offer/update-offers.mdx +0 -53
- package/content/references/workflows/order/cancel-order-fulfillment.mdx +0 -34
- package/content/references/workflows/order/confirm-claim-request.mdx +0 -25
- package/content/references/workflows/order/confirm-exchange-request.mdx +0 -25
- package/content/references/workflows/order/confirm-order-edit-request.mdx +0 -25
- package/content/references/workflows/order/confirm-return-receive.mdx +0 -25
- package/content/references/workflows/order/create-order-fulfillment.mdx +0 -45
- package/content/references/workflows/order-group/get-order-group-detail.mdx +0 -29
- package/content/references/workflows/order-group/get-order-groups-list.mdx +0 -38
- package/content/references/workflows/overview.mdx +0 -72
- package/content/references/workflows/payout/create-onboarding.mdx +0 -36
- package/content/references/workflows/payout/create-payout-account.mdx +0 -33
- package/content/references/workflows/payout/create-payout.mdx +0 -30
- package/content/references/workflows/payout/process-payout-for-webhook.mdx +0 -34
- package/content/references/workflows/product/confirm-products.mdx +0 -48
- package/content/references/workflows/product/create-products.mdx +0 -63
- package/content/references/workflows/product/link-sellers-to-product-category.mdx +0 -40
- package/content/references/workflows/product/link-sellers-to-product.mdx +0 -40
- package/content/references/workflows/product/reject-product.mdx +0 -48
- package/content/references/workflows/product/request-product-change.mdx +0 -48
- package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +0 -49
- package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +0 -46
- package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +0 -43
- package/content/references/workflows/product-attribute/create-product-attributes.mdx +0 -56
- package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +0 -30
- package/content/references/workflows/product-attribute/delete-product-attributes.mdx +0 -30
- package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +0 -29
- package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +0 -44
- package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +0 -41
- package/content/references/workflows/product-attribute/update-product-attributes.mdx +0 -48
- package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +0 -43
- package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +0 -39
- package/content/references/workflows/product-edit/cancel-product-change.mdx +0 -49
- package/content/references/workflows/product-edit/confirm-product-change.mdx +0 -57
- package/content/references/workflows/product-edit/create-product-change.mdx +0 -72
- package/content/references/workflows/product-edit/reject-product-change.mdx +0 -54
- package/content/references/workflows/product-edit/stage-product-change.mdx +0 -75
- package/content/references/workflows/seller/approve-seller.mdx +0 -36
- package/content/references/workflows/seller/create-seller-account.mdx +0 -59
- package/content/references/workflows/seller/create-seller-defaults.mdx +0 -22
- package/content/references/workflows/seller/create-sellers.mdx +0 -65
- package/content/references/workflows/seller/delete-seller-professional-details.mdx +0 -37
- package/content/references/workflows/seller/delete-sellers.mdx +0 -24
- package/content/references/workflows/seller/invite-seller.mdx +0 -28
- package/content/references/workflows/seller/suspend-seller.mdx +0 -37
- package/content/references/workflows/seller/terminate-seller.mdx +0 -37
- package/content/references/workflows/seller/unsuspend-seller.mdx +0 -36
- package/content/references/workflows/seller/unterminate-seller.mdx +0 -36
- package/content/references/workflows/seller/update-seller-address.mdx +0 -55
- package/content/references/workflows/seller/update-seller-payment-details.mdx +0 -52
- package/content/references/workflows/seller/update-seller-professional-details.mdx +0 -48
- package/content/references/workflows/seller/update-sellers.mdx +0 -57
- package/content/resources/ai/llms.mdx +0 -74
- package/content/resources/integrations/notifications.mdx +0 -39
- package/content/resources/integrations/search.mdx +0 -122
- package/content/resources/tutorials/configure-commissions.mdx +0 -127
- package/content/resources/tutorials/first-marketplace.mdx +0 -45
- package/content/resources/tutorials/handle-product-requests.mdx +0 -80
- package/content/resources/tutorials/import-export-products.mdx +0 -96
- package/content/resources/tutorials/seller-payouts-stripe.mdx +0 -89
- package/content/resources/tutorials/store-setup-checklist.mdx +0 -214
- package/content/tools/api-client.mdx +0 -155
- package/content/tools/cli.mdx +0 -196
- package/content/tools/dashboard-sdk.mdx +0 -35
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Search module"
|
|
3
|
-
description: "The provider-agnostic search module, its document shapes, and the provider contract."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The Search module is a **provider abstraction**: it owns no data models and wraps exactly one registered search provider behind three verbs — `index`, `remove`, `search`. Mercur ships a default in-process provider built on [Orama](https://oramasearch.com) that requires zero external infrastructure; operators can swap in Algolia, Meilisearch, or anything else by implementing the same contract.
|
|
7
|
-
|
|
8
|
-
Both **products** (master catalog entries) and **offers** (per-seller listings with offer-scoped prices) are indexed.
|
|
9
|
-
|
|
10
|
-
## Document shape
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
interface SearchDoc {
|
|
14
|
-
id: string
|
|
15
|
-
type: "product" | "offer"
|
|
16
|
-
title: string
|
|
17
|
-
description?: string
|
|
18
|
-
handle: string
|
|
19
|
-
thumbnail?: string
|
|
20
|
-
seller_handle?: string // offers only
|
|
21
|
-
collection_id?: string
|
|
22
|
-
collection?: string
|
|
23
|
-
category_ids?: string[]
|
|
24
|
-
categories?: string[]
|
|
25
|
-
product_id?: string // offers
|
|
26
|
-
variant_id?: string // offers
|
|
27
|
-
sku?: string // offers
|
|
28
|
-
attribute_tokens: string[] // facetable: "attr:<handle>:<value_id>"
|
|
29
|
-
attributes: Record<string, string> // stored label map
|
|
30
|
-
prices: Record<string, SearchDocPrice> // keyed by region_id, stored not indexed
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Prices are **stored, not searched**: each document carries a per-region price map (`calculated_amount`, `original_amount`, `currency_code`), and the provider projects `calculated_price` for the requested region at query time. Suspended sellers' offers and unpublished products are excluded at index time. Attributes flagged `is_filterable` are tokenized into `attribute_tokens` for faceting.
|
|
35
|
-
|
|
36
|
-
## Query and results
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
interface SearchQueryBase {
|
|
40
|
-
q?: string
|
|
41
|
-
limit?: number
|
|
42
|
-
offset?: number
|
|
43
|
-
context?: Record<string, unknown> // pricing/display context, not a filter
|
|
44
|
-
filters?: Record<string, unknown> // provider-owned shape
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface SearchResults {
|
|
48
|
-
hits: SearchDoc[]
|
|
49
|
-
count: number
|
|
50
|
-
facets: { collections; categories; attributes } // pre-labelled by the provider
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`filters` is an open passthrough — each provider defines its own filter shape. The built-in Orama provider accepts:
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
filters?: {
|
|
58
|
-
type?: "product" | "offer"
|
|
59
|
-
collection_ids?: string[]
|
|
60
|
-
category_ids?: string[]
|
|
61
|
-
seller_handle?: string
|
|
62
|
-
attributes?: Record<string, string[]> // attribute handle -> selected value ids
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Service
|
|
67
|
-
|
|
68
|
-
`SearchModuleService` exposes:
|
|
69
|
-
|
|
70
|
-
| Method | Behavior |
|
|
71
|
-
| --- | --- |
|
|
72
|
-
| `index(docs)` | Upserts documents into the provider index |
|
|
73
|
-
| `remove(ids)` | Removes documents by ID |
|
|
74
|
-
| `search(query)` | Runs a query against the provider |
|
|
75
|
-
| `getProviderIdentifier()` | Returns the active provider's identifier |
|
|
76
|
-
|
|
77
|
-
## Provider contract
|
|
78
|
-
|
|
79
|
-
Implement `AbstractSearchProvider` (exported from the module) and register it via the module's `provider` option. Exactly one provider must be registered — the module throws at boot otherwise. If no provider is configured, the Orama provider registers automatically.
|
|
80
|
-
|
|
81
|
-
```ts
|
|
82
|
-
abstract class AbstractSearchProvider<TQuery extends SearchQueryBase> {
|
|
83
|
-
static identifier: string
|
|
84
|
-
abstract index(docs: SearchDoc[]): Promise<void>
|
|
85
|
-
abstract remove(ids: string[]): Promise<void>
|
|
86
|
-
abstract search(query: TQuery): Promise<SearchResults>
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
<Warning>
|
|
91
|
-
The built-in Orama provider holds its index **in process memory**. It starts
|
|
92
|
-
empty, is rebuilt on boot via the reindex event, and does not share state
|
|
93
|
-
across processes. For multi-instance deployments, use an external provider.
|
|
94
|
-
</Warning>
|
|
95
|
-
|
|
96
|
-
## Index synchronization
|
|
97
|
-
|
|
98
|
-
Sync is event-driven — there are no search workflows:
|
|
99
|
-
|
|
100
|
-
- Subscribers react to product, offer, and seller changes (`search-product-changed`, `search-product-deleted`, `search-offer-changed`, `search-seller-changed`) and reindex or remove the affected documents.
|
|
101
|
-
- A full rebuild runs when the `search.reindex` event (`SEARCH_REINDEX_EVENT`) is emitted; in worker mode the module emits it automatically on application start.
|
|
102
|
-
|
|
103
|
-
## Related endpoints
|
|
104
|
-
|
|
105
|
-
`POST /store/search` — the storefront query route. Body: `q`, `limit` (default 12, max 100), `offset`, `region_id` / `country_code` / `province` (pricing context), and the provider-owned `filters`. Responds with `{ hits, count, limit, offset, facets }`. Customer authentication is optional.
|
|
106
|
-
|
|
107
|
-
## Next steps
|
|
108
|
-
|
|
109
|
-
<CardGroup cols={2}>
|
|
110
|
-
<Card title="Search integrations" href="/rc/resources/integrations/search" />
|
|
111
|
-
<Card title="Store API" href="/rc/references/api/store" />
|
|
112
|
-
</CardGroup>
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Seller module"
|
|
3
|
-
description: "Data models, links, and service methods for the Seller module."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The Seller module owns the marketplace vendor domain: the seller entity and its satellite records (professional details, address, payment details), the seller's team (members and pending invites), and the **order group** — the aggregate that binds the per-seller orders created from a single multi-vendor cart.
|
|
7
|
-
|
|
8
|
-
For the conceptual introduction, see [Sellers](/rc/learn/sellers), [Seller members](/rc/learn/seller-members), and [Order groups](/rc/learn/order-groups).
|
|
9
|
-
|
|
10
|
-
## Data models
|
|
11
|
-
|
|
12
|
-
### `Seller`
|
|
13
|
-
|
|
14
|
-
Table `seller`, ID prefix `sel`.
|
|
15
|
-
|
|
16
|
-
| Field | Type | Notes |
|
|
17
|
-
| --- | --- | --- |
|
|
18
|
-
| `id` | text | Primary key |
|
|
19
|
-
| `name` | text | Unique, searchable |
|
|
20
|
-
| `handle` | text | Unique, URL-friendly; auto-generated from `name` when omitted |
|
|
21
|
-
| `email` | text | Unique, searchable |
|
|
22
|
-
| `phone` | text | Nullable |
|
|
23
|
-
| `description` | text | Nullable |
|
|
24
|
-
| `logo` | text | Nullable |
|
|
25
|
-
| `banner` | text | Nullable |
|
|
26
|
-
| `website_url` | text | Nullable |
|
|
27
|
-
| `external_id` | text | Nullable; unique when set |
|
|
28
|
-
| `currency_code` | text | The seller's single operating currency |
|
|
29
|
-
| `status` | enum | `SellerStatus`, default `pending_approval` |
|
|
30
|
-
| `status_reason` | text | Nullable |
|
|
31
|
-
| `approved_at` | dateTime | Nullable |
|
|
32
|
-
| `rejected_at` | dateTime | Nullable |
|
|
33
|
-
| `is_premium` | boolean | Default `false`; operator-set only |
|
|
34
|
-
| `closed_from` / `closed_to` | dateTime | Nullable; scheduled closure window |
|
|
35
|
-
| `closure_note` | text | Nullable |
|
|
36
|
-
| `metadata` | json | Nullable |
|
|
37
|
-
|
|
38
|
-
Relations: `professional_details`, `address`, and `payment_details` (one-to-one, deleted with the seller), `members` (many-to-many through `SellerMember`), `member_invites` (one-to-many, deleted with the seller).
|
|
39
|
-
|
|
40
|
-
### `ProfessionalDetails`
|
|
41
|
-
|
|
42
|
-
Table `professional_details`, ID prefix `selprodet`. Presence of this record marks the seller as a registered business.
|
|
43
|
-
|
|
44
|
-
| Field | Type |
|
|
45
|
-
| --- | --- |
|
|
46
|
-
| `corporate_name` | text, nullable |
|
|
47
|
-
| `registration_number` | text, nullable |
|
|
48
|
-
| `tax_id` | text, nullable |
|
|
49
|
-
|
|
50
|
-
### `SellerAddress`
|
|
51
|
-
|
|
52
|
-
Table `seller_address`, ID prefix `seladdr`. Fields: `name`, `company`, `first_name`, `last_name`, `address_1`, `address_2`, `city`, `country_code`, `province`, `postal_code`, `phone`, `metadata` — all nullable.
|
|
53
|
-
|
|
54
|
-
### `PaymentDetails`
|
|
55
|
-
|
|
56
|
-
Table `payment_details`, ID prefix `selpaydet`. Fields: `country_code`, `holder_name`, `bank_name`, `iban`, `bic`, `routing_number`, `account_number` — all nullable.
|
|
57
|
-
|
|
58
|
-
### `Member`
|
|
59
|
-
|
|
60
|
-
Table `member`, ID prefix `mem`. A member is a dashboard user that can belong to one or more sellers.
|
|
61
|
-
|
|
62
|
-
| Field | Type | Notes |
|
|
63
|
-
| --- | --- | --- |
|
|
64
|
-
| `email` | text | Unique, searchable |
|
|
65
|
-
| `first_name` / `last_name` | text | Nullable |
|
|
66
|
-
| `locale` | text | Nullable |
|
|
67
|
-
| `is_active` | boolean | Default `true` |
|
|
68
|
-
| `metadata` | json | Nullable |
|
|
69
|
-
|
|
70
|
-
### `SellerMember`
|
|
71
|
-
|
|
72
|
-
Table `seller_member`, ID prefix `selmem`. Pivot between `Seller` and `Member`; unique on (`seller_id`, `member_id`).
|
|
73
|
-
|
|
74
|
-
| Field | Type | Notes |
|
|
75
|
-
| --- | --- | --- |
|
|
76
|
-
| `role_id` | text | Nullable; resolved against the RBAC roles module |
|
|
77
|
-
| `is_owner` | boolean | Default `false` |
|
|
78
|
-
| `metadata` | json | Nullable |
|
|
79
|
-
|
|
80
|
-
### `MemberInvite`
|
|
81
|
-
|
|
82
|
-
Table `member_invite`, ID prefix `meminv`. Unique on (`email`, `seller_id`) while unaccepted.
|
|
83
|
-
|
|
84
|
-
| Field | Type | Notes |
|
|
85
|
-
| --- | --- | --- |
|
|
86
|
-
| `email` | text | Searchable |
|
|
87
|
-
| `token` | text | Signed JWT |
|
|
88
|
-
| `accepted` | boolean | Default `false` |
|
|
89
|
-
| `expires_at` | dateTime | Derived from `invite_valid_duration` |
|
|
90
|
-
| `role_id` | text | Role assigned on acceptance |
|
|
91
|
-
| `metadata` | json | Nullable |
|
|
92
|
-
|
|
93
|
-
### `OrderGroup`
|
|
94
|
-
|
|
95
|
-
Table `order_group`, ID prefix `og`. Created when a multi-vendor cart completes.
|
|
96
|
-
|
|
97
|
-
| Field | Type | Notes |
|
|
98
|
-
| --- | --- | --- |
|
|
99
|
-
| `display_id` | autoincrement | Shopper-facing number |
|
|
100
|
-
| `cart_id` | text | The originating cart |
|
|
101
|
-
| `customer_id` | text | Nullable |
|
|
102
|
-
| `seller_count` | number | Computed |
|
|
103
|
-
| `total` | bigNumber | Computed across child orders |
|
|
104
|
-
|
|
105
|
-
## Enums
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
enum SellerStatus {
|
|
109
|
-
OPEN = "open",
|
|
110
|
-
PENDING_APPROVAL = "pending_approval",
|
|
111
|
-
SUSPENDED = "suspended",
|
|
112
|
-
TERMINATED = "terminated",
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
enum SellerRole {
|
|
116
|
-
SELLER_ADMINISTRATION = "role_seller_administration",
|
|
117
|
-
INVENTORY_MANAGEMENT = "role_seller_inventory_management",
|
|
118
|
-
ORDER_MANAGEMENT = "role_seller_order_management",
|
|
119
|
-
ACCOUNTING = "role_seller_accounting",
|
|
120
|
-
SUPPORT = "role_seller_support",
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Links
|
|
125
|
-
|
|
126
|
-
The seller is the anchor of the marketplace graph. Nearly every seller-scoped resource is connected through a module link rather than a foreign key:
|
|
127
|
-
|
|
128
|
-
| Linked entity | Cardinality | Purpose |
|
|
129
|
-
| --- | --- | --- |
|
|
130
|
-
| `Product.product` | many-to-many (`product_seller`) | Selling-eligibility allowlist for [master products](/rc/references/modules/product-edit) |
|
|
131
|
-
| `Order.order` | one seller — many orders | Per-seller child orders |
|
|
132
|
-
| `Payout.payout` | one seller — many payouts | Settlements |
|
|
133
|
-
| `Payout.payoutAccount` | one-to-one | The seller's provider account |
|
|
134
|
-
| `Pricing.priceList` | one seller — many lists | Vendor price lists |
|
|
135
|
-
| `Promotion.promotion` / `Promotion.campaign` | one seller — many | Vendor promotions and campaigns |
|
|
136
|
-
| `Inventory.inventoryItem` | one seller — many items | Vendor inventory |
|
|
137
|
-
| `StockLocation.stockLocation` | one seller — many | Vendor locations |
|
|
138
|
-
| `Fulfillment.shippingProfile` / `shippingOption` / `fulfillmentSet` / `serviceZone` | one seller — many | Vendor shipping setup |
|
|
139
|
-
| `Customer.customer` / `customerGroup` | many-to-many / one seller — many | Vendor customer base |
|
|
140
|
-
| `Product.productCategory` | many-to-many | Categories a seller may sell in |
|
|
141
|
-
|
|
142
|
-
Order groups carry two additional links: a read-only link to the originating `Cart` (via `cart_id`) and a list link to the child `Order` records (table `order_group_order`). The `SellerMember.role_id` field is a read-only link into the RBAC roles module.
|
|
143
|
-
|
|
144
|
-
## Service
|
|
145
|
-
|
|
146
|
-
`SellerModuleService` extends `MedusaService` with auto-generated CRUD for all models above, plus:
|
|
147
|
-
|
|
148
|
-
| Method | Behavior |
|
|
149
|
-
| --- | --- |
|
|
150
|
-
| `createSellers(data)` / `updateSellers(data)` | Validates the handle and auto-generates it from `name` when missing |
|
|
151
|
-
| `upsertMembers(data)` | Dedupes by email, creates missing members, backfills empty names; returns members in input order |
|
|
152
|
-
| `createMemberInvites(data)` | Rejects emails that already belong to the seller; issues a JWT token with an expiry |
|
|
153
|
-
| `validateMemberInviteToken(token)` | Verifies the JWT and rejects accepted or expired invites |
|
|
154
|
-
| `listOrderGroups` / `listAndCountOrderGroups` / `retrieveOrderGroup` | Custom repository-backed reads that resolve the computed `seller_count` and `total` fields |
|
|
155
|
-
|
|
156
|
-
## Module options
|
|
157
|
-
|
|
158
|
-
| Option | Type | Default | Purpose |
|
|
159
|
-
| --- | --- | --- | --- |
|
|
160
|
-
| `invite_valid_duration` | number (seconds) | 7 days | Member invite lifetime |
|
|
161
|
-
| `jwt_secret` | string | project `http.jwtSecret` | Signs invite tokens |
|
|
162
|
-
| `vendor_url` | string | `MERCUR_VENDOR_URL` env var | Vendor dashboard base URL used in invite links |
|
|
163
|
-
|
|
164
|
-
## Related endpoints
|
|
165
|
-
|
|
166
|
-
- [Admin API — sellers, members, order groups](/rc/references/api/admin)
|
|
167
|
-
- [Vendor API — sellers, members](/rc/references/api/vendor)
|
|
168
|
-
- [Store API — public seller storefronts](/rc/references/api/store)
|
|
169
|
-
|
|
170
|
-
## Next steps
|
|
171
|
-
|
|
172
|
-
<CardGroup cols={2}>
|
|
173
|
-
<Card title="Commission module" href="/rc/references/modules/commission" />
|
|
174
|
-
<Card title="Payout module" href="/rc/references/modules/payout" />
|
|
175
|
-
</CardGroup>
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Panel Extension API"
|
|
3
|
-
description: "The file-based helpers for extending the admin and vendor panels — defineWidgetConfig, defineNavigationConfig, defineCustomFieldsConfig, createFormHelper — and the exact props passed to every component you supply."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This is the technical contract for the panel extension API.
|
|
7
|
-
Where the [Extend forms and tables](/rc/resources/tutorials/extend-forms-and-tables),
|
|
8
|
-
[Add a widget](/rc/resources/tutorials/add-a-widget), and
|
|
9
|
-
[Customize navigation](/rc/resources/tutorials/customize-navigation) tutorials
|
|
10
|
-
walk through *building* an extension, this page documents the exact config shape
|
|
11
|
-
of each helper and — most importantly — **the props each `component` you pass in
|
|
12
|
-
receives at render time**.
|
|
13
|
-
|
|
14
|
-
<Info>
|
|
15
|
-
**Separate apps, no `surface` field.** Admin (`@mercurjs/admin`, port 7000) and
|
|
16
|
-
vendor (`@mercurjs/vendor`, port 7001) are separate Vite apps. A file dropped
|
|
17
|
-
under a panel's `src/` targets *that* panel — the folder you author in *is* the
|
|
18
|
-
surface. The helpers are the same in both; import them from
|
|
19
|
-
`@mercurjs/dashboard-sdk` (config helpers) and `@mercurjs/dashboard-shared`
|
|
20
|
-
(`createFormHelper`).
|
|
21
|
-
</Info>
|
|
22
|
-
|
|
23
|
-
## Typed targets (register once)
|
|
24
|
-
|
|
25
|
-
Zone ids, nav item ids, models, and built-in field ids are typed per panel from a
|
|
26
|
-
generated `extension-targets.d.ts`. Reference it once per host app so every
|
|
27
|
-
extension file type-checks with no per-file import:
|
|
28
|
-
|
|
29
|
-
```typescript apps/vendor/src/extension-targets.d.ts
|
|
30
|
-
/// <reference types="@mercurjs/vendor/extension-targets" />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```typescript apps/admin-test/src/extension-targets.d.ts
|
|
34
|
-
/// <reference types="@mercurjs/admin/extension-targets" />
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
A wrong `zone`, `model`, or nav `id` fails `tsc` (`bun run lint`) rather than
|
|
38
|
-
silently no-op'ing at runtime.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## `defineWidgetConfig`
|
|
43
|
-
|
|
44
|
-
A widget is a React component attached to a named zone on a built-in page. The
|
|
45
|
-
placement (`before | after | replace`) is the last segment of the zone id.
|
|
46
|
-
|
|
47
|
-
```tsx apps/vendor/src/widgets/product-list-banner.tsx
|
|
48
|
-
import { defineWidgetConfig } from "@mercurjs/dashboard-sdk"
|
|
49
|
-
|
|
50
|
-
export const config = defineWidgetConfig({
|
|
51
|
-
zone: "product.list.before", // WidgetZoneId — <domain>.<view>[.<slot>].<before|after|replace>
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
export default ProductListBanner
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Config
|
|
58
|
-
|
|
59
|
-
| Field | Type | Description |
|
|
60
|
-
| ------ | ------------------------------- | --------------------------------------------------------------------------- |
|
|
61
|
-
| `zone` | `WidgetZoneId \| WidgetZoneId[]` | Target zone(s). Placement is the suffix. Multiple widgets stack in order. |
|
|
62
|
-
| `id` | `string` (optional) | Stable id; derived from the file path at build time when omitted. |
|
|
63
|
-
|
|
64
|
-
### Component props
|
|
65
|
-
|
|
66
|
-
The widget component receives a single prop:
|
|
67
|
-
|
|
68
|
-
| Prop | Type | Description |
|
|
69
|
-
| ------ | --------- | ----------------------------------------------------------------------------------------- |
|
|
70
|
-
| `data` | `unknown` | The zone's contextual entity — e.g. the loaded product on a `product.detail.*` zone. Undefined on list/public zones that have no single entity. |
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
const ProductDetailNote = ({ data }: { data?: HttpTypes.AdminProduct }) => (
|
|
74
|
-
<Container>{data?.title}</Container>
|
|
75
|
-
)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
<Note>
|
|
79
|
-
The public `login.logo` / `login.before` / `login.after` zones render before
|
|
80
|
-
authentication and receive no `data`.
|
|
81
|
-
</Note>
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## `defineNavigationConfig`
|
|
86
|
-
|
|
87
|
-
Reorder, hide, relabel, or re-parent **built-in** sidebar items. Single
|
|
88
|
-
host-owned file — blocks cannot contribute nav overrides.
|
|
89
|
-
|
|
90
|
-
```ts apps/vendor/src/_navigation.ts
|
|
91
|
-
import { defineNavigationConfig } from "@mercurjs/dashboard-sdk"
|
|
92
|
-
|
|
93
|
-
export default defineNavigationConfig({
|
|
94
|
-
items: [
|
|
95
|
-
{ id: "orders", rank: 0 },
|
|
96
|
-
{ id: "price-lists", hidden: true },
|
|
97
|
-
{ id: "payouts", label: "settlements" },
|
|
98
|
-
{ id: "categories", nested: null, rank: 1 },
|
|
99
|
-
{ id: "campaigns", nested: "orders" },
|
|
100
|
-
],
|
|
101
|
-
})
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### `NavItemOverride`
|
|
105
|
-
|
|
106
|
-
| Field | Type | Description |
|
|
107
|
-
| -------- | -------------------------- | ------------------------------------------------------------------------------ |
|
|
108
|
-
| `id` | `NavItemId` | Built-in item to override (top-level or nested). Typed against the panel registry. |
|
|
109
|
-
| `rank` | `number` (optional) | Order within the item's parent (or among top-level items). |
|
|
110
|
-
| `hidden` | `boolean` (optional) | Remove from the sidebar (route may still be directly reachable). |
|
|
111
|
-
| `label` | `string` (optional) | i18n key or literal replacing the item's label. |
|
|
112
|
-
| `icon` | `ComponentType` (optional) | Icon component replacing the item's icon (from `@medusajs/icons`). |
|
|
113
|
-
| `nested` | `NavParentId \| null` (optional) | Re-parent under a built-in parent id; `null` promotes a nested item to top level. |
|
|
114
|
-
|
|
115
|
-
There is no `component` prop here — navigation overrides reshape existing items
|
|
116
|
-
only.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## `defineCustomFieldsConfig`
|
|
121
|
-
|
|
122
|
-
The model-scoped surface. One file per model adds form fields, section displays,
|
|
123
|
-
section actions, and list-table columns. Import
|
|
124
|
-
`createFormHelper` from `@mercurjs/dashboard-shared` to turn a Zod schema into an
|
|
125
|
-
input type + validation.
|
|
126
|
-
|
|
127
|
-
```tsx apps/vendor/src/custom-fields/product.tsx
|
|
128
|
-
import { defineCustomFieldsConfig } from "@mercurjs/dashboard-sdk"
|
|
129
|
-
import { createFormHelper } from "@mercurjs/dashboard-shared"
|
|
130
|
-
|
|
131
|
-
type ProductWithMeta = { metadata?: Record<string, unknown> }
|
|
132
|
-
const form = createFormHelper<ProductWithMeta>()
|
|
133
|
-
|
|
134
|
-
export default defineCustomFieldsConfig({
|
|
135
|
-
model: "product",
|
|
136
|
-
link: "brand", // string | string[] — module link(s) fetched alongside the entity
|
|
137
|
-
forms: [/* ... */],
|
|
138
|
-
displays: [/* ... */],
|
|
139
|
-
list: {/* ... */},
|
|
140
|
-
})
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Top-level config
|
|
144
|
-
|
|
145
|
-
| Field | Type | Description |
|
|
146
|
-
| ---------- | ------------------------ | ------------------------------------------------------------------------ |
|
|
147
|
-
| `model` | `CustomFieldModel` | Target model (start with `"product"`). Typed against `CustomFieldsRegistry`. |
|
|
148
|
-
| `link` | `string \| string[]` | Module link(s) fetched alongside the entity; their data is available to columns and displays via the `+link.*` fetch. |
|
|
149
|
-
| `forms` | `CustomFormEntry[]` | Fields injected into built-in create/edit/onboarding forms. |
|
|
150
|
-
| `displays` | `CustomDisplayEntry[]` | Field replace/remove/add + `ActionMenu` actions on detail sections. |
|
|
151
|
-
| `list` | `CustomListExtension` | Columns, bulk actions, filters, view defaults on the model's list table. |
|
|
152
|
-
|
|
153
|
-
### `forms[]` — form fields
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
forms: [
|
|
157
|
-
{
|
|
158
|
-
zone: "edit", // CustomFormZone — "create" | "edit" | "organize" | "attributes" | "onboarding"
|
|
159
|
-
tab: "general", // TabbedForm tab id, or wizard step id for zone: "onboarding"
|
|
160
|
-
fields: {
|
|
161
|
-
erp_id: form.define({
|
|
162
|
-
validation: form.string().nullish(), // Zod → input type + validation
|
|
163
|
-
defaultValue: (data) => (data?.metadata?.erp_id as string) ?? "",
|
|
164
|
-
label: "ERP ID",
|
|
165
|
-
description: "External system identifier",
|
|
166
|
-
placeholder: "ERP-000",
|
|
167
|
-
component: MyErpInput, // optional custom render
|
|
168
|
-
}),
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
]
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Each field is a `CustomFormField`:
|
|
175
|
-
|
|
176
|
-
| Field | Type | Description |
|
|
177
|
-
| -------------- | ---------------------------------------- | ----------------------------------------------------------------- |
|
|
178
|
-
| `validation` | Zod schema | Drives both the default input type and validation. |
|
|
179
|
-
| `defaultValue` | `unknown \| ((data) => unknown)` | Static value or a resolver from the loaded entity. |
|
|
180
|
-
| `label` | `string` (optional) | Field label. |
|
|
181
|
-
| `description` | `string` (optional) | Help text below the input. |
|
|
182
|
-
| `placeholder` | `string` (optional) | Input placeholder. |
|
|
183
|
-
| `component` | `ComponentType` (optional) | Custom render; falls back to a default input for the Zod type. |
|
|
184
|
-
|
|
185
|
-
<Warning>
|
|
186
|
-
**Form-field `component` receives no props.** It is rendered as `<Component />`
|
|
187
|
-
inside the field's `additional_data.<field>` React Hook Form context. Read and
|
|
188
|
-
write the value with RHF's `useFormContext()` / `useController()`, and render
|
|
189
|
-
through the mandated `Form.Field → Form.Item` chain — do not use a raw
|
|
190
|
-
`Controller`. Values live in form state under `additional_data`; in the MVP,
|
|
191
|
-
`product` custom fields persist onto the product's `metadata`.
|
|
192
|
-
</Warning>
|
|
193
|
-
|
|
194
|
-
### `displays[]` — detail sections
|
|
195
|
-
|
|
196
|
-
```tsx
|
|
197
|
-
displays: [
|
|
198
|
-
{
|
|
199
|
-
zone: "general", // CustomFieldsRegistry displayZones — an existing detail section id
|
|
200
|
-
fields: [
|
|
201
|
-
{ id: "erp_id", component: ErpRow }, // ADD (unknown id → new read-only row)
|
|
202
|
-
{ id: "status", component: BrandedStatusBadge }, // REPLACE a built-in field's render
|
|
203
|
-
{ id: "created_by", component: null }, // REMOVE a built-in field
|
|
204
|
-
],
|
|
205
|
-
actions: [
|
|
206
|
-
{ rank: 0, component: SyncErpAction }, // add to the section's ActionMenu
|
|
207
|
-
],
|
|
208
|
-
},
|
|
209
|
-
]
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
`fields[]` is `CustomDisplayField`:
|
|
213
|
-
|
|
214
|
-
| Field | Type | Description |
|
|
215
|
-
| ----------- | --------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
216
|
-
| `id` | `displayFieldIds \| (string & {})` | Built-in field id (autocompletes) → replace/remove; any other string → add a new row. |
|
|
217
|
-
| `component` | `ComponentType<{ data? }> \| null` | Render component, or `null` to remove a built-in field. |
|
|
218
|
-
|
|
219
|
-
**Display field `component` props:**
|
|
220
|
-
|
|
221
|
-
| Prop | Type | Description |
|
|
222
|
-
| ------ | --------- | ---------------------------------- |
|
|
223
|
-
| `data` | `unknown` | The loaded detail entity, **including any `link`ed module data**. If the config declares `link: "brand"`, read it off `data.brand` here. |
|
|
224
|
-
|
|
225
|
-
```tsx
|
|
226
|
-
// with `link: "brand"` on the config, the linked module data rides on `data`
|
|
227
|
-
const BrandRow = ({ data }: { data?: { brand?: { name: string } } }) => (
|
|
228
|
-
<Text>{data?.brand?.name}</Text>
|
|
229
|
-
)
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
`actions[]` is `SectionAction` (the same shape as list `bulkActions`):
|
|
233
|
-
|
|
234
|
-
| Field | Type | Description |
|
|
235
|
-
| ----------- | ------------------------------- | ----------------------------------------------------------------- |
|
|
236
|
-
| `rank` | `number` (optional) | Position within the section's `ActionMenu`. |
|
|
237
|
-
| `component` | `ComponentType<{ data? }>` | Owns its own label, icon, group placement, and `onClick`. |
|
|
238
|
-
|
|
239
|
-
**Section-action `component` props:**
|
|
240
|
-
|
|
241
|
-
| Prop | Type | Description |
|
|
242
|
-
| ------ | --------- | ----------------------------------------------------------------------- |
|
|
243
|
-
| `data` | `unknown` | The loaded detail entity, **including any `link`ed module data** (e.g. `data.brand`). |
|
|
244
|
-
|
|
245
|
-
### `list` — list table
|
|
246
|
-
|
|
247
|
-
```tsx
|
|
248
|
-
list: {
|
|
249
|
-
columns: [
|
|
250
|
-
{ id: "title", component: ({ value }) => <strong>{value}</strong> }, // override a cell
|
|
251
|
-
{ id: "brand_name", header: "Brand", component: ({ row }) => row.brand?.name }, // add (from link)
|
|
252
|
-
],
|
|
253
|
-
bulkActions: [{ rank: 0, component: ArchiveBulkAction }],
|
|
254
|
-
filters: [/* add / remove list filters */],
|
|
255
|
-
viewDefaults: {
|
|
256
|
-
columnVisibility: { created_at: false }, // hide a column
|
|
257
|
-
columnOrder: ["title", "sku", "erp_id"],
|
|
258
|
-
},
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
`columns[]` is `CustomColumn`:
|
|
263
|
-
|
|
264
|
-
| Field | Type | Description |
|
|
265
|
-
| ----------- | ------------------------------------------ | -------------------------------------------------------- |
|
|
266
|
-
| `id` | `string` | Column id — matches a built-in column to override, or adds a new one. |
|
|
267
|
-
| `header` | `string` (optional) | Column header text (for added columns). |
|
|
268
|
-
| `component` | `ComponentType<{ row?, value? }>` (optional) | Cell renderer. |
|
|
269
|
-
|
|
270
|
-
**Column `component` props:**
|
|
271
|
-
|
|
272
|
-
| Prop | Type | Description |
|
|
273
|
-
| ------- | --------- | -------------------------------------------------------- |
|
|
274
|
-
| `row` | `unknown` | The full row entity (including `link`ed module data). |
|
|
275
|
-
| `value` | `unknown` | The cell value for this column id, when derivable. |
|
|
276
|
-
|
|
277
|
-
`bulkActions[]` is `SectionAction` (`{ rank?, component }`, component props `{ data? }`).
|
|
278
|
-
|
|
279
|
-
<Note>
|
|
280
|
-
**Bulk-action rendering is deferred in the MVP.** `bulkActions` are accepted and
|
|
281
|
-
surfaced by the config but not yet mounted into the list toolbar.
|
|
282
|
-
</Note>
|
|
283
|
-
|
|
284
|
-
<Warning>
|
|
285
|
-
**Vendor product list is field-constrained.** The vendor `product` list must use
|
|
286
|
-
the curated fields from `useProductTableQuery` — the SDK merges `link` fetches
|
|
287
|
-
with the `+`/`-` convention, never bare fields, or the list 500s. You never
|
|
288
|
-
hand-write the field list; the `link` declaration drives it.
|
|
289
|
-
</Warning>
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
## `createFormHelper`
|
|
294
|
-
|
|
295
|
-
`createFormHelper<T>()` returns Medusa's zod surface for describing field
|
|
296
|
-
validation and value types:
|
|
297
|
-
|
|
298
|
-
```ts
|
|
299
|
-
const form = createFormHelper<ProductWithMeta>()
|
|
300
|
-
|
|
301
|
-
form.define({ validation, defaultValue?, label?, description?, placeholder?, component? })
|
|
302
|
-
form.string() / form.number() / form.boolean() / form.date()
|
|
303
|
-
form.array() / form.object() / form.null() / form.nullable() / form.coerce
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
The generated registry types the **target** (which zone/tab/field ids exist); the
|
|
307
|
-
Zod `validation` types the **value**. The two compose — codegen types the address,
|
|
308
|
-
Zod types the payload.
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## Persistence
|
|
313
|
-
|
|
314
|
-
<Warning>
|
|
315
|
-
**The MVP is a UI surface only.** Custom fields render, validate, and display
|
|
316
|
-
through the built-in forms/sections/tables — there is no generic core-side write
|
|
317
|
-
path. For `product`, values are submitted under `additional_data` and persisted
|
|
318
|
-
onto `metadata`. To store data for other models, wire your own route/workflow or
|
|
319
|
-
use the backend [Custom Fields module](/rc/resources/customization/custom-fields).
|
|
320
|
-
</Warning>
|
|
321
|
-
|
|
322
|
-
## Related
|
|
323
|
-
|
|
324
|
-
<CardGroup cols={2}>
|
|
325
|
-
<Card title="Extend forms and tables" href="/rc/resources/tutorials/extend-forms-and-tables">
|
|
326
|
-
Step-by-step build with `defineCustomFieldsConfig`.
|
|
327
|
-
</Card>
|
|
328
|
-
<Card title="Add a widget" href="/rc/resources/tutorials/add-a-widget">
|
|
329
|
-
Inject a component into a zone.
|
|
330
|
-
</Card>
|
|
331
|
-
<Card title="Customize navigation" href="/rc/resources/tutorials/customize-navigation">
|
|
332
|
-
Reorder and hide sidebar items.
|
|
333
|
-
</Card>
|
|
334
|
-
<Card title="Custom Fields module" href="/rc/references/modules/custom-fields">
|
|
335
|
-
The backend storage layer.
|
|
336
|
-
</Card>
|
|
337
|
-
</CardGroup>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "addSellerShippingMethodToCartWorkflow"
|
|
3
|
-
description: "Add shipping methods to a cart, replacing only the same seller's existing methods."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Seller-aware variant of Medusa's `addShippingMethodToCartWorkflow`. Validates the requested options against the cart and their calculated prices, then swaps shipping methods per seller: existing methods belonging to the sellers whose options are being added are removed, while other sellers' methods stay untouched — so a multi-seller cart keeps one shipping method per seller. Refreshes cart items afterwards and emits `cart.updated`. Triggered by `POST /store/carts/:id/shipping-methods`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { addSellerShippingMethodToCartWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await addSellerShippingMethodToCartWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
cart_id: "cart_123",
|
|
16
|
-
options: [{ id: "so_123" }],
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="cart_id" type="string" required>The cart to add shipping methods to.</ParamField>
|
|
24
|
-
|
|
25
|
-
<ParamField body="options" type="object[]" required>
|
|
26
|
-
Shipping options to add as methods.
|
|
27
|
-
|
|
28
|
-
<Expandable title="properties">
|
|
29
|
-
<ParamField body="id" type="string" required>The shipping option ID; must have a calculated price for the cart.</ParamField>
|
|
30
|
-
<ParamField body="data" type="object">Custom method data validated by the fulfillment provider.</ParamField>
|
|
31
|
-
</Expandable>
|
|
32
|
-
</ParamField>
|
|
33
|
-
|
|
34
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
35
|
-
|
|
36
|
-
## Result
|
|
37
|
-
|
|
38
|
-
<ResponseField name="result" type="void">No return value; the cart's shipping methods are replaced per seller as a side effect.</ResponseField>
|
|
39
|
-
|
|
40
|
-
## Hooks
|
|
41
|
-
|
|
42
|
-
- `validate` — runs after the cart is loaded with `{ input, cart }`.
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
addSellerShippingMethodToCartWorkflow.hooks.validate(async ({ input, cart }) => {
|
|
46
|
-
// throw to reject the shipping method
|
|
47
|
-
})
|
|
48
|
-
```
|