@tallyui/pos 3.20.1 → 4.0.1

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.
Files changed (117) hide show
  1. package/dist/index.d.ts +1008 -111
  2. package/dist/index.js +3158 -907
  3. package/package.json +6 -6
  4. package/src/app-settings/app-settings.ts +77 -0
  5. package/src/app-settings/index.ts +2 -0
  6. package/src/currency/currency-provider.tsx +5 -7
  7. package/src/currency/index.ts +1 -1
  8. package/src/customer/customer-patch.ts +70 -0
  9. package/src/customer-display/display-client.ts +11 -17
  10. package/src/customer-display/display-link.ts +10 -5
  11. package/src/customer-display/index.ts +3 -1
  12. package/src/customer-display/protocol.ts +1 -1
  13. package/src/customer-display/sale-display.ts +6 -8
  14. package/src/customer-display/snapshot-fallback.ts +14 -1
  15. package/src/customer-display/till-device.ts +62 -0
  16. package/src/customer-display/till-display-service.ts +44 -42
  17. package/src/customer-display/till-pairing.ts +20 -23
  18. package/src/customer-display/use-customer-display.ts +2 -1
  19. package/src/customer-display/use-till-pairing.ts +4 -4
  20. package/src/index.ts +37 -18
  21. package/src/order/allocate-order-discount.ts +5 -17
  22. package/src/order/apportion.ts +29 -0
  23. package/src/order/from-store-order.ts +115 -0
  24. package/src/order/index.ts +1 -0
  25. package/src/order/order-builder.ts +239 -52
  26. package/src/order/order-drafts.ts +46 -6
  27. package/src/order/order-manager.ts +2 -1
  28. package/src/order/tax-ids.ts +27 -0
  29. package/src/order/types.ts +61 -5
  30. package/src/order/woocommerce-tax.ts +9 -0
  31. package/src/outbox/index.ts +1 -1
  32. package/src/outbox/order-outbox.ts +138 -43
  33. package/src/outbox/register-outbox.ts +4 -3
  34. package/src/outbox/retry-delay.ts +8 -0
  35. package/src/outbox/use-order-outbox.ts +8 -2
  36. package/src/pos-order/__fixtures__/order-create-v10.json +97 -0
  37. package/src/pos-order/__fixtures__/order-create-v11.json +90 -0
  38. package/src/pos-order/__fixtures__/order-create-v12.json +95 -0
  39. package/src/pos-order/__fixtures__/order-create-v9.json +89 -0
  40. package/src/pos-order/attention-handled.ts +24 -0
  41. package/src/pos-order/command.ts +132 -12
  42. package/src/pos-order/extras-delivery.ts +14 -0
  43. package/src/pos-order/finalize.ts +138 -29
  44. package/src/pos-order/index.ts +7 -3
  45. package/src/pos-order/money-divergence.ts +19 -0
  46. package/src/pos-order/needs-attention.ts +9 -1
  47. package/src/pos-order/refund-due.ts +35 -0
  48. package/src/pos-order/reopen.ts +96 -12
  49. package/src/pos-order/schema.ts +35 -10
  50. package/src/pos-order/till-payments.ts +4 -0
  51. package/src/pos-order/types.ts +45 -6
  52. package/src/print/escpos/__fixtures__/thermal-every-node.xml +33 -0
  53. package/src/print/escpos/commands.ts +79 -0
  54. package/src/print/escpos/drawer.ts +25 -0
  55. package/src/print/escpos/encode.ts +1 -0
  56. package/src/print/escpos/index.ts +6 -1
  57. package/src/print/escpos/network-sinks.ts +130 -0
  58. package/src/print/escpos/render-escpos.ts +155 -0
  59. package/src/print/escpos/transport.ts +2 -1
  60. package/src/print/index.ts +5 -2
  61. package/src/print/resolve-printer.ts +46 -0
  62. package/src/print/types.ts +1 -1
  63. package/src/product/index.ts +2 -0
  64. package/src/product/terms.ts +42 -0
  65. package/src/product/tile-fields.ts +27 -0
  66. package/src/receipt/build-receipt-data.ts +12 -7
  67. package/src/receipt/carried-rows.ts +29 -0
  68. package/src/receipt/index.ts +1 -0
  69. package/src/receipt/reprint.ts +14 -8
  70. package/src/receipt/types.ts +3 -1
  71. package/src/receipt-template/default-templates.ts +3 -0
  72. package/src/receipt-template/template-data.ts +3 -0
  73. package/src/receipt-template/wcpos/build.ts +1 -0
  74. package/src/receipt-template/wcpos/format.ts +2 -2
  75. package/src/receipt-template/wcpos/from-orders.ts +6 -2
  76. package/src/receipt-template/wcpos/types.ts +5 -1
  77. package/src/register/closure-document.ts +42 -4
  78. package/src/register/closure-rows.ts +3 -2
  79. package/src/register/document-labels.ts +25 -0
  80. package/src/register/expected.ts +49 -10
  81. package/src/register/index.ts +5 -5
  82. package/src/register/money.ts +23 -0
  83. package/src/register/register-adoption.ts +6 -5
  84. package/src/register/register-commands.ts +4 -3
  85. package/src/register/schemas.ts +11 -3
  86. package/src/register/session-store.ts +44 -23
  87. package/src/register/settled-figures.ts +5 -19
  88. package/src/register/use-register-session.ts +18 -19
  89. package/src/reopen/index.ts +3 -0
  90. package/src/reopen/reopen-entry.ts +48 -0
  91. package/src/reopen/reopen-store-order.ts +78 -0
  92. package/src/reopen/send-order-reopen.ts +61 -0
  93. package/src/reports/adapters.ts +15 -7
  94. package/src/reports/sales-figures.ts +15 -1
  95. package/src/reports/types.ts +2 -0
  96. package/src/sale/cart.ts +4 -2
  97. package/src/sale/index.ts +1 -1
  98. package/src/sale/open-sales.ts +3 -0
  99. package/src/sale/use-sale.ts +388 -83
  100. package/src/sale/woocommerce/coupon-refetch.ts +1 -0
  101. package/src/sale/woocommerce/coupon-source.ts +4 -4
  102. package/src/sale/woocommerce/coupons.ts +6 -0
  103. package/src/sale/woocommerce/discount-codes.ts +1 -6
  104. package/src/scanner/analyze-trace.ts +86 -0
  105. package/src/scanner/device-scanner.ts +57 -0
  106. package/src/scanner/hid-scanner.ts +14 -41
  107. package/src/scanner/index.ts +2 -0
  108. package/src/scanner/serial-scanner.ts +15 -42
  109. package/src/scanner/use-barcode-scanner.ts +107 -5
  110. package/src/scanner/wedge-detector.ts +33 -15
  111. package/src/tax/exact.ts +1 -13
  112. package/src/tax/taxed-lines.ts +26 -0
  113. package/src/tender/index.ts +6 -1
  114. package/src/tender/split-units.ts +109 -0
  115. package/src/tender/tender-figures.ts +114 -0
  116. package/src/tender/tender-state.ts +105 -17
  117. package/src/currency/format-money-with.ts +0 -45
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 { Money, TaxRounding, StoreSettings, woocommerceTax, PaymentMethodDescriptor, CustomerAddress, TallyConnector, SyncContext, StoreSettingsChoice, StoreSettingsChoices, Cashier, CashierPermission, ProductTraits, woocommerceCoupons, OrderCreateLine, PaymentMethodKind, OrderAddress, CommandServerRefs, CommandWarning, CommandError, StoreOrder, ReceiptTemplate, ServerCapabilities, OrderCreateEnvelope, OrderRefundEnvelope, OrderRefundResult, RegisterInfo, RegisterCommandType, RegisterCommandResult, RegisterSessionTransitionPayload, CommandResult, AnyCommandEnvelope, CommandEnvelope, OrderCreatePayload, VariantSummary, TraitContext, IceServer, SignalMessage, DisplaySignalling, DisplaySignallingContext, DisplayAdvertisement, DisplayRecord, PendingPairing, ProductCategory, VariantOptionGroup, ListOrdersQuery, OrderFilterField, RegisterCommandEnvelope, OrderRefundLine, StoreOrderLine } from '@tallyui/core';
4
- export { getProductStock, withStockOverlay } from '@tallyui/core';
3
+ import { MoneyFormat, Money, TaxRounding, StoreSettings, woocommerceTax, PaymentMethodDescriptor, CustomerAddress, CustomerTaxId, OrderCreateMeta, TallyConnector, SyncContext, StoreSettingsChoice, StoreSettingsChoices, Cashier, CashierPermission, ProductTraits, woocommerceCoupons, OrderCreateLine, PaymentMethodKind, OrderAddress, CommandServerRefs, CommandWarning, CommandError, StoreOrder, 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, ListOrdersQuery, OrderFilterField, RegisterCommandEnvelope, OrderRefundLine, StoreOrderLine, OrderReopenResult, OrderReopenEnvelope } from '@tallyui/core';
4
+ export { Correction, MoneyFormat as CurrencyFormat, getProductStock, ratePpmFromPercent, 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';
@@ -134,19 +134,11 @@ declare function csvFromCells(lines: readonly (readonly unknown[])[]): string;
134
134
  /** Header row from `columns`, then one line per row. */
135
135
  declare function toCsv<Row>(rows: readonly Row[], columns: readonly CsvColumn<Row>[]): string;
136
136
 
137
- /** A store's own money format (WCPOS v2 General settings); a field left out keeps the locale's. */
138
- interface CurrencyFormat {
139
- position?: 'left' | 'right' | 'left_space' | 'right_space';
140
- thousandSeparator?: string;
141
- decimalSeparator?: string;
142
- decimals?: number;
143
- }
144
-
145
137
  interface CurrencyProviderProps {
146
138
  currencyCode: string;
147
139
  locale?: string;
148
140
  /** The store's own money format; without it, money reads as Intl formats it for `locale`. */
149
- format?: CurrencyFormat;
141
+ format?: MoneyFormat;
150
142
  children: ReactNode;
151
143
  }
152
144
  declare function CurrencyProvider({ currencyCode, locale, format, children }: CurrencyProviderProps): react_jsx_runtime.JSX.Element;
@@ -155,8 +147,6 @@ declare function useCurrencyCode(): string;
155
147
 
156
148
  /** Micro-minor-units per minor unit. */
157
149
  declare const MICROS_PER_MINOR = 1000000n;
158
- /** Converts a plain decimal percentage with at most four fractional digits to safe integer ppm. */
159
- declare function ratePpmFromPercent(percent: number | string): number;
160
150
  /**
161
151
  * Exact exclusive tax, or inclusive tax rounded half away from zero to a micro-minor-unit.
162
152
  * Throws RangeError unless amount and rate are safe integers and rate is non-negative.
@@ -289,14 +279,48 @@ declare function canVoidLeg(leg: {
289
279
  status?: PaymentLegStatus;
290
280
  }, method: PaymentMethodDescriptor): boolean;
291
281
 
282
+ /** A store-priced coupon's share of one line (#790, docs/contract/order-create-v9.md), tax-exclusive, in integer minor units. */
283
+ interface OrderCouponLine {
284
+ lineId: string;
285
+ discountMinor: number;
286
+ discountTaxMinor: number;
287
+ /** The store's priced amount in this line's own tax mode; present only on a carried coupon. */
288
+ amountMinor?: number;
289
+ }
292
290
  interface OrderCoupon {
293
291
  code: string;
294
292
  couponId: string;
295
293
  discountMinor: number;
296
294
  discountTaxMinor: number;
295
+ /** The store refused this code at send and the sale was charged at its price; it is never sent as a coupon. */
296
+ carried?: true;
297
+ /** #790: present only on a store-priced coupon. It holds the coupon's share of each line, in lineItems order, with no zero entries unless a carried coupon's amountMinor is non-zero. */
298
+ lines?: OrderCouponLine[];
299
+ }
300
+ /** The store order a reopened cart edits (ADR-090): its id, the revision it was read at, and the till's id for it when a till made it. */
301
+ interface StoreOrderRef {
302
+ id: string;
303
+ revision: string;
304
+ uuid?: string;
297
305
  }
298
306
  interface Order {
299
307
  id: string;
308
+ /** Set only on a reopened sale; absent on every new sale. */
309
+ storeOrder?: StoreOrderRef;
310
+ /** Set only on a reopened sale whose closed session's closure already counted it (ADR-077, Front desk 2026-11-21): it is re-sent with its original time and register, in no session, with the payment legs, fees, shipping and tax that closure counted, at the legs' sum as its total. */
311
+ afterClose?: {
312
+ sessionId: string;
313
+ createdAt: string;
314
+ registerId?: string;
315
+ payments: Array<{
316
+ id: string;
317
+ method: string;
318
+ amountMinor: number;
319
+ }>;
320
+ taxMinor: number;
321
+ fees: Array<Pick<ChargeLine, 'totalMinor' | 'taxLines'>>;
322
+ shipping: Array<Pick<ChargeLine, 'totalMinor' | 'taxLines'>>;
323
+ };
300
324
  status: 'draft' | 'parked' | 'saved' | 'completed';
301
325
  lineItems: LineItem[];
302
326
  fees?: FeeLine[];
@@ -309,6 +333,9 @@ interface Order {
309
333
  payments: Payment[];
310
334
  customer: CustomerSummary | null;
311
335
  note: string;
336
+ /** The sale's order meta, WooCommerce's custom fields (ADR-092 6d). Set with `useSale().setMeta`, parked with the draft,
337
+ * stored on the order, and sent at order.create 12. Keys are unique; none starts with `_`. Absent when there is none. */
338
+ meta?: OrderCreateMeta[];
312
339
  currency: string;
313
340
  pricesIncludeTax: boolean;
314
341
  /** The store's tax rounding strategy the figures were computed with (#287), from the sale's tax context; absent is per_order. */
@@ -370,7 +397,12 @@ interface DisplayLine {
370
397
  }
371
398
  interface LineItem {
372
399
  id: string;
400
+ /** The store's id for a line the reopened sale keeps; absent on a line the till added. */
401
+ storeLineId?: string;
402
+ /** The line's tax class: kept under woo granularity, on a custom line that has one, and on a class-taxed line outside woo. */
373
403
  taxClass?: string;
404
+ /** Set outside woo granularity when the line's rates came from the tax context for taxClass (absent: rates the caller gave, or a draft from before this field); a re-tax or resume re-derives them. */
405
+ taxFromClass?: true;
374
406
  /** WooCommerce's stored net at rounding precision, in integer micro-minor units, and its rounded gross. */
375
407
  netMicros?: string;
376
408
  totalMinor?: number;
@@ -384,6 +416,8 @@ interface LineItem {
384
416
  /** The names in attributes the cashier picked for the variant's "Any" option groups (#495); absent when none. */
385
417
  anyAttributes?: string[];
386
418
  sku: string;
419
+ /** The SKU the line was added with, set the first time the cashier edits a catalogue line's SKU (ADR-092 6b); absent means `sku` is the catalogue's. */
420
+ catalogueSku?: string;
387
421
  imageUrl?: string;
388
422
  unitPriceMinor: number;
389
423
  /** The catalogue's regular unit price, in the line's own tax mode like unitPriceMinor; absent on custom lines (ADR-077 d3). */
@@ -401,12 +435,18 @@ interface LineItem {
401
435
  }
402
436
  interface ChargeLine {
403
437
  id: string;
438
+ /** The store's id for a line the reopened sale keeps; absent on a line the till added. */
439
+ storeLineId?: string;
404
440
  netMicros?: string;
405
441
  totalMinor?: number;
406
442
  name: string;
407
443
  amountMinor: number;
408
444
  taxClass?: string;
409
445
  taxStatus: 'taxable' | 'none';
446
+ /** The cashier's mode for this charge (v2 "Amount includes tax"); absent means the order's. Never stored on a finalized order. */
447
+ amountIncludesTax?: boolean;
448
+ /** A fee's percentage of the cart (v2 Add Fee "%"): the builder sets `amountMinor` to it on every build. Fees only. Never stored on a finalized order. */
449
+ percent?: number;
410
450
  taxLines: LineItem['taxLines'];
411
451
  netMinor: number;
412
452
  taxMicros: string;
@@ -417,10 +457,14 @@ interface ShippingLine extends ChargeLine {
417
457
  methodId?: string;
418
458
  }
419
459
  interface ChargeInput {
460
+ id?: string;
420
461
  name: string;
421
462
  amountMinor: number;
422
463
  taxClass?: string;
423
464
  taxStatus?: 'taxable' | 'none';
465
+ storeLineId?: string;
466
+ amountIncludesTax?: boolean;
467
+ percent?: number;
424
468
  }
425
469
  interface LineTaxLine {
426
470
  code?: string;
@@ -430,6 +474,7 @@ interface LineTaxLine {
430
474
  taxMicros: string;
431
475
  }
432
476
  interface Discount {
477
+ id?: string;
433
478
  type: 'percentage' | 'fixed';
434
479
  value: number;
435
480
  label?: string;
@@ -441,13 +486,23 @@ interface AppliedDiscount extends Discount {
441
486
  }
442
487
  interface Payment {
443
488
  id: string;
489
+ /** The store's payment record id for a leg it already holds */
490
+ storePaymentId?: string;
491
+ /** A leg the store already holds: never removed or moved, only sent back with its storePaymentId */
492
+ locked?: true;
493
+ /** A leg copied from a refused order when it was reopened (reopenRefusedOrder): its money was already taken, so tender keeps it. Draft-only: finalize drops it. */
494
+ reopened?: true;
444
495
  method: string;
496
+ /** The payment method's own id on the platform, kept for labels and takings (`legMethodId`); `method` decides cash. */
497
+ methodId?: string;
445
498
  /** Absent means captured; only captured legs count toward paidMinor. */
446
499
  status?: PaymentLegStatus;
447
500
  amountMinor: number;
448
501
  tenderedMinor?: number;
449
502
  changeMinor?: number;
450
503
  reference?: string;
504
+ /** The units of each line (`String(line id)`) this leg paid for, set when it was taken with unit picks (#1133). Absent for a leg taken by amount. */
505
+ units?: Readonly<Record<string, number>>;
451
506
  }
452
507
  interface CustomerSummary {
453
508
  id: string;
@@ -457,6 +512,9 @@ interface CustomerSummary {
457
512
  * order.create 8 when the sale was taxed on one of them (#722). */
458
513
  billing?: CustomerAddress;
459
514
  shipping?: CustomerAddress;
515
+ /** The sale's tax ids (ADR-092 6a): set with `useSale().setTaxIds`, parked with the draft, stored on the order and sent
516
+ * at order.create 12 without `label`. A picked customer's own (`Customer.taxIds`) may be passed in `setCustomer`, which refuses a list `setTaxIds` would refuse. */
517
+ taxIds?: CustomerTaxId[];
460
518
  }
461
519
  interface PaymentMethod {
462
520
  id: string;
@@ -465,7 +523,12 @@ interface PaymentMethod {
465
523
  requiresReference?: boolean;
466
524
  }
467
525
  interface AddLineInput {
526
+ id?: string;
468
527
  productId: string;
528
+ /** A kept store line: never merged */
529
+ storeLineId?: string;
530
+ /** Add as its own line: never merged into an equal line (a draft's lines restore one for one). */
531
+ separate?: true;
469
532
  custom?: true;
470
533
  taxStatus?: 'taxable' | 'none';
471
534
  variantId?: string;
@@ -673,6 +736,22 @@ interface CashierState {
673
736
  */
674
737
  declare function useCashier(connector: TallyConnector | null, context: SyncContext | null): CashierState;
675
738
 
739
+ /**
740
+ * Which words a catalogue grid tile shows (vendurepos gap 9.9). Device-local, kept in app_settings as
741
+ * `catalogue.tileFields`. v2 provenance: WCPOS monorepo `core/src/screens/main/pos/products/ui-settings-form.tsx`
742
+ * (`gridFields`, nine switches). TallyUI's keys are camelCase; v2's tax and cost_of_goods_sold are not here yet.
743
+ */
744
+ declare const TILE_FIELDS: readonly ["name", "price", "onSale", "categories", "sku", "barcode", "stock"];
745
+ type TileField = (typeof TILE_FIELDS)[number];
746
+ type TileFields = Readonly<Record<TileField, boolean>>;
747
+ /** Today's tile: name, price with its on-sale strike, and the stock status. Desk 19 Nov (Q6): the default stays today's. */
748
+ declare const DEFAULT_TILE_FIELDS: TileFields;
749
+ /**
750
+ * Each field takes the value's own boolean, else its default, so a value stored before a field was added keeps its
751
+ * switches. Unknown keys are dropped; a non-object (including an array) gives `undefined`.
752
+ */
753
+ declare function normalizeTileFields(value: unknown): TileFields | undefined;
754
+
676
755
  /**
677
756
  * Device UI preferences, one JSON-encoded value per key. Local only, never replicated;
678
757
  * the app adds the collection as `app_settings`.
@@ -687,6 +766,41 @@ type UiScale = (typeof UI_SCALES)[number];
687
766
  /** v2's first three themes (`core/screens/main/settings/theme.tsx`); TallyUI's tokens define light and dark. */
688
767
  declare const UI_THEMES: readonly ["system", "light", "dark"];
689
768
  type UiTheme = (typeof UI_THEMES)[number];
769
+ /** The same ids, in the same default order, as `@tallyui/components` `CartColumnSettings` (`cart/cart-columns.tsx`);
770
+ * pos cannot import components, so keep the two in step. */
771
+ declare const CART_COLUMN_IDS: readonly ["quantity", "image", "name", "sku", "price", "regularPrice", "total"];
772
+ type CartColumnId = (typeof CART_COLUMN_IDS)[number];
773
+ /** v2 `openOrdersPosition`, default bottom (`initial-settings.json:153`). */
774
+ declare const OPEN_ORDERS_POSITIONS: readonly ["top", "bottom"];
775
+ type OpenOrdersPosition = (typeof OPEN_ORDERS_POSITIONS)[number];
776
+ /** Structurally the same as `@tallyui/components` `CartColumnSettings`, so a stored value passes straight to `Cart`. */
777
+ interface CartColumnsSetting {
778
+ quantity?: {
779
+ show?: boolean;
780
+ split?: boolean;
781
+ };
782
+ image?: {
783
+ show?: boolean;
784
+ };
785
+ name?: {
786
+ show?: boolean;
787
+ sku?: boolean;
788
+ };
789
+ sku?: {
790
+ show?: boolean;
791
+ };
792
+ price?: {
793
+ show?: boolean;
794
+ onSale?: boolean;
795
+ };
796
+ regularPrice?: {
797
+ show?: boolean;
798
+ };
799
+ total?: {
800
+ show?: boolean;
801
+ };
802
+ order?: readonly CartColumnId[];
803
+ }
690
804
  /** The typed key map. Add a key here and in APP_SETTING_DEFINITIONS; no schema change is needed. */
691
805
  interface AppSettings {
692
806
  /** The app applies it (e.g. Uniwind's setTheme); this store only records it. */
@@ -699,6 +813,21 @@ interface AppSettings {
699
813
  * `pos-cart.quickDiscounts: [5, 10, 15]` (`core/src/screens/main/contexts/ui-settings/initial-settings.json`).
700
814
  */
701
815
  'cart.quickDiscounts': readonly number[];
816
+ /** Cart Settings › Columns (v2 `pos-cart.columns`), for `Cart`'s `columns`; per device, unlike v2's
817
+ * per store × login (desk, 19 Nov). */
818
+ 'cart.columns': CartColumnsSetting;
819
+ 'cart.openOrdersPosition': OpenOrdersPosition;
820
+ /**
821
+ * Which words a catalogue grid tile shows. v2 keeps them per screen as `pos-products.gridFields`.
822
+ * Desk 19 Nov (Q6): per device, camelCase keys, and the default is today's tile.
823
+ */
824
+ 'catalogue.tileFields': TileFields;
825
+ /** Print the receipt after checkout without asking (v2 `pos-cart.autoPrintReceipt`, default false).
826
+ * The app runs the print; this store only records it. Per device (desk, 19 Nov). */
827
+ 'print.autoPrintReceipt': boolean;
828
+ /** Template id to printer profile id: the device's routing overrides, for `PrintingSettings`'s `routing`
829
+ * and `resolvePrinter`. A template with no entry uses Auto. Per device. */
830
+ 'print.templatePrinters': Readonly<Record<string, string>>;
702
831
  }
703
832
  type AppSettingKey = keyof AppSettings;
704
833
  /** One key's default and its check: `parse` returns the value when valid, else `undefined`. */
@@ -767,16 +896,32 @@ interface StorePricedCoupon {
767
896
  /** Coupons priced by the store (TallyUI#709): the till applies the amounts and never computes a coupon's value. */
768
897
  interface StorePricedCouponContext {
769
898
  kind: 'store-priced';
899
+ carried?: true;
770
900
  priced: ReadonlyMap<string, StorePricedCoupon>;
771
901
  /** couponPricingBasis(order) of the order the store priced. */
772
902
  basis: string;
773
903
  }
904
+ /** A parked order's coupons, display coupon rows and post-coupon line figures, kept on a paid resume (ADR-077 d3, amended
905
+ * 2026-11-19). They apply only while one of the parked live legs is live on the parked lines; else no figures, and the order is stale. */
906
+ interface KeptCouponContext {
907
+ kind: 'kept';
908
+ coupons: readonly OrderCoupon[];
909
+ displayRows: readonly number[];
910
+ lines: ReadonlyMap<string, Pick<LineItem, 'netMinor' | 'netMicros' | 'totalMinor' | 'taxLines' | 'taxMicros'>>;
911
+ basis: string;
912
+ linesBasis: string;
913
+ /** The ids of the live legs the figures were kept for: a leg added later never brings them back. */
914
+ legIds: readonly string[];
915
+ }
774
916
  /** What a store-priced coupon's amounts depend on (TallyUI#709). A price is good only while this is unchanged. */
775
- declare function couponPricingBasis(order: Order): string;
917
+ declare function couponPricingBasis(order: Pick<Order, 'currency' | 'customer' | 'lineItems' | 'discounts'>): string;
776
918
  interface OrderBuilderOptions {
777
919
  currency: string;
778
920
  taxContext: TaxContext;
779
921
  id?: string;
922
+ createdAt?: string;
923
+ storeOrder?: StoreOrderRef;
924
+ afterClose?: Order['afterClose'];
780
925
  couponContext?: OrderCouponContext;
781
926
  }
782
927
  interface OrderBuilder {
@@ -805,17 +950,36 @@ interface OrderBuilder {
805
950
  splitLine(lineId: string): string[];
806
951
  /** Sets a line's unit price (a till price edit), in minor units of the order's currency and the line's own tax mode; its discounts and tax are recomputed. */
807
952
  setUnitPrice(lineId: string, amountMinor: number): void;
953
+ /**
954
+ * Edits a line's name, SKU or regular unit price (ADR-092 6b/6c); `regularUnitPriceMinor: null` removes it. Name and SKU
955
+ * are trimmed and may not be empty. A catalogue line's first SKU edit keeps the SKU it was added with as `catalogueSku`.
956
+ * A custom line refuses a regular price (ADR-077 d3). The whole patch is checked first, so a patch that throws changes nothing.
957
+ */
958
+ updateLine(lineId: string, patch: {
959
+ name?: string;
960
+ sku?: string;
961
+ regularUnitPriceMinor?: number | null;
962
+ }): void;
808
963
  removeItem(lineId: string): void;
964
+ /**
965
+ * Puts a removed line, fee or shipping line back as it was (#1095), at `index` clamped to its list's end, and
966
+ * recalculates it as an add does; never re-priced. Throws a RangeError when its id, or a line discount's, is on the order.
967
+ */
968
+ restoreItem(kind: 'line' | 'fee' | 'shipping', item: LineItem | ChargeLine, index: number): void;
809
969
  applyLineDiscount(lineId: string, discount: Discount): void;
810
970
  applyOrderDiscount(discount: Discount): void;
811
971
  removeDiscount(discountId: string): void;
812
- addPayment(payment: Omit<Payment, 'id'>): string;
972
+ addPayment(payment: Omit<Payment, 'id'> & {
973
+ id?: string;
974
+ }): string;
813
975
  setPaymentStatus(paymentId: string, status: PaymentLegStatus): boolean;
814
976
  removePayment(paymentId: string): void;
815
977
  setCustomer(customer: CustomerSummary | null): void;
816
978
  setNote(note: string): void;
979
+ /** Replaces the order meta as given (`[]` removes it); `useSale().setMeta` checks keys before it calls this. */
980
+ setMeta(meta: OrderCreateMeta[]): void;
817
981
  /** Replaces the coupon codes with their trimmed, lower-case, deduplicated list; a given context replaces the builder's coupon context. */
818
- setCoupons(codes: readonly string[], context?: OrderCouponContext | StorePricedCouponContext): void;
982
+ setCoupons(codes: readonly string[], context?: OrderCouponContext | StorePricedCouponContext | KeptCouponContext): void;
819
983
  clear(): void;
820
984
  getSnapshot(): Order;
821
985
  }
@@ -878,9 +1042,18 @@ interface ParkedOrderSummary {
878
1042
  firstItem?: string;
879
1043
  }
880
1044
  declare function writeOrderDraft(drafts: RxCollection, snapshot: Order): Promise<string>;
1045
+ /**
1046
+ * Rebuilds a saved order on `taxContext`. Fees and shipping re-derive their rates; under woo granularity lines re-derive
1047
+ * from their class too. Outside woo, a line marked taxFromClass re-derives from its class unless `keepTaxRates` is set;
1048
+ * every other line (given rates, a draft from before the marker) keeps its stored rates. `keepCoupons` puts the saved
1049
+ * coupons back as parked, figures and all, while an unlocked leg is live (ADR-077 d3, amended 2026-11-19); otherwise none.
1050
+ * Carried coupons always restore their priced amounts against the saved basis, keeping stale figures stale.
1051
+ */
881
1052
  declare function restoreOrderDraft(saved: Order, options: {
882
1053
  currency: string;
883
1054
  taxContext: TaxContext;
1055
+ keepTaxRates?: boolean;
1056
+ keepCoupons?: boolean;
884
1057
  }): OrderBuilder;
885
1058
  declare function parkedOrderSummaries$(drafts: RxCollection): Observable<ParkedOrderSummary[]>;
886
1059
 
@@ -987,9 +1160,12 @@ interface ReceiptData {
987
1160
  payments: {
988
1161
  method: string;
989
1162
  amountMinor: number;
1163
+ changeMinor?: number;
990
1164
  reference?: string;
991
1165
  }[];
992
1166
  changeDueMinor: number;
1167
+ /** What the store owes back on a reopened sale (ADR-090); present only when above 0. Never part of changeDueMinor. */
1168
+ refundDueMinor?: number;
993
1169
  footer: {
994
1170
  note?: string;
995
1171
  /** ADR-083 condition 2: set only on a reprint of a till order whose note was not sent to the store. */
@@ -1034,15 +1210,29 @@ interface PosOrderCoupon {
1034
1210
  couponId: string;
1035
1211
  discountMinor: number;
1036
1212
  discountTaxMinor: number;
1213
+ carried?: true;
1214
+ /** Present only on a store-priced coupon (#790), in stored `lines` order, with no zero entries unless a carried amountMinor is non-zero;
1215
+ * absent on WooCommerce replay coupons and on every order stored before schema 13. */
1216
+ lines?: PosOrderCouponLine[];
1217
+ }
1218
+ interface PosOrderCouponLine {
1219
+ lineId: string;
1220
+ discountMinor: number;
1221
+ discountTaxMinor: number;
1222
+ amountMinor?: number;
1037
1223
  }
1038
1224
  interface PosOrderLine {
1039
1225
  id: string;
1226
+ /** The store's id of a kept line (ADR-090); absent on a line added at the till. */
1227
+ storeLineId?: string;
1040
1228
  productId: string;
1041
1229
  variantId?: string;
1042
1230
  custom?: OrderCreateLine['custom'];
1043
1231
  taxStatus?: 'taxable' | 'none';
1044
1232
  name: string;
1045
1233
  sku: string;
1234
+ /** The SKU the line was added with, recorded only when the cashier edits the line's `sku` (pos_orders v18, ADR-092); absent means `sku` is the catalogue's. */
1235
+ catalogueSku?: string;
1046
1236
  quantity: number;
1047
1237
  unitPriceMinor: number;
1048
1238
  /** The chosen variation attributes, name to value (pos_orders v9, #495). */
@@ -1065,7 +1255,11 @@ interface PosOrderLine {
1065
1255
  }
1066
1256
  interface PosOrderPayment {
1067
1257
  id: string;
1258
+ /** The store's id of a payment already on the order (ADR-090): a captured leg, never re-taken. Sent as `order.update`'s `paymentId`. */
1259
+ storePaymentId?: string;
1068
1260
  method: PaymentMethodKind;
1261
+ /** The payment method's own id on the platform, kept for labels and takings (`legMethodId`); `method` decides cash. */
1262
+ methodId?: string;
1069
1263
  amountMinor: number;
1070
1264
  tenderedMinor?: number;
1071
1265
  changeMinor?: number;
@@ -1075,18 +1269,30 @@ interface PosOrder {
1075
1269
  id: string;
1076
1270
  /** The sale order's id (the builder's), set by finalizeOrder (pos_orders v7, ADR-072): support traceability from a draft or preview to this stored order. Never sent, never printed. */
1077
1271
  saleId?: string;
1272
+ /** The store order this sale reopened (ADR-090); the outbox sends such a row as `order.update`, never `order.create`. */
1273
+ storeOrderId?: string;
1274
+ /** The store's revision of that order as the reopen left it (ADR-090). */
1275
+ baseRevision?: string;
1078
1276
  createdAt: string;
1079
1277
  currency: string;
1080
1278
  pricesIncludeTax: boolean;
1081
1279
  lines: PosOrderLine[];
1082
1280
  /** pos_orders v9, ADR-077 d2; present only on a sale with coupons */
1083
1281
  coupons?: PosOrderCoupon[];
1084
- fees?: FeeLine[];
1085
- shipping?: ShippingLine[];
1282
+ fees?: Array<FeeLine & {
1283
+ /** The store's id of a kept fee or shipping line, in the same id space as lines (ADR-090). */
1284
+ storeLineId?: string;
1285
+ }>;
1286
+ shipping?: Array<ShippingLine & {
1287
+ /** The store's id of a kept fee or shipping line, in the same id space as lines (ADR-090). */
1288
+ storeLineId?: string;
1289
+ }>;
1086
1290
  subtotalMinor: number;
1087
1291
  discountMinor: number;
1088
1292
  taxMinor: number;
1089
1293
  totalMinor: number;
1294
+ /** 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. */
1295
+ refundDueMinor?: number;
1090
1296
  payments: PosOrderPayment[];
1091
1297
  /** `billing` and `shipping` (#722) are frozen copies of the customer's addresses, stored only with `taxAddress`. */
1092
1298
  customer: {
@@ -1095,17 +1301,31 @@ interface PosOrder {
1095
1301
  email?: string;
1096
1302
  billing?: OrderAddress;
1097
1303
  shipping?: OrderAddress;
1304
+ /** The sale's tax ids (pos_orders v18, ADR-092), sent at order.create 12; `label` is kept on the till and is not sent. */
1305
+ taxIds?: Array<{
1306
+ type: string;
1307
+ value: string;
1308
+ country?: string;
1309
+ label?: string;
1310
+ }>;
1098
1311
  } | null;
1099
1312
  /** The customer address the sale was taxed on (#722), sent as order.create 8's `taxAddress`; absent: the store's base. */
1100
1313
  taxAddress?: 'billing' | 'shipping';
1101
1314
  /** The sale's note; sent as order.create version 7's `note` (ADR-083), cut to ORDER_NOTE_MAX when frozen. */
1102
1315
  note?: string;
1316
+ /** The order's custom fields (pos_orders v18, ADR-092), sent at order.create 12 in this order. */
1317
+ meta?: Array<{
1318
+ key: string;
1319
+ value: string;
1320
+ }>;
1103
1321
  registerId?: string;
1104
1322
  /**
1105
1323
  * The register session the sale was taken in (ADR-032): its closure counts this order.
1106
1324
  * Sent at `order.create` version 3 as the payload's `sessionId` (the stamped or late session, one field).
1107
1325
  */
1108
1326
  sessionId?: string;
1327
+ /** The closed session whose closure already counted this sale: set by finalize on an after-close reopen (ADR-077), which then joins no session. */
1328
+ countedInClosureOf?: string;
1109
1329
  /**
1110
1330
  * Set only by `useSale`'s late-sale path (ADR-032): the session the sale was taken for, which
1111
1331
  * refused the stamp after the money was taken. Such an order has no `sessionId`, so no closure
@@ -1116,9 +1336,9 @@ interface PosOrder {
1116
1336
  * The order.create version every attempt under this `commandId` goes out at: the outbox records it before the first
1117
1337
  * send, and lowers it only on a downgrade (ADR-065 amendment). Absent means not sent yet (or requeued).
1118
1338
  */
1119
- sentVersion?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
1339
+ sentVersion?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
1120
1340
  /** The version first tried, before the downgrade (the order's audit). */
1121
- downgradedFrom?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
1341
+ downgradedFrom?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
1122
1342
  /** ADR-065: the receipt's display figures, in integer minor units of `currency` at `exponent`. */
1123
1343
  display?: DisplayTotals & {
1124
1344
  currency: string;
@@ -1147,8 +1367,10 @@ interface PosOrder {
1147
1367
  serverFailures?: PosOrderServerFailures;
1148
1368
  error?: CommandError;
1149
1369
  updatedAt: string;
1150
- /** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention hides it, and it stays as the record of the refusal. */
1370
+ /** When the till reopened this refused order as a parked sale (ADR-077 d4b). Needs attention keeps it until its finalized successor is in the list (`replacedOrderIds`), and it stays as the record of the refusal. */
1151
1371
  reopenedAt?: string;
1372
+ /** The commandId whose refusal the cashier marked handled (tally-woo 03, ADR-092 6f); the logic comes in a later PR. */
1373
+ attentionHandledFor?: string;
1152
1374
  }
1153
1375
 
1154
1376
  /**
@@ -1159,6 +1381,9 @@ declare function buildReceiptDataFromPosOrder(order: PosOrder, config: ReceiptCo
1159
1381
  /** Receipt data for reprinting an order read from the store with `getOrders`/`listOrders` (ADR-081). */
1160
1382
  declare function buildReceiptDataFromStoreOrder(order: StoreOrder, config: ReceiptConfig): ReceiptData;
1161
1383
 
1384
+ /** Whether a receipt row is a carried coupon's derived label (carriedCouponLabel). */
1385
+ declare const isCarriedCouponLabel: (label: string) => boolean;
1386
+
1162
1387
  type DrawerConnector = 'pin2' | 'pin5';
1163
1388
  type ThermalNode = ReceiptNode | TextNode | RawTextNode | BoldNode | UnderlineNode | InvertNode | SizeNode | AlignNode | RowNode | ColNode | LineNode | BarcodeNode | QrcodeNode | ImageNode | CutNode | FeedNode | DrawerNode;
1164
1389
  interface ReceiptNode {
@@ -1329,6 +1554,8 @@ interface ReceiptTemplateData {
1329
1554
  reference: string;
1330
1555
  }[];
1331
1556
  change: string;
1557
+ /** What the store owes back on a reopened sale (ADR-090); present only when above 0. Never shown as change. */
1558
+ refundDue?: string;
1332
1559
  note: string;
1333
1560
  qrPayload: string;
1334
1561
  }
@@ -1465,6 +1692,8 @@ interface WcposReceiptSource {
1465
1692
  changeMinor?: number;
1466
1693
  }>;
1467
1694
  changeMinor?: number;
1695
+ /** What the store owes back on a reopened sale (ADR-090); present only when above 0. Never part of changeMinor. */
1696
+ refundDueMinor?: number;
1468
1697
  /** The register the sale was rung up on. */
1469
1698
  registerId?: string;
1470
1699
  /** The fiscal sale stamp, its IANA zone and the sale counter. */
@@ -1601,6 +1830,8 @@ interface WcposReceiptTotals extends Amounts<'subtotal'>, Amounts<'discount_tota
1601
1830
  tax_total: number;
1602
1831
  paid_total: number;
1603
1832
  change_total: number;
1833
+ /** v2's `refund_due`: what the store owes back on a reopened sale (ADR-090); absent when none. Not `refund_total`. */
1834
+ refund_due_total?: number;
1604
1835
  refund_total?: number;
1605
1836
  net_total?: number;
1606
1837
  total_qty?: number;
@@ -1787,7 +2018,7 @@ type WcposItemTaxView = WcposItemTax & {
1787
2018
  type WcposAdjustmentView<T extends WcposReceiptAdjustment = WcposReceiptAdjustment> = T & Displays<WcposTri<'total'>> & {
1788
2019
  taxes?: WcposItemTaxView[];
1789
2020
  };
1790
- type WcposTotalsView = WcposReceiptTotals & Displays<WcposTri<'subtotal' | 'discount_total' | 'total'> | 'tax_total' | 'paid_total' | 'change_total'> & MaybeDisplays<WcposTri<'sale_savings_total' | 'total_saved'> | 'refund_total' | 'net_total'>;
2021
+ type WcposTotalsView = WcposReceiptTotals & Displays<WcposTri<'subtotal' | 'discount_total' | 'total'> | 'tax_total' | 'paid_total' | 'change_total'> & MaybeDisplays<WcposTri<'sale_savings_total' | 'total_saved'> | 'refund_due_total' | 'refund_total' | 'net_total'>;
1791
2022
  /** `taxable_amount_*_display` is '' when the amount is null. */
1792
2023
  type WcposTaxSummaryView = WcposTaxSummaryRow & Displays<'tax_amount' | 'taxable_amount_excl' | 'taxable_amount_incl'>;
1793
2024
  type WcposPaymentView = WcposReceiptPayment & Displays<'amount'> & MaybeDisplays<'tendered' | 'change'>;
@@ -1899,6 +2130,8 @@ interface DisplayPayment {
1899
2130
  leg?: {
1900
2131
  method: string;
1901
2132
  amountMinor: number;
2133
+ tenderedMinor?: number;
2134
+ changeMinor?: number;
1902
2135
  };
1903
2136
  message?: string;
1904
2137
  }
@@ -2028,7 +2261,8 @@ declare function createDisplayLink(transport: DisplayTransport, options: {
2028
2261
  }): DisplayLink;
2029
2262
 
2030
2263
  declare const DISPLAY_TEMPLATE: DisplayTemplate;
2031
- /** The hello is re-sent until a config answers it, so a till opened after the display still finds it. */
2264
+ /** The hello is re-sent until a config answers it, so a till opened after the display still finds it.
2265
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
2032
2266
  declare const HELLO_RETRY_MS = 2000;
2033
2267
  /**
2034
2268
  * The customer display's side: says `display.hello`, then shows what the till sends. As v2's display page
@@ -2048,10 +2282,12 @@ interface FinalizeOptions {
2048
2282
  newId?: () => string;
2049
2283
  /** The store's `order.create` capability (ADR-062); `undefined` is treated as 1. */
2050
2284
  capabilities?: ServerCapabilities;
2051
- /** The address the sale's tax context matched (#722, `saleTaxContexts`). A customer's billing or shipping address
2052
- * stores `taxAddress` and the customer's addresses, sent at order.create 8; the base, or absent, stores neither. */
2285
+ /** The address the sale's tax context matched (#722, `saleTaxContexts`). A customer's billing or shipping address stores
2286
+ * `taxAddress`; the base, or absent, stores none. The customer's non-empty addresses are stored on every order, sent at
2287
+ * order.create 8 with `taxAddress` and at 11 without it (ADR-086 d2, amended 2026-11-19). */
2053
2288
  taxLocation?: woocommerceTax.ResolvedTaxLocation;
2054
2289
  }
2290
+ declare const AFTER_CLOSE_PAYMENTS_CHANGED = "This sale was counted in a closed register. Its payments must stay as that closure counted them.";
2055
2291
  /**
2056
2292
  * Turns a fully paid builder Order into a pending PosOrder without mutating it. The PosOrder holds the sent form,
2057
2293
  * frozen: line names and v3 discount labels are cut to PAYLOAD_STRING_MAX with NUL stripped (`cutText`), and a
@@ -2059,6 +2295,10 @@ interface FinalizeOptions {
2059
2295
  */
2060
2296
  declare function finalizeOrder(order: Order, options?: FinalizeOptions): PosOrder;
2061
2297
 
2298
+ /** order.create 11 (ADR-086 d2, amended 2026-11-19) is 10 plus the customer's addresses on a sale not taxed by address, as informational fields. */
2299
+ declare const UNTAXED_ADDRESS_ORDER_CREATE_VERSION: 11;
2300
+ /** order.create 12 (ADR-092) is 11 plus the customer's tax ids, a catalogue line's edited SKU and order meta, as informational fields. */
2301
+ declare const INFORMATIONAL_EXTRAS_ORDER_CREATE_VERSION: 12;
2062
2302
  /** order.create 8 (#722) tells the server which customer address the sale was taxed on (`taxAddress`) and carries the
2063
2303
  * addresses; below it a server taxes on the store's base, so `saleTaxContexts` re-taxes by address only from here. */
2064
2304
  declare const TAX_ADDRESS_ORDER_CREATE_VERSION: 8;
@@ -2075,15 +2315,26 @@ declare class UnsupportedOrderVersionError extends Error {
2075
2315
  * ADR-065's figures make version 3; otherwise a discounted order is version 2 (ADR-062), else version 1, byte-identical.
2076
2316
  * A version-3 order goes as version 4 (#286) only when `maxVersion` is at least 4 and its `sentVersion` doesn't cap it.
2077
2317
  * Coupon orders need version 6, carrying coupons, stored regular prices, line attributes and receipt coupons.
2318
+ * A carried coupon (`carried`) is never sent as a coupon; its line shares go in the line discounts and its display row in `display.orderDiscountMinor`, and it needs version 4.
2078
2319
  * A sale with a note goes as version 7 when capped at 7 or more and it has figures; otherwise the note is not sent.
2079
2320
  * A sale taxed on the customer's address (`taxAddress`, #722) needs version 8 and never downgrades: below 8 the server
2080
2321
  * taxes on the base, so a lower cap throws UnsupportedOrderVersionError(8). At 8 it carries the note, `taxAddress` and
2081
2322
  * the stored addresses; every other field follows the version its content makes, as at 7.
2323
+ * Version 9 sends every coupon's stored line shares when the cap allows it, keeping notes and any tax address.
2324
+ * Version 10 is 9 plus each payment's `methodId`: only at a cap of 10 or more, for an order with figures (4+) whose coupons all have lines and a leg with an id.
2325
+ * Version 11 is 10 plus the customer's addresses on a sale with no `taxAddress`: only at a cap of 11 or more, for an order with figures (4+) whose coupons all have lines; otherwise they are dropped.
2326
+ * Version 12 is 11 plus the customer's tax ids (without `label`), order meta and a catalogue line's edited `sku` (ADR-092): only at a cap of 12 or more, for an order with figures (4+) whose coupons all have lines; otherwise they are dropped.
2082
2327
  * Orders with Any picks (#495) need version 6 too, carrying a line's `anyAttributes`, and coupons only when they have some.
2328
+ * A reopened sale (`storeOrderId`) throws: it goes as `order.update` (`toOrderUpdateEnvelope`).
2083
2329
  */
2084
2330
  declare function toOrderCreateEnvelope(order: PosOrder, deviceId: string, attempt?: number, options?: {
2085
2331
  maxVersion?: number;
2086
2332
  }): OrderCreateEnvelope;
2333
+ /** Builds at order.create version 5 or more (a store's cap below 5 throws UnsupportedOrderVersionError(5, cap)).
2334
+ * Refuses a row without baseRevision or figures, and pairs store ids by client id. */
2335
+ declare function toOrderUpdateEnvelope(order: PosOrder, deviceId: string, attempt?: number, options?: {
2336
+ maxVersion?: number;
2337
+ }): OrderUpdateEnvelope;
2087
2338
 
2088
2339
  declare const posOrderSchema: RxJsonSchema<PosOrder>;
2089
2340
  /**
@@ -2136,6 +2387,9 @@ declare function getDeviceId(storage: {
2136
2387
  setItem(key: string, value: string): void;
2137
2388
  } | null, key: string): string;
2138
2389
 
2390
+ /** The `error.code` the outbox puts on a pending reopened sale whose `order.update` it cannot build (ADR-090 W4b). The row stays pending: unsent. */
2391
+ declare const UPDATE_UNSENDABLE = "update_unsendable";
2392
+ declare const UPDATE_UNSENDABLE_MESSAGE = "The store can't accept this change yet. Ask the owner to update the POS plugin, then press Retry.";
2139
2393
  /**
2140
2394
  * The orders a cashier must look at: rejected, applied with a known warning, taken after their
2141
2395
  * session closed (`lateSessionId`) or with local warnings (whatever the sync status), or pending with a `commandId` in
@@ -2143,11 +2397,29 @@ declare function getDeviceId(storage: {
2143
2397
  * A warning code this till version doesn't know is not shown here (`knownWarnings`). Never changes `orders`.
2144
2398
  * `register_session_unknown` is not shown, because the store counts the order once its session arrives (ADR-078).
2145
2399
  * A refused order is left out once its finalized successor is in `orders`.
2400
+ * Pending updates marked `UPDATE_UNSENDABLE` are shown until a person acts.
2401
+ * An order a cashier marked handled (`markAttentionHandled`) is left out while its `commandId` is the one it was marked
2402
+ * for; a requeue mints a new `commandId`, so a fresh refusal shows again (ADR-092 6f).
2146
2403
  */
2147
2404
  declare function needsAttention(orders: PosOrder[], options?: {
2148
2405
  stuckCommandIds?: readonly string[];
2149
2406
  }): PosOrder[];
2150
2407
 
2408
+ /**
2409
+ * Marks the order `orderId` handled for its current `commandId`, so `needsAttention` leaves it out until a requeue
2410
+ * mints a new one (ADR-092 6f, tally-woo 03). Resolves to true when the order is stamped (or already was, for this
2411
+ * commandId); false, with nothing changed, when the id is unknown or the order is pending (still the outbox's to settle).
2412
+ */
2413
+ declare function markAttentionHandled(orders: RxCollection<PosOrder>, orderId: string, now?: () => Date): Promise<boolean>;
2414
+
2415
+ /** What the store computed differently on a sale, for a cashier's notice: the order figures (`figures_mismatch`) and
2416
+ * the lines (`line_figures_mismatch`, distinct `lineId`s in first-seen order). null when neither warning is known. */
2417
+ interface MoneyDivergence {
2418
+ orderFields: string[];
2419
+ lineIds: string[];
2420
+ }
2421
+ declare function moneyDivergence(order: Pick<PosOrder, 'warnings'>): MoneyDivergence | null;
2422
+
2151
2423
  type PosRefundStatus = 'pending' | 'applied' | 'rejected' | 'unsent';
2152
2424
  interface PosRefund {
2153
2425
  id: string;
@@ -2174,7 +2446,8 @@ declare const posRefundCollection: () => {
2174
2446
  /**
2175
2447
  * The register's local collections (ADR-032): sessions, cash movements and closures. Port
2176
2448
  * provenance (ADR-032 amendment 1): WCPOS `next` `3b5331b5c`, where they are at versions 1, 0
2177
- * and 1; sessions are at version 1 here (ADR-078), movements and closures at version 0.
2449
+ * and 1; sessions are at version 2 here (ADR-078, plus the count note, desk ruling 18 Nov), movements and
2450
+ * closures at version 0.
2178
2451
  *
2179
2452
  * All three are local only, like `pos_orders`: the app creates them and never replicates them
2180
2453
  * (a replicated collection must never take local writes, #53). WCPOS's outbox fields
@@ -2219,6 +2492,8 @@ interface RegisterSession {
2219
2492
  /** A server's expected figures; cleared before every money action (`requireOpenSession`). */
2220
2493
  server_expected?: TenderMap | null;
2221
2494
  server_sales_count?: number | null;
2495
+ /** The cashier's note on the close count, written with the count; null when none. */
2496
+ count_note?: string | null;
2222
2497
  }
2223
2498
  interface CashMovement {
2224
2499
  id: string;
@@ -2410,6 +2685,10 @@ declare function openSession(sessions: RegisterSessionCollection, input: {
2410
2685
  month: number;
2411
2686
  day: number;
2412
2687
  };
2688
+ /**
2689
+ * @deprecated when omitted. Omitting storeKey is deprecated: a session without one writes closures that count as
2690
+ * any store's. It becomes required at the next major.
2691
+ */
2413
2692
  storeKey?: string | null;
2414
2693
  }): Promise<rxdb.RxDocument<RegisterSession, {}, unknown>>;
2415
2694
  declare const startCounting: (sessions: RegisterSessionCollection, id: string) => Promise<rxdb.RxDocument<RegisterSession, {}, unknown>>;
@@ -2419,7 +2698,8 @@ declare const backToSelling: (sessions: RegisterSessionCollection, id: string) =
2419
2698
  * without a business day. `approvedBy`, the manager who approved the count, is written in the same
2420
2699
  * write as the close, and a repeat close keeps the first close's approver as it keeps its count.
2421
2700
  * `approval`, the store's opaque proof (ADR-082), is written to `approver_token` in the same
2422
- * write; it never reaches the closure or its breakdowns.
2701
+ * write; it never reaches the closure or its breakdowns. `note`, the cashier's note on the count, is
2702
+ * written with the count (blank is stored as null); a repeat close keeps the first close's note, as it keeps its count.
2423
2703
  */
2424
2704
  declare function closeSession(sessions: RegisterSessionCollection, id: string, input: {
2425
2705
  counted: Record<string, number>;
@@ -2427,6 +2707,7 @@ declare function closeSession(sessions: RegisterSessionCollection, id: string, i
2427
2707
  approvedBy?: string;
2428
2708
  approval?: string;
2429
2709
  timezone?: string;
2710
+ note?: string;
2430
2711
  }): Promise<rxdb.RxDocument<RegisterSession, {}, unknown>>;
2431
2712
  /**
2432
2713
  * Records a movement on a session that is `open` or `counting`; a closed or missing one is refused.
@@ -2484,12 +2765,19 @@ declare function writeClosure({ closures, register, storeKey, session, counted,
2484
2765
  }): Promise<rxdb.RxDocument<Closure, {}, unknown>>;
2485
2766
 
2486
2767
  declare const REOPENABLE_CODES: readonly string[];
2487
- type ReopenRefusal = 'not_found' | 'not_rejected' | 'code_not_reopenable' | 'already_replaced' | 'session_closed';
2768
+ type ReopenRefusal = 'not_found' | 'store_order' | 'not_rejected' | 'code_not_reopenable' | 'already_replaced' | 'session_closed' | 'coupon_carry_inexact' | 'carried_draft_exists';
2488
2769
  declare class ReopenRefusedOrderError extends Error {
2489
2770
  readonly orderId: string;
2490
2771
  readonly reason: ReopenRefusal;
2491
- constructor(orderId: string, reason: ReopenRefusal);
2772
+ readonly toCollectMinor?: number | undefined;
2773
+ constructor(orderId: string, reason: ReopenRefusal, toCollectMinor?: number | undefined);
2492
2774
  }
2775
+ /**
2776
+ * Reopens a refused sale as a draft; a coupon sale reopens with its coupons carried at the amounts the store charged.
2777
+ * When that carry is not exact it refuses `coupon_carry_inexact`, with `toCollectMinor` the amount still to collect without them.
2778
+ * `{ withoutCoupons: true }` is the explicit drop: the sale reopens without its coupons and the cashier collects the difference.
2779
+ * It refuses `carried_draft_exists` when the parked draft already carries a coupon, rather than return that draft.
2780
+ */
2493
2781
  declare function reopenRefusedOrder(orderId: string, deps: {
2494
2782
  orders: RxCollection<PosOrder>;
2495
2783
  drafts: RxCollection;
@@ -2498,6 +2786,12 @@ declare function reopenRefusedOrder(orderId: string, deps: {
2498
2786
  /** The product's tax class from the catalogue (ProductTraits.getTaxClass); undefined falls back to 'standard'. */
2499
2787
  taxClassOf?: (productId: string, variantId?: string) => string | undefined;
2500
2788
  now?: () => Date;
2789
+ /** The store's capabilities: a coupon carry needs `orderCreate` 4 or more; absent counts as 1, as in finalize. */
2790
+ capabilities?: ServerCapabilities;
2791
+ /** The frozen closures: a carried sale whose closed session's closure lists it reopens after close (ADR-077, Front desk 2026-11-21). */
2792
+ closures?: ClosureCollection;
2793
+ }, options?: {
2794
+ withoutCoupons?: true;
2501
2795
  }): Promise<string>;
2502
2796
 
2503
2797
  /** Only tells that a reopen was started: a UI hint with no accounting meaning. */
@@ -2512,6 +2806,14 @@ type NoteDelivery = 'none' | 'pending' | 'sent' | 'not_sent';
2512
2806
  */
2513
2807
  declare function noteDelivery(order: Pick<PosOrder, 'note' | 'sentVersion'>): NoteDelivery;
2514
2808
 
2809
+ interface ExtrasNotSent {
2810
+ taxIds: boolean;
2811
+ meta: boolean;
2812
+ skuLineIds: string[];
2813
+ }
2814
+ /** ADR-092 condition 1: which of a sale's tax ids, meta and edited SKUs went below order.create 12, so the store never got them. */
2815
+ declare function extrasNotSent(order: Pick<PosOrder, 'customer' | 'meta' | 'lines' | 'sentVersion'>): ExtrasNotSent;
2816
+
2515
2817
  type SaleContent = Pick<PosOrder, 'totalMinor' | 'currency' | 'lines' | 'payments'>;
2516
2818
  /**
2517
2819
  * Whether two orders carry the same money-bearing content: `totalMinor` and `currency`; each line's
@@ -2525,6 +2827,32 @@ declare class OrderContentMismatchError extends Error {
2525
2827
  constructor(orderId: string);
2526
2828
  }
2527
2829
 
2830
+ /**
2831
+ * What the store owes back on a stored sale (ADR-090, desk Q4 2026-11-17): the stored `refundDueMinor`, which
2832
+ * `finalizeOrder` writes on every reopened sale (0 when nothing is due); a till sale and a row stored before v15 have
2833
+ * none, and for those `sum(payments) − total`, never below 0, gives 0 because a till sale's cash leg is capped at the balance.
2834
+ */
2835
+ declare function refundDueOf(order: Pick<PosOrder, 'refundDueMinor' | 'payments' | 'totalMinor'>): number;
2836
+ /**
2837
+ * The same figure for a sale still in the builder: the locked legs (the store's own, ADR-090) beyond the new total.
2838
+ * Unlocked legs never count, so a cashier's cash overpayment stays change.
2839
+ */
2840
+ declare function lockedRefundDueMinor(order: {
2841
+ payments: readonly Pick<Payment, 'locked' | 'amountMinor'>[];
2842
+ totalMinor: number;
2843
+ }): number;
2844
+ /**
2845
+ * The till legs a reopened sale may not keep (ADR-090 gate 36c): once the store's locked legs cover the total, every
2846
+ * unlocked payment is refused. Mirrors finalizeOrder's desk Q6 check (finalize.ts:193-197), so the pane can name and
2847
+ * remove them before Complete instead of after it throws. It judges only captured legs, the ones useSale's complete
2848
+ * passes to finalizeOrder (use-sale.ts:713), so a voided or failed till leg is never named.
2849
+ */
2850
+ declare function tillLegsTheStoreRefuses(order: {
2851
+ storeOrder?: unknown;
2852
+ totalMinor: number;
2853
+ payments: readonly Pick<Payment, 'id' | 'locked' | 'amountMinor' | 'status'>[];
2854
+ }): string[];
2855
+
2528
2856
  type MovementType = 'paid_in' | 'paid_out' | 'no_sale';
2529
2857
  declare function normalizeAmount(raw: string): string;
2530
2858
  /** Whether the server's `decimal()` would accept this string. */
@@ -2539,16 +2867,6 @@ declare function movementFieldError(input: {
2539
2867
  reason: string;
2540
2868
  }): 'amount' | 'reason' | null;
2541
2869
 
2542
- /**
2543
- * What the register should hold at close, per tender method: the session's cash float plus
2544
- * captured payments and cash movements — never what the cashier counts. Port provenance
2545
- * (ADR-032 amendment 1): WCPOS `next` `3b5331b5c`.
2546
- *
2547
- * Refunds come from the till's applied `pos_refunds`, counted in the record's own `sessionId`
2548
- * (ADR-080 amendment 1), by the server's rule. WCPOS's `attributeRefunds` fallbacks (allocations,
2549
- * `refunded_amount`) are not ported: the store attributes each refund to a tender in `byMethod`.
2550
- */
2551
-
2552
2870
  type RefundRow = Pick<PosRefund, 'id' | 'sessionId' | 'status' | 'result'>;
2553
2871
  /** `session_id`, `kind`, `method_id`, `status` kept as WCPOS names them; money is TallyUI's integer-minor-units convention. */
2554
2872
  type LedgerRow = {
@@ -2610,6 +2928,15 @@ interface DrawerTerms {
2610
2928
  * method's figure is its `otherTenders` amount. A refund counts once per method it touches.
2611
2929
  */
2612
2930
  declare function deriveDrawerTerms(input: Parameters<typeof deriveExpected>[0]): DrawerTerms;
2931
+ /**
2932
+ * Takings per payment method for one session, for the closure sheet: this till's captured payments (`tillPayments`) of the
2933
+ * orders whose `sessionId` is `sessionId`, keyed by `legMethodId`'s kind plus id (`external:stripe`), with the number of
2934
+ * payments behind each. Local only, never synced: register rows and payloads keep `method_id: payment.method` (#256, ADR-070
2935
+ * decision 1). A leg with no methodId keys exactly as deriveDrawerTerms does (`cash` or its method); the figures sum to
2936
+ * deriveDrawerTerms' cash sales plus other tenders for the same orders. Refunds and movements are not here: they are keyed
2937
+ * by the wire method. The map has no prototype, so a platform id such as `__proto__` or `toString` is a key like any other.
2938
+ */
2939
+ declare function takingsByMethod(orders: readonly Pick<PosOrder, 'sessionId' | 'payments'>[], sessionId: string): Record<string, DrawerTerm>;
2613
2940
 
2614
2941
  /**
2615
2942
  * The pure maths behind a register count: variance against the expected float, a display
@@ -2682,33 +3009,11 @@ declare function addRegisterSessionCollection(db: RxDatabase, closeWaitMs?: numb
2682
3009
  * arithmetic on a2's `*_minor` fields and tender maps.
2683
3010
  */
2684
3011
 
2685
- type Correction = {
2686
- id: number;
2687
- type: 'late_sale' | 'late_movement' | 'recount';
2688
- created_at: string;
2689
- actor: {
2690
- id: string;
2691
- name: string;
2692
- };
2693
- approver: {
2694
- id: string;
2695
- name: string;
2696
- } | null;
2697
- reason: string;
2698
- figures: {
2699
- expected_delta?: Record<string, number>;
2700
- cash_delta?: number;
2701
- sales_delta?: number;
2702
- refunds_delta?: number;
2703
- counted?: Record<string, number>;
2704
- variance?: Record<string, number>;
2705
- };
2706
- };
2707
3012
  type RecordedFigures = Pick<Closure, 'expected' | 'counted' | 'variance' | 'period_sales_total_minor' | 'period_refunds_total_minor' | 'perpetual_sales_total_minor' | 'perpetual_refunds_total_minor'>;
2708
3013
  /**
2709
3014
  * Folds `corrections` onto `recorded`, ordered by `created_at` then `id`, deduplicated by `id`.
2710
3015
  * A `recount` replaces the supplied tenders in `counted`; a `late_movement` adds its signed
2711
- * `cash_delta` to expected cash; a `late_sale` adds its `expected_delta` tenders to expected and
3016
+ * `cash_delta` to expected cash; a `late_sale` or `late_refund` adds its `expected_delta` tenders to expected and
2712
3017
  * its `sales_delta`/`refunds_delta` to both the period and perpetual totals. Variance is
2713
3018
  * recomputed for every tender named by expected or counted, once any correction applies.
2714
3019
  * `touched` names every field, or `field.tender`, whose settled value differs from `recorded`.
@@ -2798,6 +3103,7 @@ declare const labelKeys: {
2798
3103
  void: string;
2799
3104
  copy: string;
2800
3105
  };
3106
+ declare const ENGLISH_CLOSURE_LABELS: Record<keyof typeof labelKeys, string>;
2801
3107
 
2802
3108
  type ClosureScope = {
2803
3109
  from: string;
@@ -2813,7 +3119,8 @@ declare function clampClosureScope(scope: ClosureScope, today: string, historyDa
2813
3119
  * `business_day` (a legacy or remote row) gets one from `opened_at` in `timezone`, reusing a2's
2814
3120
  * `businessDayOf` rather than duplicating it. Register and cashier are optional filters; the
2815
3121
  * store is not — a row's `store_key` must equal `scope.storeKey` (both `null` when neither is
2816
- * set), as WCPOS always compared `store_id`.
3122
+ * set), as WCPOS always compared `store_id`. A closure with no `store_key` (absent or `null`)
3123
+ * counts as this store's (#665), as `register-adoption.ts` does when it renumbers.
2817
3124
  */
2818
3125
  declare function selectClosureRows(rows: readonly Closure[], scope: ClosureScope, timezone: string): {
2819
3126
  business_day: string;
@@ -2854,16 +3161,12 @@ declare function selectClosureRows(rows: readonly Closure[], scope: ClosureScope
2854
3161
  number_retried?: boolean;
2855
3162
  }[];
2856
3163
 
2857
- /**
2858
- * Minor-unit money formatting shared across the register package (moved out of `export-csv.ts` so
2859
- * `closure-document.ts` reuses the same implementation instead of duplicating it).
2860
- */
2861
- /**
2862
- * `minor` as a fixed-point decimal string with exactly `exponent` places: `-50` at exponent 2 is
2863
- * `'-0.50'`, `1250` is `'12.50'`, and at exponent 0, `1500` is `'1500'`. Integer maths only —
2864
- * sign, `Math.trunc`, and the remainder padded to `exponent` digits — no `toFixed` on floats.
2865
- */
2866
- declare function minorToDecimal(minor: number, exponent: number): string;
3164
+ /** Formats a decimal amount as currency; preserves empty, non-finite or unformattable input. */
3165
+ declare function formatDecimalMoney(value: string, options: {
3166
+ currency: string;
3167
+ exponent: number;
3168
+ locale?: string;
3169
+ }): string;
2867
3170
 
2868
3171
  type Values = Record<string, unknown>;
2869
3172
  /**
@@ -2871,6 +3174,8 @@ type Values = Record<string, unknown>;
2871
3174
  * desk, 2026-09-30). The closure template lives in the apps, so the document carries it ready to print.
2872
3175
  */
2873
3176
  declare const TAX_ROUNDING_MIXED_NOTE = "This register's sales used more than one tax rounding method. Each sale's tax is as its receipt showed.";
3177
+ /** The Z report's line when the session holds a reopened sale: its tax rates are the whole order's (ADR-090 ruling 38). */
3178
+ declare const TAX_STORE_PAID_NOTE = "Tax rates include tax on amounts paid earlier in the store.";
2874
3179
  type ClosureContext = {
2875
3180
  store: Values;
2876
3181
  currency: string;
@@ -2890,9 +3195,27 @@ type ClosureContext = {
2890
3195
  */
2891
3196
  breakdowns?: Values;
2892
3197
  };
3198
+ type CreateClosureContextOptions = {
3199
+ currency: string;
3200
+ store: Record<string, unknown>;
3201
+ /** Defaults to minorUnitDigits(currency) from @tallyui/core. */
3202
+ exponent?: number;
3203
+ /** Defaults to the runtime's Intl locale. */
3204
+ locale?: string;
3205
+ /** Defaults to 'device' (formatClosureDate then uses the runtime's zone). */
3206
+ timezone?: string;
3207
+ /** Defaults to new Date().toISOString(). */
3208
+ printedAt?: string;
3209
+ /** Merged over ENGLISH_CLOSURE_LABELS; extra keys pass through to i18n. */
3210
+ labels?: Record<string, string>;
3211
+ expected?: Record<string, number>;
3212
+ breakdowns?: Record<string, unknown>;
3213
+ };
3214
+ declare function createClosureContext(options: CreateClosureContextOptions): ClosureContext;
2893
3215
  declare function formatClosureDate(value: string | null | undefined, context: Pick<ClosureContext, 'timezone' | 'locale'>): Record<string, string>;
2894
3216
  declare function buildClosureDocument(row: Closure, context: ClosureContext): {
2895
3217
  closure: {
3218
+ tax_store_paid_note?: string | undefined;
2896
3219
  tax_rounding_note?: string | undefined;
2897
3220
  has_sales: boolean;
2898
3221
  has_perpetual: boolean;
@@ -3004,6 +3327,7 @@ declare function buildClosureDocument(row: Closure, context: ClosureContext): {
3004
3327
  };
3005
3328
  declare function buildXReportDocument(session: RegisterSession, context: ClosureContext): {
3006
3329
  closure: {
3330
+ tax_store_paid_note?: string | undefined;
3007
3331
  tax_rounding_note?: string | undefined;
3008
3332
  has_sales: boolean;
3009
3333
  has_perpetual: boolean;
@@ -3170,8 +3494,10 @@ declare const registerCommandCollection: () => {
3170
3494
  type BuiltCommand = Pick<RegisterCommand, 'key' | 'type' | 'payload'> & {
3171
3495
  version: 1 | 2 | 3;
3172
3496
  };
3497
+ /** The options make a v2 open, or version 3 at register contract 3 (#1105); the payload is v2's. */
3173
3498
  declare function sessionOpenCommand(s: RegisterSession, v2?: {
3174
3499
  deviceName?: string | null;
3500
+ registerContract?: number;
3175
3501
  }): BuiltCommand;
3176
3502
  declare function sessionTransitionCommand(s: RegisterSession & {
3177
3503
  status: RegisterSessionTransitionPayload['status'];
@@ -3221,7 +3547,7 @@ declare function adoptRegisterResults({ commands, sessions, registerId, host, st
3221
3547
  closures?: ClosureCollection;
3222
3548
  }): Promise<void>;
3223
3549
  declare function takeOverSession({ commands, sessions, sessionId, now, registerContract }: SessionTarget & {
3224
- /** The store's register contract (`capabilities.register`); take over needs 2, and a missing value counts as below 2. */
3550
+ /** The store's register contract (`capabilities.register`); take over needs 2, and a missing value counts as below 2; 3 sends the take-over as version 3 (#1105). */
3225
3551
  registerContract?: number;
3226
3552
  }): Promise<void>;
3227
3553
  declare function abandonSession(input: SessionTarget): Promise<void>;
@@ -3422,6 +3748,7 @@ declare function useRegisterSession(options: UseRegisterSessionOptions): {
3422
3748
  approvedByName?: string;
3423
3749
  approval?: string;
3424
3750
  approvedVariance?: Record<string, number>;
3751
+ note?: string;
3425
3752
  }) => Promise<rxdb.RxDocument<Closure, {}, unknown>>;
3426
3753
  /** ADR-082 d3: the variance this count would close with, read as the gate reads it; the app sends it to its approval route and back as `approvedVariance`. */
3427
3754
  closureVariance: (counted: Record<string, number>) => Promise<{
@@ -3671,6 +3998,9 @@ interface SaleDiscountCodes<Accepted = unknown> {
3671
3998
  beforeResume?(sale: SaleDiscountState<Accepted>): Promise<void>;
3672
3999
  }
3673
4000
 
4001
+ /** ADR-092 6a: the refusal of a tax id list order.create 12 could not carry (setTaxIds, setCustomer, tender entry, finalize). */
4002
+ declare const TAX_IDS_INVALID = "Each tax id needs a type of at most 32 characters and a number of at most 64, no two the same; a country is a two-letter code, and a sale takes at most 10.";
4003
+
3674
4004
  /** Logs a throw from onSaleCompleted for a confirmed pending completion newSale() has abandoned (Continue): nothing else would ever surface it. */
3675
4005
  declare const saleLogger: Logger;
3676
4006
  type SaleStage = {
@@ -3690,15 +4020,54 @@ declare const SALE_SAVING = "This sale is being saved. Retry to finish it.";
3690
4020
  declare const PAYMENT_IN_MOTION = "Finish or void the payment in progress before completing the sale";
3691
4021
  /**
3692
4022
  * `switchSale()` and `closeSale()` refuse a sale whose legs took money (u19). v2 keeps a partly paid order's legs on
3693
- * switching, but a TallyUI draft keeps no tender stage, the next `startTender` replaces every leg, and `resume`
3694
- * re-checks coupons: so the sale stays on the till until it is paid or its paid legs are voided.
4023
+ * switching, but a TallyUI draft keeps no tender stage, the next `startTender` replaces every unlocked leg but a kept
4024
+ * paid draft's parked legs, and `resume` keeps a paid draft's parked coupons (ADR-077 d3, amended 2026-11-19): so the
4025
+ * sale stays on the till until it is paid or its paid legs are voided.
3695
4026
  */
3696
4027
  declare const SALE_PARTLY_PAID = "This sale is partly paid. Take the rest of the payment or void the paid legs first.";
3697
4028
  declare const SALE_IN_TENDER = "Finish or cancel the payment before switching sales";
4029
+ /**
4030
+ * Line and total changes refuse with this while a till leg is live, as v2's resolveStage stills the cart (tally-woo 11c).
4031
+ * "Cancel the payment" names the leg's button, `pos_checkout.cancel_payment` ("Cancel payment") in packages/components.
4032
+ */
4033
+ declare const SALE_HAS_PAYMENT = "A payment was taken on this sale. Cancel the payment before changing the sale.";
4034
+ /** On the receipt the finished sale refuses edits and re-tender with this; `add` starts the next sale instead (v2 #2861). */
4035
+ declare const SALE_FINISHED = "This sale is finished. Start a new sale to change it.";
3698
4036
  /** startTender and complete() refuse with this while the order's store-priced coupons are stale or being priced again (TallyUI#710). */
3699
4037
  declare const COUPONS_REPRICING = "Coupon prices are being checked; try again in a moment";
4038
+ /** Coupon changes refuse with this while a store-priced coupon is carried. */
4039
+ declare const COUPON_CARRIED = "The store refused this sale's coupon, so it is carried at the amount charged. Coupons can't be added or removed on this sale.";
4040
+ /** Tender and completion refuse with this after a carried coupon's pricing basis changes. */
4041
+ declare const COUPON_CARRY_STALE = "The sale changed after the store refused its coupon, so the amount carried for it no longer applies. Reopen the sale without the coupon to take payment.";
4042
+ /** startTender refuses with this when the app's tenderGate rejects instead of answering. */
4043
+ declare const TENDER_GATE_FAILED = "The checkout check failed, so the tender did not start";
4044
+ /** 5.2 backlog F5: startTender shows this when a re-tax swapped the sale while the tender gate ran; the tender does not start. */
4045
+ declare const TENDER_SALE_CHANGED = "The sale changed while the checkout check ran; start the payment again.";
3700
4046
  /** #722: setCustomer's refusal of a customer whose address moves the sale's rates once they can no longer change (tender, receipt, money live); interim until #759 re-taxes like v2. */
3701
4047
  declare const CUSTOMER_RETAX_REFUSED = "This customer would change the tax on this sale. To use them, cancel the payment and change the customer in the cart, or start a new order.";
4048
+ /** Desk Q7.4 (19 Nov): setAddresses' refusal once the sale left the cart or money is live; the address changes only in the cart. */
4049
+ declare const ADDRESS_CHANGE_REFUSED = "The address can only change in the cart. Cancel the payment to change it, or start a new order.";
4050
+ /** ADR-092 6a: setTaxIds' refusal once the sale left the cart or money is live; the tax ids change only in the cart. */
4051
+ declare const TAX_IDS_CHANGE_REFUSED = "Tax ids can only change in the cart. Cancel the payment to change them, or start a new order.";
4052
+
4053
+ /** ADR-092 6d: setMeta's refusal once the sale left the cart or money is live; custom fields change only in the cart. */
4054
+ declare const META_CHANGE_REFUSED = "Custom fields can only change in the cart. Cancel the payment to change them, or start a new order.";
4055
+ /** ADR-092 6d: setMeta's refusal of an empty, too long or `_` key, or of a new key past ORDER_META_MAX. */
4056
+ 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.";
4057
+ /** 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. */
4058
+ 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.";
4059
+ /** #1095: restore()'s refusal of a removal whose sale moved on (reset, parked, finished) or that is already back. */
4060
+ declare const RESTORE_STALE = "This item can no longer be put back. Add it again.";
4061
+ /** Taken by `removal()` before a remove; pass it to `restore()`. Hosts never build one. */
4062
+ type SaleRemoval = {
4063
+ readonly kind: 'line' | 'fee' | 'shipping';
4064
+ readonly id: string;
4065
+ readonly item: LineItem | ChargeLine;
4066
+ readonly index: number;
4067
+ readonly orderId: string;
4068
+ readonly taxContext: TaxContext;
4069
+ readonly epoch: number;
4070
+ };
3702
4071
  /** Call under a `TaxProvider`: its tax context and the settings' currency price every sale. */
3703
4072
  declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscountsSequentially'>, opts: {
3704
4073
  registerId: string;
@@ -3706,6 +4075,14 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3706
4075
  capabilities?: ServerCapabilities;
3707
4076
  /** The platform's discount codes (ADR-077 amendment 3), e.g. woocommerceDiscountCodes.createDiscountCodes(source); without them, applyCoupon refuses with COUPONS_UNSUPPORTED. */
3708
4077
  discountCodes?: SaleDiscountCodes<any>;
4078
+ /**
4079
+ * Awaited after startTender's own checks, before the tender starts (ADR-089 D11): resolves to a refusal to show,
4080
+ * or null to start. Typically `(attempt) => host.dispatch('checkout.tender.start', attempt, sources)` from
4081
+ * `@tallyui/extensions`. Without it startTender starts at once, as before; a rejection refuses with TENDER_GATE_FAILED.
4082
+ */
4083
+ tenderGate?: (attempt: {
4084
+ method: 'cash' | 'external';
4085
+ }) => Promise<string | null>;
3709
4086
  /**
3710
4087
  * Put on every new sale, as v2's store setting `default_customer` (or the cashier, `default_customer_is_cashier`)
3711
4088
  * is on every new cart: the first sale and each one after complete, discard, park, newSale or a switch to New,
@@ -3762,7 +4139,7 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3762
4139
  saving: boolean;
3763
4140
  /** The failed save's order is confirmed stored (see `isStored`): the UI also offers Continue (`continueSale()`). */
3764
4141
  canContinue: boolean;
3765
- /** Adds the entry, as a new line or one more on its line; returns that line's id, or the refusal `error` now shows. */
4142
+ /** Adds the entry, as a new line or one more on its line; returns that line's id, or the refusal `error` now shows. On the receipt it starts the next sale first (v2 #2861). */
3766
4143
  add(entry: CatalogueEntry<any>, traits: ProductTraits<any>): {
3767
4144
  lineId: string;
3768
4145
  } | string;
@@ -3802,7 +4179,21 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3802
4179
  } | string;
3803
4180
  /** Sets a line's unit price in minor units of its own tax mode, recomputing discounts and tax; returns a refusal or null. */
3804
4181
  setUnitPrice(lineId: string, amountMinor: number): string | null;
4182
+ /**
4183
+ * ADR-092 6b/6c: edits a cart line's `name`, `sku` or `regularUnitPriceMinor` (`null` removes it); the regular price is
4184
+ * the "was" price that receipts print and order.create 6+ sends. Cart only; returns a refusal or null: editRefusal's
4185
+ * refusals first (SALE_SAVING, SALE_FINISHED, SALE_HAS_PAYMENT), then LINE_EDIT_REFUSED for any other stage outside the cart.
4186
+ */
4187
+ updateLine(lineId: string, patch: {
4188
+ name?: string;
4189
+ sku?: string;
4190
+ regularUnitPriceMinor?: number | null;
4191
+ }): string | null;
3805
4192
  remove(lineId: string): void;
4193
+ /** #1095: the line, fee or shipping line `id` as it is now, taken before a remove for `restore()`; null when it is not there. */
4194
+ removal(kind: SaleRemoval["kind"], id: string): SaleRemoval | null;
4195
+ /** #1095, v2's Undo: puts a removal back at its old index (clamped), re-taxed when the sale's rates moved since; returns a refusal or null. */
4196
+ restore(removal: SaleRemoval): string | null;
3806
4197
  /** A line's discount, or the order's without a line; returns the refusal to show, or null once applied. */
3807
4198
  applyDiscount(lineId: string | null, discount: Discount): string | null;
3808
4199
  removeDiscount(id: string): void;
@@ -3817,7 +4208,22 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3817
4208
  /** The sale's note, kept on the open sale (parked and resumed with it, cleared by newSale) and sent as order.create v7's note (ADR-083). */
3818
4209
  setNote(note: string): void;
3819
4210
  /** the picked customer reaches the server as order.create v3's customer.customerId */
3820
- setCustomer(customer: CustomerSummary | null): void;
4211
+ setCustomer(picked: CustomerSummary | null): void;
4212
+ /**
4213
+ * Replaces both addresses on the picked customer (`undefined` removes one) and re-taxes like `setCustomer`. Does
4214
+ * nothing and returns false for a guest sale (guests come later); refuses once the sale left the cart (desk Q7.4).
4215
+ */
4216
+ setAddresses(billing: CustomerAddress | undefined, shipping: CustomerAddress | undefined): boolean;
4217
+ /** Replaces the picked customer's tax ids on this sale (`[]` removes them). Returns false for a guest sale, as `setAddresses`
4218
+ * does; refuses once the sale left the cart, and refuses an invalid list (ADR-092 6a). It does not re-tax, and it does
4219
+ * not save them to the customer (the customer editor does). */
4220
+ setTaxIds(taxIds: CustomerTaxId[]): boolean;
4221
+ /**
4222
+ * Sets one custom field on this sale (ADR-092 4 and 6d). It replaces the value when the key is there, and removes the
4223
+ * field when `value` is null. It refuses once the sale has left the cart, and it refuses an invalid key. The value is
4224
+ * cut to its bound when the order is frozen, as the note is.
4225
+ */
4226
+ setMeta(key: string, value: string | null): boolean;
3821
4227
  /**
3822
4228
  * Pins `options.session` for this tender when given, else the rendered `session` option. Pass the
3823
4229
  * session `useRegisterSession`'s `requireSaleSession()` returned: the rendered one can lag a session
@@ -3831,20 +4237,24 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3831
4237
  }): void;
3832
4238
  setTender: (tender: {
3833
4239
  method: "cash" | "external";
4240
+ methodId?: string;
3834
4241
  amountMinor: number;
3835
4242
  reference?: string;
3836
4243
  } | null) => void;
3837
- /** 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. */
4244
+ /** 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). */
3838
4245
  addTender(tender: {
3839
4246
  method: "cash" | "external";
4247
+ methodId?: string;
3840
4248
  amountMinor: number;
4249
+ tenderedMinor?: number;
3841
4250
  reference?: string;
4251
+ units?: Readonly<Record<string, number>>;
3842
4252
  status?: "pending" | "authorized" | "captured";
3843
4253
  }): string | null;
3844
4254
  setTenderStatus(paymentId: string, status: "authorized" | "captured" | "failed"): boolean;
3845
- /** The leg stays in order.payments as voided and counts nothing; removeTender still removes a leg outright. */
4255
+ /** The leg stays in order.payments as voided and counts nothing; removeTender still removes a leg outright. Refused on the receipt. */
3846
4256
  voidTender(paymentId: string): boolean;
3847
- /** ADR-072: remove one tender and its dropped-reference warning. An id not among the payments changes nothing. */
4257
+ /** ADR-072: remove one tender and its dropped-reference warning. An id not among the payments changes nothing. Refused on the receipt. */
3848
4258
  removeTender(paymentId: string): void;
3849
4259
  cancelTender(): void;
3850
4260
  /**
@@ -3879,6 +4289,10 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3879
4289
  newSale(): void;
3880
4290
  /** Parks the cart in `drafts`; resolves to a refusal message, or null once parked. */
3881
4291
  park(): Promise<string | null>;
4292
+ /** Whether the live sale or a parked draft holds this store order; unreadable drafts do not count. */
4293
+ holdsStoreOrder(orderId: string): Promise<boolean>;
4294
+ /** Loads a reopened store order (from reopenStoreOrder) into an empty sale, or returns why not. */
4295
+ openStoreOrder(order: Order): string | null;
3882
4296
  /** Resumes a draft into an empty cart; resolves to a refusal message, or null once resumed. */
3883
4297
  resume(draftId: string, options?: {
3884
4298
  keepParkedPrices?: boolean;
@@ -3890,7 +4304,8 @@ declare function useSale(settings: Pick<StoreSettings, 'currency' | 'calcDiscoun
3890
4304
  * the tender stage. Resolves to a refusal (park's, or `resume`'s for the chosen draft), or null.
3891
4305
  */
3892
4306
  switchSale(draftId: string | null): Promise<string | null>;
3893
- /** 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. */
4307
+ /** 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.
4308
+ * A reopened sale's locked store legs do not stop it closing; the store order stays reopened, as in v2. */
3894
4309
  closeSale(): string | null;
3895
4310
  /**
3896
4311
  * Continue after a failed save whose order is confirmed stored (`canContinue`): exactly `newSale()`.
@@ -4000,13 +4415,17 @@ declare function createTillPeerLink(options: PeerLinkOptions): PeerLink;
4000
4415
  /** A display's end (the answerer): it answers the first offer and takes the till's channel. */
4001
4416
  declare function createDisplayPeerLink(options: PeerLinkOptions): PeerLink;
4002
4417
 
4003
- /** TallyUI's choice: how often a waiting display asks whether the cashier has confirmed. */
4418
+ /** TallyUI's choice: how often a waiting display asks whether the cashier has confirmed.
4419
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4004
4420
  declare const COLLECT_POLL_MS = 2000;
4005
- /** TallyUI's choice: how often a paired display drains its inbox while no link is open. */
4421
+ /** TallyUI's choice: how often a paired display drains its inbox while no link is open.
4422
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4006
4423
  declare const DISPLAY_SIGNAL_POLL_MS = 1000;
4007
- /** TallyUI's choice: how often it drains its inbox while a link is open, so a re-linking till's offer is still seen. */
4424
+ /** TallyUI's choice: how often it drains its inbox while a link is open, so a re-linking till's offer is still seen.
4425
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4008
4426
  declare const OPEN_SIGNAL_POLL_MS = 5000;
4009
- /** TallyUI's choice: how often it reads the snapshot fallback while no link is open. */
4427
+ /** TallyUI's choice: how often it reads the snapshot fallback while no link is open.
4428
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4010
4429
  declare const SNAPSHOT_POLL_MS = 2000;
4011
4430
  /** Where the display keeps its token; U8 binds it to a local collection that is never replicated (ADR-085 d5). */
4012
4431
  interface DisplayTokenStore {
@@ -4092,25 +4511,55 @@ interface SnapshotSender {
4092
4511
  }): void;
4093
4512
  stop(): void;
4094
4513
  }
4514
+ /** @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4095
4515
  declare const SNAPSHOT_MIN_INTERVAL_MS = 1000;
4516
+ /** @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4096
4517
  declare const SNAPSHOT_RESEND_MS = 20000;
4097
- /** The server keeps a snapshot for at most 60 s (ADR-085 d8). */
4518
+ /** The server keeps a snapshot for at most 60 s (ADR-085 d8).
4519
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4098
4520
  declare const SNAPSHOT_LIFETIME_MS = 60000;
4099
4521
  /** One display's snapshot fallback (ADR-085 d8): it posts the display's state while its data channel is not open. */
4100
4522
  declare function createSnapshotSender({ post, clock, onError }: SnapshotSenderOptions): SnapshotSender;
4101
4523
 
4102
- /** How often the till drains its signal inbox while a link is connecting; TallyUI's choice. */
4524
+ /** Where the till keeps its device key (TallyUI#754): next to its device id, never replicated. Its errors never carry the key. */
4525
+ interface TillDeviceKeyStore {
4526
+ load(): Promise<string | null>;
4527
+ save(key: string): Promise<void>;
4528
+ clear(): Promise<void>;
4529
+ }
4530
+ interface TillDeviceOptions {
4531
+ signalling: DisplaySignalling;
4532
+ /** The till's device id: an identifier, not a credential. */
4533
+ deviceId: string;
4534
+ keys: TillDeviceKeyStore;
4535
+ /** A key store failure on save or clear, for logs; never throws into the handle. A key that fails to save is held only in memory, so after a restart the till is refused until an admin resets it. */
4536
+ onError?: (error: unknown) => void;
4537
+ }
4538
+ /** The till's credential for every till-side call; `createTillPairing` and `createTillDisplayService` share one. */
4539
+ interface TillDeviceHandle {
4540
+ /** The stored key with the device id, registering first when none is stored (one registration for concurrent callers). */
4541
+ device(ctx: SyncContext): Promise<TillDevice>;
4542
+ /** Clears the stored key after the server refused it, so the next `device` registers again. */
4543
+ refused(): Promise<void>;
4544
+ }
4545
+ /** The till side of the device key (ADR-085, TallyUI#754): it loads the key, or registers once and saves it. */
4546
+ declare function createTillDevice(options: TillDeviceOptions): TillDeviceHandle;
4547
+
4548
+ /** How often the till drains its signal inbox while a link is connecting; TallyUI's choice.
4549
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4103
4550
  declare const SIGNAL_POLL_MS = 1000;
4104
- /** How often the till lists its displays; TallyUI's choice. */
4551
+ /** How often the till lists its displays; TallyUI's choice.
4552
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4105
4553
  declare const LIST_POLL_MS = 10000;
4106
- /** How long a link may stay connecting before it counts as a drop; TallyUI's choice. */
4554
+ /** How long a link may stay connecting before it counts as a drop; TallyUI's choice.
4555
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4107
4556
  declare const CONNECT_TIMEOUT_MS = 30000;
4108
4557
  interface TillDisplayServiceOptions {
4109
4558
  signalling: DisplaySignalling;
4110
4559
  /** The cashier session; null while nobody is logged in, which stops every server call (d5). */
4111
4560
  context: () => SyncContext | null;
4112
- /** The till's own device id (d5); U8 stores it. */
4113
- deviceId: string;
4561
+ /** The till's device (d5, TallyUI#754), from `createTillDevice`; its key is never logged or reported. */
4562
+ device: TillDeviceHandle;
4114
4563
  advertisement: DisplayAdvertisement;
4115
4564
  /** One display's config: the store, i18n and idle settings, with `display` from its record. */
4116
4565
  configFor: (display: DisplayRecord) => DisplayConfig;
@@ -4120,12 +4569,15 @@ interface TillDisplayServiceOptions {
4120
4569
  onError?: (error: unknown) => void;
4121
4570
  }
4122
4571
  type TillDisplayStatus = 'online' | 'offline' | 'paused' | 'closed';
4572
+ type TillDisplayPauseReason = 'signed_out' | 'forbidden' | 'device_refused';
4123
4573
  interface TillDisplayEntry {
4124
4574
  display: DisplayRecord;
4125
4575
  link: PeerLinkState;
4126
4576
  }
4127
4577
  interface TillDisplayService extends DisplayLink {
4128
4578
  readonly status: TillDisplayStatus;
4579
+ /** Why the service is `paused`; null in every other status. */
4580
+ readonly pauseReason: TillDisplayPauseReason | null;
4129
4581
  /** The owned displays from the last successful list, each with its current link's state. */
4130
4582
  readonly displays: readonly TillDisplayEntry[];
4131
4583
  /** Called after any change to `status` or `displays`; returns the unsubscribe. */
@@ -4140,9 +4592,10 @@ interface TillDisplayService extends DisplayLink {
4140
4592
  */
4141
4593
  declare function createTillDisplayService(options: TillDisplayServiceOptions): TillDisplayService;
4142
4594
 
4143
- /** How often the till lists the claims on its code while it shows one; TallyUI's choice. */
4595
+ /** How often the till lists the claims on its code while it shows one; TallyUI's choice.
4596
+ * @deprecated Internal tuning value, not supported API; leaves the public entry at the next major. */
4144
4597
  declare const PENDING_POLL_MS = 2000;
4145
- type PairingError = 'forbidden' | 'limit' | 'expired' | 'not_found' | 'network' | 'server';
4598
+ type PairingError = 'forbidden' | 'limit' | 'expired' | 'not_found' | 'device_refused' | 'network' | 'server';
4146
4599
  type PairingPhase = {
4147
4600
  phase: 'idle';
4148
4601
  error?: PairingError;
@@ -4161,8 +4614,8 @@ interface TillPairingOptions {
4161
4614
  signalling: DisplaySignalling;
4162
4615
  /** The cashier session; null while nobody is logged in, which refuses every call as `forbidden` (d5). */
4163
4616
  context: () => SyncContext | null;
4164
- /** The till's own device id (d5). */
4165
- deviceId: string;
4617
+ /** The till's device (d5, TallyUI#754), from `createTillDevice`; its key is never logged or reported. */
4618
+ device: TillDeviceHandle;
4166
4619
  /** U4's service, refreshed after a confirm or a forget. */
4167
4620
  service?: Pick<TillDisplayService, 'refresh'>;
4168
4621
  clock?: ServiceClock;
@@ -4196,12 +4649,32 @@ interface TillPairingView {
4196
4649
  interface TillDisplaysView {
4197
4650
  status: TillDisplayStatus;
4198
4651
  displays: readonly TillDisplayEntry[];
4652
+ pauseReason: TillDisplayPauseReason | null;
4199
4653
  }
4200
4654
  /** The till pairing's phase and last forget refusal, re-rendered on each change; null gives idle. */
4201
4655
  declare function useTillPairing(pairing: TillPairing | null): TillPairingView;
4202
4656
  /** The till display service's status and displays, re-rendered on each change; null gives `closed` with none. */
4203
4657
  declare function useTillDisplays(service: TillDisplayService | null): TillDisplaysView;
4204
4658
 
4659
+ /** Customer form values to a create input or an update patch, with WCPOS v2's rules (MIT, WCPOS). Pure: writes nothing. */
4660
+
4661
+ /** The customers screen's form values. `shipping` undefined is "Same as billing" (ShippingAddressFields' convention). */
4662
+ interface CustomerEditValues {
4663
+ firstName: string;
4664
+ lastName: string;
4665
+ email: string;
4666
+ phone: string;
4667
+ company?: string;
4668
+ billing?: CustomerAddress;
4669
+ shipping?: CustomerAddress;
4670
+ }
4671
+ /** Shipping follows billing while no part is set, or every part equals billing's; email is never compared. */
4672
+ declare function shipsToBilling(shipping: CustomerAddress | undefined, billing: CustomerAddress | undefined): boolean;
4673
+ /** Form values to what `createCustomer` takes. */
4674
+ declare function toCustomerInput(values: CustomerEditValues): CustomerInput;
4675
+ /** Form values to what `updateCustomer` takes: only what changed; an address is sent whole. Does not validate. */
4676
+ declare function toCustomerPatch(before: Customer, values: CustomerEditValues): CustomerPatch;
4677
+
4205
4678
  /**
4206
4679
  * Filters product documents by a cashier's search term, through traits, so
4207
4680
  * it works the same on every backend.
@@ -4220,6 +4693,22 @@ declare function listCategories<Doc>(docs: readonly Doc[], traits: ProductTraits
4220
4693
  /** Whether `doc` is in the category with this id. */
4221
4694
  declare function inCategory<Doc>(doc: Doc, categoryId: string, traits: ProductTraits<Doc>): boolean;
4222
4695
 
4696
+ /** One term group across a set of products, e.g. Brand with its terms. */
4697
+ interface ProductTermGroup {
4698
+ id: string;
4699
+ name: string;
4700
+ terms: {
4701
+ id: string;
4702
+ name: string;
4703
+ }[];
4704
+ }
4705
+ /** The product's terms: `getTerms`, else none. */
4706
+ declare function productTerms<Doc>(doc: Doc, traits: ProductTraits<Doc>): ProductTerm[];
4707
+ /** Every term group across `docs`, once per group id and each term once per id (the first name seen wins), groups and terms sorted by name. */
4708
+ declare function listTermGroups<Doc>(docs: readonly Doc[], traits: ProductTraits<Doc>): ProductTermGroup[];
4709
+ /** Whether `doc` carries the term with this id in this group. */
4710
+ declare function hasTerm<Doc>(doc: Doc, group: string, termId: string, traits: ProductTraits<Doc>): boolean;
4711
+
4223
4712
  /** A sort on one field: ascending or descending. */
4224
4713
  interface ProductSort {
4225
4714
  field: string;
@@ -4274,6 +4763,9 @@ declare function stockOverlayAsOf$(collection: RxCollection): Observable<string
4274
4763
  interface WedgeSettings {
4275
4764
  /** Folded-average gap (ms) below which input latches as a scan. */
4276
4765
  threshold: number;
4766
+ /** 'folded' (default): v2's folded average, latched for the rest of the burst. 'every': each gap must be under
4767
+ * the threshold; a slower key drops the burst and starts a new one. */
4768
+ gapRule?: 'folded' | 'every';
4277
4769
  /** Stripped only when it equals the first key. */
4278
4770
  prefix: string;
4279
4771
  /** Stripped only when it equals the last key. */
@@ -4292,17 +4784,23 @@ interface WedgeState {
4292
4784
  lastTimeMs: number | null;
4293
4785
  /** Time of the first key of the current burst's stack. */
4294
4786
  startedAtMs: number | null;
4787
+ /** Lowest finite folded average seen (v2); `createWedgeState` starts it at +Infinity. */
4788
+ minAvgGapMs?: number;
4295
4789
  /** An Enter/Tab arrived during the burst — the signature of a scanner terminator. */
4296
4790
  sawTerminator: boolean;
4297
4791
  }
4792
+ /** @deprecated Internal helper, not supported API; leaves the public entry at the next major. */
4298
4793
  declare function createWedgeState(): WedgeState;
4299
4794
  /** Fold one key, mutating and returning state. Kept bug-for-bug with v2:
4300
4795
  * only length-1 keys advance timing; the first gap is +Infinity; the average
4301
4796
  * folds as (avg + gap) / 2. Scanning latches below threshold for the burst;
4302
- * a slow key outside a burst resets the average and restarts the stack. */
4303
- declare function foldWedgeKey(state: WedgeState, key: string, timeMs: number, threshold: number): WedgeState;
4304
- /** Strip a configured prefix/suffix only when it equals the single key at
4305
- * that edge of the stack — never as a substring. */
4797
+ * a slow key outside a burst resets the average and restarts the stack;
4798
+ * 'every' ends the burst on a slow gap.
4799
+ * @deprecated Internal helper, not supported API; leaves the public entry at the next major. */
4800
+ declare function foldWedgeKey(state: WedgeState, key: string, timeMs: number, threshold: number, gapRule?: 'folded' | 'every'): WedgeState;
4801
+ /** Match whole strings at the edges: prefix first, then suffix on the remainder.
4802
+ * A one-character setting behaves as before.
4803
+ * @deprecated Internal helper, not supported API; leaves the public entry at the next major. */
4306
4804
  declare function stripBoundary(stack: string[], settings: WedgeSettings): string;
4307
4805
  interface TraceKey {
4308
4806
  key: string;
@@ -4313,8 +4811,11 @@ interface WedgeReplayResult {
4313
4811
  detectedAsScan: boolean;
4314
4812
  /** The barcode the detector would emit, with prefix/suffix stripped. */
4315
4813
  code: string;
4814
+ /** Lowest folded average gap in ms (+Infinity when no gap was measured). */
4815
+ minAvgGapMs: number;
4316
4816
  }
4317
- /** Replay the detector over a completed keystroke trace. */
4817
+ /** Replay the detector over a completed keystroke trace.
4818
+ * @deprecated Internal helper, not supported API; leaves the public entry at the next major. */
4318
4819
  declare function replayWedgeDetector(keys: TraceKey[], settings: WedgeSettings): WedgeReplayResult;
4319
4820
  interface WedgeScanMeta {
4320
4821
  /** The burst ended with an Enter/Tab terminator — scanners send one, typists rarely do. */
@@ -4343,6 +4844,38 @@ interface WedgeDetector {
4343
4844
  * once the quiet period exceeds the threshold, mirroring the original hook. */
4344
4845
  declare function createWedgeDetector(options: WedgeDetectorOptions): WedgeDetector;
4345
4846
 
4847
+ type ScanTraceSettings = WedgeSettings & {
4848
+ minChars: number;
4849
+ };
4850
+ interface TraceSuggestion {
4851
+ kind: 'raise-threshold' | 'lower-min-chars' | 'set-prefix';
4852
+ /** A patch in the same keys as components' `BarcodeScanningValues`. */
4853
+ settings: Partial<Pick<ScanTraceSettings, 'threshold' | 'minChars' | 'prefix'>>;
4854
+ value: number | string;
4855
+ }
4856
+ interface TraceAnalysis {
4857
+ raw: string;
4858
+ code: string;
4859
+ avgGapMs: number;
4860
+ gaps: number[];
4861
+ detectedAsScan: boolean;
4862
+ tooShort: boolean;
4863
+ nearMiss: boolean;
4864
+ leadingSymbol: string | null;
4865
+ trailingEnter: boolean;
4866
+ shiftMangled: boolean;
4867
+ suggestions: TraceSuggestion[];
4868
+ }
4869
+ /**
4870
+ * Analyze one completed keystroke trace from the settings test panel.
4871
+ *
4872
+ * The verdict, displayed code, and one-tap fixes all come from replaying the
4873
+ * real detector over the trace (`replayWedgeDetector` — the same reducer the
4874
+ * live hook streams through), so the panel can never claim a scan the detector
4875
+ * would reject, or vice versa.
4876
+ */
4877
+ declare function analyzeScanTrace(keys: TraceKey[], settings: ScanTraceSettings): TraceAnalysis;
4878
+
4346
4879
  /** Suppress repeated reads within a cooldown and reject retail check-digit misreads. */
4347
4880
  declare const DEFAULT_COOLDOWN_MS = 1200;
4348
4881
  type ScanRejectReason = 'cooldown' | 'bad-check-digit';
@@ -4418,14 +4951,21 @@ interface UseBarcodeScannerOptions {
4418
4951
  /** Listen only while true (default true). */
4419
4952
  enabled?: boolean;
4420
4953
  threshold?: number;
4954
+ /** Gap rule for scanner bursts; see WedgeSettings.gapRule. */
4955
+ gapRule?: 'folded' | 'every';
4421
4956
  prefix?: string;
4422
4957
  suffix?: string;
4423
4958
  minChars?: number;
4959
+ /** Which focused elements own their keys; a key there resets the burst and is never scanned.
4960
+ * 'reset' (default): INPUT and TEXTAREA. 'ignore-editable': also SELECT and contentEditable elements.
4961
+ * 'hold-money': as 'ignore-editable', but a money field (an input with inputmode="decimal") is held, not reset:
4962
+ * a scan into it never reaches the field, and other runs go in at the caret as typing. */
4963
+ fieldPolicy?: 'reset' | 'ignore-editable' | 'hold-money';
4424
4964
  /** Called with each accepted scan event (wedge or device) after cross-source de-duplication,
4425
4965
  * before onScan. */
4426
4966
  onScanEvent?: (event: ScanEvent) => void;
4427
4967
  }
4428
- /** Listen for keyboard-wedge scans outside INPUT/TEXTAREA, with a minimum length gate. Inside a ScanHubProvider the
4968
+ /** Listen for keyboard-wedge scans according to fieldPolicy, with a minimum length gate. Inside a ScanHubProvider the
4429
4969
  * hub's device scans (serial, HID-POS) join them, and a copy of one physical scan from a second source is dropped.
4430
4970
  * Ported from WCPOS v2 packages/core/src/screens/main/hooks/barcodes/use-barcode-detection.ts (monorepo 5ac185b0).
4431
4971
  * @example
@@ -4814,6 +5354,34 @@ interface CameraScan {
4814
5354
  * Ported from WCPOS v2 packages/core/src/screens/main/pos/products/use-camera-scan.ts. */
4815
5355
  declare function useCameraScan(options?: UseCameraScanOptions): CameraScan;
4816
5356
 
5357
+ /** A cart line as a unit split prices it: `totalMinor` is the line's money with tax inside, as the cashier is charged. */
5358
+ interface SplitUnitLine {
5359
+ id: TenderLineId;
5360
+ quantity: number;
5361
+ totalMinor: number;
5362
+ }
5363
+ /** Payment id → line id (as `String(id)`) → units that payment paid for. */
5364
+ type UnitAllocations = Record<string, Record<string, number>>;
5365
+ /** Each line as a unit split prices it: its charged money with tax inside, in lineItems order. A line whose figure is
5366
+ * negative is left out (unitsMinor refuses it). Fees, shipping and cash rounding are never in a figure. */
5367
+ declare function splitUnitLines(order: Pick<Order, 'lineItems' | 'pricesIncludeTax' | 'taxRounding'>): SplitUnitLine[];
5368
+ declare function unitAllocationsFromLegs(payments: readonly Payment[]): UnitAllocations;
5369
+ /** Units of each line a leg holds while captured or in motion (pending, authorized); a failed or voided leg frees them (#1133). */
5370
+ declare function heldUnitsByLine(payments: readonly Payment[]): Record<string, number>;
5371
+ /**
5372
+ * The money `units` units of a line carry, cumulatively: floor(total·units/quantity).
5373
+ * Unit k of n costs floor(total·k/n) − floor(total·(k−1)/n), so any run of picks sums exactly to the line
5374
+ * total, and no stray cent is left over. (v2's unitsMinor puts the rounding on the last unit instead.)
5375
+ * Throws RangeError when quantity is not a positive integer, or units is not an integer in 0..quantity.
5376
+ */
5377
+ declare function unitsMinor(totalMinor: number, quantity: number, units: number): number;
5378
+ /** Units of each line the live payments paid for. A payment not in `livePaymentIds` (voided, cancelled, refused) frees its units. */
5379
+ declare function paidUnitsByLine(allocations: UnitAllocations, livePaymentIds: readonly string[]): Record<string, number>;
5380
+ /** Units of each line still unpaid, by `String(id)`. A line whose quantity is not a positive integer is left out: it cannot be split by units (vet §11.3, until the decimal-quantity ADR). */
5381
+ declare function unpaidUnitsByLine(lines: readonly SplitUnitLine[], paid: Record<string, number>): Record<string, number>;
5382
+ /** The money the picks add to this payment: Σ unitsMinor(total, n, paid+picked) − unitsMinor(total, n, paid). Picks on a line not in `lines` throw RangeError, and so does a pick beyond the line's unpaid units. */
5383
+ declare function pickedUnitsMinor(lines: readonly SplitUnitLine[], picked: Record<string, number>, paid: Record<string, number>): number;
5384
+
4817
5385
  /** The transport a payment terminal is reached over: hardware-neutral, not tied to any backend. */
4818
5386
  type PaymentTransport = 'bluetooth' | 'usb' | 'network' | 'tap_to_pay';
4819
5387
  type TenderView = 'select' | 'amount' | 'cancel';
@@ -4821,19 +5389,31 @@ type TenderLineId = string | number;
4821
5389
  type TenderPlan = {
4822
5390
  kind: 'even';
4823
5391
  ways: number;
5392
+ /** @deprecated The captured-leg count when the plan was set; read only when `before` is absent (#1133). */
4824
5393
  from: number;
5394
+ /** Every payment id on the order when the plan was set; the plan's legs are the captured legs not in it (#1133). */
5395
+ before?: readonly string[];
4825
5396
  } | {
4826
5397
  kind: 'fixed';
4827
5398
  firstMinor: number;
4828
5399
  title: string | null;
5400
+ /** Equal shares the rest is split into after the first payment; absent means 1. */
5401
+ thenWays?: number;
5402
+ /** @deprecated The captured-leg count when the plan was set; read only when `before` is absent (#1133). */
4829
5403
  from: number;
5404
+ /** Every payment id on the order when the plan was set; the plan's legs are the captured legs not in it (#1133). */
5405
+ before?: readonly string[];
4830
5406
  } | {
4831
5407
  kind: 'items';
4832
5408
  lineIds: TenderLineId[];
4833
5409
  firstMinor: number;
4834
5410
  ways: number;
5411
+ /** @deprecated The captured-leg count when the plan was set; read only when `before` is absent (#1133). */
4835
5412
  from: number;
5413
+ /** Every payment id on the order when the plan was set; the plan's legs are the captured legs not in it (#1133). */
5414
+ before?: readonly string[];
4836
5415
  };
5416
+ /** @deprecated The split sub-view retired in WCPOS v2 split V1; kept for existing callers. */
4837
5417
  type SplitTab = 'even' | 'amount' | 'percent' | 'item';
4838
5418
  interface TenderState {
4839
5419
  view: TenderView;
@@ -4845,11 +5425,17 @@ interface TenderState {
4845
5425
  entryMinor: number;
4846
5426
  /** False until the cashier has touched the keypad since the entry was pre-filled. */
4847
5427
  entryDirty: boolean;
5428
+ /** Money reads the keypad as minor units; percent reads it as a whole percent of the balance. */
5429
+ entryMode: 'money' | 'percent';
4848
5430
  plan: TenderPlan | null;
4849
5431
  splitView: boolean;
4850
5432
  splitTab: SplitTab;
4851
5433
  pickedLineIds: TenderLineId[];
4852
5434
  linesPaidBy: Record<TenderLineId, string[]>;
5435
+ /** THIS payment's picked units per line (`String(line id)`); cleared when the payment is pressed. */
5436
+ pickedUnits: Record<string, number>;
5437
+ /** Each pressed payment's units, frozen at its press (`tender-started` with `paymentId`). Read paid units with `paidUnitsByLine`. */
5438
+ unitAllocations: UnitAllocations;
4853
5439
  }
4854
5440
  /** '0'..'9' plus the two edit keys. There is deliberately no decimal key: digits shift in from the right. */
4855
5441
  type TenderKey = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'clear' | 'backspace';
@@ -4867,12 +5453,17 @@ type TenderAction = {
4867
5453
  readerId: string | null;
4868
5454
  } | {
4869
5455
  type: 'tender-started';
5456
+ paymentId?: string; /** The units the recorded leg carries; frozen in place of pickedUnits when given (`{}` for a money-only leg). */
5457
+ units?: Readonly<Record<string, number>>;
4870
5458
  } | {
4871
5459
  type: 'key';
4872
5460
  key: TenderKey;
4873
5461
  } | {
4874
5462
  type: 'set-entry';
4875
5463
  minor: number;
5464
+ } | {
5465
+ type: 'set-entry-mode';
5466
+ mode: 'money' | 'percent';
4876
5467
  } | {
4877
5468
  type: 'back';
4878
5469
  } | {
@@ -4893,6 +5484,11 @@ type TenderAction = {
4893
5484
  } | {
4894
5485
  type: 'toggle-split-line';
4895
5486
  lineId: TenderLineId;
5487
+ } | {
5488
+ type: 'set-split-units';
5489
+ lineId: TenderLineId;
5490
+ units: number;
5491
+ unpaidUnits: number;
4896
5492
  } | {
4897
5493
  type: 'set-plan';
4898
5494
  plan: TenderPlan;
@@ -4915,9 +5511,10 @@ declare const initialTenderState: TenderState;
4915
5511
  * tab the cashier is coming back to — reopens its keypad prefilled with the balance, exactly
4916
5512
  * as a tap on that tile would. Everything else starts from scratch.
4917
5513
  */
4918
- declare function initTenderState({ methodId, balanceMinor, }: {
5514
+ declare function initTenderState({ methodId, balanceMinor, payments, }: {
4919
5515
  methodId: string | null;
4920
5516
  balanceMinor: number;
5517
+ payments?: readonly Payment[];
4921
5518
  }): TenderState;
4922
5519
  declare function tenderReducer(state: TenderState, action: TenderAction): TenderState;
4923
5520
  /**
@@ -4938,6 +5535,8 @@ declare function quickTenderedAmounts(balanceMinor: number, stepsMinor: readonly
4938
5535
  * minor unit; the last leg remains whatever balance is left.
4939
5536
  */
4940
5537
  declare function evenSplitShareMinor(balanceMinor: number, ways: number): number;
5538
+ /** Round a percentage half-up to minor units, never outside the remaining balance. */
5539
+ declare function percentOfMinor(balanceMinor: number, percent: number): number;
4941
5540
  /** Completion is derived from payment rows, never an extra counter in the reducer. */
4942
5541
  declare function activePlan(plan: TenderPlan | null, taken: number, balanceMinor: number): TenderPlan | null;
4943
5542
  interface PlanLeg {
@@ -5084,7 +5683,7 @@ declare function createSimulatedDriver(options?: SimulatedDriverOptions): Paymen
5084
5683
  * carries HTML, bytes or both, and each transport prints what it can.
5085
5684
  */
5086
5685
 
5087
- type PrintJobKind = 'receipt' | 'report' | 'test';
5686
+ type PrintJobKind = 'receipt' | 'report' | 'test' | 'drawer';
5088
5687
  interface PrintJob {
5089
5688
  id: string;
5090
5689
  kind: PrintJobKind;
@@ -5182,6 +5781,25 @@ declare function printerProfileCollection(): {
5182
5781
  type PrinterProfileCollection = RxCollection<PrinterProfile>;
5183
5782
  declare function addPrinterProfileCollection(db: RxDatabase): Promise<PrinterProfileCollection>;
5184
5783
 
5784
+ /**
5785
+ * Which printer prints a template: the cashier's pick for this print, else the device's per-template override,
5786
+ * else the first match by paper (the default printer first). Ported from WCPOS v2
5787
+ * `packages/printer/src/resolve-printer.ts` (monorepo main). A thermal template matches a non-dialog printer whose
5788
+ * columns fit its paper (58mm -> 32; 80mm or unset -> 42 or 48); an html template matches the print dialog.
5789
+ */
5790
+
5791
+ interface ResolvePrinterOptions {
5792
+ template: Pick<ReceiptTemplate, 'id' | 'engine' | 'paper'>;
5793
+ profiles: readonly PrinterProfile[];
5794
+ /** Template id -> printer profile id, set on this device. A missing or deleted profile falls through to auto. */
5795
+ overrides?: Readonly<Record<string, string>>;
5796
+ /** The cashier's pick at print time. A pick that names no profile resolves to null, as in v2. */
5797
+ manualPrinterId?: string;
5798
+ }
5799
+ /** The column counts a thermal template's paper fits: 58mm -> [32]; 80mm or unset -> [42, 48]. */
5800
+ declare function templateColumns(paper: ReceiptTemplate['paper']): readonly number[];
5801
+ declare function resolvePrinter(options: ResolvePrinterOptions): PrinterProfile | null;
5802
+
5185
5803
  /**
5186
5804
  * Prints rendered HTML through the platform print dialog. Ported from WCPOS v2 (monorepo main)
5187
5805
  * `packages/printer/src/transport/system-print-adapter.web.ts` (hidden iframe, `print()`, `afterprint`) and
@@ -5231,8 +5849,27 @@ interface EscPosCodePage {
5231
5849
  * opens every job with `ESC @` then `ESC M 0` (Font A, so the profile's column count holds whatever the
5232
5850
  * printer's memory switch says; v2 gotcha N39), and `render-escpos.ts` `writeCut` cuts with `GS V 0x41|0x42 0`
5233
5851
  * (feed to the cutter, then cut). Text goes through `foldText`, so no multibyte UTF-8 ever reaches the printer.
5852
+ * The `underline`, `invert`, `barcode` and `qrcode` bytes follow `@point-of-sale/receipt-printer-encoder` 4.0.1,
5853
+ * as read on 19 Nov 2026, except two TallyUI choices: the `GS h`, `GS w`, `GS H` order before a barcode, and
5854
+ * sending a computed check digit for a 12-digit EAN-13.
5234
5855
  */
5235
5856
 
5857
+ interface EscPosBarcodeOptions {
5858
+ /** `GS h n`, dots. Default 60; rounded and clamped to 1-255. */
5859
+ height?: number;
5860
+ /** Module width 1-3; `GS w (width + 1)`. Default 2; rounded and clamped to 1-3. */
5861
+ width?: number;
5862
+ /** `GS H n`: where the human-readable digits print. Default 'none'. */
5863
+ hri?: 'none' | 'above' | 'below' | 'both';
5864
+ }
5865
+ interface EscPosQrOptions {
5866
+ /** Default 2. */
5867
+ model?: 1 | 2;
5868
+ /** Module size; default 6; rounded and clamped to 1-8. */
5869
+ size?: number;
5870
+ /** Error correction; default 'm'. */
5871
+ errorLevel?: 'l' | 'm' | 'q' | 'h';
5872
+ }
5236
5873
  interface EscPosBuilder {
5237
5874
  /** `ESC @` (reset), then `ESC M 0` (Font A). */
5238
5875
  init(): EscPosBuilder;
@@ -5249,6 +5886,14 @@ interface EscPosBuilder {
5249
5886
  cut(type?: 'full' | 'partial'): EscPosBuilder;
5250
5887
  /** `ESC p m 25 250`: a drawer kick, on 50 ms and off 500 ms; m 0 for pin 2, 1 for pin 5. */
5251
5888
  pulse(connector?: DrawerConnector): EscPosBuilder;
5889
+ /** `ESC - 1` on, `ESC - 0` off. */
5890
+ underline(on: boolean): EscPosBuilder;
5891
+ /** `GS B 1` on, `GS B 0` off (reverse print). */
5892
+ invert(on: boolean): EscPosBuilder;
5893
+ /** `GS h`, `GS w`, `GS H`, then `GS k 0x49 n data` (code128) or `GS k 0x02 d1…d13 NUL` (ean13); RangeError first. */
5894
+ barcode(value: string, symbology: 'code128' | 'ean13', options?: EscPosBarcodeOptions): EscPosBuilder;
5895
+ /** `GS ( k` model, size, error level, store (`31 50 30 data`) and print (`31 51 30`); RangeError first. */
5896
+ qrcode(value: string, options?: EscPosQrOptions): EscPosBuilder;
5252
5897
  bytes(): Uint8Array;
5253
5898
  }
5254
5899
  declare function escpos(page?: EscPosCodePage): EscPosBuilder;
@@ -5269,7 +5914,8 @@ declare function encodeEscPos(receipt: ReceiptData, options: EncodeEscPosOptions
5269
5914
 
5270
5915
  /**
5271
5916
  * A `PrintTransport` that writes ESC/POS bytes to a sink the app supplies (WebUSB, WebSerial, a TCP socket,
5272
- * Bluetooth). It holds no device code; ADR-084 decision 2 keeps vendor SDKs out of the MIT packages. Run it
5917
+ * Bluetooth); the pos package ships the Epson ePOS and Star WebPRNT web sinks (`networkSinkFor`). It holds no
5918
+ * device code; ADR-084 decision 2 keeps vendor SDKs out of the MIT packages. Run it
5273
5919
  * through `createPrintQueue`, like the system transport, so one printer prints one job at a time.
5274
5920
  */
5275
5921
 
@@ -5283,6 +5929,54 @@ interface EscPosTransportOptions {
5283
5929
  }
5284
5930
  declare function createEscPosTransport({ sink, profile, format }: EscPosTransportOptions): PrintTransport;
5285
5931
 
5932
+ /**
5933
+ * Web sinks for `createEscPosTransport`. A browser cannot open a raw 9100 socket, so a network Epson printer takes the
5934
+ * bytes over ePOS-Print and a Star printer over WebPRNT: plain HTTP, no vendor SDK (ADR-084 decision 2). Ported from
5935
+ * WCPOS v2 `packages/printer/src/transport` (monorepo main).
5936
+ */
5937
+
5938
+ interface NetworkSinkOptions {
5939
+ /** IP address or hostname. */
5940
+ address: string;
5941
+ /** The profile's port. Unset or 9100 (the raw-socket default) picks the vendor's web port. */
5942
+ port?: number;
5943
+ /** The till page is https. Default: `globalThis.location?.protocol === 'https:'`. */
5944
+ https?: boolean;
5945
+ /** Abort the request after this long. Default: 15_000 for ePOS, 30_000 for WebPRNT (v2's figures). */
5946
+ timeoutMs?: number;
5947
+ /** Default `globalThis.fetch`. */
5948
+ fetch?: typeof fetch;
5949
+ }
5950
+ declare function createEpsonEposSink(options: NetworkSinkOptions & {
5951
+ deviceId?: string;
5952
+ }): EscPosSink;
5953
+ declare function createStarWebPrntSink(options: NetworkSinkOptions & {
5954
+ cut?: boolean;
5955
+ }): EscPosSink;
5956
+ /** The web sink for a network Epson or Star profile; null for system, usb, bluetooth, a generic vendor or no address. */
5957
+ declare function networkSinkFor(profile: PrinterProfile, options?: Pick<NetworkSinkOptions, 'https' | 'timeoutMs' | 'fetch'>): EscPosSink | null;
5958
+
5959
+ /**
5960
+ * A standalone cash-drawer kick, ported from WCPOS v2 `packages/printer/src/printer-service.ts`
5961
+ * (`encodeEscposDrawerKick`, `openDrawer`) and `capabilities.ts` (`canOpenDrawer`), monorepo main.
5962
+ */
5963
+
5964
+ /** Whether a standalone drawer kick can go to this printer (v2 capabilities.ts canOpenDrawer). */
5965
+ declare function canOpenDrawer(profile: PrinterProfile | undefined): boolean;
5966
+ /** The drawer-kick job for `profile`, to run through the printer's queue and `createEscPosTransport`. */
5967
+ declare function openDrawerJob(profile: PrinterProfile, id: string): PrintJob;
5968
+
5969
+ interface RenderEscposOptions {
5970
+ /** Characters per line at 1× width. Default: the template's `paperWidth`. */ columns?: number;
5971
+ /** A code page name for `resolveCodePage`. Default cp437. */ codePage?: string;
5972
+ /** Pulse the drawer when the template has no `<drawer>` node (v2 rule). Default false. */ openDrawer?: boolean;
5973
+ /** For `openDrawer` and for a `<drawer>` with no connector. Default 'pin2'. */ drawerConnector?: DrawerConnector;
5974
+ }
5975
+ /** Print a parsed thermal template as ESC/POS bytes: `ESC @`, the code page, the body, then its trailing controls. */
5976
+ declare function renderEscpos(ast: ReceiptNode, options?: RenderEscposOptions): Uint8Array;
5977
+ /** WCPOS v2's `encodeThermalTemplate`: Mustache (`renderReceiptTemplate`), then `parseXml`, then `renderEscpos`. */
5978
+ declare function encodeThermalTemplate(template: string, data: object, options?: RenderEscposOptions): Uint8Array;
5979
+
5286
5980
  /** One tab of the till's open sales: the current sale or a parked draft (v2 cart/tabs.tsx). */
5287
5981
  interface OpenSale {
5288
5982
  id: string;
@@ -5292,6 +5986,8 @@ interface OpenSale {
5292
5986
  totalMinor: number;
5293
5987
  paidMinor: number;
5294
5988
  balanceDueMinor: number;
5989
+ /** When a parked sale was last parked (ISO); absent on the current sale. The tab's age reads it. */
5990
+ parkedAt?: string;
5295
5991
  /** The sale on the till now. */
5296
5992
  current: boolean;
5297
5993
  }
@@ -5468,6 +6164,8 @@ interface ReportOrder {
5468
6164
  needsPayment?: boolean;
5469
6165
  lines: ReportLine[];
5470
6166
  payments: ReportPayment[];
6167
+ /** A reopened sale's payments the store already held (its locked legs): not this till's takings, but they settle the total. */
6168
+ paidEarlierMinor?: number;
5471
6169
  taxes: ReportTax[];
5472
6170
  /** Refunds embedded on the order, undated (a store order's own list). Positive. */
5473
6171
  refunds: Array<{
@@ -5529,9 +6227,15 @@ declare function createBackendNotFound(): BackendNotFound;
5529
6227
 
5530
6228
  /** Whether the outbox resends a rejection with this code. */
5531
6229
  declare function isRequeueable(code: string | undefined): boolean;
6230
+ /**
6231
+ * Whether `requeue()` will send this order again. A rejected order: its code is requeueable, except that a reopened
6232
+ * sale (`storeOrderId`) refused with `reopen_required` or `revision_conflict` needs a fresh reopen, not a resend
6233
+ * (ADR-090 gate 5). A pending order the outbox could not build as an update (`UPDATE_UNSENDABLE`): yes, it is tried again.
6234
+ */
6235
+ declare function isRequeueableOrder(order: Pick<PosOrder, 'syncStatus' | 'storeOrderId' | 'error'>): boolean;
5532
6236
  interface OrderOutboxOptions {
5533
6237
  collection: RxCollection<PosOrder>;
5534
- transport: CommandTransport<OrderCreateEnvelope>;
6238
+ transport: CommandTransport<OrderCreateEnvelope | OrderUpdateEnvelope>;
5535
6239
  deviceId: string;
5536
6240
  getMaxOrderCreateVersion?: () => number | undefined | Promise<number | undefined>;
5537
6241
  refreshCapabilities?: () => Promise<void>;
@@ -5550,9 +6254,12 @@ interface OrderOutboxOptions {
5550
6254
  interface OrderOutbox {
5551
6255
  /** Sends pending orders until empty or retrying. Concurrent calls share one run. */
5552
6256
  flush(): Promise<void>;
5553
- /** Moves rejected orders (all, or those whose id is listed) back to pending with a new commandId, then flushes.
5554
- * Orders rejected with idempotency_mismatch are left for reconciliation. Resolves to the number requeued. */
6257
+ /** Requeues rejected orders with a new commandId, or clears a pending update's unsendable mark, then flushes.
6258
+ * Orders isRequeueableOrder refuses are left alone. Resolves to the number requeued. */
5555
6259
  requeue(orderIds?: string[]): Promise<number>;
6260
+ /** Removes the rejected order `orderId` from the collection, after any running flush ends. Resolves to true when
6261
+ * removed; false, with nothing changed, when the id is unknown or the order is not rejected. */
6262
+ discard(orderId: string): Promise<boolean>;
5556
6263
  /** Watches for pending orders and sends them. */
5557
6264
  start(): void;
5558
6265
  /** Stops watching and retrying. */
@@ -5632,7 +6339,7 @@ interface UseOrderOutboxOptions {
5632
6339
  close(): Promise<void>;
5633
6340
  }>;
5634
6341
  /** Builds the command transport for `storeKey` (the app's HTTP transport and auth headers). Read once per open. */
5635
- transport(storeKey: string): CommandTransport<OrderCreateEnvelope>;
6342
+ transport(storeKey: string): CommandTransport<OrderCreateEnvelope | OrderUpdateEnvelope>;
5636
6343
  /** The device id sent on every command (see `getDeviceId`). A change reopens. */
5637
6344
  deviceId: string;
5638
6345
  /** Presence is fixed when the store opens; calls use the latest function. Reopen to add or remove. */
@@ -5668,6 +6375,8 @@ interface UseOrderOutboxResult {
5668
6375
  flush(): Promise<void>;
5669
6376
  /** Moves rejected orders back to pending (see `OrderOutbox.requeue`); resolves to 0 before the current store is ready. */
5670
6377
  requeue(orderIds?: string[]): Promise<number>;
6378
+ /** Removes one rejected order (see `OrderOutbox.discard`); resolves to false before the current store is ready. */
6379
+ discard(orderId: string): Promise<boolean>;
5671
6380
  /**
5672
6381
  * The count of `record()` calls not yet settled (resolved or rejected). An app holds sign-out
5673
6382
  * (closing the store) while this is above 0, because a close that lands under a write stuck in
@@ -5783,6 +6492,187 @@ declare function refundableLines(lines: readonly RefundableOrderLine[], refunds:
5783
6492
  /** Prices requested quantities with cumulative shares, clamping them to what remains refundable. */
5784
6493
  declare function priceRefund(lines: readonly RefundableOrderLine[], refunds: readonly EarlierRefund[], request: readonly OrderRefundLine[]): PricedRefund;
5785
6494
 
6495
+ type OrderReopenOutcome = {
6496
+ kind: 'applied';
6497
+ reopen: OrderReopenResult;
6498
+ duplicate: boolean;
6499
+ } | {
6500
+ kind: 'rejected';
6501
+ error: CommandError;
6502
+ } | {
6503
+ kind: 'unknown';
6504
+ reason: string;
6505
+ retryAfterMs?: number;
6506
+ } | {
6507
+ kind: 'refused';
6508
+ status: number;
6509
+ reason: string;
6510
+ } | {
6511
+ kind: 'unauthorized';
6512
+ } | {
6513
+ kind: 'in_flight';
6514
+ };
6515
+ /** Online only, never queued (ADR-090). On unknown, resend the same envelope (same id); after rejected, a new attempt needs a new id.
6516
+ * At most one reopen per order is in flight; a second gets in_flight without a send. */
6517
+ declare function sendOrderReopen(transport: CommandTransport<OrderReopenEnvelope>, envelope: OrderReopenEnvelope): Promise<OrderReopenOutcome>;
6518
+ declare function isOrderReopenInFlight(orderId: string): boolean;
6519
+ /** Re-open is offered only when the store lists order.reopen, the till is online, storage is not degraded and no reopen of the order is in flight (ADR-090 decision 2). */
6520
+ declare function isReopenOffered(input: {
6521
+ orderReopen?: number;
6522
+ orderCreate?: number;
6523
+ online: boolean;
6524
+ storageDegraded: boolean;
6525
+ orderId: string;
6526
+ }): boolean;
6527
+
6528
+ /** Why the till cannot rebuild a store order as a reopened cart (ADR-090 D7c5). */
6529
+ type StoreOrderRebuildReason = 'currency' | 'tax_mode' | 'revision' | 'store_id' | 'refund' | 'payment_record' | 'coupon' | 'discount' | 'product' | 'quantity' | 'unit_price' | 'charge' | 'customer' | 'payment' | 'totals';
6530
+
6531
+ declare const REOPEN_REFUSED_STATUSES: readonly string[];
6532
+ type ReopenEntryReason = StoreOrderRebuildReason | 'status' | 'catalogue' | 'overpaid';
6533
+ declare class ReopenEntryError extends Error {
6534
+ readonly reason: ReopenEntryReason;
6535
+ constructor(reason: ReopenEntryReason, message: string);
6536
+ }
6537
+ declare function storeOrderForReopen(read: StoreOrder, options: {
6538
+ currency: string;
6539
+ taxContext: TaxContext;
6540
+ /** The catalogue's tax class and status for a read line's product, or null when that product is no longer in the till's catalogue. */
6541
+ catalogue: (line: StoreOrderLine) => {
6542
+ taxClass?: string;
6543
+ taxStatus?: 'taxable' | 'none';
6544
+ } | null;
6545
+ }): OrderBuilder;
6546
+
6547
+ declare const REOPENED_NOT_LOADED = "The store has reopened this order, but the till could not load it. Check the order in the store before trying again.";
6548
+ declare const STORE_ORDER_OPEN_HERE = "This order is already open on this till. Find it in the current sale or the parked sales.";
6549
+ type ReopenStoreOrderOutcome =
6550
+ /** The store reopened the order and the till rebuilt it from the read taken after the reopen. */
6551
+ {
6552
+ kind: 'reopened';
6553
+ order: Order;
6554
+ duplicate: boolean;
6555
+ }
6556
+ /** The pre-check refused the detail read; nothing was sent. */
6557
+ | {
6558
+ kind: 'refused';
6559
+ reason: ReopenEntryReason | 'open_here';
6560
+ message: string;
6561
+ }
6562
+ /** The store did not reopen the order, or its answer is unknown (sendOrderReopen's outcome, unchanged).
6563
+ * When outcome.kind is 'unknown', pass envelope back as deps.resend to retry. After any other outcome, a new attempt starts without it. */
6564
+ | {
6565
+ kind: 'not_reopened';
6566
+ outcome: Exclude<OrderReopenOutcome, {
6567
+ kind: 'applied';
6568
+ }>;
6569
+ envelope: OrderReopenEnvelope;
6570
+ }
6571
+ /** The store reopened it, but the read after it failed or was refused. `message` starts with REOPENED_NOT_LOADED. */
6572
+ | {
6573
+ kind: 'reopened_unloadable';
6574
+ reason: ReopenEntryReason | 'reread';
6575
+ message: string;
6576
+ };
6577
+ /** Reopens from the detail read the cashier opened, not a list row (ADR-090 decision 1).
6578
+ * `baseRevision` is that read's revision; the cart is built from the read after reopening. */
6579
+ declare function reopenStoreOrder(read: StoreOrder, deps: {
6580
+ transport: CommandTransport<OrderReopenEnvelope>;
6581
+ /** The connector's getOrders, bound to the sync context. */
6582
+ getOrders: (ids: readonly string[]) => Promise<StoreOrder[]>;
6583
+ identity: {
6584
+ cashierRef: string;
6585
+ registerId: string;
6586
+ storeId?: string;
6587
+ deviceId: string;
6588
+ };
6589
+ currency: string;
6590
+ taxContext: TaxContext;
6591
+ /** The sale's per-customer tax context; pass the same function as useSale's `taxContextFor` option. */
6592
+ taxContextFor?: (customer: CustomerSummary | null) => {
6593
+ taxContext: TaxContext;
6594
+ };
6595
+ /** Whether this till's live sale or a parked sale already holds the store order (useSale's holdsStoreOrder). */
6596
+ openHere: (orderId: string) => boolean | Promise<boolean>;
6597
+ resend?: OrderReopenEnvelope;
6598
+ catalogue: (line: StoreOrderLine) => {
6599
+ taxClass?: string;
6600
+ taxStatus?: 'taxable' | 'none';
6601
+ } | null;
6602
+ /** Milliseconds since the epoch; defaults to Date.now. */
6603
+ now?: () => number;
6604
+ }): Promise<ReopenStoreOrderOutcome>;
6605
+
6606
+ /** A gateway that takes no part payment runs the whole order. */
6607
+ declare const runsWholeOrder: (method: PaymentMethodDescriptor | null) => boolean;
6608
+ interface TenderFacts {
6609
+ /** Currency decimal places; every `*Minor` number is in these units. */
6610
+ dp: number;
6611
+ balanceMinor: number;
6612
+ /** The order's payment legs in ledger order; only those that count toward paid are numbered. */
6613
+ payments: readonly {
6614
+ status?: PaymentLegStatus;
6615
+ }[];
6616
+ /** The plan's counted legs (by `plan.before`, else since `plan.from`), as `tender-recorded` and `planLegs` read them. */
6617
+ rowsSinceFrom: {
6618
+ minor: number;
6619
+ title: string;
6620
+ }[];
6621
+ /** The selected method, or null in the select view. */
6622
+ method: PaymentMethodDescriptor | null;
6623
+ state: Pick<TenderState, 'view' | 'entryMinor' | 'entryDirty' | 'entryMode' | 'plan'>;
6624
+ }
6625
+ type TenderFigures = ReturnType<typeof tenderFigures>;
6626
+ /** Every number the keypad shows and commits, computed once and formatted by the pane. */
6627
+ declare function tenderFigures(facts: TenderFacts): {
6628
+ fixedAmount: boolean;
6629
+ /** The plan as the keypad sees it: null once its legs are taken, or for a fixed gateway. */
6630
+ plan: TenderPlan | null;
6631
+ legs: PlanLeg[];
6632
+ /** The plan's untranslated label pieces; the flow localizes them. */
6633
+ label: {
6634
+ n: number;
6635
+ ways: number;
6636
+ rest: boolean;
6637
+ title: string | null;
6638
+ } | null;
6639
+ /** "Payment n of ways", numbered across the bill; `ways` is 0 without a plan. */
6640
+ n: number;
6641
+ ways: number;
6642
+ /** Planned payments still to come after this one. */
6643
+ toCome: number;
6644
+ groupDone: boolean;
6645
+ /** An items plan shared more than one way, its group not yet paid. */
6646
+ shared: boolean;
6647
+ /** The planned leg, or the balance with no plan. */
6648
+ thisPaymentMinor: number;
6649
+ roundedDueMinor: number;
6650
+ /** `roundedDueMinor - balanceMinor` when the entry settles at the rounded due, else 0. */
6651
+ roundingMinor: number;
6652
+ percentMinor: number | null;
6653
+ /** The entry as the cashier sees it: percent share or the (rounded) prefill. */
6654
+ entryMinor: number;
6655
+ /** The leg the entry makes before rounding (the commit's `amountMinor`). */
6656
+ enteredLegMinor: number;
6657
+ /** That leg after cash rounding: what the entry applies to the order. */
6658
+ entryAppliedMinor: number;
6659
+ entryChangeMinor: number;
6660
+ /** THIS payment: the applied entry on the keypad, the planned share in the select view. */
6661
+ nowMinor: number;
6662
+ afterThisPaymentMinor: number;
6663
+ quickAmountsMinor: number[];
6664
+ dueMinor: number;
6665
+ /** The Exact chip: the rounded due whenever this leg is the whole balance, since tapping it settles. */
6666
+ exactMinor: number;
6667
+ /** The big figure. */
6668
+ shownMinor: number;
6669
+ /** A no-change method typed past the balance; a fixed-amount gateway applies the balance whatever is typed. */
6670
+ noChange: boolean;
6671
+ /** An amount typed below the balance is THIS payment; the split helpers divide the rest. */
6672
+ typed: boolean;
6673
+ restMinor: number;
6674
+ };
6675
+
5786
6676
  /**
5787
6677
  * One record per voided tender leg: its v2 ledger row plus the provenance a v2 `void`
5788
6678
  * fiscal record carries (TallyUI#479). Write-once: insert only, never update or delete;
@@ -5874,6 +6764,10 @@ interface SalesTotals {
5874
6764
  orderCount: number;
5875
6765
  averageMinor: number;
5876
6766
  items: number;
6767
+ /** v2 ordersSummary: the middle order total, the mean of the two middles for an even count (rounded half up to the minor unit); 0 with no orders. */
6768
+ medianMinor?: number;
6769
+ /** v2 ordersSummary: the largest order total; null with no orders. */
6770
+ largestMinor?: number | null;
5877
6771
  margin: Margin;
5878
6772
  }
5879
6773
  interface PaymentRow {
@@ -5948,8 +6842,11 @@ declare function comparisonRange(range: DayRange, mode: 'previous' | 'week', pre
5948
6842
  declare function marginOf(lines: readonly ReportLine[]): Margin;
5949
6843
  declare function salesFigures(input: SalesFiguresInput): SalesFigures;
5950
6844
 
5951
- declare function reportOrderFromPosOrder(order: PosOrder, join?: LineJoin): ReportOrder;
6845
+ declare function reportOrderFromPosOrder(order: PosOrder, join?: LineJoin, methodTitle?: (methodId: string) => string | undefined): ReportOrder;
5952
6846
  declare function reportOrderFromStoreOrder(order: StoreOrder, join?: LineJoin): ReportOrder;
5953
6847
  declare function reportRefundFromPosRefund(refund: PosRefund): ReportRefund | undefined;
5954
6848
 
5955
- export { APP_SETTING_DEFINITIONS, type Actor, type AddLineInput, type AppSettingCollection, type AppSettingDefinition, type AppSettingDoc, type AppSettingKey, type AppSettings, type AppliedDiscount, type ApprovalNeeded, type BackendNotFound, type BasketLine, type BroadcastChannelLike, CAMERA_BARCODE_TYPES, CAMERA_CONSTRAINTS, COLLECT_POLL_MS, CONNECT_TIMEOUT_MS, COUPONS_NEED_CONNECTION, COUPONS_REPRICING, COUPONS_UNSUPPORTED, CUSTOMER_RETAX_REFUSED, type CameraDecoder, type CameraScan, 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 Correction, type CsvColumn, type CurrencyFormat, CurrencyProvider, type CurrencyProviderProps, 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_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, ESCPOS_CODE_PAGES, type EarlierRefund, type EncodeEscPosOptions, type EscPosBuilder, type EscPosSink, type EscPosTransportOptions, 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, 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, MICROS_PER_MINOR, type Margin, type Movement$1 as Movement, type MovementType, type NoteDelivery, OPEN_SIGNAL_POLL_MS, type OpenSale, type OptionPicks, type Order, type OrderBuilder, type OrderBuilderOptions, OrderContentMismatchError, type OrderCoupon, type OrderCouponContext, type OrderFilterValue, type OrderManager, type OrderManagerOptions, type OrderOutbox, type OrderOutboxOptions, type OrderRefundOutcome, 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 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, RECEIPT_SCHEMA_VERSION, REGISTER_SESSION_MIGRATION_CLOSE_WAIT_MS, REOPENABLE_CODES, 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 RenderReceiptOptions, type RenderSanitizeOptions, type ReopenRefusal, ReopenRefusedOrderError, type ReportCategory, type ReportLine, type ReportOrder, type ReportPayment, type ReportRefund, type ReportTax, type Repository, type ResolveStoreSettingsOptions, 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, SYSTEM_PRINTER_ID, SYSTEM_PRINT_TIMING, type SaleDiscountCodes, type SaleDiscountState, type SaleDisplayInput, type SaleDisplayOptions, type SaleDisplayPublisher, 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 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 StoreDay, 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_ROUNDING_MIXED_NOTE, type TaxContext, type TaxDerivation, type TaxDerivationClass, type TaxDerivationRate, type TaxLineInput, TaxProvider, type TaxProviderProps, type TaxRateMap, type TaxRateWhy, type TaxRow, type TenderAction, type TenderKey, type TenderLineId, type TenderPlan, type TenderRounding, type TenderState, type TenderView, type TenderVoid, type ThermalNode, type TillDisplayEntry, type TillDisplayService, type TillDisplayServiceOptions, type TillDisplayStatus, type TillDisplaysView, type TillPairing, type TillPairingOptions, type TillPairingView, type TraceKey, type TransportOutcome, UI_SCALES, UI_THEMES, type UiScale, type UiTheme, 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 WedgeDetector, type WedgeDetectorOptions, type WedgeReplayResult, type WedgeScanMeta, type WedgeSettings, type WedgeState, abandonSession, activePlan, addEntryToCart, addPosOrderCollection, addPrinterProfileCollection, addRegisterSessionCollection, addScannerProfileCollection, adoptRegisterResults, advancePerpetual, allocateOrderDiscount, appSettingCollection, appSettingSchema, appSettings$, appliedMinor, backToSelling, bindRegister, buildClosureDocument, buildReceiptData, buildReceiptDataFromPosOrder, buildReceiptDataFromStoreOrder, buildXReportDocument, callbackSink, cameraErrorStatus, can, canMoveLeg, canVoidLeg, capturedMinor, cartQuantities, cashMovementSchema, catalogueEntries, catalogueViewReducer, changeMinor, clampClosureScope, closeNeedsApproval, closeSession, closureApprovalStatus, closureCommand, closureSchema, closureVariance, comparisonRange, computeOrderTax, consoleSink, countVariance, countsTowardPaid, couponPricingBasis, createBackendNotFound, createBroadcastDisplayTransport, createDeviceScannerStateCell, createDisplayClient, createDisplayLink, createDisplayPeerLink, createEscPosTransport, createHidScanner, createHttpCommandTransport, createLogger, createOrderBuilder, createOrderManager, createOrderOutbox, createPaymentDriverRegistry, createPrintQueue, createRegisterOutbox, createRepository, createSaleDisplayPublisher, createScanBus, createScanHub, createScanSession, createSerialLineDecoder, createSerialScanner, createSimulatedDriver, createSnapshotSender, createStorePricedDiscountCodes, createSystemPrintTransport, createTaxContext, createTillDisplayService, createTillPairing, createTillPeerLink, 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, ensureRegister, escpos, evenSplitShareMinor, exportCsv, finalizeOrder, findEntryByCode, foldWedgeKey, formatClosureDate, formatWcposMoney, formatWcposReceiptData, getBoundRegisterId, getDeviceId, handoverSlip, hasActor, hasValidRetailCheckDigit, inCategory, inMotionMinor, inRange, inertDeviceScanControls, inertScanHub, initTenderState, initialDisplayState, initialTenderState, isCanonicalUuid, isChooserCancel, isInMotion, isKnownSessionStatus, isLiveAtStore, isPartlyPaid, isRegisterRequeueable, isReopened, isRequeueable, isServerDecimal, isWebHidSupported, isWebSerialSupported, labelKeys, legStatus, listCategories, makeEnvelope, marginOf, matchVariant, matchesPresetFilters, messageBytes, methodDrivers, methodForProvider, minorToDecimal, mintClosureNumber, mintUuid, movementCommand, movementFieldError, nativeBarcodeDetector, needsAttention, nextSaleCounter, normalizeAmount, normalizeCatalogueViewState, normalizeRetailCode, normalizeUuid, noteDelivery, observeRegister$, openSales, openSession, openSessionSelector, orderDraftSchema, orderFiltersQuery, outboxLogger, overThreshold, parkedOrderSummaries$, parseMinor, parseXml, planLegs, posOrderCollection, posOrderSchema, posOrdersLogger, posRefundCollection, posRefundSchema, presetFilters, presetRange, priceRefund, printerProfileCollection, printerProfileSchema, productCategories, productSortValue, quickTenderedAmounts, ratePpmFromPercent, readAppSettings, readBoundRegister, readRegister, readScannerProfiles, reapproveClosure, receiptTemplateData, reconcileRegisterCommands, recordMovement, recordRegisterFact, refundableLines, registerCommandCollection, registerCommandSchema, registerCommandsLogger, registerFactsLogger, registerSessionCollection, registerSessionSchema, registerSessionsLogger, removeScannerProfile, renderHtml, renderLogiclessTemplate, renderReceiptHtml, renderReceiptTemplate, renderStoreReceiptTemplate, renderThermalPreview, reopenRefusedOrder, replacedOrderIds, replayWedgeDetector, reportOrderFromPosOrder, reportOrderFromStoreOrder, reportRefundFromPosRefund, requireOpenSession, resolveAppSettings, resolveGridColumns, resolveStoreSettings, restoreOrderDraft, retailCodeTwin, roundMicrosToMinor, roundedDue, saleLogger, saleTaxContexts, salesFigures, sameSale, sanitizeHtml, saveScannerProfile, scanTimeOf, scannerDeviceKey, scannerProfileCollection, scannerProfileSchema, scannerProfileStore, scannerProfiles$, scannerTransport, searchProducts, selectClosureRows, sendOrderRefund, serialPortIdentity, sessionOpenCommand, sessionTransitionCommand, sortProducts, stampSession, startCounting, startDecodeLoop, stockOverlay$, stockOverlayAsOf$, stripBoundary, submitOrderRefund, suggestFloat, summarizeOutboxHealth, switchWarnings, takeOverSession, taxDerivation, taxFiguresForBasket, taxLinesByRate, taxLogger, taxMicros, taxProviderProps, taxSettingsForLocation, tenderReducer, tenderRounding, tenderVoidCollection, tenderVoidSchema, toCsv, toOrderCreateEnvelope, toPrintError, unbindRegister, useAppSettings, useBarcodeScanner, useCameraScan, useCashier, useCurrencyCode, useCurrencyFormatter, useCustomerDisplay, useDeviceScanControls, useDisplayClient, useOrderOutbox, useOutboxHealth, useParkedSales, useRegisterOutbox, useRegisterSession, useSale, useSaleDisplay, useScanHub, useStoreSettings, useTax, useTillDisplays, useTillPairing, uuidv7, validAmount, varianceText, variantFits, variantPriceLabel, voidMovement, watchOutboxHealth, wcposReceiptContext, wcposReceiptData, wcposSourceFromPosOrder, wcposSourceFromSentOrder, wcposSourceFromStoreOrder, withPricingContext, index as woocommerceDiscountCodes, writeAppSetting, writeClosure, writeOrderDraft };
6849
+ /** @deprecated Use `minorToMajor(minor, digits)` from `@tallyui/core`, which also rejects an amount that is not a safe integer. */
6850
+ declare const minorToDecimal: (minor: number, exponent: number) => string;
6851
+
6852
+ 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, 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 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 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 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, 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, 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, useStoreSettings, useTax, useTillDisplays, useTillPairing, uuidv7, validAmount, varianceText, variantFits, variantPriceLabel, voidMovement, watchOutboxHealth, wcposReceiptContext, wcposReceiptData, wcposSourceFromPosOrder, wcposSourceFromSentOrder, wcposSourceFromStoreOrder, withPricingContext, index as woocommerceDiscountCodes, writeAppSetting, writeClosure, writeOrderDraft };