@kreiseck/kasseneck-api 1.25.1 → 1.27.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 (71) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/models/receipt-errors.d.ts +1 -1
  3. package/dist/cjs/models/receipt-errors.js +2 -0
  4. package/dist/cjs/models/receipt-item.d.ts +10 -0
  5. package/dist/cjs/models/receipt-item.js +8 -0
  6. package/dist/cjs/pos/artikel.d.ts +39 -0
  7. package/dist/cjs/pos/artikel.js +23 -0
  8. package/dist/cjs/pos/index.d.ts +3 -1
  9. package/dist/cjs/pos/index.js +28 -2
  10. package/dist/cjs/pos/kachel-referenz.d.ts +55 -0
  11. package/dist/cjs/pos/kachel-referenz.js +107 -0
  12. package/dist/cjs/pos/texte.d.ts +35 -0
  13. package/dist/cjs/pos/texte.js +14 -0
  14. package/dist/cjs/pos/zusaetze.d.ts +70 -0
  15. package/dist/cjs/pos/zusaetze.js +159 -0
  16. package/dist/cjs/receipt/grid.js +16 -3
  17. package/dist/cjs/receipt/layout.js +16 -9
  18. package/dist/cjs/stored/draht.js +4 -0
  19. package/dist/cjs/stored/vokabular.d.ts +1 -1
  20. package/dist/cjs/stored/vokabular.js +25 -4
  21. package/dist/cjs/version.d.ts +1 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/esm/models/receipt-errors.d.ts +1 -1
  24. package/dist/esm/models/receipt-errors.js +2 -0
  25. package/dist/esm/models/receipt-item.d.ts +10 -0
  26. package/dist/esm/models/receipt-item.js +8 -0
  27. package/dist/esm/pos/artikel.d.ts +39 -0
  28. package/dist/esm/pos/artikel.js +20 -0
  29. package/dist/esm/pos/index.d.ts +3 -1
  30. package/dist/esm/pos/index.js +3 -1
  31. package/dist/esm/pos/kachel-referenz.d.ts +55 -0
  32. package/dist/esm/pos/kachel-referenz.js +98 -0
  33. package/dist/esm/pos/texte.d.ts +35 -0
  34. package/dist/esm/pos/texte.js +14 -0
  35. package/dist/esm/pos/zusaetze.d.ts +70 -0
  36. package/dist/esm/pos/zusaetze.js +148 -0
  37. package/dist/esm/receipt/grid.js +16 -3
  38. package/dist/esm/receipt/layout.js +16 -9
  39. package/dist/esm/stored/draht.js +4 -0
  40. package/dist/esm/stored/vokabular.d.ts +1 -1
  41. package/dist/esm/stored/vokabular.js +25 -4
  42. package/dist/esm/version.d.ts +1 -1
  43. package/dist/esm/version.js +1 -1
  44. package/fixtures/add-on-cases.json +103 -0
  45. package/fixtures/expected/add-ons.grid32.txt +31 -0
  46. package/fixtures/expected/add-ons.grid48.txt +27 -0
  47. package/fixtures/expected/add-ons.lines.json +270 -0
  48. package/fixtures/expected/add-ons.sheet32.json +212 -0
  49. package/fixtures/expected/add-ons.sheet48.json +188 -0
  50. package/fixtures/hobex-hps-codes.json +1 -1
  51. package/fixtures/invoice-api.schema.json +1 -1
  52. package/fixtures/invoice-texts.json +1 -1
  53. package/fixtures/manifest.json +8 -0
  54. package/fixtures/pos-texts.json +40 -1
  55. package/fixtures/receipts/add-ons.json +70 -0
  56. package/fixtures/reference-cases.json +238 -0
  57. package/fixtures/surface.json +14 -1
  58. package/fixtures/v3/antworten/belege.json +1 -1
  59. package/fixtures/v3/antworten/belegmail.json +1 -1
  60. package/fixtures/v3/antworten/berichte.json +1 -1
  61. package/fixtures/v3/antworten/kasse-belege.json +1 -1
  62. package/fixtures/v3/antworten/kasse.json +2 -2
  63. package/fixtures/v3/antworten/lager.json +1 -1
  64. package/fixtures/v3/antworten/rechnungen.json +1 -1
  65. package/fixtures/v3/antworten/storno.json +1 -1
  66. package/fixtures/v3/stored/belege.json +1 -1
  67. package/fixtures/v3/stored/kasse.json +2 -2
  68. package/fixtures/v3/stored/rechnungen.json +1 -1
  69. package/fixtures/v3/v3-vokabular.json +51 -12
  70. package/fixtures/v3/zahlbetrag-faelle.json +1 -1
  71. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@ Was vor 0.7.0 geschah, steht in der Commit-Historie (`git log`); ab hier wird
4
4
  es hier geführt. Ein Eintrag nennt die Änderung **und ihren Grund** —
5
5
  nur der Grund überlebt den nächsten Umbau.
6
6
 
