@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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.js +14 -14
- package/es/components/HDLKiosk/ui/entry/Screen/assets/PHOSPHOR-LICENSE +21 -21
- package/es/plus/invoice/ReceiptRenderer.js +86 -42
- package/es/plus/invoice/VirtualCurrencyLines.js +21 -8
- package/es/plus/invoice/VirtualCurrencyReceiptRenderer.js +21 -10
- package/es/plus/invoice/invoiceVisibility.js +94 -0
- package/es/plus/invoice/receipt.js +4 -3
- package/es/plus/piPaymentUI/eftpos/logger.js +10 -7
- package/es/plus/piPaymentUI/sendWarningLog.js +33 -22
- package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
- package/es/plus/saleDetail/actions/index.js +11 -4
- package/es/plus/saleDetail/serve.js +7 -8
- package/es/plus/saleDetail/tmpl/B/components/Invoice/VirtualCurrencyInvoice.js +1 -1
- package/es/plus/saleDetail/tmpl/B/components/Invoice/index.js +29 -5
- package/es/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +85 -43
- package/es/plus/salesSdk/context/SalesSdkCartContext.js +5 -1
- package/es/plus/salesSdk/context/SalesSdkProvider.js +3 -0
- package/es/plus/salesSdk/utils/receiptPrintWarning.js +16 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- package/lib/components/HDLKiosk/ui/entry/Screen/assets/PHOSPHOR-LICENSE +21 -21
- package/lib/plus/invoice/ReceiptRenderer.js +86 -42
- package/lib/plus/invoice/VirtualCurrencyLines.js +21 -8
- package/lib/plus/invoice/VirtualCurrencyReceiptRenderer.js +21 -10
- package/lib/plus/invoice/invoiceVisibility.js +99 -0
- package/lib/plus/invoice/receipt.js +4 -3
- package/lib/plus/piPaymentUI/eftpos/logger.js +10 -7
- package/lib/plus/piPaymentUI/sendWarningLog.js +32 -20
- package/lib/plus/saleDetail/actions/index.js +11 -4
- package/lib/plus/saleDetail/serve.js +7 -8
- package/lib/plus/saleDetail/tmpl/B/components/Invoice/VirtualCurrencyInvoice.js +1 -1
- package/lib/plus/saleDetail/tmpl/B/components/Invoice/index.js +29 -5
- package/lib/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +85 -43
- package/lib/plus/salesSdk/context/SalesSdkCartContext.js +5 -1
- package/lib/plus/salesSdk/context/SalesSdkProvider.js +3 -0
- package/lib/plus/salesSdk/utils/receiptPrintWarning.js +16 -0
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
3
|
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
|
|
4
|
+
const require_invoiceVisibility = require("./invoiceVisibility.js");
|
|
4
5
|
const require_receipt = require("./receipt.js");
|
|
5
6
|
const require_receiptTranslations = require("./receiptTranslations.js");
|
|
6
7
|
let dayjs = require("dayjs");
|
|
@@ -22,6 +23,7 @@ function ReceiptSeparator() {
|
|
|
22
23
|
}, RECEIPT_SEPARATOR_TEXT);
|
|
23
24
|
}
|
|
24
25
|
function ReceiptRows({ locale, rows }) {
|
|
26
|
+
if (!rows.length) return null;
|
|
25
27
|
return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-rows` }, rows.map((row, index) => {
|
|
26
28
|
const singleValue = !row.item || !row.value;
|
|
27
29
|
const alignment = row.align || (singleValue ? "left" : "");
|
|
@@ -34,11 +36,11 @@ function ReceiptRows({ locale, rows }) {
|
|
|
34
36
|
function ReceiptSectionTitle({ children }) {
|
|
35
37
|
return /* @__PURE__ */ react.default.createElement("h3", { className: `${PREFIX}__receipt-section-title` }, children);
|
|
36
38
|
}
|
|
37
|
-
function PaymentNotice({ receipt }) {
|
|
39
|
+
function PaymentNotice({ receipt, separated = true }) {
|
|
38
40
|
var _receipt$secondary;
|
|
39
41
|
const notice = receipt.paymentNotice;
|
|
40
42
|
if (!notice) return null;
|
|
41
|
-
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(ReceiptSeparator, null), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-payment-notice` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-payment-notice-title` }, require_receiptTranslations.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.default.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.default.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.default.createElement("strong", null, label("Balance Due", receipt.locale), ": ", notice.due, ".", receipt.secondary ? /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Balance Due", receipt.secondary.locale)) : null) : null));
|
|
43
|
+
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, separated ? /* @__PURE__ */ react.default.createElement(ReceiptSeparator, null) : null, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-payment-notice` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-payment-notice-title` }, require_receiptTranslations.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.default.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.default.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.default.createElement("strong", null, label("Balance Due", receipt.locale), ": ", notice.due, ".", receipt.secondary ? /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__receipt-translation` }, label("Balance Due", receipt.secondary.locale)) : null) : null));
|
|
42
44
|
}
|
|
43
45
|
function getOptionTitle(option) {
|
|
44
46
|
return String(option.name || option.title || option.product_title || "");
|
|
@@ -130,8 +132,9 @@ function buildOptionRows(options, quantity, indent, showUnitPrice = true) {
|
|
|
130
132
|
function isDiscountExtension(row) {
|
|
131
133
|
return /^\s*-/.test(String(row.value || ""));
|
|
132
134
|
}
|
|
133
|
-
function buildProductDetailRows(product, quantity, locale, indent, scaleCombinationQuantity = true, showUnitPrice = true) {
|
|
135
|
+
function buildProductDetailRows(product, quantity, locale, indent, scaleCombinationQuantity = true, showUnitPrice = true, config) {
|
|
134
136
|
var _product$base_price, _product$product_note;
|
|
137
|
+
const visible = (field) => !config || require_invoiceVisibility.isInvoiceFieldVisible(config, field);
|
|
135
138
|
const options = Array.isArray(product.options) ? product.options : Array.isArray(product.combinations_options) ? product.combinations_options : [];
|
|
136
139
|
const combinations = Array.isArray(product.combinations) ? product.combinations : Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
137
140
|
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) || ""))) : [];
|
|
@@ -150,19 +153,19 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
|
|
|
150
153
|
const note = formatProductNote((_product$product_note = product.product_note) !== null && _product$product_note !== void 0 ? _product$product_note : product.note, locale);
|
|
151
154
|
const allergy = formatProductAllergy(product.allergy, locale);
|
|
152
155
|
const rows = [];
|
|
153
|
-
if (allergy) rows.push({
|
|
156
|
+
if (allergy && visible("allergies")) rows.push({
|
|
154
157
|
receipt_key: `${product.receipt_key}/allergy`,
|
|
155
158
|
item: allergy,
|
|
156
159
|
value: "",
|
|
157
160
|
indent
|
|
158
161
|
});
|
|
159
|
-
if (note) rows.push({
|
|
162
|
+
if (note && visible("item_note")) rows.push({
|
|
160
163
|
receipt_key: `${product.receipt_key}/note`,
|
|
161
164
|
item: note,
|
|
162
165
|
value: "",
|
|
163
166
|
indent
|
|
164
167
|
});
|
|
165
|
-
if (showBasePrice) rows.push({
|
|
168
|
+
if (showBasePrice && visible("base_price")) rows.push({
|
|
166
169
|
receipt_key: `${product.receipt_key}/Base price`,
|
|
167
170
|
item: label("Base price", locale),
|
|
168
171
|
value: authoritativeBasePrice || require_receipt.subtractReceiptMoney(originalTotal, optionTotal ? [optionTotal] : []),
|
|
@@ -193,7 +196,7 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
|
|
|
193
196
|
value: combinationTotals[index],
|
|
194
197
|
indent: indent + 1
|
|
195
198
|
});
|
|
196
|
-
rows.push(...buildProductDetailRows(combination, combinationQuantity, locale, indent + 2, true, showUnitPrice));
|
|
199
|
+
rows.push(...buildProductDetailRows(combination, combinationQuantity, locale, indent + 2, true, showUnitPrice, config));
|
|
197
200
|
});
|
|
198
201
|
}
|
|
199
202
|
rows.push(...otherExtensionRows.map((row) => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, row), {}, { indent })));
|
|
@@ -203,11 +206,11 @@ function buildProductDetailRows(product, quantity, locale, indent, scaleCombinat
|
|
|
203
206
|
})));
|
|
204
207
|
return rows;
|
|
205
208
|
}
|
|
206
|
-
function ProductDetails({ locale, product, secondaryLocale }) {
|
|
209
|
+
function ProductDetails({ locale, product, secondaryLocale, config }) {
|
|
207
210
|
const quantity = Number(product.product_quantity || 1);
|
|
208
211
|
const productTotal = require_receipt.getReceiptProductTotal(product);
|
|
209
|
-
const primaryRows = buildProductDetailRows(product, quantity, locale, 1, false);
|
|
210
|
-
const detailRows = secondaryLocale && product.secondary ? require_receiptTranslations.mergeTranslatedRows(primaryRows, buildProductDetailRows(product.secondary, quantity, secondaryLocale, 1, false, false), locale, secondaryLocale, true) : primaryRows;
|
|
212
|
+
const primaryRows = buildProductDetailRows(product, quantity, locale, 1, false, true, config);
|
|
213
|
+
const detailRows = secondaryLocale && product.secondary ? require_receiptTranslations.mergeTranslatedRows(primaryRows, buildProductDetailRows(product.secondary, quantity, secondaryLocale, 1, false, false, config), locale, secondaryLocale, true) : primaryRows;
|
|
211
214
|
return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-product` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-product-main` }, /* @__PURE__ */ react.default.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.default.createElement("span", { className: `${PREFIX}__receipt-translation` }, productDisplayTitle(product.secondary)) : null), /* @__PURE__ */ react.default.createElement("strong", null, productTotal)), detailRows.map((row, index) => /* @__PURE__ */ react.default.createElement("div", {
|
|
212
215
|
className: `${PREFIX}__receipt-product-detail`,
|
|
213
216
|
key: `${row.item}-${row.value}-${index}`,
|
|
@@ -255,16 +258,21 @@ function bookingMetaRows(group, locale) {
|
|
|
255
258
|
}
|
|
256
259
|
].filter((row) => row.value);
|
|
257
260
|
}
|
|
258
|
-
function
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
function lineGroupMetaRows(group, locale, secondaryLocale) {
|
|
262
|
+
return secondaryLocale && group.secondary ? require_receiptTranslations.mergeTranslatedRows(group.appointmentRows || bookingMetaRows(group, locale), group.secondary.appointmentRows || bookingMetaRows(group.secondary, secondaryLocale), locale, secondaryLocale) : group.appointmentRows || bookingMetaRows(group, locale);
|
|
263
|
+
}
|
|
264
|
+
function LineGroup({ group, locale, secondaryLocale, config }) {
|
|
265
|
+
const metaRows = lineGroupMetaRows(group, locale, secondaryLocale);
|
|
266
|
+
if (!metaRows.length && !group.products.length) return null;
|
|
267
|
+
return /* @__PURE__ */ react.default.createElement("section", { className: `${PREFIX}__receipt-line-group` }, metaRows.length ? /* @__PURE__ */ react.default.createElement("h4", null, require_receiptTranslations.bilingualText(label("Booking", locale), secondaryLocale && label("Booking", secondaryLocale))) : null, /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
261
268
|
locale,
|
|
262
|
-
rows:
|
|
269
|
+
rows: metaRows
|
|
263
270
|
}), group.products.map((product, productIndex) => /* @__PURE__ */ react.default.createElement(ProductDetails, {
|
|
264
271
|
key: `${product.product_uid || product.booking_uid || "product"}-${productIndex}`,
|
|
265
272
|
locale,
|
|
266
273
|
product,
|
|
267
|
-
secondaryLocale
|
|
274
|
+
secondaryLocale,
|
|
275
|
+
config
|
|
268
276
|
})));
|
|
269
277
|
}
|
|
270
278
|
function RecordGroups({ groups, locale }) {
|
|
@@ -277,21 +285,48 @@ function RecordGroups({ groups, locale }) {
|
|
|
277
285
|
}))));
|
|
278
286
|
}
|
|
279
287
|
function bookingHeadersAreVisible(config) {
|
|
280
|
-
|
|
281
|
-
if (!booking || typeof booking !== "object" || Array.isArray(booking)) return true;
|
|
282
|
-
const value = booking.is_show;
|
|
283
|
-
if (value === false || value === 0) return false;
|
|
284
|
-
const normalized = String(value !== null && value !== void 0 ? value : "").trim().toLowerCase();
|
|
285
|
-
return normalized !== "0" && normalized !== "false";
|
|
288
|
+
return require_invoiceVisibility.isInvoiceFieldVisible(config, "booking");
|
|
286
289
|
}
|
|
287
|
-
const renderBrand = ({ receipt }) => {
|
|
290
|
+
const renderBrand = ({ config, receipt }) => {
|
|
288
291
|
var _receipt$secondary2, _receipt$secondary3;
|
|
289
292
|
const base = receipt.baseData;
|
|
290
|
-
|
|
291
|
-
|
|
293
|
+
const show = (field) => require_invoiceVisibility.isInvoiceFieldVisible(config, field);
|
|
294
|
+
const logo = show("logo") && receipt.brandLogo;
|
|
295
|
+
const name = show("store_name") && base.shop_name;
|
|
296
|
+
const taxNumber = show("abn") && base.shop_tax_number;
|
|
297
|
+
const address = show("address") && base.shop_address;
|
|
298
|
+
const phone = show("phone") && base.shop_phone;
|
|
299
|
+
const title = show("tax_invoice") && Boolean(receipt.brandLogo || base.shop_name || base.shop_tax_number || base.shop_address || base.shop_phone);
|
|
300
|
+
if (!logo && !name && !taxNumber && !address && !phone && !title) return null;
|
|
301
|
+
return /* @__PURE__ */ react.default.createElement("section", { className: `${PREFIX}__receipt-brand` }, logo ? /* @__PURE__ */ react.default.createElement("img", {
|
|
292
302
|
alt: "",
|
|
293
303
|
src: receipt.brandLogo
|
|
294
|
-
}) : null,
|
|
304
|
+
}) : null, name ? /* @__PURE__ */ react.default.createElement("h2", null, require_receiptTranslations.bilingualText(base.shop_name, (_receipt$secondary2 = receipt.secondary) === null || _receipt$secondary2 === void 0 ? void 0 : _receipt$secondary2.baseData.shop_name)) : null, taxNumber ? /* @__PURE__ */ react.default.createElement("div", null, receipt.taxNumberLabel ? `${receipt.taxNumberLabel}: ` : "", base.shop_tax_number) : null, address ? /* @__PURE__ */ react.default.createElement("div", null, require_receiptTranslations.bilingualText(base.shop_address, (_receipt$secondary3 = receipt.secondary) === null || _receipt$secondary3 === void 0 ? void 0 : _receipt$secondary3.baseData.shop_address)) : null, phone ? /* @__PURE__ */ react.default.createElement("div", null, base.shop_phone) : null, title ? /* @__PURE__ */ react.default.createElement("strong", { className: `${PREFIX}__receipt-bill-title` }, require_receiptTranslations.receiptLabel(receipt, receipt.billTitle)) : null);
|
|
305
|
+
};
|
|
306
|
+
/** Stable row keys survive translation; localized labels are never selectors. */
|
|
307
|
+
function visibleSemanticRows(rows, config, fields) {
|
|
308
|
+
return rows.filter((row) => {
|
|
309
|
+
var _row$receipt_key;
|
|
310
|
+
const key = ((_row$receipt_key = row.receipt_key) === null || _row$receipt_key === void 0 ? void 0 : _row$receipt_key.replace(/\/secondary$/, "")) || "";
|
|
311
|
+
return !fields[key] || require_invoiceVisibility.isInvoiceFieldVisible(config, fields[key]);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
const renderOrder = ({ config, receipt }) => {
|
|
315
|
+
const rows = visibleSemanticRows(receipt.orderRows, config, {
|
|
316
|
+
"order/Order time": "order_time",
|
|
317
|
+
"order/Last updated": "last_updated",
|
|
318
|
+
"order/Print time": "print_time"
|
|
319
|
+
});
|
|
320
|
+
const note = require_invoiceVisibility.isInvoiceFieldVisible(config, "note") && receipt.orderNote;
|
|
321
|
+
const notice = require_invoiceVisibility.isInvoiceFieldVisible(config, "payment_status") && receipt.paymentNotice;
|
|
322
|
+
if (!rows.length && !note && !notice) return null;
|
|
323
|
+
return /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
324
|
+
locale: receipt.locale,
|
|
325
|
+
rows
|
|
326
|
+
}), note ? /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-order-note` }, label("Order note", receipt.locale), ": ", receipt.orderNote, receipt.secondary ? /* @__PURE__ */ react.default.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.default.createElement(PaymentNotice, {
|
|
327
|
+
receipt,
|
|
328
|
+
separated: Boolean(rows.length || note)
|
|
329
|
+
}) : null);
|
|
295
330
|
};
|
|
296
331
|
const renderCustom = ({ config, receipt }) => {
|
|
297
332
|
var _receipt$secondary4;
|
|
@@ -302,10 +337,7 @@ const MODULE_RENDERERS = {
|
|
|
302
337
|
brand: renderBrand,
|
|
303
338
|
board: renderBrand,
|
|
304
339
|
custom_1: renderCustom,
|
|
305
|
-
order:
|
|
306
|
-
locale: receipt.locale,
|
|
307
|
-
rows: receipt.orderRows
|
|
308
|
-
}), receipt.orderNote ? /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-order-note` }, label("Order note", receipt.locale), ": ", receipt.orderNote, receipt.secondary ? /* @__PURE__ */ react.default.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.default.createElement(PaymentNotice, { receipt })) : null,
|
|
340
|
+
order: renderOrder,
|
|
309
341
|
handover: ({ receipt }) => receipt.deliveryRows.length ? /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
310
342
|
locale: receipt.locale,
|
|
311
343
|
rows: receipt.deliveryRows
|
|
@@ -315,28 +347,40 @@ const MODULE_RENDERERS = {
|
|
|
315
347
|
rows: receipt.customerRows
|
|
316
348
|
})) : null,
|
|
317
349
|
line_groups: ({ config, receipt }) => {
|
|
318
|
-
const
|
|
350
|
+
const showBookingHeaders = bookingHeadersAreVisible(config);
|
|
351
|
+
const lineGroups = showBookingHeaders ? receipt.lineGroups.filter((group) => {
|
|
352
|
+
var _receipt$secondary5;
|
|
353
|
+
return group.products.length || lineGroupMetaRows(group, receipt.locale, (_receipt$secondary5 = receipt.secondary) === null || _receipt$secondary5 === void 0 ? void 0 : _receipt$secondary5.locale).length;
|
|
354
|
+
}) : receipt.products.length ? [{
|
|
319
355
|
key: "all-items",
|
|
320
356
|
products: receipt.products,
|
|
321
357
|
resources: []
|
|
322
358
|
}] : [];
|
|
323
|
-
|
|
359
|
+
const tableRows = showBookingHeaders ? receipt.tableRows : [];
|
|
360
|
+
return lineGroups.length || tableRows.length ? /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
324
361
|
locale: receipt.locale,
|
|
325
|
-
rows:
|
|
362
|
+
rows: tableRows
|
|
326
363
|
}), lineGroups.map((group) => {
|
|
327
|
-
var _receipt$
|
|
364
|
+
var _receipt$secondary6;
|
|
328
365
|
return /* @__PURE__ */ react.default.createElement(LineGroup, {
|
|
329
366
|
group,
|
|
330
367
|
key: group.key,
|
|
331
368
|
locale: receipt.locale,
|
|
332
|
-
secondaryLocale: (_receipt$
|
|
369
|
+
secondaryLocale: (_receipt$secondary6 = receipt.secondary) === null || _receipt$secondary6 === void 0 ? void 0 : _receipt$secondary6.locale,
|
|
370
|
+
config
|
|
333
371
|
});
|
|
334
372
|
})) : null;
|
|
335
373
|
},
|
|
336
|
-
settlement: ({ receipt }) =>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
374
|
+
settlement: ({ config, receipt }) => {
|
|
375
|
+
const rows = visibleSemanticRows(receipt.settlementRows, config, {
|
|
376
|
+
"settlement/original": "original_amount",
|
|
377
|
+
"settlement/item-discounts": "item_discounts"
|
|
378
|
+
});
|
|
379
|
+
return rows.length ? /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
380
|
+
locale: receipt.locale,
|
|
381
|
+
rows
|
|
382
|
+
})) : null;
|
|
383
|
+
},
|
|
340
384
|
custom_2: renderCustom,
|
|
341
385
|
customer_2: renderCustom,
|
|
342
386
|
payment: ({ receipt }) => receipt.paymentSummaryRows.length || receipt.paymentRows.length || receipt.refundRows.length ? /* @__PURE__ */ react.default.createElement("section", null, receipt.paymentSummaryRows.length ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(ReceiptSectionTitle, null, require_receiptTranslations.receiptLabel(receipt, "Payment summary")), /* @__PURE__ */ react.default.createElement(ReceiptRows, {
|
|
@@ -353,9 +397,9 @@ const MODULE_RENDERERS = {
|
|
|
353
397
|
groups: receipt.walletRows,
|
|
354
398
|
locale: receipt.locale
|
|
355
399
|
})) : null,
|
|
356
|
-
total_savings: ({ receipt }) => {
|
|
357
|
-
var _receipt$
|
|
358
|
-
return receipt.totalSavings ? /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-savings` }, /* @__PURE__ */ react.default.createElement("strong", null, require_receiptTranslations.receiptLabel(receipt, "Total Savings")), /* @__PURE__ */ react.default.createElement("strong", null, receipt.totalSavings)), receipt.totalSavingsDescription ? /* @__PURE__ */ react.default.createElement("p", { className: `${PREFIX}__receipt-savings-description` }, require_receiptTranslations.bilingualText(receipt.totalSavingsDescription, (_receipt$
|
|
400
|
+
total_savings: ({ config, receipt }) => {
|
|
401
|
+
var _receipt$secondary7;
|
|
402
|
+
return receipt.totalSavings ? /* @__PURE__ */ react.default.createElement("section", null, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__receipt-savings` }, /* @__PURE__ */ react.default.createElement("strong", null, require_receiptTranslations.receiptLabel(receipt, "Total Savings")), /* @__PURE__ */ react.default.createElement("strong", null, receipt.totalSavings)), require_invoiceVisibility.isInvoiceFieldVisible(config, "description") && receipt.totalSavingsDescription ? /* @__PURE__ */ react.default.createElement("p", { className: `${PREFIX}__receipt-savings-description` }, require_receiptTranslations.bilingualText(receipt.totalSavingsDescription, (_receipt$secondary7 = receipt.secondary) === null || _receipt$secondary7 === void 0 ? void 0 : _receipt$secondary7.totalSavingsDescription)) : null) : null;
|
|
359
403
|
},
|
|
360
404
|
custom_3: renderCustom,
|
|
361
405
|
barcode: ({ receipt }) => receipt.barcodeValue ? /* @__PURE__ */ react.default.createElement("section", { className: `${PREFIX}__receipt-barcode` }, /* @__PURE__ */ react.default.createElement(_pisell_materials.QRCode, {
|
|
@@ -384,7 +428,7 @@ const InvoiceReceiptPaper = (0, react.forwardRef)(function InvoiceReceiptPaper(_
|
|
|
384
428
|
const InvoiceReceiptRenderer = (0, react.forwardRef)(function InvoiceReceiptRenderer({ receipt: primaryReceipt, moduleOverrides }, ref) {
|
|
385
429
|
const receipt = require_receiptTranslations.withReceiptTranslations(primaryReceipt, primaryReceipt.secondary);
|
|
386
430
|
const renderedModules = receipt.layout.module.flatMap((module, index) => {
|
|
387
|
-
if (module
|
|
431
|
+
if (!require_invoiceVisibility.isInvoiceModuleVisible(module)) return [];
|
|
388
432
|
const Renderer = MODULE_RENDERERS[module.key];
|
|
389
433
|
const override = moduleOverrides === null || moduleOverrides === void 0 ? void 0 : moduleOverrides[module.key];
|
|
390
434
|
const content = moduleOverrides && Object.prototype.hasOwnProperty.call(moduleOverrides, module.key) ? typeof override === "function" ? override(module) : override : Renderer === null || Renderer === void 0 ? void 0 : Renderer({
|
|
@@ -2,6 +2,8 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
|
2
2
|
const require_locales = require("../saleDetail/locales.js");
|
|
3
3
|
const require_locales$1 = require("../saleDetail/components/LineItem/locales.js");
|
|
4
4
|
const require_render = require("../saleDetail/components/LineItem/utils/render.js");
|
|
5
|
+
const require_invoiceVisibility = require("./invoiceVisibility.js");
|
|
6
|
+
const require_receipt = require("./receipt.js");
|
|
5
7
|
const require_receiptTranslations = require("./receiptTranslations.js");
|
|
6
8
|
let react = require("react");
|
|
7
9
|
react = require_runtime.__toESM(react);
|
|
@@ -28,6 +30,7 @@ function selectedText(key, locale) {
|
|
|
28
30
|
return ((_language = require_locales.default[language]) === null || _language === void 0 ? void 0 : _language[key]) || ((_language2 = require_locales$1.default[language]) === null || _language2 === void 0 ? void 0 : _language2[key]) || require_locales.default.en[key] || key;
|
|
29
31
|
}
|
|
30
32
|
function getLineLabel(line, locale) {
|
|
33
|
+
if (line.kind === "allergy") return `${require_receipt.getReceiptLabel(locale || "en", "Allergies")}: ${line.label}`;
|
|
31
34
|
if (line.kind === "note") return `${selectedText("pisell2.sale-cart.line-item.note", locale)}: ${line.label}`;
|
|
32
35
|
return line.label;
|
|
33
36
|
}
|
|
@@ -39,34 +42,40 @@ function formatOptionalMoney(value, symbol, amountFormatter) {
|
|
|
39
42
|
function formatQuantity(quantity) {
|
|
40
43
|
return quantity ? `×${quantity}` : "—";
|
|
41
44
|
}
|
|
42
|
-
function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, secondaryLocale, secondaryRows }) {
|
|
45
|
+
function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, secondaryLocale, secondaryRows, config }) {
|
|
43
46
|
var _amountFormatter2;
|
|
44
47
|
const text = (key) => require_receiptTranslations.bilingualText(selectedText(key, locale), secondaryLocale ? selectedText(key, secondaryLocale) : void 0);
|
|
48
|
+
const visible = (field) => !config || require_invoiceVisibility.isInvoiceFieldVisible(config, field);
|
|
49
|
+
const showBasePrice = visible("base_price");
|
|
50
|
+
const rowIsVisible = (row) => (row.kind !== "note" || visible("item_note")) && (row.kind !== "allergy" || visible("allergies"));
|
|
51
|
+
const lineStyle = showBasePrice ? void 0 : { gridTemplateColumns: "minmax(0, 1.8fr) minmax(24px, 0.4fr) minmax(0, 1fr)" };
|
|
45
52
|
const labels = COLUMN_LABELS.map(text);
|
|
46
|
-
const translatedLines = require_receiptTranslations.pairReceiptEntries(rows, secondaryRows || [], (row) => row.key);
|
|
53
|
+
const translatedLines = require_receiptTranslations.pairReceiptEntries(rows.filter(rowIsVisible), (secondaryRows || []).filter(rowIsVisible), (row) => row.key);
|
|
47
54
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
48
55
|
className: `${PREFIX}__line-list`,
|
|
49
56
|
role: "table"
|
|
50
57
|
}, /* @__PURE__ */ react.default.createElement("div", {
|
|
51
58
|
className: `${PREFIX}__line-row ${PREFIX}__line-row--head`,
|
|
52
|
-
role: "row"
|
|
53
|
-
|
|
59
|
+
role: "row",
|
|
60
|
+
style: lineStyle
|
|
61
|
+
}, COLUMN_LABELS.filter((_, index) => showBasePrice || index !== 1).map((key) => /* @__PURE__ */ react.default.createElement("div", {
|
|
54
62
|
className: `${PREFIX}__line-head-cell`,
|
|
55
63
|
key,
|
|
56
64
|
role: "columnheader"
|
|
57
65
|
}, text(key)))), translatedLines.map(({ primary: line, secondary: translatedLine }) => /* @__PURE__ */ react.default.createElement("div", {
|
|
58
66
|
className: `${PREFIX}__line-row ${PREFIX}__line-row--${line.kind}`,
|
|
59
67
|
key: line.key,
|
|
60
|
-
role: "row"
|
|
68
|
+
role: "row",
|
|
69
|
+
style: lineStyle
|
|
61
70
|
}, /* @__PURE__ */ react.default.createElement("div", {
|
|
62
71
|
className: `${PREFIX}__line-cell ${PREFIX}__line-cell--name`,
|
|
63
72
|
"data-label": labels[0],
|
|
64
73
|
role: "cell"
|
|
65
|
-
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[0]), /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__line-name` }, require_receiptTranslations.bilingualText(getLineLabel(line, locale) || selectedText("pisell2.sale-detail.item", locale), secondaryLocale && translatedLine ? getLineLabel(translatedLine, secondaryLocale) : void 0))), /* @__PURE__ */ react.default.createElement("div", {
|
|
74
|
+
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[0]), /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__line-name` }, require_receiptTranslations.bilingualText(getLineLabel(line, locale) || selectedText("pisell2.sale-detail.item", locale), secondaryLocale && translatedLine ? getLineLabel(translatedLine, secondaryLocale) : void 0))), showBasePrice ? /* @__PURE__ */ react.default.createElement("div", {
|
|
66
75
|
className: `${PREFIX}__line-cell ${PREFIX}__line-cell--amount`,
|
|
67
76
|
"data-label": labels[1],
|
|
68
77
|
role: "cell"
|
|
69
|
-
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[1]), /* @__PURE__ */ react.default.createElement("span", null, formatOptionalMoney(line.unitPrice, symbol, amountFormatter))), /* @__PURE__ */ react.default.createElement("div", {
|
|
78
|
+
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[1]), /* @__PURE__ */ react.default.createElement("span", null, formatOptionalMoney(line.unitPrice, symbol, amountFormatter))) : null, /* @__PURE__ */ react.default.createElement("div", {
|
|
70
79
|
className: `${PREFIX}__line-cell ${PREFIX}__line-cell--quantity`,
|
|
71
80
|
"data-label": labels[2],
|
|
72
81
|
role: "cell"
|
|
@@ -74,7 +83,11 @@ function InvoiceLineList({ rows, subtotal, symbol, amountFormatter, locale, seco
|
|
|
74
83
|
className: `${PREFIX}__line-cell ${PREFIX}__line-cell--amount ${PREFIX}__line-cell--total`,
|
|
75
84
|
"data-label": labels[3],
|
|
76
85
|
role: "cell"
|
|
77
|
-
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[3]), /* @__PURE__ */ react.default.createElement("span", null,
|
|
86
|
+
}, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__mobile-label` }, labels[3]), /* @__PURE__ */ react.default.createElement("span", null, !showBasePrice && [
|
|
87
|
+
"product",
|
|
88
|
+
"bundle",
|
|
89
|
+
"add-time"
|
|
90
|
+
].includes(line.kind) ? null : formatOptionalMoney(line.amount, symbol, amountFormatter))))), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__subtotal-row` }, /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__subtotal-label` }, text("pisell2.sale-detail.subtotal")), /* @__PURE__ */ react.default.createElement("span", { className: `${PREFIX}__subtotal-value` }, (_amountFormatter2 = amountFormatter === null || amountFormatter === void 0 ? void 0 : amountFormatter(subtotal)) !== null && _amountFormatter2 !== void 0 ? _amountFormatter2 : require_render.formatMoney(subtotal, symbol))));
|
|
78
91
|
}
|
|
79
92
|
function InvoiceBookingMetaRows({ card }) {
|
|
80
93
|
const rows = [{
|
|
@@ -3,8 +3,8 @@ const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.12
|
|
|
3
3
|
const require_index = require("../multiCurrencySettlement/index.js");
|
|
4
4
|
const require_receiptTranslations = require("./receiptTranslations.js");
|
|
5
5
|
const require_ReceiptRenderer = require("./ReceiptRenderer.js");
|
|
6
|
-
const require_VirtualCurrencyLines = require("./VirtualCurrencyLines.js");
|
|
7
6
|
const require_utils = require("../saleDetail/tmpl/B/components/Invoice/utils.js");
|
|
7
|
+
const require_VirtualCurrencyLines = require("./VirtualCurrencyLines.js");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_runtime.__toESM(react);
|
|
10
10
|
//#region src/plus/invoice/VirtualCurrencyReceiptRenderer.tsx
|
|
@@ -54,12 +54,18 @@ function localizedCard(products, source, receipt) {
|
|
|
54
54
|
const localized = localizedRawProduct(sourceProduct(source, product, receipt), product);
|
|
55
55
|
if (!require_utils.isVisibleInvoiceProductItem(localized)) return [];
|
|
56
56
|
const prefix = `${product.receipt_key || product.product_uid || receipt.products.indexOf(product)}/`;
|
|
57
|
-
|
|
57
|
+
const lines = require_utils.buildInvoiceProductLineItems(localized, prefix).map((row) => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, row), {}, { key: row.kind === "variant" ? `${prefix}variant` : row.key }));
|
|
58
|
+
if (product.allergy) lines.push({
|
|
59
|
+
key: `${prefix}allergy`,
|
|
60
|
+
kind: "allergy",
|
|
61
|
+
label: String(product.allergy)
|
|
62
|
+
});
|
|
63
|
+
return lines;
|
|
58
64
|
});
|
|
59
65
|
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, card), {}, { rows });
|
|
60
66
|
}
|
|
61
67
|
/** Preserve the virtual-currency arithmetic and formatter used by POS. */
|
|
62
|
-
const VirtualCurrencyReceiptRenderer = (0, react.forwardRef)(function VirtualCurrencyReceiptRenderer({ receipt, source, currencySymbol }, ref) {
|
|
68
|
+
const VirtualCurrencyReceiptRenderer = (0, react.forwardRef)(function VirtualCurrencyReceiptRenderer({ receipt, source, currencySymbol, moduleOverrides }, ref) {
|
|
63
69
|
const format = (value) => require_index.formatTempOrderSettlementAmount(source, value);
|
|
64
70
|
const symbol = String(source.currency_symbol || currencySymbol || "$");
|
|
65
71
|
const escaped = symbol.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -100,14 +106,13 @@ const VirtualCurrencyReceiptRenderer = (0, react.forwardRef)(function VirtualCur
|
|
|
100
106
|
products: secondary.products,
|
|
101
107
|
resources: []
|
|
102
108
|
}] : [];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
rows: tableRows
|
|
106
|
-
}), require_receiptTranslations.pairReceiptEntries(groups, translatedGroups, (group) => group.key).map(({ primary: group, secondary: translated }) => {
|
|
109
|
+
const visibleTableRows = showBooking ? tableRows : [];
|
|
110
|
+
const renderedGroups = require_receiptTranslations.pairReceiptEntries(groups, translatedGroups, (group) => group.key).map(({ primary: group, secondary: translated }) => {
|
|
107
111
|
const card = localizedCard(group.products, products, receipt);
|
|
108
112
|
const translatedCard = translated && secondary ? localizedCard(translated.products, products, secondary) : void 0;
|
|
109
113
|
const primaryMeta = group.appointmentRows || require_ReceiptRenderer.bookingMetaRows(group, receipt.locale);
|
|
110
114
|
const metaRows = translated && secondary ? require_receiptTranslations.mergeTranslatedRows(primaryMeta, translated.appointmentRows || require_ReceiptRenderer.bookingMetaRows(translated, secondary.locale), receipt.locale, secondary.locale) : primaryMeta;
|
|
115
|
+
if (!card && !metaRows.length) return null;
|
|
111
116
|
return /* @__PURE__ */ react.default.createElement("section", { key: group.key }, /* @__PURE__ */ react.default.createElement(require_ReceiptRenderer.ReceiptRows, {
|
|
112
117
|
locale: receipt.locale,
|
|
113
118
|
rows: metaRows
|
|
@@ -118,13 +123,19 @@ const VirtualCurrencyReceiptRenderer = (0, react.forwardRef)(function VirtualCur
|
|
|
118
123
|
secondaryLocale: secondary === null || secondary === void 0 ? void 0 : secondary.locale,
|
|
119
124
|
subtotal: card.subtotal,
|
|
120
125
|
symbol,
|
|
121
|
-
amountFormatter: format
|
|
126
|
+
amountFormatter: format,
|
|
127
|
+
config
|
|
122
128
|
}) : null);
|
|
123
|
-
}));
|
|
129
|
+
}).filter(Boolean);
|
|
130
|
+
if (!visibleTableRows.length && !renderedGroups.length) return null;
|
|
131
|
+
return /* @__PURE__ */ react.default.createElement("section", { className: "pisell-order-invoice__virtual-lines" }, /* @__PURE__ */ react.default.createElement(require_ReceiptRenderer.ReceiptRows, {
|
|
132
|
+
locale: receipt.locale,
|
|
133
|
+
rows: visibleTableRows
|
|
134
|
+
}), renderedGroups);
|
|
124
135
|
};
|
|
125
136
|
return /* @__PURE__ */ react.default.createElement(require_ReceiptRenderer.InvoiceReceiptRenderer, {
|
|
126
137
|
receipt: view,
|
|
127
|
-
moduleOverrides: { line_groups: lines },
|
|
138
|
+
moduleOverrides: require_objectSpread2._objectSpread2({ line_groups: lines }, moduleOverrides),
|
|
128
139
|
ref
|
|
129
140
|
});
|
|
130
141
|
});
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
exports.hasInvoiceDetailSettings = hasInvoiceDetailSettings;
|
|
95
|
+
exports.invoiceVisibility = invoiceVisibility;
|
|
96
|
+
exports.isInvoiceFieldVisible = isInvoiceFieldVisible;
|
|
97
|
+
exports.isInvoiceModuleVisible = isInvoiceModuleVisible;
|
|
98
|
+
exports.permitsLegacyWalletFallback = permitsLegacyWalletFallback;
|
|
99
|
+
exports.requiresInvoiceDataFiltering = requiresInvoiceDataFiltering;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
3
|
const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
4
|
+
const require_invoiceVisibility = require("./invoiceVisibility.js");
|
|
4
5
|
let dayjs = require("dayjs");
|
|
5
6
|
dayjs = require_runtime.__toESM(dayjs);
|
|
6
7
|
let decimal_js = require("decimal.js");
|
|
@@ -874,14 +875,14 @@ function buildInvoiceReceiptViewModel(params) {
|
|
|
874
875
|
taxNumberLabel: text(taxNumberLabel) || void 0,
|
|
875
876
|
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,
|
|
876
877
|
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,
|
|
877
|
-
walletRows: rowGroups(data.wallets).length ? rowGroups(data.wallets) : rowGroups(data.tickets)
|
|
878
|
+
walletRows: rowGroups(data.wallets).length ? rowGroups(data.wallets) : require_invoiceVisibility.permitsLegacyWalletFallback(layout) ? rowGroups(data.tickets) : []
|
|
878
879
|
};
|
|
879
880
|
}
|
|
880
881
|
function getModuleText(module, locale = "en") {
|
|
881
882
|
var _ref4, _ref5, _module$text, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _configuredValue$loca;
|
|
882
883
|
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;
|
|
883
884
|
if (!isRecord(value)) return text(value);
|
|
884
|
-
if (value.is_show
|
|
885
|
+
if (!require_invoiceVisibility.invoiceVisibility(value.is_show)) return "";
|
|
885
886
|
const configuredValue = "value" in value ? value.value : value;
|
|
886
887
|
if (!isRecord(configuredValue)) return text(configuredValue);
|
|
887
888
|
const dashed = locale.replace(/_/g, "-");
|
|
@@ -891,7 +892,7 @@ function getModuleText(module, locale = "en") {
|
|
|
891
892
|
function getModuleImage(module) {
|
|
892
893
|
if (typeof module.img === "string") return text(module.img);
|
|
893
894
|
if (typeof module.image === "string") return text(module.image);
|
|
894
|
-
if (!isRecord(module.image) || module.image.is_show
|
|
895
|
+
if (!isRecord(module.image) || !require_invoiceVisibility.invoiceVisibility(module.image.is_show)) return "";
|
|
895
896
|
return text(module.image.value);
|
|
896
897
|
}
|
|
897
898
|
//#endregion
|
|
@@ -62,13 +62,14 @@ var PiPaymentLogger = class PiPaymentLogger {
|
|
|
62
62
|
/** 立即取走缓冲并异步上报;关闭、卸载及快照调用共享一次性标记。 */
|
|
63
63
|
"reportToFeishu",
|
|
64
64
|
() => {
|
|
65
|
+
var _this$shared3, _this$shared3$splice;
|
|
65
66
|
if (this.shared.reported) return;
|
|
66
67
|
this.shared.reported = true;
|
|
67
|
-
const timeline = this.shared.timeline.splice(0);
|
|
68
|
+
const timeline = (_this$shared3 = this.shared) === null || _this$shared3 === void 0 || (_this$shared3 = _this$shared3.timeline) === null || _this$shared3 === void 0 || (_this$shared3$splice = _this$shared3.splice) === null || _this$shared3$splice === void 0 ? void 0 : _this$shared3$splice.call(_this$shared3, 0);
|
|
68
69
|
if (!timeline.length) return;
|
|
69
70
|
try {
|
|
70
|
-
var _this$context, _this$context2, _this$context3, _this$context4, _this$context5;
|
|
71
|
-
const _this
|
|
71
|
+
var _this, _this$context, _this$context2, _this$context3, _this$context4, _this$context5;
|
|
72
|
+
const _ref = ((_this = this) === null || _this === void 0 || (_this = _this.shared) === null || _this === void 0 ? void 0 : _this.context) || {}, { transactionNumber, attemptIndex } = _ref, common = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
72
73
|
Promise.resolve(require_sendWarningLog.sendWarningLog({
|
|
73
74
|
title: `Pi_${common.provider}_${common.salesId || ""}`,
|
|
74
75
|
content: [
|
|
@@ -98,14 +99,16 @@ var PiPaymentLogger = class PiPaymentLogger {
|
|
|
98
99
|
}
|
|
99
100
|
]
|
|
100
101
|
})).catch(() => void 0);
|
|
101
|
-
} catch (
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.warn("[PiPayment] 飞书上报准备失败", error);
|
|
104
|
+
}
|
|
102
105
|
}
|
|
103
106
|
);
|
|
104
107
|
require_defineProperty._defineProperty(this, "addLog", (entry) => {
|
|
105
108
|
let host;
|
|
106
109
|
try {
|
|
107
110
|
host = this.getHostLogger();
|
|
108
|
-
} catch (
|
|
111
|
+
} catch (_unused4) {}
|
|
109
112
|
try {
|
|
110
113
|
var _this$context$salesId, _this$context$payment, _this$context$deviceN, _this$context$provide, _this$context$session, _this$context$transac, _this$context$attempt;
|
|
111
114
|
writePiPaymentEftposLog(host, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, entry), {}, { metadata: {
|
|
@@ -119,7 +122,7 @@ var PiPaymentLogger = class PiPaymentLogger {
|
|
|
119
122
|
attemptIndex: (_this$context$attempt = this.context.attemptIndex) !== null && _this$context$attempt !== void 0 ? _this$context$attempt : null,
|
|
120
123
|
sequence: ++this.shared.value
|
|
121
124
|
} }), this.collect);
|
|
122
|
-
} catch (
|
|
125
|
+
} catch (_unused5) {}
|
|
123
126
|
});
|
|
124
127
|
this.context = require_objectSpread2._objectSpread2({}, context);
|
|
125
128
|
}
|
|
@@ -132,7 +135,7 @@ var PiPaymentLogger = class PiPaymentLogger {
|
|
|
132
135
|
let host;
|
|
133
136
|
try {
|
|
134
137
|
host = this.getHostLogger();
|
|
135
|
-
} catch (
|
|
138
|
+
} catch (_unused6) {}
|
|
136
139
|
return new PiPaymentLogger(() => host, this.context, this.shared);
|
|
137
140
|
}
|
|
138
141
|
};
|