@mercurjs/docs 2.2.1 → 2.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/home.mdx +107 -0
- package/content/learn/architecture.mdx +168 -83
- package/content/learn/introduction.mdx +161 -56
- package/content/learn/migration-to-2-0.mdx +187 -0
- package/content/learn/why-mercur.mdx +91 -0
- package/content/platform/attribute/concepts/attribute-types.mdx +59 -0
- package/content/platform/attribute/concepts/global-vs-inline.mdx +50 -0
- package/content/platform/attribute/concepts/variant-axes.mdx +61 -0
- package/content/platform/attribute/guides/attach-attributes-to-a-product.mdx +69 -0
- package/content/platform/attribute/guides/create-a-variant-axis.mdx +83 -0
- package/content/platform/attribute/guides/create-an-attribute.mdx +81 -0
- package/content/platform/attribute/overview.mdx +87 -0
- package/content/platform/attribute/reference/data-models.mdx +56 -0
- package/content/platform/attribute/reference/events.mdx +41 -0
- package/content/platform/attribute/reference/links.mdx +45 -0
- package/content/platform/attribute/reference/service.mdx +49 -0
- package/content/platform/attribute/reference/workflows.mdx +45 -0
- package/content/platform/catalog/concepts/master-products.mdx +54 -0
- package/content/platform/catalog/concepts/product-seller-allowlist.mdx +48 -0
- package/content/platform/catalog/concepts/status-lifecycle.mdx +58 -0
- package/content/platform/catalog/concepts/variants-categories-collections.mdx +49 -0
- package/content/platform/catalog/guides/allowlist-stores.mdx +59 -0
- package/content/platform/catalog/guides/create-a-master-product.mdx +70 -0
- package/content/platform/catalog/guides/publish-or-reject-a-product.mdx +79 -0
- package/content/platform/catalog/overview.mdx +90 -0
- package/content/platform/catalog/reference/data-models.mdx +66 -0
- package/content/platform/catalog/reference/events.mdx +41 -0
- package/content/platform/catalog/reference/links.mdx +44 -0
- package/content/platform/catalog/reference/service.mdx +52 -0
- package/content/platform/catalog/reference/workflows.mdx +40 -0
- package/content/platform/commission/concepts/order-commission-lines.mdx +65 -0
- package/content/platform/commission/concepts/rule-matching.mdx +86 -0
- package/content/platform/commission/concepts/rules-and-rates.mdx +84 -0
- package/content/platform/commission/guides/batch-update-rules.mdx +58 -0
- package/content/platform/commission/guides/create-a-rate.mdx +72 -0
- package/content/platform/commission/guides/refresh-order-commission-lines.mdx +55 -0
- package/content/platform/commission/overview.mdx +86 -0
- package/content/platform/commission/reference/data-models.mdx +75 -0
- package/content/platform/commission/reference/events.mdx +58 -0
- package/content/platform/commission/reference/links.mdx +45 -0
- package/content/platform/commission/reference/service.mdx +51 -0
- package/content/platform/commission/reference/workflows.mdx +40 -0
- package/content/platform/offer/concepts/pricing-and-inventory.mdx +72 -0
- package/content/platform/offer/concepts/shipping.mdx +48 -0
- package/content/platform/offer/concepts/what-is-an-offer.mdx +65 -0
- package/content/platform/offer/guides/bulk-create-offers.mdx +84 -0
- package/content/platform/offer/guides/create-an-offer.mdx +83 -0
- package/content/platform/offer/guides/manage-offer-inventory.mdx +53 -0
- package/content/platform/offer/overview.mdx +84 -0
- package/content/platform/offer/reference/data-models.mdx +56 -0
- package/content/platform/offer/reference/events.mdx +39 -0
- package/content/platform/offer/reference/links.mdx +60 -0
- package/content/platform/offer/reference/service.mdx +53 -0
- package/content/platform/offer/reference/workflows.mdx +38 -0
- package/content/platform/order-group/concepts/computed-totals.mdx +59 -0
- package/content/platform/order-group/concepts/order-splitting.mdx +61 -0
- package/content/platform/order-group/concepts/the-order-group.mdx +64 -0
- package/content/platform/order-group/guides/list-order-groups.mdx +67 -0
- package/content/platform/order-group/guides/retrieve-an-order-group.mdx +63 -0
- package/content/platform/order-group/guides/split-a-cart.mdx +58 -0
- package/content/platform/order-group/overview.mdx +83 -0
- package/content/platform/order-group/reference/data-models.mdx +40 -0
- package/content/platform/order-group/reference/events.mdx +37 -0
- package/content/platform/order-group/reference/links.mdx +45 -0
- package/content/platform/order-group/reference/service.mdx +50 -0
- package/content/platform/order-group/reference/workflows.mdx +39 -0
- package/content/platform/payout/concepts/account-lifecycle.mdx +75 -0
- package/content/platform/payout/concepts/accounts-and-onboarding.mdx +70 -0
- package/content/platform/payout/concepts/payout-pipeline.mdx +99 -0
- package/content/platform/payout/guides/create-a-payout-account.mdx +59 -0
- package/content/platform/payout/guides/process-a-provider-webhook.mdx +74 -0
- package/content/platform/payout/guides/start-provider-onboarding.mdx +50 -0
- package/content/platform/payout/overview.mdx +86 -0
- package/content/platform/payout/reference/data-models.mdx +61 -0
- package/content/platform/payout/reference/events.mdx +48 -0
- package/content/platform/payout/reference/links.mdx +36 -0
- package/content/platform/payout/reference/service.mdx +53 -0
- package/content/platform/payout/reference/workflows.mdx +32 -0
- package/content/platform/product-edit/concepts/change-actions.mdx +66 -0
- package/content/platform/product-edit/concepts/change-pipeline.mdx +69 -0
- package/content/platform/product-edit/concepts/status-and-auto-confirm.mdx +66 -0
- package/content/platform/product-edit/guides/confirm-or-decline-a-change.mdx +76 -0
- package/content/platform/product-edit/guides/edit-a-product.mdx +74 -0
- package/content/platform/product-edit/guides/request-a-revision.mdx +54 -0
- package/content/platform/product-edit/overview.mdx +85 -0
- package/content/platform/product-edit/reference/data-models.mdx +65 -0
- package/content/platform/product-edit/reference/events.mdx +47 -0
- package/content/platform/product-edit/reference/links.mdx +39 -0
- package/content/platform/product-edit/reference/service.mdx +43 -0
- package/content/platform/product-edit/reference/workflows.mdx +49 -0
- package/content/platform/review/concepts/product-vs-seller-reviews.mdx +63 -0
- package/content/platform/review/concepts/ratings-and-moderation.mdx +64 -0
- package/content/platform/review/concepts/the-review-model.mdx +56 -0
- package/content/platform/review/guides/compute-aggregate-ratings.mdx +57 -0
- package/content/platform/review/guides/create-a-review.mdx +55 -0
- package/content/platform/review/guides/moderate-a-review.mdx +58 -0
- package/content/platform/review/guides/respond-to-a-review.mdx +61 -0
- package/content/platform/review/overview.mdx +87 -0
- package/content/platform/review/reference/data-models.mdx +36 -0
- package/content/platform/review/reference/events.mdx +61 -0
- package/content/platform/review/reference/links.mdx +43 -0
- package/content/platform/review/reference/service.mdx +54 -0
- package/content/platform/review/reference/workflows.mdx +31 -0
- package/content/platform/store/concepts/lifecycle.mdx +62 -0
- package/content/platform/store/concepts/store-entity.mdx +53 -0
- package/content/platform/store/concepts/team.mdx +50 -0
- package/content/platform/store/guides/create-a-store.mdx +55 -0
- package/content/platform/store/guides/manage-the-team.mdx +55 -0
- package/content/platform/store/guides/moderate-a-store.mdx +59 -0
- package/content/platform/store/overview.mdx +86 -0
- package/content/platform/store/reference/data-models.mdx +89 -0
- package/content/platform/store/reference/events.mdx +43 -0
- package/content/platform/store/reference/links.mdx +71 -0
- package/content/platform/store/reference/service.mdx +51 -0
- package/content/platform/store/reference/workflows.mdx +35 -0
- package/content/references/api/admin/commission-rates/create-commission-rate.mdx +1 -1
- package/content/references/api/admin/commission-rates/list-commission-rates.mdx +2 -2
- package/content/references/api/admin/commission-rates/update-commission-rate.mdx +1 -1
- package/content/references/api/admin/offers/batch-create-offers.mdx +3 -3
- package/content/references/api/admin/order-groups/list-order-groups.mdx +1 -1
- package/content/references/api/admin/product-attributes/create-attribute-value.mdx +2 -2
- package/content/references/api/admin/product-attributes/create-product-attribute.mdx +1 -1
- package/content/references/api/admin/product-attributes/update-product-attribute.mdx +1 -1
- package/content/references/api/admin/product-changes/confirm-product-change.mdx +1 -1
- package/content/references/api/admin/products/batch-product-attributes.mdx +1 -1
- package/content/references/api/admin/products/create-product.mdx +1 -1
- package/content/references/api/admin/products/preview-product.mdx +1 -1
- package/content/references/api/admin.mdx +4 -5
- package/content/references/api/conventions.mdx +9 -7
- package/content/references/api/store/carts/add-line-item.mdx +1 -1
- package/content/references/api/store/offers/list-offers.mdx +1 -1
- package/content/references/api/store/order-groups/list-order-groups.mdx +1 -1
- package/content/references/api/store.mdx +4 -13
- package/content/references/api/vendor/members/accept-member-invite.mdx +1 -1
- package/content/references/api/vendor/offers/batch-create-offers.mdx +4 -0
- package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +2 -0
- package/content/references/api/vendor/offers/create-offer.mdx +13 -1
- package/content/references/api/vendor/offers/list-offers.mdx +4 -0
- package/content/references/api/vendor/offers/retrieve-offer.mdx +4 -0
- package/content/references/api/vendor/offers/update-offer.mdx +12 -0
- package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +1 -1
- package/content/references/api/vendor/products/batch-product-attributes.mdx +1 -1
- package/content/references/api/vendor/products/create-product-variant.mdx +1 -1
- package/content/references/api/vendor/products/create-product.mdx +1 -1
- package/content/references/api/vendor/products/delete-product.mdx +1 -1
- package/content/references/api/vendor/products/update-product.mdx +1 -1
- package/content/references/api/vendor/sellers/create-seller.mdx +2 -2
- package/content/references/api/vendor/sellers/list-sellers.mdx +1 -1
- package/content/references/api/vendor.mdx +6 -5
- package/content/references/configuration.mdx +16 -33
- package/content/references/overview.mdx +34 -52
- package/content/references/panel-extensions/create-page.mdx +194 -0
- package/content/references/panel-extensions/custom-fields.mdx +256 -0
- package/content/references/panel-extensions/overview.mdx +102 -0
- package/content/references/panel-extensions/widgets.mdx +212 -0
- package/content/resources/ai/mcp.mdx +2 -2
- package/content/resources/ai/overview.mdx +21 -16
- package/content/resources/ai/skills.mdx +67 -0
- package/content/resources/best-practices/api-routes.mdx +55 -43
- package/content/resources/best-practices/custom-fields.mdx +116 -92
- package/content/resources/best-practices/frontend.mdx +62 -50
- package/content/resources/best-practices/module-links.mdx +48 -34
- package/content/resources/best-practices/modules.mdx +53 -27
- package/content/resources/best-practices/overview.mdx +45 -17
- package/content/resources/best-practices/subscribers-and-jobs.mdx +37 -24
- package/content/resources/best-practices/types.mdx +38 -23
- package/content/resources/best-practices/workflows.mdx +33 -21
- package/content/resources/customization/custom-fields.mdx +15 -15
- package/content/resources/customization/extend-a-workflow.mdx +7 -4
- package/content/resources/customization/extending-panels.mdx +55 -52
- package/content/resources/deployment/medusa-cloud.mdx +21 -20
- package/content/resources/deployment/self-host.mdx +123 -0
- package/content/resources/integrations/overview.mdx +38 -0
- package/content/resources/integrations/stripe-connect.mdx +39 -38
- package/content/resources/tutorials/add-a-block.mdx +25 -18
- package/content/resources/tutorials/add-a-widget.mdx +32 -23
- package/content/resources/tutorials/add-order-detail-button.mdx +33 -20
- package/content/resources/tutorials/attributes-and-variant-axes.mdx +28 -27
- package/content/resources/tutorials/build-a-block.mdx +26 -15
- package/content/resources/tutorials/custom-api-route.mdx +32 -20
- package/content/resources/tutorials/custom-panel-page.mdx +21 -12
- package/content/resources/tutorials/customize-navigation.mdx +30 -23
- package/content/resources/tutorials/extend-forms-and-tables.mdx +36 -28
- package/content/resources/tutorials/extend-onboarding.mdx +38 -35
- package/content/resources/tutorials/master-products-and-offers.mdx +28 -23
- package/content/telemetry.mdx +3 -3
- package/content/user-guide/admin/attributes/how-tos/create-an-attribute.mdx +64 -0
- package/content/user-guide/admin/attributes/how-tos/manage-possible-values.mdx +40 -0
- package/content/user-guide/admin/attributes/overview.mdx +22 -0
- package/content/user-guide/admin/commissions/how-tos/create-a-commission-rule.mdx +63 -0
- package/content/user-guide/admin/commissions/how-tos/edit-the-global-commission.mdx +48 -0
- package/content/user-guide/admin/commissions/how-tos/manage-a-commission-rule.mdx +45 -0
- package/content/user-guide/admin/commissions/overview.mdx +25 -0
- package/content/user-guide/admin/overview.mdx +20 -12
- package/content/user-guide/admin/product-requests/how-tos/review-a-new-product.mdx +58 -0
- package/content/user-guide/admin/product-requests/how-tos/review-a-product-edit.mdx +48 -0
- package/content/user-guide/admin/product-requests/overview.mdx +25 -0
- package/content/user-guide/vendor/offers/how-tos/create-an-offer.mdx +59 -0
- package/content/user-guide/vendor/offers/how-tos/update-prices-and-stock.mdx +40 -0
- package/content/user-guide/vendor/offers/overview.mdx +22 -0
- package/content/user-guide/vendor/onboarding.mdx +79 -0
- package/content/user-guide/vendor/orders/how-tos/fulfill-an-order.mdx +49 -0
- package/content/user-guide/vendor/orders/how-tos/mark-an-order-as-delivered.mdx +33 -0
- package/content/user-guide/vendor/orders/how-tos/process-a-return.mdx +42 -0
- package/content/user-guide/vendor/orders/how-tos/refund-an-order.mdx +38 -0
- package/content/user-guide/vendor/orders/how-tos/ship-an-order.mdx +40 -0
- package/content/user-guide/vendor/orders/overview.mdx +31 -0
- package/content/user-guide/vendor/overview.mdx +23 -12
- package/content/user-guide/vendor/products/how-tos/edit-a-product.mdx +44 -0
- package/content/user-guide/vendor/products/how-tos/submit-a-product.mdx +63 -0
- package/content/user-guide/vendor/products/overview.mdx +22 -0
- package/llms.txt +176 -142
- package/package.json +1 -1
- package/content/learn/concepts.mdx +0 -84
- package/content/learn/installation.mdx +0 -117
- package/content/learn/mirakl-alternative.mdx +0 -86
- package/content/migration/from-1-x-to-2-0.mdx +0 -152
- package/content/migration/from-2-0-to-2-1.mdx +0 -105
- package/content/migration/overview.mdx +0 -58
- package/content/references/api/store/search/search.mdx +0 -136
- package/content/references/modules/commission.mdx +0 -106
- package/content/references/modules/custom-fields.mdx +0 -45
- package/content/references/modules/media.mdx +0 -55
- package/content/references/modules/offer.mdx +0 -64
- package/content/references/modules/payout.mdx +0 -121
- package/content/references/modules/product-attribute.mdx +0 -111
- package/content/references/modules/product-edit.mdx +0 -80
- package/content/references/modules/search.mdx +0 -112
- package/content/references/modules/seller.mdx +0 -175
- package/content/references/panel-extension-api.mdx +0 -337
- package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +0 -48
- package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +0 -36
- package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +0 -39
- package/content/references/workflows/cart/update-cart-seller-promotions.mdx +0 -42
- package/content/references/workflows/commission/batch-commission-rules.mdx +0 -49
- package/content/references/workflows/commission/create-commission-rates.mdx +0 -41
- package/content/references/workflows/commission/delete-commission-rates.mdx +0 -34
- package/content/references/workflows/commission/refresh-order-commission-lines.mdx +0 -30
- package/content/references/workflows/commission/update-commission-rates.mdx +0 -35
- package/content/references/workflows/media/set-category-images.mdx +0 -41
- package/content/references/workflows/media/set-collection-images.mdx +0 -41
- package/content/references/workflows/member/accept-member-invite.mdx +0 -33
- package/content/references/workflows/member/add-seller-member.mdx +0 -30
- package/content/references/workflows/member/create-member-invites.mdx +0 -34
- package/content/references/workflows/member/delete-member-invite.mdx +0 -24
- package/content/references/workflows/member/remove-seller-member.mdx +0 -28
- package/content/references/workflows/member/resend-member-invite.mdx +0 -28
- package/content/references/workflows/member/update-member-role.mdx +0 -28
- package/content/references/workflows/member/update-member.mdx +0 -35
- package/content/references/workflows/offer/batch-offer-inventory-items.mdx +0 -62
- package/content/references/workflows/offer/create-offers.mdx +0 -65
- package/content/references/workflows/offer/delete-offers.mdx +0 -35
- package/content/references/workflows/offer/update-offers.mdx +0 -53
- package/content/references/workflows/order/cancel-order-fulfillment.mdx +0 -34
- package/content/references/workflows/order/confirm-claim-request.mdx +0 -25
- package/content/references/workflows/order/confirm-exchange-request.mdx +0 -25
- package/content/references/workflows/order/confirm-order-edit-request.mdx +0 -25
- package/content/references/workflows/order/confirm-return-receive.mdx +0 -25
- package/content/references/workflows/order/create-order-fulfillment.mdx +0 -45
- package/content/references/workflows/order-group/get-order-group-detail.mdx +0 -29
- package/content/references/workflows/order-group/get-order-groups-list.mdx +0 -38
- package/content/references/workflows/overview.mdx +0 -72
- package/content/references/workflows/payout/create-onboarding.mdx +0 -36
- package/content/references/workflows/payout/create-payout-account.mdx +0 -33
- package/content/references/workflows/payout/create-payout.mdx +0 -30
- package/content/references/workflows/payout/process-payout-for-webhook.mdx +0 -34
- package/content/references/workflows/product/confirm-products.mdx +0 -48
- package/content/references/workflows/product/create-products.mdx +0 -63
- package/content/references/workflows/product/link-sellers-to-product-category.mdx +0 -40
- package/content/references/workflows/product/link-sellers-to-product.mdx +0 -40
- package/content/references/workflows/product/reject-product.mdx +0 -48
- package/content/references/workflows/product/request-product-change.mdx +0 -48
- package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +0 -49
- package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +0 -46
- package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +0 -43
- package/content/references/workflows/product-attribute/create-product-attributes.mdx +0 -56
- package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +0 -30
- package/content/references/workflows/product-attribute/delete-product-attributes.mdx +0 -30
- package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +0 -29
- package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +0 -44
- package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +0 -41
- package/content/references/workflows/product-attribute/update-product-attributes.mdx +0 -48
- package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +0 -43
- package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +0 -39
- package/content/references/workflows/product-edit/cancel-product-change.mdx +0 -49
- package/content/references/workflows/product-edit/confirm-product-change.mdx +0 -57
- package/content/references/workflows/product-edit/create-product-change.mdx +0 -72
- package/content/references/workflows/product-edit/reject-product-change.mdx +0 -54
- package/content/references/workflows/product-edit/stage-product-change.mdx +0 -75
- package/content/references/workflows/seller/approve-seller.mdx +0 -36
- package/content/references/workflows/seller/create-seller-account.mdx +0 -59
- package/content/references/workflows/seller/create-seller-defaults.mdx +0 -22
- package/content/references/workflows/seller/create-sellers.mdx +0 -65
- package/content/references/workflows/seller/delete-seller-professional-details.mdx +0 -37
- package/content/references/workflows/seller/delete-sellers.mdx +0 -24
- package/content/references/workflows/seller/invite-seller.mdx +0 -28
- package/content/references/workflows/seller/suspend-seller.mdx +0 -37
- package/content/references/workflows/seller/terminate-seller.mdx +0 -37
- package/content/references/workflows/seller/unsuspend-seller.mdx +0 -36
- package/content/references/workflows/seller/unterminate-seller.mdx +0 -36
- package/content/references/workflows/seller/update-seller-address.mdx +0 -55
- package/content/references/workflows/seller/update-seller-payment-details.mdx +0 -52
- package/content/references/workflows/seller/update-seller-professional-details.mdx +0 -48
- package/content/references/workflows/seller/update-sellers.mdx +0 -57
- package/content/resources/ai/llms.mdx +0 -74
- package/content/resources/integrations/notifications.mdx +0 -39
- package/content/resources/integrations/search.mdx +0 -122
- package/content/resources/tutorials/configure-commissions.mdx +0 -127
- package/content/resources/tutorials/first-marketplace.mdx +0 -45
- package/content/resources/tutorials/handle-product-requests.mdx +0 -80
- package/content/resources/tutorials/import-export-products.mdx +0 -96
- package/content/resources/tutorials/seller-payouts-stripe.mdx +0 -89
- package/content/resources/tutorials/store-setup-checklist.mdx +0 -214
- package/content/tools/api-client.mdx +0 -155
- package/content/tools/cli.mdx +0 -196
- package/content/tools/dashboard-sdk.mdx +0 -35
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "batchOfferInventoryItemsWorkflow"
|
|
3
|
-
description: "Create, update, and delete an offer's inventory-item links in one call."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Manages the `offer ↔ inventory_item` links that define what stock an offer consumes. Validates the payload (no duplicates, no ID in more than one bucket, created items must exist, deleted items must already be linked), then batches the link changes — each link carries a `required_quantity` (default `1`). Emits `offer.updated`. Triggered by `POST /vendor/offers/:id/inventory-items/batch`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { batchOfferInventoryItemsWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await batchOfferInventoryItemsWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
offer_id: "offer_123",
|
|
16
|
-
create: [{ inventory_item_id: "iitem_1", required_quantity: 2 }],
|
|
17
|
-
update: [{ inventory_item_id: "iitem_2", required_quantity: 1 }],
|
|
18
|
-
delete: ["iitem_3"],
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Input
|
|
24
|
-
|
|
25
|
-
<ParamField body="offer_id" type="string" required>The offer whose inventory links are managed; fails if not found.</ParamField>
|
|
26
|
-
<ParamField body="create" type="object[]">
|
|
27
|
-
Links to create; the inventory items must exist and not appear in `update`/`delete`.
|
|
28
|
-
|
|
29
|
-
<Expandable title="properties">
|
|
30
|
-
<ParamField body="inventory_item_id" type="string" required>The inventory item to link.</ParamField>
|
|
31
|
-
<ParamField body="required_quantity" type="number">Units consumed per offer unit; defaults to `1`.</ParamField>
|
|
32
|
-
</Expandable>
|
|
33
|
-
</ParamField>
|
|
34
|
-
<ParamField body="update" type="object[]">
|
|
35
|
-
Existing links to update.
|
|
36
|
-
|
|
37
|
-
<Expandable title="properties">
|
|
38
|
-
<ParamField body="inventory_item_id" type="string" required>The linked inventory item.</ParamField>
|
|
39
|
-
<ParamField body="required_quantity" type="number" required>New units consumed per offer unit.</ParamField>
|
|
40
|
-
</Expandable>
|
|
41
|
-
</ParamField>
|
|
42
|
-
<ParamField body="delete" type="string[]">Inventory item IDs to unlink; each must currently be linked or the workflow throws a 404.</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.created" type="LinkDefinition[]">The created offer ↔ inventory-item links.</ResponseField>
|
|
48
|
-
<ResponseField name="result.updated" type="LinkDefinition[]">The updated links.</ResponseField>
|
|
49
|
-
<ResponseField name="result.deleted" type="string[]">Inventory item IDs that were unlinked.</ResponseField>
|
|
50
|
-
|
|
51
|
-
## Hooks
|
|
52
|
-
|
|
53
|
-
- `validate` — runs first with `{ input }`.
|
|
54
|
-
- `offerInventoryItemsBatched` — runs after the batch with `{ offer_id, result, additional_data }`.
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
batchOfferInventoryItemsWorkflow.hooks.offerInventoryItemsBatched(
|
|
58
|
-
async ({ offer_id, result }) => {
|
|
59
|
-
// react to link changes
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
```
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createOffersWorkflow"
|
|
3
|
-
description: "Create seller offers with inventory items and offer-scoped prices."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Creates one offer per entry: creates and links new inventory items (with optional starting stock levels) to the offer and the seller, ensures the master variant has a `PriceSet`, writes the offer's prices onto that shared set scoped by an `offer_id` price rule, and links the price rows to the offer. Emits `offer.created`. Triggered by `POST /vendor/offers` and the vendor/admin offer batch routes.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createOffersWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createOffersWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
offers: [
|
|
16
|
-
{
|
|
17
|
-
seller_id: "sel_123",
|
|
18
|
-
created_by: "member_123",
|
|
19
|
-
variant_id: "variant_123",
|
|
20
|
-
shipping_profile_id: "sp_123",
|
|
21
|
-
sku: "ACME-TEE-M",
|
|
22
|
-
inventory_items: [
|
|
23
|
-
{ stock_levels: [{ location_id: "sloc_123", stocked_quantity: 50 }] },
|
|
24
|
-
],
|
|
25
|
-
prices: [{ amount: 1999, currency_code: "usd" }],
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Input
|
|
33
|
-
|
|
34
|
-
<ParamField body="offers" type="object[]" required>
|
|
35
|
-
Offers to create.
|
|
36
|
-
|
|
37
|
-
<Expandable title="properties">
|
|
38
|
-
<ParamField body="seller_id" type="string" required>The seller that owns the offer.</ParamField>
|
|
39
|
-
<ParamField body="created_by" type="string" required>ID of the member creating the offer.</ParamField>
|
|
40
|
-
<ParamField body="sku" type="string" required>The offer's SKU.</ParamField>
|
|
41
|
-
<ParamField body="variant_id" type="string" required>The master product variant the offer sells; fails if not found.</ParamField>
|
|
42
|
-
<ParamField body="shipping_profile_id" type="string" required>Shipping profile used to fulfill the offer.</ParamField>
|
|
43
|
-
<ParamField body="inventory_items" type="object[]" required>New inventory items to create and link; at least one entry. Each entry accepts `sku`, `title`, `required_quantity` (default `1`), and `stock_levels` (`{ location_id, stocked_quantity }[]`).</ParamField>
|
|
44
|
-
<ParamField body="prices" type="object[]" required>Offer price ladder; each row accepts `amount`, `currency_code`, `min_quantity`, `max_quantity`, and `rules`.</ParamField>
|
|
45
|
-
<ParamField body="ean" type="string | null">EAN; snapshotted from the variant when omitted.</ParamField>
|
|
46
|
-
<ParamField body="upc" type="string | null">UPC; snapshotted from the variant when omitted.</ParamField>
|
|
47
|
-
<ParamField body="metadata" type="object | null">Custom key-value data.</ParamField>
|
|
48
|
-
</Expandable>
|
|
49
|
-
</ParamField>
|
|
50
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
51
|
-
|
|
52
|
-
## Result
|
|
53
|
-
|
|
54
|
-
<ResponseField name="result" type="OfferDTO[]">The created offers.</ResponseField>
|
|
55
|
-
|
|
56
|
-
## Hooks
|
|
57
|
-
|
|
58
|
-
- `validate` — runs first with `{ input }`.
|
|
59
|
-
- `offersCreated` — runs after creation with `{ offers, additional_data }`.
|
|
60
|
-
|
|
61
|
-
```ts
|
|
62
|
-
createOffersWorkflow.hooks.offersCreated(async ({ offers, additional_data }) => {
|
|
63
|
-
// react to new offers
|
|
64
|
-
})
|
|
65
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "deleteOffersWorkflow"
|
|
3
|
-
description: "Delete one or more offers."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Deletes the given offers and emits `offer.deleted` with each offer's `id` and `product_id`. Triggered by `DELETE /vendor/offers/:id`, `DELETE /admin/offers/:id`, and the offer batch routes.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { deleteOffersWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await deleteOffersWorkflow(container).run({
|
|
14
|
-
input: { ids: ["offer_123"] },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="ids" type="string[]" required>IDs of the offers to delete.</ParamField>
|
|
21
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
22
|
-
|
|
23
|
-
## Result
|
|
24
|
-
|
|
25
|
-
<ResponseField name="result" type="void">No return value; the offers are deleted.</ResponseField>
|
|
26
|
-
|
|
27
|
-
## Hooks
|
|
28
|
-
|
|
29
|
-
- `offersDeleted` — runs after deletion with `{ ids, additional_data }`.
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
deleteOffersWorkflow.hooks.offersDeleted(async ({ ids, additional_data }) => {
|
|
33
|
-
// react to deleted offers
|
|
34
|
-
})
|
|
35
|
-
```
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "updateOffersWorkflow"
|
|
3
|
-
description: "Update offer rows and rewrite their price ladders with replace semantics."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Applies partial updates to offer rows (`sku`, `shipping_profile_id`, `metadata`). When an entry sets `prices`, the offer's price ladder is rewritten with replace semantics: rows with `id` are updated in place, rows without `id` are added, and existing offer-owned prices omitted from the array are removed — all on the variant's shared `PriceSet`, scoped by the `offer_id` price rule. Price ownership is asserted so an offer can't touch another offer's rows. Emits `offer.updated`. Triggered by `POST /vendor/offers/:id` and the offer batch routes.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { updateOffersWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await updateOffersWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
offers: [
|
|
16
|
-
{
|
|
17
|
-
id: "offer_123",
|
|
18
|
-
prices: [{ amount: 1799, currency_code: "usd" }],
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Input
|
|
26
|
-
|
|
27
|
-
<ParamField body="offers" type="object[]" required>
|
|
28
|
-
Offer updates, keyed by ID.
|
|
29
|
-
|
|
30
|
-
<Expandable title="properties">
|
|
31
|
-
<ParamField body="id" type="string" required>The offer to update; fails if not found.</ParamField>
|
|
32
|
-
<ParamField body="sku" type="string">New SKU.</ParamField>
|
|
33
|
-
<ParamField body="shipping_profile_id" type="string">New shipping profile.</ParamField>
|
|
34
|
-
<ParamField body="metadata" type="object | null">Custom key-value data.</ParamField>
|
|
35
|
-
<ParamField body="prices" type="object[]">Full replacement price ladder; each row accepts `id` (update in place when set), `amount`, `currency_code`, `min_quantity`, `max_quantity`, and `rules`. Omit the field to leave prices untouched.</ParamField>
|
|
36
|
-
</Expandable>
|
|
37
|
-
</ParamField>
|
|
38
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
39
|
-
|
|
40
|
-
## Result
|
|
41
|
-
|
|
42
|
-
<ResponseField name="result" type="OfferDTO[]">The updated offers.</ResponseField>
|
|
43
|
-
|
|
44
|
-
## Hooks
|
|
45
|
-
|
|
46
|
-
- `validate` — runs first with `{ input }`.
|
|
47
|
-
- `offersUpdated` — runs after the update with `{ offers, additional_data }`.
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
updateOffersWorkflow.hooks.offersUpdated(async ({ offers, additional_data }) => {
|
|
51
|
-
// react to updated offers
|
|
52
|
-
})
|
|
53
|
-
```
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "cancelOrderFulfillmentWorkflow"
|
|
3
|
-
description: "Cancel an unshipped fulfillment and restore reservations and stock."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Mercur's offer-aware replacement for Medusa's cancel-order-fulfillment flow. Validates that the fulfillment exists, is not shipped, and not already canceled, then cancels it on the order and at the provider, re-creates or tops up reservations, and adjusts inventory back up — dividing line quantities by each offer's `required_quantity` so bundle offers restock correctly. Triggered by `POST /vendor/orders/:id/fulfillments/:fulfillment_id/cancel`. Emits `order.fulfillment_canceled`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { cancelOrderFulfillmentWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await cancelOrderFulfillmentWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
order_id: "order_123",
|
|
16
|
-
fulfillment_id: "ful_123",
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="order_id" type="string" required>The order the fulfillment belongs to; must not be canceled.</ParamField>
|
|
24
|
-
<ParamField body="fulfillment_id" type="string" required>The fulfillment to cancel; shipped or already-canceled fulfillments throw.</ParamField>
|
|
25
|
-
<ParamField body="no_notification" type="boolean">Suppress customer notification for the cancellation.</ParamField>
|
|
26
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the hooks.</ParamField>
|
|
27
|
-
|
|
28
|
-
## Result
|
|
29
|
-
|
|
30
|
-
<ResponseField name="result" type="void">No return value.</ResponseField>
|
|
31
|
-
|
|
32
|
-
## Hooks
|
|
33
|
-
|
|
34
|
-
- `orderFulfillmentCanceled` — runs after cancellation with `{ fulfillment, additional_data }`.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "confirmClaimRequestWorkflow"
|
|
3
|
-
description: "Confirm a claim request and fix reservations for offer bundles."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Wraps Medusa's `confirmClaimRequestWorkflow` and then rewrites the reservations created for the claim's additional items when those items come from offers: single-link offers get their reservation quantity scaled by `required_quantity`, multi-link (bundle) offers have the default reservation replaced with one reservation per linked inventory item. Triggered by `POST /admin/claims/:id/request` and `POST /vendor/claims/:id/request`. Events are emitted by the wrapped Medusa workflow.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { confirmClaimRequestWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await confirmClaimRequestWorkflow(container).run({
|
|
14
|
-
input: { claim_id: "claim_123", confirmed_by: "user_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="claim_id" type="string" required>The claim whose pending request is confirmed.</ParamField>
|
|
21
|
-
<ParamField body="confirmed_by" type="string">Id of the user confirming the claim.</ParamField>
|
|
22
|
-
|
|
23
|
-
## Result
|
|
24
|
-
|
|
25
|
-
<ResponseField name="result" type="OrderPreviewDTO">Preview of the order with the confirmed claim applied.</ResponseField>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "confirmExchangeRequestWorkflow"
|
|
3
|
-
description: "Confirm an exchange request and fix reservations for offer bundles."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Wraps Medusa's `confirmExchangeRequestWorkflow` and then rewrites the reservations created for the exchange's additional items when those items come from offers: single-link offers get their reservation quantity scaled by `required_quantity`, multi-link (bundle) offers have the default reservation replaced with one reservation per linked inventory item. Triggered by `POST /admin/exchanges/:id/request` and `POST /vendor/exchanges/:id/request`. Events are emitted by the wrapped Medusa workflow.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { confirmExchangeRequestWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await confirmExchangeRequestWorkflow(container).run({
|
|
14
|
-
input: { exchange_id: "exchange_123", confirmed_by: "user_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="exchange_id" type="string" required>The exchange whose pending request is confirmed.</ParamField>
|
|
21
|
-
<ParamField body="confirmed_by" type="string">Id of the user confirming the exchange.</ParamField>
|
|
22
|
-
|
|
23
|
-
## Result
|
|
24
|
-
|
|
25
|
-
<ResponseField name="result" type="OrderPreviewDTO">Preview of the order with the confirmed exchange applied.</ResponseField>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "confirmOrderEditRequestWorkflow"
|
|
3
|
-
description: "Confirm an order edit and reconcile offer-bundle reservations."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Wraps Medusa's `confirmOrderEditRequestWorkflow` and then reconciles reservations for every unfulfilled order item that comes from an offer with inventory links: desired quantities are computed as `(ordered - fulfilled) × required_quantity` per linked inventory item, and mismatching reservations are replaced with a correct set (one per linked item, bundle offers included). Triggered by `POST /admin/order-edits/:id/confirm` and `POST /vendor/order-edits/:id/confirm`. Events are emitted by the wrapped Medusa workflow.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { confirmOrderEditRequestWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await confirmOrderEditRequestWorkflow(container).run({
|
|
14
|
-
input: { order_id: "order_123", confirmed_by: "user_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="order_id" type="string" required>The order whose pending edit is confirmed.</ParamField>
|
|
21
|
-
<ParamField body="confirmed_by" type="string">Id of the user confirming the edit.</ParamField>
|
|
22
|
-
|
|
23
|
-
## Result
|
|
24
|
-
|
|
25
|
-
<ResponseField name="result" type="OrderPreviewDTO">Preview of the order with the confirmed edit applied.</ResponseField>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "confirmReturnReceiveWorkflow"
|
|
3
|
-
description: "Confirm a return receival, offer-aware restock included."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Mercur's offer-aware replacement for Medusa's confirm-return-receive flow. Applies the pending receive actions of the return's order change, updates return items' received/damaged quantities, marks the return `received` (or `partially_received`), restocks inventory — expanding offer bundle links by `required_quantity` — and refreshes the order payment collection. Throws when a bundle offer has no stock level at the return's location. Triggered by `POST /admin/returns/:id/receive/confirm` and `POST /vendor/returns/:id/receive/confirm`. Emits `order.return_received`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { confirmReturnReceiveWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await confirmReturnReceiveWorkflow(container).run({
|
|
14
|
-
input: { return_id: "return_123", confirmed_by: "user_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="return_id" type="string" required>The return whose pending receival is confirmed.</ParamField>
|
|
21
|
-
<ParamField body="confirmed_by" type="string">Id of the user confirming the receival.</ParamField>
|
|
22
|
-
|
|
23
|
-
## Result
|
|
24
|
-
|
|
25
|
-
<ResponseField name="result" type="OrderPreviewDTO">Preview of the order with the confirmed changes applied.</ResponseField>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createOrderFulfillmentWorkflow"
|
|
3
|
-
description: "Create a fulfillment for order items, offer-bundle aware."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Mercur's offer-aware replacement for Medusa's create-order-fulfillment flow. Validates the order and items, creates the fulfillment, registers it on the order, links it, and consumes reservations / adjusts inventory — multiplying quantities by each offer's `required_quantity` inventory links so bundle offers deduct the right stock. Triggered by `POST /vendor/orders/:id/fulfillments`. Emits `order.fulfillment_created`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createOrderFulfillmentWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createOrderFulfillmentWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
order_id: "order_123",
|
|
16
|
-
items: [{ id: "ordli_123", quantity: 1 }],
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="order_id" type="string" required>The order to fulfill.</ParamField>
|
|
24
|
-
<ParamField body="items" type="{ id: string; quantity: number }[]" required>Order line items and quantities to fulfill; all items must either require shipping or not — mixed requests throw.</ParamField>
|
|
25
|
-
<ParamField body="location_id" type="string">Stock location to fulfill from; defaults to the shipping option's linked location.</ParamField>
|
|
26
|
-
<ParamField body="shipping_option_id" type="string">Shipping option to fulfill with; defaults to the order's first shipping method.</ParamField>
|
|
27
|
-
<ParamField body="created_by" type="string">Id of the user creating the fulfillment.</ParamField>
|
|
28
|
-
<ParamField body="labels" type="FulfillmentLabelDTO[]">Tracking labels to attach.</ParamField>
|
|
29
|
-
<ParamField body="no_notification" type="boolean">Suppress customer notification for this fulfillment.</ParamField>
|
|
30
|
-
<ParamField body="metadata" type="object | null">Custom key-value data on the fulfillment.</ParamField>
|
|
31
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the hooks.</ParamField>
|
|
32
|
-
|
|
33
|
-
## Result
|
|
34
|
-
|
|
35
|
-
<ResponseField name="result" type="FulfillmentDTO">The created fulfillment.</ResponseField>
|
|
36
|
-
|
|
37
|
-
## Hooks
|
|
38
|
-
|
|
39
|
-
- `fulfillmentCreated` — runs after creation with `{ fulfillment, additional_data }`.
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
createOrderFulfillmentWorkflow.hooks.fulfillmentCreated(async ({ fulfillment }) => {
|
|
43
|
-
// push to a 3PL
|
|
44
|
-
})
|
|
45
|
-
```
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "getOrderGroupDetailWorkflow"
|
|
3
|
-
description: "Retrieve one order group with per-order aggregated payment and fulfillment statuses."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Loads an order group with its child orders and computes each order's `payment_status` and `fulfillment_status` from its payment collections and fulfillments. Payment collections and fulfillments are stripped from the response unless the requested fields include them. Triggered by `GET /admin/order-groups/:id` and `GET /admin/orders/:id/order-group`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { getOrderGroupDetailWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await getOrderGroupDetailWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
order_group_id: "ordgrp_123",
|
|
16
|
-
fields: ["display_id", "total", "orders.display_id"],
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="order_group_id" type="string" required>The order group to retrieve; fails if not found.</ParamField>
|
|
24
|
-
<ParamField body="fields" type="string[]" required>Fields to retrieve; merged with the defaults needed for status aggregation (`orders.items.*`, payment collection and fulfillment timestamps).</ParamField>
|
|
25
|
-
|
|
26
|
-
## Result
|
|
27
|
-
|
|
28
|
-
<ResponseField name="result" type="object">The order group with its child orders.</ResponseField>
|
|
29
|
-
<ResponseField name="result.orders" type="OrderDetailDTO[]">Child orders, each with computed `payment_status` and `fulfillment_status`.</ResponseField>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "getOrderGroupsListWorkflow"
|
|
3
|
-
description: "List order groups with pagination and per-order aggregated statuses."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Lists order groups with their child orders, computing each order's `payment_status` and `fulfillment_status` from payment collections and fulfillments. When `sellerId` is set, each group's `orders` array is filtered to that seller's orders — useful for vendor-scoped views. Payment collections and fulfillments are stripped unless the requested fields include them. Triggered by `GET /admin/order-groups`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { getOrderGroupsListWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await getOrderGroupsListWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
fields: ["display_id", "total"],
|
|
16
|
-
variables: { skip: 0, take: 20, order: { created_at: "DESC" } },
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="fields" type="string[]" required>Fields to retrieve; merged with the defaults needed for status aggregation.</ParamField>
|
|
24
|
-
<ParamField body="variables" type="object">
|
|
25
|
-
Query filters plus pagination.
|
|
26
|
-
|
|
27
|
-
<Expandable title="properties">
|
|
28
|
-
<ParamField body="skip" type="number">Number of groups to skip.</ParamField>
|
|
29
|
-
<ParamField body="take" type="number">Number of groups to return.</ParamField>
|
|
30
|
-
<ParamField body="order" type="object">Sort spec, e.g. `{ created_at: "DESC" }`.</ParamField>
|
|
31
|
-
</Expandable>
|
|
32
|
-
</ParamField>
|
|
33
|
-
<ParamField body="sellerId" type="string | string[]">Restrict each group's `orders` to the given seller(s).</ParamField>
|
|
34
|
-
|
|
35
|
-
## Result
|
|
36
|
-
|
|
37
|
-
<ResponseField name="result.rows" type="object[]">The order groups; each child order carries computed `payment_status` and `fulfillment_status`.</ResponseField>
|
|
38
|
-
<ResponseField name="result.metadata" type="object">Pagination metadata (`count`, `skip`, `take`).</ResponseField>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Workflows"
|
|
3
|
-
description: "Every workflow exported by @mercurjs/core, grouped by domain."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
All marketplace business logic runs through Medusa workflows exported from `@mercurjs/core/workflows`. Run them from your own API routes, jobs, or subscribers, and extend them through their hooks — see [Extend a workflow](/rc/resources/customization/extend-a-workflow).
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
import { createSellersWorkflow } from "@mercurjs/core/workflows"
|
|
10
|
-
|
|
11
|
-
const { result } = await createSellersWorkflow(container).run({
|
|
12
|
-
input: { name: "Acme", email: "hello@acme.co" },
|
|
13
|
-
})
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Each workflow has its own reference page with the exact input, result, and hooks.
|
|
17
|
-
|
|
18
|
-
<CardGroup cols={2}>
|
|
19
|
-
<Card title="Seller lifecycle" href="/rc/references/workflows/seller/create-sellers">
|
|
20
|
-
Create, approve, suspend, terminate sellers and manage their details.
|
|
21
|
-
</Card>
|
|
22
|
-
<Card title="Members & invites" href="/rc/references/workflows/member/add-seller-member">
|
|
23
|
-
Team management and the JWT invite flow.
|
|
24
|
-
</Card>
|
|
25
|
-
<Card title="Checkout & carts" href="/rc/references/workflows/cart/complete-cart-with-split-orders">
|
|
26
|
-
The multi-vendor split checkout and per-seller cart operations.
|
|
27
|
-
</Card>
|
|
28
|
-
<Card title="Order groups" href="/rc/references/workflows/order-group/get-order-group-detail">
|
|
29
|
-
Read models over grouped per-seller orders.
|
|
30
|
-
</Card>
|
|
31
|
-
<Card title="Commission" href="/rc/references/workflows/commission/create-commission-rates">
|
|
32
|
-
Rate CRUD, rule batching, and order line recomputation.
|
|
33
|
-
</Card>
|
|
34
|
-
<Card title="Payout" href="/rc/references/workflows/payout/create-payout">
|
|
35
|
-
Accounts, onboarding, payouts, and webhook processing.
|
|
36
|
-
</Card>
|
|
37
|
-
<Card title="Products" href="/rc/references/workflows/product/create-products">
|
|
38
|
-
Master product creation, confirmation, and seller linking.
|
|
39
|
-
</Card>
|
|
40
|
-
<Card title="Product edit" href="/rc/references/workflows/product-edit/create-product-change">
|
|
41
|
-
The change-request lifecycle behind vendor edits.
|
|
42
|
-
</Card>
|
|
43
|
-
<Card title="Product attributes" href="/rc/references/workflows/product-attribute/create-and-link-product-attributes-to-product">
|
|
44
|
-
Attribute catalog CRUD and the product batch engine.
|
|
45
|
-
</Card>
|
|
46
|
-
<Card title="Offers" href="/rc/references/workflows/offer/create-offers">
|
|
47
|
-
Listing CRUD and inventory item batching.
|
|
48
|
-
</Card>
|
|
49
|
-
<Card title="Media" href="/rc/references/workflows/media/set-collection-images">
|
|
50
|
-
Category and collection galleries, thumbnails, banners, icons.
|
|
51
|
-
</Card>
|
|
52
|
-
<Card title="Orders & RMA" href="/rc/references/workflows/order/create-order-fulfillment">
|
|
53
|
-
Fulfillment and return/claim/exchange confirmation.
|
|
54
|
-
</Card>
|
|
55
|
-
</CardGroup>
|
|
56
|
-
|
|
57
|
-
## Internal and utility workflows
|
|
58
|
-
|
|
59
|
-
These are exported but usually not called directly — they run inside the workflows above:
|
|
60
|
-
|
|
61
|
-
| Workflow | Called by |
|
|
62
|
-
| --- | --- |
|
|
63
|
-
| `applyProductChangeActionsWorkflow` / `applyProductAttributeChangeActionsWorkflow` | `confirmProductChangeWorkflow` — replays staged actions onto the product |
|
|
64
|
-
| `productEditUpdateProductWorkflow` / `productEditUpdateVariantsWorkflow` / `productEditUpdateAttributesWorkflow` / `productEditDeleteProductWorkflow` | Vendor product edit routes — stage the corresponding change actions |
|
|
65
|
-
| `recordProductAuditChangeWorkflow` | Product flows — writes audit change records |
|
|
66
|
-
| `create/update/deleteProductCategoryWithImagesWorkflow` and `create/update/deleteProductCollectionWithImagesWorkflow` | Admin category/collection routes — wrap Medusa's workflows plus the image-set step |
|
|
67
|
-
| `createSellerCampaignsWorkflow`, `createSellerCustomerGroupsWorkflow`, `createSellerInventoryItemsWorkflow`, `createSellerPriceListsWorkflow`, `createSellerPromotionsWorkflow`, `createSellerShippingOptionsWorkflow`, `createSellerShippingProfilesWorkflow`, `createSellerStockLocationsWorkflow` | Vendor resource-create routes — create the record and link it to the seller |
|
|
68
|
-
|
|
69
|
-
<Note>
|
|
70
|
-
Search has no workflows by design — index synchronization is event-driven
|
|
71
|
-
through subscribers. See the [Search module](/rc/references/modules/search#index-synchronization).
|
|
72
|
-
</Note>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createOnboardingWorkflow"
|
|
3
|
-
description: "Start a provider onboarding session for a payout account."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Creates an onboarding session for an existing payout account through the payout provider — for Stripe Connect this returns a hosted onboarding link the seller completes in the browser. Triggered by `POST /vendor/payout-accounts/:id/onboarding`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createOnboardingWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createOnboardingWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
account_id: "pacc_123",
|
|
16
|
-
data: {
|
|
17
|
-
refresh_url: "https://vendor.example.com/payouts",
|
|
18
|
-
return_url: "https://vendor.example.com/payouts",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Input
|
|
25
|
-
|
|
26
|
-
<ParamField body="account_id" type="string" required>The payout account to onboard.</ParamField>
|
|
27
|
-
<ParamField body="context" type="object">Provider context; supports `idempotency_key` plus provider-specific keys.</ParamField>
|
|
28
|
-
<ParamField body="data" type="object">Provider-specific onboarding data (e.g. Stripe `refresh_url` / `return_url`).</ParamField>
|
|
29
|
-
|
|
30
|
-
## Result
|
|
31
|
-
|
|
32
|
-
<ResponseField name="result" type="OnboardingDTO">The created onboarding session.</ResponseField>
|
|
33
|
-
<ResponseField name="result.id" type="string">Onboarding ID.</ResponseField>
|
|
34
|
-
<ResponseField name="result.account_id" type="string">The payout account the session belongs to.</ResponseField>
|
|
35
|
-
<ResponseField name="result.data" type="object | null">Provider response data (e.g. the hosted onboarding URL).</ResponseField>
|
|
36
|
-
<ResponseField name="result.context" type="object | null">The context the session was created with.</ResponseField>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createPayoutAccountWorkflow"
|
|
3
|
-
description: "Create a payout account for a seller through the registered payout provider."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Validates that the seller doesn't already have a payout account, creates one through the payout provider (e.g. Stripe Connect), and links it to the seller. Triggered by `POST /vendor/payout-accounts`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createPayoutAccountWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createPayoutAccountWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
seller_id: "sel_123",
|
|
16
|
-
context: { country: "US" },
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="seller_id" type="string" required>The seller to create the payout account for; fails if the seller already has one.</ParamField>
|
|
24
|
-
<ParamField body="context" type="object">Provider context; supports `idempotency_key` plus provider-specific keys.</ParamField>
|
|
25
|
-
<ParamField body="data" type="object">Provider-specific creation data passed straight to the payout provider.</ParamField>
|
|
26
|
-
|
|
27
|
-
## Result
|
|
28
|
-
|
|
29
|
-
<ResponseField name="result" type="PayoutAccountDTO">The created payout account.</ResponseField>
|
|
30
|
-
<ResponseField name="result.id" type="string">Payout account ID.</ResponseField>
|
|
31
|
-
<ResponseField name="result.status" type="string">One of `pending`, `active`, `restricted`, `rejected`; starts as `pending` until onboarding completes.</ResponseField>
|
|
32
|
-
<ResponseField name="result.data" type="object">Provider-side account data (e.g. the connected account payload).</ResponseField>
|
|
33
|
-
<ResponseField name="result.context" type="object | null">The context the account was created with.</ResponseField>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createPayoutWorkflow"
|
|
3
|
-
description: "Issue a payout to a seller through the registered provider."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Loads a settled order with its seller and payout account, sums the order's commission lines (item and shipping), and pays out `order.total - total commission` through the payout provider, linking the payout to the seller. Fails if the seller has no payout account. The order ID doubles as the provider idempotency key, so re-running for the same order is safe. Not wired to a route — run it from your own subscriber or scheduled job once an order is captured and ready to settle.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createPayoutWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createPayoutWorkflow(container).run({
|
|
14
|
-
input: { order_id: "order_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="order_id" type="string" required>The order to settle; must belong to a seller with a payout account.</ParamField>
|
|
21
|
-
|
|
22
|
-
## Result
|
|
23
|
-
|
|
24
|
-
<ResponseField name="result" type="PayoutDTO">The created payout.</ResponseField>
|
|
25
|
-
<ResponseField name="result.id" type="string">Payout ID.</ResponseField>
|
|
26
|
-
<ResponseField name="result.account_id" type="string">The seller's payout account.</ResponseField>
|
|
27
|
-
<ResponseField name="result.amount" type="BigNumberInput">Order total minus the order's commission lines.</ResponseField>
|
|
28
|
-
<ResponseField name="result.currency_code" type="string">The order's currency.</ResponseField>
|
|
29
|
-
<ResponseField name="result.status" type="string">One of `pending`, `processing`, `paid`, `failed`, `canceled`.</ResponseField>
|
|
30
|
-
<ResponseField name="result.data" type="object | null">Provider transfer data; includes `order_id` and `seller_id`.</ResponseField>
|