@pisell/private-materials 6.12.286 → 6.12.288

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 (41) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +14 -14
  6. package/build/lowcode/view.js +14 -14
  7. package/es/components/HDLKiosk/ui/entry/Screen/assets/PHOSPHOR-LICENSE +21 -21
  8. package/es/plus/invoice/ReceiptRenderer.js +86 -42
  9. package/es/plus/invoice/VirtualCurrencyLines.js +21 -8
  10. package/es/plus/invoice/VirtualCurrencyReceiptRenderer.js +21 -10
  11. package/es/plus/invoice/invoiceVisibility.js +94 -0
  12. package/es/plus/invoice/receipt.js +4 -3
  13. package/es/plus/piPaymentUI/eftpos/logger.js +10 -7
  14. package/es/plus/piPaymentUI/sendWarningLog.js +33 -22
  15. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  16. package/es/plus/saleDetail/actions/index.js +11 -4
  17. package/es/plus/saleDetail/serve.js +7 -8
  18. package/es/plus/saleDetail/tmpl/B/components/Invoice/VirtualCurrencyInvoice.js +1 -1
  19. package/es/plus/saleDetail/tmpl/B/components/Invoice/index.js +29 -5
  20. package/es/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +85 -43
  21. package/es/plus/salesSdk/context/SalesSdkCartContext.js +5 -1
  22. package/es/plus/salesSdk/context/SalesSdkProvider.js +3 -0
  23. package/es/plus/salesSdk/utils/receiptPrintWarning.js +16 -0
  24. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  25. package/lib/components/HDLKiosk/ui/entry/Screen/assets/PHOSPHOR-LICENSE +21 -21
  26. package/lib/plus/invoice/ReceiptRenderer.js +86 -42
  27. package/lib/plus/invoice/VirtualCurrencyLines.js +21 -8
  28. package/lib/plus/invoice/VirtualCurrencyReceiptRenderer.js +21 -10
  29. package/lib/plus/invoice/invoiceVisibility.js +99 -0
  30. package/lib/plus/invoice/receipt.js +4 -3
  31. package/lib/plus/piPaymentUI/eftpos/logger.js +10 -7
  32. package/lib/plus/piPaymentUI/sendWarningLog.js +32 -20
  33. package/lib/plus/saleDetail/actions/index.js +11 -4
  34. package/lib/plus/saleDetail/serve.js +7 -8
  35. package/lib/plus/saleDetail/tmpl/B/components/Invoice/VirtualCurrencyInvoice.js +1 -1
  36. package/lib/plus/saleDetail/tmpl/B/components/Invoice/index.js +29 -5
  37. package/lib/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +85 -43
  38. package/lib/plus/salesSdk/context/SalesSdkCartContext.js +5 -1
  39. package/lib/plus/salesSdk/context/SalesSdkProvider.js +3 -0
  40. package/lib/plus/salesSdk/utils/receiptPrintWarning.js +16 -0
  41. package/package.json +3 -3
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Phosphor Icons
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Phosphor Icons
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,5 +1,6 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
3
+ import { isInvoiceFieldVisible, isInvoiceModuleVisible } from "./invoiceVisibility.js";
3
4
  import { getModuleImage, getModuleText, getReceiptBookingId, getReceiptLabel, getReceiptProductTotal, multiplyReceiptMoney, receiptMoneyValuesDiffer, subtractReceiptMoney, sumReceiptMoney } from "./receipt.js";
4
5
  import { bilingualText, mergeTranslatedRows, receiptLabel, withReceiptTranslations } from "./receiptTranslations.js";
5
6
  import dayjs from "dayjs";
@@ -19,6 +20,7 @@ function ReceiptSeparator() {
19
20
  }, RECEIPT_SEPARATOR_TEXT);
20
21
  }
