@pisell/pisellos 2.2.322 → 2.2.324
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +18 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +5 -0
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +40 -5
- package/dist/solution/BaseSales/index.js +1939 -1484
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +16 -2
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3391 -1176
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +19 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +5 -0
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +40 -5
- package/lib/solution/BaseSales/index.js +296 -43
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +16 -2
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1339 -74
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.activeVenueMenus = activeVenueMenus;
|
|
7
|
+
exports.createVenueCatalogSessionAdapter = createVenueCatalogSessionAdapter;
|
|
8
|
+
exports.productMatchesVenueMenu = productMatchesVenueMenu;
|
|
9
|
+
exports.readVenueCatalogList = readVenueCatalogList;
|
|
10
|
+
exports.validateVenueMenus = validateVenueMenus;
|
|
11
|
+
exports.venueCatalogError = venueCatalogError;
|
|
12
|
+
var _lodashEs = require("lodash-es");
|
|
13
|
+
var _getDateIsInSchedule = require("../../modules/Schedule/getDateIsInSchedule");
|
|
14
|
+
function venueCatalogError(code, message) {
|
|
15
|
+
return Object.assign(new Error(message), {
|
|
16
|
+
code
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function readVenueCatalogList(response, description) {
|
|
20
|
+
const list = response?.data?.list;
|
|
21
|
+
if (!response || response.status === false || response.success === false || response.code != null && Number(response.code) !== 200 || !Array.isArray(list)) {
|
|
22
|
+
throw venueCatalogError('VENUE_CATALOG_LOAD_FAILED', response?.message || `${description} could not be loaded.`);
|
|
23
|
+
}
|
|
24
|
+
const total = response.data.total ?? response.data.total_count ?? response.data.total_num;
|
|
25
|
+
if (total == null ? list.length >= 999 : !Number.isSafeInteger(Number(total)) || Number(total) < 0 || Number(total) > list.length) {
|
|
26
|
+
throw venueCatalogError('VENUE_CATALOG_INCOMPLETE', `${description} is incomplete. A complete catalog response is required.`);
|
|
27
|
+
}
|
|
28
|
+
if (list.some(row => !Number.isSafeInteger(Number(row?.form_record_id)) || Number(row.form_record_id) <= 0)) {
|
|
29
|
+
throw venueCatalogError('VENUE_CATALOG_INCOMPLETE', `${description} contains a record without a valid menu ID.`);
|
|
30
|
+
}
|
|
31
|
+
return list;
|
|
32
|
+
}
|
|
33
|
+
function validateVenueMenus(records, ids) {
|
|
34
|
+
return ids.flatMap(id => {
|
|
35
|
+
const menu = records.find(row => Number(row.form_record_id) === id);
|
|
36
|
+
if (!menu || menu.deleted_at || menu.status && menu.status !== 'valid') return [];
|
|
37
|
+
const config = menu.partyroom_package;
|
|
38
|
+
if (!['product_all', 'products', 'product_collection'].includes(config?.type) || !Array.isArray(menu.schedule) || menu.schedule.some(value => !Number.isSafeInteger(Number(value)) || Number(value) <= 0) || config.type !== 'product_all' && (!Array.isArray(config.products) || config.products.some(row => {
|
|
39
|
+
const value = Number(row?.[config.type === 'products' ? 'product_id' : 'product_collection_id']);
|
|
40
|
+
return !Number.isSafeInteger(value) || value <= 0;
|
|
41
|
+
}))) {
|
|
42
|
+
throw venueCatalogError('VENUE_MENU_INCOMPLETE', 'The configured menu is incomplete. Reload the booking page.');
|
|
43
|
+
}
|
|
44
|
+
return [(0, _lodashEs.cloneDeep)(menu)];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Same ID/collection union as the local OS product query; variant selection stays with SKU validation. */
|
|
49
|
+
function productMatchesVenueMenu(product, menu) {
|
|
50
|
+
if (menu.status && menu.status !== 'valid') return false;
|
|
51
|
+
const config = menu.partyroom_package;
|
|
52
|
+
if (config?.type === 'product_all') return true;
|
|
53
|
+
if (config?.type === 'products') return config.products.some(row => Number(row.product_id) === Number(product.id));
|
|
54
|
+
if (config?.type === 'product_collection') {
|
|
55
|
+
if (!Array.isArray(product.collection)) {
|
|
56
|
+
throw venueCatalogError('VENUE_CATALOG_INCOMPLETE', 'Product collection data is missing from the catalog.');
|
|
57
|
+
}
|
|
58
|
+
return config.products.some(row => product.collection.some(collection => Number(collection.id) === Number(row.product_collection_id)));
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
function activeVenueMenus(menus, schedules, datetime, dateOnly = false) {
|
|
63
|
+
const scheduleMap = new Map(schedules.map(row => [Number(row.id), row]));
|
|
64
|
+
return menus.filter(menu => {
|
|
65
|
+
if (menu.status && menu.status !== 'valid') return false;
|
|
66
|
+
const records = menu.schedule.map(id => scheduleMap.get(Number(id)));
|
|
67
|
+
if (records.some(record => !record)) {
|
|
68
|
+
throw venueCatalogError('VENUE_SCHEDULE_INCOMPLETE', 'Menu schedule data is not ready. Please retry.');
|
|
69
|
+
}
|
|
70
|
+
// A calendar/card read asks whether the menu opens at any point on that date.
|
|
71
|
+
// Only selected-time/retail quotes require membership at an exact instant.
|
|
72
|
+
return dateOnly ? (0, _getDateIsInSchedule.getScheduleStartEndTimePoints)(datetime.slice(0, 10), records).length > 0 : (0, _getDateIsInSchedule.getDateIsInSchedule)(datetime, records);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Internal loader injection is not exposed to material callers. Rejected loads remain rejected until explicit retry. */
|
|
77
|
+
function createVenueCatalogSessionAdapter(options) {
|
|
78
|
+
let disposed = false;
|
|
79
|
+
let failed = false;
|
|
80
|
+
let pending;
|
|
81
|
+
const assertCurrent = () => {
|
|
82
|
+
if (disposed) throw venueCatalogError('VENUE_CATALOG_DISPOSED', 'The venue catalog session is closed.');
|
|
83
|
+
options.assertCurrent();
|
|
84
|
+
};
|
|
85
|
+
const load = async () => {
|
|
86
|
+
assertCurrent();
|
|
87
|
+
if (!pending) {
|
|
88
|
+
pending = Promise.resolve().then(() => {
|
|
89
|
+
assertCurrent();
|
|
90
|
+
return options.load();
|
|
91
|
+
}).then(pool => {
|
|
92
|
+
assertCurrent();
|
|
93
|
+
return (0, _lodashEs.cloneDeep)(pool);
|
|
94
|
+
}).catch(error => {
|
|
95
|
+
failed = true;
|
|
96
|
+
throw error;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const pool = await pending;
|
|
100
|
+
assertCurrent();
|
|
101
|
+
return pool;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
queryCatalogSnapshot: async (params = {}) => {
|
|
105
|
+
const pool = await load();
|
|
106
|
+
const result = options.snapshot(pool, (0, _lodashEs.cloneDeep)(params));
|
|
107
|
+
assertCurrent();
|
|
108
|
+
return (0, _lodashEs.cloneDeep)(result);
|
|
109
|
+
},
|
|
110
|
+
queryCatalogProductDetail: async ({
|
|
111
|
+
product_id,
|
|
112
|
+
...params
|
|
113
|
+
}) => {
|
|
114
|
+
const pool = await load();
|
|
115
|
+
const result = options.snapshot(pool, {
|
|
116
|
+
...(0, _lodashEs.cloneDeep)(params),
|
|
117
|
+
product_ids: [product_id]
|
|
118
|
+
});
|
|
119
|
+
assertCurrent();
|
|
120
|
+
return (0, _lodashEs.cloneDeep)(result.find(product => Number(product.id) === Number(product_id)));
|
|
121
|
+
},
|
|
122
|
+
prepareProductDetail: async params => {
|
|
123
|
+
const pool = await load();
|
|
124
|
+
const query = {
|
|
125
|
+
...(0, _lodashEs.cloneDeep)(params),
|
|
126
|
+
product_ids: [params.product_id]
|
|
127
|
+
};
|
|
128
|
+
if (!options.snapshot(pool, query).some(product => Number(product.id) === Number(params.product_id))) return undefined;
|
|
129
|
+
await options.prepareDetail(pool, (0, _lodashEs.cloneDeep)(params));
|
|
130
|
+
assertCurrent();
|
|
131
|
+
return (0, _lodashEs.cloneDeep)(options.snapshot(pool, query).find(product => Number(product.id) === Number(params.product_id)));
|
|
132
|
+
},
|
|
133
|
+
calculateProductBookingPrice: async params => {
|
|
134
|
+
const pool = await load();
|
|
135
|
+
const result = await options.quote(pool, (0, _lodashEs.cloneDeep)(params));
|
|
136
|
+
assertCurrent();
|
|
137
|
+
return (0, _lodashEs.cloneDeep)(result);
|
|
138
|
+
},
|
|
139
|
+
retry: () => {
|
|
140
|
+
assertCurrent();
|
|
141
|
+
if (failed) {
|
|
142
|
+
pending = undefined;
|
|
143
|
+
failed = false;
|
|
144
|
+
}
|
|
145
|
+
options.onRetry?.();
|
|
146
|
+
},
|
|
147
|
+
dispose: () => {
|
|
148
|
+
if (!disposed) {
|
|
149
|
+
disposed = true;
|
|
150
|
+
pending = undefined;
|
|
151
|
+
options.onDispose?.();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
package/lib/utils/platform.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
|
6
6
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isCustomerUserPlatform(platform: unknown): boolean;
|
|
9
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
10
|
+
export declare function isSelfServicePlatform(platform: unknown): boolean;
|
package/lib/utils/platform.js
CHANGED
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isCustomerUserPlatform = isCustomerUserPlatform;
|
|
7
|
+
exports.isSelfServicePlatform = isSelfServicePlatform;
|
|
7
8
|
exports.normalizeRuntimePlatform = normalizeRuntimePlatform;
|
|
8
9
|
const CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
10
|
+
const SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Normalize the runtime platform passed through solution/module otherParams.
|
|
@@ -19,4 +21,9 @@ function normalizeRuntimePlatform(platform) {
|
|
|
19
21
|
*/
|
|
20
22
|
function isCustomerUserPlatform(platform) {
|
|
21
23
|
return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
27
|
+
function isSelfServicePlatform(platform) {
|
|
28
|
+
return SELF_SERVICE_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
22
29
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = "_os_pos_receipt_auto_print_payment_statuses";
|
|
2
|
+
export type PosReceiptAutoPrintPaymentStatus = 'paid' | 'partially_paid' | 'payment_processing';
|
|
3
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
4
|
+
export declare function normalizePosReceiptAutoPrintPaymentStatuses(value: unknown): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = void 0;
|
|
7
|
+
exports.normalizePosReceiptAutoPrintPaymentStatuses = normalizePosReceiptAutoPrintPaymentStatuses;
|
|
8
|
+
const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = '_os_pos_receipt_auto_print_payment_statuses';
|
|
9
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
10
|
+
function normalizePosReceiptAutoPrintPaymentStatuses(value) {
|
|
11
|
+
if (!Array.isArray(value)) return undefined;
|
|
12
|
+
return [...new Set(value.filter(status => status === 'paid' || status === 'partially_paid' || status === 'payment_processing'))];
|
|
13
|
+
}
|