@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,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "completeCartWithSplitOrdersWorkflow"
|
|
3
|
-
description: "Complete a multi-seller cart by splitting it into per-seller orders under an order group."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Mercur's replacement for Medusa's `completeCartWorkflow` and the heart of multi-vendor checkout. It groups the cart's items by the seller behind each item's offer, creates one order per seller (each carrying only that seller's items, shipping methods, addresses, and promotion adjustments), and wraps them in a single `OrderGroup` the shopper tracks as one purchase. Along the way it validates seller items and shipping coverage, mirrors line-item ↔ offer links onto the new order items, reserves offer inventory, registers promotion usage, links orders to the cart, sellers, payment collection, and order group, authorizes the single payment session, distributes captured amounts proportionally as order transactions, and refreshes each order's commission lines via `refreshOrderCommissionLinesWorkflow`. The run is idempotent per cart — an existing order group for the cart is returned instead of re-creating orders. Emits `order.placed` (one entry per child order) and `order_group.created`. Triggered by `POST /store/carts/:id/complete`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { completeCartWithSplitOrdersWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await completeCartWithSplitOrdersWorkflow(container).run({
|
|
14
|
-
input: { cart_id: "cart_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="cart_id" type="string" required>The cart to complete; must have an authorized-able payment session and seller-scoped shipping methods covering every seller in the cart.</ParamField>
|
|
21
|
-
|
|
22
|
-
## Result
|
|
23
|
-
|
|
24
|
-
<ResponseField name="result.order_group_id" type="string">ID of the order group wrapping the per-seller orders — either newly created or the one already created for this cart.</ResponseField>
|
|
25
|
-
|
|
26
|
-
## Hooks
|
|
27
|
-
|
|
28
|
-
- `validate` — runs after the cart is loaded (before any orders are created) with `{ input, cart }`.
|
|
29
|
-
- `beforePaymentAuthorization` — runs after orders and links are created, right before the payment session is authorized, with `{ input }`.
|
|
30
|
-
- `orderGroupCreated` — runs at the end of the creation branch with `{ order_group_id, cart_id }`.
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
completeCartWithSplitOrdersWorkflow.hooks.validate(async ({ input, cart }) => {
|
|
34
|
-
// throw to block checkout
|
|
35
|
-
})
|
|
36
|
-
```
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "listSellerShippingOptionsForCartWorkflow"
|
|
3
|
-
description: "List available shipping options for a cart, grouped by seller."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Resolves the sellers behind the cart's offers, finds their stock locations valid for the cart's sales channel, and queries shipping options in those locations' fulfillment sets with cart-scoped pricing. Each option carries its calculated `amount`, `is_tax_inclusive`, and an `insufficient_inventory` flag when the seller's location can't cover the cart quantities. Options are translated to the cart locale and returned keyed by seller ID. Triggered by `GET /store/shipping-options`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { listSellerShippingOptionsForCartWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await listSellerShippingOptionsForCartWorkflow(container).run({
|
|
14
|
-
input: { cart_id: "cart_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="cart_id" type="string" required>The cart to list options for; must have `sales_channel_id`, `region_id`, and `currency_code` set.</ParamField>
|
|
21
|
-
<ParamField body="is_return" type="boolean">List return shipping options instead; defaults to `false`.</ParamField>
|
|
22
|
-
<ParamField body="enabled_in_store" type="boolean">Only options enabled in the storefront; defaults to `true`.</ParamField>
|
|
23
|
-
<ParamField body="fields" type="string[]">Extra shipping-option fields to retrieve on top of the defaults.</ParamField>
|
|
24
|
-
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
|
|
25
|
-
|
|
26
|
-
## Result
|
|
27
|
-
|
|
28
|
-
<ResponseField name="result" type="Record<string, ShippingOptionDTO[]>">Map of seller ID to that seller's priced shipping options, each extended with `amount`, `is_tax_inclusive`, and `insufficient_inventory`.</ResponseField>
|
|
29
|
-
|
|
30
|
-
## Hooks
|
|
31
|
-
|
|
32
|
-
- `setPricingContext` — runs with `{ cart, fulfillmentSetIds, additional_data }`; return a record to merge into the price calculation context.
|
|
33
|
-
- `setShippingOptionsContext` — runs with the same payload; return a record to merge into the shipping-option rule context.
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
listSellerShippingOptionsForCartWorkflow.hooks.setPricingContext(async ({ cart }) => {
|
|
37
|
-
return { customer_tier: "vip" }
|
|
38
|
-
})
|
|
39
|
-
```
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "updateCartSellerPromotionsWorkflow"
|
|
3
|
-
description: "Apply, remove, or replace promotion codes on a cart with seller-scoped adjustments."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Seller-aware variant of Medusa's `updateCartPromotionsWorkflow`. Computes promotion actions for the requested codes, then prepares line-item and shipping-method adjustments so each promotion only discounts the owning seller's items, before creating/removing adjustments and syncing the cart's applied promotions. Optionally refreshes the payment collection. Triggered by `POST /store/carts/:id/promotions`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { updateCartSellerPromotionsWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await updateCartSellerPromotionsWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
cart_id: "cart_123",
|
|
16
|
-
promo_codes: ["SUMMER10"],
|
|
17
|
-
action: "add",
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Input
|
|
23
|
-
|
|
24
|
-
<ParamField body="cart_id" type="string" required>The cart to update promotions on.</ParamField>
|
|
25
|
-
<ParamField body="promo_codes" type="string[]">Promotion codes to apply; defaults to `[]`.</ParamField>
|
|
26
|
-
<ParamField body="action" type="string">One of `add`, `remove`, `replace`; defaults to `add`.</ParamField>
|
|
27
|
-
<ParamField body="cart" type="object">Preloaded cart data; skips the internal cart fetch when provided.</ParamField>
|
|
28
|
-
<ParamField body="force_refresh_payment_collection" type="boolean">Refresh the cart's payment collection after adjustments change.</ParamField>
|
|
29
|
-
|
|
30
|
-
## Result
|
|
31
|
-
|
|
32
|
-
<ResponseField name="result" type="void">No return value; the cart's adjustments and applied promotions are updated as a side effect.</ResponseField>
|
|
33
|
-
|
|
34
|
-
## Hooks
|
|
35
|
-
|
|
36
|
-
- `validate` — runs after the cart is loaded with `{ input, cart }`.
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
updateCartSellerPromotionsWorkflow.hooks.validate(async ({ input, cart }) => {
|
|
40
|
-
// throw to reject the promotion change
|
|
41
|
-
})
|
|
42
|
-
```
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "batchCommissionRulesWorkflow"
|
|
3
|
-
description: "Create, update, and delete a commission rate's rules in one call."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Runs create, update, and delete operations on a commission rate's rules in parallel. Rules bind a rate to a reference (e.g. a seller, category, or product type) so the rate applies when an order line matches. Triggered by `POST /admin/commission-rates/:id/rules`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { batchCommissionRulesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await batchCommissionRulesWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
commission_rate_id: "comrate_123",
|
|
16
|
-
create: [{ reference: "seller", reference_id: "sel_123" }],
|
|
17
|
-
update: [{ id: "comrule_456", reference_id: "sel_789" }],
|
|
18
|
-
delete: ["comrule_999"],
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Input
|
|
24
|
-
|
|
25
|
-
<ParamField body="commission_rate_id" type="string" required>The commission rate the rules belong to.</ParamField>
|
|
26
|
-
<ParamField body="create" type="object[]">
|
|
27
|
-
Rules to create.
|
|
28
|
-
|
|
29
|
-
<Expandable title="properties">
|
|
30
|
-
<ParamField body="reference" type="string" required>Entity type the rule targets (e.g. `seller`, `product_category`, `product_type`).</ParamField>
|
|
31
|
-
<ParamField body="reference_id" type="string" required>ID of the referenced entity.</ParamField>
|
|
32
|
-
</Expandable>
|
|
33
|
-
</ParamField>
|
|
34
|
-
<ParamField body="update" type="object[]">
|
|
35
|
-
Rules to update.
|
|
36
|
-
|
|
37
|
-
<Expandable title="properties">
|
|
38
|
-
<ParamField body="id" type="string" required>The rule to update.</ParamField>
|
|
39
|
-
<ParamField body="reference" type="string">New reference type.</ParamField>
|
|
40
|
-
<ParamField body="reference_id" type="string">New referenced entity ID.</ParamField>
|
|
41
|
-
</Expandable>
|
|
42
|
-
</ParamField>
|
|
43
|
-
<ParamField body="delete" type="string[]">IDs of rules to delete.</ParamField>
|
|
44
|
-
|
|
45
|
-
## Result
|
|
46
|
-
|
|
47
|
-
<ResponseField name="result.created" type="CommissionRuleDTO[]">The created rules.</ResponseField>
|
|
48
|
-
<ResponseField name="result.updated" type="CommissionRuleDTO[]">The updated rules.</ResponseField>
|
|
49
|
-
<ResponseField name="result.deleted" type="string[]">IDs of the deleted rules.</ResponseField>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createCommissionRatesWorkflow"
|
|
3
|
-
description: "Create one or more commission rates."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Creates commission rates — the fee definitions (flat or percentage) applied to seller orders. A unique `code` is auto-generated from the name when not provided. Triggered by `POST /admin/commission-rates`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createCommissionRatesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createCommissionRatesWorkflow(container).run({
|
|
14
|
-
input: [
|
|
15
|
-
{
|
|
16
|
-
name: "Default commission",
|
|
17
|
-
type: "percentage",
|
|
18
|
-
value: 10,
|
|
19
|
-
is_default: true,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Input
|
|
26
|
-
|
|
27
|
-
The input is an array of commission rates to create.
|
|
28
|
-
|
|
29
|
-
<ParamField body="name" type="string" required>Display name of the rate.</ParamField>
|
|
30
|
-
<ParamField body="type" type="string" required>One of `fixed`, `percentage`.</ParamField>
|
|
31
|
-
<ParamField body="value" type="number" required>Rate value — a percentage for `percentage`, an amount for `fixed`.</ParamField>
|
|
32
|
-
<ParamField body="code" type="string">Unique code; auto-generated from the name when omitted.</ParamField>
|
|
33
|
-
<ParamField body="currency_code" type="string | null">Currency of a `fixed` rate.</ParamField>
|
|
34
|
-
<ParamField body="include_tax" type="boolean">Include tax totals in the commission base.</ParamField>
|
|
35
|
-
<ParamField body="include_shipping" type="boolean">Also apply the rate to shipping methods.</ParamField>
|
|
36
|
-
<ParamField body="is_enabled" type="boolean">Whether the rate is active.</ParamField>
|
|
37
|
-
<ParamField body="is_default" type="boolean">Marks the rate as the platform-wide fallback.</ParamField>
|
|
38
|
-
|
|
39
|
-
## Result
|
|
40
|
-
|
|
41
|
-
<ResponseField name="result" type="CommissionRateDTO[]">The created commission rates.</ResponseField>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "deleteCommissionRatesWorkflow"
|
|
3
|
-
description: "Soft-delete commission rates after validating they can be removed."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Validates the rates are deletable, then soft-deletes them. Deletion is reversible on workflow failure (compensation restores the rates). Triggered by `DELETE /admin/commission-rates/:id`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { deleteCommissionRatesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await deleteCommissionRatesWorkflow(container).run({
|
|
14
|
-
input: { ids: ["comrate_123"] },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="ids" type="string[]" required>IDs of the commission rates to delete.</ParamField>
|
|
21
|
-
|
|
22
|
-
## Result
|
|
23
|
-
|
|
24
|
-
<ResponseField name="result" type="void">No return value; the rates are soft-deleted.</ResponseField>
|
|
25
|
-
|
|
26
|
-
## Hooks
|
|
27
|
-
|
|
28
|
-
- `commissionRatesDeleted` — runs after deletion with `{ ids }`.
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
deleteCommissionRatesWorkflow.hooks.commissionRatesDeleted(async ({ ids }) => {
|
|
32
|
-
// react to deleted rates
|
|
33
|
-
})
|
|
34
|
-
```
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "refreshOrderCommissionLinesWorkflow"
|
|
3
|
-
description: "Recompute the commission lines for one or more orders."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Loads each order with its items, products, sellers, and shipping methods, evaluates the matching commission rates, and upserts a commission line per item and shipping method (delete-then-insert, so re-running is idempotent). Runs inside `completeCartWithSplitOrdersWorkflow` after orders are created, and again from the `order-edit-confirmed` subscriber on order edits, returns, claims, and exchanges.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { refreshOrderCommissionLinesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await refreshOrderCommissionLinesWorkflow(container).run({
|
|
14
|
-
input: { order_ids: ["order_123"] },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="order_ids" type="string[]" required>IDs of the orders to recompute commission lines for; fails if any order is not found.</ParamField>
|
|
21
|
-
|
|
22
|
-
## Result
|
|
23
|
-
|
|
24
|
-
<ResponseField name="result" type="CommissionLineDTO[]">The upserted commission lines.</ResponseField>
|
|
25
|
-
<ResponseField name="result[].item_id" type="string | null">The order line item the commission applies to.</ResponseField>
|
|
26
|
-
<ResponseField name="result[].shipping_method_id" type="string | null">The shipping method the commission applies to.</ResponseField>
|
|
27
|
-
<ResponseField name="result[].commission_rate_id" type="string | null">The rate that produced the line.</ResponseField>
|
|
28
|
-
<ResponseField name="result[].code" type="string">Code of the applied rate.</ResponseField>
|
|
29
|
-
<ResponseField name="result[].rate" type="number">Rate value applied.</ResponseField>
|
|
30
|
-
<ResponseField name="result[].amount" type="number">Commission amount in the order currency.</ResponseField>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "updateCommissionRatesWorkflow"
|
|
3
|
-
description: "Update one or more commission rates."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Applies partial updates to existing commission rates by ID. Triggered by `POST /admin/commission-rates/:id`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { updateCommissionRatesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await updateCommissionRatesWorkflow(container).run({
|
|
14
|
-
input: [{ id: "comrate_123", value: 12, is_enabled: true }],
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
The input is an array of commission rate updates.
|
|
21
|
-
|
|
22
|
-
<ParamField body="id" type="string" required>The commission rate to update.</ParamField>
|
|
23
|
-
<ParamField body="name" type="string">Display name of the rate.</ParamField>
|
|
24
|
-
<ParamField body="code" type="string">Unique code of the rate.</ParamField>
|
|
25
|
-
<ParamField body="type" type="string">One of `fixed`, `percentage`.</ParamField>
|
|
26
|
-
<ParamField body="value" type="number">Rate value — a percentage for `percentage`, an amount for `fixed`.</ParamField>
|
|
27
|
-
<ParamField body="currency_code" type="string | null">Currency of a `fixed` rate.</ParamField>
|
|
28
|
-
<ParamField body="include_tax" type="boolean">Include tax totals in the commission base.</ParamField>
|
|
29
|
-
<ParamField body="include_shipping" type="boolean">Also apply the rate to shipping methods.</ParamField>
|
|
30
|
-
<ParamField body="is_enabled" type="boolean">Whether the rate is active.</ParamField>
|
|
31
|
-
<ParamField body="is_default" type="boolean">Marks the rate as the platform-wide fallback.</ParamField>
|
|
32
|
-
|
|
33
|
-
## Result
|
|
34
|
-
|
|
35
|
-
<ResponseField name="result" type="CommissionRateDTO[]">The updated commission rates.</ResponseField>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "setCategoryImagesWorkflow"
|
|
3
|
-
description: "Replace a category's media gallery and icon, enforcing single thumbnail/banner."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Replaces a product category's media. When `media` is provided, the entire existing gallery is swapped for the new list; when `icon` is provided, the existing icon image is swapped (pass `null` to clear it). Omitted fields are left untouched. At most one image keeps `is_thumbnail` and one keeps `is_banner` — the first flagged entry wins and later flags are silently dropped. Usually invoked through the `createProductCategoryWithImagesWorkflow`, `updateProductCategoryWithImagesWorkflow`, and `deleteProductCategoryWithImagesWorkflow` wrappers behind the `/admin/product-categories` routes.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { setCategoryImagesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await setCategoryImagesWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
category_id: "pcat_123",
|
|
16
|
-
media: [
|
|
17
|
-
{ url: "https://cdn.example.com/hero.jpg", is_banner: true },
|
|
18
|
-
{ url: "https://cdn.example.com/thumb.jpg", is_thumbnail: true },
|
|
19
|
-
],
|
|
20
|
-
icon: "https://cdn.example.com/icon.svg",
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Input
|
|
26
|
-
|
|
27
|
-
<ParamField body="category_id" type="string" required>The category whose images are replaced.</ParamField>
|
|
28
|
-
<ParamField body="media" type="CategoryMediaInput[]">
|
|
29
|
-
New gallery; replaces all existing non-icon images (pass `[]` to clear).
|
|
30
|
-
<Expandable title="properties">
|
|
31
|
-
<ParamField body="url" type="string" required>Public URL of the image.</ParamField>
|
|
32
|
-
<ParamField body="is_thumbnail" type="boolean">Mark as the thumbnail; only the first flagged image is honoured.</ParamField>
|
|
33
|
-
<ParamField body="is_banner" type="boolean">Mark as the banner; only the first flagged image is honoured.</ParamField>
|
|
34
|
-
<ParamField body="rank" type="number">Sort rank; defaults to the array index.</ParamField>
|
|
35
|
-
</Expandable>
|
|
36
|
-
</ParamField>
|
|
37
|
-
<ParamField body="icon" type="string | null">New icon URL; `null` removes the current icon, omit to keep it.</ParamField>
|
|
38
|
-
|
|
39
|
-
## Result
|
|
40
|
-
|
|
41
|
-
<ResponseField name="result" type="void">No return value.</ResponseField>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "setCollectionImagesWorkflow"
|
|
3
|
-
description: "Replace a collection's media gallery and icon, enforcing single thumbnail/banner."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Replaces a product collection's media. When `media` is provided, the entire existing gallery is swapped for the new list; when `icon` is provided, the existing icon image is swapped (pass `null` to clear it). Omitted fields are left untouched. At most one image keeps `is_thumbnail` and one keeps `is_banner` — the first flagged entry wins and later flags are silently dropped. Usually invoked through the `createProductCollectionWithImagesWorkflow`, `updateProductCollectionWithImagesWorkflow`, and `deleteProductCollectionWithImagesWorkflow` wrappers behind the `/admin/collections` routes.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { setCollectionImagesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await setCollectionImagesWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
collection_id: "pcol_123",
|
|
16
|
-
media: [
|
|
17
|
-
{ url: "https://cdn.example.com/hero.jpg", is_banner: true },
|
|
18
|
-
{ url: "https://cdn.example.com/thumb.jpg", is_thumbnail: true },
|
|
19
|
-
],
|
|
20
|
-
icon: "https://cdn.example.com/icon.svg",
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Input
|
|
26
|
-
|
|
27
|
-
<ParamField body="collection_id" type="string" required>The collection whose images are replaced.</ParamField>
|
|
28
|
-
<ParamField body="media" type="CollectionMediaInput[]">
|
|
29
|
-
New gallery; replaces all existing non-icon images (pass `[]` to clear).
|
|
30
|
-
<Expandable title="properties">
|
|
31
|
-
<ParamField body="url" type="string" required>Public URL of the image.</ParamField>
|
|
32
|
-
<ParamField body="is_thumbnail" type="boolean">Mark as the thumbnail; only the first flagged image is honoured.</ParamField>
|
|
33
|
-
<ParamField body="is_banner" type="boolean">Mark as the banner; only the first flagged image is honoured.</ParamField>
|
|
34
|
-
<ParamField body="rank" type="number">Sort rank; defaults to the array index.</ParamField>
|
|
35
|
-
</Expandable>
|
|
36
|
-
</ParamField>
|
|
37
|
-
<ParamField body="icon" type="string | null">New icon URL; `null` removes the current icon, omit to keep it.</ParamField>
|
|
38
|
-
|
|
39
|
-
## Result
|
|
40
|
-
|
|
41
|
-
<ResponseField name="result" type="void">No return value.</ResponseField>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "acceptMemberInviteWorkflow"
|
|
3
|
-
description: "Redeem an invite token and join a seller's team."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Validates the invite token, upserts the member by the invited email, links them to the seller with the invited role (as owner if the seller has none yet), binds the auth identity when the member is new, and deletes the consumed invite. Triggered by `POST /vendor/members/invites/accept`. Emits `member_invite.accepted`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { acceptMemberInviteWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await acceptMemberInviteWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
invite_token: "eyJhbGciOi...",
|
|
16
|
-
auth_identity_id: "authid_123",
|
|
17
|
-
first_name: "Jane",
|
|
18
|
-
last_name: "Doe",
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Input
|
|
24
|
-
|
|
25
|
-
<ParamField body="invite_token" type="string" required>Signed invite token from the invitation link.</ParamField>
|
|
26
|
-
<ParamField body="auth_identity_id" type="string" required>Auth identity of the accepting user.</ParamField>
|
|
27
|
-
<ParamField body="member_id" type="string">Existing member id; when set, no auth metadata is written.</ParamField>
|
|
28
|
-
<ParamField body="first_name" type="string">First name for a newly created member.</ParamField>
|
|
29
|
-
<ParamField body="last_name" type="string">Last name for a newly created member.</ParamField>
|
|
30
|
-
|
|
31
|
-
## Result
|
|
32
|
-
|
|
33
|
-
<ResponseField name="result" type="MemberDTO">The member linked to the seller.</ResponseField>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "addSellerMemberWorkflow"
|
|
3
|
-
description: "Attach an existing member to a seller with a role."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Creates a seller-member link between an existing member and a seller with the given role. Triggered by `POST /admin/sellers/:id/members` and `POST /vendor/sellers/:id/members`. Emits `seller_member.created`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { addSellerMemberWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await addSellerMemberWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
seller_id: "sel_123",
|
|
16
|
-
member_id: "mem_123",
|
|
17
|
-
role_id: "role_seller_support",
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Input
|
|
23
|
-
|
|
24
|
-
<ParamField body="seller_id" type="string" required>Id of the seller.</ParamField>
|
|
25
|
-
<ParamField body="member_id" type="string" required>Id of the member to attach.</ParamField>
|
|
26
|
-
<ParamField body="role_id" type="string" required>Role to assign, e.g. `role_seller_administration`, `role_seller_support`.</ParamField>
|
|
27
|
-
|
|
28
|
-
## Result
|
|
29
|
-
|
|
30
|
-
<ResponseField name="result" type="SellerMemberDTO">The created seller-member link.</ResponseField>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "createMemberInvitesWorkflow"
|
|
3
|
-
description: "Create tokenized member invitations for sellers."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Creates invite records with a signed token and expiry for each entry. Triggered by `POST /admin/sellers/:id/members/invite` and the vendor invite routes; also run as a step by `createSellersWorkflow` for the initial member. Emits `member_invite.created` with `{ id, token, expires_at }` per invite, which typically drives the invitation email.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { createMemberInvitesWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await createMemberInvitesWorkflow(container).run({
|
|
14
|
-
input: [
|
|
15
|
-
{
|
|
16
|
-
seller_id: "sel_123",
|
|
17
|
-
email: "teammate@acme.co",
|
|
18
|
-
role_id: "role_seller_support",
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
})
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Input
|
|
25
|
-
|
|
26
|
-
The input is an array of invites.
|
|
27
|
-
|
|
28
|
-
<ParamField body="[].seller_id" type="string" required>Seller the invite belongs to.</ParamField>
|
|
29
|
-
<ParamField body="[].email" type="string" required>Email of the invitee.</ParamField>
|
|
30
|
-
<ParamField body="[].role_id" type="string" required>Role the invitee receives on acceptance.</ParamField>
|
|
31
|
-
|
|
32
|
-
## Result
|
|
33
|
-
|
|
34
|
-
<ResponseField name="result" type="MemberInviteDTO[]">The created invites, including `token` and `expires_at`.</ResponseField>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "deleteMemberInviteWorkflow"
|
|
3
|
-
description: "Delete a pending member invite."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Deletes the invite so its token can no longer be redeemed. Triggered by `DELETE /admin/sellers/:id/members/invites/:invite_id` and the vendor equivalent.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { deleteMemberInviteWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await deleteMemberInviteWorkflow(container).run({
|
|
14
|
-
input: { invite_id: "meminv_123" },
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Input
|
|
19
|
-
|
|
20
|
-
<ParamField body="invite_id" type="string" required>Id of the invite to delete.</ParamField>
|
|
21
|
-
|
|
22
|
-
## Result
|
|
23
|
-
|
|
24
|
-
<ResponseField name="result" type="void">Nothing is returned.</ResponseField>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "removeSellerMemberWorkflow"
|
|
3
|
-
description: "Remove a member from a seller's team."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Validates the seller-member link can be removed (owners cannot be removed), then deletes it. Triggered by `DELETE /admin/sellers/:id/members/:member_id` and `DELETE /vendor/sellers/:id/members/:member_id`. Emits `seller_member.deleted`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { removeSellerMemberWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await removeSellerMemberWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
seller_member_id: "selmem_123",
|
|
16
|
-
seller_id: "sel_123",
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="seller_member_id" type="string" required>Id of the seller-member link to delete.</ParamField>
|
|
24
|
-
<ParamField body="seller_id" type="string" required>Id of the seller, included in the emitted event.</ParamField>
|
|
25
|
-
|
|
26
|
-
## Result
|
|
27
|
-
|
|
28
|
-
<ResponseField name="result" type="void">Nothing is returned.</ResponseField>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "resendMemberInviteWorkflow"
|
|
3
|
-
description: "Re-issue a member invite with a fresh token."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Loads the existing invite, deletes it, and creates a new one with the same email and role — resetting the token and expiry. Triggered by `POST /admin/sellers/:id/members/invites/:invite_id/resend` and the vendor equivalent. Emits `member_invite.created` for the new invite.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { resendMemberInviteWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await resendMemberInviteWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
invite_id: "meminv_123",
|
|
16
|
-
seller_id: "sel_123",
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="invite_id" type="string" required>Id of the invite to re-issue; must belong to the seller.</ParamField>
|
|
24
|
-
<ParamField body="seller_id" type="string" required>Seller the invite belongs to.</ParamField>
|
|
25
|
-
|
|
26
|
-
## Result
|
|
27
|
-
|
|
28
|
-
<ResponseField name="result" type="MemberInviteDTO[]">The re-created invite (single-element array) with a new `token` and `expires_at`.</ResponseField>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "updateMemberRoleWorkflow"
|
|
3
|
-
description: "Change a team member's role."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Validates the target is not the seller owner, then updates the seller-member link's role. Triggered by `POST /admin/sellers/:id/members/:member_id` and `POST /vendor/sellers/:id/members/:member_id`. Emits `seller_member.updated`.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { updateMemberRoleWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
await updateMemberRoleWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
seller_member_id: "selmem_123",
|
|
16
|
-
role_id: "role_seller_order_management",
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="seller_member_id" type="string" required>Id of the seller-member link to update; must not be the owner.</ParamField>
|
|
24
|
-
<ParamField body="role_id" type="string" required>New role to assign.</ParamField>
|
|
25
|
-
|
|
26
|
-
## Result
|
|
27
|
-
|
|
28
|
-
<ResponseField name="result" type="void">Nothing is returned.</ResponseField>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "updateMemberWorkflow"
|
|
3
|
-
description: "Update member profile fields matching a selector."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Updates every member matching the selector — name and locale only. Triggered by `POST /vendor/members/me` when a member edits their own profile.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { updateMemberWorkflow } from "@mercurjs/core/workflows"
|
|
12
|
-
|
|
13
|
-
const { result } = await updateMemberWorkflow(container).run({
|
|
14
|
-
input: {
|
|
15
|
-
selector: { id: "mem_123" },
|
|
16
|
-
update: { first_name: "Jane", last_name: "Doe" },
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Input
|
|
22
|
-
|
|
23
|
-
<ParamField body="selector" type="object" required>Filter selecting the members to update, e.g. `{ id: "mem_123" }`.</ParamField>
|
|
24
|
-
<ParamField body="update" type="object" required>
|
|
25
|
-
Fields to update.
|
|
26
|
-
<Expandable title="properties">
|
|
27
|
-
<ParamField body="first_name" type="string | null">First name.</ParamField>
|
|
28
|
-
<ParamField body="last_name" type="string | null">Last name.</ParamField>
|
|
29
|
-
<ParamField body="locale" type="string | null">Preferred locale.</ParamField>
|
|
30
|
-
</Expandable>
|
|
31
|
-
</ParamField>
|
|
32
|
-
|
|
33
|
-
## Result
|
|
34
|
-
|
|
35
|
-
<ResponseField name="result" type="MemberDTO[]">The updated members.</ResponseField>
|