@medusajs/core-flows 3.0.0-snapshot-20251114155958 → 3.0.0-snapshot-20251126221441
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/dist/cart/steps/get-actions-to-compute-from-promotions.d.ts +13 -9
- package/dist/cart/steps/get-actions-to-compute-from-promotions.d.ts.map +1 -1
- package/dist/cart/steps/get-actions-to-compute-from-promotions.js +6 -6
- package/dist/cart/steps/get-actions-to-compute-from-promotions.js.map +1 -1
- package/dist/cart/workflows/get-variants-and-items-with-prices.js +2 -2
- package/dist/cart/workflows/get-variants-and-items-with-prices.js.map +1 -1
- package/dist/cart/workflows/update-cart-promotions.js +1 -1
- package/dist/cart/workflows/update-cart-promotions.js.map +1 -1
- package/dist/common/steps/emit-event.d.ts +20 -0
- package/dist/common/steps/emit-event.d.ts.map +1 -1
- package/dist/common/steps/emit-event.js +18 -0
- package/dist/common/steps/emit-event.js.map +1 -1
- package/dist/draft-order/steps/create-draft-order-line-item-adjustments.d.ts +4 -0
- package/dist/draft-order/steps/create-draft-order-line-item-adjustments.d.ts.map +1 -1
- package/dist/draft-order/steps/create-draft-order-line-item-adjustments.js +2 -1
- package/dist/draft-order/steps/create-draft-order-line-item-adjustments.js.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-items.d.ts.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-items.js +4 -6
- package/dist/draft-order/workflows/add-draft-order-items.js.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-promotions.d.ts.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-promotions.js +10 -6
- package/dist/draft-order/workflows/add-draft-order-promotions.js.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-shipping-methods.d.ts.map +1 -1
- package/dist/draft-order/workflows/add-draft-order-shipping-methods.js +3 -12
- package/dist/draft-order/workflows/add-draft-order-shipping-methods.js.map +1 -1
- package/dist/draft-order/workflows/cancel-draft-order-edit.d.ts.map +1 -1
- package/dist/draft-order/workflows/cancel-draft-order-edit.js +26 -28
- package/dist/draft-order/workflows/cancel-draft-order-edit.js.map +1 -1
- package/dist/draft-order/workflows/compute-draft-order-adjustments.d.ts +33 -0
- package/dist/draft-order/workflows/compute-draft-order-adjustments.d.ts.map +1 -0
- package/dist/draft-order/workflows/compute-draft-order-adjustments.js +142 -0
- package/dist/draft-order/workflows/compute-draft-order-adjustments.js.map +1 -0
- package/dist/draft-order/workflows/index.d.ts +1 -0
- package/dist/draft-order/workflows/index.d.ts.map +1 -1
- package/dist/draft-order/workflows/index.js +1 -0
- package/dist/draft-order/workflows/index.js.map +1 -1
- package/dist/draft-order/workflows/refresh-draft-order-adjustments.d.ts +4 -0
- package/dist/draft-order/workflows/refresh-draft-order-adjustments.d.ts.map +1 -1
- package/dist/draft-order/workflows/refresh-draft-order-adjustments.js +2 -1
- package/dist/draft-order/workflows/refresh-draft-order-adjustments.js.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-action-item.d.ts.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-action-item.js +3 -5
- package/dist/draft-order/workflows/remove-draft-order-action-item.js.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-action-shipping-method.d.ts.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-action-shipping-method.js +3 -5
- package/dist/draft-order/workflows/remove-draft-order-action-shipping-method.js.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-promotions.d.ts.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-promotions.js +10 -6
- package/dist/draft-order/workflows/remove-draft-order-promotions.js.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-shipping-method.d.ts.map +1 -1
- package/dist/draft-order/workflows/remove-draft-order-shipping-method.js +3 -12
- package/dist/draft-order/workflows/remove-draft-order-shipping-method.js.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-action-item.d.ts.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-action-item.js +3 -5
- package/dist/draft-order/workflows/update-draft-order-action-item.js.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-action-shipping-method.d.ts.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-action-shipping-method.js +3 -5
- package/dist/draft-order/workflows/update-draft-order-action-shipping-method.js.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-item.d.ts.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-item.js +4 -6
- package/dist/draft-order/workflows/update-draft-order-item.js.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-shipping-method.d.ts.map +1 -1
- package/dist/draft-order/workflows/update-draft-order-shipping-method.js +3 -5
- package/dist/draft-order/workflows/update-draft-order-shipping-method.js.map +1 -1
- package/dist/fulfillment/workflows/mark-fulfillment-as-delivered.d.ts.map +1 -1
- package/dist/fulfillment/workflows/mark-fulfillment-as-delivered.js +13 -1
- package/dist/fulfillment/workflows/mark-fulfillment-as-delivered.js.map +1 -1
- package/dist/notification/steps/send-notifications.d.ts +9 -0
- package/dist/notification/steps/send-notifications.d.ts.map +1 -1
- package/dist/notification/steps/send-notifications.js.map +1 -1
- package/dist/order/utils/fields.d.ts.map +1 -1
- package/dist/order/utils/fields.js +2 -0
- package/dist/order/utils/fields.js.map +1 -1
- package/dist/order/workflows/create-fulfillment.d.ts.map +1 -1
- package/dist/order/workflows/create-fulfillment.js +1 -0
- package/dist/order/workflows/create-fulfillment.js.map +1 -1
- package/dist/order/workflows/create-or-update-order-payment-collection.js +1 -1
- package/dist/order/workflows/create-or-update-order-payment-collection.js.map +1 -1
- package/dist/order/workflows/exchange/exchange-add-new-item.d.ts.map +1 -1
- package/dist/order/workflows/exchange/exchange-add-new-item.js +23 -2
- package/dist/order/workflows/exchange/exchange-add-new-item.js.map +1 -1
- package/dist/order/workflows/exchange/exchange-request-item-return.d.ts.map +1 -1
- package/dist/order/workflows/exchange/exchange-request-item-return.js +17 -1
- package/dist/order/workflows/exchange/exchange-request-item-return.js.map +1 -1
- package/dist/order/workflows/index.d.ts +3 -2
- package/dist/order/workflows/index.d.ts.map +1 -1
- package/dist/order/workflows/index.js +3 -2
- package/dist/order/workflows/index.js.map +1 -1
- package/dist/order/workflows/mark-order-fulfillment-as-delivered.d.ts.map +1 -1
- package/dist/order/workflows/mark-order-fulfillment-as-delivered.js +11 -1
- package/dist/order/workflows/mark-order-fulfillment-as-delivered.js.map +1 -1
- package/dist/order/workflows/order-edit/begin-order-edit.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/begin-order-edit.js +2 -1
- package/dist/order/workflows/order-edit/begin-order-edit.js.map +1 -1
- package/dist/order/workflows/order-edit/compute-adjustments-for-preview.d.ts +60 -0
- package/dist/order/workflows/order-edit/compute-adjustments-for-preview.d.ts.map +1 -0
- package/dist/order/workflows/order-edit/compute-adjustments-for-preview.js +93 -0
- package/dist/order/workflows/order-edit/compute-adjustments-for-preview.js.map +1 -0
- package/dist/order/workflows/order-edit/confirm-order-edit-request.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/confirm-order-edit-request.js +15 -15
- package/dist/order/workflows/order-edit/confirm-order-edit-request.js.map +1 -1
- package/dist/order/workflows/order-edit/order-edit-add-new-item.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/order-edit-add-new-item.js +13 -1
- package/dist/order/workflows/order-edit/order-edit-add-new-item.js.map +1 -1
- package/dist/order/workflows/order-edit/order-edit-update-item-quantity.d.ts +4 -0
- package/dist/order/workflows/order-edit/order-edit-update-item-quantity.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/order-edit-update-item-quantity.js +18 -2
- package/dist/order/workflows/order-edit/order-edit-update-item-quantity.js.map +1 -1
- package/dist/order/workflows/order-edit/remove-order-edit-item-action.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/remove-order-edit-item-action.js +7 -0
- package/dist/order/workflows/order-edit/remove-order-edit-item-action.js.map +1 -1
- package/dist/order/workflows/order-edit/update-order-edit-add-item.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/update-order-edit-add-item.js +7 -0
- package/dist/order/workflows/order-edit/update-order-edit-add-item.js.map +1 -1
- package/dist/order/workflows/order-edit/update-order-edit-item-quantity.d.ts +3 -0
- package/dist/order/workflows/order-edit/update-order-edit-item-quantity.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/update-order-edit-item-quantity.js +10 -0
- package/dist/order/workflows/order-edit/update-order-edit-item-quantity.js.map +1 -1
- package/dist/order/workflows/order-edit/utils/fields.d.ts.map +1 -1
- package/dist/order/workflows/order-edit/utils/fields.js +6 -1
- package/dist/order/workflows/order-edit/utils/fields.js.map +1 -1
- package/dist/order/workflows/update-tax-lines.d.ts +5 -1
- package/dist/order/workflows/update-tax-lines.d.ts.map +1 -1
- package/dist/order/workflows/update-tax-lines.js +4 -0
- package/dist/order/workflows/update-tax-lines.js.map +1 -1
- package/dist/payment/workflows/process-payment.d.ts.map +1 -1
- package/dist/payment/workflows/process-payment.js +15 -3
- package/dist/payment/workflows/process-payment.js.map +1 -1
- package/dist/product/steps/create-product-options.d.ts +1 -6
- package/dist/product/steps/create-product-options.d.ts.map +1 -1
- package/dist/product/steps/create-product-options.js +1 -6
- package/dist/product/steps/create-product-options.js.map +1 -1
- package/dist/product/steps/index.d.ts +0 -2
- package/dist/product/steps/index.d.ts.map +1 -1
- package/dist/product/steps/index.js +0 -2
- package/dist/product/steps/index.js.map +1 -1
- package/dist/product/steps/update-product-options.d.ts.map +1 -1
- package/dist/product/steps/update-product-options.js +6 -6
- package/dist/product/steps/update-product-options.js.map +1 -1
- package/dist/product/workflows/batch-products.d.ts.map +1 -1
- package/dist/product/workflows/batch-products.js +4 -10
- package/dist/product/workflows/batch-products.js.map +1 -1
- package/dist/product/workflows/create-product-options.d.ts +0 -6
- package/dist/product/workflows/create-product-options.d.ts.map +1 -1
- package/dist/product/workflows/create-product-options.js +0 -6
- package/dist/product/workflows/create-product-options.js.map +1 -1
- package/dist/product/workflows/index.d.ts +0 -1
- package/dist/product/workflows/index.d.ts.map +1 -1
- package/dist/product/workflows/index.js +0 -1
- package/dist/product/workflows/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/product/steps/link-product-options-to-product.d.ts +0 -30
- package/dist/product/steps/link-product-options-to-product.d.ts.map +0 -1
- package/dist/product/steps/link-product-options-to-product.js +0 -58
- package/dist/product/steps/link-product-options-to-product.js.map +0 -1
- package/dist/product/steps/process-product-options-for-import.d.ts +0 -15
- package/dist/product/steps/process-product-options-for-import.d.ts.map +0 -1
- package/dist/product/steps/process-product-options-for-import.js +0 -61
- package/dist/product/steps/process-product-options-for-import.js.map +0 -1
- package/dist/product/workflows/create-and-link-product-options-to-product.d.ts +0 -50
- package/dist/product/workflows/create-and-link-product-options-to-product.d.ts.map +0 -1
- package/dist/product/workflows/create-and-link-product-options-to-product.js +0 -85
- package/dist/product/workflows/create-and-link-product-options-to-product.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"begin-order-edit.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/begin-order-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,aAAa,EACd,MAAM,2BAA2B,CAAA;AAalC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,sGAKxC,CAAA;AAED,eAAO,MAAM,6BAA6B,2BAA2B,CAAA;AACrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"begin-order-edit.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/begin-order-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,aAAa,EACd,MAAM,2BAA2B,CAAA;AAalC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,sGAKxC,CAAA;AAED,eAAO,MAAM,6BAA6B,2BAA2B,CAAA;AACrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,2BAA2B,2HAkCvC,CAAA"}
|
|
@@ -73,6 +73,7 @@ exports.beginOrderEditOrderWorkflow = (0, workflows_sdk_1.createWorkflow)(export
|
|
|
73
73
|
internal_note: input.internal_note,
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
const orderChange = (0, create_order_change_1.createOrderChangeStep)(orderChangeInput);
|
|
77
|
+
return new workflows_sdk_1.WorkflowResponse(orderChange);
|
|
77
78
|
});
|
|
78
79
|
//# sourceMappingURL=begin-order-edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"begin-order-edit.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/begin-order-edit.ts"],"names":[],"mappings":";;;AAKA,qEAM0C;AAC1C,4CAAmD;AACnD,yEAAuE;AACvE,mEAAsE;AACtE,2CAAyD;AAYzD;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,4BAA4B,GAAG,IAAA,0BAAU,EACpD,6BAA6B,EAC7B,KAAK,WAAW,EAAE,KAAK,EAAqC;IAC1D,IAAA,0CAAuB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AACpC,CAAC,CACF,CAAA;AAEY,QAAA,6BAA6B,GAAG,wBAAwB,CAAA;AACrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACU,QAAA,2BAA2B,GAAG,IAAA,8BAAc,EACvD,qCAA6B,EAC7B,UACE,KAA8D;IAE9D,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,iCAAwB;QAChC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE;YACP,kBAAkB,EAAE,IAAI;SACzB;KACF,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,IAAA,yBAAS,EAAC,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,IAAA,oCAA4B,EAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IAEvC,MAAM,gBAAgB,GAAG,IAAA,yBAAS,EAAC,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1D,OAAO;YACL,WAAW,EAAE,MAAe;YAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,
|
|
1
|
+
{"version":3,"file":"begin-order-edit.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/begin-order-edit.ts"],"names":[],"mappings":";;;AAKA,qEAM0C;AAC1C,4CAAmD;AACnD,yEAAuE;AACvE,mEAAsE;AACtE,2CAAyD;AAYzD;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,4BAA4B,GAAG,IAAA,0BAAU,EACpD,6BAA6B,EAC7B,KAAK,WAAW,EAAE,KAAK,EAAqC;IAC1D,IAAA,0CAAuB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AACpC,CAAC,CACF,CAAA;AAEY,QAAA,6BAA6B,GAAG,wBAAwB,CAAA;AACrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACU,QAAA,2BAA2B,GAAG,IAAA,8BAAc,EACvD,qCAA6B,EAC7B,UACE,KAA8D;IAE9D,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,iCAAwB;QAChC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE;YACP,kBAAkB,EAAE,IAAI;SACzB;KACF,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,IAAA,yBAAS,EAAC,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,IAAA,oCAA4B,EAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IAEvC,MAAM,gBAAgB,GAAG,IAAA,yBAAS,EAAC,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1D,OAAO;YACL,WAAW,EAAE,MAAe;YAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,IAAA,2CAAqB,EAAC,gBAAgB,CAAC,CAAA;IAE3D,OAAO,IAAI,gCAAgB,CAAC,WAAW,CAAC,CAAA;AAC1C,CAAC,CACF,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { OrderChangeDTO, OrderDTO, PromotionDTO } from "@medusajs/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* The data to compute adjustments for an order edit, exchange, claim, or return.
|
|
4
|
+
*/
|
|
5
|
+
export type ComputeAdjustmentsForPreviewWorkflowInput = {
|
|
6
|
+
/**
|
|
7
|
+
* The order's details.
|
|
8
|
+
*/
|
|
9
|
+
order: OrderDTO & {
|
|
10
|
+
promotions: PromotionDTO[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The order change's details.
|
|
14
|
+
*/
|
|
15
|
+
orderChange: OrderChangeDTO;
|
|
16
|
+
/**
|
|
17
|
+
* Optional exchange ID to include in the order change action.
|
|
18
|
+
*/
|
|
19
|
+
exchange_id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional claim ID to include in the order change action.
|
|
22
|
+
*/
|
|
23
|
+
claim_id?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional return ID to include in the order change action.
|
|
26
|
+
*/
|
|
27
|
+
return_id?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const computeAdjustmentsForPreviewWorkflowId = "compute-adjustments-for-preview";
|
|
30
|
+
/**
|
|
31
|
+
* This workflow computes adjustments for an order edit, exchange, claim, or return.
|
|
32
|
+
* It's used by the [Add Items to Order Edit Admin API Route](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditems),
|
|
33
|
+
* [Add Outbound Items Admin API Route](https://docs.medusajs.com/api/admin#exchanges_postexchangesidoutbounditems),
|
|
34
|
+
* and [Add Inbound Items Admin API Route](https://docs.medusajs.com/api/admin#exchanges_postexchangesidinbounditems).
|
|
35
|
+
*
|
|
36
|
+
* You can use this workflow within your customizations or your own custom workflows, allowing you to compute adjustments
|
|
37
|
+
* in your custom flows.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const { result } = await computeAdjustmentsForPreviewWorkflow(container)
|
|
41
|
+
* .run({
|
|
42
|
+
* input: {
|
|
43
|
+
* order: {
|
|
44
|
+
* id: "order_123",
|
|
45
|
+
* // other order details...
|
|
46
|
+
* },
|
|
47
|
+
* orderChange: {
|
|
48
|
+
* id: "orch_123",
|
|
49
|
+
* // other order change details...
|
|
50
|
+
* },
|
|
51
|
+
* exchange_id: "exchange_123", // optional, for exchanges
|
|
52
|
+
* }
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* @summary
|
|
56
|
+
*
|
|
57
|
+
* Compute adjustments for an order edit, exchange, claim, or return.
|
|
58
|
+
*/
|
|
59
|
+
export declare const computeAdjustmentsForPreviewWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<ComputeAdjustmentsForPreviewWorkflowInput, unknown, any[]>;
|
|
60
|
+
//# sourceMappingURL=compute-adjustments-for-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-adjustments-for-preview.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/compute-adjustments-for-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,YAAY,EACb,MAAM,2BAA2B,CAAA;AAelC;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD;;OAEG;IACH,KAAK,EAAE,QAAQ,GAAG;QAAE,UAAU,EAAE,YAAY,EAAE,CAAA;KAAE,CAAA;IAChD;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,sCAAsC,oCAChB,CAAA;AACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,oCAAoC,uHAqFhD,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeAdjustmentsForPreviewWorkflow = exports.computeAdjustmentsForPreviewWorkflowId = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
6
|
+
const cart_1 = require("../../../cart");
|
|
7
|
+
const preview_order_change_1 = require("../../steps/preview-order-change");
|
|
8
|
+
const create_order_change_actions_1 = require("../create-order-change-actions");
|
|
9
|
+
exports.computeAdjustmentsForPreviewWorkflowId = "compute-adjustments-for-preview";
|
|
10
|
+
/**
|
|
11
|
+
* This workflow computes adjustments for an order edit, exchange, claim, or return.
|
|
12
|
+
* It's used by the [Add Items to Order Edit Admin API Route](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditems),
|
|
13
|
+
* [Add Outbound Items Admin API Route](https://docs.medusajs.com/api/admin#exchanges_postexchangesidoutbounditems),
|
|
14
|
+
* and [Add Inbound Items Admin API Route](https://docs.medusajs.com/api/admin#exchanges_postexchangesidinbounditems).
|
|
15
|
+
*
|
|
16
|
+
* You can use this workflow within your customizations or your own custom workflows, allowing you to compute adjustments
|
|
17
|
+
* in your custom flows.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const { result } = await computeAdjustmentsForPreviewWorkflow(container)
|
|
21
|
+
* .run({
|
|
22
|
+
* input: {
|
|
23
|
+
* order: {
|
|
24
|
+
* id: "order_123",
|
|
25
|
+
* // other order details...
|
|
26
|
+
* },
|
|
27
|
+
* orderChange: {
|
|
28
|
+
* id: "orch_123",
|
|
29
|
+
* // other order change details...
|
|
30
|
+
* },
|
|
31
|
+
* exchange_id: "exchange_123", // optional, for exchanges
|
|
32
|
+
* }
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* @summary
|
|
36
|
+
*
|
|
37
|
+
* Compute adjustments for an order edit, exchange, claim, or return.
|
|
38
|
+
*/
|
|
39
|
+
exports.computeAdjustmentsForPreviewWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.computeAdjustmentsForPreviewWorkflowId, function (input) {
|
|
40
|
+
const previewedOrder = (0, preview_order_change_1.previewOrderChangeStep)(input.order.id);
|
|
41
|
+
(0, workflows_sdk_1.when)({ order: input.order }, ({ order }) => !!order.promotions.length).then(() => {
|
|
42
|
+
const actionsToComputeItemsInput = (0, workflows_sdk_1.transform)({ previewedOrder, order: input.order }, ({ previewedOrder, order }) => {
|
|
43
|
+
return {
|
|
44
|
+
currency_code: order.currency_code,
|
|
45
|
+
items: previewedOrder.items.map((item) => ({
|
|
46
|
+
...item,
|
|
47
|
+
// Buy-Get promotions rely on the product ID, so we need to manually set it before refreshing adjustments
|
|
48
|
+
product: { id: item.product_id },
|
|
49
|
+
})),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const orderPromotions = (0, workflows_sdk_1.transform)({ order: input.order }, ({ order }) => {
|
|
53
|
+
return order.promotions
|
|
54
|
+
.map((p) => p.code)
|
|
55
|
+
.filter((p) => p !== undefined);
|
|
56
|
+
});
|
|
57
|
+
const actions = (0, cart_1.getActionsToComputeFromPromotionsStep)({
|
|
58
|
+
computeActionContext: actionsToComputeItemsInput,
|
|
59
|
+
promotionCodesToApply: orderPromotions,
|
|
60
|
+
});
|
|
61
|
+
const { lineItemAdjustmentsToCreate } = (0, cart_1.prepareAdjustmentsFromPromotionActionsStep)({ actions });
|
|
62
|
+
const orderChangeActionAdjustmentsInput = (0, workflows_sdk_1.transform)({
|
|
63
|
+
order: input.order,
|
|
64
|
+
previewedOrder,
|
|
65
|
+
orderChange: input.orderChange,
|
|
66
|
+
lineItemAdjustmentsToCreate,
|
|
67
|
+
exchangeId: input.exchange_id,
|
|
68
|
+
claimId: input.claim_id,
|
|
69
|
+
returnId: input.return_id,
|
|
70
|
+
}, ({ order, previewedOrder, orderChange, lineItemAdjustmentsToCreate, exchangeId, claimId, returnId, }) => {
|
|
71
|
+
return previewedOrder.items.map((item) => {
|
|
72
|
+
const itemAdjustments = lineItemAdjustmentsToCreate.filter((adjustment) => adjustment.item_id === item.id);
|
|
73
|
+
return {
|
|
74
|
+
order_change_id: orderChange.id,
|
|
75
|
+
order_id: order.id,
|
|
76
|
+
...(exchangeId && { exchange_id: exchangeId }),
|
|
77
|
+
...(claimId && { claim_id: claimId }),
|
|
78
|
+
...(returnId && { return_id: returnId }),
|
|
79
|
+
version: orderChange.version,
|
|
80
|
+
action: utils_1.ChangeActionType.ITEM_ADJUSTMENTS_REPLACE,
|
|
81
|
+
details: {
|
|
82
|
+
reference_id: item.id,
|
|
83
|
+
adjustments: itemAdjustments,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
create_order_change_actions_1.createOrderChangeActionsWorkflow
|
|
89
|
+
.runAsStep({ input: orderChangeActionAdjustmentsInput })
|
|
90
|
+
.config({ name: "order-change-action-adjustments-input" });
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=compute-adjustments-for-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-adjustments-for-preview.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/compute-adjustments-for-preview.ts"],"names":[],"mappings":";;;AAMA,qDAA4D;AAC5D,qEAK0C;AAC1C,wCAGsB;AACtB,2EAAyE;AACzE,gFAAiF;AA4BpE,QAAA,sCAAsC,GACjD,iCAAiC,CAAA;AACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACU,QAAA,oCAAoC,GAAG,IAAA,8BAAc,EAChE,8CAAsC,EACtC,UAAU,KAA8D;IACtE,MAAM,cAAc,GAAG,IAAA,6CAAsB,EAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAE7D,IAAA,oBAAI,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CACzE,GAAG,EAAE;QACH,MAAM,0BAA0B,GAAG,IAAA,yBAAS,EAC1C,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EACtC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,EAAE;YAC5B,OAAO;gBACL,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CA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EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,KAAK,IAAI,CAAC,EAAE,CAC/C,CAAA;gBAED,OAAO;oBACL,eAAe,EAAE,WAAW,CAAC,EAAE;oBAC/B,QAAQ,EAAE,KAAK,CAAC,EAAE;oBAClB,GAAG,CAAC,UAAU,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;oBAC9C,GAAG,CAAC,OAAO,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;oBACrC,GAAG,CAAC,QAAQ,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;oBACxC,OAAO,EAAE,WAAW,CAAC,OAAO;oBAC5B,MAAM,EAAE,wBAAgB,CAAC,wBAAwB;oBACjD,OAAO,EAAE;wBACP,YAAY,EAAE,IAAI,CAAC,EAAE;wBACrB,WAAW,EAAE,eAAe;qBAC7B;iBACF,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CACF,CAAA;QAED,8DAAgC;aAC7B,SAAS,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;aACvD,MAAM,CAAC,EAAE,IAAI,EAAE,uCAAuC,EAAE,CAAC,CAAA;IAC9D,CAAC,CACF,CAAA;AACH,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-order-edit-request.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/confirm-order-edit-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EAChB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"confirm-order-edit-request.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/confirm-order-edit-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EAChB,MAAM,2BAA2B,CAAA;AA8BlC;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qCAAqC,+GASjD,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iCAAiC,+BAA+B,CAAA;AAC7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,+BAA+B,uHA6K3C,CAAA"}
|
|
@@ -103,30 +103,32 @@ exports.confirmOrderEditRequestWorkflow = (0, workflows_sdk_1.createWorkflow)(ex
|
|
|
103
103
|
orderId: order.id,
|
|
104
104
|
confirmed_by: input.confirmed_by,
|
|
105
105
|
});
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
fields:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
const { data: refreshedOrder } = (0, common_1.useQueryGraphStep)({
|
|
107
|
+
entity: "order",
|
|
108
|
+
fields: (0, utils_1.deduplicate)([
|
|
109
|
+
...prepare_confirm_inventory_input_1.requiredOrderFieldsForInventoryConfirmation,
|
|
110
|
+
...fields_1.fieldsToRefreshOrderEdit,
|
|
111
|
+
]),
|
|
112
|
+
filters: { id: input.order_id },
|
|
113
|
+
options: {
|
|
114
|
+
throwIfKeyNotFound: true,
|
|
115
|
+
isList: false,
|
|
116
|
+
},
|
|
112
117
|
}).config({ name: "order-items-query" });
|
|
113
|
-
const { variants, items, toRemoveReservationLineItemIds } = (0, workflows_sdk_1.transform)({
|
|
118
|
+
const { variants, items, toRemoveReservationLineItemIds } = (0, workflows_sdk_1.transform)({ refreshedOrder, previousOrderItems: order.items, orderPreview }, ({ refreshedOrder, previousOrderItems, orderPreview }) => {
|
|
114
119
|
const allItems = [];
|
|
115
120
|
const allVariants = [];
|
|
116
121
|
const previousItemIds = (previousOrderItems || []).map(({ id }) => id);
|
|
117
|
-
const currentItemIds =
|
|
122
|
+
const currentItemIds = refreshedOrder.items.map(({ id }) => id);
|
|
118
123
|
const removedItemIds = previousItemIds.filter((id) => !currentItemIds.includes(id));
|
|
119
124
|
const updatedItemIds = [];
|
|
120
|
-
|
|
125
|
+
refreshedOrder.items.forEach((ordItem) => {
|
|
121
126
|
const itemAction = orderPreview.items?.find((item) => item.id === ordItem.id &&
|
|
122
127
|
item.actions?.find((a) => a.action === utils_1.ChangeActionType.ITEM_ADD ||
|
|
123
128
|
a.action === utils_1.ChangeActionType.ITEM_UPDATE));
|
|
124
129
|
if (!itemAction) {
|
|
125
130
|
return;
|
|
126
131
|
}
|
|
127
|
-
const unitPrice = itemAction.raw_unit_price ?? itemAction.unit_price;
|
|
128
|
-
const compareAtUnitPrice = itemAction.raw_compare_at_unit_price ??
|
|
129
|
-
itemAction.compare_at_unit_price;
|
|
130
132
|
const updateAction = itemAction.actions.find((a) => a.action === utils_1.ChangeActionType.ITEM_UPDATE);
|
|
131
133
|
if (updateAction) {
|
|
132
134
|
updatedItemIds.push(ordItem.id);
|
|
@@ -137,8 +139,6 @@ exports.confirmOrderEditRequestWorkflow = (0, workflows_sdk_1.createWorkflow)(ex
|
|
|
137
139
|
id: ordItem.id,
|
|
138
140
|
variant_id: ordItem.variant_id,
|
|
139
141
|
quantity: reservationQuantity,
|
|
140
|
-
unit_price: unitPrice,
|
|
141
|
-
compare_at_unit_price: compareAtUnitPrice,
|
|
142
142
|
});
|
|
143
143
|
allVariants.push(ordItem.variant);
|
|
144
144
|
});
|
|
@@ -153,7 +153,7 @@ exports.confirmOrderEditRequestWorkflow = (0, workflows_sdk_1.createWorkflow)(ex
|
|
|
153
153
|
});
|
|
154
154
|
const formatedInventoryItems = (0, workflows_sdk_1.transform)({
|
|
155
155
|
input: {
|
|
156
|
-
sales_channel_id:
|
|
156
|
+
sales_channel_id: refreshedOrder.sales_channel_id,
|
|
157
157
|
variants,
|
|
158
158
|
items,
|
|
159
159
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-order-edit-request.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/confirm-order-edit-request.ts"],"names":[],"mappings":";;;AAMA,
|
|
1
|
+
{"version":3,"file":"confirm-order-edit-request.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/confirm-order-edit-request.ts"],"names":[],"mappings":";;;AAMA,qDAMkC;AAClC,qEAK0C;AAC1C,6EAA4E;AAC5E,yGAG4D;AAC5D,4CAAkE;AAClE,sDAAwE;AACxE,uCAAoD;AACpD,6EAAuE;AACvE,mEAGqC;AACrC,4GAA2G;AAC3G,2CAAyD;AAgBzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,qCAAqC,GAAG,IAAA,0BAAU,EAC7D,qCAAqC,EACrC,KAAK,WAAW,EACd,KAAK,EACL,WAAW,GACgC;IAC3C,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;AAChD,CAAC,CACF,CAAA;AAgBY,QAAA,iCAAiC,GAAG,4BAA4B,CAAA;AAC7E;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,+BAA+B,GAAG,IAAA,8BAAc,EAC3D,yCAAiC,EACjC,UACE,KAA2C;IAE3C,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,iCAAwB;QAChC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE;YACP,kBAAkB,EAAE,IAAI;SACzB;KACF,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IAElC,MAAM,KAAK,GAAG,IAAA,yBAAS,EAAC,EAAE,WAAW,EA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,CAAC,SAAS,CAAC;QACrD,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK,CAAC,EAAE;SACnB;KACF,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,IAAA,yBAAS,EACzB,EAAE,KAAK,EAAE,WAAW,EAAE,EACtB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE;QACzB,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,EAAE;YAClB,OAAO,EAAE,WAAW,CAAC,OAAO;SAC7B,CAAA;IACH,CAAC,CACF,CAAA;IAED,IAAA,sBAAa,EAAC;QACZ,SAAS,EAAE,+BAAuB,CAAC,SAAS;QAC5C,IAAI,EAAE,SAAS;KAChB,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,YAAY,CAAC,CAAA;AAC3C,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-edit-add-new-item.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-add-new-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"order-edit-add-new-item.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-add-new-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;AAqBlC;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iCAAiC,2GAS7C,CAAA;AAED,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,2BAA2B,iIAiGvC,CAAA"}
|
|
@@ -10,6 +10,7 @@ const add_line_items_1 = require("../add-line-items");
|
|
|
10
10
|
const create_order_change_actions_1 = require("../create-order-change-actions");
|
|
11
11
|
const update_tax_lines_1 = require("../update-tax-lines");
|
|
12
12
|
const fields_1 = require("./utils/fields");
|
|
13
|
+
const compute_adjustments_for_preview_1 = require("./compute-adjustments-for-preview");
|
|
13
14
|
/**
|
|
14
15
|
* This step validates that new items can be added to an order edit.
|
|
15
16
|
* If the order is canceled or the order change is not active, the step will throw an error.
|
|
@@ -105,7 +106,12 @@ exports.orderEditAddNewItemWorkflow = (0, workflows_sdk_1.createWorkflow)(export
|
|
|
105
106
|
item_ids: lineItemIds,
|
|
106
107
|
},
|
|
107
108
|
});
|
|
108
|
-
const orderChangeActionInput = (0, workflows_sdk_1.transform)({
|
|
109
|
+
const orderChangeActionInput = (0, workflows_sdk_1.transform)({
|
|
110
|
+
order,
|
|
111
|
+
orderChange,
|
|
112
|
+
items: input.items,
|
|
113
|
+
lineItems,
|
|
114
|
+
}, ({ order, orderChange, items, lineItems }) => {
|
|
109
115
|
return items.map((item, index) => ({
|
|
110
116
|
order_change_id: orderChange.id,
|
|
111
117
|
order_id: order.id,
|
|
@@ -125,6 +131,12 @@ exports.orderEditAddNewItemWorkflow = (0, workflows_sdk_1.createWorkflow)(export
|
|
|
125
131
|
create_order_change_actions_1.createOrderChangeActionsWorkflow.runAsStep({
|
|
126
132
|
input: orderChangeActionInput,
|
|
127
133
|
});
|
|
134
|
+
compute_adjustments_for_preview_1.computeAdjustmentsForPreviewWorkflow.runAsStep({
|
|
135
|
+
input: {
|
|
136
|
+
order,
|
|
137
|
+
orderChange,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
128
140
|
return new workflows_sdk_1.WorkflowResponse((0, preview_order_change_1.previewOrderChangeStep)(input.order_id));
|
|
129
141
|
});
|
|
130
142
|
//# sourceMappingURL=order-edit-add-new-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-edit-add-new-item.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-add-new-item.ts"],"names":[],"mappings":";;;AAMA,
|
|
1
|
+
{"version":3,"file":"order-edit-add-new-item.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-add-new-item.ts"],"names":[],"mappings":";;;AAMA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,2EAAyE;AACzE,mEAGqC;AACrC,sDAA6D;AAC7D,gFAAiF;AACjF,0DAAiE;AACjE,2CAAyD;AACzD,uFAAwF;AAgBxF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,iCAAiC,GAAG,IAAA,0BAAU,EACzD,oCAAoC,EACpC,KAAK,WAAW,EACd,KAAK,EACL,WAAW,GAC4B;IACvC,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;AAChD,CAAC,CACF,CAAA;AAEY,QAAA,6BAA6B,GAAG,yBAAyB,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,2BAA2B,GAAG,IAAA,8BAAc,EACvD,qCAA6B,EAC7B,UACE,KAAmE;IAEnE,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,iCAAwB;QAChC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE;YACP,kBAAkB,EAAE,IAAI;SACzB;KACF,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IAElC,MAAM,KAAK,GAAG,IAAA,yBAAS,EAAC,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3D,OAAO,WAAW,CAAC,IAAI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X,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS;KACV,EACD,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;QAC3C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACjC,eAAe,EAAE,WAAW,CAAC,EAAE;YAC/B,QAAQ,EAAE,KAAK,CAAC,EAAE;YAClB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,MAAM,EAAE,wBAAgB,CAAC,QAAQ;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE;gBACP,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,UAAU;gBAC1D,qBAAqB,EACnB,IAAI,CAAC,qBAAqB;oBAC1B,SAAS,CAAC,KAAK,CAAC,CAAC,qBAAqB;gBACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAC,CAAC,CAAA;IACL,CAAC,CACF,CAAA;IAED,8DAAgC,CAAC,SAAS,CAAC;QACzC,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAA;IAEF,sEAAoC,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE;YACL,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,IAAA,6CAAsB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC,CACF,CAAA"}
|
|
@@ -41,6 +41,10 @@ export declare const orderEditUpdateItemQuantityWorkflowId = "order-edit-update-
|
|
|
41
41
|
* This workflow updates the quantity of an existing item in an order's edit. It's used by the
|
|
42
42
|
* [Update Order Item Quantity Admin API Route](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsitemitem_id).
|
|
43
43
|
*
|
|
44
|
+
* This workflow is different from the `updateOrderEditItemQuantityWorkflow` workflow in that this should be used
|
|
45
|
+
* when the item to update was part of the original order before the edit. The other workflow is for items
|
|
46
|
+
* that were added to the order as part of the edit.
|
|
47
|
+
*
|
|
44
48
|
* You can also use this workflow to remove an item from an order by setting its quantity to `0`.
|
|
45
49
|
*
|
|
46
50
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to update the quantity of an existing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-edit-update-item-quantity.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-update-item-quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"order-edit-update-item-quantity.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-update-item-quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;AAwBlC;;GAEG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yCAAyC,mHASrD,CAAA;AAED,eAAO,MAAM,qCAAqC,oCACf,CAAA;AACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mCAAmC,yIAwF/C,CAAA"}
|
|
@@ -7,6 +7,7 @@ const common_1 = require("../../../common");
|
|
|
7
7
|
const preview_order_change_1 = require("../../steps/preview-order-change");
|
|
8
8
|
const order_validation_1 = require("../../utils/order-validation");
|
|
9
9
|
const create_order_change_actions_1 = require("../create-order-change-actions");
|
|
10
|
+
const compute_adjustments_for_preview_1 = require("./compute-adjustments-for-preview");
|
|
10
11
|
const fields_1 = require("./utils/fields");
|
|
11
12
|
/**
|
|
12
13
|
* This step validates that the quantity of an existing item in an order can be updated in an order edit.
|
|
@@ -40,6 +41,10 @@ exports.orderEditUpdateItemQuantityWorkflowId = "order-edit-update-item-quantity
|
|
|
40
41
|
* This workflow updates the quantity of an existing item in an order's edit. It's used by the
|
|
41
42
|
* [Update Order Item Quantity Admin API Route](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsitemitem_id).
|
|
42
43
|
*
|
|
44
|
+
* This workflow is different from the `updateOrderEditItemQuantityWorkflow` workflow in that this should be used
|
|
45
|
+
* when the item to update was part of the original order before the edit. The other workflow is for items
|
|
46
|
+
* that were added to the order as part of the edit.
|
|
47
|
+
*
|
|
43
48
|
* You can also use this workflow to remove an item from an order by setting its quantity to `0`.
|
|
44
49
|
*
|
|
45
50
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to update the quantity of an existing
|
|
@@ -90,8 +95,12 @@ exports.orderEditUpdateItemQuantityWorkflow = (0, workflows_sdk_1.createWorkflow
|
|
|
90
95
|
order,
|
|
91
96
|
orderChange,
|
|
92
97
|
});
|
|
93
|
-
const orderChangeActionInput = (0, workflows_sdk_1.transform)({
|
|
94
|
-
|
|
98
|
+
const orderChangeActionInput = (0, workflows_sdk_1.transform)({
|
|
99
|
+
order,
|
|
100
|
+
orderChange,
|
|
101
|
+
items: input.items,
|
|
102
|
+
}, ({ order, orderChange, items }) => {
|
|
103
|
+
const itemsUpdates = items.map((item) => {
|
|
95
104
|
const existing = order?.items?.find((exItem) => exItem.id === item.id);
|
|
96
105
|
const quantityDiff = new utils_1.BigNumber(utils_1.MathBN.sub(item.quantity, existing.quantity));
|
|
97
106
|
return {
|
|
@@ -109,10 +118,17 @@ exports.orderEditUpdateItemQuantityWorkflow = (0, workflows_sdk_1.createWorkflow
|
|
|
109
118
|
},
|
|
110
119
|
};
|
|
111
120
|
});
|
|
121
|
+
return [...itemsUpdates];
|
|
112
122
|
});
|
|
113
123
|
create_order_change_actions_1.createOrderChangeActionsWorkflow.runAsStep({
|
|
114
124
|
input: orderChangeActionInput,
|
|
115
125
|
});
|
|
126
|
+
compute_adjustments_for_preview_1.computeAdjustmentsForPreviewWorkflow.runAsStep({
|
|
127
|
+
input: {
|
|
128
|
+
order,
|
|
129
|
+
orderChange,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
116
132
|
return new workflows_sdk_1.WorkflowResponse((0, preview_order_change_1.previewOrderChangeStep)(input.order_id));
|
|
117
133
|
});
|
|
118
134
|
//# sourceMappingURL=order-edit-update-item-quantity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-edit-update-item-quantity.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-update-item-quantity.ts"],"names":[],"mappings":";;;AAMA,qDAKkC;AAClC,qEAM0C;AAC1C,4CAAmD;AACnD,2EAAyE;AACzE,mEAGqC;AACrC,gFAAiF;AACjF,2CAAyD;AAgBzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,yCAAyC,GAAG,IAAA,0BAAU,EACjE,4CAA4C,EAC5C,KAAK,WAAW,EACd,KAAK,EACL,WAAW,GACoC;IAC/C,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;AAChD,CAAC,CACF,CAAA;AAEY,QAAA,qCAAqC,GAChD,iCAAiC,CAAA;AACnC
|
|
1
|
+
{"version":3,"file":"order-edit-update-item-quantity.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/order-edit-update-item-quantity.ts"],"names":[],"mappings":";;;AAMA,qDAKkC;AAClC,qEAM0C;AAC1C,4CAAmD;AACnD,2EAAyE;AACzE,mEAGqC;AACrC,gFAAiF;AACjF,uFAAwF;AACxF,2CAAyD;AAgBzD;;;;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,CAAA;QAEF,OAAO,CAAC,GAAG,YAAY,CAAC,CAAA;IAC1B,CAAC,CACF,CAAA;IAED,8DAAgC,CAAC,SAAS,CAAC;QACzC,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAA;IAEF,sEAAoC,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE;YACL,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,IAAA,6CAAsB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-order-edit-item-action.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/remove-order-edit-item-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"remove-order-edit-item-action.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/remove-order-edit-item-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;AAqBlC;;GAEG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC,sCAAsC,CAAA;CAC5D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,uCAAuC,iHA4BnD,CAAA;AAED,eAAO,MAAM,mCAAmC,kCACf,CAAA;AACjC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iCAAiC,uIAmD7C,CAAA"}
|
|
@@ -6,6 +6,7 @@ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
|
6
6
|
const common_1 = require("../../../common");
|
|
7
7
|
const steps_1 = require("../../steps");
|
|
8
8
|
const order_validation_1 = require("../../utils/order-validation");
|
|
9
|
+
const compute_adjustments_for_preview_1 = require("./compute-adjustments-for-preview");
|
|
9
10
|
const fields_1 = require("./utils/fields");
|
|
10
11
|
/**
|
|
11
12
|
* This step validates that an item that was added in the order edit can be removed
|
|
@@ -96,6 +97,12 @@ exports.removeItemOrderEditActionWorkflow = (0, workflows_sdk_1.createWorkflow)(
|
|
|
96
97
|
orderChange,
|
|
97
98
|
});
|
|
98
99
|
(0, steps_1.deleteOrderChangeActionsStep)({ ids: [input.action_id] });
|
|
100
|
+
compute_adjustments_for_preview_1.computeAdjustmentsForPreviewWorkflow.runAsStep({
|
|
101
|
+
input: {
|
|
102
|
+
order,
|
|
103
|
+
orderChange,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
99
106
|
return new workflows_sdk_1.WorkflowResponse((0, steps_1.previewOrderChangeStep)(order.id));
|
|
100
107
|
});
|
|
101
108
|
//# sourceMappingURL=remove-order-edit-item-action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-order-edit-item-action.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/remove-order-edit-item-action.ts"],"names":[],"mappings":";;;AAOA,
|
|
1
|
+
{"version":3,"file":"remove-order-edit-item-action.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/remove-order-edit-item-action.ts"],"names":[],"mappings":";;;AAOA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,uCAGoB;AACpB,mEAGqC;AACrC,uFAAwF;AACxF,2CAAyD;AAoBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACU,QAAA,uCAAuC,GAAG,IAAA,0BAAU,EAC/D,0CAA0C,EAC1C,KAAK,WAAW,EACd,KAAK,EACL,WAAW,EACX,KAAK,GACwC;IAC7C,IAAA,qCAAkB,EAAC,KAAK,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;IAC5B,CAAC,CAAC,CAAA;IAEF,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EAAC;QAC1C,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC;QAChD,OAAO,EAAE;YACP,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,CAAC,yBAAiB,CAAC,OAAO,EAAE,yBAAiB,CAAC,SAAS,CAAC;SACjE;KACF,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,CAAA;IAEzC,MAAM,WAAW,GAAG,IAAA,yBAAS,EAC3B,EAAE,iBAAiB,EAAE,EACrB,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE;QACxB,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAClC,CAAC,CACF,CAAA;IAED,IAAA,+CAAuC,EAAC;QACtC,KAAK;QACL,KAAK;QACL,WAAW;KACZ,CAAC,CAAA;IAEF,IAAA,oCAA4B,EAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAExD,sEAAoC,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE;YACL,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,IAAA,8BAAsB,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-order-edit-add-item.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-add-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"update-order-edit-add-item.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-add-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;AAqBlC;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC,sCAAsC,CAAA;CAC5D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,oCAAoC,8GAqBhD,CAAA;AAED,eAAO,MAAM,gCAAgC,+BAA+B,CAAA;AAC5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,8BAA8B,uIAyE1C,CAAA"}
|
|
@@ -6,6 +6,7 @@ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
|
6
6
|
const common_1 = require("../../../common");
|
|
7
7
|
const steps_1 = require("../../steps");
|
|
8
8
|
const order_validation_1 = require("../../utils/order-validation");
|
|
9
|
+
const compute_adjustments_for_preview_1 = require("./compute-adjustments-for-preview");
|
|
9
10
|
const fields_1 = require("./utils/fields");
|
|
10
11
|
/**
|
|
11
12
|
* This step validates that a new item can be updated in an order edit.
|
|
@@ -117,6 +118,12 @@ exports.updateOrderEditAddItemWorkflow = (0, workflows_sdk_1.createWorkflow)(exp
|
|
|
117
118
|
};
|
|
118
119
|
});
|
|
119
120
|
(0, steps_1.updateOrderChangeActionsStep)([updateData]);
|
|
121
|
+
compute_adjustments_for_preview_1.computeAdjustmentsForPreviewWorkflow.runAsStep({
|
|
122
|
+
input: {
|
|
123
|
+
order,
|
|
124
|
+
orderChange,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
120
127
|
return new workflows_sdk_1.WorkflowResponse((0, steps_1.previewOrderChangeStep)(order.id));
|
|
121
128
|
});
|
|
122
129
|
//# sourceMappingURL=update-order-edit-add-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-order-edit-add-item.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-add-item.ts"],"names":[],"mappings":";;;AAOA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,uCAGoB;AACpB,mEAGqC;AACrC,2CAAyD;AAoBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACU,QAAA,oCAAoC,GAAG,IAAA,0BAAU,EAC5D,uCAAuC,EACvC,KAAK,WACH,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAA6C,EACxE,OAAO;IAEP,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;IAE9C,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CACR,CAAA;IAEzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,oCAAoC,KAAK,CAAC,QAAQ,oBAAoB,WAAW,CAAC,EAAE,EAAE,CACvF,CAAA;IACH,CAAC;SAAM,IAAI,gBAAgB,CAAC,MAAM,KAAK,wBAAgB,CAAC,QAAQ,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,UAAU,gBAAgB,CAAC,EAAE,wBAAwB,CAAC,CAAA;IACxE,CAAC;AACH,CAAC,CACF,CAAA;AAEY,QAAA,gCAAgC,GAAG,4BAA4B,CAAA;AAC5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,8BAA8B,GAAG,IAAA,8BAAc,EAC1D,wCAAgC,EAChC,UACE,KAAyE;IAEzE,MAAM,WAAW,GAAG,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OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CACR,CAAA;QAEzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,OAAO;YACL,EAAE,EAAE,KAAK,CAAC,SAAS;YACnB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,EAAE,QAAQ;gBAC3D,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,cAAc,CAAC,OAAO,EAAE,UAAU;gBACjE,qBAAqB,EACnB,IAAI,CAAC,qBAAqB;oBAC1B,cAAc,CAAC,OAAO,EAAE,qBAAqB;aAChD;YACD,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;IACH,CAAC,CACF,CAAA;IAED,IAAA,oCAA4B,EAAC,CAAC,UAAU,CAAC,CAAC,CAAA;IAE1C,OAAO,IAAI,gCAAgB,CAAC,IAAA,8BAAsB,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC,CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"update-order-edit-add-item.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-add-item.ts"],"names":[],"mappings":";;;AAOA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,uCAGoB;AACpB,mEAGqC;AACrC,uFAAwF;AACxF,2CAAyD;AAoBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACU,QAAA,oCAAoC,GAAG,IAAA,0BAAU,EAC5D,uCAAuC,EACvC,KAAK,WACH,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAA6C,EACxE,OAAO;IAEP,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;IAE9C,M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,oCAA4B,EAAC,CAAC,UAAU,CAAC,CAAC,CAAA;IAE1C,sEAAoC,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE;YACL,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,IAAA,8BAAsB,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC,CACF,CAAA"}
|
|
@@ -52,6 +52,9 @@ export declare const updateOrderEditItemQuantityValidationStep: import("@medusaj
|
|
|
52
52
|
export declare const updateOrderEditItemQuantityWorkflowId = "update-order-edit-update-quantity";
|
|
53
53
|
/**
|
|
54
54
|
* This workflow updates an existing order item that was previously added to the order edit.
|
|
55
|
+
* It is different from the `orderEditUpdateItemQuantityWorkflow` workflow in that this should be used
|
|
56
|
+
* when the item to update was added as part of the order edit. The other workflow is for items
|
|
57
|
+
* that were already in the order before the edit.
|
|
55
58
|
*
|
|
56
59
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to update the quantity
|
|
57
60
|
* of an existing item in an order edit in your custom flows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-order-edit-item-quantity.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-item-quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"update-order-edit-item-quantity.d.ts","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-item-quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAA;AAqBlC;;GAEG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,cAAc,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC,wCAAwC,CAAA;CAC9D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,yCAAyC,mHAyBrD,CAAA;AAED,eAAO,MAAM,qCAAqC,sCACb,CAAA;AACrC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,mCAAmC,yIAqE/C,CAAA"}
|
|
@@ -6,6 +6,7 @@ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
|
6
6
|
const common_1 = require("../../../common");
|
|
7
7
|
const steps_1 = require("../../steps");
|
|
8
8
|
const order_validation_1 = require("../../utils/order-validation");
|
|
9
|
+
const compute_adjustments_for_preview_1 = require("./compute-adjustments-for-preview");
|
|
9
10
|
const fields_1 = require("./utils/fields");
|
|
10
11
|
/**
|
|
11
12
|
* This step validates that an existing order item can be updated in an order edit.
|
|
@@ -53,6 +54,9 @@ exports.updateOrderEditItemQuantityValidationStep = (0, workflows_sdk_1.createSt
|
|
|
53
54
|
exports.updateOrderEditItemQuantityWorkflowId = "update-order-edit-update-quantity";
|
|
54
55
|
/**
|
|
55
56
|
* This workflow updates an existing order item that was previously added to the order edit.
|
|
57
|
+
* It is different from the `orderEditUpdateItemQuantityWorkflow` workflow in that this should be used
|
|
58
|
+
* when the item to update was added as part of the order edit. The other workflow is for items
|
|
59
|
+
* that were already in the order before the edit.
|
|
56
60
|
*
|
|
57
61
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to update the quantity
|
|
58
62
|
* of an existing item in an order edit in your custom flows.
|
|
@@ -113,6 +117,12 @@ exports.updateOrderEditItemQuantityWorkflow = (0, workflows_sdk_1.createWorkflow
|
|
|
113
117
|
};
|
|
114
118
|
});
|
|
115
119
|
(0, steps_1.updateOrderChangeActionsStep)([updateData]);
|
|
120
|
+
compute_adjustments_for_preview_1.computeAdjustmentsForPreviewWorkflow.runAsStep({
|
|
121
|
+
input: {
|
|
122
|
+
order,
|
|
123
|
+
orderChange,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
116
126
|
return new workflows_sdk_1.WorkflowResponse((0, steps_1.previewOrderChangeStep)(order.id));
|
|
117
127
|
});
|
|
118
128
|
//# sourceMappingURL=update-order-edit-item-quantity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-order-edit-item-quantity.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-item-quantity.ts"],"names":[],"mappings":";;;AAOA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,uCAGoB;AACpB,mEAGqC;AACrC,2CAAyD;AAoBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACU,QAAA,yCAAyC,GAAG,IAAA,0BAAU,EACjE,8CAA8C,EAC9C,KAAK,WACH,EACE,KAAK,EACL,WAAW,EACX,KAAK,GAC0C,EACjD,OAAO;IAEP,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;IAE9C,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CACR,CAAA;IAEzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gDAAgD,KAAK,CAAC,QAAQ,oBAAoB,WAAW,CAAC,EAAE,EAAE,CACnG,CAAA;IACH,CAAC;SAAM,IAAI,gBAAgB,CAAC,MAAM,KAAK,wBAAgB,CAAC,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,UAAU,gBAAgB,CAAC,EAAE,0BAA0B,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC,CACF,CAAA;AAEY,QAAA,qCAAqC,GAChD,mCAAmC,CAAA;AACrC
|
|
1
|
+
{"version":3,"file":"update-order-edit-item-quantity.js","sourceRoot":"","sources":["../../../../src/order/workflows/order-edit/update-order-edit-item-quantity.ts"],"names":[],"mappings":";;;AAOA,qDAA+E;AAC/E,qEAM0C;AAC1C,4CAAmD;AACnD,uCAGoB;AACpB,mEAGqC;AACrC,uFAAwF;AACxF,2CAAyD;AAoBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACU,QAAA,yCAAyC,GAAG,IAAA,0BAAU,EACjE,8CAA8C,EAC9C,KAAK,WACH,EACE,KAAK,EACL,WAAW,EACX,KAAK,GAC0C,EACjD,OAAO;IAEP,IAAA,qCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,IAAA,gDAA6B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAA;IAE9C,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CACR,CAAA;IAEzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gDAAgD,KAAK,CAAC,QAAQ,oBAAoB,WAAW,CAAC,EAAE,EAAE,CACnG,CAAA;IACH,CAAC;SAAM,IAAI,gBAAgB,CAAC,MAAM,KAAK,wBAAgB,CAAC,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,UAAU,gBAAgB,CAAC,EAAE,0BAA0B,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC,CACF,CAAA;AAEY,QAAA,qCAAqC,GAChD,mCAAmC,CAAA;AACrC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,mCAAmC,GAAG,IAAA,8BAAc,EAC/D,6CAAqC,EACrC,UACE,KAA2E;IAE3E,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EA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,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CACR,CAAA;QAEzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,OAAO;YACL,EAAE,EAAE,KAAK,CAAC,SAAS;YACnB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,EAAE,QAAQ;aAC5D;YACD,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;IACH,CAAC,CACF,CAAA;IAED,IAAA,oCAA4B,EAAC,CAAC,UAAU,CAAC,CAAC,CAAA;IAE1C,sEAAoC,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE;YACL,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,IAAA,8BAAsB,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../../src/order/workflows/order-edit/utils/fields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../../src/order/workflows/order-edit/utils/fields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,UAepC,CAAA"}
|
|
@@ -7,9 +7,14 @@ exports.fieldsToRefreshOrderEdit = [
|
|
|
7
7
|
"version",
|
|
8
8
|
"currency_code",
|
|
9
9
|
"canceled_at",
|
|
10
|
+
"promotions.*",
|
|
11
|
+
"subtotal",
|
|
10
12
|
"items.*",
|
|
13
|
+
"items.subtotal",
|
|
11
14
|
"items.product.id",
|
|
12
|
-
"
|
|
15
|
+
"items.adjustments.*",
|
|
16
|
+
"shipping_methods.*",
|
|
17
|
+
"shipping_methods.adjustments.*",
|
|
13
18
|
"shipping_address.*",
|
|
14
19
|
];
|
|
15
20
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../src/order/workflows/order-edit/utils/fields.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG;IACtC,IAAI;IACJ,QAAQ;IACR,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,kBAAkB;IAClB,
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../src/order/workflows/order-edit/utils/fields.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG;IACtC,IAAI;IACJ,QAAQ;IACR,SAAS;IACT,eAAe;IACf,aAAa;IACb,cAAc;IACd,UAAU;IACV,SAAS;IACT,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,oBAAoB;IACpB,gCAAgC;IAChC,oBAAoB;CACrB,CAAA"}
|