7
+ ## 1.27.0 - 2026-11-05
8
+
9
+ Add-on tiles: tapping a main service opens a sheet with its add-ons (nail art, repair per nail, hand massage …); each add-on becomes its own receipt line pointing at its main line. Additive; articles, groups and receipts without the new fields read, print and send exactly as before (all existing goldens unchanged).
10
+
11
+ - **`ArticleGroup.addOns`** and **`PosArticle.addOns`** (`string[] | null`, stored `zusaetze`): the group's list in sheet order; on the article `null` = as the group, `[]` = none, otherwise its own list. The reader always sets both. Reason: a nail studio sells many add-ons that otherwise sit in their own group and have to be searched for at the till.
12
+ - **`ReceiptItem.addOnOf`** (stored `zusatzZu`): index of the main line in the same receipt, read and written only as a whole number ≥ 0. The server checks it (`invalid_add_on_reference`, now in `RECEIPT_ERROR_CODES`); it never touches totals, counter or signature.
13
+ - **Helpers** `addOnsFor` (effective list: the article itself, unknown, inactive and non-selectable articles and duplicates drop out silently), `isSelectableAddOn` (reason `inactive|own_list|asks_price|reference|asks_quantity|no_price|service_voucher`: an add-on is booked without prompts and opens no sheet of its own), `addOnReferencesValid`, `addOnsOfItem` (cancellation pre-selects a main line's add-ons), `addOnRemap`, `addOnDisplayOrder`, `orderAddOnLines` (cart lines with the parent's line id -> receipt order and index), `ADD_ONS_MAX` (30). Contract cases `fixtures/add-on-cases.json`, the same as the backend (`zusatz-faelle.json`) and the Dart package.
14
+ - **Receipt layout:** add-ons stand directly under their main line (stable, also when the receipt lists them later), indented with „+ “; a wrapped name continues under the quantity. The grid applies the same hanging indent to a left column that starts with spaces (as it already did for text lines). New golden `add-ons`.
15
+ - **Texts:** labels `addons.title` „Zusätze zu {name}“, `addons.none` „Ohne Zusatz“, `addons.done` „Fertig“, `addons.open` „Zusätze“.
16
+ - Contract `v3` re-fetched from the backend (`addOns` on articles and groups, `addOnOf` on receipt items).
17
+
18
+ ## 1.26.0 - 2026-11-04
19
+
20
+ Tile with amount and reference: a tile can ask, when tapped, for the amount and/or a reference (fee note, order number). Additive; articles without the new fields read as before.
21
+
22
+ - **`PosArticle.askPrice`** (wire `askPrice`, stored `preisFragen`) and **`PosArticle.reference`** (`PosReference`: `mode` `optional|required`, `label`, `hint`, `pattern`, `patternStrict`; stored `referenz`). The reader always sets both (`false`/`null`); a malformed `reference` reads as `null`. Reason: a law office takes cash for fee notes; the receipt line „Honorarnote 2026/0123“ refers to the invoice without the client's name.
23
+ - **Helpers** `checkReference` (`ok`/`empty`/`warning`/`error` plus the cleaned value: no control characters (no NFC, so JS and Dart agree), whitespace collapsed, at most 40 characters), `isValidReferencePattern` (whole-input match; lookbehind, named groups, backreferences and inline flags are refused so JS and Dart agree), `isDigitsOnlyPattern` (numeric keyboard), `referenceLineName`, `isBookableArticle` (without a price only with `askPrice`), `tilePrompts`, `REFERENCE_PATTERN_TEMPLATES`. Contract cases `fixtures/reference-cases.json`, the same as the backend (`referenz-faelle.json`) and the Dart package.
24
+ - **Texts:** `reference.missing` „Bitte „{name}“ eingeben.“, `reference.format_invalid`, `reference.format_warning`; labels `tile_prompt.amount`, `tile_prompt.quantity`, `tile_prompt.apply`, `tile_prompt.apply_anyway`.
25
+ - `./stored`: `fromStoredArticle` reads `preisFragen`/`referenz`. Contract `v3` re-fetched from the backend (`askPrice`, `reference`, catalog `REFERENZ_STUFE`).
26
+
7
27
  ## 1.25.1 - 2026-11-04
8
28
 
9
29
  Texts for the cancellation sheet; no API change.
