@pisell/pisellos 0.10.88 → 0.10.91
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/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.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
- 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 +21 -0
- package/dist/modules/BookingContext/utils/productExtend.js +132 -33
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- 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/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/OpenData/salesSettings.js +1 -1
- package/dist/modules/OpenData/types.d.ts +9 -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 +22 -7
- package/dist/modules/Order/index.js +1565 -1161
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/types.d.ts +33 -11
- package/dist/modules/Order/types.js +2 -2
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +185 -129
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/types.d.ts +16 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +383 -24
- package/dist/modules/ResourcePlanner/types.d.ts +42 -0
- package/dist/modules/Rules/index.js +86 -54
- 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 +9 -0
- package/dist/server/index.js +1928 -1462
- 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 +21 -0
- package/dist/server/modules/order/index.js +1399 -831
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterOrders.js +20 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1295 -769
- 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/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +1 -0
- package/dist/shared/receipt/small-ticket.js +58 -26
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +22 -6
- package/dist/solution/BaseSales/index.js +1881 -1347
- package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/dist/solution/BaseSales/pickupTiming.js +35 -8
- 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 +19 -3
- package/dist/solution/BookingByStep/index.js +681 -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 +6 -0
- package/dist/solution/BookingTicket/index.js +666 -593
- package/dist/solution/BookingTicket/types.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +7 -7
- 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/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
- package/dist/solution/OrderInvoicePreview/index.js +4 -3
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +230 -97
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
- package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- 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.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
- 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 +21 -0
- package/lib/modules/BookingContext/utils/productExtend.js +104 -5
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- 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/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/OpenData/salesSettings.js +1 -1
- package/lib/modules/OpenData/types.d.ts +9 -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 +22 -7
- package/lib/modules/Order/index.js +457 -174
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/types.d.ts +33 -11
- package/lib/modules/Order/types.js +2 -2
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +51 -3
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/types.d.ts +16 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +299 -9
- package/lib/modules/ResourcePlanner/types.d.ts +42 -0
- package/lib/modules/Rules/index.js +32 -3
- 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 +9 -0
- package/lib/server/index.js +279 -30
- 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 +21 -0
- package/lib/server/modules/order/index.js +344 -35
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterOrders.js +18 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +224 -62
- 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/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +1 -0
- package/lib/shared/receipt/small-ticket.js +53 -25
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +22 -6
- package/lib/solution/BaseSales/index.js +347 -59
- package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/lib/solution/BaseSales/pickupTiming.js +24 -3
- 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 +19 -3
- package/lib/solution/BookingByStep/index.js +229 -17
- 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 +6 -0
- package/lib/solution/BookingTicket/index.js +40 -5
- package/lib/solution/BookingTicket/types.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +7 -7
- 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/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
- package/lib/solution/OrderInvoicePreview/index.js +1 -0
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +131 -22
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/lib/solution/UnifiedBookingSales/index.js +717 -144
- package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
- 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,13 @@
|
|
|
1
|
+
/** Local reconciliation state; never part of a cloud checkout payload. */
|
|
2
|
+
export declare const LOCAL_EFTPOS_REFRESH_REQUIRED = "_local_eftpos_refresh_required";
|
|
3
|
+
export declare const LOCAL_EFTPOS_FINALIZED = "_local_eftpos_finalized";
|
|
4
|
+
export declare const PAYMENT_REFRESH_MESSAGE = "\u8BA2\u5355\u9700\u8981\u5237\u65B0\uFF0C\u8BF7\u8054\u7F51\u5237\u65B0\u8BA2\u5355\u540E\u518D\u4ED8\u6B3E";
|
|
5
|
+
export interface LocalEftposFinalization {
|
|
6
|
+
saleId: string | number;
|
|
7
|
+
paymentNumber: string;
|
|
8
|
+
result: 'failed' | 'not_started';
|
|
9
|
+
failedTransactionNumbers: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function requiresLocalPaymentRefresh(order: any): boolean;
|
|
12
|
+
export declare function isLocalFinalizedPayment(payment: any): boolean;
|
|
13
|
+
export declare function stripLocalEftposState<T extends Record<string, any>>(order: T): T;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
/** Local reconciliation state; never part of a cloud checkout payload. */
|
|
8
|
+
export var LOCAL_EFTPOS_REFRESH_REQUIRED = '_local_eftpos_refresh_required';
|
|
9
|
+
export var LOCAL_EFTPOS_FINALIZED = '_local_eftpos_finalized';
|
|
10
|
+
export var PAYMENT_REFRESH_MESSAGE = '订单需要刷新,请联网刷新订单后再付款';
|
|
11
|
+
export function requiresLocalPaymentRefresh(order) {
|
|
12
|
+
var _order$metadata;
|
|
13
|
+
return (order === null || order === void 0 || (_order$metadata = order.metadata) === null || _order$metadata === void 0 ? void 0 : _order$metadata[LOCAL_EFTPOS_REFRESH_REQUIRED]) === true;
|
|
14
|
+
}
|
|
15
|
+
export function isLocalFinalizedPayment(payment) {
|
|
16
|
+
var _payment$metadata;
|
|
17
|
+
return (payment === null || payment === void 0 ? void 0 : payment.status) === 'voided' && (payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata[LOCAL_EFTPOS_FINALIZED]) === true;
|
|
18
|
+
}
|
|
19
|
+
export function stripLocalEftposState(order) {
|
|
20
|
+
var result = _objectSpread({}, order);
|
|
21
|
+
if (order.metadata) {
|
|
22
|
+
result.metadata = _objectSpread({}, order.metadata);
|
|
23
|
+
delete result.metadata[LOCAL_EFTPOS_REFRESH_REQUIRED];
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(order.payments)) {
|
|
26
|
+
result.payments = order.payments.filter(function (payment) {
|
|
27
|
+
return !isLocalFinalizedPayment(payment);
|
|
28
|
+
}).map(function (payment) {
|
|
29
|
+
var _payment$metadata2;
|
|
30
|
+
if (!((_payment$metadata2 = payment.metadata) !== null && _payment$metadata2 !== void 0 && _payment$metadata2[LOCAL_EFTPOS_FINALIZED])) return payment;
|
|
31
|
+
var metadata = _objectSpread({}, payment.metadata);
|
|
32
|
+
delete metadata[LOCAL_EFTPOS_FINALIZED];
|
|
33
|
+
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
34
|
+
metadata: metadata
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
@@ -71,8 +71,8 @@ export interface OrderGiftSelectResult {
|
|
|
71
71
|
/**
|
|
72
72
|
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
73
73
|
*
|
|
74
|
-
* -
|
|
75
|
-
* -
|
|
74
|
+
* - 唯一且无规格/套餐的候选:SDK 自动构造商品
|
|
75
|
+
* - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
|
|
76
76
|
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
77
77
|
*
|
|
78
78
|
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
@@ -213,6 +213,7 @@ export interface VirtualCurrencySnapshotItem {
|
|
|
213
213
|
id: number | string;
|
|
214
214
|
tag: 'virtual_currency';
|
|
215
215
|
product_id?: number | string;
|
|
216
|
+
code?: string;
|
|
216
217
|
product_name: string;
|
|
217
218
|
par_value: string;
|
|
218
219
|
used_par_value: string;
|
|
@@ -448,6 +449,17 @@ export interface ReplaceTempOrderOptions {
|
|
|
448
449
|
recalculateSummary?: boolean;
|
|
449
450
|
persist?: boolean;
|
|
450
451
|
saveDraft?: boolean;
|
|
452
|
+
/** Internal same-order updates may explicitly retain an anonymous order's session. */
|
|
453
|
+
preserveOrderSessionId?: string;
|
|
454
|
+
}
|
|
455
|
+
export interface OrderSessionChangedPayload {
|
|
456
|
+
sessionId: string | null;
|
|
457
|
+
previousSessionId: string | null;
|
|
458
|
+
}
|
|
459
|
+
export interface HydrateTempOrderOptions {
|
|
460
|
+
recalcOnHydrate?: boolean;
|
|
461
|
+
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
462
|
+
preserveOrderSessionId?: string;
|
|
451
463
|
}
|
|
452
464
|
export type AddProductBookingInput = Record<string, any>;
|
|
453
465
|
/**
|
|
@@ -459,13 +471,20 @@ export interface AddProductToOrderOptions {
|
|
|
459
471
|
/** Associates a selection with an existing runtime voucher group. */
|
|
460
472
|
productVoucherGroupKey?: string;
|
|
461
473
|
insertAfterProductUid?: string;
|
|
474
|
+
/** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
|
|
475
|
+
insertAtStart?: boolean;
|
|
462
476
|
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
463
477
|
disableMerge?: boolean;
|
|
464
478
|
/** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
|
|
465
479
|
salesNotes?: SalesNoteDraftInput[];
|
|
466
|
-
/**
|
|
480
|
+
/**
|
|
481
|
+
* 自动预约加购的同步提交门禁;抛错时不发布本次新增。
|
|
482
|
+
* 带门禁时先在私有草稿中准备全部商品/booking,异步等待后及原子发布前重新调用。
|
|
483
|
+
* 门禁须校验当前订单身份/版本和真实时间;发布前不会因本次拆行改变订单版本。
|
|
484
|
+
* 不传时保留原有人工加购行为。
|
|
485
|
+
*/
|
|
467
486
|
availabilityCommitGuard?: () => void;
|
|
468
|
-
/**
|
|
487
|
+
/** 发布后的订单/业务归属检查;只用于阻止旧异步收尾写入新单,不再校验截止或 revision。 */
|
|
469
488
|
availabilityCommitTargetGuard?: () => boolean;
|
|
470
489
|
}
|
|
471
490
|
/** Atomic replacement of one unsubmitted Party booking and its explicitly confirmed retail children. */
|
|
@@ -482,9 +501,9 @@ export interface ReplaceBookingProductWithRelatedRetailParams {
|
|
|
482
501
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
483
502
|
*/
|
|
484
503
|
export interface RemoveProductsFromOrderOptions {
|
|
485
|
-
/**
|
|
504
|
+
/** Validate the selected row/cascade snapshot before mutation; may throw. Not called during finalization. */
|
|
486
505
|
beforeApply?: () => void;
|
|
487
|
-
/**
|
|
506
|
+
/** 自动购物车写入的订单归属检查;失效时不再变更或发布异步收尾结果。 */
|
|
488
507
|
isCurrentOrder?: () => boolean;
|
|
489
508
|
preserveDisplayPosition?: {
|
|
490
509
|
remainingProductUid: string;
|
|
@@ -879,6 +898,10 @@ export interface OrderModuleAPI {
|
|
|
879
898
|
salesSummaryModuleName?: string;
|
|
880
899
|
}) => void;
|
|
881
900
|
getTempOrder: () => OrderTempOrder | null;
|
|
901
|
+
/** Runtime-only identity; never part of an order or a persisted draft. */
|
|
902
|
+
getOrderSessionId: () => string | null;
|
|
903
|
+
/** Also rejects a session while an asynchronous order replacement is pending. */
|
|
904
|
+
isOrderSessionCurrent: (sessionId: string) => boolean;
|
|
882
905
|
ensureTempOrder: () => OrderTempOrder;
|
|
883
906
|
replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
|
|
884
907
|
addNewOrder: () => Promise<OrderTempOrder>;
|
|
@@ -937,7 +960,9 @@ export interface OrderModuleAPI {
|
|
|
937
960
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
938
961
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
939
962
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions) => Promise<OrderProduct[]>;
|
|
940
|
-
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams
|
|
963
|
+
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams, options?: {
|
|
964
|
+
isCurrentOrder?: () => boolean;
|
|
965
|
+
}) => Promise<OrderProduct[]>;
|
|
941
966
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
942
967
|
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
943
968
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
@@ -1008,10 +1033,7 @@ export interface OrderModuleAPI {
|
|
|
1008
1033
|
}) => OrderPaymentData[];
|
|
1009
1034
|
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
1010
1035
|
saveDraft: () => Promise<void>;
|
|
1011
|
-
hydrateTempOrderFromRecord: (record: Record<string, any>, options?:
|
|
1012
|
-
recalcOnHydrate?: boolean;
|
|
1013
|
-
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
1014
|
-
}) => Promise<OrderTempOrder>;
|
|
1036
|
+
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: HydrateTempOrderOptions) => Promise<OrderTempOrder>;
|
|
1015
1037
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
1016
1038
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
1017
1039
|
getLastOrderInfo: () => Record<string, any> | undefined;
|
|
@@ -30,8 +30,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
30
30
|
/**
|
|
31
31
|
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
32
32
|
*
|
|
33
|
-
* -
|
|
34
|
-
* -
|
|
33
|
+
* - 唯一且无规格/套餐的候选:SDK 自动构造商品
|
|
34
|
+
* - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
|
|
35
35
|
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
36
36
|
*
|
|
37
37
|
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud saved orders with no payment rows report a zero gap, even while unpaid.
|
|
3
|
+
* Restore the OS payment target from the same snapshot, without repricing products.
|
|
4
|
+
* Voided rows are local payment history and are omitted from cloud checkout.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeUnpaidOrderAmountGap<T extends Record<string, any>>(order: T): T;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
|
+
import Decimal from 'decimal.js';
|
|
8
|
+
var UNPAID_STATUSES = new Set(['unpaid', 'payment_pending', 'payment_processing']);
|
|
9
|
+
var CANCELLED_STATUSES = new Set(['cancelled', 'canceled', 'voided']);
|
|
10
|
+
function firstValue() {
|
|
11
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12
|
+
values[_key] = arguments[_key];
|
|
13
|
+
}
|
|
14
|
+
return values.find(function (value) {
|
|
15
|
+
return value != null && String(value).trim() !== '';
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function money(value) {
|
|
19
|
+
if (typeof value !== 'string' && typeof value !== 'number') return undefined;
|
|
20
|
+
try {
|
|
21
|
+
var amount = new Decimal(value);
|
|
22
|
+
return amount.isFinite() ? amount : undefined;
|
|
23
|
+
} catch (_unused) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Cloud saved orders with no payment rows report a zero gap, even while unpaid.
|
|
30
|
+
* Restore the OS payment target from the same snapshot, without repricing products.
|
|
31
|
+
* Voided rows are local payment history and are omitted from cloud checkout.
|
|
32
|
+
*/
|
|
33
|
+
export function normalizeUnpaidOrderAmountGap(order) {
|
|
34
|
+
var _firstValue, _order$status, _money2;
|
|
35
|
+
var summary = order.summary && _typeof(order.summary) === 'object' && !Array.isArray(order.summary) ? order.summary : {};
|
|
36
|
+
var status = String((_firstValue = firstValue(order.payment_status, summary.payment_status, order.original_payment_status)) !== null && _firstValue !== void 0 ? _firstValue : '').trim().toLowerCase();
|
|
37
|
+
if (!UNPAID_STATUSES.has(status) || CANCELLED_STATUSES.has(String((_order$status = order.status) !== null && _order$status !== void 0 ? _order$status : '').trim().toLowerCase())) return order;
|
|
38
|
+
if (Array.isArray(order.refunds) && order.refunds.length > 0) return order;
|
|
39
|
+
|
|
40
|
+
// An omitted collection is a sparse patch, not proof that the order has no payments.
|
|
41
|
+
if (!Array.isArray(order.payments) || order.payments.some(function (payment) {
|
|
42
|
+
var _payment$status;
|
|
43
|
+
return String((_payment$status = payment === null || payment === void 0 ? void 0 : payment.status) !== null && _payment$status !== void 0 ? _payment$status : '').trim().toLowerCase() !== 'voided';
|
|
44
|
+
})) return order;
|
|
45
|
+
for (var _i = 0, _arr = ['order_paid_amount', 'customer_paid_amount', 'total_refund_amount', 'paid_amount', 'payment_amount']; _i < _arr.length; _i++) {
|
|
46
|
+
var field = _arr[_i];
|
|
47
|
+
var values = [summary[field], order[field]].filter(function (value) {
|
|
48
|
+
return value != null && String(value).trim() !== '';
|
|
49
|
+
});
|
|
50
|
+
if (values.some(function (value) {
|
|
51
|
+
var _money;
|
|
52
|
+
return !((_money = money(value)) !== null && _money !== void 0 && _money.isZero());
|
|
53
|
+
})) return order;
|
|
54
|
+
}
|
|
55
|
+
var gapValue = firstValue(summary.amount_gap, order.amount_gap);
|
|
56
|
+
if (gapValue !== undefined && !((_money2 = money(gapValue)) !== null && _money2 !== void 0 && _money2.isZero())) return order;
|
|
57
|
+
var expected = money(firstValue(summary.expect_amount, order.expect_amount, summary.total_amount, order.total_amount));
|
|
58
|
+
if (!(expected !== null && expected !== void 0 && expected.gt(0))) return order;
|
|
59
|
+
var target = expected;
|
|
60
|
+
if (Number(order.is_deposit) === 1) {
|
|
61
|
+
var deposit = money(firstValue(summary.deposit_amount, order.deposit_amount, 0));
|
|
62
|
+
if (!deposit || deposit.lt(0) || deposit.gt(expected)) return order;
|
|
63
|
+
if (deposit.gt(0)) target = deposit;
|
|
64
|
+
}
|
|
65
|
+
var amountGap = target.toFixed(2);
|
|
66
|
+
return _objectSpread(_objectSpread({}, order), {}, {
|
|
67
|
+
amount_gap: amountGap,
|
|
68
|
+
summary: _objectSpread(_objectSpread({}, summary), {}, {
|
|
69
|
+
amount_gap: amountGap
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -128,7 +128,9 @@ export declare function getBundleSellingMagnitude(bundle: Record<string, any> |
|
|
|
128
128
|
*
|
|
129
129
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
130
130
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
131
|
-
* (`metadata.source_product_price
|
|
131
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
132
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
133
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
132
134
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
133
135
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
134
136
|
* total(source + option + bundle)对齐。
|
|
@@ -217,6 +219,7 @@ export declare function normalizeBookingSubType(booking: Record<string, any>): s
|
|
|
217
219
|
export declare function normalizeSubmitBooking<T extends {
|
|
218
220
|
metadata?: Record<string, any>;
|
|
219
221
|
}>(booking: T): T;
|
|
222
|
+
export declare function resolveTableOccupancyDuration(tempOrder: OrderTempOrder): number;
|
|
220
223
|
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
221
224
|
export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
|
|
222
225
|
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|