@tallyui/pos 4.0.0 → 4.1.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/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +6 -6
- package/src/order/order-drafts.ts +1 -0
- package/src/order/types.ts +2 -0
- package/src/pos-order/reopen.ts +1 -1
- package/src/pos-order/types.ts +1 -1
- package/src/sale/use-sale.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -490,6 +490,8 @@ interface Payment {
|
|
|
490
490
|
storePaymentId?: string;
|
|
491
491
|
/** A leg the store already holds: never removed or moved, only sent back with its storePaymentId */
|
|
492
492
|
locked?: true;
|
|
493
|
+
/** A leg copied from a refused order when it was reopened (reopenRefusedOrder): its money was already taken, so tender keeps it. Draft-only: finalize drops it. */
|
|
494
|
+
reopened?: true;
|
|
493
495
|
method: string;
|
|
494
496
|
/** The payment method's own id on the platform, kept for labels and takings (`legMethodId`); `method` decides cash. */
|
|
495
497
|
methodId?: string;
|
|
@@ -1365,7 +1367,7 @@ interface PosOrder {
|
|
|
1365
1367
|
serverFailures?: PosOrderServerFailures;
|
|
1366
1368
|
error?: CommandError;
|
|
1367
1369
|
updatedAt: string;
|
|
1368
|
-
/** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention
|
|
1370
|
+
/** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention keeps it until its finalized successor is in the list (`replacedOrderIds`), and it stays as the record of the refusal. */
|
|
1369
1371
|
reopenedAt?: string;
|
|
1370
1372
|
/** The commandId whose refusal the cashier marked handled (tally-woo 03, ADR-092 6f); the logic comes in a later PR. */
|
|
1371
1373
|
attentionHandledFor?: string;
|
package/dist/index.js
CHANGED
|
@@ -2218,6 +2218,7 @@ function restoreOrderDraft(saved, options) {
|
|
|
2218
2218
|
...payment.status !== void 0 ? { status: payment.status } : {},
|
|
2219
2219
|
...payment.storePaymentId !== void 0 ? { storePaymentId: payment.storePaymentId } : {},
|
|
2220
2220
|
...payment.locked !== void 0 ? { locked: payment.locked } : {},
|
|
2221
|
+
...payment.reopened !== void 0 ? { reopened: payment.reopened } : {},
|
|
2221
2222
|
...payment.methodId !== void 0 ? { methodId: payment.methodId } : {},
|
|
2222
2223
|
...payment.units !== void 0 ? { units: payment.units } : {}
|
|
2223
2224
|
});
|
|
@@ -9379,6 +9380,7 @@ async function reopenRefusedOrder(orderId, deps, options) {
|
|
|
9379
9380
|
...afterClose ? { id: payment.id } : {},
|
|
9380
9381
|
method: payment.method,
|
|
9381
9382
|
amountMinor: payment.amountMinor,
|
|
9383
|
+
reopened: true,
|
|
9382
9384
|
...payment.reference !== void 0 ? { reference: payment.reference } : {},
|
|
9383
9385
|
...payment.methodId !== void 0 ? { methodId: payment.methodId } : {}
|
|
9384
9386
|
});
|
|
@@ -12057,7 +12059,7 @@ function useSale(settings, opts) {
|
|
|
12057
12059
|
return !!builderNow.current.getSnapshot().afterClose?.payments.some((leg) => leg.id === p.id);
|
|
12058
12060
|
}
|
|
12059
12061
|
function heldLeg(p) {
|
|
12060
|
-
return !!p.locked || countedLeg(p) || keptCodes() && isLiveLeg(p) && keptLegIds.current.includes(p.id);
|
|
12062
|
+
return !!p.locked || !!p.reopened || countedLeg(p) || keptCodes() && isLiveLeg(p) && keptLegIds.current.includes(p.id);
|
|
12061
12063
|
}
|
|
12062
12064
|
function reprice() {
|
|
12063
12065
|
if (repricing.current) return repricing.current;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/pos",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared POS business logic for Tally UI — tax, orders, payments, discounts, receipts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"mustache": "^4.2.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@tallyui/core": "^4.
|
|
37
|
+
"@tallyui/core": "^4.1.0",
|
|
38
38
|
"react": ">=18",
|
|
39
39
|
"rxdb": "~17.5.0",
|
|
40
40
|
"rxjs": ">=7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@tallyui/core": "4.
|
|
43
|
+
"@tallyui/core": "4.1.0",
|
|
44
44
|
"@types/react": ">=18",
|
|
45
45
|
"react": "^19.2.4",
|
|
46
46
|
"rxdb": "17.5.0",
|
|
47
47
|
"rxjs": "7.8.2",
|
|
48
|
-
"@tallyui/connector-medusa": "4.
|
|
49
|
-
"@tallyui/connector-woocommerce": "4.
|
|
50
|
-
"@tallyui/database": "4.
|
|
48
|
+
"@tallyui/connector-medusa": "4.1.0",
|
|
49
|
+
"@tallyui/connector-woocommerce": "4.1.0",
|
|
50
|
+
"@tallyui/database": "4.1.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsup",
|
|
@@ -147,6 +147,7 @@ export function restoreOrderDraft(saved: Order, options: { currency: string; tax
|
|
|
147
147
|
...(payment.status !== undefined ? { status: payment.status } : {}),
|
|
148
148
|
...(payment.storePaymentId !== undefined ? { storePaymentId: payment.storePaymentId } : {}),
|
|
149
149
|
...(payment.locked !== undefined ? { locked: payment.locked } : {}),
|
|
150
|
+
...(payment.reopened !== undefined ? { reopened: payment.reopened } : {}),
|
|
150
151
|
...(payment.methodId !== undefined ? { methodId: payment.methodId } : {}),
|
|
151
152
|
...(payment.units !== undefined ? { units: payment.units } : {}),
|
|
152
153
|
});
|
package/src/order/types.ts
CHANGED
|
@@ -179,6 +179,8 @@ export interface Payment {
|
|
|
179
179
|
storePaymentId?: string;
|
|
180
180
|
/** A leg the store already holds: never removed or moved, only sent back with its storePaymentId */
|
|
181
181
|
locked?: true;
|
|
182
|
+
/** A leg copied from a refused order when it was reopened (reopenRefusedOrder): its money was already taken, so tender keeps it. Draft-only: finalize drops it. */
|
|
183
|
+
reopened?: true;
|
|
182
184
|
method: string;
|
|
183
185
|
/** The payment method's own id on the platform, kept for labels and takings (`legMethodId`); `method` decides cash. */
|
|
184
186
|
methodId?: string;
|
package/src/pos-order/reopen.ts
CHANGED
|
@@ -125,7 +125,7 @@ export async function reopenRefusedOrder(orderId: string, deps: {
|
|
|
125
125
|
});
|
|
126
126
|
for (const payment of order.payments) builder.addPayment({
|
|
127
127
|
// After close each leg keeps the refused order's id, so finalize knows it for the leg that closure counted.
|
|
128
|
-
...(afterClose ? { id: payment.id } : {}), method: payment.method, amountMinor: payment.amountMinor,
|
|
128
|
+
...(afterClose ? { id: payment.id } : {}), method: payment.method, amountMinor: payment.amountMinor, reopened: true,
|
|
129
129
|
...(payment.reference !== undefined ? { reference: payment.reference } : {}),
|
|
130
130
|
...(payment.methodId !== undefined ? { methodId: payment.methodId } : {}),
|
|
131
131
|
});
|
package/src/pos-order/types.ts
CHANGED
|
@@ -154,7 +154,7 @@ export interface PosOrder {
|
|
|
154
154
|
serverFailures?: PosOrderServerFailures;
|
|
155
155
|
error?: CommandError;
|
|
156
156
|
updatedAt: string;
|
|
157
|
-
/** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention
|
|
157
|
+
/** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention keeps it until its finalized successor is in the list (`replacedOrderIds`), and it stays as the record of the refusal. */
|
|
158
158
|
reopenedAt?: string;
|
|
159
159
|
/** The commandId whose refusal the cashier marked handled (tally-woo 03, ADR-092 6f); the logic comes in a later PR. */
|
|
160
160
|
attentionHandledFor?: string;
|
package/src/sale/use-sale.ts
CHANGED
|
@@ -250,7 +250,7 @@ export function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscount
|
|
|
250
250
|
const keptLegIds = useRef<readonly string[]>([]); // the kept draft's parked live legs, held while KEPT placeholders hold
|
|
251
251
|
// An after-close sale's closure counted these legs, and finalize refuses any change to them: they are held like a locked leg.
|
|
252
252
|
function countedLeg(p: { id: string }) { return !!builderNow.current.getSnapshot().afterClose?.payments.some((leg) => leg.id === p.id); }
|
|
253
|
-
function heldLeg(p: Order['payments'][number]) { return !!p.locked || countedLeg(p) || (keptCodes() && isLiveLeg(p) && keptLegIds.current.includes(p.id)); }
|
|
253
|
+
function heldLeg(p: Order['payments'][number]) { return !!p.locked || !!p.reopened || countedLeg(p) || (keptCodes() && isLiveLeg(p) && keptLegIds.current.includes(p.id)); }
|
|
254
254
|
/** Prices the accepted codes again, as resume() checks them, on the live builder; resolves to the error it set, or null. */
|
|
255
255
|
function reprice(): Promise<string | null> {
|
|
256
256
|
if (repricing.current) return repricing.current;
|