@@ -18,7 +18,7 @@ import { KasseneckApiError } from '../client/errors.js';
18
18
  * ...) stehen in [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
19
19
  * `KasseneckApiError.code` lesbar.
20
20
  */
21
- export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "idempotency_conflict", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "server_error", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "voucher_balance_changed", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
21
+ export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "idempotency_conflict", "invalid_add_on_reference", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "server_error", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "voucher_balance_changed", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
22
22
  export type ReceiptErrorCode = (typeof RECEIPT_ERROR_CODES)[number];
23
23
  export declare function isReceiptErrorCode(value: unknown): value is ReceiptErrorCode;
24
24
  /** Der Code eines geworfenen Fehlers, wenn er in [RECEIPT_ERROR_CODES] steht; sonst `undefined`. */
@@ -34,6 +34,8 @@ exports.RECEIPT_ERROR_CODES = Object.freeze([
34
34
  // Seit 1.15.0 (Vertrag): derselbe idempotencyKey mit anderem Inhalt, nichts geschrieben. Seit 1.22.0 sendet
35
35
  // dieses Paket den Schluessel, wenn der Aufrufer ihn angibt (`idempotencyKey` an sellReceipt/createReceipt).
36
36
  'idempotency_conflict',
37
+ // Seit 1.27.0 (Zusatz-Kacheln): addOnOf zeigt nicht nach vorne auf eine Warenposition, die selbst kein Zusatz ist.
38
+ 'invalid_add_on_reference',
37
39
  'module_inactive',
38
40
  'not_permitted',
39
41
  'receipt_limit_exceeded',
@@ -61,6 +61,12 @@ export interface ReceiptItem {
61
61
  originalIndex?: number;
62
62
  /** Nur an Storno-Zeilen mit `articleId`: wohin die Ware ging (Lager-Kern Stufe 2). */
63
63
  returnDisposition?: ReturnDisposition;
64
+ /**
65
+ * Zusatz-Kacheln (1.27.0): Index der Hauptposition im selben Beleg; nur an
66
+ * Zusatzpositionen. Der Server prueft: ganze Zahl, zeigt nach vorne auf eine
67
+ * Warenposition, die selbst kein Zusatz ist (`invalid_add_on_reference`).
68
+ */
69
+ addOnOf?: number;
64
70
  }
65
71
  /** Empfaenger einer Trinkgeld-Position (Kassen-Benutzer, Snapshot des Namens). */
66
72
  export interface TipRecipient {
@@ -99,6 +105,8 @@ export interface ReceiptItemPayload {
99
105
  keptByEmployee?: boolean;
100
106
  /** Artikel-Verweis, siehe [ReceiptItem.articleId]. */
101
107
  articleId?: string;
108
+ /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
109
+ addOnOf?: number;
102
110
  }
103
111
  /**
104
112
  * Nutzlast-Form, die dieses Paket **liest** — v2 und v1 nebeneinander, alles
@@ -144,6 +152,8 @@ export interface ReceiptItemPayloadRead {
144
152
  originalIndex?: number | null;
145
153
  /** Storno-Zeile mit `articleId`: Rueckgabe-Wahl, siehe [ReceiptItem.returnDisposition]. */
146
154
  returnDisposition?: string | null;
155
+ /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
156
+ addOnOf?: number | null;
147
157
  }
148
158
  export declare function toReceiptItemPayload(item: ReceiptItem): ReceiptItemPayload;
149
159
  /**
@@ -68,6 +68,9 @@ function toReceiptItemPayload(item) {
68
68
  // Artikel-Verweis reist mit (Erloesgruppen im Bericht); leere Werte nicht.
69
69
  if (item.articleId != null && item.articleId !== '')
70
70
  nutzlast.articleId = item.articleId;
71
+ // Zusatz-Kacheln: Verweis auf die Hauptposition nur, wenn gesetzt.
72
+ if (istIndex(item.addOnOf))
73
+ nutzlast.addOnOf = item.addOnOf;
71
74
  return nutzlast;
72
75
  }
73
76
  /**
@@ -118,8 +121,13 @@ function fromReceiptItemPayload(payload) {
118
121
  // unbekannter Wert faellt weg wie am Rand des Servers).
119
122
  ...(Number.isInteger(payload.originalIndex) && payload.originalIndex >= 0 ? { originalIndex: payload.originalIndex } : {}),
120
123
  ...((0, cancellation_js_1.isReturnDisposition)(payload.returnDisposition) ? { returnDisposition: payload.returnDisposition } : {}),
124
+ // Zusatz-Kacheln: Verweis auf die Hauptposition (nur eine ganze Zahl >= 0).
125
+ ...(istIndex(payload.addOnOf) ? { addOnOf: payload.addOnOf } : {}),
121
126
  };
122
127
  }
128
+ function istIndex(wert) {
129
+ return Number.isInteger(wert) && wert >= 0;
130
+ }
123
131
  /** Erster brauchbarer Zahlenwert der Reihe; `null`/`undefined`/NaN zaehlen nicht. */
124
132
  function ersteZahl(...werte) {
125
133
  for (const wert of werte) {
@@ -1,4 +1,5 @@
1
1
  import type { InternerTransport } from '../client/aufrufe.js';
2
+ import { type PosReference } from './kachel-referenz.js';
2
3
  /**
3
4
  * Artikelgruppen (Kategorien der Kachel-Kasse) und Artikel in der Form, die
4
5
  * die Kacheln brauchen, Backend: `article-endpoints.js`
@@ -13,6 +14,13 @@ export interface ArticleGroup {
13
14
  symbol: string | null;
14
15
  sort: number;
15
16
  vatRate: number | null;
17
+ /**
18
+ * Zusaetze der Gruppe (Zusatz-Kacheln, 1.27.0): Artikel-Kennungen in der
19
+ * Reihenfolge des Fensters; null = keine. Optional, damit bestehende Literale
20
+ * weiter uebersetzen; der Leser setzt das Feld immer. Wirksam wird die Liste
21
+ * erst ueber [addOnsFor].
22
+ */
23
+ addOns?: string[] | null;
16
24
  }
17
25
  export interface ArticleGroupPayload {
18
26
  id?: string | null;
@@ -21,7 +29,10 @@ export interface ArticleGroupPayload {
21
29
  symbol?: string | null;
22
30
  sort?: number | null;
23
31
  vatRate?: number | null;
32
+ addOns?: unknown;
24
33
  }
34
+ /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
35
+ export declare function addOnListe(wert: unknown): string[] | null;
25
36
  export declare function fromArticleGroupPayload(p: ArticleGroupPayload): ArticleGroup;
26
37
  /**
27
38
  * Mengenregel eines Artikels (Draht `quantityRule`): `piece` = ganze Stueck
@@ -96,7 +107,32 @@ export interface PosArticle {
96
107
  * ausdrueckliches `true` gilt.
97
108
  */
98
109
  serviceVoucher?: boolean;
110
+ /**
111
+ * Kasse fragt beim Antippen den Betrag (Kachel mit Betrag und Referenz,
112
+ * 1.26.0); ein vorhandener Preis ist Vorschlag. Optional wie
113
+ * `serviceVoucher`, der Leser setzt es immer: nur ein ausdrueckliches `true` gilt.
114
+ */
115
+ askPrice?: boolean;
116
+ /** Kasse fragt beim Antippen eine Referenz ab; null = aus. Der Leser setzt es immer. */
117
+ reference?: PosReference | null;
118
+ /**
119
+ * Eigene Zusatzliste (Zusatz-Kacheln, 1.27.0): null = wie die Gruppe, [] =
120
+ * keine, sonst die Liste in der Reihenfolge des Fensters. Der Leser setzt es
121
+ * immer; wirksam wird es ueber [addOnsFor].
122
+ */
123
+ addOns?: string[] | null;
99
124
  }
125
+ /**
126
+ * Kann die Kachel gebucht werden? Mit festem Preis immer, ohne Preis nur mit
127
+ * `askPrice` (der Betrag kommt aus dem Eingabeblatt).
128
+ */
129
+ export declare function isBookableArticle(a: Pick<PosArticle, 'unitPriceCents' | 'askPrice'>): boolean;
130
+ /** Fragt die Kachel beim Antippen etwas ab (Betrag, Referenz oder Menge)? */
131
+ export declare function tilePrompts(a: Pick<PosArticle, 'askPrice' | 'reference' | 'unit' | 'quantityRule' | 'askQuantity'>): {
132
+ amount: boolean;
133
+ reference: boolean;
134
+ quantity: boolean;
135
+ };
100
136
  /** Deckelt eine gewuenschte Menge an der Hoechstmenge des Artikels (null = keine Grenze). */
101
137
  export declare function allowedQuantity(a: Pick<PosArticle, 'maxQuantity'>, wanted: number): number;
102
138
  /** Ein Artikel am Draht `/api/v3` (`listMyArticles`), soweit dieses Paket ihn liest. */
@@ -122,6 +158,9 @@ export interface PosArticlePayload {
122
158
  internalCode?: string | null;
123
159
  stockTracked?: boolean | null;
124
160
  serviceVoucher?: boolean | null;
161
+ askPrice?: boolean | null;
162
+ reference?: unknown;
163
+ addOns?: unknown;
125
164
  }
126
165
  export declare function fromPosArticlePayload(p: PosArticlePayload): PosArticle;
127
166
  /**
@@ -1,15 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QUANTITY_RULES = void 0;
4
+ exports.addOnListe = addOnListe;
4
5
  exports.fromArticleGroupPayload = fromArticleGroupPayload;
5
6
  exports.quantityRuleForUnit = quantityRuleForUnit;
6
7
  exports.quantityDefaults = quantityDefaults;
8
+ exports.isBookableArticle = isBookableArticle;
9
+ exports.tilePrompts = tilePrompts;
7
10
  exports.allowedQuantity = allowedQuantity;
8
11
  exports.fromPosArticlePayload = fromPosArticlePayload;
9
12
  exports.liste = liste;
10
13
  exports.listMyArticleGroups = listMyArticleGroups;
11
14
  exports.listMyArticles = listMyArticles;
12
15
  const errors_js_1 = require("../client/errors.js");
16
+ const kachel_referenz_js_1 = require("./kachel-referenz.js");
17
+ /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
18
+ function addOnListe(wert) {
19
+ return Array.isArray(wert) ? wert.filter((s) => typeof s === 'string' && s !== '') : null;
20
+ }
13
21
  function fromArticleGroupPayload(p) {
14
22
  return {
15
23
  id: p.id ?? '',
@@ -18,6 +26,7 @@ function fromArticleGroupPayload(p) {
18
26
  symbol: p.symbol ?? null,
19
27
  sort: typeof p.sort === 'number' ? p.sort : 0,
20
28
  vatRate: typeof p.vatRate === 'number' ? p.vatRate : null,
29
+ addOns: addOnListe(p.addOns),
21
30
  };
22
31
  }
23
32
  /**
@@ -52,6 +61,17 @@ function quantityDefaults(a) {
52
61
  decimals: (a.quantityRule ?? v.rule) === 'decimal' ? Math.max(1, v.decimals || 2) : 0,
53
62
  };
54
63
  }
64
+ /**
65
+ * Kann die Kachel gebucht werden? Mit festem Preis immer, ohne Preis nur mit
66
+ * `askPrice` (der Betrag kommt aus dem Eingabeblatt).
67
+ */
68
+ function isBookableArticle(a) {
69
+ return a.askPrice === true || (typeof a.unitPriceCents === 'number' && Number.isInteger(a.unitPriceCents) && a.unitPriceCents >= 0);
70
+ }
71
+ /** Fragt die Kachel beim Antippen etwas ab (Betrag, Referenz oder Menge)? */
72
+ function tilePrompts(a) {
73
+ return { amount: a.askPrice === true, reference: a.reference != null, quantity: quantityDefaults(a).ask };
74
+ }
55
75
  /** Deckelt eine gewuenschte Menge an der Hoechstmenge des Artikels (null = keine Grenze). */
56
76
  function allowedQuantity(a, wanted) {
57
77
  return a.maxQuantity != null && a.maxQuantity > 0 ? Math.min(wanted, a.maxQuantity) : wanted;
@@ -83,6 +103,9 @@ function fromPosArticlePayload(p) {
83
103
  internalCode: textOderNull(p.internalCode),
84
104
  stockTracked: typeof p.stockTracked === 'boolean' ? p.stockTracked : null,
85
105
  serviceVoucher: p.serviceVoucher === true,
106
+ askPrice: p.askPrice === true,
107
+ reference: (0, kachel_referenz_js_1.fromReferencePayload)(p.reference),
108
+ addOns: addOnListe(p.addOns),
86
109
  };
87
110
  }
88
111
  /**
@@ -7,7 +7,9 @@
7
7
  * und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
8
8
  */
9
9
  export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, posTipKeptByDefault, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
10
- export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, } from './artikel.js';
10
+ export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
11
+ export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
12
+ export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
11
13
  export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
12
14
  export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
13
15
  export { distributeDiscount } from '../receipt/discount.js';
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.quantityRuleForUnit = exports.QUANTITY_RULES = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = exports.posShortcutConflict = exports.POS_SHORTCUT_SHARED_PAIRS = exports.posSettingsChanges = exports.unknownPosSettingValues = exports.sanitizePosSettings = exports.mergePosSettings = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.posTipKeptByDefault = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
4
- exports.getMyDrawerState = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.reportConnectState = exports.inspectionInfoLines = exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.allowedQuantity = exports.quantityDefaults = void 0;
5
- exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = void 0;
4
+ exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.orderAddOnLines = exports.addOnDisplayOrder = exports.addOnRemap = exports.addOnsOfItem = exports.addOnReferencesValid = exports.addOnsFor = exports.isSelectableAddOn = exports.ADD_ON_BLOCK_REASONS = exports.ADD_ONS_MAX = exports.fromReferencePayload = exports.referenceLineName = exports.checkReference = exports.isDigitsOnlyPattern = exports.isValidReferencePattern = exports.cleanReferenceText = exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = exports.tilePrompts = exports.isBookableArticle = exports.allowedQuantity = exports.quantityDefaults = void 0;
5
+ exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = exports.getMyDrawerState = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.reportConnectState = exports.inspectionInfoLines = void 0;
6
+ exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = void 0;
6
7
  /**
7
8
  * Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
8
9
  * Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
@@ -66,6 +67,31 @@ Object.defineProperty(exports, "QUANTITY_RULES", { enumerable: true, get: functi
66
67
  Object.defineProperty(exports, "quantityRuleForUnit", { enumerable: true, get: function () { return artikel_js_1.quantityRuleForUnit; } });
67
68
  Object.defineProperty(exports, "quantityDefaults", { enumerable: true, get: function () { return artikel_js_1.quantityDefaults; } });
68
69
  Object.defineProperty(exports, "allowedQuantity", { enumerable: true, get: function () { return artikel_js_1.allowedQuantity; } });
70
+ Object.defineProperty(exports, "isBookableArticle", { enumerable: true, get: function () { return artikel_js_1.isBookableArticle; } });
71
+ Object.defineProperty(exports, "tilePrompts", { enumerable: true, get: function () { return artikel_js_1.tilePrompts; } });
72
+ var kachel_referenz_js_1 = require("./kachel-referenz.js");
73
+ Object.defineProperty(exports, "REFERENCE_MODES", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_MODES; } });
74
+ Object.defineProperty(exports, "REFERENCE_INPUT_MAX", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_INPUT_MAX; } });
75
+ Object.defineProperty(exports, "REFERENCE_LABEL_MAX", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_LABEL_MAX; } });
76
+ Object.defineProperty(exports, "REFERENCE_HINT_MAX", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_HINT_MAX; } });
77
+ Object.defineProperty(exports, "REFERENCE_PATTERN_MAX", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_PATTERN_MAX; } });
78
+ Object.defineProperty(exports, "REFERENCE_PATTERN_TEMPLATES", { enumerable: true, get: function () { return kachel_referenz_js_1.REFERENCE_PATTERN_TEMPLATES; } });
79
+ Object.defineProperty(exports, "cleanReferenceText", { enumerable: true, get: function () { return kachel_referenz_js_1.cleanReferenceText; } });
80
+ Object.defineProperty(exports, "isValidReferencePattern", { enumerable: true, get: function () { return kachel_referenz_js_1.isValidReferencePattern; } });
81
+ Object.defineProperty(exports, "isDigitsOnlyPattern", { enumerable: true, get: function () { return kachel_referenz_js_1.isDigitsOnlyPattern; } });
82
+ Object.defineProperty(exports, "checkReference", { enumerable: true, get: function () { return kachel_referenz_js_1.checkReference; } });
83
+ Object.defineProperty(exports, "referenceLineName", { enumerable: true, get: function () { return kachel_referenz_js_1.referenceLineName; } });
84
+ Object.defineProperty(exports, "fromReferencePayload", { enumerable: true, get: function () { return kachel_referenz_js_1.fromReferencePayload; } });
85
+ var zusaetze_js_1 = require("./zusaetze.js");
86
+ Object.defineProperty(exports, "ADD_ONS_MAX", { enumerable: true, get: function () { return zusaetze_js_1.ADD_ONS_MAX; } });
87
+ Object.defineProperty(exports, "ADD_ON_BLOCK_REASONS", { enumerable: true, get: function () { return zusaetze_js_1.ADD_ON_BLOCK_REASONS; } });
88
+ Object.defineProperty(exports, "isSelectableAddOn", { enumerable: true, get: function () { return zusaetze_js_1.isSelectableAddOn; } });
89
+ Object.defineProperty(exports, "addOnsFor", { enumerable: true, get: function () { return zusaetze_js_1.addOnsFor; } });
90
+ Object.defineProperty(exports, "addOnReferencesValid", { enumerable: true, get: function () { return zusaetze_js_1.addOnReferencesValid; } });
91
+ Object.defineProperty(exports, "addOnsOfItem", { enumerable: true, get: function () { return zusaetze_js_1.addOnsOfItem; } });
92
+ Object.defineProperty(exports, "addOnRemap", { enumerable: true, get: function () { return zusaetze_js_1.addOnRemap; } });
93
+ Object.defineProperty(exports, "addOnDisplayOrder", { enumerable: true, get: function () { return zusaetze_js_1.addOnDisplayOrder; } });
94
+ Object.defineProperty(exports, "orderAddOnLines", { enumerable: true, get: function () { return zusaetze_js_1.orderAddOnLines; } });
69
95
  var client_js_1 = require("./client.js");
70
96
  Object.defineProperty(exports, "getPosSettings", { enumerable: true, get: function () { return client_js_1.getPosSettings; } });
71
97
  Object.defineProperty(exports, "setMyPosSettings", { enumerable: true, get: function () { return client_js_1.setMyPosSettings; } });
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Kachel mit Betrag und Referenz: eine Kachel fragt beim Antippen den Betrag
3
+ * (`askPrice`) und/oder eine Referenz (Honorarnote, Auftragsnummer) ab.
4
+ * Dieselben Regeln rechnen das Backend (`kachel-referenz-core.js`) und das
5
+ * Dart-Paket; der Vertrag sind die Pruefaelle `fixtures/reference-cases.json`.
6
+ */
7
+ /** `optional` = darf leer bleiben, `required` = Pflicht. */
8
+ export declare const REFERENCE_MODES: readonly ["optional", "required"];
9
+ export type ReferenceMode = typeof REFERENCE_MODES[number];
10
+ /** Einstellung am Artikel (Draht `reference`). */
11
+ export interface PosReference {
12
+ mode: ReferenceMode;
13
+ /** Titel des Eingabefelds („Honorarnote Nr.“); steht nie am Beleg. */
14
+ label: string;
15
+ /** Platzhalter/Hilfetext („z. B. 2026/0123“); null = keiner. */
16
+ hint: string | null;
17
+ /** Regulaerer Ausdruck fuer die ganze Eingabe (ohne ^/$); null = keiner. */
18
+ pattern: string | null;
19
+ /** true = falsches Format sperrt, false = nur Warnung. */
20
+ patternStrict: boolean;
21
+ }
22
+ /** Hoechstlaenge der Eingabe an der Kasse. */
23
+ export declare const REFERENCE_INPUT_MAX = 40;
24
+ export declare const REFERENCE_LABEL_MAX = 30;
25
+ export declare const REFERENCE_HINT_MAX = 60;
26
+ export declare const REFERENCE_PATTERN_MAX = 200;
27
+ /** Vorlagen fuer das Musterfeld im Panel. */
28
+ export declare const REFERENCE_PATTERN_TEMPLATES: readonly {
29
+ key: 'digits' | 'year_number' | 'letters_digits';
30
+ pattern: string;
31
+ }[];
32
+ /**
33
+ * Eingabe an der Kasse: ohne Steuer- und Formatzeichen, Leerraum
34
+ * zusammengezogen und getrimmt. Bewusst ohne NFC, damit Web und Dart gleich
35
+ * rechnen (Dart kennt keine Unicode-Normalisierung).
36
+ */
37
+ export declare function cleanReferenceText(text: string): string;
38
+ /** Ist das Muster erlaubt (kompilierbar, ohne gesperrte Konstrukte)? */
39
+ export declare function isValidReferencePattern(pattern: string | null | undefined): boolean;
40
+ /** Reines Ziffernmuster -> die Kasse zeigt die Zifferntastatur. */
41
+ export declare function isDigitsOnlyPattern(pattern: string | null | undefined): boolean;
42
+ export type ReferenceCheckResult = 'ok' | 'empty' | 'warning' | 'error';
43
+ /**
44
+ * Prueft die Eingabe an der Kasse. `empty` und `error` sperren das Uebernehmen,
45
+ * `warning` zeigt den Hinweis und laesst uebernehmen. Ein ungueltiges Muster
46
+ * (Altbestand, fremder Client) gilt wie keines.
47
+ */
48
+ export declare function checkReference(input: string | null | undefined, reference: Pick<PosReference, 'mode' | 'pattern' | 'patternStrict'> | null | undefined): {
49
+ result: ReferenceCheckResult;
50
+ value: string;
51
+ };
52
+ /** Positionsname am Beleg: Artikelname + Leerzeichen + Referenz (leer = nur der Name). */
53
+ export declare function referenceLineName(articleName: string, value: string | null | undefined): string;
54
+ /** Liest `reference` vom Draht; alles Unbrauchbare -> null. */
55
+ export declare function fromReferencePayload(p: unknown): PosReference | null;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * Kachel mit Betrag und Referenz: eine Kachel fragt beim Antippen den Betrag
4
+ * (`askPrice`) und/oder eine Referenz (Honorarnote, Auftragsnummer) ab.
5
+ * Dieselben Regeln rechnen das Backend (`kachel-referenz-core.js`) und das
6
+ * Dart-Paket; der Vertrag sind die Pruefaelle `fixtures/reference-cases.json`.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = void 0;
10
+ exports.cleanReferenceText = cleanReferenceText;
11
+ exports.isValidReferencePattern = isValidReferencePattern;
12
+ exports.isDigitsOnlyPattern = isDigitsOnlyPattern;
13
+ exports.checkReference = checkReference;
14
+ exports.referenceLineName = referenceLineName;
15
+ exports.fromReferencePayload = fromReferencePayload;
16
+ /** `optional` = darf leer bleiben, `required` = Pflicht. */
17
+ exports.REFERENCE_MODES = ['optional', 'required'];
18
+ /** Hoechstlaenge der Eingabe an der Kasse. */
19
+ exports.REFERENCE_INPUT_MAX = 40;
20
+ exports.REFERENCE_LABEL_MAX = 30;
21
+ exports.REFERENCE_HINT_MAX = 60;
22
+ exports.REFERENCE_PATTERN_MAX = 200;
23
+ /** Vorlagen fuer das Musterfeld im Panel. */
24
+ exports.REFERENCE_PATTERN_TEMPLATES = [
25
+ { key: 'digits', pattern: '\\d+' },
26
+ { key: 'year_number', pattern: '\\d{4}/\\d{1,6}' },
27
+ { key: 'letters_digits', pattern: '[A-Za-z]{1,4}-?\\d{1,8}' },
28
+ ];
29
+ // Steuer- und unsichtbare Formatzeichen.
30
+ // eslint-disable-next-line no-control-regex
31
+ const STEUERZEICHEN = /[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028\u2029\u202a-\u202e\u2060-\u2064\ufeff]/g;
32
+ /**
33
+ * Eingabe an der Kasse: ohne Steuer- und Formatzeichen, Leerraum
34
+ * zusammengezogen und getrimmt. Bewusst ohne NFC, damit Web und Dart gleich
35
+ * rechnen (Dart kennt keine Unicode-Normalisierung).
36
+ */
37
+ function cleanReferenceText(text) {
38
+ return text.replace(STEUERZEICHEN, '').replace(/\s+/g, ' ').trim();
39
+ }
40
+ // Konstrukte, die JS und Dart nicht garantiert gleich auswerten.
41
+ const GESPERRT = [/\(\?<[=!]/, /\(\?<[A-Za-z]/, /\\[1-9]/, /\\k</, /\(\?[a-zA-Z]/];
42
+ /** Ist das Muster erlaubt (kompilierbar, ohne gesperrte Konstrukte)? */
43
+ function isValidReferencePattern(pattern) {
44
+ if (typeof pattern !== 'string' || pattern.length < 1 || pattern.length > exports.REFERENCE_PATTERN_MAX)
45
+ return false;
46
+ if (GESPERRT.some((r) => r.test(pattern)))
47
+ return false;
48
+ try {
49
+ new RegExp(`^(?:${pattern})$`);
50
+ return true;
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ }
56
+ /** Reines Ziffernmuster -> die Kasse zeigt die Zifferntastatur. */
57
+ function isDigitsOnlyPattern(pattern) {
58
+ if (typeof pattern !== 'string' || pattern === '' || !isValidReferencePattern(pattern))
59
+ return false;
60
+ const rest = pattern
61
+ .replace(/\\d/g, '')
62
+ .replace(/\[0-9\]/g, '')
63
+ .replace(/\{\d+(,\d*)?\}/g, '')
64
+ .replace(/\(\?:/g, '')
65
+ .replace(/[()|?*+^$]/g, '');
66
+ return rest === '';
67
+ }
68
+ /**
69
+ * Prueft die Eingabe an der Kasse. `empty` und `error` sperren das Uebernehmen,
70
+ * `warning` zeigt den Hinweis und laesst uebernehmen. Ein ungueltiges Muster
71
+ * (Altbestand, fremder Client) gilt wie keines.
72
+ */
73
+ function checkReference(input, reference) {
74
+ const value = cleanReferenceText(input ?? '').slice(0, exports.REFERENCE_INPUT_MAX);
75
+ if (!reference)
76
+ return { result: 'ok', value };
77
+ if (value === '')
78
+ return { result: reference.mode === 'required' ? 'empty' : 'ok', value };
79
+ if (reference.pattern && isValidReferencePattern(reference.pattern)) {
80
+ if (!new RegExp(`^(?:${reference.pattern})$`).test(value)) {
81
+ return { result: reference.patternStrict ? 'error' : 'warning', value };
82
+ }
83
+ }
84
+ return { result: 'ok', value };
85
+ }
86
+ /** Positionsname am Beleg: Artikelname + Leerzeichen + Referenz (leer = nur der Name). */
87
+ function referenceLineName(articleName, value) {
88
+ return value ? `${articleName} ${value}` : articleName;
89
+ }
90
+ /** Liest `reference` vom Draht; alles Unbrauchbare -> null. */
91
+ function fromReferencePayload(p) {
92
+ if (!p || typeof p !== 'object' || Array.isArray(p))
93
+ return null;
94
+ const r = p;
95
+ if (r.mode !== 'optional' && r.mode !== 'required')
96
+ return null;
97
+ if (typeof r.label !== 'string' || r.label === '')
98
+ return null;
99
+ const pattern = typeof r.pattern === 'string' && r.pattern !== '' ? r.pattern : null;
100
+ return {
101
+ mode: r.mode,
102
+ label: r.label,
103
+ hint: typeof r.hint === 'string' && r.hint !== '' ? r.hint : null,
104
+ pattern,
105
+ patternStrict: pattern !== null && r.patternStrict === true,
106
+ };
107
+ }
@@ -119,6 +119,16 @@ declare const MELDUNGEN_ROH: {
119
119
  readonly 'item.description_missing': {
120
120
  readonly text: "Bitte eine Bezeichnung eingeben – sie steht am Beleg.";
121
121
  };
122
+ readonly 'reference.missing': {
123
+ readonly text: "Bitte „{name}“ eingeben.";
124
+ readonly placeholders: readonly ["name"];
125
+ };
126
+ readonly 'reference.format_invalid': {
127
+ readonly text: "Das Format passt nicht.";
128
+ };
129
+ readonly 'reference.format_warning': {
130
+ readonly text: "Das Format passt nicht. Trotzdem übernehmen?";
131
+ };
122
132
  readonly 'discount.percent_invalid': {
123
133
  readonly text: "Bitte einen Prozentwert zwischen 0,1 und 100 eingeben.";
124
134
  };
@@ -2062,6 +2072,31 @@ declare const BESCHRIFTUNGEN_ROH: {
2062
2072
  readonly 'voucher.add': {
2063
2073
  readonly text: "Hinzufügen";
2064
2074
  };
2075
+ readonly 'tile_prompt.amount': {
2076
+ readonly text: "Betrag";
2077
+ };
2078
+ readonly 'tile_prompt.quantity': {
2079
+ readonly text: "Menge";
2080
+ };
2081
+ readonly 'tile_prompt.apply': {
2082
+ readonly text: "Übernehmen";
2083
+ };
2084
+ readonly 'tile_prompt.apply_anyway': {
2085
+ readonly text: "Trotzdem übernehmen";
2086
+ };
2087
+ readonly 'addons.title': {
2088
+ readonly text: "Zusätze zu {name}";
2089
+ readonly placeholders: readonly ["name"];
2090
+ };
2091
+ readonly 'addons.none': {
2092
+ readonly text: "Ohne Zusatz";
2093
+ };
2094
+ readonly 'addons.done': {
2095
+ readonly text: "Fertig";
2096
+ };
2097
+ readonly 'addons.open': {
2098
+ readonly text: "Zusätze";
2099
+ };
2065
2100
  readonly 'voucher.tab': {
2066
2101
  readonly text: "Gutscheine";
2067
2102
  };
@@ -82,6 +82,10 @@ const MELDUNGEN_ROH = {
82
82
  'articles.vat_rate_unknown': { text: '„{name}“ hat einen Steuersatz, den die Kasse nicht kennt.', placeholders: ['name'] },
83
83
  'item.amount_missing': { text: 'Bitte einen Betrag eingeben.' },
84
84
  'item.description_missing': { text: 'Bitte eine Bezeichnung eingeben – sie steht am Beleg.' },
85
+ // Kachel mit Betrag und Referenz (1.26.0): Eingabeblatt beim Antippen.
86
+ 'reference.missing': { text: 'Bitte „{name}“ eingeben.', placeholders: ['name'] },
87
+ 'reference.format_invalid': { text: 'Das Format passt nicht.' },
88
+ 'reference.format_warning': { text: 'Das Format passt nicht. Trotzdem übernehmen?' },
85
89
  'discount.percent_invalid': { text: 'Bitte einen Prozentwert zwischen 0,1 und 100 eingeben.' },
86
90
  // --- Kassieren -----------------------------------------------------------
87
91
  // Der Grund ueber dem Knopf, solange der Beleg nicht abgeschlossen werden kann.
@@ -1051,6 +1055,16 @@ const BESCHRIFTUNGEN_ROH = {
1051
1055
  'voucher.code_done': { text: 'Fertig' },
1052
1056
  'voucher.article': { text: 'Artikel' },
1053
1057
  'voucher.add': { text: 'Hinzufügen' },
1058
+ // Kachel mit Betrag und Referenz (1.26.0): Felder und Knoepfe des Eingabeblatts.
1059
+ 'tile_prompt.amount': { text: 'Betrag' },
1060
+ 'tile_prompt.quantity': { text: 'Menge' },
1061
+ 'tile_prompt.apply': { text: 'Übernehmen' },
1062
+ 'tile_prompt.apply_anyway': { text: 'Trotzdem übernehmen' },
1063
+ // Zusatz-Kacheln (1.27.0): Fenster nach dem Antippen einer Hauptleistung, Knopf an der Korbzeile.
1064
+ 'addons.title': { text: 'Zusätze zu {name}', placeholders: ['name'] },
1065
+ 'addons.none': { text: 'Ohne Zusatz' },
1066
+ 'addons.done': { text: 'Fertig' },
1067
+ 'addons.open': { text: 'Zusätze' },
1054
1068
  // Gutschein-Sorten als Kacheln im Reiter „Gutscheine“ (Stufe 4b, 1.17.0): Kachel je Sorte mit Betrag
1055
1069
  // oder „Betrag eingeben“, darunter klein die Art; dazu die feste Kachel „Leistungsgutschein“.
1056
1070
  'voucher.tab': { text: 'Gutscheine' },
@@ -0,0 +1,70 @@
1
+ import type { ArticleGroup, PosArticle } from './artikel.js';
2
+ /**
3
+ * Zusatz-Kacheln (1.27.0): Tippt man eine Hauptleistung an, oeffnet die Kasse
4
+ * ein Fenster mit ihren Zusaetzen. Die Liste steht an der Gruppe, je Artikel
5
+ * abweichend (`addOns`: null = wie die Gruppe, [] = keine, sonst eigene Liste).
6
+ * Jeder Zusatz wird eine eigene Belegposition mit `addOnOf` = Index der
7
+ * Hauptposition. Die Regeln rechnen Backend (`gemeinsam/zusatz-core.js`), npm
8
+ * und Dart gleich; der Vertrag sind die Pruefaelle `fixtures/add-on-cases.json`.
9
+ */
10
+ /** Hoechstens so viele Zusaetze je Liste (der Server weist mehr ab). */
11
+ export declare const ADD_ONS_MAX = 30;
12
+ /** Warum ein Artikel kein Zusatz sein kann (Panel zeigt den Grund an). */
13
+ export declare const ADD_ON_BLOCK_REASONS: readonly ["inactive", "own_list", "asks_price", "reference", "asks_quantity", "no_price", "service_voucher"];
14
+ export type AddOnBlockReason = typeof ADD_ON_BLOCK_REASONS[number];
15
+ type ZusatzArtikel = Pick<PosArticle, 'id' | 'active' | 'unitPriceCents'> & Partial<Pick<PosArticle, 'addOns' | 'askPrice' | 'reference' | 'askQuantity' | 'serviceVoucher'>>;
16
+ type ArtikelNachId<T> = ReadonlyMap<string, T> | Readonly<Record<string, T>>;
17
+ /**
18
+ * Taugt der Artikel als Zusatz? `null` = ja. Im Fenster wird ohne Abfrage
19
+ * gebucht: Betrag, Referenz oder Menge fragen geht nicht, ein Preis muss
20
+ * feststehen (0 erlaubt), ein Leistungsgutschein liefe am Gutschein-Weg vorbei,
21
+ * und ein Artikel mit eigener Liste oeffnete selbst ein Fenster (eine Ebene).
22
+ */
23
+ export declare function isSelectableAddOn(a: ZusatzArtikel): AddOnBlockReason | null;
24
+ /**
25
+ * Wirksame Zusatzliste eines Artikels: eigene Liste (auch leer) vor der der
26
+ * Gruppe; still heraus fallen der Artikel selbst, Unbekanntes, Dubletten und
27
+ * alles, was nicht als Zusatz taugt. Leer = kein Fenster.
28
+ */
29
+ export declare function addOnsFor<T extends ZusatzArtikel>(article: ZusatzArtikel, group: Pick<ArticleGroup, 'addOns'> | null | undefined, articleById: ArtikelNachId<T>): string[];
30
+ type MitVerweis = {
31
+ addOnOf?: number | null;
32
+ };
33
+ /**
34
+ * Halten die Verweise den Server-Regeln stand? Ganze Zahl, zeigt nach vorne
35
+ * auf eine Warenposition, die selbst kein Zusatz ist (sonst antwortet
36
+ * createReceipt mit `invalid_add_on_reference`).
37
+ */
38
+ export declare function addOnReferencesValid(items: readonly (MitVerweis & {
39
+ kind?: string | null;
40
+ })[]): boolean;
41
+ /** Indizes der Zusaetze einer Hauptposition (Storno: mit vormerken, abwaehlbar). */
42
+ export declare function addOnsOfItem(items: readonly MitVerweis[], index: number): number[];
43
+ /**
44
+ * Storno: Verweis je Storno-Position (in der Reihenfolge der stornierten
45
+ * Positionen, Menge > 0). Ein Zusatz behaelt ihn nur, wenn seine Hauptposition
46
+ * mit storniert wird, umgerechnet auf den neuen Index; sonst `null`.
47
+ */
48
+ export declare function addOnRemap(items: readonly MitVerweis[], quantities: readonly number[]): (number | null)[];
49
+ /** Ist Position `i` ein gueltiger Zusatz (Verweis nach vorne auf eine Hauptposition)? Paketintern (Layout). */
50
+ export declare function istGueltigerZusatz(items: readonly MitVerweis[], i: number): boolean;
51
+ /**
52
+ * Bon-Reihenfolge: jede Hauptposition, direkt gefolgt von ihren Zusaetzen
53
+ * (stabil). Positionen mit ungueltigem Verweis bleiben an ihrem Platz.
54
+ */
55
+ export declare function addOnDisplayOrder(items: readonly MitVerweis[]): number[];
56
+ /**
57
+ * Warenkorb -> Belegpositionen: Zeilen tragen die Zeilen-Id ihrer Hauptzeile
58
+ * (`addOnOf`). Sortiert jeden Zusatz hinter seine Hauptzeile (stabil) und
59
+ * rechnet den Verweis in den Index um. Fehlt die Hauptzeile (geloescht oder
60
+ * vorher herausgefiltert, etwa ein Gutschein-Verkauf), bleibt die Zeile ohne
61
+ * Verweis an ihrem Platz.
62
+ */
63
+ export declare function orderAddOnLines<T extends {
64
+ id: string;
65
+ addOnOf?: string | null;
66
+ }>(lines: readonly T[]): {
67
+ line: T;
68
+ addOnOf: number | null;
69
+ }[];
70
+ export {};