@pisell/pisellos 2.2.314 → 2.2.316
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 +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
- package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +2 -0
- package/dist/modules/Holder/utils.js +32 -2
- package/dist/modules/OpenData/contactInfo.d.ts +20 -0
- package/dist/modules/OpenData/contactInfo.js +70 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/types.d.ts +23 -0
- package/dist/modules/Order/holderRelations.d.ts +14 -0
- package/dist/modules/Order/holderRelations.js +154 -0
- package/dist/modules/Order/index.d.ts +16 -4
- package/dist/modules/Order/index.js +926 -511
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +49 -3
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
- package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
- package/dist/modules/Order/utils.d.ts +2 -1
- package/dist/modules/Order/utils.js +61 -17
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Product/types.d.ts +11 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +332 -23
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/modules/Rules/index.js +62 -61
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1557 -1322
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +19 -0
- package/dist/server/modules/order/index.js +1071 -774
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1297 -770
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/test.json +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
- package/dist/shared/receipt/small-ticket.d.ts +96 -0
- package/dist/shared/receipt/small-ticket.js +2763 -0
- package/dist/shared/receipt/templateVisibility.d.ts +26 -0
- package/dist/shared/receipt/templateVisibility.js +68 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +43 -16
- package/dist/solution/BaseSales/index.js +2028 -1247
- package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/dist/solution/BaseSales/pickupTiming.js +616 -0
- package/dist/solution/BaseSales/types.d.ts +12 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +10 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
- package/dist/solution/BookingByStep/index.d.ts +4 -2
- package/dist/solution/BookingByStep/index.js +8 -3
- package/dist/solution/BookingTicket/index.d.ts +23 -3
- package/dist/solution/BookingTicket/index.js +867 -507
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/dist/solution/OrderInvoicePreview/index.js +340 -0
- package/dist/solution/RegisterAndLogin/config.js +54 -11
- package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
- package/dist/solution/RegisterAndLogin/index.js +1 -1
- package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/dist/solution/RegisterAndLogin/utils.js +36 -16
- package/dist/solution/ScanOrder/index.js +65 -31
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/dist/solution/UnifiedBookingSales/index.js +1715 -906
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1062 -785
- package/dist/solution/VenueBooking/types.d.ts +2 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
- package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/Holder/utils.d.ts +2 -0
- package/lib/modules/Holder/utils.js +27 -1
- package/lib/modules/OpenData/contactInfo.d.ts +20 -0
- package/lib/modules/OpenData/contactInfo.js +56 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/types.d.ts +23 -0
- package/lib/modules/Order/holderRelations.d.ts +14 -0
- package/lib/modules/Order/holderRelations.js +98 -0
- package/lib/modules/Order/index.d.ts +16 -4
- package/lib/modules/Order/index.js +284 -50
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +49 -3
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
- package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
- package/lib/modules/Order/utils.d.ts +2 -1
- package/lib/modules/Order/utils.js +49 -11
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Product/types.d.ts +11 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +252 -8
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/modules/Rules/index.js +2 -1
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +166 -39
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +19 -0
- package/lib/server/modules/order/index.js +160 -7
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +226 -63
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/test.json +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
- package/lib/shared/receipt/small-ticket.d.ts +96 -0
- package/lib/shared/receipt/small-ticket.js +2555 -0
- package/lib/shared/receipt/templateVisibility.d.ts +26 -0
- package/lib/shared/receipt/templateVisibility.js +67 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +43 -16
- package/lib/solution/BaseSales/index.js +401 -33
- package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/lib/solution/BaseSales/pickupTiming.js +290 -0
- package/lib/solution/BaseSales/types.d.ts +12 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +7 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
- package/lib/solution/BookingByStep/index.d.ts +4 -2
- package/lib/solution/BookingByStep/index.js +7 -3
- package/lib/solution/BookingTicket/index.d.ts +23 -3
- package/lib/solution/BookingTicket/index.js +197 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/lib/solution/OrderInvoicePreview/index.js +246 -0
- package/lib/solution/RegisterAndLogin/config.js +57 -11
- package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
- package/lib/solution/RegisterAndLogin/index.js +9 -1
- package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/lib/solution/RegisterAndLogin/utils.js +24 -17
- package/lib/solution/ScanOrder/index.js +59 -20
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/lib/solution/UnifiedBookingSales/index.js +562 -75
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +243 -96
- package/lib/solution/VenueBooking/types.d.ts +2 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContactInfoRequiredError = exports.CONTACT_INFO_FIELDS = void 0;
|
|
7
|
+
exports.extractCustomerContactInfo = extractCustomerContactInfo;
|
|
8
|
+
exports.getMissingContactInfoFields = getMissingContactInfoFields;
|
|
9
|
+
exports.isContactRecord = isContactRecord;
|
|
10
|
+
exports.resolveContactInfoConfig = resolveContactInfoConfig;
|
|
11
|
+
const CONTACT_INFO_FIELDS = exports.CONTACT_INFO_FIELDS = ['first_name', 'last_name', 'phone', 'email'];
|
|
12
|
+
function resolveContactInfoConfig(data) {
|
|
13
|
+
const enabled = data?.['sale.enable_contact_info'] === true;
|
|
14
|
+
const fields = CONTACT_INFO_FIELDS.reduce((result, field) => {
|
|
15
|
+
const visible = data?.[`sale.${field}.visible`] !== false;
|
|
16
|
+
result[field] = {
|
|
17
|
+
visible,
|
|
18
|
+
required: enabled && visible && data?.[`sale.${field}.required`] === true
|
|
19
|
+
};
|
|
20
|
+
return result;
|
|
21
|
+
}, {});
|
|
22
|
+
return {
|
|
23
|
+
enabled: enabled && CONTACT_INFO_FIELDS.some(field => fields[field].visible),
|
|
24
|
+
fields
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function getMissingContactInfoFields(config, value) {
|
|
28
|
+
if (!config.enabled) return [];
|
|
29
|
+
const contact = isContactRecord(value) ? value : {};
|
|
30
|
+
return CONTACT_INFO_FIELDS.filter(field => {
|
|
31
|
+
if (!config.fields[field].visible || !config.fields[field].required) return false;
|
|
32
|
+
const fieldValue = field === 'phone' ? isContactRecord(contact.phone) ? contact.phone.phone : undefined : contact[field];
|
|
33
|
+
return typeof fieldValue !== 'string' || !fieldValue.trim();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function isContactRecord(value) {
|
|
37
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Customer relations wrap the contact in value; sales orders store the object itself. */
|
|
41
|
+
function extractCustomerContactInfo(customer) {
|
|
42
|
+
if (!isContactRecord(customer)) return null;
|
|
43
|
+
const contact = customer.contacts_info;
|
|
44
|
+
if (!isContactRecord(contact)) return null;
|
|
45
|
+
const value = Object.prototype.hasOwnProperty.call(contact, 'value') ? contact.value : contact;
|
|
46
|
+
return isContactRecord(value) ? value : null;
|
|
47
|
+
}
|
|
48
|
+
class ContactInfoRequiredError extends Error {
|
|
49
|
+
code = 'CONTACT_INFO_REQUIRED';
|
|
50
|
+
constructor(fields) {
|
|
51
|
+
super(`Contact information is required: ${fields.join(', ')}`);
|
|
52
|
+
this.fields = fields;
|
|
53
|
+
this.name = 'ContactInfoRequiredError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ContactInfoRequiredError = ContactInfoRequiredError;
|
|
@@ -3,6 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import type { ScheduleModule } from '../Schedule';
|
|
4
4
|
import type { OpenDataConfig, OpenDataFetchParams, OpenDataAvailabilityResult, InvoiceLayoutConfig, InvoiceTemplateSettings } from './types';
|
|
5
5
|
export * from './types';
|
|
6
|
+
export * from './contactInfo';
|
|
6
7
|
export { computeAvailability, getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutConfig, normalizeInvoiceLayoutFromTemplateSettings, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales, } from './utils';
|
|
7
8
|
export declare class OpenDataModule extends BaseModule implements Module {
|
|
8
9
|
protected defaultName: string;
|
|
@@ -77,6 +77,18 @@ Object.keys(_types).forEach(function (key) {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
+
var _contactInfo = require("./contactInfo");
|
|
81
|
+
Object.keys(_contactInfo).forEach(function (key) {
|
|
82
|
+
if (key === "default" || key === "__esModule") return;
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
84
|
+
if (key in exports && exports[key] === _contactInfo[key]) return;
|
|
85
|
+
Object.defineProperty(exports, key, {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _contactInfo[key];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
80
92
|
function isRecord(value) {
|
|
81
93
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
82
94
|
}
|
|
@@ -69,14 +69,37 @@ export interface OpenDataConfig {
|
|
|
69
69
|
'reservation.time_slice'?: number | string;
|
|
70
70
|
'sale.allow_item_notes'?: boolean;
|
|
71
71
|
'sale.allow_order_notes'?: boolean;
|
|
72
|
+
'sale.enable_contact_info'?: boolean;
|
|
73
|
+
'sale.first_name.visible'?: boolean;
|
|
74
|
+
'sale.first_name.required'?: boolean;
|
|
75
|
+
'sale.last_name.visible'?: boolean;
|
|
76
|
+
'sale.last_name.required'?: boolean;
|
|
77
|
+
'sale.phone.visible'?: boolean;
|
|
78
|
+
'sale.phone.required'?: boolean;
|
|
79
|
+
'sale.email.visible'?: boolean;
|
|
80
|
+
'sale.email.required'?: boolean;
|
|
81
|
+
/** False submits an order without starting or confirming payment. */
|
|
82
|
+
'sale.require_payment_on_submit'?: boolean | null;
|
|
72
83
|
'sale.enable_item_rules'?: boolean;
|
|
73
84
|
'sale.enable_short_number'?: boolean;
|
|
85
|
+
'sale.short_number_digits'?: number;
|
|
86
|
+
'sale.maximum_number'?: number | string | null;
|
|
87
|
+
'sale.pad_with_leading_zeros'?: boolean | null;
|
|
88
|
+
'sale.short_number_random'?: boolean;
|
|
74
89
|
'sale.short_number_daily_reset'?: boolean;
|
|
75
90
|
'sale.short_number_start_number'?: number;
|
|
76
91
|
'sale.short_number_prefix'?: string | null;
|
|
77
92
|
'sale.sale_number_prefix'?: string | null;
|
|
78
93
|
'sale.enabled_item_rules'?: number[];
|
|
79
94
|
'fulfillment.enable_pickup'?: boolean;
|
|
95
|
+
'fulfillment.handover_mode'?: string[];
|
|
96
|
+
'fulfillment.takeaway_fees_rules'?: number[];
|
|
97
|
+
'fulfillment.dine_in_fees_rules'?: number[];
|
|
98
|
+
'fulfillment.pickup.timing_mode'?: 'asap_only' | 'scheduled_only' | 'asap_and_scheduled';
|
|
99
|
+
'fulfillment.pickup.schedule'?: number[];
|
|
100
|
+
'fulfillment.pickup.advance_days'?: number;
|
|
101
|
+
'fulfillment.pickup.slot_interval_minutes'?: number;
|
|
102
|
+
'fulfillment.pickup.preparation_time_minutes'?: number;
|
|
80
103
|
'fulfillment.overdue_reminder'?: boolean;
|
|
81
104
|
'fulfillment.manual_input_type'?: string;
|
|
82
105
|
'fulfillment.enable_auto_complete'?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrderHolderRelation, OrderTempOrder } from './types';
|
|
2
|
+
/** 在原订单上补齐关系身份,让缓存、提交和重试共用同一个 UUID。 */
|
|
3
|
+
export declare function ensureHolderRelationUuids(order: {
|
|
4
|
+
holder_relations?: OrderHolderRelation[];
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function hasProductBooking(product: Record<string, any>): boolean;
|
|
7
|
+
export declare function getProductHolderRelations(order: {
|
|
8
|
+
holder_relations?: OrderHolderRelation[];
|
|
9
|
+
}, product: Record<string, any>): OrderHolderRelation[];
|
|
10
|
+
export declare function replaceProductHolderRelations(order: OrderTempOrder, product: Record<string, any>, patch: OrderHolderRelation[] | undefined): void;
|
|
11
|
+
/** 只删除明确被用户删除的行,不从稀疏远端快照推断删除。 */
|
|
12
|
+
export declare function removeProductHolderRelations(order: OrderTempOrder, products: Array<Record<string, any>>): void;
|
|
13
|
+
/** 仅兼容尚无新字段的旧测试草稿;显式 [] 永远不恢复旧 product 数据。 */
|
|
14
|
+
export declare function restoreLegacyHolderRelations(order: Record<string, any>): OrderHolderRelation[] | undefined;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ensureHolderRelationUuids = ensureHolderRelationUuids;
|
|
7
|
+
exports.getProductHolderRelations = getProductHolderRelations;
|
|
8
|
+
exports.hasProductBooking = hasProductBooking;
|
|
9
|
+
exports.removeProductHolderRelations = removeProductHolderRelations;
|
|
10
|
+
exports.replaceProductHolderRelations = replaceProductHolderRelations;
|
|
11
|
+
exports.restoreLegacyHolderRelations = restoreLegacyHolderRelations;
|
|
12
|
+
var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
13
|
+
function getHolderRelationUuid(relation) {
|
|
14
|
+
return typeof relation?.uuid === 'string' && relation.uuid.trim() ? relation.uuid : undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** 在原订单上补齐关系身份,让缓存、提交和重试共用同一个 UUID。 */
|
|
18
|
+
function ensureHolderRelationUuids(order) {
|
|
19
|
+
if (!Array.isArray(order.holder_relations)) return;
|
|
20
|
+
for (const relation of order.holder_relations) {
|
|
21
|
+
if (relation && typeof relation === 'object' && !getHolderRelationUuid(relation)) {
|
|
22
|
+
relation.uuid = (0, _orderCollectionIdentity.createUuidV4)();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function hasProductBooking(product) {
|
|
27
|
+
const bookingIds = [product.booking_id, product.metadata?.booking_id, product.schedule_event_id];
|
|
28
|
+
return Boolean(product.booking_uid || product.metadata?.booking_uid) || bookingIds.some(id => id !== undefined && id !== null && String(id) !== '' && String(id) !== '0');
|
|
29
|
+
}
|
|
30
|
+
function getProductHolderRelations(order, product) {
|
|
31
|
+
const uid = product.metadata?.unique_identification_number ?? product.unique_identification_number;
|
|
32
|
+
if (uid === undefined || uid === null || uid === '') return [];
|
|
33
|
+
return (order.holder_relations || []).filter(relation => relation.relation_model === 'order_detail' && String(relation.relation_uuid) === String(uid));
|
|
34
|
+
}
|
|
35
|
+
function replaceProductHolderRelations(order, product, patch) {
|
|
36
|
+
if (patch === undefined || hasProductBooking(product)) return;
|
|
37
|
+
const uid = product.metadata?.unique_identification_number ?? product.unique_identification_number;
|
|
38
|
+
if (uid === undefined || uid === null || uid === '') return;
|
|
39
|
+
const existing = getProductHolderRelations(order, product);
|
|
40
|
+
const next = new Map();
|
|
41
|
+
for (const relation of patch) {
|
|
42
|
+
const key = `${relation.holder_type}:${relation.holder_id}`;
|
|
43
|
+
const previous = existing.find(item => item.holder_type === relation.holder_type && String(item.holder_id) === String(relation.holder_id));
|
|
44
|
+
next.set(key, {
|
|
45
|
+
...previous,
|
|
46
|
+
...relation,
|
|
47
|
+
uuid: getHolderRelationUuid(previous) || getHolderRelationUuid(relation) || (0, _orderCollectionIdentity.createUuidV4)(),
|
|
48
|
+
relation_model: 'order_detail',
|
|
49
|
+
relation_uuid: String(uid),
|
|
50
|
+
...(previous?.metadata || relation.metadata ? {
|
|
51
|
+
metadata: {
|
|
52
|
+
...previous?.metadata,
|
|
53
|
+
...relation.metadata
|
|
54
|
+
}
|
|
55
|
+
} : {})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
order.holder_relations = [...(order.holder_relations || []).filter(relation => relation.relation_model !== 'order_detail' || String(relation.relation_uuid) !== String(uid)), ...next.values()];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 只删除明确被用户删除的行,不从稀疏远端快照推断删除。 */
|
|
62
|
+
function removeProductHolderRelations(order, products) {
|
|
63
|
+
if (!Array.isArray(order.holder_relations)) return;
|
|
64
|
+
const removedUids = new Set(products.map(product => String(product.metadata?.unique_identification_number ?? product.unique_identification_number ?? '')));
|
|
65
|
+
order.holder_relations = order.holder_relations.filter(relation => relation.relation_model !== 'order_detail' || !removedUids.has(String(relation.relation_uuid)));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 仅兼容尚无新字段的旧测试草稿;显式 [] 永远不恢复旧 product 数据。 */
|
|
69
|
+
function restoreLegacyHolderRelations(order) {
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(order, 'holder_relations')) {
|
|
71
|
+
return Array.isArray(order.holder_relations) ? order.holder_relations : undefined;
|
|
72
|
+
}
|
|
73
|
+
const relations = [];
|
|
74
|
+
const bookingProductUids = new Set((order.bookings || []).map(booking => String(booking.product_uid ?? booking.metadata?.product_uid ?? '')));
|
|
75
|
+
for (const product of order.products || []) {
|
|
76
|
+
if (hasProductBooking(product)) continue;
|
|
77
|
+
const uid = product.metadata?.unique_identification_number ?? product.unique_identification_number;
|
|
78
|
+
if (uid === undefined || uid === null || uid === '' || bookingProductUids.has(String(uid))) continue;
|
|
79
|
+
const holder = product.metadata?.holder || {};
|
|
80
|
+
const rawIds = product.metadata?.holder_id ?? holder.form_record;
|
|
81
|
+
const ids = (Array.isArray(rawIds) ? rawIds : [rawIds]).filter(id => id !== undefined && id !== null && id !== '' && Number.isInteger(Number(id)) && Number(id) >= 0);
|
|
82
|
+
for (const id of ids) {
|
|
83
|
+
const metadata = {
|
|
84
|
+
...holder,
|
|
85
|
+
form_record: [Number(id)]
|
|
86
|
+
};
|
|
87
|
+
if (ids.length !== 1) delete metadata.name;
|
|
88
|
+
relations.push({
|
|
89
|
+
relation_model: 'order_detail',
|
|
90
|
+
relation_uuid: String(uid),
|
|
91
|
+
holder_type: 'form',
|
|
92
|
+
holder_id: Number(id),
|
|
93
|
+
metadata
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return relations.length ? relations : undefined;
|
|
98
|
+
}
|
|
@@ -3,7 +3,8 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import
|
|
6
|
+
import { type PickupTimingBooking, type PickupTimingBookingInput } from './pickupTiming';
|
|
7
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderCartIntentCommitContext, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
|
|
7
8
|
import type { ICustomer } from '../AccountList/types';
|
|
8
9
|
import type { Discount } from '../Discount/types';
|
|
9
10
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -66,6 +67,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
66
67
|
* orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
|
|
67
68
|
*/
|
|
68
69
|
updateOtherParams(params: Record<string, any>): void;
|
|
70
|
+
/** Internal intent boundary shared with asynchronous scanner/detail flows. */
|
|
71
|
+
createCartIntentCommitGuard(action: OrderCartIntentCommitContext['action'], tempOrder?: OrderTempOrder | null): () => void;
|
|
69
72
|
/** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
|
|
70
73
|
isOnlineStorePlatform(): boolean;
|
|
71
74
|
/**
|
|
@@ -329,6 +332,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
329
332
|
private applyOrderProductsDepositSummary;
|
|
330
333
|
recalculateSummary(options?: {
|
|
331
334
|
createIfMissing?: boolean;
|
|
335
|
+
isCurrentOrder?: () => boolean;
|
|
332
336
|
}): Promise<OrderSummary | null>;
|
|
333
337
|
getOrderSummary(): Promise<OrderSummary>;
|
|
334
338
|
updateTempOrderNote(note: string): string;
|
|
@@ -354,6 +358,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
354
358
|
private updateTempOrderShopServiceData;
|
|
355
359
|
updateTempOrderPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
356
360
|
updateTempOrderServiceType(serviceType: ShopServiceType): ShopServiceData;
|
|
361
|
+
getPickupTimingBooking(): PickupTimingBooking | null;
|
|
362
|
+
setPickupTimingBooking(input: PickupTimingBookingInput): PickupTimingBooking;
|
|
363
|
+
clearPickupTimingBooking(): void;
|
|
357
364
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
358
365
|
private buildTempOrderCustomer;
|
|
359
366
|
private isCustomerBoundDiscount;
|
|
@@ -498,10 +505,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
498
505
|
private hasSameEntitlementMergePriceConfig;
|
|
499
506
|
private getBundleRuntimeIdentity;
|
|
500
507
|
private preservePersistedBundlePriceFields;
|
|
508
|
+
private isRestrictedCartProductUpdate;
|
|
501
509
|
private applyOrderProductUpdateToTempOrder;
|
|
502
510
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
503
511
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<OrderProduct[]>;
|
|
504
|
-
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams
|
|
512
|
+
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams, options?: {
|
|
513
|
+
isCurrentOrder?: () => boolean;
|
|
514
|
+
}): Promise<OrderProduct[]>;
|
|
505
515
|
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
506
516
|
/**
|
|
507
517
|
* 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
|
|
@@ -585,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
585
595
|
generateIdempotencyToken(): string;
|
|
586
596
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
587
597
|
createOrder(params: CommitOrderParams['query']): {
|
|
588
|
-
type: "
|
|
598
|
+
type: "virtual" | "appointment_booking";
|
|
589
599
|
platform: string;
|
|
590
600
|
sales_channel: string;
|
|
591
601
|
order_sales_channel: string;
|
|
@@ -663,4 +673,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
663
673
|
getOrderInfo(order_id: number): Promise<any>;
|
|
664
674
|
getVouchers(): any[];
|
|
665
675
|
}
|
|
666
|
-
export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, VirtualCurrencySnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
676
|
+
export type { OrderHolderRelation, AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, VirtualCurrencySnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
677
|
+
export { isFulfillmentTimingBooking } from './pickupTiming';
|
|
678
|
+
export type { PickupTimingBooking, PickupTimingBookingInput, PickupTimingBookingMetadata, PickupTimingSelectionMode, PickupTimingSource, } from './pickupTiming';
|