@final-commerce/command-frame 0.6.0-staging.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ The library provides three main capabilities:
|
|
|
18
18
|
|
|
19
19
|
Domain models (orders, cart, customers, products, and related types) are documented in **[Types reference](./src/types/README.md)**.
|
|
20
20
|
|
|
21
|
+
The order lifecycle — payment × fulfillment state pairs, display labels, the transition guard chain, and the financial invariants — is documented in **[Order state machine reference](./docs/order-state-machine.md)**. Read it before building anything that reads or moves order state (`canTransition`, `getAvailableTransitions`, `applyTransition`, park/void/resume, payments, refunds).
|
|
22
|
+
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
23
25
|
### From npm (public registry)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AddProductDiscountParams } from
|
|
2
|
-
import type { AddProductFeeParams } from
|
|
1
|
+
import type { AddProductDiscountParams } from '../add-product-discount/types';
|
|
2
|
+
import type { AddProductFeeParams } from '../add-product-fee/types';
|
|
3
3
|
export interface AddProductToCartParams {
|
|
4
4
|
/** ID of the variant to add. */
|
|
5
5
|
variantId: string;
|
|
@@ -2,7 +2,12 @@ import type { GetAvailableTransitions } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Mock implementation: returns a fixed set of plausible transitions
|
|
4
4
|
* so the demo app has data to render. Mirrors an UNPAID order under the
|
|
5
|
-
* default (empty cross-axis rules) config
|
|
6
|
-
*
|
|
5
|
+
* default (empty cross-axis rules) config.
|
|
6
|
+
*
|
|
7
|
+
* FULFILLMENT-AXIS ONLY (common 2.1.4 contract): the payment axis never
|
|
8
|
+
* appears as an available transition — it moves exclusively through the
|
|
9
|
+
* money operations (pay / refund / void), which derive their own landing
|
|
10
|
+
* pairs. Every row keeps `to.payment` equal to the order's current payment
|
|
11
|
+
* state, exactly like the host's `getAvailableTransitions`.
|
|
7
12
|
*/
|
|
8
13
|
export declare const getAvailableTransitionsMock: GetAvailableTransitions;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mock implementation: returns a fixed set of plausible transitions
|
|
3
3
|
* so the demo app has data to render. Mirrors an UNPAID order under the
|
|
4
|
-
* default (empty cross-axis rules) config
|
|
5
|
-
*
|
|
4
|
+
* default (empty cross-axis rules) config.
|
|
5
|
+
*
|
|
6
|
+
* FULFILLMENT-AXIS ONLY (common 2.1.4 contract): the payment axis never
|
|
7
|
+
* appears as an available transition — it moves exclusively through the
|
|
8
|
+
* money operations (pay / refund / void), which derive their own landing
|
|
9
|
+
* pairs. Every row keeps `to.payment` equal to the order's current payment
|
|
10
|
+
* state, exactly like the host's `getAvailableTransitions`.
|
|
6
11
|
*/
|
|
7
12
|
export const getAvailableTransitionsMock = () => Promise.resolve({
|
|
8
13
|
transitions: [
|
|
@@ -22,13 +27,8 @@ export const getAvailableTransitionsMock = () => Promise.resolve({
|
|
|
22
27
|
conditions: [{ met: true, description: 'Order is open' }],
|
|
23
28
|
},
|
|
24
29
|
{
|
|
25
|
-
to: { payment: '
|
|
26
|
-
displayLabel: '
|
|
27
|
-
conditions: [{ met: true, description: 'Balance due > 0' }],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
to: { payment: 'voided', fulfillment: 'cancelled' },
|
|
31
|
-
displayLabel: 'Void Order',
|
|
30
|
+
to: { payment: 'unpaid', fulfillment: 'cancelled' },
|
|
31
|
+
displayLabel: 'Cancel Order',
|
|
32
32
|
conditions: [
|
|
33
33
|
{ met: true, description: 'Order exists' },
|
|
34
34
|
{ met: false, description: 'No payments captured (mock: skipped)' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/command-frame",
|
|
3
|
-
"version": "0.6.0
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Commands Frame library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ignoreBranchesMissingTickets": true
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@final-commerce/common": "2.2.0
|
|
60
|
+
"@final-commerce/common": "2.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^19.0.0",
|