21
22
  function ReceiptRows({ locale, rows }) {
23
+ if (!rows.length) return null;
22
24
  return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-rows` }, rows.map((row, index) => {
23
25
  const singleValue = !row.item || !row.value;
24
26
  const alignment = row.align || (singleValue ? "left" : "");
@@ -31,11 +33,11 @@ function ReceiptRows({ locale, rows }) {
31
33
  function ReceiptSectionTitle({ children }) {
32
34
  return /* @__PURE__ */ React.createElement("h3", { className: `${PREFIX}__receipt-section-title` }, children);
33
35
  }
34
- function PaymentNotice({ receipt }) {
36
+ function PaymentNotice({ receipt, separated = true }) {
35
37
  var _receipt$secondary;
36
38
  const notice = receipt.paymentNotice;
37
39
  if (!notice) return null;
38
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReceiptSeparator, null), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice-title` }, bilingualText(notice.title, (_receipt$secondary = receipt.secondary) === null || _receipt$secondary === void 0 || (_receipt$secondary = _receipt$secondary.paymentNotice) === null || _receipt$secondary === void 0 ? void 0 : _receipt$secondary.title)), notice.total || notice.paid ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice-summary` }, notice.total ? `${label("Total", receipt.locale)}: ${notice.total}.` : "", " ", notice.paid ? `${label("Paid", receipt.locale)}: ${notice.paid}.` : "", receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, [notice.total ? label("Total", receipt.secondary.locale) : "", notice.paid ? label("Paid", receipt.secondary.locale) : ""].filter(Boolean).join(" / ")) : null) : null, notice.due ? /* @__PURE__ */ React.createElement("strong", null, label("Balance Due", receipt.locale), ": ", notice.due, ".", receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Balance Due", receipt.secondary.locale)) : null) : null));
40
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, separated ? /* @__PURE__ */ React.createElement(ReceiptSeparator, null) : null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice-title` }, bilingualText(notice.title, (_receipt$secondary = receipt.secondary) === null || _receipt$secondary === void 0 || (_receipt$secondary = _receipt$secondary.paymentNotice) === null || _receipt$secondary === void 0 ? void 0 : _receipt$secondary.title)), notice.total || notice.paid ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-payment-notice-summary` }, notice.total ? `${label("Total", receipt.locale)}: ${notice.total}.` : "", " ", notice.paid ? `${label("Paid", receipt.locale)}: ${notice.paid}.` : "", receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, [notice.total ? label("Total", receipt.secondary.locale) : "", notice.paid ? label("Paid", receipt.secondary.locale) : ""].filter(Boolean).join(" / ")) : null) : null, notice.due ? /* @__PURE__ */ React.createElement("strong", null, label("Balance Due", receipt.locale), ": ", notice.due, ".", receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Balance Due", receipt.secondary.locale)) : null) : null));
39
41
  }
40
42
  function getOptionTitle(option) {
41
43
  return String(option.name || option.title || option.product_title || "");
@@ -127,8 +129,9 @@ function buildOptionRows(options, quantity, indent, showUnitPrice = true) {
127
129
  function isDiscountExtension(row) {
128
130
  return /^\s*-/.test(String(row.value || ""));
129
131
  }
130
- function buildProductDetailRows(product, quantity, locale, indent, scaleCombinationQuantity = true, showUnitPrice = true) {
132
+ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinationQuantity = true, showUnitPrice = true, config) {
131
133
  var _product$base_price, _product$product_note;
134
+ const visible = (field) => !config || isInvoiceFieldVisible(config, field);
132
135
  const options = Array.isArray(product.options) ? product.options : Array.isArray(product.combinations_options) ? product.combinations_options : [];
133
136
  const combinations = Array.isArray(product.combinations) ? product.combinations : Array.isArray(product.product_bundle) ? product.product_bundle : [];
134
137
  const extensionRows = Array.isArray(product.extension_list) ? product.extension_list.filter((row) => !/^\s*\d+(?:\.\d+)?\s*@\s*.+\s+EACH\s*$/i.test(String((row === null || row === void 0 ? void 0 : row.item) || ""))) : [];
@@ -147,19 +150,19 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
147
150
  const note = formatProductNote((_product$product_note = product.product_note) !== null && _product$product_note !== void 0 ? _product$product_note : product.note, locale);
148
151
  const allergy = formatProductAllergy(product.allergy, locale);
149
152
  const rows = [];
150
- if (allergy) rows.push({
153
+ if (allergy && visible("allergies")) rows.push({
151
154
  receipt_key: `${product.receipt_key}/allergy`,
152
155
  item: allergy,
153
156
  value: "",
154
157
  indent
155
158
  });
156
- if (note) rows.push({
159
+ if (note && visible("item_note")) rows.push({
157
160
  receipt_key: `${product.receipt_key}/note`,
158
161
  item: note,
159
162
  value: "",
160
163
  indent
161
164
  });
162
- if (showBasePrice) rows.push({
165
+ if (showBasePrice && visible("base_price")) rows.push({
163
166
  receipt_key: `${product.receipt_key}/Base price`,
164
167
  item: label("Base price", locale),
165
168
  value: authoritativeBasePrice || subtractReceiptMoney(originalTotal, optionTotal ? [optionTotal] : []),
@@ -190,7 +193,7 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
190
193
  value: combinationTotals[index],
191
194
  indent: indent + 1
192
195
  });
193
- rows.push(...buildProductDetailRows(combination, combinationQuantity, locale, indent + 2, true, showUnitPrice));
196
+ rows.push(...buildProductDetailRows(combination, combinationQuantity, locale, indent + 2, true, showUnitPrice, config));
194
197
  });
195
198
  }
196
199
  rows.push(...otherExtensionRows.map((row) => _objectSpread2(_objectSpread2({}, row), {}, { indent })));
@@ -200,11 +203,11 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
200
203
  })));
201
204
  return rows;
202
205
  }
203
- function ProductDetails({ locale, product, secondaryLocale }) {
206
+ function ProductDetails({ locale, product, secondaryLocale, config }) {
204
207
  const quantity = Number(product.product_quantity || 1);
205
208
  const productTotal = getReceiptProductTotal(product);
206
- const primaryRows = buildProductDetailRows(product, quantity, locale, 1, false);
207
- const detailRows = secondaryLocale && product.secondary ? mergeTranslatedRows(primaryRows, buildProductDetailRows(product.secondary, quantity, secondaryLocale, 1, false, false), locale, secondaryLocale, true) : primaryRows;
209
+ const primaryRows = buildProductDetailRows(product, quantity, locale, 1, false, true, config);
210
+ const detailRows = secondaryLocale && product.secondary ? mergeTranslatedRows(primaryRows, buildProductDetailRows(product.secondary, quantity, secondaryLocale, 1, false, false, config), locale, secondaryLocale, true) : primaryRows;
208
211
  return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-product` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-product-main` }, /* @__PURE__ */ React.createElement("strong", null, quantity, " x ", productDisplayTitle(product), quantity > 1 && product.selling_price ? ` (${product.selling_price} each)` : "", product.secondary && productDisplayTitle(product.secondary) !== productDisplayTitle(product) ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, productDisplayTitle(product.secondary)) : null), /* @__PURE__ */ React.createElement("strong", null, productTotal)), detailRows.map((row, index) => /* @__PURE__ */ React.createElement("div", {
209
212
  className: `${PREFIX}__receipt-product-detail`,
210
213
  key: `${row.item}-${row.value}-${index}`,
@@ -252,16 +255,21 @@ function bookingMetaRows(group, locale) {
252
255
  }
253
256
  ].filter((row) => row.value);
254
257
  }
255
- function LineGroup({ group, locale, secondaryLocale }) {
256
- var _group$appointmentRow;
257
- return /* @__PURE__ */ React.createElement("section", { className: `${PREFIX}__receipt-line-group` }, group.booking || ((_group$appointmentRow = group.appointmentRows) === null || _group$appointmentRow === void 0 ? void 0 : _group$appointmentRow.length) ? /* @__PURE__ */ React.createElement("h4", null, bilingualText(label("Booking", locale), secondaryLocale && label("Booking", secondaryLocale))) : null, /* @__PURE__ */ React.createElement(ReceiptRows, {
258
+ function lineGroupMetaRows(group, locale, secondaryLocale) {
259
+ return secondaryLocale && group.secondary ? mergeTranslatedRows(group.appointmentRows || bookingMetaRows(group, locale), group.secondary.appointmentRows || bookingMetaRows(group.secondary, secondaryLocale), locale, secondaryLocale) : group.appointmentRows || bookingMetaRows(group, locale);
260
+ }
261
+ function LineGroup({ group, locale, secondaryLocale, config }) {
262
+ const metaRows = lineGroupMetaRows(group, locale, secondaryLocale);
263
+ if (!metaRows.length && !group.products.length) return null;
264
+ return /* @__PURE__ */ React.createElement("section", { className: `${PREFIX}__receipt-line-group` }, metaRows.length ? /* @__PURE__ */ React.createElement("h4", null, bilingualText(label("Booking", locale), secondaryLocale && label("Booking", secondaryLocale))) : null, /* @__PURE__ */ React.createElement(ReceiptRows, {
258
265
  locale,
259
- rows: secondaryLocale && group.secondary ? mergeTranslatedRows(group.appointmentRows || bookingMetaRows(group, locale), group.secondary.appointmentRows || bookingMetaRows(group.secondary, secondaryLocale), locale, secondaryLocale) : group.appointmentRows || bookingMetaRows(group, locale)
266
+ rows: metaRows
260
267
  }), group.products.map((product, productIndex) => /* @__PURE__ */ React.createElement(ProductDetails, {
261
268
  key: `${product.product_uid || product.booking_uid || "product"}-${productIndex}`,
262
269
  locale,
263
270
  product,
264
- secondaryLocale
271
+ secondaryLocale,
272
+ config
265
273
  })));
266
274
  }
267
275
  function RecordGroups({ groups, locale }) {
@@ -274,21 +282,48 @@ function RecordGroups({ groups, locale }) {
274
282
  }))));
275
283
  }
276
284
  function bookingHeadersAreVisible(config) {
277
- const booking = config.booking;
278
- if (!booking || typeof booking !== "object" || Array.isArray(booking)) return true;
279
- const value = booking.is_show;
280
- if (value === false || value === 0) return false;
281
- const normalized = String(value !== null && value !== void 0 ? value : "").trim().toLowerCase();
282
- return normalized !== "0" && normalized !== "false";
285
+ return isInvoiceFieldVisible(config, "booking");
283
286
  }
284
- const renderBrand = ({ receipt }) => {
287
+ const renderBrand = ({ config, receipt }) => {
285
288
  var _receipt$secondary2, _receipt$secondary3;
286
289
  const base = receipt.baseData;
287
- if (!Boolean(receipt.brandLogo || base.shop_name || base.shop_tax_number || base.shop_address || base.shop_phone)) return null;
288
- return /* @__PURE__ */ React.createElement("section", { className: `${PREFIX}__receipt-brand` }, receipt.brandLogo ? /* @__PURE__ */ React.createElement("img", {
290
+ const show = (field) => isInvoiceFieldVisible(config, field);
291
+ const logo = show("logo") && receipt.brandLogo;
292
+ const name = show("store_name") && base.shop_name;
293
+ const taxNumber = show("abn") && base.shop_tax_number;
294
+ const address = show("address") && base.shop_address;
295
+ const phone = show("phone") && base.shop_phone;
296
+ const title = show("tax_invoice") && Boolean(receipt.brandLogo || base.shop_name || base.shop_tax_number || base.shop_address || base.shop_phone);
297
+ if (!logo && !name && !taxNumber && !address && !phone && !title) return null;
298
+ return /* @__PURE__ */ React.createElement("section", { className: `${PREFIX}__receipt-brand` }, logo ? /* @__PURE__ */ React.createElement("img", {
289
299
  alt: "",
290
300
  src: receipt.brandLogo
291
- }) : null, base.shop_name ? /* @__PURE__ */ React.createElement("h2", null, bilingualText(base.shop_name, (_receipt$secondary2 = receipt.secondary) === null || _receipt$secondary2 === void 0 ? void 0 : _receipt$secondary2.baseData.shop_name)) : null, base.shop_tax_number ? /* @__PURE__ */ React.createElement("div", null, receipt.taxNumberLabel ? `${receipt.taxNumberLabel}: ` : "", base.shop_tax_number) : null, base.shop_address ? /* @__PURE__ */ React.createElement("div", null, bilingualText(base.shop_address, (_receipt$secondary3 = receipt.secondary) === null || _receipt$secondary3 === void 0 ? void 0 : _receipt$secondary3.baseData.shop_address)) : null, base.shop_phone ? /* @__PURE__ */ React.createElement("div", null, base.shop_phone) : null, /* @__PURE__ */ React.createElement("strong", { className: `${PREFIX}__receipt-bill-title` }, receiptLabel(receipt, receipt.billTitle)));
301
+ }) : null, name ? /* @__PURE__ */ React.createElement("h2", null, bilingualText(base.shop_name, (_receipt$secondary2 = receipt.secondary) === null || _receipt$secondary2 === void 0 ? void 0 : _receipt$secondary2.baseData.shop_name)) : null, taxNumber ? /* @__PURE__ */ React.createElement("div", null, receipt.taxNumberLabel ? `${receipt.taxNumberLabel}: ` : "", base.shop_tax_number) : null, address ? /* @__PURE__ */ React.createElement("div", null, bilingualText(base.shop_address, (_receipt$secondary3 = receipt.secondary) === null || _receipt$secondary3 === void 0 ? void 0 : _receipt$secondary3.baseData.shop_address)) : null, phone ? /* @__PURE__ */ React.createElement("div", null, base.shop_phone) : null, title ? /* @__PURE__ */ React.createElement("strong", { className: `${PREFIX}__receipt-bill-title` }, receiptLabel(receipt, receipt.billTitle)) : null);
302
+ };
303
+ /** Stable row keys survive translation; localized labels are never selectors. */
304
+ function visibleSemanticRows(rows, config, fields) {
305
+ return rows.filter((row) => {
306
+ var _row$receipt_key;
307
+ const key = ((_row$receipt_key = row.receipt_key) === null || _row$receipt_key === void 0 ? void 0 : _row$receipt_key.replace(/\/secondary$/, "")) || "";
308
+ return !fields[key] || isInvoiceFieldVisible(config, fields[key]);
309
+ });
310
+ }
311
+ const renderOrder = ({ config, receipt }) => {
312
+ const rows = visibleSemanticRows(receipt.orderRows, config, {
313
+ "order/Order time": "order_time",
314
+ "order/Last updated": "last_updated",
315
+ "order/Print time": "print_time"
316
+ });
317
+ const note = isInvoiceFieldVisible(config, "note") && receipt.orderNote;
318
+ const notice = isInvoiceFieldVisible(config, "payment_status") && receipt.paymentNotice;
319
+ if (!rows.length && !note && !notice) return null;
320
+ return /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
321
+ locale: receipt.locale,
322
+ rows
323
+ }), note ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-order-note` }, label("Order note", receipt.locale), ": ", receipt.orderNote, receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Order note", receipt.secondary.locale), receipt.secondary.orderNote && receipt.secondary.orderNote !== receipt.orderNote ? `: ${receipt.secondary.orderNote}` : "") : null) : null, notice ? /* @__PURE__ */ React.createElement(PaymentNotice, {
324
+ receipt,
325
+ separated: Boolean(rows.length || note)
326
+ }) : null);
292
327
  };
