@tallyui/pos 4.2.0 → 5.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 +620 -166
- package/dist/index.js +1970 -1091
- package/package.json +7 -6
- package/src/index.ts +15 -12
- package/src/order/index.ts +1 -0
- package/src/order/order-builder.ts +64 -22
- package/src/order/order-drafts.ts +77 -25
- package/src/order/types.ts +9 -2
- package/src/order/woocommerce-tax.ts +9 -12
- package/src/outbox/http-transport.ts +16 -1
- package/src/outbox/index.ts +3 -1
- package/src/outbox/needs-admin-reason.ts +10 -0
- package/src/outbox/order-outbox.ts +27 -11
- package/src/outbox/register-outbox.ts +4 -3
- package/src/outbox/store-settlement.ts +136 -0
- package/src/outbox/types.ts +3 -1
- package/src/outbox/use-order-outbox.ts +54 -4
- package/src/pos-order/attention-handled.ts +2 -0
- package/src/pos-order/command.ts +31 -9
- package/src/pos-order/finalize.ts +9 -0
- package/src/pos-order/index.ts +3 -1
- package/src/pos-order/needs-attention.ts +8 -3
- package/src/pos-order/reopen.ts +9 -2
- package/src/pos-order/schema.ts +20 -2
- package/src/pos-order/store-order-left.ts +21 -0
- package/src/pos-order/store-settlement.ts +51 -0
- package/src/pos-order/types.ts +27 -1
- package/src/receipt/build-receipt-data.ts +8 -1
- package/src/receipt/reprint.ts +2 -0
- package/src/receipt/types.ts +2 -0
- package/src/receipt-template/template-data.ts +1 -1
- package/src/receipt-template/wcpos/from-orders.ts +5 -1
- package/src/refund/index.ts +1 -0
- package/src/refund/needs-admin-line.ts +6 -0
- package/src/refund/refundable-lines.ts +2 -91
- package/src/refund/send-order-refund.ts +6 -1
- package/src/refund/submit-order-refund.ts +33 -1
- package/src/register/closing.ts +15 -0
- package/src/register/closure-document.ts +13 -5
- package/src/register/closure-figures.ts +83 -0
- package/src/register/document-labels.ts +5 -3
- package/src/register/expected.ts +30 -9
- package/src/register/index.ts +3 -1
- package/src/register/register-adoption.ts +42 -4
- package/src/register/register-document.ts +17 -0
- package/src/register/session-store.ts +48 -12
- package/src/register/use-register-session.ts +53 -20
- package/src/reports/adapters.ts +5 -1
- package/src/reports/index.ts +1 -1
- package/src/reports/sales-figures.ts +33 -6
- package/src/reports/types.ts +3 -1
- package/src/sale/index.ts +1 -1
- package/src/sale/use-sale.ts +320 -134
- package/src/store-orders/index.ts +3 -0
- package/src/store-orders/sales-range-query.ts +18 -0
- package/src/store-orders/use-store-refunds-in-range.ts +179 -0
- package/src/tax/exact.ts +2 -10
- package/src/tender/cash-rounding.ts +57 -6
- package/src/tender/index.ts +1 -1
- package/src/tender/payment-legs.ts +5 -0
- package/src/tender/tender-figures.ts +3 -1
- package/src/outbox/types.test-d.ts +0 -27
- package/src/print/escpos/sinks.test-d.ts +0 -77
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { MoneyFormat, Money, TaxRounding, StoreSettings, woocommerceTax, PaymentMethodDescriptor, CustomerAddress, CustomerTaxId, OrderCreateMeta, TallyConnector, SyncContext, StoreSettingsChoice, StoreSettingsChoices, Cashier, CashierPermission, ProductTraits, woocommerceCoupons, StoreOrder, ListOrdersQuery, OrderCreateLine, PaymentMethodKind, OrderAddress, CommandServerRefs, CommandWarning, CommandError, ReceiptTemplate, ServerCapabilities, OrderCreateEnvelope, OrderUpdateEnvelope, OrderRefundEnvelope, OrderRefundResult, Correction, RegisterInfo, RegisterCommandType, RegisterCommandResult, RegisterSessionTransitionPayload, CommandResult, AnyCommandEnvelope, CommandEnvelope, OrderCreatePayload, VariantSummary, TraitContext, IceServer, SignalMessage, DisplaySignalling, DisplaySignallingContext, DisplayAdvertisement, TillDevice, DisplayRecord, PendingPairing, CustomerInput, Customer, CustomerPatch, ProductCategory, ProductTerm, VariantOptionGroup,
|
|
4
|
-
export { Correction, MoneyFormat as CurrencyFormat, getProductStock, ratePpmFromPercent, withStockOverlay } from '@tallyui/core';
|
|
3
|
+
import { MoneyFormat, Money, RoundingMode, TaxRounding, StoreSettings, woocommerceTax, PaymentMethodDescriptor, CustomerAddress, CustomerTaxId, OrderCreateMeta, TallyConnector, SyncContext, StoreSettingsChoice, StoreSettingsChoices, Cashier, CashierPermission, ProductTraits, woocommerceCoupons, StoreOrder, ListOrdersQuery, OrderFilterField, StoreRefundOrphan, StoreRefund, OrderCreateLine, PaymentMethodKind, OrderAddress, CommandServerRefs, CommandWarning, CommandError, ReceiptTemplate, ServerCapabilities, OrderCreateEnvelope, OrderUpdateEnvelope, OrderRefundEnvelope, OrderRefundResult, Correction, RegisterInfo, RegisterCommandType, RegisterCommandResult, RegisterSessionTransitionPayload, CommandResult, AnyCommandEnvelope, CommandEnvelope, OrderCreatePayload, VariantSummary, TraitContext, PaymentRounding, IceServer, SignalMessage, DisplaySignalling, DisplaySignallingContext, DisplayAdvertisement, TillDevice, DisplayRecord, PendingPairing, CustomerInput, Customer, CustomerPatch, ProductCategory, ProductTerm, VariantOptionGroup, SettleCancelRequest, SettleOutcome, SettlePayRequest, SettlePayResult, RegisterCommandEnvelope, OrderReopenResult, OrderReopenEnvelope, StoreOrderLine } from '@tallyui/core';
|
|
4
|
+
export { Correction, MoneyFormat as CurrencyFormat, EarlierRefund, PricedRefund, PricedRefundLine, RefundableLine, RefundableOrderLine, getProductStock, priceRefund, ratePpmFromPercent, refundableLines, withStockOverlay } from '@tallyui/core';
|
|
5
5
|
import * as rxdb from 'rxdb';
|
|
6
6
|
import { RxCollection, RxJsonSchema, MangoQuery, MigrationStrategies, RxDatabase, RxLocalDocumentMutation } from 'rxdb';
|
|
7
7
|
import * as rxjs from 'rxjs';
|
|
@@ -152,8 +152,6 @@ declare const MICROS_PER_MINOR = 1000000n;
|
|
|
152
152
|
* Throws RangeError unless amount and rate are safe integers and rate is non-negative.
|
|
153
153
|
*/
|
|
154
154
|
declare function taxMicros(amountMinor: number, ratePpm: number, pricesIncludeTax: boolean): bigint;
|
|
155
|
-
/** #287: `half_up` is Math.round's rule, Vendure's DefaultMoneyStrategy (default-money-strategy.js:19-21). */
|
|
156
|
-
type RoundingMode = 'half_away_from_zero' | 'half_up';
|
|
157
155
|
/** Rounds micro-minor-units to integer minor units, half away from zero unless `mode` says otherwise. */
|
|
158
156
|
declare function roundMicrosToMinor(micros: bigint, mode?: RoundingMode): number;
|
|
159
157
|
interface TaxLineInput {
|
|
@@ -331,6 +329,8 @@ interface Order {
|
|
|
331
329
|
/** TallyUI#709: present (true) only when store-priced coupons are set and couponPricingBasis(order) no longer equals their basis. */
|
|
332
330
|
couponPricesStale?: true;
|
|
333
331
|
payments: Payment[];
|
|
332
|
+
/** ADR-094: a cash leg that settles the sale at a rounded due records the signed difference here, counted in totalMinor; only entries whose leg counts toward paid are built in. Absent when empty. */
|
|
333
|
+
cashRoundings?: CashRounding[];
|
|
334
334
|
customer: CustomerSummary | null;
|
|
335
335
|
note: string;
|
|
336
336
|
/** The sale's order meta, WooCommerce's custom fields (ADR-092 6d). Set with `useSale().setMeta`, parked with the draft,
|
|
@@ -484,6 +484,11 @@ interface AppliedDiscount extends Discount {
|
|
|
484
484
|
id: string;
|
|
485
485
|
amountMinor: number;
|
|
486
486
|
}
|
|
487
|
+
/** ADR-094: one cash rounding, the signed minor units its leg (`paymentId`) settled the sale above (+) or below (-) its due. */
|
|
488
|
+
interface CashRounding {
|
|
489
|
+
paymentId: string;
|
|
490
|
+
minor: number;
|
|
491
|
+
}
|
|
487
492
|
interface Payment {
|
|
488
493
|
id: string;
|
|
489
494
|
/** The store's payment record id for a leg it already holds */
|
|
@@ -505,6 +510,8 @@ interface Payment {
|
|
|
505
510
|
units?: Readonly<Record<string, number>>;
|
|
506
511
|
/** When the till recorded the leg (an ISO 8601 instant). Absent on store-held legs and on legs from before 4.2. */
|
|
507
512
|
takenAt?: string;
|
|
513
|
+
/** The register session the leg was taken in (money suspect S3): its cash counts there, not in the order's session. */
|
|
514
|
+
sessionId?: string;
|
|
508
515
|
}
|
|
509
516
|
interface CustomerSummary {
|
|
510
517
|
id: string;
|
|
@@ -938,6 +945,11 @@ interface OrderBuilderOptions {
|
|
|
938
945
|
storeOrder?: StoreOrderRef;
|
|
939
946
|
afterClose?: Order['afterClose'];
|
|
940
947
|
couponContext?: OrderCouponContext;
|
|
948
|
+
/** A restored paid draft's parked tax lines by line, fee or shipping id (row 497); held only while one of `legIds` is captured or moving. */
|
|
949
|
+
heldRates?: {
|
|
950
|
+
legIds: readonly string[];
|
|
951
|
+
taxLines: ReadonlyMap<string, readonly LineTaxLine[]>;
|
|
952
|
+
};
|
|
941
953
|
}
|
|
942
954
|
interface OrderBuilder {
|
|
943
955
|
order$: Observable<Order>;
|
|
@@ -984,11 +996,19 @@ interface OrderBuilder {
|
|
|
984
996
|
applyLineDiscount(lineId: string, discount: Discount): void;
|
|
985
997
|
applyOrderDiscount(discount: Discount): void;
|
|
986
998
|
removeDiscount(discountId: string): void;
|
|
999
|
+
/** ADR-094: `rounding` adds the leg's cash rounding entry with it, so no snapshot shows the leg without it (none when `minor` is 0). */
|
|
987
1000
|
addPayment(payment: Omit<Payment, 'id'> & {
|
|
988
1001
|
id?: string;
|
|
1002
|
+
}, rounding?: {
|
|
1003
|
+
minor: number;
|
|
989
1004
|
}): string;
|
|
990
|
-
/**
|
|
991
|
-
|
|
1005
|
+
/** ADR-094: adds a cash rounding entry against an existing leg; it counts in totalMinor while that leg counts toward paid. */
|
|
1006
|
+
addCashRounding(entry: CashRounding): void;
|
|
1007
|
+
/**
|
|
1008
|
+
* Moves a leg's status; `takenAt` is set on the leg only on a move to captured, and `sessionId` with it (S3: the
|
|
1009
|
+
* session that captured the leg), only on a leg that has none yet.
|
|
1010
|
+
*/
|
|
1011
|
+
setPaymentStatus(paymentId: string, status: PaymentLegStatus, takenAt?: string, sessionId?: string): boolean;
|
|
992
1012
|
removePayment(paymentId: string): void;
|
|
993
1013
|
setCustomer(customer: CustomerSummary | null): void;
|
|
994
1014
|
setNote(note: string): void;
|
|
@@ -1059,9 +1079,11 @@ interface ParkedOrderSummary {
|
|
|
1059
1079
|
}
|
|
1060
1080
|
declare function writeOrderDraft(drafts: RxCollection, snapshot: Order): Promise<string>;
|
|
1061
1081
|
/**
|
|
1062
|
-
* Rebuilds a saved order on `taxContext`.
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1082
|
+
* Rebuilds a saved order on `taxContext`. Outside woo, a line marked taxFromClass re-derives from its class unless
|
|
1083
|
+
* `keepTaxRates` is set; every other line (given rates, a draft from before the marker) keeps its stored rates. Fees and
|
|
1084
|
+
* shipping, and under woo lines too, re-derive today's rates, except with `keepTaxRates` (row 497): then they hold their
|
|
1085
|
+
* parked tax lines (under woo, only those with every rate id), and the hold ends at the next build once no parked leg
|
|
1086
|
+
* is still captured or in motion. Granularity must match the draft's. `keepCoupons` puts the saved
|
|
1065
1087
|
* coupons back as parked, figures and all, while an unlocked leg is live (ADR-077 d3, amended 2026-11-19); otherwise none.
|
|
1066
1088
|
* Carried coupons always restore their priced amounts against the saved basis, keeping stale figures stale.
|
|
1067
1089
|
*/
|
|
@@ -1130,6 +1152,160 @@ type StoreOrdersRangeQuery = Omit<ListOrdersQuery, 'page' | 'perPage'>;
|
|
|
1130
1152
|
*/
|
|
1131
1153
|
declare function useStoreOrdersInRange(connector: TallyConnector | null, context: SyncContext | null, query: StoreOrdersRangeQuery | null): StoreOrdersInRange;
|
|
1132
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* The read for a sales report over `[after, before)`: UTC instants with a `Z`, such as `orderFiltersQuery` gives for
|
|
1157
|
+
* store days. When the connector lists `modifiedAfter`, the read is widened to orders changed at or after `after` and
|
|
1158
|
+
* created before `before`, so an order created earlier and paid in the range is fetched. `reportOrderFromStoreOrder`
|
|
1159
|
+
* then places each order on its paid day, and the report's own range test drops one paid outside the range.
|
|
1160
|
+
* Otherwise the read is by creation date.
|
|
1161
|
+
*/
|
|
1162
|
+
declare function salesRangeQuery(range: {
|
|
1163
|
+
after: string;
|
|
1164
|
+
before: string;
|
|
1165
|
+
}, orderFilters: readonly OrderFilterField[] | undefined): StoreOrdersRangeQuery;
|
|
1166
|
+
|
|
1167
|
+
/** A store day, `yyyy-MM-dd` in the store's timezone. */
|
|
1168
|
+
type StoreDay = string;
|
|
1169
|
+
/** Inclusive range of store days. */
|
|
1170
|
+
interface DayRange {
|
|
1171
|
+
from: StoreDay;
|
|
1172
|
+
to: StoreDay;
|
|
1173
|
+
}
|
|
1174
|
+
interface ReportCategory {
|
|
1175
|
+
id: string;
|
|
1176
|
+
name: string;
|
|
1177
|
+
}
|
|
1178
|
+
interface ReportLine {
|
|
1179
|
+
/** Grouping identity: variant, else product, else name. */
|
|
1180
|
+
key: string;
|
|
1181
|
+
name: string;
|
|
1182
|
+
quantity: number;
|
|
1183
|
+
/** After discounts, excluding tax. */
|
|
1184
|
+
netMinor: number;
|
|
1185
|
+
taxMinor: number;
|
|
1186
|
+
/** Cost of goods for the whole line (quantity × unit cost). Absent or null means the cost is missing, never 0. */
|
|
1187
|
+
costMinor?: number | null;
|
|
1188
|
+
/** The line's first category, when the caller joined one. */
|
|
1189
|
+
category?: ReportCategory;
|
|
1190
|
+
}
|
|
1191
|
+
interface ReportPayment {
|
|
1192
|
+
method: string;
|
|
1193
|
+
label?: string;
|
|
1194
|
+
amountMinor: number;
|
|
1195
|
+
}
|
|
1196
|
+
interface ReportTax {
|
|
1197
|
+
ratePpm: number;
|
|
1198
|
+
code?: string;
|
|
1199
|
+
label: string;
|
|
1200
|
+
taxMinor: number;
|
|
1201
|
+
/** The net this rate taxed; null when the source does not carry it. */
|
|
1202
|
+
netMinor: number | null;
|
|
1203
|
+
}
|
|
1204
|
+
/** An order as the reports read it. Money in integer minor units. */
|
|
1205
|
+
interface ReportOrder {
|
|
1206
|
+
id: string;
|
|
1207
|
+
/** ISO 8601 UTC instant the sale was made. */
|
|
1208
|
+
at: string;
|
|
1209
|
+
/** Gross, including tax. */
|
|
1210
|
+
totalMinor: number;
|
|
1211
|
+
taxMinor: number;
|
|
1212
|
+
discountMinor: number;
|
|
1213
|
+
/** True when the order still owes money: its unpaid remainder is `unpaid`, not `unknown`. */
|
|
1214
|
+
needsPayment?: boolean;
|
|
1215
|
+
lines: ReportLine[];
|
|
1216
|
+
payments: ReportPayment[];
|
|
1217
|
+
/** A reopened sale's payments the store already held (its locked legs): not this till's takings, but they settle the total. */
|
|
1218
|
+
paidEarlierMinor?: number;
|
|
1219
|
+
taxes: ReportTax[];
|
|
1220
|
+
/** Refunds embedded on the order, undated (a store order's own list). Positive. */
|
|
1221
|
+
refunds: Array<{
|
|
1222
|
+
id: string;
|
|
1223
|
+
amountMinor: number;
|
|
1224
|
+
}>;
|
|
1225
|
+
/** Σ the order's cash roundings, signed (ADR-094); absent when none. Always absent on a store-sourced order: its rounding is a plain fee, kept inside net (#1282). */
|
|
1226
|
+
roundingMinor?: number;
|
|
1227
|
+
}
|
|
1228
|
+
/** A refund dated by when it was made, counted on that store day. */
|
|
1229
|
+
interface ReportRefund {
|
|
1230
|
+
id: string;
|
|
1231
|
+
orderId: string;
|
|
1232
|
+
/** ISO 8601 UTC instant the refund was made. */
|
|
1233
|
+
at: string;
|
|
1234
|
+
/** Zero or more. Gross, tax included. */
|
|
1235
|
+
amountMinor: number;
|
|
1236
|
+
}
|
|
1237
|
+
/** The caller's product directory: a line's unit cost and first category. */
|
|
1238
|
+
type LineJoin = (line: {
|
|
1239
|
+
productId?: string;
|
|
1240
|
+
variantId?: string;
|
|
1241
|
+
}) => {
|
|
1242
|
+
unitCostMinor?: number | null;
|
|
1243
|
+
category?: ReportCategory;
|
|
1244
|
+
} | undefined;
|
|
1245
|
+
|
|
1246
|
+
interface StoreRefundsRangeQuery {
|
|
1247
|
+
/** The report's store days, inclusive. */
|
|
1248
|
+
range: DayRange;
|
|
1249
|
+
/** IANA zone of the store, or 'device' (as SalesFiguresInput.timezone). */
|
|
1250
|
+
timezone: string;
|
|
1251
|
+
/** The report's currency (StoreOrder.currency). A refund in any other currency is never counted. */
|
|
1252
|
+
currency: string;
|
|
1253
|
+
/** Set fields restrict the report; a refund counts only when its order carries the same value for every set field. */
|
|
1254
|
+
scope?: {
|
|
1255
|
+
storeId?: string;
|
|
1256
|
+
cashierId?: string;
|
|
1257
|
+
registerId?: string;
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
interface OtherCurrencyRefunds {
|
|
1261
|
+
currency: string;
|
|
1262
|
+
count: number;
|
|
1263
|
+
amountMinor: number;
|
|
1264
|
+
}
|
|
1265
|
+
interface StoreRefundsInRange {
|
|
1266
|
+
/** The counted refunds as report rows. undefined when the store has no dated refunds: the report then uses its orders' embedded refunds. */
|
|
1267
|
+
refunds: ReportRefund[] | undefined;
|
|
1268
|
+
orphans: StoreRefundOrphan[];
|
|
1269
|
+
unreadable: number;
|
|
1270
|
+
unscoped: StoreRefund[];
|
|
1271
|
+
otherCurrency: OtherCurrencyRefunds[];
|
|
1272
|
+
progress: OrderDownloadProgress | null;
|
|
1273
|
+
error: unknown | null;
|
|
1274
|
+
complete: boolean;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Every refund a store made in the report's store days, read online page by page from `listRefunds` (ADR-081
|
|
1278
|
+
* decision 7), as `useStoreOrdersInRange` reads orders (decision 6). Nothing is stored or cached.
|
|
1279
|
+
*
|
|
1280
|
+
* - Idle (`refunds: undefined`, `complete: false`, nothing called) without `connector`, `context` or `query`.
|
|
1281
|
+
* - No `connector.listRefunds`, or a page rejecting with `StoreRefundsUnsupportedError`: `refunds: undefined`,
|
|
1282
|
+
* `complete: true`, so `salesFigures` uses the orders' embedded refunds.
|
|
1283
|
+
* - The read's `dateRange` is the store days' UTC bounds (`orderFiltersQuery`). While reading, `progress` is
|
|
1284
|
+
* `{ downloaded, total }`: distinct refund and orphan ids plus `unreadable`, and page 1's `total` or `null`.
|
|
1285
|
+
* - One id set covers refunds and orphans; the first copy stays. `unreadable` sums page 1's and each later page's
|
|
1286
|
+
* that adds a new id. A `hasMore: true` page that adds no new id stops the read with an `Error`.
|
|
1287
|
+
* - Each fresh refund is sorted into exactly one place, so none is in two of `refunds`, `unscoped`, `otherCurrency`
|
|
1288
|
+
* and `orphans`. With a set `scope` field, each page's not-yet-asked orders are fetched with one `getOrders` call:
|
|
1289
|
+
* an order not returned (or no `getOrders`) makes the refund `unscoped`; an order with a different value in any set
|
|
1290
|
+
* field puts it outside the report, in no list; else an order missing a set field makes it `unscoped`. Then a
|
|
1291
|
+
* refund in `query.currency` is counted in `refunds`, in the store's order; any other goes to `otherCurrency`, one
|
|
1292
|
+
* row per currency, sorted by code. `orphans` are kept as they come. Only `refunds` is ever summed.
|
|
1293
|
+
* - A page with `hasMore: false`, its orders resolved, finishes: `complete: true`, `progress: null`. Any other
|
|
1294
|
+
* rejection, from `listRefunds` or `getOrders`, stops the read: `error` is it, `progress` is `null`, what was
|
|
1295
|
+
* counted stays.
|
|
1296
|
+
* - Pass `refunds` to `salesFigures` only once `complete` is `true`. While `progress` is set the list is partial.
|
|
1297
|
+
* After an `error` it is partial and `complete` stays `false`: the report shows the error and gives no refund
|
|
1298
|
+
* figure. It does not fall back to the embedded basis, so it never passes `undefined` for a failed read. With a
|
|
1299
|
+
* report `compare` period, `query.range` spans both periods. `unscoped`, `otherCurrency`, `orphans` and
|
|
1300
|
+
* `unreadable` then count the whole read, not each period.
|
|
1301
|
+
* - A `query` that differs by value, or a new `connector` or `context`, abandons the read and starts again from
|
|
1302
|
+
* page 1, showing none of the old rows; an equal new object changes nothing. Unmounting abandons the read.
|
|
1303
|
+
*
|
|
1304
|
+
* Offset paging over a live store can repeat a row, which is dropped, or push a row past a page boundary mid-read,
|
|
1305
|
+
* which is then missed until the next read.
|
|
1306
|
+
*/
|
|
1307
|
+
declare function useStoreRefundsInRange(connector: TallyConnector | null, context: SyncContext | null, query: StoreRefundsRangeQuery | null): StoreRefundsInRange;
|
|
1308
|
+
|
|
1133
1309
|
/** WCPOS receipt data schema version these blocks follow (wiki: fiscal groundwork, receipt identity and QR §2). */
|
|
1134
1310
|
declare const RECEIPT_SCHEMA_VERSION = "1.4.0";
|
|
1135
1311
|
/** 1.4 `software`: which software produced the receipt. */
|
|
@@ -1191,6 +1367,11 @@ interface ReceiptData {
|
|
|
1191
1367
|
name: string;
|
|
1192
1368
|
amountMinor: number;
|
|
1193
1369
|
}>;
|
|
1370
|
+
/** ADR-094: the sum of the order's cash roundings, signed; present only when non-zero. Counted in totals.totalMinor. */
|
|
1371
|
+
rounding?: {
|
|
1372
|
+
name: string;
|
|
1373
|
+
amountMinor: number;
|
|
1374
|
+
};
|
|
1194
1375
|
discounts: {
|
|
1195
1376
|
label: string;
|
|
1196
1377
|
amountMinor: number;
|
|
@@ -1318,6 +1499,8 @@ interface PosOrderPayment {
|
|
|
1318
1499
|
reference?: string;
|
|
1319
1500
|
/** When the till recorded the leg (`Payment.takenAt`); absent on store-held and older legs. */
|
|
1320
1501
|
takenAt?: string;
|
|
1502
|
+
/** The session the leg was taken in (`Payment.sessionId`, S3); absent means the order's session. */
|
|
1503
|
+
sessionId?: string;
|
|
1321
1504
|
}
|
|
1322
1505
|
interface PosOrder {
|
|
1323
1506
|
id: string;
|
|
@@ -1348,6 +1531,8 @@ interface PosOrder {
|
|
|
1348
1531
|
/** What the store owes back on a reopened sale whose locked payments exceed its new total, in minor units (pos_orders v15, ADR-090). `finalizeOrder` writes it on every reopened sale, 0 when nothing is due; absent on a till sale. */
|
|
1349
1532
|
refundDueMinor?: number;
|
|
1350
1533
|
payments: PosOrderPayment[];
|
|
1534
|
+
/** ADR-094: the cash rounding entries, keyed by this order's payment ids and counted in totalMinor. Absent when empty. */
|
|
1535
|
+
cashRoundings?: CashRounding[];
|
|
1351
1536
|
/** `billing` and `shipping` (#722) are frozen copies of the customer's addresses, stored only with `taxAddress`. */
|
|
1352
1537
|
customer: {
|
|
1353
1538
|
id?: string;
|
|
@@ -1425,7 +1610,39 @@ interface PosOrder {
|
|
|
1425
1610
|
reopenedAt?: string;
|
|
1426
1611
|
/** The commandId whose refusal the cashier marked handled (tally-woo 03, ADR-092 6f); the logic comes in a later PR. */
|
|
1427
1612
|
attentionHandledFor?: string;
|
|
1613
|
+
/** How the till settled the order the store created before it refused this sale (#1101); see `PosOrderStoreSettlement`. */
|
|
1614
|
+
storeSettlement?: PosOrderStoreSettlement;
|
|
1428
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* The till's settlement of a refused sale's store order (#1101, `storeOrderLeft`). `attemptId` names the attempt and is
|
|
1618
|
+
* kept while `state` is `sending`, so a repeat after a lost answer is the same attempt. `at` is the instant of the last
|
|
1619
|
+
* write. `storeStatus` is the store's status word (done, changed), `capturedMinor` what the store shows captured
|
|
1620
|
+
* (changed), `code` and `message` the store's refusal (refused), for the sync log, never shown to the cashier.
|
|
1621
|
+
* `payments` and `closeId` are for kind `pay`, `legs` for kind `reverse` (later slices).
|
|
1622
|
+
*/
|
|
1623
|
+
type PosOrderStoreSettlement = {
|
|
1624
|
+
kind: 'cancel' | 'pay' | 'reverse';
|
|
1625
|
+
state: 'sending' | 'done' | 'changed' | 'refused' | 'gone';
|
|
1626
|
+
attemptId: string;
|
|
1627
|
+
at: string;
|
|
1628
|
+
storeStatus?: string;
|
|
1629
|
+
capturedMinor?: number;
|
|
1630
|
+
code?: string;
|
|
1631
|
+
message?: string;
|
|
1632
|
+
payments?: {
|
|
1633
|
+
id: string;
|
|
1634
|
+
method: string;
|
|
1635
|
+
amountMinor: number;
|
|
1636
|
+
tenderedMinor?: number;
|
|
1637
|
+
done?: boolean;
|
|
1638
|
+
}[];
|
|
1639
|
+
closeId?: string;
|
|
1640
|
+
legs?: {
|
|
1641
|
+
paymentId: string;
|
|
1642
|
+
commandId: string;
|
|
1643
|
+
done?: boolean;
|
|
1644
|
+
}[];
|
|
1645
|
+
};
|
|
1429
1646
|
|
|
1430
1647
|
/**
|
|
1431
1648
|
* Receipt data for reprinting the till's own stored order (ADR-081). A stored order keeps no discount labels: the order discount
|
|
@@ -2364,7 +2581,8 @@ declare class UnsupportedOrderVersionError extends Error {
|
|
|
2364
2581
|
}
|
|
2365
2582
|
/**
|
|
2366
2583
|
* Builds the ADR-038 order.create envelope for a PosOrder. It sends the stored order unchanged, so every resend of
|
|
2367
|
-
* an order is byte-identical,
|
|
2584
|
+
* an order is byte-identical, except that a Woo-rounded order with charge display rows sends each charge at its row
|
|
2585
|
+
* (`wireChargeMinor`, #1341) and everything else as stored:
|
|
2368
2586
|
* `finalizeOrder` freezes the sent form (names and labels cut, an unsendable customer email or id left out).
|
|
2369
2587
|
* ADR-065's figures make version 3; otherwise a discounted order is version 2 (ADR-062), else version 1, byte-identical.
|
|
2370
2588
|
* A version-3 order goes as version 4 (#286) only when `maxVersion` is at least 4 and its `sentVersion` doesn't cap it.
|
|
@@ -2453,16 +2671,56 @@ declare const UPDATE_UNSENDABLE_MESSAGE = "The store can't accept this change ye
|
|
|
2453
2671
|
* A refused order is left out once its finalized successor is in `orders`.
|
|
2454
2672
|
* Pending updates marked `UPDATE_UNSENDABLE` are shown until a person acts.
|
|
2455
2673
|
* An order a cashier marked handled (`markAttentionHandled`) is left out while its `commandId` is the one it was marked
|
|
2456
|
-
* for; a requeue mints a new `commandId`, so a fresh refusal shows again (ADR-092 6f).
|
|
2674
|
+
* for; a requeue mints a new `commandId`, so a fresh refusal shows again (ADR-092 6f). The mark does not hide a refused
|
|
2675
|
+
* sale whose order the store created (`storeOrderLeft`, #1101). A refused sale whose store order is settled on the store
|
|
2676
|
+
* (`settledOnStore`: cancelled or gone, #1101) is not shown for its refusal; any other reason above still shows it.
|
|
2457
2677
|
*/
|
|
2458
2678
|
declare function needsAttention(orders: PosOrder[], options?: {
|
|
2459
2679
|
stuckCommandIds?: readonly string[];
|
|
2460
2680
|
}): PosOrder[];
|
|
2461
2681
|
|
|
2682
|
+
/**
|
|
2683
|
+
* The store order a refused sale left behind (#1101): a value only for a rejected order with no `storeOrderId` whose
|
|
2684
|
+
* `error.data.orderId` is a non-empty string, as a transport that created the order before refusing the sale sets it.
|
|
2685
|
+
* `reference` is `data.displayId` when a non-empty string, else `orderId`. `recordedMinor` sums the first
|
|
2686
|
+
* `data.recorded` payments (a safe integer above 0; anything else counts as 0): what the store had recorded at the
|
|
2687
|
+
* refusal, not the order's state now.
|
|
2688
|
+
*/
|
|
2689
|
+
declare function storeOrderLeft(order: Pick<PosOrder, 'syncStatus' | 'storeOrderId' | 'error' | 'payments'>): {
|
|
2690
|
+
orderId: string;
|
|
2691
|
+
reference: string;
|
|
2692
|
+
recordedMinor: number;
|
|
2693
|
+
} | undefined;
|
|
2694
|
+
|
|
2695
|
+
type LeftOrder = Pick<PosOrder, 'syncStatus' | 'storeOrderId' | 'error' | 'payments' | 'storeSettlement'>;
|
|
2696
|
+
/**
|
|
2697
|
+
* Whether the store order a refused sale left behind is settled on the store (#1101): its settlement is done, or gone
|
|
2698
|
+
* while the store had recorded nothing on it (desk ruling: a gone order with money recorded still needs a manager).
|
|
2699
|
+
*/
|
|
2700
|
+
declare function settledOnStore(order: LeftOrder | Pick<PosOrder, 'storeSettlement'>): boolean;
|
|
2701
|
+
/**
|
|
2702
|
+
* Whether the till may cancel the store order a refused sale left behind (#1101): there is one (`storeOrderLeft`), the
|
|
2703
|
+
* store had recorded nothing paid on it, it is not settled (`settledOnStore`), and there is no settlement yet, or a
|
|
2704
|
+
* cancel (whose `sending` attempt a repeat finishes), or one the store changed or refused.
|
|
2705
|
+
*/
|
|
2706
|
+
declare function canCancelOnStore(order: LeftOrder): boolean;
|
|
2707
|
+
/** The till's legs the store had not recorded at the refusal (#1101 slice 3): the payments after `data.recorded`, counted
|
|
2708
|
+
* as `storeOrderLeft` counts them. */
|
|
2709
|
+
declare function unrecordedLegs(order: Pick<PosOrder, 'error' | 'payments'>): PosOrder['payments'];
|
|
2710
|
+
/**
|
|
2711
|
+
* Whether the till may record its unrecorded legs on the part-paid store order a refused sale left behind (#1101 slice
|
|
2712
|
+
* 3): the store had recorded some of the sale, it is not settled, every leg left has an amount, the settlement is not
|
|
2713
|
+
* `gone` (the order is not on the store, so a press could only read 404 again), and there is no settlement yet, or a
|
|
2714
|
+
* pay (whose `sending` attempt a repeat finishes), or one the store changed or refused.
|
|
2715
|
+
*/
|
|
2716
|
+
declare function canPayRestOnStore(order: LeftOrder): boolean;
|
|
2717
|
+
|
|
2462
2718
|
/**
|
|
2463
2719
|
* Marks the order `orderId` handled for its current `commandId`, so `needsAttention` leaves it out until a requeue
|
|
2464
2720
|
* mints a new one (ADR-092 6f, tally-woo 03). Resolves to true when the order is stamped (or already was, for this
|
|
2465
2721
|
* commandId); false, with nothing changed, when the id is unknown or the order is pending (still the outbox's to settle).
|
|
2722
|
+
* The stamp does not hide a refused sale whose order the store created (`storeOrderLeft`, #1101): it is still written
|
|
2723
|
+
* and the call still resolves to true, but `needsAttention` keeps that sale.
|
|
2466
2724
|
*/
|
|
2467
2725
|
declare function markAttentionHandled(orders: RxCollection<PosOrder>, orderId: string, now?: () => Date): Promise<boolean>;
|
|
2468
2726
|
|
|
@@ -2791,7 +3049,7 @@ declare function voidMovement(sessions: RegisterSessionCollection, movements: Ca
|
|
|
2791
3049
|
* count in the drawer, because the cash was taken, until a finalized successor carries their payments (ADR-077 R5 amended).
|
|
2792
3050
|
* A refund still pending at close is not counted, and the Z lists it.
|
|
2793
3051
|
*/
|
|
2794
|
-
declare function writeClosure({ closures, register, storeKey, session, counted, otherTenders, movements, orders, refunds, tillExpected, labels, resolveCashierName, softwareVersion, timezone, }: {
|
|
3052
|
+
declare function writeClosure({ closures, register, storeKey, session, counted, otherTenders, movements, orders, drafts, liveLegs, liveRoundings, refunds, tillExpected, labels, resolveCashierName, softwareVersion, timezone, }: {
|
|
2795
3053
|
closures: ClosureCollection;
|
|
2796
3054
|
/** The register document's host (`register_sessions`). */
|
|
2797
3055
|
register: RegisterHost;
|
|
@@ -2803,6 +3061,18 @@ declare function writeClosure({ closures, register, storeKey, session, counted,
|
|
|
2803
3061
|
movements: readonly CashMovement[];
|
|
2804
3062
|
/** Any `pos_orders`; only those whose `sessionId` is this session's are counted. */
|
|
2805
3063
|
orders: readonly PosOrder[];
|
|
3064
|
+
/**
|
|
3065
|
+
* `order_drafts` documents: a parked sale's legs taken in this session count here (S3). Optional here only because
|
|
3066
|
+
* `useRegisterSession`, the real caller, always passes it and `liveLegs`; any other caller must pass both, or cash taken
|
|
3067
|
+
* in this session but not yet on an order is missing from its Z.
|
|
3068
|
+
*/
|
|
3069
|
+
drafts?: readonly {
|
|
3070
|
+
data?: unknown;
|
|
3071
|
+
}[];
|
|
3072
|
+
/** The live sale's taken legs (`useSale`'s `registerView().takenLegs`, S3): those taken in this session count here. See `drafts`. */
|
|
3073
|
+
liveLegs?: readonly Payment[];
|
|
3074
|
+
/** The live sale's cash rounding entries (`registerView().cashRoundings`, #1281): one on a `liveLegs` leg taken in this session counts here. */
|
|
3075
|
+
liveRoundings?: readonly CashRounding[];
|
|
2806
3076
|
/** `pos_refunds` rows; only this session's applied ones are counted (ADR-080 amendment 1). */
|
|
2807
3077
|
refunds?: readonly PosRefund[];
|
|
2808
3078
|
tillExpected?: Record<string, number>;
|
|
@@ -2982,15 +3252,28 @@ interface DrawerTerms {
|
|
|
2982
3252
|
* method's figure is its `otherTenders` amount. A refund counts once per method it touches.
|
|
2983
3253
|
*/
|
|
2984
3254
|
declare function deriveDrawerTerms(input: Parameters<typeof deriveExpected>[0]): DrawerTerms;
|
|
3255
|
+
type TillLeg = {
|
|
3256
|
+
method: string;
|
|
3257
|
+
methodId?: string;
|
|
3258
|
+
amountMinor: number;
|
|
3259
|
+
storePaymentId?: string;
|
|
3260
|
+
sessionId?: string;
|
|
3261
|
+
};
|
|
3262
|
+
type TillOrder = {
|
|
3263
|
+
sessionId?: string;
|
|
3264
|
+
payments: readonly TillLeg[];
|
|
3265
|
+
};
|
|
2985
3266
|
/**
|
|
2986
|
-
* Takings per payment method for one session, for the closure sheet: this till's captured payments (`tillPayments`)
|
|
2987
|
-
*
|
|
3267
|
+
* Takings per payment method for one session, for the closure sheet: this till's captured payments (`tillPayments`) in
|
|
3268
|
+
* `sessionId`: a payment's own session, else its order's (S3), keyed by `legMethodId`'s kind plus id (`external:stripe`), with the number of
|
|
2988
3269
|
* payments behind each. Local only, never synced: register rows and payloads keep `method_id: payment.method` (#256, ADR-070
|
|
2989
3270
|
* decision 1). A leg with no methodId keys exactly as deriveDrawerTerms does (`cash` or its method); the figures sum to
|
|
2990
|
-
* deriveDrawerTerms' cash sales plus other tenders for the same orders.
|
|
3271
|
+
* deriveDrawerTerms' cash sales plus other tenders for the same orders. `extra` adds taken legs no order holds yet (S3: a
|
|
3272
|
+
* parked draft's `parkedTakenLegs`, the live sale's `registerView().takenLegs`), each counted only in its own `sessionId`; they are legs,
|
|
3273
|
+
* not `LedgerRow`s, because a row keeps no `methodId` to key by. Refunds and movements are not here: they are keyed
|
|
2991
3274
|
* by the wire method. The map has no prototype, so a platform id such as `__proto__` or `toString` is a key like any other.
|
|
2992
3275
|
*/
|
|
2993
|
-
declare function takingsByMethod(orders: readonly
|
|
3276
|
+
declare function takingsByMethod(orders: readonly TillOrder[], sessionId: string, extra?: readonly TillLeg[]): Record<string, DrawerTerm>;
|
|
2994
3277
|
|
|
2995
3278
|
/**
|
|
2996
3279
|
* The pure maths behind a register count: variance against the expected float, a display
|
|
@@ -3091,6 +3374,56 @@ declare function deriveSettled(recorded: RecordedFigures, corrections: readonly
|
|
|
3091
3374
|
touched: Set<string>;
|
|
3092
3375
|
};
|
|
3093
3376
|
|
|
3377
|
+
/**
|
|
3378
|
+
* One typed read of a closure's figures (#1261). `writeClosure` (session-store.ts) freezes them in the untyped
|
|
3379
|
+
* `Closure.breakdowns`, and a closure adopted from the store may lack any of them, so every reader goes through here.
|
|
3380
|
+
*
|
|
3381
|
+
* The one rule: a money or count value that is not a finite integer (absent, `null`, a string, NaN) is left out
|
|
3382
|
+
* (undefined), never read as 0. A missing group is an empty list. A payment method, tax rate or movement whose money
|
|
3383
|
+
* is not a finite integer is dropped from its list, and so is a movement without a string id. A cashier given as a
|
|
3384
|
+
* bare string becomes `{ id, name: id }`; a nameless one is named by its id.
|
|
3385
|
+
*/
|
|
3386
|
+
|
|
3387
|
+
type ClosureFigures = {
|
|
3388
|
+
openingFloat: {
|
|
3389
|
+
expectedMinor?: number;
|
|
3390
|
+
countedMinor?: number;
|
|
3391
|
+
varianceMinor?: number;
|
|
3392
|
+
};
|
|
3393
|
+
paymentMethods: {
|
|
3394
|
+
id: string;
|
|
3395
|
+
name?: string;
|
|
3396
|
+
salesMinor: number;
|
|
3397
|
+
refundsMinor: number;
|
|
3398
|
+
}[];
|
|
3399
|
+
taxRates: {
|
|
3400
|
+
key: string;
|
|
3401
|
+
name?: string;
|
|
3402
|
+
netMinor: number;
|
|
3403
|
+
taxMinor: number;
|
|
3404
|
+
grossMinor: number;
|
|
3405
|
+
}[];
|
|
3406
|
+
movements: {
|
|
3407
|
+
id: string;
|
|
3408
|
+
type: string;
|
|
3409
|
+
amountMinor: number;
|
|
3410
|
+
reason: string;
|
|
3411
|
+
voided: boolean;
|
|
3412
|
+
createdAtGmt?: string;
|
|
3413
|
+
createdBy?: string;
|
|
3414
|
+
}[];
|
|
3415
|
+
transactionCount?: number;
|
|
3416
|
+
refundCount?: number;
|
|
3417
|
+
cashiers: {
|
|
3418
|
+
id: string;
|
|
3419
|
+
name: string;
|
|
3420
|
+
}[];
|
|
3421
|
+
taxRoundingMixed: boolean;
|
|
3422
|
+
taxIncludesStorePaid: boolean;
|
|
3423
|
+
varianceNote?: string;
|
|
3424
|
+
};
|
|
3425
|
+
declare function closureFigures(closure: Pick<Closure, 'breakdowns'>): ClosureFigures;
|
|
3426
|
+
|
|
3094
3427
|
/**
|
|
3095
3428
|
* The opening float the open-register card suggests (v2 parity A4): the register's default float, else the cash
|
|
3096
3429
|
* counted at the last close, else none. Port provenance: WCPOS v2 monorepo `main` `5ac185b0e`,
|
|
@@ -3156,6 +3489,7 @@ declare const labelKeys: {
|
|
|
3156
3489
|
no_sale: string;
|
|
3157
3490
|
void: string;
|
|
3158
3491
|
copy: string;
|
|
3492
|
+
cash_rounding: string;
|
|
3159
3493
|
};
|
|
3160
3494
|
declare const ENGLISH_CLOSURE_LABELS: Record<keyof typeof labelKeys, string>;
|
|
3161
3495
|
|
|
@@ -3271,6 +3605,7 @@ declare function buildClosureDocument(row: Closure, context: ClosureContext): {
|
|
|
3271
3605
|
closure: {
|
|
3272
3606
|
tax_store_paid_note?: string | undefined;
|
|
3273
3607
|
tax_rounding_note?: string | undefined;
|
|
3608
|
+
has_cash_rounding: boolean;
|
|
3274
3609
|
has_sales: boolean;
|
|
3275
3610
|
has_perpetual: boolean;
|
|
3276
3611
|
} & {
|
|
@@ -3337,8 +3672,15 @@ declare function buildClosureDocument(row: Closure, context: ClosureContext): {
|
|
|
3337
3672
|
reason: string;
|
|
3338
3673
|
amount_display: string;
|
|
3339
3674
|
}[];
|
|
3340
|
-
cashiers:
|
|
3675
|
+
cashiers: {
|
|
3676
|
+
id: string;
|
|
3677
|
+
name: string;
|
|
3678
|
+
}[];
|
|
3341
3679
|
};
|
|
3680
|
+
cash_rounding?: ({
|
|
3681
|
+
name: string;
|
|
3682
|
+
amount: {} | null;
|
|
3683
|
+
} & Record<"amount_display", string>) | undefined;
|
|
3342
3684
|
period_sales_total_display: string;
|
|
3343
3685
|
period_refunds_total_display: string;
|
|
3344
3686
|
perpetual_sales_total_display: string;
|
|
@@ -3383,6 +3725,7 @@ declare function buildXReportDocument(session: RegisterSession, context: Closure
|
|
|
3383
3725
|
closure: {
|
|
3384
3726
|
tax_store_paid_note?: string | undefined;
|
|
3385
3727
|
tax_rounding_note?: string | undefined;
|
|
3728
|
+
has_cash_rounding: boolean;
|
|
3386
3729
|
has_sales: boolean;
|
|
3387
3730
|
has_perpetual: boolean;
|
|
3388
3731
|
} & {
|
|
@@ -3435,8 +3778,15 @@ declare function buildXReportDocument(session: RegisterSession, context: Closure
|
|
|
3435
3778
|
reason: string;
|
|
3436
3779
|
amount_display: string;
|
|
3437
3780
|
}[];
|
|
3438
|
-
cashiers:
|
|
3781
|
+
cashiers: {
|
|
3782
|
+
id: string;
|
|
3783
|
+
name: string;
|
|
3784
|
+
}[];
|
|
3439
3785
|
};
|
|
3786
|
+
cash_rounding?: ({
|
|
3787
|
+
name: string;
|
|
3788
|
+
amount: {} | null;
|
|
3789
|
+
} & Record<"amount_display", string>) | undefined;
|
|
3440
3790
|
period_sales_total_display: string;
|
|
3441
3791
|
period_refunds_total_display: string;
|
|
3442
3792
|
perpetual_sales_total_display: string;
|
|
@@ -3588,8 +3938,9 @@ type SessionTarget = {
|
|
|
3588
3938
|
* Applied opens fill a missing resume id; refused opens make open/counting sessions conflict.
|
|
3589
3939
|
* Superseded rejections make open/counting sessions terminal; a conflict session leaves only by an applied open or abandon (ADR-078 decision 9); terminal/unknown states stay untouched.
|
|
3590
3940
|
* Applied conflict opens restore the latest transition's counting state, otherwise open; pending rows do nothing.
|
|
3591
|
-
* Given `host` and `storeKey`, applied rows also raise the register's counters to the store's (#651, `adoptStoreCounters
|
|
3941
|
+
* Given `host` and `storeKey`, applied rows also raise the register's counters to the store's (#651, `adoptStoreCounters`; refunds only from answers at the highest closure number among them),
|
|
3592
3942
|
* and given `closures` too, a closure refused for its number is renumbered once and requeued (#655, `renumberRefused`).
|
|
3943
|
+
* Given `closures`, applied closure answers then set the register's perpetual refunds to the store's (`settleStoreRefunds`) when nothing of this till's is unsent.
|
|
3593
3944
|
* Answers are walked in seq/key order; adoption is idempotent and safe to run at any time.
|
|
3594
3945
|
*/
|
|
3595
3946
|
declare function adoptRegisterResults({ commands, sessions, registerId, host, storeKey, closures }: {
|
|
@@ -3643,6 +3994,10 @@ declare function reapproveClosure({ commands, closureId, approval, approvedBy, r
|
|
|
3643
3994
|
declare class RegisterTenderInProgressError extends Error {
|
|
3644
3995
|
constructor();
|
|
3645
3996
|
}
|
|
3997
|
+
/** The live sale is still saving (or its save failed and was not retried), so the till can't count or close under it. Its message can be shown to a cashier as it is. */
|
|
3998
|
+
declare class RegisterSaleSavingError extends Error {
|
|
3999
|
+
constructor();
|
|
4000
|
+
}
|
|
3646
4001
|
/** The register already has an `open` or `counting` session, or an open is in flight. Its message can be shown to a cashier as it is. */
|
|
3647
4002
|
declare class RegisterSessionAlreadyOpenError extends Error {
|
|
3648
4003
|
constructor();
|
|
@@ -3671,6 +4026,27 @@ interface UseRegisterSessionOptions {
|
|
|
3671
4026
|
deviceName?: string | null;
|
|
3672
4027
|
/** `pos_orders`: a session's sales are those whose `sessionId` is its id. */
|
|
3673
4028
|
orders: RxCollection<PosOrder> | null;
|
|
4029
|
+
/**
|
|
4030
|
+
* Required (S3): `order_drafts`, the sale's own, so a parked sale's taken legs count in the session that took them;
|
|
4031
|
+
* `null` when the app never parks a sale. Left out, that cash would be missing from the session's Z.
|
|
4032
|
+
*/
|
|
4033
|
+
drafts: RxCollection | null;
|
|
4034
|
+
/**
|
|
4035
|
+
* Required (S3): the live sale's taken legs, read when the figures are derived, so a leg still in the cart (after
|
|
4036
|
+
* `cancelTender`, say) counts on its session's Z; `null` when the app has no live sale. A getter, because the app
|
|
4037
|
+
* creates the register before the sale (the sale takes `register.saleSession`). The usual wiring is a ref:
|
|
4038
|
+
* ```ts
|
|
4039
|
+
* const saleRef = useRef<ReturnType<typeof useSale> | null>(null)
|
|
4040
|
+
* const register = useRegisterSession({ …, liveSale: () => saleRef.current?.registerView() ?? { takenLegs: [], saving: false } })
|
|
4041
|
+
* const sale = useSale(…)
|
|
4042
|
+
* saleRef.current = sale
|
|
4043
|
+
* ```
|
|
4044
|
+
*/
|
|
4045
|
+
liveSale: (() => {
|
|
4046
|
+
takenLegs: readonly Payment[];
|
|
4047
|
+
saving: boolean;
|
|
4048
|
+
cashRoundings?: readonly CashRounding[];
|
|
4049
|
+
}) | null;
|
|
3674
4050
|
/** The register document's host, for the closure number and perpetual totals (`writeClosure`); `null` while it opens. */
|
|
3675
4051
|
register: RegisterHost | null;
|
|
3676
4052
|
/** The app's neutral store key (see `bindRegister`). */
|
|
@@ -3824,6 +4200,11 @@ interface OrderTransportContext {
|
|
|
3824
4200
|
orders: ReadonlyMap<string, PosOrder>;
|
|
3825
4201
|
};
|
|
3826
4202
|
}
|
|
4203
|
+
type NeedsAdminAnswer = {
|
|
4204
|
+
id: string;
|
|
4205
|
+
reason: string;
|
|
4206
|
+
message: string;
|
|
4207
|
+
};
|
|
3827
4208
|
type TransportOutcome = {
|
|
3828
4209
|
kind: 'results';
|
|
3829
4210
|
results: CommandResult[];
|
|
@@ -3840,6 +4221,7 @@ type TransportOutcome = {
|
|
|
3840
4221
|
kind: 'retry';
|
|
3841
4222
|
reason: string;
|
|
3842
4223
|
retryAfterMs?: number;
|
|
4224
|
+
needsAdmin?: NeedsAdminAnswer;
|
|
3843
4225
|
};
|
|
3844
4226
|
interface CommandTransport<E extends AnyCommandEnvelope = CommandEnvelope<OrderCreatePayload>> {
|
|
3845
4227
|
send(batch: E[], context?: OrderTransportContext): Promise<TransportOutcome>;
|
|
@@ -4071,20 +4453,37 @@ type SaleStage = {
|
|
|
4071
4453
|
declare const DISCOUNTS_UNSUPPORTED = "finalize: discounts are not supported by the server yet (order.create v2)";
|
|
4072
4454
|
/** Every sale change refuses with this while a completion is pending (see `complete()`). */
|
|
4073
4455
|
declare const SALE_SAVING = "This sale is being saved. Retry to finish it.";
|
|
4456
|
+
/** `complete`, `park` and `resume` refuse with this while a close for the sale's register is in flight (#1275). */
|
|
4457
|
+
declare const REGISTER_CLOSING = "The register is closing. Wait for the close to finish, then try again.";
|
|
4074
4458
|
declare const PAYMENT_IN_MOTION = "Finish or void the payment in progress before completing the sale";
|
|
4075
4459
|
/**
|
|
4076
4460
|
* `switchSale()` and `closeSale()` refuse a sale whose legs took money (u19). v2 keeps a partly paid order's legs on
|
|
4077
|
-
* switching, but a TallyUI draft keeps no tender stage
|
|
4078
|
-
*
|
|
4461
|
+
* switching, but a TallyUI draft keeps no tender stage; `startTender` keeps taken legs and legs in motion (ADR-072 d3,
|
|
4462
|
+
* amended 2026-11-22 and 2026-11-23), and `resume` keeps a paid draft's parked coupons (ADR-077 d3, amended 2026-11-19): so the
|
|
4079
4463
|
* sale stays on the till until it is paid or its paid legs are voided.
|
|
4080
4464
|
*/
|
|
4081
4465
|
declare const SALE_PARTLY_PAID = "This sale is partly paid. Take the rest of the payment or void the paid legs first.";
|
|
4466
|
+
/** newSale refuses with this while an unlocked payment leg is pending or authorized. */
|
|
4467
|
+
declare const SALE_CARD_IN_PROGRESS = "A card payment is still in progress. Finish or cancel it before starting a new sale.";
|
|
4082
4468
|
declare const SALE_IN_TENDER = "Finish or cancel the payment before switching sales";
|
|
4083
4469
|
/**
|
|
4084
4470
|
* Line and total changes refuse with this while a till leg is live, as v2's resolveStage stills the cart (tally-woo 11c).
|
|
4085
4471
|
* "Cancel the payment" names the leg's button, `pos_checkout.cancel_payment` ("Cancel payment") in packages/components.
|
|
4086
4472
|
*/
|
|
4087
4473
|
declare const SALE_HAS_PAYMENT = "A payment was taken on this sale. Cancel the payment before changing the sale.";
|
|
4474
|
+
/** removeTender refuses a taken leg with this: it is voided, never removed (ADR-072 d3, amended 2026-11-22). */
|
|
4475
|
+
declare const PAYMENT_TAKEN = "This payment was taken. Void it instead of removing it.";
|
|
4476
|
+
/** A cash addTender refuses with this when the balance less the legs in motion leaves nothing due (row 500). */
|
|
4477
|
+
declare const NOTHING_DUE = "Nothing is left to pay: the payments on this sale already cover the total.";
|
|
4478
|
+
/** ADR-094: a cash due that rounds to nothing is entered against the last leg counting toward paid; with none, there is nothing to round against. */
|
|
4479
|
+
declare const NOTHING_TO_ROUND_AGAINST = "This sale rounds to nothing in cash: take it by another method.";
|
|
4480
|
+
declare const CASH_NOT_PAYABLE = "Cash cannot pay that amount: take a whole number of the smallest cash step.";
|
|
4481
|
+
declare const CASH_WAITS_FOR_PAYMENT = "Cash cannot pay that amount while another payment is in progress: finish that payment first.";
|
|
4482
|
+
declare const CASH_PICK_ENTRIES_MAX = 15;
|
|
4483
|
+
declare const CASH_PICK_LIMIT = "Too many rounded cash payments on this sale: take the rest as one payment.";
|
|
4484
|
+
declare const CASH_SETTLE_LIMIT = "Too many rounded cash payments on this sale: take the rest by another method.";
|
|
4485
|
+
/** voidTender's refusal for cashVoidRefusal's 'later_cash_rounding' (ADR-094 item 6); the components translate it as pos_checkout.void_later_cash_first. */
|
|
4486
|
+
declare const VOID_LATER_CASH_FIRST = "Void the later cash payment first.";
|
|
4088
4487
|
/** On the receipt the finished sale refuses edits and re-tender with this; `add` starts the next sale instead (v2 #2861). */
|
|
4089
4488
|
declare const SALE_FINISHED = "This sale is finished. Start a new sale to change it.";
|
|
4090
4489
|
/** startTender and complete() refuse with this while the order's store-priced coupons are stale or being priced again (TallyUI#710). */
|
|
@@ -4110,7 +4509,7 @@ declare const META_CHANGE_REFUSED = "Custom fields can only change in the cart.
|
|
|
4110
4509
|
declare const META_INVALID = "A custom field needs a name of at most 255 characters that does not start with \"_\", and a sale takes at most 50.";
|
|
4111
4510
|
/** ADR-092 6b: updateLine's refusal once the sale left the cart; a line's name, SKU and regular price change only in the cart. */
|
|
4112
4511
|
declare const LINE_EDIT_REFUSED = "A line can only be edited in the cart. Cancel the payment to edit it, or start a new order.";
|
|
4113
|
-
/** #1095: restore()'s refusal of a removal whose sale moved on (reset, parked, finished) or that is already back. */
|
|
4512
|
+
/** #1095: restore()'s refusal of a removal whose sale moved on (reset, parked, resumed, finished), whose customer changed or whose sale was re-taxed since, or that is already back. */
|
|
4114
4513
|
declare const RESTORE_STALE = "This item can no longer be put back. Add it again.";
|
|
4115
4514
|
/** Taken by `removal()` before a remove; pass it to `restore()`. Hosts never build one. */
|
|
4116
4515
|
type SaleRemoval = {
|
|
@@ -4173,6 +4572,8 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4173
4572
|
isStored?: (posOrder: PosOrder) => Promise<boolean>;
|
|
4174
4573
|
/** Tests only: overrides HUNG_SAVE_CHECK_MS, so a test can shrink the hung-save poll's interval. */
|
|
4175
4574
|
hungSaveCheckMs?: number;
|
|
4575
|
+
/** Tests only: overrides SAVE_TIMEOUT_MS, so a test can shrink the save's time bound. */
|
|
4576
|
+
saveTimeoutMs?: number;
|
|
4176
4577
|
/**
|
|
4177
4578
|
* #722: the tax context for a customer's address (`saleTaxContexts(settings)`, memoized). Each new sale is taxed for its
|
|
4178
4579
|
* customer, and `setCustomer` re-taxes a cart whose new customer moves the matched rates; tender and receipt keep theirs.
|
|
@@ -4246,7 +4647,7 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4246
4647
|
remove(lineId: string): void;
|
|
4247
4648
|
/** #1095: the line, fee or shipping line `id` as it is now, taken before a remove for `restore()`; null when it is not there. */
|
|
4248
4649
|
removal(kind: SaleRemoval["kind"], id: string): SaleRemoval | null;
|
|
4249
|
-
/** #1095, v2's Undo: puts a removal back at its old index (clamped), re-
|
|
4650
|
+
/** #1095, v2's Undo: puts a removal back at its old index (clamped); returns a refusal or null. Any customer change, a re-tax, a reset (park, resume, new sale) or the receipt voids it (RESTORE_STALE). */
|
|
4250
4651
|
restore(removal: SaleRemoval): string | null;
|
|
4251
4652
|
/** A line's discount, or the order's without a line; returns the refusal to show, or null once applied. */
|
|
4252
4653
|
applyDiscount(lineId: string | null, discount: Discount): string | null;
|
|
@@ -4295,8 +4696,8 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4295
4696
|
amountMinor: number;
|
|
4296
4697
|
reference?: string;
|
|
4297
4698
|
} | null) => void;
|
|
4298
|
-
/** ADR-072: external is capped at the balance due; change comes only from cash. A leg is captured unless a status says otherwise; a leg in motion is held against the external cap. Units are checked against the units legs hold (`heldUnitsByLine`), but a leg's amount is not tied to its units' money here; the pane enforces that (#1133). */
|
|
4299
|
-
addTender(
|
|
4699
|
+
/** ADR-072: external is capped at the balance due; change comes only from cash. A cash leg records the amount applied, the amount handed over (`tenderedMinor`) and the change (`changeMinor`). A leg is captured unless a status says otherwise; a leg in motion is held against the external cap. Units are checked against the units legs hold (`heldUnitsByLine`), but a leg's amount is not tied to its units' money here; the pane enforces that (#1133). A cash part pick rounds its target less the live entries on a cashRounding store, and one that reaches the whole-settle due is taken as that settle (ADR-094 item 7). */
|
|
4700
|
+
addTender(input: {
|
|
4300
4701
|
method: "cash" | "external";
|
|
4301
4702
|
methodId?: string;
|
|
4302
4703
|
amountMinor: number;
|
|
@@ -4304,12 +4705,15 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4304
4705
|
reference?: string;
|
|
4305
4706
|
units?: Readonly<Record<string, number>>;
|
|
4306
4707
|
status?: "pending" | "authorized" | "captured";
|
|
4708
|
+
rounding?: PaymentRounding;
|
|
4307
4709
|
}): string | null;
|
|
4308
4710
|
setTenderStatus(paymentId: string, status: "authorized" | "captured" | "failed"): boolean;
|
|
4309
|
-
/** The leg stays in order.payments as voided and counts nothing; removeTender
|
|
4711
|
+
/** The leg stays in order.payments as voided and counts nothing; removeTender removes only a leg that took no money. Refused on the receipt. */
|
|
4310
4712
|
voidTender(paymentId: string): boolean;
|
|
4311
4713
|
/** ADR-072: remove one tender and its dropped-reference warning. An id not among the payments changes nothing. Refused on the receipt. */
|
|
4312
4714
|
removeTender(paymentId: string): void;
|
|
4715
|
+
/** True when setTender keeps this payment; false for one it replaces and for an id not among the payments. Changes nothing. */
|
|
4716
|
+
tenderHeld(paymentId: string): boolean;
|
|
4313
4717
|
cancelTender(): void;
|
|
4314
4718
|
/**
|
|
4315
4719
|
* Finalizes the tender, stamps the session (see `session`), hands the order to `onSaleCompleted`,
|
|
@@ -4325,6 +4729,7 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4325
4729
|
* another is in flight returns that call's promise, and a call on the receipt does nothing. While
|
|
4326
4730
|
* `cashierRef` or `registerId` is out of bounds (shown as `error`), a call does nothing either,
|
|
4327
4731
|
* unless it's the Retry of a pending completion, which was built with the options as they were.
|
|
4732
|
+
* Refused with `REGISTER_CLOSING`, changing nothing, while a close for this register is in flight (#1275).
|
|
4328
4733
|
*/
|
|
4329
4734
|
complete: () => Promise<void>;
|
|
4330
4735
|
/**
|
|
@@ -4338,24 +4743,47 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
|
|
|
4338
4743
|
* save still in flight carries on in the background, a throw logged at error) and starts the new
|
|
4339
4744
|
* sale outright — from the receipt, or an idle cart, there's nothing pending to abandon. Abandoning
|
|
4340
4745
|
* clears the screen, never the record (the Front desk, 2026-09-25). `newSale()` never deletes,
|
|
4341
|
-
* updates or requeues `pos_orders` itself.
|
|
4746
|
+
* updates or requeues `pos_orders` itself. An unfinished sale that still holds a taken payment is refused
|
|
4747
|
+
* with SALE_PARTLY_PAID, changing nothing, as `closeSale` refuses it; the receipt and a confirmed stored
|
|
4748
|
+
* pending completion are unchanged.
|
|
4749
|
+
* An unfinished sale with an unlocked leg in motion refuses with SALE_CARD_IN_PROGRESS, changing nothing.
|
|
4342
4750
|
*/
|
|
4343
4751
|
newSale(): void;
|
|
4344
|
-
/**
|
|
4752
|
+
/**
|
|
4753
|
+
* S3: the live sale's legs its session counts now and no stored order counts yet, for `useRegisterSession`'s
|
|
4754
|
+
* `liveSale`: captured till legs stamped with a session, not reopened and not counted by an after-close sale's closure
|
|
4755
|
+
* (`sessionTakenLegs`, the rule a parked draft's legs follow). `[]` on the receipt, whose stored order counts them.
|
|
4756
|
+
* `cashRoundings` are the sale's cash rounding entries on those legs, copied, counted on the Z with them (#1281).
|
|
4757
|
+
* `saving` is true while a completion is in flight or pending, including after a failed save, and while a
|
|
4758
|
+
* `park()` or `resume()` is in flight.
|
|
4759
|
+
*/
|
|
4760
|
+
registerView(): {
|
|
4761
|
+
takenLegs: Payment[];
|
|
4762
|
+
saving: boolean;
|
|
4763
|
+
cashRoundings: CashRounding[];
|
|
4764
|
+
};
|
|
4765
|
+
/**
|
|
4766
|
+
* Parks the cart in `drafts`; resolves to a refusal message, or null once parked.
|
|
4767
|
+
* Refused with `REGISTER_CLOSING` while a close for this register is in flight (#1275).
|
|
4768
|
+
*/
|
|
4345
4769
|
park(): Promise<string | null>;
|
|
4346
4770
|
/** Whether the live sale or a parked draft holds this store order; unreadable drafts do not count. */
|
|
4347
4771
|
holdsStoreOrder(orderId: string): Promise<boolean>;
|
|
4348
|
-
/** Loads a reopened store order (from reopenStoreOrder) into an empty sale, or returns why not. */
|
|
4772
|
+
/** Loads a reopened store order (from reopenStoreOrder) into an empty sale, or returns why not; refused with SALE_PARTLY_PAID while the live sale holds a taken payment. */
|
|
4349
4773
|
openStoreOrder(order: Order): string | null;
|
|
4350
|
-
/**
|
|
4774
|
+
/**
|
|
4775
|
+
* Resumes a draft into an empty cart; resolves to a refusal message, or null once resumed; refused with SALE_PARTLY_PAID while the live sale holds a taken payment.
|
|
4776
|
+
* Refused with `REGISTER_CLOSING` while a close for this register is in flight (#1275).
|
|
4777
|
+
*/
|
|
4351
4778
|
resume(draftId: string, options?: {
|
|
4352
4779
|
keepParkedPrices?: boolean;
|
|
4353
4780
|
}): Promise<string | null>;
|
|
4354
4781
|
/**
|
|
4355
4782
|
* Opens the parked draft `draftId`, or an empty sale for null (New), as a tab switch (u19, v2 cart/tabs.tsx):
|
|
4356
4783
|
* parks the current sale first when it has lines, fees or shipping (a receipt is done and is not parked).
|
|
4357
|
-
* Refused, changing nothing, while saving, for a partly paid sale (SALE_PARTLY_PAID), a payment in motion or
|
|
4784
|
+
* Refused, changing nothing, while saving, for a partly paid sale or an empty sale holding a taken payment (SALE_PARTLY_PAID), a payment in motion or
|
|
4358
4785
|
* the tender stage. Resolves to a refusal (park's, or `resume`'s for the chosen draft), or null.
|
|
4786
|
+
* Refused with `REGISTER_CLOSING` while a close for this register is in flight (#1275).
|
|
4359
4787
|
*/
|
|
4360
4788
|
switchSale(draftId: string | null): Promise<string | null>;
|
|
4361
4789
|
/** Discards the current sale (nothing is parked) and starts an empty one; refused while saving, once a leg of an unfinished sale took or holds money, or in the tender stage.
|
|
@@ -6234,83 +6662,6 @@ type CartQuantityLine = {
|
|
|
6234
6662
|
*/
|
|
6235
6663
|
declare function cartQuantities(lines: readonly CartQuantityLine[]): Map<string, number>;
|
|
6236
6664
|
|
|
6237
|
-
/** A store day, `yyyy-MM-dd` in the store's timezone. */
|
|
6238
|
-
type StoreDay = string;
|
|
6239
|
-
/** Inclusive range of store days. */
|
|
6240
|
-
interface DayRange {
|
|
6241
|
-
from: StoreDay;
|
|
6242
|
-
to: StoreDay;
|
|
6243
|
-
}
|
|
6244
|
-
interface ReportCategory {
|
|
6245
|
-
id: string;
|
|
6246
|
-
name: string;
|
|
6247
|
-
}
|
|
6248
|
-
interface ReportLine {
|
|
6249
|
-
/** Grouping identity: variant, else product, else name. */
|
|
6250
|
-
key: string;
|
|
6251
|
-
name: string;
|
|
6252
|
-
quantity: number;
|
|
6253
|
-
/** After discounts, excluding tax. */
|
|
6254
|
-
netMinor: number;
|
|
6255
|
-
taxMinor: number;
|
|
6256
|
-
/** Cost of goods for the whole line (quantity × unit cost). Absent or null means the cost is missing, never 0. */
|
|
6257
|
-
costMinor?: number | null;
|
|
6258
|
-
/** The line's first category, when the caller joined one. */
|
|
6259
|
-
category?: ReportCategory;
|
|
6260
|
-
}
|
|
6261
|
-
interface ReportPayment {
|
|
6262
|
-
method: string;
|
|
6263
|
-
label?: string;
|
|
6264
|
-
amountMinor: number;
|
|
6265
|
-
}
|
|
6266
|
-
interface ReportTax {
|
|
6267
|
-
ratePpm: number;
|
|
6268
|
-
code?: string;
|
|
6269
|
-
label: string;
|
|
6270
|
-
taxMinor: number;
|
|
6271
|
-
/** The net this rate taxed; null when the source does not carry it. */
|
|
6272
|
-
netMinor: number | null;
|
|
6273
|
-
}
|
|
6274
|
-
/** An order as the reports read it. Money in integer minor units. */
|
|
6275
|
-
interface ReportOrder {
|
|
6276
|
-
id: string;
|
|
6277
|
-
/** ISO 8601 UTC instant the sale was made. */
|
|
6278
|
-
at: string;
|
|
6279
|
-
/** Gross, including tax. */
|
|
6280
|
-
totalMinor: number;
|
|
6281
|
-
taxMinor: number;
|
|
6282
|
-
discountMinor: number;
|
|
6283
|
-
/** True when the order still owes money: its unpaid remainder is `unpaid`, not `unknown`. */
|
|
6284
|
-
needsPayment?: boolean;
|
|
6285
|
-
lines: ReportLine[];
|
|
6286
|
-
payments: ReportPayment[];
|
|
6287
|
-
/** A reopened sale's payments the store already held (its locked legs): not this till's takings, but they settle the total. */
|
|
6288
|
-
paidEarlierMinor?: number;
|
|
6289
|
-
taxes: ReportTax[];
|
|
6290
|
-
/** Refunds embedded on the order, undated (a store order's own list). Positive. */
|
|
6291
|
-
refunds: Array<{
|
|
6292
|
-
id: string;
|
|
6293
|
-
amountMinor: number;
|
|
6294
|
-
}>;
|
|
6295
|
-
}
|
|
6296
|
-
/** A refund dated by when it was made, counted on that store day. */
|
|
6297
|
-
interface ReportRefund {
|
|
6298
|
-
id: string;
|
|
6299
|
-
orderId: string;
|
|
6300
|
-
/** ISO 8601 UTC instant the refund was made. */
|
|
6301
|
-
at: string;
|
|
6302
|
-
/** Positive. */
|
|
6303
|
-
amountMinor: number;
|
|
6304
|
-
}
|
|
6305
|
-
/** The caller's product directory: a line's unit cost and first category. */
|
|
6306
|
-
type LineJoin = (line: {
|
|
6307
|
-
productId?: string;
|
|
6308
|
-
variantId?: string;
|
|
6309
|
-
}) => {
|
|
6310
|
-
unitCostMinor?: number | null;
|
|
6311
|
-
category?: ReportCategory;
|
|
6312
|
-
} | undefined;
|
|
6313
|
-
|
|
6314
6665
|
/** What the orders filter bar holds (#721): store ids as strings, and the date range as store days. */
|
|
6315
6666
|
interface OrderFilterValue {
|
|
6316
6667
|
status?: string;
|
|
@@ -6351,8 +6702,9 @@ declare function isRequeueable(code: string | undefined): boolean;
|
|
|
6351
6702
|
* Whether `requeue()` will send this order again. A rejected order: its code is requeueable, except that a reopened
|
|
6352
6703
|
* sale (`storeOrderId`) refused with `reopen_required` or `revision_conflict` needs a fresh reopen, not a resend
|
|
6353
6704
|
* (ADR-090 gate 5). A pending order the outbox could not build as an update (`UPDATE_UNSENDABLE`): yes, it is tried again.
|
|
6705
|
+
* An order with a `storeSettlement` (#1101): never; the till is settling its store order instead.
|
|
6354
6706
|
*/
|
|
6355
|
-
declare function isRequeueableOrder(order: Pick<PosOrder, 'syncStatus' | 'storeOrderId' | 'error'>): boolean;
|
|
6707
|
+
declare function isRequeueableOrder(order: Pick<PosOrder, 'syncStatus' | 'storeOrderId' | 'error' | 'storeSettlement'>): boolean;
|
|
6356
6708
|
interface OrderOutboxOptions {
|
|
6357
6709
|
collection: RxCollection<PosOrder>;
|
|
6358
6710
|
transport: CommandTransport<OrderCreateEnvelope | OrderUpdateEnvelope>;
|
|
@@ -6378,7 +6730,8 @@ interface OrderOutbox {
|
|
|
6378
6730
|
* Orders isRequeueableOrder refuses are left alone. Resolves to the number requeued. */
|
|
6379
6731
|
requeue(orderIds?: string[]): Promise<number>;
|
|
6380
6732
|
/** Removes the rejected order `orderId` from the collection, after any running flush ends. Resolves to true when
|
|
6381
|
-
* removed; false, with nothing changed, when the id is unknown
|
|
6733
|
+
* removed; false, with nothing changed, when the id is unknown, the order is not rejected, or the store created its
|
|
6734
|
+
* order before refusing it (`storeOrderLeft`, #1101). */
|
|
6382
6735
|
discard(orderId: string): Promise<boolean>;
|
|
6383
6736
|
/** Watches for pending orders and sends them. */
|
|
6384
6737
|
start(): void;
|
|
@@ -6388,6 +6741,46 @@ interface OrderOutbox {
|
|
|
6388
6741
|
}
|
|
6389
6742
|
declare function createOrderOutbox(options: OrderOutboxOptions): OrderOutbox;
|
|
6390
6743
|
|
|
6744
|
+
interface CancelOnStoreDeps {
|
|
6745
|
+
orders: RxCollection<PosOrder>;
|
|
6746
|
+
/** The connector's cancel, bound to the open store (`RefusedOrderSettlement.cancel`). */
|
|
6747
|
+
cancel(request: SettleCancelRequest): Promise<SettleOutcome>;
|
|
6748
|
+
now?: () => Date;
|
|
6749
|
+
}
|
|
6750
|
+
/**
|
|
6751
|
+
* Cancels on the store the order a refused sale left behind (#1101), when `canCancelOnStore` allows it on the stored
|
|
6752
|
+
* row; otherwise resolves to `not_offered` and never calls `cancel`. It first stores the attempt as `sending` (keeping
|
|
6753
|
+
* the stored `attemptId` of a cancel still `sending`, so a repeat is the same attempt), and only once that write has
|
|
6754
|
+
* resolved calls `cancel`. The outcome is written only while the stored settlement is still this attempt's `sending`
|
|
6755
|
+
* one; `retry` writes nothing, and a rejected `cancel` leaves the row `sending` and rejects with the same error.
|
|
6756
|
+
* `syncStatus`, `error`, `commandId`, `payments` and the totals are never changed. pos_orders is till-local, never
|
|
6757
|
+
* pulled from a store, so these writes break no replication rule.
|
|
6758
|
+
*/
|
|
6759
|
+
declare function cancelOnStore(deps: CancelOnStoreDeps, orderId: string): Promise<SettleOutcome | {
|
|
6760
|
+
kind: 'not_offered';
|
|
6761
|
+
}>;
|
|
6762
|
+
interface PayRestOnStoreDeps {
|
|
6763
|
+
orders: RxCollection<PosOrder>;
|
|
6764
|
+
/** The connector's pay, bound to the open store (`RefusedOrderSettlement.pay`). */
|
|
6765
|
+
pay(request: SettlePayRequest): Promise<SettlePayResult>;
|
|
6766
|
+
now?: () => Date;
|
|
6767
|
+
}
|
|
6768
|
+
/**
|
|
6769
|
+
* Records on the store the legs of a refused sale its part-paid store order is missing (#1101 slice 3), when
|
|
6770
|
+
* `canPayRestOnStore` allows it on the stored row; otherwise resolves to `not_offered` and never calls `pay`. No money is
|
|
6771
|
+
* taken: each leg of `unrecordedLegs` is sent under a new id (method, amount, and `tenderedMinor` for cash only, never
|
|
6772
|
+
* the change), except that a stored pay with one payment per leg keeps its ids, amounts and `done` flags, so the store
|
|
6773
|
+
* skips a leg it already holds. It first stores the attempt as `sending` with those ids (a pay still `sending` also keeps
|
|
6774
|
+
* its `attemptId`, so a repeat is the same attempt; any other mints a new one), and only once that write has resolved
|
|
6775
|
+
* calls `pay`. The answer is written only while the stored settlement is still this attempt's `sending` one: every id in
|
|
6776
|
+
* `recorded` is marked `done` whatever the outcome, `retry` keeps `sending`, and a rejected `pay` leaves the row
|
|
6777
|
+
* `sending` and rejects with the same error.
|
|
6778
|
+
* `syncStatus`, `error`, `commandId`, `payments` and the totals are never changed.
|
|
6779
|
+
*/
|
|
6780
|
+
declare function payRestOnStore(deps: PayRestOnStoreDeps, orderId: string): Promise<SettleOutcome | {
|
|
6781
|
+
kind: 'not_offered';
|
|
6782
|
+
}>;
|
|
6783
|
+
|
|
6391
6784
|
/** Whether the register outbox's requeue() resends a rejection with this code. */
|
|
6392
6785
|
declare function isRegisterRequeueable(code: string | undefined): boolean;
|
|
6393
6786
|
interface RegisterOutboxOptions {
|
|
@@ -6448,6 +6841,11 @@ interface UseRegisterOutboxResult {
|
|
|
6448
6841
|
}
|
|
6449
6842
|
declare function useRegisterOutbox(options: UseRegisterOutboxOptions): UseRegisterOutboxResult;
|
|
6450
6843
|
|
|
6844
|
+
/** The retry reason prefix the transport gives a 409 needs_admin answer; the server's reason follows it. */
|
|
6845
|
+
declare const NEEDS_ADMIN_RETRY_PREFIX = "needs_admin:";
|
|
6846
|
+
/** The server's needs_admin reason inside an outbox retry reason, or undefined when the reason is anything else. */
|
|
6847
|
+
declare function needsAdminReasonOf(retryReason: string): string | undefined;
|
|
6848
|
+
|
|
6451
6849
|
declare const outboxLogger: Logger;
|
|
6452
6850
|
|
|
6453
6851
|
interface UseOrderOutboxOptions {
|
|
@@ -6470,6 +6868,12 @@ interface UseOrderOutboxOptions {
|
|
|
6470
6868
|
onBusy?(busy: boolean): void;
|
|
6471
6869
|
/** Called when `open` rejects, even if the key has changed since (medusapos: reports storage worker failures). */
|
|
6472
6870
|
onOpenError?(error: unknown): void;
|
|
6871
|
+
/** The settlement of a refused sale's store order (#1101) for `storeKey`: the connector's `cancel` and `pay`, bound to
|
|
6872
|
+
* that store. Read on each call, for the open store. */
|
|
6873
|
+
storeSettlement?(storeKey: string): {
|
|
6874
|
+
cancel?(request: SettleCancelRequest): Promise<SettleOutcome>;
|
|
6875
|
+
pay?(request: SettlePayRequest): Promise<SettlePayResult>;
|
|
6876
|
+
} | undefined;
|
|
6473
6877
|
}
|
|
6474
6878
|
interface UseOrderOutboxResult {
|
|
6475
6879
|
/** The open orders collection, or `null` until the current store is ready. */
|
|
@@ -6479,7 +6883,7 @@ interface UseOrderOutboxResult {
|
|
|
6479
6883
|
/** The newest 50 orders, newest first; empty until the current store is ready. */
|
|
6480
6884
|
recent: PosOrder[];
|
|
6481
6885
|
/**
|
|
6482
|
-
* Stores a finalized order, then flushes. Throws the opening error, or "Orders are not ready.", before the store is ready.
|
|
6886
|
+
* Stores a finalized order, then flushes. It resolves only once `state.pending` counts the order. Throws the opening error, or "Orders are not ready.", before the store is ready.
|
|
6483
6887
|
* Recording an order whose `id` is already stored, not deleted, with the same money-bearing content (`sameSale`;
|
|
6484
6888
|
* a retried `complete()`) counts as stored, never overwrites it, and still flushes, whatever the stored `commandId`
|
|
6485
6889
|
* (a requeue mints a new one; the difference is logged at warn). Other content rejects with `OrderContentMismatchError`.
|
|
@@ -6497,6 +6901,23 @@ interface UseOrderOutboxResult {
|
|
|
6497
6901
|
requeue(orderIds?: string[]): Promise<number>;
|
|
6498
6902
|
/** Removes one rejected order (see `OrderOutbox.discard`); resolves to false before the current store is ready. */
|
|
6499
6903
|
discard(orderId: string): Promise<boolean>;
|
|
6904
|
+
/**
|
|
6905
|
+
* Cancels on the store the order a refused sale left behind (`cancelOnStore`, #1101), with the `cancel` of
|
|
6906
|
+
* `storeSettlement` for the open store, then recounts the outbox state, whether the cancel resolved or rejected.
|
|
6907
|
+
* Resolves to `not_offered` before the current store is ready, or when there is no `storeSettlement` or no `cancel`.
|
|
6908
|
+
*/
|
|
6909
|
+
cancelOnStore(orderId: string): Promise<SettleOutcome | {
|
|
6910
|
+
kind: 'not_offered';
|
|
6911
|
+
}>;
|
|
6912
|
+
/**
|
|
6913
|
+
* Records on the store the till's legs a refused sale's part-paid store order is missing (`payRestOnStore`, #1101
|
|
6914
|
+
* slice 3), with the `pay` of `storeSettlement` for the open store, then recounts the outbox state, whether the pay
|
|
6915
|
+
* resolved or rejected. Resolves to `not_offered` before the current store is ready, or when there is no
|
|
6916
|
+
* `storeSettlement` or no `pay`.
|
|
6917
|
+
*/
|
|
6918
|
+
payRestOnStore(orderId: string): Promise<SettleOutcome | {
|
|
6919
|
+
kind: 'not_offered';
|
|
6920
|
+
}>;
|
|
6500
6921
|
/**
|
|
6501
6922
|
* The count of `record()` calls not yet settled (resolved or rejected). An app holds sign-out
|
|
6502
6923
|
* (closing the store) while this is above 0, because a close that lands under a write stuck in
|
|
@@ -6531,6 +6952,10 @@ type OrderRefundOutcome = {
|
|
|
6531
6952
|
} | {
|
|
6532
6953
|
kind: 'rejected';
|
|
6533
6954
|
error: CommandError;
|
|
6955
|
+
} | {
|
|
6956
|
+
kind: 'needs_admin';
|
|
6957
|
+
reason: string;
|
|
6958
|
+
message: string;
|
|
6534
6959
|
} | {
|
|
6535
6960
|
kind: 'unknown';
|
|
6536
6961
|
reason: string;
|
|
@@ -6542,10 +6967,13 @@ type OrderRefundOutcome = {
|
|
|
6542
6967
|
} | {
|
|
6543
6968
|
kind: 'unauthorized';
|
|
6544
6969
|
};
|
|
6545
|
-
/** Online only, never queued (ADR-080). On unknown, resend the same envelope (same id).
|
|
6970
|
+
/** Online only, never queued (ADR-080). On unknown or needs_admin, resend the same envelope (same id; Check again).
|
|
6546
6971
|
* After rejected, a new attempt needs a new id. Refused and unauthorized mean the store did not take the batch. */
|
|
6547
6972
|
declare function sendOrderRefund(transport: CommandTransport<OrderRefundEnvelope>, envelope: OrderRefundEnvelope): Promise<OrderRefundOutcome>;
|
|
6548
6973
|
|
|
6974
|
+
/** The till's lead line for a refund parked needs_admin, by reason (TallyUI #1280). Only session_closed guarantees no money moved. */
|
|
6975
|
+
declare function refundNeedsAdminLine(reason: string): string;
|
|
6976
|
+
|
|
6549
6977
|
declare class RefundAnswerPendingError extends Error {
|
|
6550
6978
|
readonly record: PosRefund;
|
|
6551
6979
|
readonly code = "REFUND_ANSWER_PENDING";
|
|
@@ -6554,7 +6982,7 @@ declare class RefundAnswerPendingError extends Error {
|
|
|
6554
6982
|
/** Online only, never queued; the record is written before the send.
|
|
6555
6983
|
* An applied record is final; a pending one is resent only with its own envelope
|
|
6556
6984
|
* (ADR-080 amendment 1). */
|
|
6557
|
-
declare function submitOrderRefund(
|
|
6985
|
+
declare function submitOrderRefund(args: {
|
|
6558
6986
|
refunds: PosRefundCollection;
|
|
6559
6987
|
transport: CommandTransport<OrderRefundEnvelope>;
|
|
6560
6988
|
envelope: OrderRefundEnvelope;
|
|
@@ -6564,54 +6992,6 @@ declare function submitOrderRefund({ refunds, transport, envelope, now }: {
|
|
|
6564
6992
|
record: PosRefund;
|
|
6565
6993
|
}>;
|
|
6566
6994
|
|
|
6567
|
-
/**
|
|
6568
|
-
* Ports v2 calculate-refund.ts (calculateLineItemRefund, computeRemainingRefundQuantity).
|
|
6569
|
-
* Amounts follow ADR-080 amendment 2's cumulative-share rule.
|
|
6570
|
-
*/
|
|
6571
|
-
|
|
6572
|
-
/** The fields of an order line this needs; a StoreOrderLine fits. */
|
|
6573
|
-
type RefundableOrderLine = Pick<StoreOrderLine, 'id' | 'quantity' | 'totalMinor' | 'taxMinor'>;
|
|
6574
|
-
/** Earlier refund lines; negative quantities count by magnitude. */
|
|
6575
|
-
interface EarlierRefund {
|
|
6576
|
-
lines: ReadonlyArray<Pick<OrderRefundLine, 'orderLineId' | 'quantity'>>;
|
|
6577
|
-
}
|
|
6578
|
-
/** Remaining quantities and amounts, with earlier refund magnitudes capped at the line quantity. */
|
|
6579
|
-
interface RefundableLine {
|
|
6580
|
-
orderLineId: string;
|
|
6581
|
-
refundedQuantity: number;
|
|
6582
|
-
refundableQuantity: number;
|
|
6583
|
-
netMinor: number;
|
|
6584
|
-
taxMinor: number;
|
|
6585
|
-
}
|
|
6586
|
-
/** A selected quantity's cumulative shares of net and tax, and their sum. */
|
|
6587
|
-
interface PricedRefundLine {
|
|
6588
|
-
orderLineId: string;
|
|
6589
|
-
quantity: number;
|
|
6590
|
-
netMinor: number;
|
|
6591
|
-
taxMinor: number;
|
|
6592
|
-
totalMinor: number;
|
|
6593
|
-
}
|
|
6594
|
-
/** Payload-ready lines and their amounts; the caller adds shipping and adjustment to totalMinor. */
|
|
6595
|
-
interface PricedRefund {
|
|
6596
|
-
/** Exactly orderLineId, quantity (>= 1), and restock. */
|
|
6597
|
-
lines: OrderRefundLine[];
|
|
6598
|
-
/** Amounts in the same order as lines. */
|
|
6599
|
-
priced: PricedRefundLine[];
|
|
6600
|
-
/** Requests cut to availability, including unknown lines cut to zero. */
|
|
6601
|
-
clamped: Array<{
|
|
6602
|
-
orderLineId: string;
|
|
6603
|
-
requestedQuantity: number;
|
|
6604
|
-
quantity: number;
|
|
6605
|
-
}>;
|
|
6606
|
-
netMinor: number;
|
|
6607
|
-
taxMinor: number;
|
|
6608
|
-
totalMinor: number;
|
|
6609
|
-
}
|
|
6610
|
-
/** Returns the quantities and amounts still refundable, in order-line order. */
|
|
6611
|
-
declare function refundableLines(lines: readonly RefundableOrderLine[], refunds: readonly EarlierRefund[]): RefundableLine[];
|
|
6612
|
-
/** Prices requested quantities with cumulative shares, clamping them to what remains refundable. */
|
|
6613
|
-
declare function priceRefund(lines: readonly RefundableOrderLine[], refunds: readonly EarlierRefund[], request: readonly OrderRefundLine[]): PricedRefund;
|
|
6614
|
-
|
|
6615
6995
|
type OrderReopenOutcome = {
|
|
6616
6996
|
kind: 'applied';
|
|
6617
6997
|
reopen: OrderReopenResult;
|
|
@@ -6729,6 +7109,8 @@ interface TenderFacts {
|
|
|
6729
7109
|
/** Currency decimal places; every `*Minor` number is in these units. */
|
|
6730
7110
|
dp: number;
|
|
6731
7111
|
balanceMinor: number;
|
|
7112
|
+
/** The sum of the order's live cashRoundings, already counted in the balance. */
|
|
7113
|
+
entriesMinor?: number;
|
|
6732
7114
|
/** The order's payment legs in ledger order; only those that count toward paid are numbered. */
|
|
6733
7115
|
payments: readonly {
|
|
6734
7116
|
status?: PaymentLegStatus;
|
|
@@ -6836,11 +7218,60 @@ declare function tenderVoidCollection(): {
|
|
|
6836
7218
|
* Port of v2's cash rounding: packages/order-math/src/payments/rounding.ts and
|
|
6837
7219
|
* packages/core/src/screens/main/pos/checkout/tender/tender-figures.ts.
|
|
6838
7220
|
* v2's tender LEDGER: "a partial or short cash entry and every other method keep full precision".
|
|
6839
|
-
*
|
|
7221
|
+
* The till records the rounding as an order field, Order.cashRoundings (ADR-094).
|
|
6840
7222
|
*/
|
|
6841
7223
|
|
|
6842
|
-
/** The
|
|
6843
|
-
declare function
|
|
7224
|
+
/** The nearest payable cash amounts, or null when the amount is already payable. */
|
|
7225
|
+
declare function nearestPayableCash(amountMinor: number, incrementMinor: number): {
|
|
7226
|
+
belowMinor: number;
|
|
7227
|
+
aboveMinor: number;
|
|
7228
|
+
} | null;
|
|
7229
|
+
/** ADR-094 item 7 (carry): a cash part pick rounds its target less `entriesMinor`, the live entries the pick carries against; it defaults to 0, the 5.0.0 per-pick rounding. 0 means cash cannot pay it. */
|
|
7230
|
+
declare function roundedPickTarget(targetMinor: number, rounding: PaymentRounding | null | undefined, entriesMinor?: number): number;
|
|
7231
|
+
/** ADR-094 items 1 and 6: the live entries a remainder rounds against, every entry on the sale (cash-pick entries included since the carry rule). */
|
|
7232
|
+
declare function remainderEntriesMinor(order: {
|
|
7233
|
+
payments: readonly {
|
|
7234
|
+
id: string;
|
|
7235
|
+
method?: string;
|
|
7236
|
+
units?: Readonly<Record<string, number>>;
|
|
7237
|
+
}[];
|
|
7238
|
+
cashRoundings?: readonly {
|
|
7239
|
+
paymentId: string;
|
|
7240
|
+
minor: number;
|
|
7241
|
+
}[];
|
|
7242
|
+
}): number;
|
|
7243
|
+
/**
|
|
7244
|
+
* ADR-094 item 1 (#1365, amended by the carry rule 2026-11-26): the zero-remainder write-off's leg, the last counting leg with
|
|
7245
|
+
* wire method 'cash', else the last counting leg. A later cash leg rounds against a non-cash leg's write-off; `cashVoidRefusal` keeps the entries a stack.
|
|
7246
|
+
*/
|
|
7247
|
+
declare function writeOffLeg<L extends {
|
|
7248
|
+
id: string;
|
|
7249
|
+
method?: string;
|
|
7250
|
+
status?: PaymentLegStatus;
|
|
7251
|
+
units?: Readonly<Record<string, number>>;
|
|
7252
|
+
}>(order: {
|
|
7253
|
+
payments: readonly L[];
|
|
7254
|
+
}): L | undefined;
|
|
7255
|
+
/** Why a void is refused by ADR-094 item 6 (desk ruling (i), #1292): a later live cash leg's entry was computed against this leg's. */
|
|
7256
|
+
type CashVoidRefusal = 'later_cash_rounding';
|
|
7257
|
+
/**
|
|
7258
|
+
* ADR-094 item 6: a leg carrying a live rounding entry cannot be voided while a later live cash leg (wire method 'cash') carries one; the later cash is voided first. A non-cash leg's entry (the zero-remainder write-off) never blocks, so a leg the till cannot void never strands one it can.
|
|
7259
|
+
*/
|
|
7260
|
+
declare function cashVoidRefusal(order: {
|
|
7261
|
+
payments: readonly {
|
|
7262
|
+
id: string;
|
|
7263
|
+
method?: string;
|
|
7264
|
+
status?: PaymentLegStatus;
|
|
7265
|
+
}[];
|
|
7266
|
+
cashRoundings?: readonly {
|
|
7267
|
+
paymentId: string;
|
|
7268
|
+
minor: number;
|
|
7269
|
+
}[];
|
|
7270
|
+
}, paymentId: string): CashVoidRefusal | undefined;
|
|
7271
|
+
/** The balance under a cash method's rounding, with its signed difference. */
|
|
7272
|
+
declare function roundedDue(balanceMinor: number, method: PaymentMethodDescriptor | null,
|
|
7273
|
+
/** The sum of the order's live cashRoundings, already counted in the balance. */
|
|
7274
|
+
entriesMinor?: number): {
|
|
6844
7275
|
dueMinor: number;
|
|
6845
7276
|
roundingMinor: number;
|
|
6846
7277
|
};
|
|
@@ -6856,7 +7287,9 @@ interface TenderRounding {
|
|
|
6856
7287
|
appliedMinor: number;
|
|
6857
7288
|
}
|
|
6858
7289
|
/** Figure the displayed entry and applied amount, rounding only a leg that settles at the due. */
|
|
6859
|
-
declare function tenderRounding(state: Pick<TenderState, 'entryMinor' | 'entryDirty'>, balanceMinor: number, method: PaymentMethodDescriptor | null
|
|
7290
|
+
declare function tenderRounding(state: Pick<TenderState, 'entryMinor' | 'entryDirty'>, balanceMinor: number, method: PaymentMethodDescriptor | null,
|
|
7291
|
+
/** The sum of the order's live cashRoundings, already counted in the balance. */
|
|
7292
|
+
entriesMinor?: number): TenderRounding;
|
|
6860
7293
|
|
|
6861
7294
|
type DatePreset = 'today' | 'yesterday' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth';
|
|
6862
7295
|
declare const DATE_PRESETS: readonly DatePreset[];
|
|
@@ -6881,6 +7314,12 @@ interface SalesTotals {
|
|
|
6881
7314
|
discountMinor: number;
|
|
6882
7315
|
refundsMinor: number;
|
|
6883
7316
|
embeddedRefundsMinor: number;
|
|
7317
|
+
/**
|
|
7318
|
+
* Σ cash roundings in gross; gross = net + tax + rounding (front desk, 22 Nov, Q3).
|
|
7319
|
+
* Only orders built by `reportOrderFromPosOrder` carry one. A store-sourced order (`reportOrderFromStoreOrder`) carries no rounding figure:
|
|
7320
|
+
* Woo stores its rounding as a plain fee line, so that order's rounding stays inside net (#1282, a documented limit).
|
|
7321
|
+
*/
|
|
7322
|
+
roundingMinor: number;
|
|
6884
7323
|
orderCount: number;
|
|
6885
7324
|
averageMinor: number;
|
|
6886
7325
|
items: number;
|
|
@@ -6889,6 +7328,13 @@ interface SalesTotals {
|
|
|
6889
7328
|
/** v2 ordersSummary: the largest order total; null with no orders. */
|
|
6890
7329
|
largestMinor?: number | null;
|
|
6891
7330
|
margin: Margin;
|
|
7331
|
+
/** Which refund figure `grossAfterRefundsMinor` subtracts: `refundsMinor` or `embeddedRefundsMinor`. A report never subtracts both. */
|
|
7332
|
+
refundBasis: 'dated' | 'embedded';
|
|
7333
|
+
/**
|
|
7334
|
+
* `grossMinor` less the basis figure; negative when refunds exceed gross. Gross refunds come off gross only, never
|
|
7335
|
+
* off `netMinor` or any row.
|
|
7336
|
+
*/
|
|
7337
|
+
grossAfterRefundsMinor: number;
|
|
6892
7338
|
}
|
|
6893
7339
|
interface PaymentRow {
|
|
6894
7340
|
method: string;
|
|
@@ -6919,6 +7365,11 @@ interface DayPoint {
|
|
|
6919
7365
|
}
|
|
6920
7366
|
interface SalesFiguresInput {
|
|
6921
7367
|
orders: readonly ReportOrder[];
|
|
7368
|
+
/**
|
|
7369
|
+
* Dated refunds, for every period the report shows. Pass `undefined` (not `[]`) when the store has no dated refunds
|
|
7370
|
+
* (no `listRefunds`, or the store does not support it), so the report uses its orders' embedded refunds.
|
|
7371
|
+
* `useStoreRefundsInRange().refunds` is already in that shape; pass it only once the read is `complete`.
|
|
7372
|
+
*/
|
|
6922
7373
|
refunds?: readonly ReportRefund[];
|
|
6923
7374
|
range: DayRange;
|
|
6924
7375
|
compare?: DayRange;
|
|
@@ -6960,13 +7411,16 @@ declare function daysOf(range: DayRange): StoreDay[];
|
|
|
6960
7411
|
*/
|
|
6961
7412
|
declare function comparisonRange(range: DayRange, mode: 'previous' | 'week', preset?: DatePreset): DayRange;
|
|
6962
7413
|
declare function marginOf(lines: readonly ReportLine[]): Margin;
|
|
7414
|
+
/** The median of minor-unit values: 0 for none; an even count rounds the mean of the middle two (`Math.round`). */
|
|
7415
|
+
declare function medianMinor(values: readonly number[]): number;
|
|
6963
7416
|
declare function salesFigures(input: SalesFiguresInput): SalesFigures;
|
|
6964
7417
|
|
|
6965
7418
|
declare function reportOrderFromPosOrder(order: PosOrder, join?: LineJoin, methodTitle?: (methodId: string) => string | undefined): ReportOrder;
|
|
7419
|
+
/** A store order as a report row, on its paid day (`paidAt`); an order with no `paidAt` (unpaid, or a store that records none) stays on its placed day. */
|
|
6966
7420
|
declare function reportOrderFromStoreOrder(order: StoreOrder, join?: LineJoin): ReportOrder;
|
|
6967
7421
|
declare function reportRefundFromPosRefund(refund: PosRefund): ReportRefund | undefined;
|
|
6968
7422
|
|
|
6969
7423
|
/** @deprecated Use `minorToMajor(minor, digits)` from `@tallyui/core`, which also rejects an amount that is not a safe integer. */
|
|
6970
7424
|
declare const minorToDecimal: (minor: number, exponent: number) => string;
|
|
6971
7425
|
|
|
6972
|
-
export { ADDRESS_CHANGE_REFUSED, AFTER_CLOSE_PAYMENTS_CHANGED, APP_SETTING_DEFINITIONS, type Actor, type AddLineInput, type AppSettingCollection, type AppSettingDefinition, type AppSettingDoc, type AppSettingKey, type AppSettings, type AppliedDiscount, type ApprovalNeeded, BLUETOOTH_PRINT_SERVICES, type BackendNotFound, type BasketLine, type BroadcastChannelLike, CAMERA_BARCODE_TYPES, CAMERA_CONSTRAINTS, CART_COLUMN_IDS, COLLECT_POLL_MS, CONNECT_TIMEOUT_MS, COUPONS_NEED_CONNECTION, COUPONS_REPRICING, COUPONS_UNSUPPORTED, COUPON_CARRIED, COUPON_CARRY_STALE, CUSTOMER_RETAX_REFUSED, type CameraDecoder, type CameraScan, type CartColumnId, type CartColumnsSetting, CartError, type CartQuantityLine, type CashMovement, type CashMovementCollection, type CashierState, type CatalogueEntry, type CatalogueGridColumns, type CatalogueView, type CatalogueViewAction, type CatalogueViewState, type ChargeInput, type ChargeLine, type Closure, type ClosureApprovalStatus, type ClosureCollection, type ClosureContext, type ClosureScope, type CollectInput, type CollectOutcome, type CollectResult, type CommandTransport, type CreateClosureContextOptions, type CsvColumn, CurrencyProvider, type CurrencyProviderProps, type CustomerEditValues, type CustomerSummary, DATE_PRESETS, DECODER_ERROR_THRESHOLD, DEFAULT_APP_SETTINGS, DEFAULT_CATALOGUE_VIEW_STATE, DEFAULT_COOLDOWN_MS, DEFAULT_DECODE_INTERVAL_MS, DEFAULT_MIN_SCAN_CHARS, DEFAULT_RECEIPT_TEMPLATES, DEFAULT_SERIAL_BAUD_RATE, DEFAULT_TILE_FIELDS, DEFAULT_WEDGE_SETTINGS, DETECTOR_FORMATS, DISCOUNTS_UNSUPPORTED, DISPLAY_ACTIONS, DISPLAY_CHANNEL, DISPLAY_PROTOCOL_VERSION, DISPLAY_SIGNAL_POLL_MS, DISPLAY_TEMPLATE, type DatePreset, type DayPoint, type DayRange, type DecodeLoopOptions, type DecodeRefusal, type DecodeResult, type DetectedBarcode, type DeviceScanControl, type DeviceScanControls, type DeviceScanner, type DeviceScannerErrorHandler, type DeviceScannerErrorPhase, type DeviceScannerSettings, type DeviceScannerState, type DeviceScannerStateCell, type Discount, type DisplayAction, type DisplayCart, type DisplayClient, type DisplayClientError, type DisplayClientOptions, type DisplayClientPhase, type DisplayClientView, type DisplayClock, type DisplayConfig, type DisplayEnvelope, type DisplayLine, type DisplayLink, type DisplayPayloads, type DisplayPayment, type DisplayState, type DisplayTemplate, type DisplayTokenStore, type DisplayTotals, type DisplayTransport, type DisplayView, type DrawerTerm, type DrawerTerms, type DriverAvailability, type DriverCapabilities, type DriverStatus, type DriverStatusSource, ENGLISH_CLOSURE_LABELS, ESCPOS_CODE_PAGES, type EarlierRefund, type EncodeEscPosOptions, type EscPosBarcodeOptions, type EscPosBuilder, type EscPosQrOptions, type EscPosSink, type EscPosTransportOptions, type ExtrasNotSent, type FeeLine, type FinalizeOptions, type FloatSuggestion, type FormatWcposReceiptOptions, type GroupRow, HELLO_RETRY_MS, HID_POS_USAGE_PAGE, type HandoverSlipData, type HandoverSlipInput, type HidDeviceLike, type HidInputReportEventLike, type HidLike, type HidPosDecodeOptions, type HidPosResult, type HidScannerOptions, type HttpTransportOptions, INFORMATIONAL_EXTRAS_ORDER_CREATE_VERSION, LINE_EDIT_REFUSED, LIST_POLL_MS, type LedgerRow, type LineItem, type LineJoin, type LineTaxLine, type LogActor, type LogEntry, type LogLevel, type LogMeta, type LogPreset, type LogPresetFilters, type LogSink, type LogSyncRecord, type Logger, MAX_MESSAGE_BYTES, MAX_TENDER_MINOR, META_CHANGE_REFUSED, META_INVALID, MICROS_PER_MINOR, type Margin, type MoneyDivergence, type Movement$1 as Movement, type MovementType, type NetworkSinkOptions, type NoteDelivery, OPEN_ORDERS_POSITIONS, OPEN_SIGNAL_POLL_MS, type OpenOrdersPosition, type OpenSale, type OptionPicks, type Order, type OrderBuilder, type OrderBuilderOptions, OrderContentMismatchError, type OrderCoupon, type OrderCouponContext, type OrderCouponLine, type OrderDownloadProgress, type OrderFilterValue, type OrderManager, type OrderManagerOptions, type OrderOutbox, type OrderOutboxOptions, type OrderRefundOutcome, type OrderReopenOutcome, type OrderTaxTotals, type OrderTransportContext, type OutboxCounts, type OutboxHealth, type OutboxState, PAPER_COLUMNS, PAYMENT_IN_MOTION, PENDING_POLL_MS, PRINTER_PROFILES_COLLECTION, PRODUCT_SORT_FIELDS, type PairingError, type PairingPhase, type ParkedOrderSummary, type Payment, type PaymentDriver, type PaymentDriverRegistry, type PaymentLegStatus, type PaymentMethod, type PaymentPhase, type PaymentRow, type PaymentTransport, type PeerFactory, type PeerLink, type PeerLinkOptions, type PeerLinkState, type PlanLeg, type PosOrder, type PosOrderCoupon, type PosOrderCouponLine, type PosOrderLine, type PosOrderLocalWarning, PosOrderOpenClosedError, type PosOrderPayment, type PosOrderServerFailures, type PosOrderSyncStatus, type PosRefund, type PosRefundCollection, type PosRefundStatus, type PricedRefund, type PricedRefundLine, PrintError, type PrintErrorCode, type PrintJob, type PrintJobKind, type PrintQueue, type PrintQueueOptions, type PrintQueueState, type PrintTransport, type PrintableSale, type PrinterProfile, type PrinterProfileCollection, type ProductSort, type ProductSortValue, type ProductTermGroup, RECEIPT_SCHEMA_VERSION, REGISTER_SESSION_MIGRATION_CLOSE_WAIT_MS, REOPENABLE_CODES, REOPENED_NOT_LOADED, REOPEN_REFUSED_STATUSES, RESTORE_STALE, type RTCDataChannelLike, type RTCPeerConnectionLike, type RateTaxLine, type ReaderInfo, type ReceiptConfig, type ReceiptData, type ReceiptFiscal, type ReceiptLineItem, type ReceiptNode, type ReceiptPaper, type ReceiptRegister, type ReceiptSoftware, type ReceiptTemplateData, type ReceiptTemplateLine, type ReceiptTemplateOptions, type ReceiptTemplateRow, type RecordedFigures, RefundAnswerPendingError, type RefundableLine, type RefundableOrderLine, RegisterApprovalRequiredError, type RegisterBucket, RegisterCloseIncompleteError, type RegisterCommand, type RegisterCommandCollection, type RegisterCounters, type RegisterDocument, type RegisterFact, type RegisterHost, RegisterIdInvalidError, RegisterMovementAmountError, RegisterMovementReasonError, RegisterMovementStrandedError, RegisterNeedsUpgradeError, type RegisterOutbox, type RegisterOutboxOptions, RegisterReapproveError, type RegisterSession, RegisterSessionAlreadyOpenError, RegisterSessionClosedError, type RegisterSessionCollection, RegisterSessionConflictError, RegisterSessionOpenClosedError, RegisterSessionRequiredError, type RegisterStore, RegisterTakeOverError, RegisterTenderInProgressError, type RenderEscposOptions, type RenderReceiptOptions, type RenderSanitizeOptions, ReopenEntryError, type ReopenEntryReason, type ReopenRefusal, ReopenRefusedOrderError, type ReopenStoreOrderOutcome, type ReportCategory, type ReportLine, type ReportOrder, type ReportPayment, type ReportRefund, type ReportTax, type Repository, type ResolvePrinterOptions, type ResolveStoreSettingsOptions, SALE_FINISHED, SALE_HAS_PAYMENT, SALE_IN_TENDER, SALE_PARTLY_PAID, SALE_SAVING, SCANNER_DEVICE_KEY_MAX_LENGTH, SCANNER_PROFILES_COLLECTION, SCAN_DEDUP_WINDOW_MS, SIGNAL_POLL_MS, SIMULATED_PROVIDER, SIMULATED_TIMING, SNAPSHOT_LIFETIME_MS, SNAPSHOT_MIN_INTERVAL_MS, SNAPSHOT_POLL_MS, SNAPSHOT_RESEND_MS, SPLIT_FIXED_DISCOUNT, STANDARD_SPP_SERVICE_CLASS_ID, STORE_ORDER_OPEN_HERE, SYSTEM_PRINTER_ID, SYSTEM_PRINT_TIMING, type SaleDiscountCodes, type SaleDiscountState, type SaleDisplayInput, type SaleDisplayOptions, type SaleDisplayPublisher, type SaleRemoval, type SaleStage, type SaleTaxContext, type SaleTaxLocation, type SalesFigures, type SalesFiguresInput, type SalesTotals, type SanitizeHtmlOptions, type ScanBus, type ScanEvent, type ScanHub, ScanHubProvider, type ScanHubProviderProps, type ScanOfferResult, type ScanRejectReason, type ScanSession, type ScanSessionOptions, type ScanSource, type ScanSourceKind, type ScanTraceSettings, type ScannerConnectionType, type ScannerIdentity, type ScannerProfile, type ScannerProfileCollection, type ScannerProfileStore, type ScannerTransport, type SentOrder, type SerialLike, type SerialLineDecoder, type SerialLineDecoderOptions, type SerialPortInfoLike, type SerialPortLike, type SerialScannerOptions, type ServiceClock, type SessionDescriptionLike, type ShippingLine, type SignalPort, type SimulatedDriverOptions, type SimulatedReaderId, type SnapshotBody, type SnapshotSender, type SnapshotSenderOptions, type SplitTab, type SplitUnitLine, type StoreDay, type StoreOrdersInRange, type StoreOrdersRangeQuery, type StorePricedAccepted, type StorePricedCodePricing, type StorePricedCoupon, type StorePricedCouponContext, type StorePricedDiscountCodesOptions, type StoreSettingsResolution, type StoreSettingsState, type StoreTemplateContext, type StuckRecord, type SwitchKind, type SwitchWarning, type SwitchWarningInput, type SwitchWarnings, type SyncRecordOutcome, type SystemPrintTransportOptions, TAX_ADDRESS_ORDER_CREATE_VERSION, TAX_IDS_CHANGE_REFUSED, TAX_IDS_INVALID, TAX_ROUNDING_MIXED_NOTE, TAX_STORE_PAID_NOTE, TENDER_GATE_FAILED, TENDER_SALE_CHANGED, TILE_FIELDS, type TaxContext, type TaxDerivation, type TaxDerivationClass, type TaxDerivationRate, type TaxLineInput, TaxProvider, type TaxProviderProps, type TaxRateMap, type TaxRateWhy, type TaxRow, type TenderAction, type TenderFacts, type TenderFigures, type TenderKey, type TenderLineId, type TenderPlan, type TenderRounding, type TenderState, type TenderView, type TenderVoid, type ThermalNode, type TileField, type TileFields, type TillDeviceHandle, type TillDeviceKeyStore, type TillDeviceOptions, type TillDisplayEntry, type TillDisplayPauseReason, type TillDisplayService, type TillDisplayServiceOptions, type TillDisplayStatus, type TillDisplaysView, type TillPairing, type TillPairingOptions, type TillPairingView, type TraceAnalysis, type TraceKey, type TraceSuggestion, type TransportOutcome, UI_SCALES, UI_THEMES, UNTAXED_ADDRESS_ORDER_CREATE_VERSION, UPDATE_UNSENDABLE, UPDATE_UNSENDABLE_MESSAGE, type UiScale, type UiTheme, type UnitAllocations, UnsupportedOrderVersionError, type UseBarcodeScannerOptions, type UseCameraScanOptions, type UseOrderOutboxOptions, type UseOrderOutboxResult, type UseOutboxHealthOptions, type UseOutboxHealthResult, type UseRegisterOutboxOptions, type UseRegisterOutboxResult, type UseRegisterSessionOptions, type ViewfinderStatus, WCPOS_DEFAULT_I18N, WCPOS_TAX_ID_LABELS, WEDGE_END_OF_SCAN_MS, type WcposLineView, type WcposMoneyOptions, type WcposReceiptData, type WcposReceiptDate, type WcposReceiptLine, type WcposReceiptOptions, type WcposReceiptSource, type WcposReceiptStore, type WcposReceiptView, type WcposTaxId, type WebBluetoothDevice, type WebBluetoothSinkOptions, type WebUsbDevice, type WebUsbSinkOptions, type WedgeDetector, type WedgeDetectorOptions, type WedgeReplayResult, type WedgeScanMeta, type WedgeSettings, type WedgeState, abandonSession, activePlan, addEntryToCart, addPosOrderCollection, addPrinterProfileCollection, addRegisterSessionCollection, addScannerProfileCollection, adoptRegisterResults, advancePerpetual, allocateOrderDiscount, analyzeScanTrace, appSettingCollection, appSettingSchema, appSettings$, appliedMinor, backToSelling, bindRegister, buildClosureDocument, buildReceiptData, buildReceiptDataFromPosOrder, buildReceiptDataFromStoreOrder, buildXReportDocument, callbackSink, cameraErrorStatus, can, canMoveLeg, canOpenDrawer, canVoidLeg, capturedMinor, cartQuantities, cashMovementSchema, catalogueEntries, catalogueViewReducer, changeMinor, clampClosureScope, closeNeedsApproval, closeSession, closureApprovalStatus, closureCommand, closureSchema, closureVariance, comparisonRange, computeOrderTax, consoleSink, countVariance, countsTowardPaid, couponPricingBasis, createBackendNotFound, createBroadcastDisplayTransport, createClosureContext, createDeviceScannerStateCell, createDisplayClient, createDisplayLink, createDisplayPeerLink, createEpsonEposSink, createEscPosTransport, createHidScanner, createHttpCommandTransport, createLogger, createOrderBuilder, createOrderManager, createOrderOutbox, createPaymentDriverRegistry, createPrintQueue, createRegisterOutbox, createRepository, createSaleDisplayPublisher, createScanBus, createScanHub, createScanSession, createSerialLineDecoder, createSerialScanner, createSimulatedDriver, createSnapshotSender, createStarWebPrntSink, createStorePricedDiscountCodes, createSystemPrintTransport, createTaxContext, createTillDevice, createTillDisplayService, createTillPairing, createTillPeerLink, createWebBluetoothSink, createWebUsbSink, createWedgeDetector, createWedgeState, csvCell, csvFromCells, daysOf, decode as decodeDisplayMessage, decodeHidPosReport, dedupeScans, denominationTotal, denominations, deriveDrawerTerms, deriveExpected, derivePaymentEvent, deriveSettled, deriveStuckRecords, detectorFormatToSymbology, disabledOptions, displayCart, displayReducer, driverForMethod, encode as encodeDisplayMessage, encodeEscPos, encodeThermalTemplate, ensureRegister, escpos, evenSplitShareMinor, exportCsv, extrasNotSent, finalizeOrder, findEntryByCode, foldWedgeKey, formatClosureDate, formatDecimalMoney, formatWcposMoney, formatWcposReceiptData, getBoundRegisterId, getDeviceId, handoverSlip, hasActor, hasTerm, hasValidRetailCheckDigit, heldUnitsByLine, inCategory, inMotionMinor, inRange, inertDeviceScanControls, inertScanHub, initTenderState, initialDisplayState, initialTenderState, isCanonicalUuid, isCarriedCouponLabel, isChooserCancel, isInMotion, isKnownSessionStatus, isLiveAtStore, isOrderReopenInFlight, isPartlyPaid, isRegisterRequeueable, isReopenOffered, isReopened, isRequeueable, isRequeueableOrder, isServerDecimal, isWebHidSupported, isWebSerialSupported, labelKeys, legStatus, listCategories, listTermGroups, lockedRefundDueMinor, makeEnvelope, marginOf, markAttentionHandled, matchVariant, matchesPresetFilters, messageBytes, methodDrivers, methodForProvider, minorToDecimal, mintClosureNumber, mintUuid, moneyDivergence, movementCommand, movementFieldError, nativeBarcodeDetector, needsAttention, networkSinkFor, nextSaleCounter, normalizeAmount, normalizeCatalogueViewState, normalizeRetailCode, normalizeTileFields, normalizeUuid, noteDelivery, observeRegister$, openDrawerJob, openSales, openSession, openSessionSelector, orderDraftSchema, orderFiltersQuery, outboxLogger, overThreshold, paidUnitsByLine, parkedOrderSummaries$, parseMinor, parseXml, percentOfMinor, pickedUnitsMinor, planLegs, posOrderCollection, posOrderSchema, posOrdersLogger, posRefundCollection, posRefundSchema, presetFilters, presetRange, priceRefund, printerProfileCollection, printerProfileSchema, productCategories, productSortValue, productTerms, quickTenderedAmounts, readAppSettings, readBoundRegister, readRegister, readScannerProfiles, reapproveClosure, receiptTemplateData, reconcileRegisterCommands, recordMovement, recordRegisterFact, refundDueOf, refundableLines, registerCommandCollection, registerCommandSchema, registerCommandsLogger, registerFactsLogger, registerSessionCollection, registerSessionSchema, registerSessionsLogger, removeScannerProfile, renderEscpos, renderHtml, renderLogiclessTemplate, renderReceiptHtml, renderReceiptTemplate, renderStoreReceiptTemplate, renderThermalPreview, reopenRefusedOrder, reopenStoreOrder, replacedOrderIds, replayWedgeDetector, reportOrderFromPosOrder, reportOrderFromStoreOrder, reportRefundFromPosRefund, requireOpenSession, resolveAppSettings, resolveGridColumns, resolvePrinter, resolveStoreSettings, restoreOrderDraft, retailCodeTwin, roundMicrosToMinor, roundedDue, runsWholeOrder, saleLogger, saleTaxContexts, salesFigures, sameSale, sanitizeHtml, saveScannerProfile, scanTimeOf, scannerDeviceKey, scannerProfileCollection, scannerProfileSchema, scannerProfileStore, scannerProfiles$, scannerTransport, searchProducts, selectClosureRows, sendOrderRefund, sendOrderReopen, serialPortIdentity, sessionOpenCommand, sessionTransitionCommand, shipsToBilling, sortProducts, splitUnitLines, stampSession, startCounting, startDecodeLoop, stockOverlay$, stockOverlayAsOf$, storeOrderForReopen, stripBoundary, submitOrderRefund, suggestFloat, summarizeOutboxHealth, switchWarnings, takeOverSession, takingsByMethod, taxDerivation, taxFiguresForBasket, taxLinesByRate, taxLogger, taxMicros, taxProviderProps, taxSettingsForLocation, taxedLinesFor, templateColumns, tenderFigures, tenderReducer, tenderRounding, tenderVoidCollection, tenderVoidSchema, tillLegsTheStoreRefuses, toCsv, toCustomerInput, toCustomerPatch, toOrderCreateEnvelope, toOrderUpdateEnvelope, toPrintError, unbindRegister, unitAllocationsFromLegs, unitsMinor, unpaidUnitsByLine, useAppSettings, useBarcodeScanner, useCameraScan, useCashier, useCurrencyCode, useCurrencyFormatter, useCustomerDisplay, useDeviceScanControls, useDisplayClient, useOrderOutbox, useOutboxHealth, useParkedSales, useRegisterOutbox, useRegisterSession, useSale, useSaleDisplay, useScanHub, useStoreOrdersInRange, useStoreSettings, useTax, useTillDisplays, useTillPairing, uuidv7, validAmount, varianceText, variantFits, variantPriceLabel, voidMovement, watchOutboxHealth, wcposReceiptContext, wcposReceiptData, wcposSourceFromPosOrder, wcposSourceFromSentOrder, wcposSourceFromStoreOrder, withPricingContext, index as woocommerceDiscountCodes, writeAppSetting, writeClosure, writeOrderDraft };
|
|
7426
|
+
export { ADDRESS_CHANGE_REFUSED, AFTER_CLOSE_PAYMENTS_CHANGED, APP_SETTING_DEFINITIONS, type Actor, type AddLineInput, type AppSettingCollection, type AppSettingDefinition, type AppSettingDoc, type AppSettingKey, type AppSettings, type AppliedDiscount, type ApprovalNeeded, BLUETOOTH_PRINT_SERVICES, type BackendNotFound, type BasketLine, type BroadcastChannelLike, CAMERA_BARCODE_TYPES, CAMERA_CONSTRAINTS, CART_COLUMN_IDS, CASH_NOT_PAYABLE, CASH_PICK_ENTRIES_MAX, CASH_PICK_LIMIT, CASH_SETTLE_LIMIT, CASH_WAITS_FOR_PAYMENT, COLLECT_POLL_MS, CONNECT_TIMEOUT_MS, COUPONS_NEED_CONNECTION, COUPONS_REPRICING, COUPONS_UNSUPPORTED, COUPON_CARRIED, COUPON_CARRY_STALE, CUSTOMER_RETAX_REFUSED, type CameraDecoder, type CameraScan, type CancelOnStoreDeps, type CartColumnId, type CartColumnsSetting, CartError, type CartQuantityLine, type CashMovement, type CashMovementCollection, type CashRounding, type CashVoidRefusal, type CashierState, type CatalogueEntry, type CatalogueGridColumns, type CatalogueView, type CatalogueViewAction, type CatalogueViewState, type ChargeInput, type ChargeLine, type Closure, type ClosureApprovalStatus, type ClosureCollection, type ClosureContext, type ClosureFigures, type ClosureScope, type CollectInput, type CollectOutcome, type CollectResult, type CommandTransport, type CreateClosureContextOptions, type CsvColumn, CurrencyProvider, type CurrencyProviderProps, type CustomerEditValues, type CustomerSummary, DATE_PRESETS, DECODER_ERROR_THRESHOLD, DEFAULT_APP_SETTINGS, DEFAULT_CATALOGUE_VIEW_STATE, DEFAULT_COOLDOWN_MS, DEFAULT_DECODE_INTERVAL_MS, DEFAULT_MIN_SCAN_CHARS, DEFAULT_RECEIPT_TEMPLATES, DEFAULT_SERIAL_BAUD_RATE, DEFAULT_TILE_FIELDS, DEFAULT_WEDGE_SETTINGS, DETECTOR_FORMATS, DISCOUNTS_UNSUPPORTED, DISPLAY_ACTIONS, DISPLAY_CHANNEL, DISPLAY_PROTOCOL_VERSION, DISPLAY_SIGNAL_POLL_MS, DISPLAY_TEMPLATE, type DatePreset, type DayPoint, type DayRange, type DecodeLoopOptions, type DecodeRefusal, type DecodeResult, type DetectedBarcode, type DeviceScanControl, type DeviceScanControls, type DeviceScanner, type DeviceScannerErrorHandler, type DeviceScannerErrorPhase, type DeviceScannerSettings, type DeviceScannerState, type DeviceScannerStateCell, type Discount, type DisplayAction, type DisplayCart, type DisplayClient, type DisplayClientError, type DisplayClientOptions, type DisplayClientPhase, type DisplayClientView, type DisplayClock, type DisplayConfig, type DisplayEnvelope, type DisplayLine, type DisplayLink, type DisplayPayloads, type DisplayPayment, type DisplayState, type DisplayTemplate, type DisplayTokenStore, type DisplayTotals, type DisplayTransport, type DisplayView, type DrawerTerm, type DrawerTerms, type DriverAvailability, type DriverCapabilities, type DriverStatus, type DriverStatusSource, ENGLISH_CLOSURE_LABELS, ESCPOS_CODE_PAGES, type EncodeEscPosOptions, type EscPosBarcodeOptions, type EscPosBuilder, type EscPosQrOptions, type EscPosSink, type EscPosTransportOptions, type ExtrasNotSent, type FeeLine, type FinalizeOptions, type FloatSuggestion, type FormatWcposReceiptOptions, type GroupRow, HELLO_RETRY_MS, HID_POS_USAGE_PAGE, type HandoverSlipData, type HandoverSlipInput, type HidDeviceLike, type HidInputReportEventLike, type HidLike, type HidPosDecodeOptions, type HidPosResult, type HidScannerOptions, type HttpTransportOptions, INFORMATIONAL_EXTRAS_ORDER_CREATE_VERSION, LINE_EDIT_REFUSED, LIST_POLL_MS, type LedgerRow, type LineItem, type LineJoin, type LineTaxLine, type LogActor, type LogEntry, type LogLevel, type LogMeta, type LogPreset, type LogPresetFilters, type LogSink, type LogSyncRecord, type Logger, MAX_MESSAGE_BYTES, MAX_TENDER_MINOR, META_CHANGE_REFUSED, META_INVALID, MICROS_PER_MINOR, type Margin, type MoneyDivergence, type Movement$1 as Movement, type MovementType, NEEDS_ADMIN_RETRY_PREFIX, NOTHING_DUE, NOTHING_TO_ROUND_AGAINST, type NeedsAdminAnswer, type NetworkSinkOptions, type NoteDelivery, OPEN_ORDERS_POSITIONS, OPEN_SIGNAL_POLL_MS, type OpenOrdersPosition, type OpenSale, type OptionPicks, type Order, type OrderBuilder, type OrderBuilderOptions, OrderContentMismatchError, type OrderCoupon, type OrderCouponContext, type OrderCouponLine, type OrderDownloadProgress, type OrderFilterValue, type OrderManager, type OrderManagerOptions, type OrderOutbox, type OrderOutboxOptions, type OrderRefundOutcome, type OrderReopenOutcome, type OrderTaxTotals, type OrderTransportContext, type OtherCurrencyRefunds, type OutboxCounts, type OutboxHealth, type OutboxState, PAPER_COLUMNS, PAYMENT_IN_MOTION, PAYMENT_TAKEN, PENDING_POLL_MS, PRINTER_PROFILES_COLLECTION, PRODUCT_SORT_FIELDS, type PairingError, type PairingPhase, type ParkedOrderSummary, type PayRestOnStoreDeps, type Payment, type PaymentDriver, type PaymentDriverRegistry, type PaymentLegStatus, type PaymentMethod, type PaymentPhase, type PaymentRow, type PaymentTransport, type PeerFactory, type PeerLink, type PeerLinkOptions, type PeerLinkState, type PlanLeg, type PosOrder, type PosOrderCoupon, type PosOrderCouponLine, type PosOrderLine, type PosOrderLocalWarning, PosOrderOpenClosedError, type PosOrderPayment, type PosOrderServerFailures, type PosOrderStoreSettlement, type PosOrderSyncStatus, type PosRefund, type PosRefundCollection, type PosRefundStatus, PrintError, type PrintErrorCode, type PrintJob, type PrintJobKind, type PrintQueue, type PrintQueueOptions, type PrintQueueState, type PrintTransport, type PrintableSale, type PrinterProfile, type PrinterProfileCollection, type ProductSort, type ProductSortValue, type ProductTermGroup, RECEIPT_SCHEMA_VERSION, REGISTER_CLOSING, REGISTER_SESSION_MIGRATION_CLOSE_WAIT_MS, REOPENABLE_CODES, REOPENED_NOT_LOADED, REOPEN_REFUSED_STATUSES, RESTORE_STALE, type RTCDataChannelLike, type RTCPeerConnectionLike, type RateTaxLine, type ReaderInfo, type ReceiptConfig, type ReceiptData, type ReceiptFiscal, type ReceiptLineItem, type ReceiptNode, type ReceiptPaper, type ReceiptRegister, type ReceiptSoftware, type ReceiptTemplateData, type ReceiptTemplateLine, type ReceiptTemplateOptions, type ReceiptTemplateRow, type RecordedFigures, RefundAnswerPendingError, RegisterApprovalRequiredError, type RegisterBucket, RegisterCloseIncompleteError, type RegisterCommand, type RegisterCommandCollection, type RegisterCounters, type RegisterDocument, type RegisterFact, type RegisterHost, RegisterIdInvalidError, RegisterMovementAmountError, RegisterMovementReasonError, RegisterMovementStrandedError, RegisterNeedsUpgradeError, type RegisterOutbox, type RegisterOutboxOptions, RegisterReapproveError, RegisterSaleSavingError, type RegisterSession, RegisterSessionAlreadyOpenError, RegisterSessionClosedError, type RegisterSessionCollection, RegisterSessionConflictError, RegisterSessionOpenClosedError, RegisterSessionRequiredError, type RegisterStore, RegisterTakeOverError, RegisterTenderInProgressError, type RenderEscposOptions, type RenderReceiptOptions, type RenderSanitizeOptions, ReopenEntryError, type ReopenEntryReason, type ReopenRefusal, ReopenRefusedOrderError, type ReopenStoreOrderOutcome, type ReportCategory, type ReportLine, type ReportOrder, type ReportPayment, type ReportRefund, type ReportTax, type Repository, type ResolvePrinterOptions, type ResolveStoreSettingsOptions, SALE_CARD_IN_PROGRESS, SALE_FINISHED, SALE_HAS_PAYMENT, SALE_IN_TENDER, SALE_PARTLY_PAID, SALE_SAVING, SCANNER_DEVICE_KEY_MAX_LENGTH, SCANNER_PROFILES_COLLECTION, SCAN_DEDUP_WINDOW_MS, SIGNAL_POLL_MS, SIMULATED_PROVIDER, SIMULATED_TIMING, SNAPSHOT_LIFETIME_MS, SNAPSHOT_MIN_INTERVAL_MS, SNAPSHOT_POLL_MS, SNAPSHOT_RESEND_MS, SPLIT_FIXED_DISCOUNT, STANDARD_SPP_SERVICE_CLASS_ID, STORE_ORDER_OPEN_HERE, SYSTEM_PRINTER_ID, SYSTEM_PRINT_TIMING, type SaleDiscountCodes, type SaleDiscountState, type SaleDisplayInput, type SaleDisplayOptions, type SaleDisplayPublisher, type SaleRemoval, type SaleStage, type SaleTaxContext, type SaleTaxLocation, type SalesFigures, type SalesFiguresInput, type SalesTotals, type SanitizeHtmlOptions, type ScanBus, type ScanEvent, type ScanHub, ScanHubProvider, type ScanHubProviderProps, type ScanOfferResult, type ScanRejectReason, type ScanSession, type ScanSessionOptions, type ScanSource, type ScanSourceKind, type ScanTraceSettings, type ScannerConnectionType, type ScannerIdentity, type ScannerProfile, type ScannerProfileCollection, type ScannerProfileStore, type ScannerTransport, type SentOrder, type SerialLike, type SerialLineDecoder, type SerialLineDecoderOptions, type SerialPortInfoLike, type SerialPortLike, type SerialScannerOptions, type ServiceClock, type SessionDescriptionLike, type ShippingLine, type SignalPort, type SimulatedDriverOptions, type SimulatedReaderId, type SnapshotBody, type SnapshotSender, type SnapshotSenderOptions, type SplitTab, type SplitUnitLine, type StoreDay, type StoreOrdersInRange, type StoreOrdersRangeQuery, type StorePricedAccepted, type StorePricedCodePricing, type StorePricedCoupon, type StorePricedCouponContext, type StorePricedDiscountCodesOptions, type StoreRefundsInRange, type StoreRefundsRangeQuery, type StoreSettingsResolution, type StoreSettingsState, type StoreTemplateContext, type StuckRecord, type SwitchKind, type SwitchWarning, type SwitchWarningInput, type SwitchWarnings, type SyncRecordOutcome, type SystemPrintTransportOptions, TAX_ADDRESS_ORDER_CREATE_VERSION, TAX_IDS_CHANGE_REFUSED, TAX_IDS_INVALID, TAX_ROUNDING_MIXED_NOTE, TAX_STORE_PAID_NOTE, TENDER_GATE_FAILED, TENDER_SALE_CHANGED, TILE_FIELDS, type TaxContext, type TaxDerivation, type TaxDerivationClass, type TaxDerivationRate, type TaxLineInput, TaxProvider, type TaxProviderProps, type TaxRateMap, type TaxRateWhy, type TaxRow, type TenderAction, type TenderFacts, type TenderFigures, type TenderKey, type TenderLineId, type TenderPlan, type TenderRounding, type TenderState, type TenderView, type TenderVoid, type ThermalNode, type TileField, type TileFields, type TillDeviceHandle, type TillDeviceKeyStore, type TillDeviceOptions, type TillDisplayEntry, type TillDisplayPauseReason, type TillDisplayService, type TillDisplayServiceOptions, type TillDisplayStatus, type TillDisplaysView, type TillPairing, type TillPairingOptions, type TillPairingView, type TraceAnalysis, type TraceKey, type TraceSuggestion, type TransportOutcome, UI_SCALES, UI_THEMES, UNTAXED_ADDRESS_ORDER_CREATE_VERSION, UPDATE_UNSENDABLE, UPDATE_UNSENDABLE_MESSAGE, type UiScale, type UiTheme, type UnitAllocations, UnsupportedOrderVersionError, type UseBarcodeScannerOptions, type UseCameraScanOptions, type UseOrderOutboxOptions, type UseOrderOutboxResult, type UseOutboxHealthOptions, type UseOutboxHealthResult, type UseRegisterOutboxOptions, type UseRegisterOutboxResult, type UseRegisterSessionOptions, VOID_LATER_CASH_FIRST, type ViewfinderStatus, WCPOS_DEFAULT_I18N, WCPOS_TAX_ID_LABELS, WEDGE_END_OF_SCAN_MS, type WcposLineView, type WcposMoneyOptions, type WcposReceiptData, type WcposReceiptDate, type WcposReceiptLine, type WcposReceiptOptions, type WcposReceiptSource, type WcposReceiptStore, type WcposReceiptView, type WcposTaxId, type WebBluetoothDevice, type WebBluetoothSinkOptions, type WebUsbDevice, type WebUsbSinkOptions, type WedgeDetector, type WedgeDetectorOptions, type WedgeReplayResult, type WedgeScanMeta, type WedgeSettings, type WedgeState, abandonSession, activePlan, addEntryToCart, addPosOrderCollection, addPrinterProfileCollection, addRegisterSessionCollection, addScannerProfileCollection, adoptRegisterResults, advancePerpetual, allocateOrderDiscount, analyzeScanTrace, appSettingCollection, appSettingSchema, appSettings$, appliedMinor, backToSelling, bindRegister, buildClosureDocument, buildReceiptData, buildReceiptDataFromPosOrder, buildReceiptDataFromStoreOrder, buildXReportDocument, callbackSink, cameraErrorStatus, can, canCancelOnStore, canMoveLeg, canOpenDrawer, canPayRestOnStore, canVoidLeg, cancelOnStore, capturedMinor, cartQuantities, cashMovementSchema, cashVoidRefusal, catalogueEntries, catalogueViewReducer, changeMinor, clampClosureScope, closeNeedsApproval, closeSession, closureApprovalStatus, closureCommand, closureFigures, closureSchema, closureVariance, comparisonRange, computeOrderTax, consoleSink, countVariance, countsTowardPaid, couponPricingBasis, createBackendNotFound, createBroadcastDisplayTransport, createClosureContext, createDeviceScannerStateCell, createDisplayClient, createDisplayLink, createDisplayPeerLink, createEpsonEposSink, createEscPosTransport, createHidScanner, createHttpCommandTransport, createLogger, createOrderBuilder, createOrderManager, createOrderOutbox, createPaymentDriverRegistry, createPrintQueue, createRegisterOutbox, createRepository, createSaleDisplayPublisher, createScanBus, createScanHub, createScanSession, createSerialLineDecoder, createSerialScanner, createSimulatedDriver, createSnapshotSender, createStarWebPrntSink, createStorePricedDiscountCodes, createSystemPrintTransport, createTaxContext, createTillDevice, createTillDisplayService, createTillPairing, createTillPeerLink, createWebBluetoothSink, createWebUsbSink, createWedgeDetector, createWedgeState, csvCell, csvFromCells, daysOf, decode as decodeDisplayMessage, decodeHidPosReport, dedupeScans, denominationTotal, denominations, deriveDrawerTerms, deriveExpected, derivePaymentEvent, deriveSettled, deriveStuckRecords, detectorFormatToSymbology, disabledOptions, displayCart, displayReducer, driverForMethod, encode as encodeDisplayMessage, encodeEscPos, encodeThermalTemplate, ensureRegister, escpos, evenSplitShareMinor, exportCsv, extrasNotSent, finalizeOrder, findEntryByCode, foldWedgeKey, formatClosureDate, formatDecimalMoney, formatWcposMoney, formatWcposReceiptData, getBoundRegisterId, getDeviceId, handoverSlip, hasActor, hasTerm, hasValidRetailCheckDigit, heldUnitsByLine, inCategory, inMotionMinor, inRange, inertDeviceScanControls, inertScanHub, initTenderState, initialDisplayState, initialTenderState, isCanonicalUuid, isCarriedCouponLabel, isChooserCancel, isInMotion, isKnownSessionStatus, isLiveAtStore, isOrderReopenInFlight, isPartlyPaid, isRegisterRequeueable, isReopenOffered, isReopened, isRequeueable, isRequeueableOrder, isServerDecimal, isWebHidSupported, isWebSerialSupported, labelKeys, legStatus, listCategories, listTermGroups, lockedRefundDueMinor, makeEnvelope, marginOf, markAttentionHandled, matchVariant, matchesPresetFilters, medianMinor, messageBytes, methodDrivers, methodForProvider, minorToDecimal, mintClosureNumber, mintUuid, moneyDivergence, movementCommand, movementFieldError, nativeBarcodeDetector, nearestPayableCash, needsAdminReasonOf, needsAttention, networkSinkFor, nextSaleCounter, normalizeAmount, normalizeCatalogueViewState, normalizeRetailCode, normalizeTileFields, normalizeUuid, noteDelivery, observeRegister$, openDrawerJob, openSales, openSession, openSessionSelector, orderDraftSchema, orderFiltersQuery, outboxLogger, overThreshold, paidUnitsByLine, parkedOrderSummaries$, parseMinor, parseXml, payRestOnStore, percentOfMinor, pickedUnitsMinor, planLegs, posOrderCollection, posOrderSchema, posOrdersLogger, posRefundCollection, posRefundSchema, presetFilters, presetRange, printerProfileCollection, printerProfileSchema, productCategories, productSortValue, productTerms, quickTenderedAmounts, readAppSettings, readBoundRegister, readRegister, readScannerProfiles, reapproveClosure, receiptTemplateData, reconcileRegisterCommands, recordMovement, recordRegisterFact, refundDueOf, refundNeedsAdminLine, registerCommandCollection, registerCommandSchema, registerCommandsLogger, registerFactsLogger, registerSessionCollection, registerSessionSchema, registerSessionsLogger, remainderEntriesMinor, removeScannerProfile, renderEscpos, renderHtml, renderLogiclessTemplate, renderReceiptHtml, renderReceiptTemplate, renderStoreReceiptTemplate, renderThermalPreview, reopenRefusedOrder, reopenStoreOrder, replacedOrderIds, replayWedgeDetector, reportOrderFromPosOrder, reportOrderFromStoreOrder, reportRefundFromPosRefund, requireOpenSession, resolveAppSettings, resolveGridColumns, resolvePrinter, resolveStoreSettings, restoreOrderDraft, retailCodeTwin, roundMicrosToMinor, roundedDue, roundedPickTarget, runsWholeOrder, saleLogger, saleTaxContexts, salesFigures, salesRangeQuery, sameSale, sanitizeHtml, saveScannerProfile, scanTimeOf, scannerDeviceKey, scannerProfileCollection, scannerProfileSchema, scannerProfileStore, scannerProfiles$, scannerTransport, searchProducts, selectClosureRows, sendOrderRefund, sendOrderReopen, serialPortIdentity, sessionOpenCommand, sessionTransitionCommand, settledOnStore, shipsToBilling, sortProducts, splitUnitLines, stampSession, startCounting, startDecodeLoop, stockOverlay$, stockOverlayAsOf$, storeOrderForReopen, storeOrderLeft, stripBoundary, submitOrderRefund, suggestFloat, summarizeOutboxHealth, switchWarnings, takeOverSession, takingsByMethod, taxDerivation, taxFiguresForBasket, taxLinesByRate, taxLogger, taxMicros, taxProviderProps, taxSettingsForLocation, taxedLinesFor, templateColumns, tenderFigures, tenderReducer, tenderRounding, tenderVoidCollection, tenderVoidSchema, tillLegsTheStoreRefuses, toCsv, toCustomerInput, toCustomerPatch, toOrderCreateEnvelope, toOrderUpdateEnvelope, toPrintError, unbindRegister, unitAllocationsFromLegs, unitsMinor, unpaidUnitsByLine, unrecordedLegs, useAppSettings, useBarcodeScanner, useCameraScan, useCashier, useCurrencyCode, useCurrencyFormatter, useCustomerDisplay, useDeviceScanControls, useDisplayClient, useOrderOutbox, useOutboxHealth, useParkedSales, useRegisterOutbox, useRegisterSession, useSale, useSaleDisplay, useScanHub, useStoreOrdersInRange, useStoreRefundsInRange, useStoreSettings, useTax, useTillDisplays, useTillPairing, uuidv7, validAmount, varianceText, variantFits, variantPriceLabel, voidMovement, watchOutboxHealth, wcposReceiptContext, wcposReceiptData, wcposSourceFromPosOrder, wcposSourceFromSentOrder, wcposSourceFromStoreOrder, withPricingContext, index as woocommerceDiscountCodes, writeAppSetting, writeClosure, writeOffLeg, writeOrderDraft };
|