@tallyui/pos 3.20.0 → 4.0.0

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