293
328
  const renderCustom = ({ config, receipt }) => {
294
329
  var _receipt$secondary4;
@@ -299,10 +334,7 @@ const MODULE_RENDERERS = {
299
334
  brand: renderBrand,
300
335
  board: renderBrand,
301
336
  custom_1: renderCustom,
302
- order: ({ receipt }) => receipt.orderRows.length || receipt.orderNote || receipt.paymentNotice ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
303
- locale: receipt.locale,
304
- rows: receipt.orderRows
305
- }), receipt.orderNote ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-order-note` }, label("Order note", receipt.locale), ": ", receipt.orderNote, receipt.secondary ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Order note", receipt.secondary.locale), receipt.secondary.orderNote && receipt.secondary.orderNote !== receipt.orderNote ? `: ${receipt.secondary.orderNote}` : "") : null) : null, /* @__PURE__ */ React.createElement(PaymentNotice, { receipt })) : null,
337
+ order: renderOrder,
306
338
  handover: ({ receipt }) => receipt.deliveryRows.length ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
307
339
  locale: receipt.locale,
308
340
  rows: receipt.deliveryRows
@@ -312,28 +344,40 @@ const MODULE_RENDERERS = {
312
344
  rows: receipt.customerRows
313
345
  })) : null,
314
346
  line_groups: ({ config, receipt }) => {
315
- const lineGroups = bookingHeadersAreVisible(config) ? receipt.lineGroups : receipt.products.length ? [{
347
+ const showBookingHeaders = bookingHeadersAreVisible(config);
348
+ const lineGroups = showBookingHeaders ? receipt.lineGroups.filter((group) => {
349
+ var _receipt$secondary5;
350
+ return group.products.length || lineGroupMetaRows(group, receipt.locale, (_receipt$secondary5 = receipt.secondary) === null || _receipt$secondary5 === void 0 ? void 0 : _receipt$secondary5.locale).length;
351
+ }) : receipt.products.length ? [{
316
352
  key: "all-items",
317
353
  products: receipt.products,
318
354
  resources: []
319
355
  }] : [];
320
- return lineGroups.length || receipt.tableRows.length ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
356
+ const tableRows = showBookingHeaders ? receipt.tableRows : [];
357
+ return lineGroups.length || tableRows.length ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
321
358
  locale: receipt.locale,
322
- rows: receipt.tableRows
359
+ rows: tableRows
323
360
  }), lineGroups.map((group) => {
324
- var _receipt$secondary5;
361
+ var _receipt$secondary6;
325
362
  return /* @__PURE__ */ React.createElement(LineGroup, {
326
363
  group,
327
364
  key: group.key,
328
365
  locale: receipt.locale,
329
- secondaryLocale: (_receipt$secondary5 = receipt.secondary) === null || _receipt$secondary5 === void 0 ? void 0 : _receipt$secondary5.locale
366
+ secondaryLocale: (_receipt$secondary6 = receipt.secondary) === null || _receipt$secondary6 === void 0 ? void 0 : _receipt$secondary6.locale,
367
+ config
330
368
  });
331
369
  })) : null;
332
370
  },
333
- settlement: ({ receipt }) => receipt.settlementRows.length ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
334
- locale: receipt.locale,
335
- rows: receipt.settlementRows
336
- })) : null,
371
+ settlement: ({ config, receipt }) => {
372
+ const rows = visibleSemanticRows(receipt.settlementRows, config, {
373
+ "settlement/original": "original_amount",
374
+ "settlement/item-discounts": "item_discounts"
375
+ });
376
+ return rows.length ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(ReceiptRows, {
377
+ locale: receipt.locale,
378
+ rows
379
+ })) : null;
380
+ },
337
381
  custom_2: renderCustom,
338
382
  customer_2: renderCustom,
339
383
  payment: ({ receipt }) => receipt.paymentSummaryRows.length || receipt.paymentRows.length || receipt.refundRows.length ? /* @__PURE__ */ React.createElement("section", null, receipt.paymentSummaryRows.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReceiptSectionTitle, null, receiptLabel(receipt, "Payment summary")), /* @__PURE__ */ React.createElement(ReceiptRows, {
@@ -350,9 +394,9 @@ const MODULE_RENDERERS = {
350
394
  groups: receipt.walletRows,
351
395
  locale: receipt.locale
352
396
  })) : null,
353
- total_savings: ({ receipt }) => {
354
- var _receipt$secondary6;
355
- return receipt.totalSavings ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-savings` }, /* @__PURE__ */ React.createElement("strong", null, receiptLabel(receipt, "Total Savings")), /* @__PURE__ */ React.createElement("strong", null, receipt.totalSavings)), receipt.totalSavingsDescription ? /* @__PURE__ */ React.createElement("p", { className: `${PREFIX}__receipt-savings-description` }, bilingualText(receipt.totalSavingsDescription, (_receipt$secondary6 = receipt.secondary) === null || _receipt$secondary6 === void 0 ? void 0 : _receipt$secondary6.totalSavingsDescription)) : null) : null;
397
+ total_savings: ({ config, receipt }) => {
398
+ var _receipt$secondary7;
399
+ return receipt.totalSavings ? /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__receipt-savings` }, /* @__PURE__ */ React.createElement("strong", null, receiptLabel(receipt, "Total Savings")), /* @__PURE__ */ React.createElement("strong", null, receipt.totalSavings)), isInvoiceFieldVisible(config, "description") && receipt.totalSavingsDescription ? /* @__PURE__ */ React.createElement("p", { className: `${PREFIX}__receipt-savings-description` }, bilingualText(receipt.totalSavingsDescription, (_receipt$secondary7 = receipt.secondary) === null || _receipt$secondary7 === void 0 ? void 0 : _receipt$secondary7.totalSavingsDescription)) : null) : null;
356
400
  },
357
401
  custom_3: renderCustom,
358
402
  barcode: ({ receipt }) => receipt.barcodeValue ? /* @__PURE__ */ React.createElement("section", { className: `${PREFIX}__receipt-barcode` }, /* @__PURE__ */ React.createElement(QRCode, {
@@ -381,7 +425,7 @@ const InvoiceReceiptPaper = forwardRef(function InvoiceReceiptPaper(_ref, ref) {
381
425
  const InvoiceReceiptRenderer = forwardRef(function InvoiceReceiptRenderer({ receipt: primaryReceipt, moduleOverrides }, ref) {
382
426
  const receipt = withReceiptTranslations(primaryReceipt, primaryReceipt.secondary);
383
427
  const renderedModules = receipt.layout.module.flatMap((module, index) => {
384
- if (module.is_show === 0) return [];
428
+ if (!isInvoiceModuleVisible(module)) return [];
385
429
  const Renderer = MODULE_RENDERERS[module.key];
386
430
  const override = moduleOverrides === null || moduleOverrides === void 0 ? void 0 : moduleOverrides[module.key];
387
431
  const content = moduleOverrides && Object.prototype.hasOwnProperty.call(moduleOverrides, module.key) ? typeof override === "function" ? override(module) : override : Renderer === null || Renderer === void 0 ? void 0 : Renderer({
@@ -1,6 +1,8 @@
1
1
  import locales_default from "../saleDetail/locales.js";
2
2
  import locales_default$1 from "../saleDetail/components/LineItem/locales.js";
3
3
  import { formatMoney } from "../saleDetail/components/LineItem/utils/render.js";
4
+ import { isInvoiceFieldVisible } from "./invoiceVisibility.js";
5
+ import { getReceiptLabel } from "./receipt.js";
4
6
  import { bilingualText, pairReceiptEntries } from "./receiptTranslations.js";
5
7
  import React from "react";
6
8
  import { locales } from "@pisell/utils";
@@ -26,6 +28,7 @@ function selectedText(key, locale) {
26
28
  return ((_language = locales_default[language]) === null || _language === void 0 ? void 0 : _language[key]) || ((_language2 = locales_default$1[language]) === null || _language2 === void 0 ? void 0 : _language2[key]) || locales_default.en[key] || key;
27
29
  }
28
30
  function getLineLabel(line, locale) {
31
+ if (line.kind === "allergy") return `${getReceiptLabel(locale || "en", "Allergies")}: ${line.label}`;
29
32
  if (line.kind === "note") return `${selectedText("pisell2.sale-cart.line-item.note", locale)}: ${line.label}`;
30
33
  return line.label;
31
34
  }
@@ -37,34 +40,40 @@ function formatOptionalMoney(value, symbol, amountFormatter) {
37
40
  function formatQuantity(quantity) {
38
41
  return quantity ? `×${quantity}` : "—";
39
42
  }
40
- function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, secondaryLocale, secondaryRows }) {
43
+ function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, secondaryLocale, secondaryRows, config }) {
41
44
  var _amountFormatter2;
42
45
  const text = (key) => bilingualText(selectedText(key, locale), secondaryLocale ? selectedText(key, secondaryLocale) : void 0);
46
+ const visible = (field) => !config || isInvoiceFieldVisible(config, field);
47
+ const showBasePrice = visible("base_price");
48
+ const rowIsVisible = (row) => (row.kind !== "note" || visible("item_note")) && (row.kind !== "allergy" || visible("allergies"));
49
+ const lineStyle = showBasePrice ? void 0 : { gridTemplateColumns: "minmax(0, 1.8fr) minmax(24px, 0.4fr) minmax(0, 1fr)" };
43
50
  const labels = COLUMN_LABELS.map(text);
44
- const translatedLines = pairReceiptEntries(rows, secondaryRows || [], (row) => row.key);
51
+ const translatedLines = pairReceiptEntries(rows.filter(rowIsVisible), (secondaryRows || []).filter(rowIsVisible), (row) => row.key);
45
52
  return /* @__PURE__ */ React.createElement("div", {
46
53
  className: `${PREFIX}__line-list`,
47
54
  role: "table"
48
55
  }, /* @__PURE__ */ React.createElement("div", {
49
56
  className: `${PREFIX}__line-row ${PREFIX}__line-row--head`,
50
- role: "row"
51
- }, COLUMN_LABELS.map((key) => /* @__PURE__ */ React.createElement("div", {
57
+ role: "row",
58
+ style: lineStyle
59
+ }, COLUMN_LABELS.filter((_, index) => showBasePrice || index !== 1).map((key) => /* @__PURE__ */ React.createElement("div", {
52
60
  className: `${PREFIX}__line-head-cell`,
53
61
  key,
54
62
  role: "columnheader"
55
63
  }, text(key)))), translatedLines.map(({ primary: line, secondary: translatedLine }) => /* @__PURE__ */ React.createElement("div", {
56
64
  className: `${PREFIX}__line-row ${PREFIX}__line-row--${line.kind}`,
57
65
  key: line.key,
58
- role: "row"
66
+ role: "row",
67
+ style: lineStyle
59
68
  }, /* @__PURE__ */ React.createElement("div", {
60
69
  className: `${PREFIX}__line-cell ${PREFIX}__line-cell--name`,
61
70
  "data-label": labels[0],
62
71
  role: "cell"
63
- }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[0]), /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__line-name` }, bilingualText(getLineLabel(line, locale) || selectedText("pisell2.sale-detail.item", locale), secondaryLocale && translatedLine ? getLineLabel(translatedLine, secondaryLocale) : void 0))), /* @__PURE__ */ React.createElement("div", {
72
+ }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[0]), /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__line-name` }, bilingualText(getLineLabel(line, locale) || selectedText("pisell2.sale-detail.item", locale), secondaryLocale && translatedLine ? getLineLabel(translatedLine, secondaryLocale) : void 0))), showBasePrice ? /* @__PURE__ */ React.createElement("div", {
64
73
  className: `${PREFIX}__line-cell ${PREFIX}__line-cell--amount`,
65
74
  "data-label": labels[1],
66
75
  role: "cell"
67
- }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[1]), /* @__PURE__ */ React.createElement("span", null, formatOptionalMoney(line.unitPrice, symbol, amountFormatter))), /* @__PURE__ */ React.createElement("div", {
76
+ }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[1]), /* @__PURE__ */ React.createElement("span", null, formatOptionalMoney(line.unitPrice, symbol, amountFormatter))) : null, /* @__PURE__ */ React.createElement("div", {
68
77
  className: `${PREFIX}__line-cell ${PREFIX}__line-cell--quantity`,
69
78
  "data-label": labels[2],
70
79
  role: "cell"
@@ -72,7 +81,11 @@ function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, seco
72
81
  className: `${PREFIX}__line-cell ${PREFIX}__line-cell--amount ${PREFIX}__line-cell--total`,
73
82
  "data-label": labels[3],
74
83
  role: "cell"
75
- }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[3]), /* @__PURE__ */ React.createElement("span", null, formatOptionalMoney(line.amount, symbol, amountFormatter))))), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__subtotal-row` }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__subtotal-label` }, text("pisell2.sale-detail.subtotal")), /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__subtotal-value` }, (_amountFormatter2 = amountFormatter === null || amountFormatter === void 0 ? void 0 : amountFormatter(subtotal)) !== null && _amountFormatter2 !== void 0 ? _amountFormatter2 : formatMoney(subtotal, symbol))));
84
+ }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[3]), /* @__PURE__ */ React.createElement("span", null, !showBasePrice && [
85
+ "product",
86
+ "bundle",
87
+ "add-time"
88
+ ].includes(line.kind) ? null : formatOptionalMoney(line.amount, symbol, amountFormatter))))), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__subtotal-row` }, /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__subtotal-label` }, text("pisell2.sale-detail.subtotal")), /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}__subtotal-value` }, (_amountFormatter2 = amountFormatter === null || amountFormatter === void 0 ? void 0 : amountFormatter(subtotal)) !== null && _amountFormatter2 !== void 0 ? _amountFormatter2 : formatMoney(subtotal, symbol))));
76
89
  }
77
90
  function InvoiceBookingMetaRows({ card }) {
78
91
  const rows = [{
@@ -2,8 +2,8 @@ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/hel
2
2
  import { formatTempOrderSettlementAmount } from "../multiCurrencySettlement/index.js";
3
3
  import { mergeTranslatedRows, pairReceiptEntries } from "./receiptTranslations.js";
4
4
  import { InvoiceReceiptRenderer, ReceiptRows, bookingHeadersAreVisible, bookingMetaRows } from "./ReceiptRenderer.js";
5
- import { InvoiceLineList } from "./VirtualCurrencyLines.js";
6
5
  import { buildInvoiceOpenItemCard, buildInvoiceProductLineItems, isVisibleInvoiceProductItem } from "../saleDetail/tmpl/B/components/Invoice/utils.js";
6
+ import { InvoiceLineList } from "./VirtualCurrencyLines.js";
7
7
  import React, { forwardRef } from "react";
8
8
  //#region src/plus/invoice/VirtualCurrencyReceiptRenderer.tsx
9
9
  function localizedRawProduct(raw, translated, isBundle = false) {
@@ -52,12 +52,18 @@ function localizedCard(products, source, receipt) {
52
52
  const localized = localizedRawProduct(sourceProduct(source, product, receipt), product);
53
53
  if (!isVisibleInvoiceProductItem(localized)) return [];
54
54
  const prefix = `${product.receipt_key || product.product_uid || receipt.products.indexOf(product)}/`;
55
- return buildInvoiceProductLineItems(localized, prefix).map((row) => _objectSpread2(_objectSpread2({}, row), {}, { key: row.kind === "variant" ? `${prefix}variant` : row.key }));
55
+ const lines = buildInvoiceProductLineItems(localized, prefix).map((row) => _objectSpread2(_objectSpread2({}, row), {}, { key: row.kind === "variant" ? `${prefix}variant` : row.key }));
56
+ if (product.allergy) lines.push({
57
+ key: `${prefix}allergy`,
58
+ kind: "allergy",
59
+ label: String(product.allergy)
60
+ });
61
+ return lines;
56
62
  });
57
63
  return _objectSpread2(_objectSpread2({}, card), {}, { rows });
58
64
  }
59
65
  /** Preserve the virtual-currency arithmetic and formatter used by POS. */
60
- const VirtualCurrencyReceiptRenderer = forwardRef(function VirtualCurrencyReceiptRenderer({ receipt, source, currencySymbol }, ref) {
66
+ const VirtualCurrencyReceiptRenderer = forwardRef(function VirtualCurrencyReceiptRenderer({ receipt, source, currencySymbol, moduleOverrides }, ref) {
61
67
  const format = (value) => formatTempOrderSettlementAmount(source, value);
62
68
  const symbol = String(source.currency_symbol || currencySymbol || "$");
63
69
  const escaped = symbol.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -98,14 +104,13 @@ const VirtualCurrencyReceiptRenderer = forwardRef(function VirtualCurrencyReceip
98
104
  products: secondary.products,
99
105
  resources: []
100
106
  }] : [];
101
- return /* @__PURE__ */ React.createElement("section", { className: "pisell-order-invoice__virtual-lines" }, /* @__PURE__ */ React.createElement(ReceiptRows, {
102
- locale: receipt.locale,
103
- rows: tableRows
104
- }), pairReceiptEntries(groups, translatedGroups, (group) => group.key).map(({ primary: group, secondary: translated }) => {
107
+ const visibleTableRows = showBooking ? tableRows : [];
108
+ const renderedGroups = pairReceiptEntries(groups, translatedGroups, (group) => group.key).map(({ primary: group, secondary: translated }) => {
105
109
  const card = localizedCard(group.products, products, receipt);
106
110
  const translatedCard = translated && secondary ? localizedCard(translated.products, products, secondary) : void 0;
107
111
  const primaryMeta = group.appointmentRows || bookingMetaRows(group, receipt.locale);
108
112
  const metaRows = translated && secondary ? mergeTranslatedRows(primaryMeta, translated.appointmentRows || bookingMetaRows(translated, secondary.locale), receipt.locale, secondary.locale) : primaryMeta;
113
+ if (!card && !metaRows.length) return null;
109
114
  return /* @__PURE__ */ React.createElement("section", { key: group.key }, /* @__PURE__ */ React.createElement(ReceiptRows, {
110
115
  locale: receipt.locale,
111
116
  rows: metaRows
@@ -116,13 +121,19 @@ const VirtualCurrencyReceiptRenderer = forwardRef(function VirtualCurrencyReceip
116
121
  secondaryLocale: secondary === null || secondary === void 0 ? void 0 : secondary.locale,
117
122
  subtotal: card.subtotal,
118
123
  symbol,
119
- amountFormatter: format
124
+ amountFormatter: format,
125
+ config
120
126
  }) : null);
121
- }));
127
+ }).filter(Boolean);
128
+ if (!visibleTableRows.length && !renderedGroups.length) return null;
129
+ return /* @__PURE__ */ React.createElement("section", { className: "pisell-order-invoice__virtual-lines" }, /* @__PURE__ */ React.createElement(ReceiptRows, {
130
+ locale: receipt.locale,
131
+ rows: visibleTableRows
132
+ }), renderedGroups);
122
133
  };
123
134
  return /* @__PURE__ */ React.createElement(InvoiceReceiptRenderer, {
124
135
  receipt: view,
125
- moduleOverrides: { line_groups: lines },
136
+ moduleOverrides: _objectSpread2({ line_groups: lines }, moduleOverrides),
126
137
  ref
127
138
  });
128
139
  });
@@ -0,0 +1,94 @@
1
+ //#region src/plus/invoice/invoiceVisibility.ts
2
+ function record(value) {
3
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
4
+ }
5
+ /** The template protocol accepts booleans and numeric switches only. */
6
+ function invoiceVisibility(value, fallback = true) {
7
+ if (value === 0 || value === false) return false;
8
+ if (value === 1 || value === true) return true;
9
+ return fallback;
10
+ }
11
+ function invoiceModules(settings) {
12
+ if (Array.isArray(settings)) return settings.filter(record);
13
+ const config = record(settings);
14
+ if (!config) return [];
15
+ if (config.template_settings) return invoiceModules(config.template_settings);
16
+ return invoiceModules(config.modules || config.module || []);
17
+ }
18
+ function isInvoiceModuleVisible(config) {
19
+ return invoiceVisibility(config.is_show);
20
+ }
21
+ function isInvoiceFieldVisible(config, field) {
22
+ var _record;
23
+ return invoiceVisibility((_record = record(config[field])) === null || _record === void 0 ? void 0 : _record.is_show);
24
+ }
25
+ const DETAIL_FIELDS = {
26
+ brand: [
27
+ "logo",
28
+ "phone",
29
+ "address",
30
+ "abn",
31
+ "store_name",
32
+ "tax_invoice"
33
+ ],
34
+ board: [
35
+ "logo",
36
+ "phone",
37
+ "address",
38
+ "abn",
39
+ "store_name",
40
+ "tax_invoice"
41
+ ],
42
+ order: [
43
+ "order_time",
44
+ "last_updated",
45
+ "print_time",
46
+ "payment_status",
47
+ "note"
48
+ ],
49
+ handover: ["method", "fulfillment_time"],
50
+ customer: [
51
+ "name",
52
+ "email",
53
+ "phone"
54
+ ],
55
+ line_groups: [
56
+ "booking",
57
+ "item_note",
58
+ "allergies",
59
+ "base_price"
60
+ ],
61
+ settlement: ["original_amount", "item_discounts"],
62
+ total_savings: ["description"]
63
+ };
64
+ /** Select the shared virtual-currency view only for the new detail protocol. */
65
+ function hasInvoiceDetailSettings(settings) {
66
+ return invoiceModules(settings).some((module) => module.key === "card" ? Object.prototype.hasOwnProperty.call(module, "pass_type") : (DETAIL_FIELDS[module.key] || []).some((field) => {
67
+ const child = record(module[field]);
68
+ return child && Object.prototype.hasOwnProperty.call(child, "is_show");
69
+ }));
70
+ }
71
+ function cardRequiresFiltering(config) {
72
+ return Boolean(config && (!isInvoiceModuleVisible(config) || Array.isArray(config.pass_type) && config.pass_type.length > 0));
73
+ }
74
+ /** A filtered empty result is authoritative; tickets must not restore it. */
75
+ function permitsLegacyWalletFallback(settings) {
76
+ return !cardRequiresFiltering(invoiceModules(settings).find((module) => module.key === "card"));
77
+ }
78
+ /** Data-owned rows require an OS snapshot built from this exact template. */
79
+ function requiresInvoiceDataFiltering(settings) {
80
+ const modules = invoiceModules(settings);
81
+ return [
82
+ "handover",
83
+ "customer",
84
+ "card"
85
+ ].some((key) => {
86
+ const config = modules.find((module) => module.key === key);
87
+ if (!config) return false;
88
+ if (!isInvoiceModuleVisible(config)) return true;
89
+ if (key === "card") return cardRequiresFiltering(config);
90
+ return (DETAIL_FIELDS[key] || []).some((field) => !isInvoiceFieldVisible(config, field));
91
+ });
92
+ }
93
+ //#endregion
94
+ export { hasInvoiceDetailSettings, invoiceVisibility, isInvoiceFieldVisible, isInvoiceModuleVisible, permitsLegacyWalletFallback, requiresInvoiceDataFiltering };
@@ -1,5 +1,6 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
3
+ import { invoiceVisibility, permitsLegacyWalletFallback } from "./invoiceVisibility.js";
3
4
  import dayjs from "dayjs";
4
5
  import Decimal from "decimal.js";
5
6
  //#region src/plus/invoice/receipt.ts
@@ -871,14 +872,14 @@ function buildInvoiceReceiptViewModel(params) {
871
872
  taxNumberLabel: text(taxNumberLabel) || void 0,
872
873
  totalSavings: !isZeroMoney((_data$fees5 = data.fees) === null || _data$fees5 === void 0 || (_data$fees5 = _data$fees5.countFee) === null || _data$fees5 === void 0 ? void 0 : _data$fees5.order_total_discount) ? text((_data$fees6 = data.fees) === null || _data$fees6 === void 0 || (_data$fees6 = _data$fees6.countFee) === null || _data$fees6 === void 0 ? void 0 : _data$fees6.order_total_discount) : void 0,
873
874
  totalSavingsDescription: !isZeroMoney((_data$fees7 = data.fees) === null || _data$fees7 === void 0 || (_data$fees7 = _data$fees7.countFee) === null || _data$fees7 === void 0 ? void 0 : _data$fees7.order_total_discount) ? getReceiptLabel(locale, "Total Savings include any Promotional and Loyalty Discounts.") : void 0,
874
- walletRows: rowGroups(data.wallets).length ? rowGroups(data.wallets) : rowGroups(data.tickets)
875
+ walletRows: rowGroups(data.wallets).length ? rowGroups(data.wallets) : permitsLegacyWalletFallback(layout) ? rowGroups(data.tickets) : []
875
876
  };
876
877
  }
877
878
  function getModuleText(module, locale = "en") {
878
879
  var _ref4, _ref5, _module$text, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _configuredValue$loca;
879
880
  const value = (_ref4 = (_ref5 = (_module$text = module.text) !== null && _module$text !== void 0 ? _module$text : module.content) !== null && _ref5 !== void 0 ? _ref5 : module.value) !== null && _ref4 !== void 0 ? _ref4 : module.title;
880
881
  if (!isRecord(value)) return text(value);
881
- if (value.is_show === 0) return "";
882
+ if (!invoiceVisibility(value.is_show)) return "";
882
883
  const configuredValue = "value" in value ? value.value : value;
883
884
  if (!isRecord(configuredValue)) return text(configuredValue);
884
885
  const dashed = locale.replace(/_/g, "-");
@@ -888,7 +889,7 @@ function getModuleText(module, locale = "en") {
888
889
  function getModuleImage(module) {
889
890
  if (typeof module.img === "string") return text(module.img);
890
891
  if (typeof module.image === "string") return text(module.image);
891
- if (!isRecord(module.image) || module.image.is_show === 0) return "";
892
+ if (!isRecord(module.image) || !invoiceVisibility(module.image.is_show)) return "";
892
893
  return text(module.image.value);
893
894
  }
894
895
  //#endregion