@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "The store allowlist"
|
|
3
|
+
sidebarTitle: "The allowlist"
|
|
4
|
+
description: "The product_seller link that controls which stores may sell a master product."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this document, you'll learn how Mercur controls which stores are allowed to
|
|
8
|
+
sell a shared master product.
|
|
9
|
+
|
|
10
|
+
## Product seller
|
|
11
|
+
|
|
12
|
+
Since the catalog is shared, Mercur needs a way to say *which* stores may sell a
|
|
13
|
+
given master product. That's the **product–seller allowlist**: a many-to-many
|
|
14
|
+
link between Medusa's `Product` and Mercur's `Seller`, stored in the
|
|
15
|
+
`product_seller` table.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const { data: products } = await query.graph({
|
|
19
|
+
entity: "product",
|
|
20
|
+
fields: ["id", "title", "sellers.id", "sellers.name"],
|
|
21
|
+
filters: { id: "prod_123" },
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
A store appears in a product's `sellers` list only if it has been allowlisted.
|
|
26
|
+
Being on the allowlist is what lets a store create an
|
|
27
|
+
[offer](/platform/offer/overview) against the master product. Without it, the
|
|
28
|
+
store cannot list that product for sale.
|
|
29
|
+
|
|
30
|
+
<Note>
|
|
31
|
+
The allowlist link is created automatically for the submitting store when a
|
|
32
|
+
product is created with `seller_ids`, and managed afterwards with
|
|
33
|
+
`linkSellersToProductWorkflow`. See
|
|
34
|
+
[Allowlist stores](/platform/catalog/guides/allowlist-stores).
|
|
35
|
+
</Note>
|
|
36
|
+
|
|
37
|
+
## Category allowlist
|
|
38
|
+
|
|
39
|
+
Product categories carry the same pattern through the `category_seller` link. It
|
|
40
|
+
is a many-to-many association between `ProductCategory` and `Seller` that scopes
|
|
41
|
+
which categories a store is associated with. Manage it with
|
|
42
|
+
`linkSellersToProductCategoryWorkflow`.
|
|
43
|
+
|
|
44
|
+
<Tip>
|
|
45
|
+
The allowlist governs the **right to sell**, not the sale itself. A store on
|
|
46
|
+
the allowlist still has to create an offer to actually list the product.
|
|
47
|
+
Allowlisting alone doesn't put anything on the storefront.
|
|
48
|
+
</Tip>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Status lifecycle"
|
|
3
|
+
sidebarTitle: "Status lifecycle"
|
|
4
|
+
description: "How a master product moves from draft to proposed, published, or rejected."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this document, you'll learn about the product status lifecycle and how a
|
|
8
|
+
submission becomes a live catalog product.
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
A product's state is held in the `status` field of the `Product` model, typed by
|
|
13
|
+
Medusa's `ProductStatus` enum. A master product moves through four statuses:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌────────┐ submit ┌──────────┐ approve ┌────────────┐
|
|
17
|
+
│ draft │ ──────────►│ proposed │ ──────────►│ published │
|
|
18
|
+
└────────┘ └────┬─────┘ └────────────┘
|
|
19
|
+
│ reject
|
|
20
|
+
▼
|
|
21
|
+
┌────────────┐
|
|
22
|
+
│ rejected │
|
|
23
|
+
└────────────┘
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Status | Meaning |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `draft` | Work in progress, not yet submitted for review |
|
|
29
|
+
| `proposed` | Submitted, awaiting operator review |
|
|
30
|
+
| `published` | Approved and live in the shared catalog, sellable via offers |
|
|
31
|
+
| `rejected` | Turned down during review |
|
|
32
|
+
|
|
33
|
+
<Note>
|
|
34
|
+
Vendor-created products default to **`proposed`**. A store submits a product
|
|
35
|
+
for review rather than publishing it directly. An operator (or a low-risk
|
|
36
|
+
auto-confirm rule) is what promotes it to `published`.
|
|
37
|
+
</Note>
|
|
38
|
+
|
|
39
|
+
## Transitions
|
|
40
|
+
|
|
41
|
+
Each review transition has a dedicated Mercur workflow so the audit trail,
|
|
42
|
+
events, and side effects run consistently:
|
|
43
|
+
|
|
44
|
+
| Workflow | Transition |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `confirmProductsWorkflow` | `proposed` → `published` |
|
|
47
|
+
| `rejectProductWorkflow` | `proposed` → `rejected` |
|
|
48
|
+
| `requestProductChangeWorkflow` | stays `proposed`, asks the submitter for a revision |
|
|
49
|
+
|
|
50
|
+
Every transition validates that the product is currently `proposed` before it
|
|
51
|
+
runs, and records an immutable `STATUS_CHANGE` (or `CHANGE_REQUESTED`) action in
|
|
52
|
+
the product-change pipeline for a full history of who reviewed what.
|
|
53
|
+
|
|
54
|
+
<Tip>
|
|
55
|
+
Reviewing a product doesn't touch offers. Publishing makes the master product
|
|
56
|
+
sellable, but each store still lists it independently through its own
|
|
57
|
+
[offer](/platform/offer/overview).
|
|
58
|
+
</Tip>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Variants, categories & collections"
|
|
3
|
+
sidebarTitle: "Variants & categories"
|
|
4
|
+
description: "The native Medusa Product structure the shared catalog is built on."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this document, you'll learn about the structural models that organize the
|
|
8
|
+
shared catalog, all of them native to Medusa's Product module.
|
|
9
|
+
|
|
10
|
+
## Product variant
|
|
11
|
+
|
|
12
|
+
A variant is a purchasable configuration of a master product, represented by the
|
|
13
|
+
`ProductVariant` data model (table `product_variant`, id prefix `variant`).
|
|
14
|
+
Variants are generated from a product's options, including Mercur attributes
|
|
15
|
+
marked as variant axes, and hold the SKU-level structure of the catalog entry.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const { data: products } = await query.graph({
|
|
19
|
+
entity: "product",
|
|
20
|
+
fields: ["id", "title", "variants.id", "variants.title", "options.*"],
|
|
21
|
+
filters: { id: "prod_123" },
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<Note>
|
|
26
|
+
Offer-based inventory and pricing live on the [offer](/platform/offer/overview),
|
|
27
|
+
not the variant. The variant defines the shared catalog structure. Each store's
|
|
28
|
+
stock and price come from its own offer.
|
|
29
|
+
</Note>
|
|
30
|
+
|
|
31
|
+
## Categories & collections
|
|
32
|
+
|
|
33
|
+
Products are organized with Medusa's native grouping models:
|
|
34
|
+
|
|
35
|
+
| Model | Purpose |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `ProductCategory` | Hierarchical, nestable classification (id prefix `pcat`) |
|
|
38
|
+
| `ProductCollection` | Flat, curated grouping (id prefix `pcol`) |
|
|
39
|
+
| `ProductTag` | Free-form labels for filtering |
|
|
40
|
+
| `ProductType` | A single type classification per product |
|
|
41
|
+
|
|
42
|
+
Assign products to a category with `assignProductsToCategoryWorkflow`, which
|
|
43
|
+
keeps each product in exactly one category at a time.
|
|
44
|
+
|
|
45
|
+
<Tip>
|
|
46
|
+
Categories participate in the marketplace layer too: the `category_seller`
|
|
47
|
+
link scopes which stores a category is associated with, mirroring the product
|
|
48
|
+
[allowlist](/platform/catalog/concepts/product-seller-allowlist).
|
|
49
|
+
</Tip>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Allowlist stores"
|
|
3
|
+
sidebarTitle: "Allowlist stores"
|
|
4
|
+
description: "Grant and revoke a store's right to sell a master product from server code."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this guide, you'll learn how to control which stores may sell a shared master
|
|
8
|
+
product by managing the `product_seller` allowlist from your own server code.
|
|
9
|
+
|
|
10
|
+
A store can only create an [offer](/platform/offer/overview) against a master
|
|
11
|
+
product if it's on that product's allowlist. Mercur exposes
|
|
12
|
+
`linkSellersToProductWorkflow` to add and remove stores in a single call.
|
|
13
|
+
|
|
14
|
+
## Add and remove stores
|
|
15
|
+
|
|
16
|
+
```ts title="src/api/custom/allowlist/route.ts"
|
|
17
|
+
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
18
|
+
import { linkSellersToProductWorkflow } from "@mercurjs/core/workflows"
|
|
19
|
+
|
|
20
|
+
export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
21
|
+
await linkSellersToProductWorkflow(req.scope).run({
|
|
22
|
+
input: {
|
|
23
|
+
id: req.params.id, // product id
|
|
24
|
+
add: ["sel_123", "sel_456"],
|
|
25
|
+
remove: ["sel_789"],
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
res.sendStatus(200)
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
<Note>
|
|
34
|
+
`add` and `remove` are both optional. Pass either or both. Adding a store
|
|
35
|
+
that's already allowlisted is idempotent. Removing a store revokes its right
|
|
36
|
+
to sell the product going forward.
|
|
37
|
+
</Note>
|
|
38
|
+
|
|
39
|
+
## Allowlist a category
|
|
40
|
+
|
|
41
|
+
Categories use the same shape through `linkSellersToProductCategoryWorkflow`,
|
|
42
|
+
scoping which stores a category is associated with:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { linkSellersToProductCategoryWorkflow } from "@mercurjs/core/workflows"
|
|
46
|
+
|
|
47
|
+
await linkSellersToProductCategoryWorkflow(container).run({
|
|
48
|
+
input: {
|
|
49
|
+
id: "pcat_123",
|
|
50
|
+
add: ["sel_123"],
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
<Tip>
|
|
56
|
+
Allowlisting grants the **right to sell**, not the listing itself. After a
|
|
57
|
+
store is allowlisted, it still has to create an offer for the product to
|
|
58
|
+
appear on its storefront.
|
|
59
|
+
</Tip>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Create a master product"
|
|
3
|
+
sidebarTitle: "Create a master product"
|
|
4
|
+
description: "Create a master product programmatically with createProductsWorkflow."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this guide, you'll learn how to add a product to the shared catalog from your
|
|
8
|
+
own server code, for example in a seed script, a custom API route, or an import
|
|
9
|
+
flow.
|
|
10
|
+
|
|
11
|
+
Mercur exposes a `createProductsWorkflow` that creates the `Product` record,
|
|
12
|
+
attaches attributes and variants, records the submission for audit, and
|
|
13
|
+
optionally allowlists the submitting store. Run it from any place that has access
|
|
14
|
+
to the Medusa container.
|
|
15
|
+
|
|
16
|
+
## Run the workflow
|
|
17
|
+
|
|
18
|
+
```ts title="src/api/custom/route.ts"
|
|
19
|
+
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
20
|
+
import { createProductsWorkflow } from "@mercurjs/core/workflows"
|
|
21
|
+
|
|
22
|
+
export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
23
|
+
const { result } = await createProductsWorkflow(req.scope).run({
|
|
24
|
+
input: {
|
|
25
|
+
products: [
|
|
26
|
+
{
|
|
27
|
+
title: "Aeron Chair",
|
|
28
|
+
status: "proposed",
|
|
29
|
+
seller_ids: ["sel_123"],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
created_by: req.auth_context.actor_id,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
res.status(201).json({ product: result[0] })
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
<Note>
|
|
41
|
+
Passing `seller_ids` allowlists those stores for the product as it's created,
|
|
42
|
+
so the submitting store can immediately create an
|
|
43
|
+
[offer](/platform/offer/overview) against it. `created_by` records who
|
|
44
|
+
submitted the product for the audit trail.
|
|
45
|
+
</Note>
|
|
46
|
+
|
|
47
|
+
## Default status
|
|
48
|
+
|
|
49
|
+
A product created without an explicit `status` follows the marketplace's review
|
|
50
|
+
flow. Vendor-created products default to **`proposed`**, submitted for operator
|
|
51
|
+
review rather than published outright. Set `status: "draft"` to keep a product
|
|
52
|
+
private until it's ready, or `status: "published"` from a trusted operator flow
|
|
53
|
+
to skip review. See the
|
|
54
|
+
[status lifecycle](/platform/catalog/concepts/status-lifecycle).
|
|
55
|
+
|
|
56
|
+
## Attach custom data
|
|
57
|
+
|
|
58
|
+
The workflow accepts an `additional_data` payload passed to its hooks, letting
|
|
59
|
+
you persist marketplace-specific data alongside the product without forking the
|
|
60
|
+
workflow.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
await createProductsWorkflow(req.scope).run({
|
|
64
|
+
input: {
|
|
65
|
+
products: [{ title: "Aeron Chair", seller_ids: ["sel_123"] }],
|
|
66
|
+
created_by: "usr_123",
|
|
67
|
+
additional_data: { source: "supplier-feed" },
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Publish or reject a product"
|
|
3
|
+
sidebarTitle: "Publish or reject"
|
|
4
|
+
description: "Move a proposed master product to published or rejected from server code."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
In this guide, you'll learn how to review a submitted product from your own
|
|
8
|
+
server code. Each transition has a dedicated workflow so the audit trail, events,
|
|
9
|
+
and side effects run consistently.
|
|
10
|
+
|
|
11
|
+
A product enters review as `proposed`. From there you can publish it, reject it,
|
|
12
|
+
or ask the submitter for a revision. Every workflow validates that the product is
|
|
13
|
+
currently `proposed` before it runs.
|
|
14
|
+
|
|
15
|
+
## Publish a product
|
|
16
|
+
|
|
17
|
+
Move one or more `proposed` products to `published` with
|
|
18
|
+
`confirmProductsWorkflow`:
|
|
19
|
+
|
|
20
|
+
```ts title="src/api/custom/publish/route.ts"
|
|
21
|
+
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
22
|
+
import { confirmProductsWorkflow } from "@mercurjs/core/workflows"
|
|
23
|
+
|
|
24
|
+
export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
25
|
+
await confirmProductsWorkflow(req.scope).run({
|
|
26
|
+
input: {
|
|
27
|
+
product_ids: [req.params.id],
|
|
28
|
+
actor_id: req.auth_context.actor_id,
|
|
29
|
+
internal_note: "Looks good",
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
res.sendStatus(200)
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Reject a product
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { rejectProductWorkflow } from "@mercurjs/core/workflows"
|
|
41
|
+
|
|
42
|
+
await rejectProductWorkflow(container).run({
|
|
43
|
+
input: {
|
|
44
|
+
product_id: "prod_123",
|
|
45
|
+
message: "Images don't match the description",
|
|
46
|
+
actor_id: "usr_123",
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Request a revision
|
|
52
|
+
|
|
53
|
+
To send the submission back for changes without rejecting it, use
|
|
54
|
+
`requestProductChangeWorkflow`. The product stays `proposed` and a
|
|
55
|
+
`CHANGE_REQUESTED` action is recorded for the submitter to act on:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { requestProductChangeWorkflow } from "@mercurjs/core/workflows"
|
|
59
|
+
|
|
60
|
+
await requestProductChangeWorkflow(container).run({
|
|
61
|
+
input: {
|
|
62
|
+
product_id: "prod_123",
|
|
63
|
+
message: "Please add a size variant",
|
|
64
|
+
actor_id: "usr_123",
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<Warning>
|
|
70
|
+
These workflows require the product to be `proposed`. Running them against a
|
|
71
|
+
`draft`, `published`, or `rejected` product fails validation rather than
|
|
72
|
+
forcing the transition.
|
|
73
|
+
</Warning>
|
|
74
|
+
|
|
75
|
+
## React to review outcomes
|
|
76
|
+
|
|
77
|
+
To run your own side effects when a product is published or rejected, subscribe
|
|
78
|
+
to the events these workflows emit rather than polling. See the
|
|
79
|
+
[Event reference](/platform/catalog/reference/events) for the event names.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Catalog"
|
|
3
|
+
sidebarTitle: "Overview"
|
|
4
|
+
description: "Master products, variants, categories, and the store allowlist that governs who may sell what."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Use Mercur to govern one shared product catalog and control which stores are
|
|
8
|
+
allowed to sell what.
|
|
9
|
+
|
|
10
|
+
Master-data governance lives here. The Catalog domain keeps products as a single
|
|
11
|
+
shared source of truth, controls access to it through an allowlist over who may
|
|
12
|
+
sell each product, and holds every submission to an approval lifecycle before it
|
|
13
|
+
goes live. On top of that governance layer it holds master products, variants,
|
|
14
|
+
categories, collections, tags, and types. A store never owns a product. It sells
|
|
15
|
+
against a shared master product through an [offer](/platform/offer/overview).
|
|
16
|
+
|
|
17
|
+
<Note>
|
|
18
|
+
**Catalog = Medusa's Product module + Mercur's marketplace layer.** Products,
|
|
19
|
+
variants, categories, and collections are Medusa's native `Product` module.
|
|
20
|
+
Mercur adds the `product_seller` allowlist (which stores may sell a product),
|
|
21
|
+
the `draft` → `proposed` → `published` / `rejected` status lifecycle, and its
|
|
22
|
+
own product workflows. Products are **shared master products**, not
|
|
23
|
+
seller-owned, and a store sells one via an [offer](/platform/offer/overview).
|
|
24
|
+
</Note>
|
|
25
|
+
|
|
26
|
+
## Key features
|
|
27
|
+
|
|
28
|
+
- **Shared master data:** products live in one catalog, not owned by any store. Creating a product adds it to the shared catalog.
|
|
29
|
+
- **Allowlist access control:** the `product_seller` link governs which stores may sell a given master product.
|
|
30
|
+
- **Approval governance:** a `draft` → `proposed` → `published` / `rejected` lifecycle, with vendor-created products defaulting to `proposed`.
|
|
31
|
+
- **Attribution, not ownership:** the creator of an unreviewed submission is recorded for audit, but the product still belongs to the shared catalog.
|
|
32
|
+
- **Native Medusa structure:** variants, categories, collections, tags, and types come straight from Medusa's Product module.
|
|
33
|
+
- **Sold via offers:** a store lists a master product by creating an offer that carries its SKU, price, and inventory.
|
|
34
|
+
|
|
35
|
+
## Get started
|
|
36
|
+
|
|
37
|
+
Learn how the domain fits together.
|
|
38
|
+
|
|
39
|
+
<CardGroup cols={2}>
|
|
40
|
+
<Card title="Master products" icon="box" href="/platform/catalog/concepts/master-products">
|
|
41
|
+
The shared catalog, why products aren't seller-owned, and submission attribution.
|
|
42
|
+
</Card>
|
|
43
|
+
<Card title="The store allowlist" icon="user-lock" href="/platform/catalog/concepts/product-seller-allowlist">
|
|
44
|
+
The `product_seller` link that controls who may sell a product.
|
|
45
|
+
</Card>
|
|
46
|
+
<Card title="Status lifecycle" icon="arrows-rotate" href="/platform/catalog/concepts/status-lifecycle">
|
|
47
|
+
Draft, proposed, published, and rejected, plus how products move between them.
|
|
48
|
+
</Card>
|
|
49
|
+
<Card title="Variants & categories" icon="sitemap" href="/platform/catalog/concepts/variants-categories-collections">
|
|
50
|
+
Variants, categories, collections, tags, and types from Medusa's Product module.
|
|
51
|
+
</Card>
|
|
52
|
+
</CardGroup>
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
Build against the Catalog domain in your own code.
|
|
57
|
+
|
|
58
|
+
<CardGroup cols={2}>
|
|
59
|
+
<Card title="Create a master product" icon="plus" href="/platform/catalog/guides/create-a-master-product">
|
|
60
|
+
Run `createProductsWorkflow` from a route or seed script.
|
|
61
|
+
</Card>
|
|
62
|
+
<Card title="Allowlist stores" icon="user-plus" href="/platform/catalog/guides/allowlist-stores">
|
|
63
|
+
Grant and revoke a store's right to sell a product in code.
|
|
64
|
+
</Card>
|
|
65
|
+
<Card title="Publish or reject" icon="gavel" href="/platform/catalog/guides/publish-or-reject-a-product">
|
|
66
|
+
Move a proposed product to published or rejected.
|
|
67
|
+
</Card>
|
|
68
|
+
</CardGroup>
|
|
69
|
+
|
|
70
|
+
## Resources
|
|
71
|
+
|
|
72
|
+
Data models, workflows, service methods, and events for the Catalog domain.
|
|
73
|
+
|
|
74
|
+
<CardGroup cols={2}>
|
|
75
|
+
<Card title="Data models" icon="table" href="/platform/catalog/reference/data-models">
|
|
76
|
+
The `Product`, `ProductVariant`, `ProductCategory`, and the `product_seller` table.
|
|
77
|
+
</Card>
|
|
78
|
+
<Card title="Links" icon="link" href="/platform/catalog/reference/links">
|
|
79
|
+
How the catalog links to sellers, offers, attributes, and media.
|
|
80
|
+
</Card>
|
|
81
|
+
<Card title="Workflows" icon="diagram-project" href="/platform/catalog/reference/workflows">
|
|
82
|
+
Mercur's product create, review, and allowlist workflows.
|
|
83
|
+
</Card>
|
|
84
|
+
<Card title="Service" icon="gear" href="/platform/catalog/reference/service">
|
|
85
|
+
Medusa's Product module service, resolved with `Modules.PRODUCT`.
|
|
86
|
+
</Card>
|
|
87
|
+
<Card title="Events" icon="bell" href="/platform/catalog/reference/events">
|
|
88
|
+
Events emitted as products are created and reviewed.
|
|
89
|
+
</Card>
|
|
90
|
+
</CardGroup>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Data models"
|
|
3
|
+
sidebarTitle: "Data models"
|
|
4
|
+
description: "The Medusa Product models the catalog is built on, plus Mercur's marketplace layer."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The Catalog domain is owned by **Medusa's Product module**, with a marketplace
|
|
8
|
+
layer added by Mercur. This reference lists the models at the Mercur-relevant
|
|
9
|
+
level. It doesn't restate every Medusa product field. For the full module, see
|
|
10
|
+
the [Medusa Product module](https://docs.medusajs.com/resources/commerce-modules/product).
|
|
11
|
+
|
|
12
|
+
## Product
|
|
13
|
+
|
|
14
|
+
Table `product`, id prefix `prod`. The shared master product, not owned by any
|
|
15
|
+
store. The marketplace-relevant fields:
|
|
16
|
+
|
|
17
|
+
| Field | Type | Notes |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| `id` | text | Primary key |
|
|
20
|
+
| `title` | text | Searchable |
|
|
21
|
+
| `handle` | text | Unique |
|
|
22
|
+
| `subtitle` / `description` | text | Nullable |
|
|
23
|
+
| `status` | enum | `ProductStatus`: `draft` / `proposed` / `published` / `rejected`, default `draft` |
|
|
24
|
+
| `thumbnail` | text | Nullable |
|
|
25
|
+
| `metadata` | json | Nullable |
|
|
26
|
+
|
|
27
|
+
Relations used by the marketplace: `variants`, `options`, `categories`,
|
|
28
|
+
`collection`, `tags`, `type`, `images` (native Medusa), plus Mercur's `sellers`
|
|
29
|
+
(the allowlist), `offers`, `scoped_attributes`, and `changes` (audit history).
|
|
30
|
+
|
|
31
|
+
## product_seller
|
|
32
|
+
|
|
33
|
+
The **allowlist**: a many-to-many link table between `Product` and `Seller`
|
|
34
|
+
controlling which stores may sell a master product.
|
|
35
|
+
|
|
36
|
+
| Column | References |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `product_id` | `product.id` |
|
|
39
|
+
| `seller_id` | `seller.id` |
|
|
40
|
+
|
|
41
|
+
A store on this table can create an [offer](/platform/offer/overview) against the
|
|
42
|
+
product; a store not on it cannot.
|
|
43
|
+
|
|
44
|
+
## ProductVariant
|
|
45
|
+
|
|
46
|
+
Table `product_variant`, id prefix `variant`. A purchasable configuration of a
|
|
47
|
+
master product, generated from its options and variant-axis attributes. Holds the
|
|
48
|
+
SKU-level catalog structure. Offer-scoped price and inventory live on the offer,
|
|
49
|
+
not here.
|
|
50
|
+
|
|
51
|
+
## ProductCategory
|
|
52
|
+
|
|
53
|
+
Table `product_category`, id prefix `pcat`. Hierarchical, nestable
|
|
54
|
+
classification. Participates in the marketplace layer through the
|
|
55
|
+
`category_seller` allowlist and the `media_images` link.
|
|
56
|
+
|
|
57
|
+
## ProductCollection
|
|
58
|
+
|
|
59
|
+
Table `product_collection`, id prefix `pcol`. Flat, curated grouping of products,
|
|
60
|
+
with a `media_images` link for collection artwork.
|
|
61
|
+
|
|
62
|
+
<Note>
|
|
63
|
+
`ProductTag` and `ProductType` round out the native grouping models: free-form
|
|
64
|
+
labels and a single type classification per product, respectively. They carry
|
|
65
|
+
no Mercur-specific columns.
|
|
66
|
+
</Note>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Event reference"
|
|
3
|
+
sidebarTitle: "Events"
|
|
4
|
+
description: "Events emitted by the Catalog domain, for subscribers and side effects."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The Catalog domain emits events as products are created and reviewed. Subscribe
|
|
8
|
+
to them to run side effects instead of polling, such as sending notifications,
|
|
9
|
+
syncing external systems, or reindexing search.
|
|
10
|
+
|
|
11
|
+
```ts title="src/subscribers/product-published.ts"
|
|
12
|
+
import type { SubscriberArgs, SubscriberConfig } from "@medusajs/framework"
|
|
13
|
+
|
|
14
|
+
export default async function productPublishedHandler({
|
|
15
|
+
event,
|
|
16
|
+
container,
|
|
17
|
+
}: SubscriberArgs<{ id: string }>) {
|
|
18
|
+
const productId = event.data.id
|
|
19
|
+
// ...reindex search, notify the seller, etc.
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const config: SubscriberConfig = {
|
|
23
|
+
event: "product.published",
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Product events
|
|
28
|
+
|
|
29
|
+
| Event | Emitted when | Payload |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `product.created` | A master product is created | `{ id }` |
|
|
32
|
+
| `product.published` | A proposed product is approved (`→ published`) | `{ id, internal_note? }` |
|
|
33
|
+
| `product.rejected` | A proposed product is rejected | `{ id, message? }` |
|
|
34
|
+
| `product.change-requested` | A revision is requested on a proposed product | `{ id, message?, actor_id? }` |
|
|
35
|
+
|
|
36
|
+
<Note>
|
|
37
|
+
These are the marketplace lifecycle events emitted by Mercur's product
|
|
38
|
+
workflows. Medusa's Product module also emits its own native events (e.g.
|
|
39
|
+
`product.updated`, `product-variant.created`) for lower-level changes. See the
|
|
40
|
+
[Medusa events reference](https://docs.medusajs.com/resources/events-reference).
|
|
41
|
+
</Note>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Links to other modules"
|
|
3
|
+
sidebarTitle: "Links"
|
|
4
|
+
description: "How the catalog links to sellers, offers, attributes, and media."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Modules in Mercur never reference each other directly. They connect through
|
|
8
|
+
**module links**. The Catalog (Medusa's `Product` module) is wired into the
|
|
9
|
+
marketplace layer with a set of links defined in Mercur core. Once a link is
|
|
10
|
+
defined, you retrieve related records with `query.graph` using the link alias.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const { data: products } = await query.graph({
|
|
14
|
+
entity: "product",
|
|
15
|
+
fields: ["id", "title", "sellers.*", "offers.*", "changes.*"],
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Marketplace
|
|
20
|
+
|
|
21
|
+
| Linked module | Relationship |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| **Seller** | Many-to-many allowlist (`product_seller`) that controls which stores may sell a master product. Categories carry the same via `category_seller`. |
|
|
24
|
+
| **Offer** | A product has many offers (`offer.product_id`, read-only). Offers are how a store sells against the master product. |
|
|
25
|
+
| **Product change** | A product has many change records (`product.changes`, read-only): the immutable submission and review audit trail. |
|
|
26
|
+
|
|
27
|
+
## Attributes
|
|
28
|
+
|
|
29
|
+
| Linked module | Relationship |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| **Product attribute** | Product-scoped attributes resolve under `product.scoped_attributes` (read-only). Categories link attributes through `product_category_attribute`. |
|
|
32
|
+
|
|
33
|
+
## Media
|
|
34
|
+
|
|
35
|
+
| Linked module | Relationship |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| **Media** | Categories and collections link their artwork through the `media_images` alias (a `MediaImage` list). |
|
|
38
|
+
|
|
39
|
+
<Note>
|
|
40
|
+
Read-only links (Offer, Product change, scoped attributes) are resolved from
|
|
41
|
+
the field on the owning record and can't be written through the link itself.
|
|
42
|
+
The `media_images` alias is deliberately **not** the bare `images` alias. That
|
|
43
|
+
would shadow the native `Product.images` relation and break product queries.
|
|
44
|
+
</Note>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Service reference"
|
|
3
|
+
sidebarTitle: "Service"
|
|
4
|
+
description: "Medusa's Product module service: methods for working with records directly."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The catalog is backed by **Medusa's Product module**, not a Mercur-specific one.
|
|
8
|
+
Resolve its service from the container with the `Modules.PRODUCT` key to read and
|
|
9
|
+
write products, variants, categories, and collections directly, without going
|
|
10
|
+
through a workflow. Use it inside custom services, subscribers, or scheduled jobs.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Modules } from "@medusajs/framework/utils"
|
|
14
|
+
|
|
15
|
+
const productModuleService = container.resolve(Modules.PRODUCT)
|
|
16
|
+
|
|
17
|
+
const [products, count] = await productModuleService.listAndCountProducts({
|
|
18
|
+
status: "published",
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<Note>
|
|
23
|
+
Because this is Medusa's own module, the service key is `Modules.PRODUCT` from
|
|
24
|
+
`@medusajs/framework/utils`, **not** a `MercurModules` key. Mercur adds its
|
|
25
|
+
marketplace behavior (allowlist, review lifecycle, audit trail) as
|
|
26
|
+
[workflows](/platform/catalog/reference/workflows) layered on top of this
|
|
27
|
+
service.
|
|
28
|
+
</Note>
|
|
29
|
+
|
|
30
|
+
## Generated methods
|
|
31
|
+
|
|
32
|
+
Each data model gets a standard set of auto-generated methods. For `Product`:
|
|
33
|
+
|
|
34
|
+
| Method | Description |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `createProducts(data)` | Create one or more products |
|
|
37
|
+
| `retrieveProduct(id, config?)` | Retrieve a product by id |
|
|
38
|
+
| `listProducts(filters?, config?)` | List products matching filters |
|
|
39
|
+
| `listAndCountProducts(filters?, config?)` | List products with a total count |
|
|
40
|
+
| `updateProducts(data)` | Update one or more products |
|
|
41
|
+
| `deleteProducts(ids)` | Delete one or more products |
|
|
42
|
+
|
|
43
|
+
The same set exists for every model in the module, such as `ProductVariant`,
|
|
44
|
+
`ProductCategory`, `ProductCollection`, `ProductTag`, and `ProductType` (e.g.
|
|
45
|
+
`createProductVariants`, `listProductCategories`, `updateProductCollections`).
|
|
46
|
+
|
|
47
|
+
<Warning>
|
|
48
|
+
Prefer [workflows](/platform/catalog/reference/workflows) for anything with
|
|
49
|
+
side effects, such as submissions, review transitions, and allowlist changes. The
|
|
50
|
+
service writes records directly and does **not** run the marketplace layer,
|
|
51
|
+
emit Mercur's product events, or record the audit trail.
|
|
52
|
+
</Warning>
|