@mercurjs/docs 2.2.0-canary.40
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/README.md +24 -0
- package/content/blocks.mdx +209 -0
- package/content/learn/architecture.mdx +215 -0
- package/content/learn/attributes.mdx +89 -0
- package/content/learn/blocks.mdx +99 -0
- package/content/learn/commissions.mdx +175 -0
- package/content/learn/concepts.mdx +84 -0
- package/content/learn/installation.mdx +117 -0
- package/content/learn/introduction.mdx +71 -0
- package/content/learn/offers.mdx +78 -0
- package/content/learn/order-groups.mdx +114 -0
- package/content/learn/payouts.mdx +175 -0
- package/content/learn/product-requests.mdx +82 -0
- package/content/learn/products.mdx +79 -0
- package/content/learn/registry.mdx +155 -0
- package/content/learn/seller-members.mdx +62 -0
- package/content/learn/sellers.mdx +118 -0
- package/content/migration/from-1-x-to-2-0.mdx +152 -0
- package/content/migration/from-2-0-to-2-1.mdx +105 -0
- package/content/migration/overview.mdx +58 -0
- package/content/references/api/admin/commission-rates/batch-commission-rules.mdx +70 -0
- package/content/references/api/admin/commission-rates/create-commission-rate.mdx +95 -0
- package/content/references/api/admin/commission-rates/delete-commission-rate.mdx +40 -0
- package/content/references/api/admin/commission-rates/list-commission-rates.mdx +92 -0
- package/content/references/api/admin/commission-rates/retrieve-commission-rate.mdx +70 -0
- package/content/references/api/admin/commission-rates/update-commission-rate.mdx +84 -0
- package/content/references/api/admin/members/list-members.mdx +61 -0
- package/content/references/api/admin/offers/batch-create-offers.mdx +130 -0
- package/content/references/api/admin/offers/delete-offer.mdx +40 -0
- package/content/references/api/admin/offers/list-offers.mdx +106 -0
- package/content/references/api/admin/offers/retrieve-offer.mdx +82 -0
- package/content/references/api/admin/order-groups/list-order-groups.mdx +77 -0
- package/content/references/api/admin/order-groups/retrieve-order-group.mdx +56 -0
- package/content/references/api/admin/orders/get-order-commission-lines.mdx +65 -0
- package/content/references/api/admin/orders/get-order-order-group.mdx +56 -0
- package/content/references/api/admin/orders/list-orders.mdx +79 -0
- package/content/references/api/admin/payouts/list-payouts.mdx +75 -0
- package/content/references/api/admin/payouts/retrieve-payout.mdx +62 -0
- package/content/references/api/admin/product-attributes/create-attribute-value.mdx +76 -0
- package/content/references/api/admin/product-attributes/create-product-attribute.mdx +99 -0
- package/content/references/api/admin/product-attributes/delete-attribute-value.mdx +52 -0
- package/content/references/api/admin/product-attributes/delete-product-attribute.mdx +40 -0
- package/content/references/api/admin/product-attributes/list-product-attributes.mdx +91 -0
- package/content/references/api/admin/product-attributes/retrieve-product-attribute.mdx +81 -0
- package/content/references/api/admin/product-attributes/update-attribute-value.mdx +66 -0
- package/content/references/api/admin/product-attributes/update-product-attribute.mdx +76 -0
- package/content/references/api/admin/product-changes/cancel-product-change.mdx +68 -0
- package/content/references/api/admin/product-changes/confirm-product-change.mdx +47 -0
- package/content/references/api/admin/products/batch-product-attributes.mdx +96 -0
- package/content/references/api/admin/products/confirm-product.mdx +59 -0
- package/content/references/api/admin/products/create-product-variant.mdx +78 -0
- package/content/references/api/admin/products/create-product.mdx +169 -0
- package/content/references/api/admin/products/delete-product-variant.mdx +48 -0
- package/content/references/api/admin/products/delete-product.mdx +40 -0
- package/content/references/api/admin/products/list-product-variants.mdx +91 -0
- package/content/references/api/admin/products/list-products.mdx +109 -0
- package/content/references/api/admin/products/preview-product.mdx +78 -0
- package/content/references/api/admin/products/reject-product.mdx +59 -0
- package/content/references/api/admin/products/request-product-changes.mdx +59 -0
- package/content/references/api/admin/products/retrieve-product-variant.mdx +73 -0
- package/content/references/api/admin/products/retrieve-product.mdx +96 -0
- package/content/references/api/admin/products/set-product-sellers.mdx +47 -0
- package/content/references/api/admin/products/update-product-variant.mdx +89 -0
- package/content/references/api/admin/products/update-product.mdx +133 -0
- package/content/references/api/admin/sellers/add-seller-member.mdx +63 -0
- package/content/references/api/admin/sellers/approve-seller.mdx +54 -0
- package/content/references/api/admin/sellers/create-seller.mdx +100 -0
- package/content/references/api/admin/sellers/delete-member-invite.mdx +42 -0
- package/content/references/api/admin/sellers/delete-professional-details.mdx +52 -0
- package/content/references/api/admin/sellers/invite-seller-member.mdx +63 -0
- package/content/references/api/admin/sellers/list-member-invites.mdx +71 -0
- package/content/references/api/admin/sellers/list-seller-members.mdx +71 -0
- package/content/references/api/admin/sellers/list-seller-products.mdx +85 -0
- package/content/references/api/admin/sellers/list-sellers.mdx +96 -0
- package/content/references/api/admin/sellers/remove-seller-member.mdx +42 -0
- package/content/references/api/admin/sellers/resend-member-invite.mdx +55 -0
- package/content/references/api/admin/sellers/retrieve-seller.mdx +81 -0
- package/content/references/api/admin/sellers/suspend-seller.mdx +60 -0
- package/content/references/api/admin/sellers/terminate-seller.mdx +60 -0
- package/content/references/api/admin/sellers/unsuspend-seller.mdx +52 -0
- package/content/references/api/admin/sellers/unterminate-seller.mdx +52 -0
- package/content/references/api/admin/sellers/update-seller.mdx +83 -0
- package/content/references/api/admin/sellers/upsert-payment-details.mdx +88 -0
- package/content/references/api/admin/sellers/upsert-professional-details.mdx +78 -0
- package/content/references/api/admin/sellers/upsert-seller-address.mdx +91 -0
- package/content/references/api/admin.mdx +134 -0
- package/content/references/api/conventions.mdx +109 -0
- package/content/references/api/store/carts/add-line-item.mdx +115 -0
- package/content/references/api/store/carts/add-shipping-methods.mdx +84 -0
- package/content/references/api/store/carts/apply-promotions.mdx +83 -0
- package/content/references/api/store/carts/complete-cart.mdx +98 -0
- package/content/references/api/store/offers/list-offers.mdx +161 -0
- package/content/references/api/store/offers/retrieve-offer.mdx +112 -0
- package/content/references/api/store/order-groups/list-order-groups.mdx +105 -0
- package/content/references/api/store/order-groups/retrieve-order-group.mdx +78 -0
- package/content/references/api/store/product-attributes/list-product-attributes.mdx +134 -0
- package/content/references/api/store/product-attributes/retrieve-product-attribute.mdx +78 -0
- package/content/references/api/store/product-categories/list-product-categories.mdx +126 -0
- package/content/references/api/store/product-categories/retrieve-product-category.mdx +79 -0
- package/content/references/api/store/products/list-products.mdx +184 -0
- package/content/references/api/store/products/retrieve-product.mdx +107 -0
- package/content/references/api/store/search/search.mdx +136 -0
- package/content/references/api/store/sellers/list-sellers.mdx +105 -0
- package/content/references/api/store/sellers/retrieve-seller.mdx +62 -0
- package/content/references/api/store/shipping-options/list-shipping-options.mdx +74 -0
- package/content/references/api/store.mdx +67 -0
- package/content/references/api/vendor/members/accept-member-invite.mdx +65 -0
- package/content/references/api/vendor/members/retrieve-current-member.mdx +51 -0
- package/content/references/api/vendor/members/update-current-member.mdx +70 -0
- package/content/references/api/vendor/offers/batch-create-offers.mdx +123 -0
- package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +103 -0
- package/content/references/api/vendor/offers/create-offer.mdx +141 -0
- package/content/references/api/vendor/offers/delete-offer.mdx +51 -0
- package/content/references/api/vendor/offers/list-offers.mdx +125 -0
- package/content/references/api/vendor/offers/retrieve-offer.mdx +74 -0
- package/content/references/api/vendor/offers/update-offer.mdx +82 -0
- package/content/references/api/vendor/orders/cancel-fulfillment.mdx +63 -0
- package/content/references/api/vendor/orders/cancel-order.mdx +56 -0
- package/content/references/api/vendor/orders/complete-order.mdx +55 -0
- package/content/references/api/vendor/orders/create-fulfillment.mdx +76 -0
- package/content/references/api/vendor/orders/create-shipment.mdx +99 -0
- package/content/references/api/vendor/orders/get-order-commission-lines.mdx +66 -0
- package/content/references/api/vendor/orders/list-order-changes.mdx +75 -0
- package/content/references/api/vendor/orders/list-orders.mdx +103 -0
- package/content/references/api/vendor/orders/mark-fulfillment-delivered.mdx +62 -0
- package/content/references/api/vendor/orders/preview-order.mdx +65 -0
- package/content/references/api/vendor/orders/retrieve-order.mdx +84 -0
- package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +68 -0
- package/content/references/api/vendor/payout-accounts/create-payout-account.mdx +59 -0
- package/content/references/api/vendor/payout-accounts/retrieve-payout-account-by-id.mdx +60 -0
- package/content/references/api/vendor/payout-accounts/retrieve-payout-account.mdx +77 -0
- package/content/references/api/vendor/payouts/list-payouts.mdx +90 -0
- package/content/references/api/vendor/payouts/retrieve-payout.mdx +63 -0
- package/content/references/api/vendor/product-attributes/list-product-attributes.mdx +135 -0
- package/content/references/api/vendor/product-attributes/retrieve-product-attribute.mdx +71 -0
- package/content/references/api/vendor/product-variants/list-variants.mdx +136 -0
- package/content/references/api/vendor/products/batch-product-attributes.mdx +104 -0
- package/content/references/api/vendor/products/cancel-product-change.mdx +62 -0
- package/content/references/api/vendor/products/create-product-variant.mdx +92 -0
- package/content/references/api/vendor/products/create-product.mdx +197 -0
- package/content/references/api/vendor/products/delete-product-variant.mdx +68 -0
- package/content/references/api/vendor/products/delete-product.mdx +62 -0
- package/content/references/api/vendor/products/list-product-variants.mdx +114 -0
- package/content/references/api/vendor/products/list-products.mdx +163 -0
- package/content/references/api/vendor/products/preview-product.mdx +61 -0
- package/content/references/api/vendor/products/retrieve-product-variant.mdx +76 -0
- package/content/references/api/vendor/products/retrieve-product.mdx +69 -0
- package/content/references/api/vendor/products/update-product-variant.mdx +104 -0
- package/content/references/api/vendor/products/update-product.mdx +148 -0
- package/content/references/api/vendor/sellers/create-seller.mdx +150 -0
- package/content/references/api/vendor/sellers/delete-professional-details.mdx +54 -0
- package/content/references/api/vendor/sellers/invite-seller-member.mdx +67 -0
- package/content/references/api/vendor/sellers/list-member-invites.mdx +82 -0
- package/content/references/api/vendor/sellers/list-seller-members.mdx +80 -0
- package/content/references/api/vendor/sellers/list-sellers.mdx +71 -0
- package/content/references/api/vendor/sellers/remove-seller-member.mdx +48 -0
- package/content/references/api/vendor/sellers/retrieve-current-seller-member.mdx +59 -0
- package/content/references/api/vendor/sellers/retrieve-current-seller.mdx +69 -0
- package/content/references/api/vendor/sellers/select-seller.mdx +44 -0
- package/content/references/api/vendor/sellers/update-current-seller.mdx +108 -0
- package/content/references/api/vendor/sellers/update-member-role.mdx +51 -0
- package/content/references/api/vendor/sellers/upsert-payment-details.mdx +74 -0
- package/content/references/api/vendor/sellers/upsert-professional-details.mdx +70 -0
- package/content/references/api/vendor/sellers/upsert-seller-address.mdx +81 -0
- package/content/references/api/vendor.mdx +150 -0
- package/content/references/configuration.mdx +155 -0
- package/content/references/modules/commission.mdx +106 -0
- package/content/references/modules/custom-fields.mdx +45 -0
- package/content/references/modules/media.mdx +55 -0
- package/content/references/modules/offer.mdx +64 -0
- package/content/references/modules/payout.mdx +121 -0
- package/content/references/modules/product-attribute.mdx +111 -0
- package/content/references/modules/product-edit.mdx +80 -0
- package/content/references/modules/search.mdx +112 -0
- package/content/references/modules/seller.mdx +175 -0
- package/content/references/overview.mdx +70 -0
- package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +44 -0
- package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +36 -0
- package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +39 -0
- package/content/references/workflows/cart/update-cart-seller-promotions.mdx +42 -0
- package/content/references/workflows/commission/batch-commission-rules.mdx +45 -0
- package/content/references/workflows/commission/create-commission-rates.mdx +41 -0
- package/content/references/workflows/commission/delete-commission-rates.mdx +34 -0
- package/content/references/workflows/commission/refresh-order-commission-lines.mdx +30 -0
- package/content/references/workflows/commission/update-commission-rates.mdx +35 -0
- package/content/references/workflows/media/set-category-images.mdx +41 -0
- package/content/references/workflows/media/set-collection-images.mdx +41 -0
- package/content/references/workflows/member/accept-member-invite.mdx +33 -0
- package/content/references/workflows/member/add-seller-member.mdx +30 -0
- package/content/references/workflows/member/create-member-invites.mdx +34 -0
- package/content/references/workflows/member/delete-member-invite.mdx +24 -0
- package/content/references/workflows/member/remove-seller-member.mdx +28 -0
- package/content/references/workflows/member/resend-member-invite.mdx +28 -0
- package/content/references/workflows/member/update-member-role.mdx +28 -0
- package/content/references/workflows/member/update-member.mdx +35 -0
- package/content/references/workflows/offer/batch-offer-inventory-items.mdx +58 -0
- package/content/references/workflows/offer/create-offers.mdx +63 -0
- package/content/references/workflows/offer/delete-offers.mdx +35 -0
- package/content/references/workflows/offer/update-offers.mdx +51 -0
- package/content/references/workflows/order/cancel-order-fulfillment.mdx +34 -0
- package/content/references/workflows/order/confirm-claim-request.mdx +25 -0
- package/content/references/workflows/order/confirm-exchange-request.mdx +25 -0
- package/content/references/workflows/order/confirm-order-edit-request.mdx +25 -0
- package/content/references/workflows/order/confirm-return-receive.mdx +25 -0
- package/content/references/workflows/order/create-order-fulfillment.mdx +45 -0
- package/content/references/workflows/order-group/get-order-group-detail.mdx +29 -0
- package/content/references/workflows/order-group/get-order-groups-list.mdx +36 -0
- package/content/references/workflows/overview.mdx +72 -0
- package/content/references/workflows/payout/create-onboarding.mdx +36 -0
- package/content/references/workflows/payout/create-payout-account.mdx +33 -0
- package/content/references/workflows/payout/create-payout.mdx +30 -0
- package/content/references/workflows/payout/process-payout-for-webhook.mdx +32 -0
- package/content/references/workflows/product/confirm-products.mdx +46 -0
- package/content/references/workflows/product/create-products.mdx +63 -0
- package/content/references/workflows/product/link-sellers-to-product-category.mdx +40 -0
- package/content/references/workflows/product/link-sellers-to-product.mdx +40 -0
- package/content/references/workflows/product/reject-product.mdx +46 -0
- package/content/references/workflows/product/request-product-change.mdx +46 -0
- package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +49 -0
- package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +46 -0
- package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +43 -0
- package/content/references/workflows/product-attribute/create-product-attributes.mdx +56 -0
- package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +30 -0
- package/content/references/workflows/product-attribute/delete-product-attributes.mdx +30 -0
- package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +29 -0
- package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +44 -0
- package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +41 -0
- package/content/references/workflows/product-attribute/update-product-attributes.mdx +48 -0
- package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +43 -0
- package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +39 -0
- package/content/references/workflows/product-edit/cancel-product-change.mdx +49 -0
- package/content/references/workflows/product-edit/confirm-product-change.mdx +57 -0
- package/content/references/workflows/product-edit/create-product-change.mdx +72 -0
- package/content/references/workflows/product-edit/reject-product-change.mdx +54 -0
- package/content/references/workflows/product-edit/stage-product-change.mdx +75 -0
- package/content/references/workflows/seller/approve-seller.mdx +34 -0
- package/content/references/workflows/seller/create-seller-account.mdx +59 -0
- package/content/references/workflows/seller/create-seller-defaults.mdx +22 -0
- package/content/references/workflows/seller/create-sellers.mdx +65 -0
- package/content/references/workflows/seller/delete-seller-professional-details.mdx +37 -0
- package/content/references/workflows/seller/delete-sellers.mdx +24 -0
- package/content/references/workflows/seller/invite-seller.mdx +28 -0
- package/content/references/workflows/seller/suspend-seller.mdx +35 -0
- package/content/references/workflows/seller/terminate-seller.mdx +35 -0
- package/content/references/workflows/seller/unsuspend-seller.mdx +34 -0
- package/content/references/workflows/seller/unterminate-seller.mdx +34 -0
- package/content/references/workflows/seller/update-seller-address.mdx +55 -0
- package/content/references/workflows/seller/update-seller-payment-details.mdx +52 -0
- package/content/references/workflows/seller/update-seller-professional-details.mdx +48 -0
- package/content/references/workflows/seller/update-sellers.mdx +57 -0
- package/content/resources/ai/llms.mdx +74 -0
- package/content/resources/ai/mcp.mdx +152 -0
- package/content/resources/ai/overview.mdx +97 -0
- package/content/resources/customization/custom-fields.mdx +182 -0
- package/content/resources/customization/extend-a-workflow.mdx +39 -0
- package/content/resources/customization/extending-panels.mdx +309 -0
- package/content/resources/deployment/medusa-cloud.mdx +167 -0
- package/content/resources/integrations/notifications.mdx +39 -0
- package/content/resources/integrations/search.mdx +122 -0
- package/content/resources/integrations/stripe-connect.mdx +395 -0
- package/content/resources/tutorials/add-a-block.mdx +74 -0
- package/content/resources/tutorials/attributes-and-variant-axes.mdx +111 -0
- package/content/resources/tutorials/build-a-block.mdx +134 -0
- package/content/resources/tutorials/configure-commissions.mdx +127 -0
- package/content/resources/tutorials/custom-api-route.mdx +142 -0
- package/content/resources/tutorials/custom-panel-page.mdx +78 -0
- package/content/resources/tutorials/first-marketplace.mdx +45 -0
- package/content/resources/tutorials/handle-product-requests.mdx +80 -0
- package/content/resources/tutorials/import-export-products.mdx +96 -0
- package/content/resources/tutorials/master-products-and-offers.mdx +89 -0
- package/content/resources/tutorials/recompose-a-page.mdx +129 -0
- package/content/resources/tutorials/replace-panel-components.mdx +116 -0
- package/content/resources/tutorials/seller-payouts-stripe.mdx +89 -0
- package/content/telemetry.mdx +67 -0
- package/content/tools/api-client.mdx +155 -0
- package/content/tools/cli.mdx +196 -0
- package/content/tools/dashboard-sdk.mdx +35 -0
- package/content/user-guide/admin/overview.mdx +23 -0
- package/content/user-guide/admin/stores.mdx +193 -0
- package/content/user-guide/vendor/overview.mdx +23 -0
- package/content/user-guide/vendor/stores.mdx +209 -0
- package/llms.txt +307 -0
- package/package.json +33 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "updateSellerProfessionalDetailsWorkflow"
|
|
3
|
+
description: "Upsert a seller's professional (business) details."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Creates or updates the professional details record attached to a seller. Also run as a step by `createSellerAccountWorkflow` when professional details are provided at registration.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { updateSellerProfessionalDetailsWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
+
|
|
13
|
+
const { result } = await updateSellerProfessionalDetailsWorkflow(container).run({
|
|
14
|
+
input: {
|
|
15
|
+
seller_id: "sel_123",
|
|
16
|
+
data: { corporate_name: "Acme GmbH", tax_id: "DE123456789" },
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Input
|
|
22
|
+
|
|
23
|
+
<ParamField body="seller_id" type="string" required>Id of the seller whose professional details are updated.</ParamField>
|
|
24
|
+
<ParamField body="data" type="UpdateProfessionalDetailsDTO" required>
|
|
25
|
+
Fields to set; all optional.
|
|
26
|
+
<Expandable title="properties">
|
|
27
|
+
<ParamField body="corporate_name" type="string">Registered corporate name.</ParamField>
|
|
28
|
+
<ParamField body="registration_number" type="string">Company registration number.</ParamField>
|
|
29
|
+
<ParamField body="tax_id" type="string">Tax identifier.</ParamField>
|
|
30
|
+
</Expandable>
|
|
31
|
+
</ParamField>
|
|
32
|
+
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
33
|
+
|
|
34
|
+
## Result
|
|
35
|
+
|
|
36
|
+
<ResponseField name="result" type="ProfessionalDetailsDTO">The updated professional details.</ResponseField>
|
|
37
|
+
|
|
38
|
+
## Hooks
|
|
39
|
+
|
|
40
|
+
- `professionalDetailsUpdated` — runs after the update with `{ professional_details, additional_data }`.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
updateSellerProfessionalDetailsWorkflow.hooks.professionalDetailsUpdated(
|
|
44
|
+
async ({ professional_details }) => {
|
|
45
|
+
// e.g. re-run KYB checks
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "updateSellersWorkflow"
|
|
3
|
+
description: "Update sellers matching a selector."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Updates every seller matching the selector with the given data. Triggered by `POST /admin/sellers/:id` and `POST /vendor/sellers/:id`. Emits `seller.updated` for each updated seller.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { updateSellersWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
+
|
|
13
|
+
const { result } = await updateSellersWorkflow(container).run({
|
|
14
|
+
input: {
|
|
15
|
+
selector: { id: "sel_123" },
|
|
16
|
+
update: { name: "Acme Inc." },
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Input
|
|
22
|
+
|
|
23
|
+
<ParamField body="selector" type="object" required>Filter selecting the sellers to update, e.g. `{ id: "sel_123" }`.</ParamField>
|
|
24
|
+
<ParamField body="update" type="UpdateSellerDTO" required>
|
|
25
|
+
Fields to update; all optional.
|
|
26
|
+
<Expandable title="properties">
|
|
27
|
+
<ParamField body="name" type="string">Display name.</ParamField>
|
|
28
|
+
<ParamField body="handle" type="string">URL handle.</ParamField>
|
|
29
|
+
<ParamField body="email" type="string">Contact email.</ParamField>
|
|
30
|
+
<ParamField body="description" type="string">Public description.</ParamField>
|
|
31
|
+
<ParamField body="logo" type="string">Logo URL.</ParamField>
|
|
32
|
+
<ParamField body="banner" type="string">Banner URL.</ParamField>
|
|
33
|
+
<ParamField body="website_url" type="string">Website URL.</ParamField>
|
|
34
|
+
<ParamField body="external_id" type="string">External system identifier.</ParamField>
|
|
35
|
+
<ParamField body="status" type="string">One of `open`, `pending_approval`, `suspended`, `terminated`.</ParamField>
|
|
36
|
+
<ParamField body="status_reason" type="string">Reason attached to the status.</ParamField>
|
|
37
|
+
<ParamField body="is_premium" type="boolean">Premium flag.</ParamField>
|
|
38
|
+
<ParamField body="closed_from" type="Date">Start of a store closure window.</ParamField>
|
|
39
|
+
<ParamField body="closed_to" type="Date">End of a store closure window.</ParamField>
|
|
40
|
+
<ParamField body="metadata" type="object">Custom key-value data.</ParamField>
|
|
41
|
+
</Expandable>
|
|
42
|
+
</ParamField>
|
|
43
|
+
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
44
|
+
|
|
45
|
+
## Result
|
|
46
|
+
|
|
47
|
+
<ResponseField name="result" type="SellerDTO[]">The updated sellers.</ResponseField>
|
|
48
|
+
|
|
49
|
+
## Hooks
|
|
50
|
+
|
|
51
|
+
- `sellersUpdated` — runs after the update with `{ sellers, additional_data }`.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
updateSellersWorkflow.hooks.sellersUpdated(async ({ sellers }) => {
|
|
55
|
+
// sync updated sellers elsewhere
|
|
56
|
+
})
|
|
57
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "LLMs"
|
|
3
|
+
description: "Feed Mercur documentation directly to LLMs for accurate, context-aware assistance."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# LLMs
|
|
7
|
+
|
|
8
|
+
Mercur documentation is optimized for Large Language Models using the [llms.txt standard](https://llmstxt.org). This gives AI tools a structured map of all documentation — so they can answer technical questions accurately instead of guessing.
|
|
9
|
+
|
|
10
|
+
Think of it like a sitemap, but for AI: a machine-readable file that describes what documentation exists, how it's organized, and where to find specific topics.
|
|
11
|
+
|
|
12
|
+
<Note>
|
|
13
|
+
This page is for **chat assistants and hosted tools** (Claude, ChatGPT). If you're using a coding agent *inside* a Mercur project, prefer the version-matched docs bundled in `node_modules/@mercurjs/docs/` — see [Building with AI](/rc/resources/ai/overview).
|
|
14
|
+
</Note>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Available files
|
|
19
|
+
|
|
20
|
+
### llms.txt
|
|
21
|
+
|
|
22
|
+
A structured index of all Mercur documentation pages with descriptions and links.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
https://docs.mercurjs.com/llms.txt
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use this when your AI tool supports llms.txt natively or when you want to give it an overview of what's available without sending the full content.
|
|
29
|
+
|
|
30
|
+
### llms-full.txt
|
|
31
|
+
|
|
32
|
+
The entire Mercur documentation compiled into a single plain-text file.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
https://docs.mercurjs.com/llms-full.txt
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use this when you want to give an LLM the complete context in one shot — ideal for complex questions that span multiple topics.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## How to use
|
|
43
|
+
|
|
44
|
+
<Tabs>
|
|
45
|
+
<Tab title="Claude Projects">
|
|
46
|
+
1. Open [Claude](https://claude.ai) and create a new Project
|
|
47
|
+
2. In project knowledge, add a URL: `https://docs.mercurjs.com/llms-full.txt`
|
|
48
|
+
3. Claude now has full Mercur documentation context in every conversation within that project
|
|
49
|
+
</Tab>
|
|
50
|
+
<Tab title="ChatGPT">
|
|
51
|
+
1. Download `https://docs.mercurjs.com/llms-full.txt`
|
|
52
|
+
2. Upload it as a file in your conversation or attach it to a Custom GPT's knowledge base
|
|
53
|
+
</Tab>
|
|
54
|
+
<Tab title="AI IDE (paste)">
|
|
55
|
+
For any AI coding tool that accepts context:
|
|
56
|
+
1. Fetch the file: `curl -o mercur-docs.txt https://docs.mercurjs.com/llms-full.txt`
|
|
57
|
+
2. Attach it to your conversation or project context
|
|
58
|
+
</Tab>
|
|
59
|
+
</Tabs>
|
|
60
|
+
|
|
61
|
+
<Tip>
|
|
62
|
+
Both files are auto-generated and always reflect the latest documentation. No maintenance required.
|
|
63
|
+
</Tip>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## When to use llms.txt vs MCP
|
|
68
|
+
|
|
69
|
+
| Approach | Best for |
|
|
70
|
+
|----------|----------|
|
|
71
|
+
| **llms.txt / llms-full.txt** | One-time context loading, tools without MCP support, offline use |
|
|
72
|
+
| **[MCP Server](/rc/resources/ai/mcp)** | Live search, always up-to-date results, integrated AI environments |
|
|
73
|
+
|
|
74
|
+
For the best experience, use the [MCP server](/rc/resources/ai/mcp) if your tool supports it. Fall back to llms.txt when MCP isn't available.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MCP Server"
|
|
3
|
+
description: "Connect your AI environment to Mercur documentation via Model Context Protocol."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MCP Server
|
|
7
|
+
|
|
8
|
+
Mercur exposes a [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that lets AI tools **search Mercur documentation directly**. Instead of relying on training data that may be outdated, your AI assistant queries the actual docs in real time.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
https://docs.mercurjs.com/mcp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Available tool
|
|
17
|
+
|
|
18
|
+
### SearchMercurJsDocumentation
|
|
19
|
+
|
|
20
|
+
Searches across all Mercur documentation and returns:
|
|
21
|
+
|
|
22
|
+
- Relevant excerpts matching your query
|
|
23
|
+
- Page titles for context
|
|
24
|
+
- Direct links to documentation pages
|
|
25
|
+
|
|
26
|
+
Use it when you need to look up API references, understand how a module works, find CLI commands, or retrieve examples during development.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Connect to your AI environment
|
|
31
|
+
|
|
32
|
+
<Tabs>
|
|
33
|
+
<Tab title="Cursor">
|
|
34
|
+
<Steps>
|
|
35
|
+
<Step title="Open MCP settings">
|
|
36
|
+
1. Press <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>
|
|
37
|
+
2. Search for **Open MCP settings**
|
|
38
|
+
3. Select **Add custom MCP**
|
|
39
|
+
</Step>
|
|
40
|
+
<Step title="Configure the server">
|
|
41
|
+
Add the following to your `mcp.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"mercur": {
|
|
47
|
+
"url": "https://docs.mercurjs.com/mcp"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
</Step>
|
|
53
|
+
<Step title="Use it">
|
|
54
|
+
Restart Cursor and ask: **"Search Mercur docs for how to add a block"**
|
|
55
|
+
</Step>
|
|
56
|
+
</Steps>
|
|
57
|
+
|
|
58
|
+
See [Cursor MCP docs](https://docs.cursor.com/en/context/mcp) for more.
|
|
59
|
+
</Tab>
|
|
60
|
+
<Tab title="VS Code">
|
|
61
|
+
<Steps>
|
|
62
|
+
<Step title="Create MCP config">
|
|
63
|
+
Create a file at `.vscode/mcp.json` in your project root.
|
|
64
|
+
</Step>
|
|
65
|
+
<Step title="Configure the server">
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"servers": {
|
|
69
|
+
"mercur": {
|
|
70
|
+
"type": "http",
|
|
71
|
+
"url": "https://docs.mercurjs.com/mcp"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
</Step>
|
|
77
|
+
<Step title="Use it">
|
|
78
|
+
Open the Copilot Chat panel and ask: **"List available MCP servers."**
|
|
79
|
+
</Step>
|
|
80
|
+
</Steps>
|
|
81
|
+
|
|
82
|
+
See [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more.
|
|
83
|
+
</Tab>
|
|
84
|
+
<Tab title="Windsurf">
|
|
85
|
+
<Steps>
|
|
86
|
+
<Step title="Open MCP config">
|
|
87
|
+
1. Press <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>
|
|
88
|
+
2. Search for **Open Windsurf MCP Configuration**
|
|
89
|
+
</Step>
|
|
90
|
+
<Step title="Configure the server">
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"mercur": {
|
|
95
|
+
"serverUrl": "https://docs.mercurjs.com/mcp"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
</Step>
|
|
101
|
+
<Step title="Use it">
|
|
102
|
+
Open Cascade and ask: **"Search Mercur docs for seller setup"**
|
|
103
|
+
</Step>
|
|
104
|
+
</Steps>
|
|
105
|
+
</Tab>
|
|
106
|
+
<Tab title="Claude">
|
|
107
|
+
<Steps>
|
|
108
|
+
<Step title="Add the MCP server">
|
|
109
|
+
1. Go to Claude → Settings → **Connectors**
|
|
110
|
+
2. Select **Add custom connector**
|
|
111
|
+
3. Enter:
|
|
112
|
+
- **Name**: Mercur
|
|
113
|
+
- **URL**: `https://docs.mercurjs.com/mcp`
|
|
114
|
+
4. Save
|
|
115
|
+
</Step>
|
|
116
|
+
<Step title="Use it">
|
|
117
|
+
In chat, click the **attachments (+)** button and select your Mercur MCP connector.
|
|
118
|
+
</Step>
|
|
119
|
+
</Steps>
|
|
120
|
+
|
|
121
|
+
See [Claude connector docs](https://modelcontextprotocol.io/docs/tutorials/use-remote-mcp-server) for more.
|
|
122
|
+
</Tab>
|
|
123
|
+
<Tab title="Claude Code">
|
|
124
|
+
<Steps>
|
|
125
|
+
<Step title="Install the MCP server">
|
|
126
|
+
```bash
|
|
127
|
+
claude mcp add --transport http mercur https://docs.mercurjs.com/mcp
|
|
128
|
+
```
|
|
129
|
+
</Step>
|
|
130
|
+
<Step title="Verify installation">
|
|
131
|
+
```bash
|
|
132
|
+
claude mcp list
|
|
133
|
+
```
|
|
134
|
+
</Step>
|
|
135
|
+
<Step title="Use it">
|
|
136
|
+
Claude Code can now query Mercur documentation directly during any conversation.
|
|
137
|
+
</Step>
|
|
138
|
+
</Steps>
|
|
139
|
+
|
|
140
|
+
See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for more.
|
|
141
|
+
</Tab>
|
|
142
|
+
</Tabs>
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Choosing an approach
|
|
147
|
+
|
|
148
|
+
| Approach | Best for |
|
|
149
|
+
|----------|----------|
|
|
150
|
+
| **[Bundled docs](/rc/resources/ai/overview)** | Coding agents inside a project — version-matched, offline, no setup |
|
|
151
|
+
| **MCP Server** | Live search from your editor, always the latest published docs |
|
|
152
|
+
| **[llms.txt](/rc/resources/ai/llms)** | Feeding full context to a chat assistant (Claude, ChatGPT) |
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Building with AI"
|
|
3
|
+
description: "Mercur ships version-matched docs inside your project so AI coding agents build from accurate APIs instead of stale training data."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Mercur is built so AI coding agents work from **accurate, version-matched documentation** instead of their training data — which is almost always out of date for a fast-moving framework. The docs ship *inside your project's dependencies*, and your project tells agents to read them before writing any code.
|
|
7
|
+
|
|
8
|
+
<Info>
|
|
9
|
+
**Why agents do well here.** Every extension surface an agent touches has a machine-checkable contract: routes generate the [typed client](/rc/tools/api-client) (wrong calls fail to compile), pages follow [file conventions](/rc/resources/customization/extending-panels) the SDK validates at build time, and blocks are diffable source. An agent doesn't need to guess whether its change works — the toolchain tells it.
|
|
10
|
+
</Info>
|
|
11
|
+
|
|
12
|
+
## How it works
|
|
13
|
+
|
|
14
|
+
When you install a Mercur project, the documentation is bundled as a dependency at `node_modules/@mercurjs/docs/`. It mirrors the structure of this site:
|
|
15
|
+
|
|
16
|
+
```txt
|
|
17
|
+
node_modules/@mercurjs/docs/
|
|
18
|
+
├── llms.txt # index: every page with a one-line description
|
|
19
|
+
└── content/
|
|
20
|
+
├── learn/ # concepts — sellers, products, offers, commissions…
|
|
21
|
+
├── resources/ # tutorials, integrations, deployment, this guide
|
|
22
|
+
├── tools/ # CLI, API client, dashboard SDK
|
|
23
|
+
├── references/ # module, HTTP API, and configuration reference
|
|
24
|
+
└── user-guide/ # admin and vendor panel usage
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Because the docs travel with the package, an agent always has documentation that **matches your installed version** — no network request, no external lookup, and no drift between what the agent reads and what your code actually runs.
|
|
28
|
+
|
|
29
|
+
## Set up your project
|
|
30
|
+
|
|
31
|
+
### New projects
|
|
32
|
+
|
|
33
|
+
Projects created with `bunx @mercurjs/cli@rc create` are ready out of the box. The template ships:
|
|
34
|
+
|
|
35
|
+
- `@mercurjs/docs` as a dependency, so the docs land in `node_modules` on install
|
|
36
|
+
- an `AGENTS.md` and a `CLAUDE.md` at the project root that tell agents to read the bundled docs first
|
|
37
|
+
|
|
38
|
+
Most AI coding agents — Claude Code, Cursor, GitHub Copilot, and others — read `AGENTS.md` automatically when they start a session. There is nothing else to configure.
|
|
39
|
+
|
|
40
|
+
### Existing projects
|
|
41
|
+
|
|
42
|
+
Add the docs dependency:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bun add @mercurjs/docs
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then create an `AGENTS.md` at the project root with a single, focused instruction:
|
|
49
|
+
|
|
50
|
+
```md AGENTS.md
|
|
51
|
+
# Mercur: read the docs before coding
|
|
52
|
+
|
|
53
|
+
Before any non-trivial change, read the bundled documentation — it is
|
|
54
|
+
version-matched to this project's installed packages, and far more accurate
|
|
55
|
+
than training data.
|
|
56
|
+
|
|
57
|
+
1. Read the index: `node_modules/@mercurjs/docs/llms.txt`
|
|
58
|
+
2. Open the pages it points to under `node_modules/@mercurjs/docs/content/`
|
|
59
|
+
|
|
60
|
+
Don't guess at an API, data model, or file convention the docs already describe.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
[Claude Code](https://docs.anthropic.com/en/docs/claude-code) reads `CLAUDE.md`; point it at the same instructions instead of duplicating them:
|
|
64
|
+
|
|
65
|
+
```md CLAUDE.md
|
|
66
|
+
@AGENTS.md
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## What the agent reads
|
|
70
|
+
|
|
71
|
+
The workflow is deliberately simple: **index first, then the page.** An agent reads `llms.txt` to see what exists, then opens the one or two `content/` pages relevant to the task before implementing. The bundled docs cover the full domain model (sellers, products, offers, attributes, commissions, payouts, order groups), the CLI, the typed API client, the dashboard SDK, module references, and how-to guides — so the agent looks up the correct contract rather than inventing one.
|
|
72
|
+
|
|
73
|
+
## Verify its work
|
|
74
|
+
|
|
75
|
+
Mercur gives an agent a fast, machine-checkable way to know whether a change is correct — the equivalent of a grading loop it can run itself:
|
|
76
|
+
|
|
77
|
+
| Check | What it proves |
|
|
78
|
+
|-------|----------------|
|
|
79
|
+
| `bun run build` | Types resolve and the generated client matches the routes |
|
|
80
|
+
| `bun run lint` | Code conforms to the project's rules |
|
|
81
|
+
| Integration tests (`packages/api`) | Backend behavior still holds |
|
|
82
|
+
| `bunx @mercurjs/cli@rc diff` | Local blocks vs. the registry — what changed and what drifted |
|
|
83
|
+
|
|
84
|
+
Because these are objective, an agent can define what "done" looks like, run the checks, read the output, and iterate until they pass — instead of stopping at "looks plausible."
|
|
85
|
+
|
|
86
|
+
## Beyond bundled docs
|
|
87
|
+
|
|
88
|
+
The bundled docs are for agents working *inside your project*. For chat assistants and hosted tools, Mercur also publishes its docs online:
|
|
89
|
+
|
|
90
|
+
<CardGroup cols={2}>
|
|
91
|
+
<Card title="llms.txt" href="/rc/resources/ai/llms">
|
|
92
|
+
Feed the full documentation to Claude, ChatGPT, or any LLM.
|
|
93
|
+
</Card>
|
|
94
|
+
<Card title="MCP server" href="/rc/resources/ai/mcp">
|
|
95
|
+
Let your editor search the docs live via Model Context Protocol.
|
|
96
|
+
</Card>
|
|
97
|
+
</CardGroup>
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Custom Fields"
|
|
3
|
+
description: "Extend any Medusa entity with additional fields without modifying core code."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Custom Fields let you attach extra data to any existing Medusa entity — products, customers, orders, and more — through configuration alone. No migrations to write, no models to define. The module handles table creation and schema updates automatically when you run `db:migrate`.
|
|
7
|
+
|
|
8
|
+
<Info>
|
|
9
|
+
**Where this sits in the stack.** Custom Fields is a Mercur module (`@mercurjs/core/modules/custom-fields`) layered on top of Medusa's standard module-link system — it generates the side table, the link, and the schema for you. It's the lightest way to add data to an entity.
|
|
10
|
+
</Info>
|
|
11
|
+
|
|
12
|
+
## When to use Custom Fields
|
|
13
|
+
|
|
14
|
+
<Tip>
|
|
15
|
+
**Use Custom Fields when** the data is a plain property of an existing entity — it belongs to exactly one record, has no lifecycle of its own, and you mostly read it alongside its parent. Typical cases:
|
|
16
|
+
|
|
17
|
+
- A `brand`, `warranty_months`, or `is_featured` flag on a product
|
|
18
|
+
- A `company_name` or loyalty `tier` on a customer
|
|
19
|
+
- An internal `source` or `priority` tag on an order
|
|
20
|
+
|
|
21
|
+
You get a typed column, a default value, and queryability through `query.graph` — for the cost of one config entry and a `db:migrate`.
|
|
22
|
+
</Tip>
|
|
23
|
+
|
|
24
|
+
<Warning>
|
|
25
|
+
**Build a custom Medusa module instead when** the data outgrows "extra columns":
|
|
26
|
+
|
|
27
|
+
- It has its **own lifecycle** — created, updated, and deleted independently of the parent (e.g. reviews, support tickets)
|
|
28
|
+
- It has **relations** to more than one entity, or many records per parent
|
|
29
|
+
- It carries **business logic** — validation rules, state transitions, workflows
|
|
30
|
+
- You need **its own API routes** and permissions around it
|
|
31
|
+
|
|
32
|
+
Custom Fields is strictly one row per parent entity. Forcing a one-to-many or stateful concept into a JSON field works until it doesn't — model it as a module (or check whether a [block](/rc/learn/blocks) already ships it).
|
|
33
|
+
</Warning>
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
The Custom Fields module creates a separate table for each entity you extend (e.g. `product_custom_fields`). Each table is linked back to the original entity via a foreign key with a unique constraint, ensuring a one-to-one relationship. The module automatically registers these links so you can query custom fields through Medusa's standard remote query.
|
|
38
|
+
|
|
39
|
+
## Set up custom fields
|
|
40
|
+
|
|
41
|
+
<Steps>
|
|
42
|
+
<Step title="Define your fields in medusa-config.ts">
|
|
43
|
+
Register the Custom Fields module and describe your fields in the `customFields` option:
|
|
44
|
+
|
|
45
|
+
```ts medusa-config.ts
|
|
46
|
+
import { Modules } from "@medusajs/framework/utils";
|
|
47
|
+
|
|
48
|
+
module.exports = defineConfig({
|
|
49
|
+
// ...
|
|
50
|
+
modules: [
|
|
51
|
+
{
|
|
52
|
+
resolve: "@mercurjs/core/modules/custom-fields",
|
|
53
|
+
options: {
|
|
54
|
+
customFields: {
|
|
55
|
+
Product: {
|
|
56
|
+
brand: { type: "string", nullable: true },
|
|
57
|
+
is_featured: { type: "boolean", defaultValue: false },
|
|
58
|
+
weight: { type: "float", nullable: true },
|
|
59
|
+
},
|
|
60
|
+
Customer: {
|
|
61
|
+
company_name: { type: "string", nullable: true },
|
|
62
|
+
tier: {
|
|
63
|
+
type: "enum",
|
|
64
|
+
enum: ["bronze", "silver", "gold"],
|
|
65
|
+
defaultValue: "bronze",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<Warning>
|
|
76
|
+
The key in `customFields` (e.g. `Product`, `Customer`) must match the entity name as registered in Medusa's joiner configuration — a mismatched name fails at link resolution, not at config load, so double-check spelling and casing.
|
|
77
|
+
</Warning>
|
|
78
|
+
</Step>
|
|
79
|
+
<Step title="Run migrations">
|
|
80
|
+
```bash
|
|
81
|
+
bunx medusa db:migrate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The module generates and applies the schema for each side table automatically.
|
|
85
|
+
</Step>
|
|
86
|
+
<Step title="Query the fields">
|
|
87
|
+
Custom fields are automatically linked to their parent entity. Retrieve them with Medusa's remote query:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const products = await query.graph({
|
|
91
|
+
entity: "product",
|
|
92
|
+
fields: ["id", "title", "custom_fields.*"],
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
</Step>
|
|
96
|
+
</Steps>
|
|
97
|
+
|
|
98
|
+
## Supported field types
|
|
99
|
+
|
|
100
|
+
| Type | Description |
|
|
101
|
+
| ---------- | --------------------------------------------------------- |
|
|
102
|
+
| `string` | Short text |
|
|
103
|
+
| `text` | Long text |
|
|
104
|
+
| `integer` | Whole number |
|
|
105
|
+
| `float` | Decimal number |
|
|
106
|
+
| `boolean` | True/false |
|
|
107
|
+
| `date` | Date only |
|
|
108
|
+
| `time` | Time only |
|
|
109
|
+
| `datetime` | Date and time |
|
|
110
|
+
| `json` | JSON object |
|
|
111
|
+
| `array` | Array of values |
|
|
112
|
+
| `enum` | One of a predefined set of values (requires `enum` array) |
|
|
113
|
+
|
|
114
|
+
### Field options
|
|
115
|
+
|
|
116
|
+
| Option | Type | Default | Description |
|
|
117
|
+
| -------------- | ---------- | ------- | ------------------------------------------------ |
|
|
118
|
+
| `nullable` | `boolean` | `true` | Whether the field can be null |
|
|
119
|
+
| `defaultValue` | `any` | `null` | Default value for the field |
|
|
120
|
+
| `enum` | `string[]` | — | Required for `enum` type. List of allowed values |
|
|
121
|
+
|
|
122
|
+
## Using the service directly
|
|
123
|
+
|
|
124
|
+
The Custom Fields module exposes a service with `upsert`, `delete`, and `list` methods. You can use these in your own workflows and API routes:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { MercurModules } from "@mercurjs/types";
|
|
128
|
+
|
|
129
|
+
// In a step or API route
|
|
130
|
+
const customFieldsService = container.resolve(MercurModules.CUSTOM_FIELDS);
|
|
131
|
+
|
|
132
|
+
// Create or update custom fields for a product
|
|
133
|
+
await customFieldsService.upsert("product", {
|
|
134
|
+
id: "prod_123",
|
|
135
|
+
brand: "Acme",
|
|
136
|
+
is_featured: true,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Delete custom fields by record ID
|
|
140
|
+
await customFieldsService.delete("product", ["cf_456"]);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The `upsert` method accepts either a single object or an array. If a record already exists for the given entity ID, it updates it; otherwise, it creates a new one.
|
|
144
|
+
|
|
145
|
+
## Workflow steps
|
|
146
|
+
|
|
147
|
+
The module ships with two workflow steps you can compose into your own workflows:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import {
|
|
151
|
+
upsertCustomFieldsStep,
|
|
152
|
+
deleteCustomFieldsStep,
|
|
153
|
+
} from "@mercurjs/core/workflows";
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- **`upsertCustomFieldsStep`** — Takes `{ alias, data }` where `alias` is the entity name (e.g. `"product"`) and `data` contains the entity ID and field values.
|
|
157
|
+
- **`deleteCustomFieldsStep`** — Takes `{ alias, ids }` to soft-delete custom field records by their IDs.
|
|
158
|
+
|
|
159
|
+
## FAQ
|
|
160
|
+
|
|
161
|
+
<AccordionGroup>
|
|
162
|
+
<Accordion title="Can I add or change fields after the first migration?">
|
|
163
|
+
Yes — edit the `customFields` config and run `db:migrate` again; the module updates the side table's schema. Removing a field from config stops exposing it; treat destructive column changes with the same care as any schema migration.
|
|
164
|
+
</Accordion>
|
|
165
|
+
<Accordion title="How do vendors or admins edit these values from the panels?">
|
|
166
|
+
Through your own UI: add a page or re-compose an existing one ([extending panels](/rc/resources/customization/extending-panels)) and call an API route that uses the service's `upsert` — or compose `upsertCustomFieldsStep` into a workflow behind a [custom route](/rc/resources/tutorials/custom-api-route).
|
|
167
|
+
</Accordion>
|
|
168
|
+
<Accordion title="Can one entity have multiple custom-field records?">
|
|
169
|
+
No — the side table has a unique constraint on the parent ID, enforcing one-to-one. If you need many records per parent, that's a custom module, not custom fields.
|
|
170
|
+
</Accordion>
|
|
171
|
+
</AccordionGroup>
|
|
172
|
+
|
|
173
|
+
## Next steps
|
|
174
|
+
|
|
175
|
+
<CardGroup cols={2}>
|
|
176
|
+
<Card title="Add a custom API route" href="/rc/resources/tutorials/custom-api-route">
|
|
177
|
+
Expose your custom fields through a typed endpoint.
|
|
178
|
+
</Card>
|
|
179
|
+
<Card title="Extend a workflow" href="/rc/resources/customization/extend-a-workflow">
|
|
180
|
+
Write custom fields from inside existing business flows.
|
|
181
|
+
</Card>
|
|
182
|
+
</CardGroup>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Extend a workflow"
|
|
3
|
+
description: "Inject custom logic into an existing Mercur workflow through hooks — without rewriting it."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<Note>
|
|
7
|
+
This guide is being written. The outline below is the intended structure.
|
|
8
|
+
</Note>
|
|
9
|
+
|
|
10
|
+
<Info>
|
|
11
|
+
**Workflows are Medusa's extension model — Mercur keeps it.** Unlike the panels (where Mercur ships [its own customization framework](/rc/resources/customization/extending-panels)), backend logic follows Medusa conventions unchanged: Mercur's workflows expose hooks you inject steps into, with the same compensation/rollback semantics as any Medusa workflow. Skills learned in plain Medusa transfer here one-to-one.
|
|
12
|
+
</Info>
|
|
13
|
+
|
|
14
|
+
## Why hooks
|
|
15
|
+
|
|
16
|
+
Extend behavior without forking or rewriting the workflow.
|
|
17
|
+
|
|
18
|
+
<Steps>
|
|
19
|
+
<Step title="Pick the target hook">
|
|
20
|
+
The `completeCartWithSplitOrdersWorkflow` and where its hooks sit.
|
|
21
|
+
</Step>
|
|
22
|
+
<Step title="Inject a step">
|
|
23
|
+
The shape of a hook and how to register your step.
|
|
24
|
+
</Step>
|
|
25
|
+
<Step title="Handle compensation and rollback">
|
|
26
|
+
How your step participates in automatic rollback on failure.
|
|
27
|
+
</Step>
|
|
28
|
+
</Steps>
|
|
29
|
+
|
|
30
|
+
## Verify
|
|
31
|
+
|
|
32
|
+
Confirm the injected behavior runs and rolls back correctly.
|
|
33
|
+
|
|
34
|
+
## Next steps
|
|
35
|
+
|
|
36
|
+
<CardGroup cols={2}>
|
|
37
|
+
<Card title="Add a custom API route" href="/rc/resources/tutorials/custom-api-route" />
|
|
38
|
+
<Card title="Custom fields" href="/rc/resources/customization/custom-fields" />
|
|
39
|
+
</CardGroup>
|