@final-commerce/command-frame 0.5.0-preprod.8 → 0.5.0-preprod.9

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.
@@ -1,6 +1,29 @@
1
1
  export interface GetRefundPlanParams {
2
2
  /** Order to inspect; defaults to the active order. */
3
3
  orderId?: string;
4
+ /**
5
+ * The selection to allocate — the SAME array you will pass to
6
+ * `processPartialRefund({ items })`, so the plan you render and the refund
7
+ * you submit are computed from one input.
8
+ *
9
+ * A flow that owns its own refund UI holds the selection in its own state and
10
+ * never stages it on the POS, so without this there is nothing for the engine
11
+ * to allocate. Pass it here on every selection change to get the matching
12
+ * {@link RefundPlanAllocation} back. **Purely a read** — unlike
13
+ * `processPartialRefund`, this never stages the selection or touches POS
14
+ * state, so it is safe to call as the cashier ticks rows.
15
+ *
16
+ * Omit it to fall back to the selection already staged on the POS (what
17
+ * `selectAllRefundItems` sets) — the in-POS modal's path. Omitted with
18
+ * nothing staged, no `allocation` comes back.
19
+ */
20
+ items?: {
21
+ /** `internalId` / `variantId` for a product, `customSaleId`, cart-fee id, or tip `transactionId`. */
22
+ itemKey: string;
23
+ quantity: number;
24
+ /** Optional hint; inferred from the order when omitted. */
25
+ type?: 'product' | 'customSale' | 'fee' | 'tip';
26
+ }[];
4
27
  }
5
28
  export interface RefundPlanSource {
6
29
  transactionId: string;
@@ -47,9 +70,10 @@ export interface RefundPlanLeg {
47
70
  * order's captures — what a flow renders and submits instead of computing a
48
71
  * split of its own.
49
72
  *
50
- * Present only when a refund selection exists on the ACTIVE order (i.e. after
51
- * `selectAllRefundItems` / `setRefundItemQuantity`); omitted for a pure
52
- * capacity read of some other order.
73
+ * Present when the call carries a selection: either `params.items` (a flow
74
+ * holding its own selection — the usual case) or a selection already staged on
75
+ * the POS for the active order (`selectAllRefundItems`). Omitted for a bare
76
+ * capacity read with neither.
53
77
  */
54
78
  export interface RefundPlanAllocation {
55
79
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.5.0-preprod.8",
3
+ "version": "0.5.0-preprod.9",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",