@pisell/pisellos 0.10.8 → 0.10.10
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/core/index.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/OpenData/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +20 -1
- package/dist/modules/Order/index.js +976 -730
- package/dist/modules/Order/types.d.ts +6 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/ResourcePlanner/index.d.ts +0 -22
- package/dist/modules/ResourcePlanner/index.js +1 -180
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/localClock.js +183 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
- package/dist/modules/ResourcePlanner/planner.js +2019 -936
- package/dist/modules/ResourcePlanner/types.d.ts +346 -187
- package/dist/modules/ResourcePlanner/types.js +33 -1
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +90 -58
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +252 -94
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +26 -2
- package/dist/solution/BaseSales/index.js +1310 -931
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +78 -12
- package/dist/solution/BookingByStep/index.d.ts +4 -4
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +225 -161
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +5 -3
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/dist/solution/UnifiedBookingSales/index.js +3349 -971
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/dist/solution/UnifiedBookingSales/types.js +4 -9
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/OpenData/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +20 -1
- package/lib/modules/Order/index.js +393 -128
- package/lib/modules/Order/types.d.ts +6 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/ResourcePlanner/index.d.ts +0 -22
- package/lib/modules/ResourcePlanner/index.js +0 -123
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/localClock.js +270 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
- package/lib/modules/ResourcePlanner/planner.js +1903 -798
- package/lib/modules/ResourcePlanner/types.d.ts +346 -187
- package/lib/modules/ResourcePlanner/types.js +19 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +25 -1
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.js +54 -14
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +66 -2
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +26 -2
- package/lib/solution/BaseSales/index.js +261 -23
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +61 -11
- package/lib/solution/BookingByStep/index.d.ts +4 -4
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +32 -3
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -1
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/lib/solution/UnifiedBookingSales/index.js +2289 -374
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/lib/solution/UnifiedBookingSales/types.js +3 -2
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -65,6 +65,7 @@ export interface AddProductDecideContext extends BookingCalcContext {
|
|
|
65
65
|
type?: 'select' | 'detail';
|
|
66
66
|
quantity?: number;
|
|
67
67
|
customerId?: number | string;
|
|
68
|
+
channel?: string;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* 统一补齐预约商品的运行态字段。
|
|
@@ -13,7 +13,7 @@ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
|
13
13
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
14
14
|
*
|
|
15
15
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
16
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
16
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
17
17
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -30,10 +30,11 @@ function needsSpecDetailModal(item) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
33
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(kiosk 强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
34
34
|
*/
|
|
35
35
|
function needsBookingEdit(cacheItem, ctx) {
|
|
36
36
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
37
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel) === 'kiosk') return true;
|
|
37
38
|
var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
|
|
38
39
|
return true;
|
|
39
40
|
};
|
|
@@ -318,7 +319,7 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
318
319
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
319
320
|
*/
|
|
320
321
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
321
|
-
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
|
|
322
|
+
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2, _cacheItem$metadata$s, _cacheItem$metadata, _extend$metadata;
|
|
322
323
|
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
|
|
323
324
|
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
324
325
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
@@ -347,6 +348,7 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
347
348
|
bundle_edit: extend === null || extend === void 0 ? void 0 : extend.bundle_edit,
|
|
348
349
|
discount_reason: extend === null || extend === void 0 ? void 0 : extend.discount_reason,
|
|
349
350
|
discount_list: cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.discount_list,
|
|
351
|
+
selected_settlement_snapshot: (_cacheItem$metadata$s = cacheItem === null || cacheItem === void 0 || (_cacheItem$metadata = cacheItem.metadata) === null || _cacheItem$metadata === void 0 ? void 0 : _cacheItem$metadata.selected_settlement_snapshot) !== null && _cacheItem$metadata$s !== void 0 ? _cacheItem$metadata$s : extend === null || extend === void 0 || (_extend$metadata = extend.metadata) === null || _extend$metadata === void 0 ? void 0 : _extend$metadata.selected_settlement_snapshot,
|
|
350
352
|
_extend: extend
|
|
351
353
|
};
|
|
352
354
|
}
|
|
@@ -2757,10 +2757,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2757
2757
|
ruleProductsForResource,
|
|
2758
2758
|
occupancyMinutes,
|
|
2759
2759
|
paxBounds,
|
|
2760
|
-
error,
|
|
2761
|
-
_occupancyMinutes,
|
|
2762
|
-
_paxBounds,
|
|
2763
|
-
_error,
|
|
2764
2760
|
occupyDetails,
|
|
2765
2761
|
occupyDetail,
|
|
2766
2762
|
resourceSelectType,
|
|
@@ -2903,59 +2899,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2903
2899
|
});
|
|
2904
2900
|
case 46:
|
|
2905
2901
|
loaded = _context37.sent;
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) pendingRequestPaxMax = paxBounds.max;
|
|
2919
|
-
}
|
|
2920
|
-
} else {
|
|
2921
|
-
this.enabledReservationRuleProducts = [];
|
|
2922
|
-
error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2923
|
-
this.logMethodError('loadReservationRuleProducts', error, {
|
|
2924
|
-
resourceId: normalizedResourceId,
|
|
2925
|
-
reservationLinkIds: reservationLinkIds,
|
|
2926
|
-
scheduleDate: scheduleDate,
|
|
2927
|
-
scheduleDatetime: scheduleDatetime,
|
|
2928
|
-
cacheId: this.cacheId
|
|
2929
|
-
});
|
|
2930
|
-
if (Array.isArray(loaded)) {
|
|
2931
|
-
this.enabledReservationRuleProducts = loaded;
|
|
2932
|
-
_occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
|
|
2933
|
-
if (_occupancyMinutes !== undefined) {
|
|
2934
|
-
tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
|
|
2935
|
-
}
|
|
2936
|
-
if (hasCustomCapacityProduct(loaded)) {
|
|
2937
|
-
pendingRequestEntryPax = 1;
|
|
2938
|
-
_paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
|
|
2939
|
-
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
|
|
2940
|
-
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
|
|
2941
|
-
}
|
|
2942
|
-
} else {
|
|
2943
|
-
this.enabledReservationRuleProducts = [];
|
|
2944
|
-
_error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2945
|
-
this.logMethodError('loadReservationRuleProducts', _error, {
|
|
2946
|
-
resourceId: resourceId,
|
|
2947
|
-
reservationLinkIds: reservationLinkIds,
|
|
2948
|
-
scheduleDate: scheduleDate,
|
|
2949
|
-
scheduleDatetime: scheduleDatetime,
|
|
2950
|
-
cacheId: this.cacheId
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2902
|
+
matchedRuleProduct = findReservationRuleProductByResourceId(loaded, normalizedResourceId);
|
|
2903
|
+
ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
|
|
2904
|
+
this.enabledReservationRuleProducts = ruleProductsForResource;
|
|
2905
|
+
occupancyMinutes = pickFirstDurationMinutesFromProducts(ruleProductsForResource);
|
|
2906
|
+
if (occupancyMinutes !== undefined) {
|
|
2907
|
+
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
2908
|
+
}
|
|
2909
|
+
if (hasCustomCapacityProduct(ruleProductsForResource)) {
|
|
2910
|
+
pendingRequestEntryPax = 1;
|
|
2911
|
+
paxBounds = pickFirstCustomCapacityPaxBounds(ruleProductsForResource);
|
|
2912
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.min) !== undefined) pendingRequestPaxMin = paxBounds.min;
|
|
2913
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) pendingRequestPaxMax = paxBounds.max;
|
|
2953
2914
|
}
|
|
2954
2915
|
|
|
2955
2916
|
// Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
|
|
2956
|
-
_context37.next =
|
|
2917
|
+
_context37.next = 55;
|
|
2957
2918
|
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2958
|
-
case
|
|
2919
|
+
case 55:
|
|
2959
2920
|
occupyDetails = _context37.sent;
|
|
2960
2921
|
occupyDetail = (_occupyDetails$ = occupyDetails[0]) !== null && _occupyDetails$ !== void 0 ? _occupyDetails$ : null; // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2961
2922
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2963,7 +2924,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2963
2924
|
allowAddItems = toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.allow_add_items']);
|
|
2964
2925
|
additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
|
|
2965
2926
|
if (!(additionalOrderResult.reason === 'multiple_orders')) {
|
|
2966
|
-
_context37.next =
|
|
2927
|
+
_context37.next = 66;
|
|
2967
2928
|
break;
|
|
2968
2929
|
}
|
|
2969
2930
|
multipleOrdersState = _objectSpread(_objectSpread({}, this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId)), {}, {
|
|
@@ -2984,7 +2945,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2984
2945
|
resourceSelectType: resourceSelectType
|
|
2985
2946
|
});
|
|
2986
2947
|
return _context37.abrupt("return", _availabilityInfo);
|
|
2987
|
-
case
|
|
2948
|
+
case 66:
|
|
2988
2949
|
// Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
|
|
2989
2950
|
resourceState = this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId);
|
|
2990
2951
|
additionalOrderId = additionalOrderResult.order_id;
|
|
@@ -3030,12 +2991,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3030
2991
|
|
|
3031
2992
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
3032
2993
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
3033
|
-
_context37.next =
|
|
2994
|
+
_context37.next = 78;
|
|
3034
2995
|
break;
|
|
3035
2996
|
}
|
|
3036
|
-
_context37.next =
|
|
2997
|
+
_context37.next = 78;
|
|
3037
2998
|
return this.addNewOrder();
|
|
3038
|
-
case
|
|
2999
|
+
case 78:
|
|
3039
3000
|
isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
|
|
3040
3001
|
if (isAdditionalOrderMode) {
|
|
3041
3002
|
tempOrder.order_id = additionalOrderId;
|
|
@@ -3051,13 +3012,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3051
3012
|
} : {}));
|
|
3052
3013
|
return acc;
|
|
3053
3014
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
3054
|
-
_context37.next =
|
|
3015
|
+
_context37.next = 84;
|
|
3055
3016
|
return this.setItemRuleRuntimeConfig({
|
|
3056
3017
|
serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
3057
3018
|
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
3058
3019
|
historicalItems: historicalItems
|
|
3059
3020
|
});
|
|
3060
|
-
case
|
|
3021
|
+
case 84:
|
|
3061
3022
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
3062
3023
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
3063
3024
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -3079,18 +3040,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3079
3040
|
isFull: resourceState.isFull
|
|
3080
3041
|
});
|
|
3081
3042
|
return _context37.abrupt("return", availabilityInfo);
|
|
3082
|
-
case
|
|
3083
|
-
_context37.prev =
|
|
3043
|
+
case 89:
|
|
3044
|
+
_context37.prev = 89;
|
|
3084
3045
|
_context37.t0 = _context37["catch"](3);
|
|
3085
3046
|
this.logMethodError('checkResourceAvailable', _context37.t0.message, {
|
|
3086
3047
|
resourceId: normalizedResourceId
|
|
3087
3048
|
});
|
|
3088
3049
|
throw _context37.t0;
|
|
3089
|
-
case
|
|
3050
|
+
case 93:
|
|
3090
3051
|
case "end":
|
|
3091
3052
|
return _context37.stop();
|
|
3092
3053
|
}
|
|
3093
|
-
}, _callee37, this, [[3,
|
|
3054
|
+
}, _callee37, this, [[3, 89]]);
|
|
3094
3055
|
}));
|
|
3095
3056
|
function checkResourceAvailable(_x20) {
|
|
3096
3057
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { Module } from '../../types';
|
|
1
|
+
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import type { ProductData } from '../../modules';
|
|
3
3
|
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
5
|
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
7
|
+
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
8
|
import { BookingTicket } from '../BookingTicket';
|
|
9
9
|
export * from './types';
|
|
10
|
+
export { AvailabilityError } from '../../modules/ResourcePlanner';
|
|
10
11
|
/**
|
|
11
12
|
* Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
|
|
12
13
|
* candidate-card state separate from line-level applications: a selected card is not proof that
|
|
@@ -22,39 +23,37 @@ export declare function buildPlannerDiscountResult(params: {
|
|
|
22
23
|
preferredDiscountId?: number | string;
|
|
23
24
|
preferredDiscountFound?: boolean;
|
|
24
25
|
}): UnifiedBookingSalesDiscountResult;
|
|
25
|
-
/** Converts
|
|
26
|
-
export declare function
|
|
26
|
+
/** Converts ProductList and schedule records into the pure Availability vocabulary. */
|
|
27
|
+
export declare function normalizeProductForAvailability(product: ProductData | Record<string, any>, scheduleList?: ScheduleItem[], fixedOffsetMinutes?: number): AvailabilityProduct;
|
|
27
28
|
/**
|
|
28
29
|
* Materializes resource work windows locally from v2's schedule ids, then keeps its flat
|
|
29
|
-
* event_list as
|
|
30
|
+
* event_list as resource occupancy records. This deliberately avoids the older API's times -> event_list
|
|
30
31
|
* response nesting and lets one resource response serve any requested date range.
|
|
31
32
|
*/
|
|
32
|
-
export declare function
|
|
33
|
+
export declare function buildAvailabilityResourcesFromV2(params: {
|
|
33
34
|
rawResources: Record<string, any>[];
|
|
34
35
|
scheduleList: ScheduleItem[];
|
|
35
|
-
dateRange?:
|
|
36
|
+
dateRange?: AvailabilityDateRange;
|
|
37
|
+
fixedOffsetMinutes?: number;
|
|
36
38
|
}): {
|
|
37
|
-
resources:
|
|
38
|
-
|
|
39
|
+
resources: AvailabilityResource[];
|
|
40
|
+
resourceOccupancies: AvailabilityOccupancy[];
|
|
39
41
|
};
|
|
40
42
|
/** Combines URL-locked resources with every resource referenced by the selected products. */
|
|
41
|
-
export declare function
|
|
42
|
-
|
|
43
|
-
export declare function
|
|
44
|
-
assignment:
|
|
45
|
-
product:
|
|
43
|
+
export declare function collectAvailabilityResourceIds(products: AvailabilityProduct[], explicitResourceIds?: Array<number | string>): Array<number | string>;
|
|
44
|
+
export declare function buildAvailabilityLineIdentity(product: Record<string, any>): Record<string, any>;
|
|
45
|
+
export declare function buildBookingFromAvailabilityAssignment(params: {
|
|
46
|
+
assignment: Record<string, any>;
|
|
47
|
+
product: AvailabilityProduct;
|
|
48
|
+
timezone?: string;
|
|
49
|
+
fixedOffsetMinutes?: number;
|
|
46
50
|
}): Record<string, any>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare function buildBookingFromAssignments(params: {
|
|
53
|
-
assignments: ResourcePlannerAssignment[];
|
|
54
|
-
product: ResourcePlannerProduct;
|
|
51
|
+
export declare function buildBookingFromAvailabilityAssignments(params: {
|
|
52
|
+
assignments: Record<string, any>[];
|
|
53
|
+
product: AvailabilityProduct;
|
|
54
|
+
timezone?: string;
|
|
55
|
+
fixedOffsetMinutes?: number;
|
|
55
56
|
}): Record<string, any>;
|
|
56
|
-
/** Builds the exact identity BaseSales needs to remove only this solution's order lines. */
|
|
57
|
-
export declare function buildPlannerLineIdentity(product: Record<string, any>): Record<string, any>;
|
|
58
57
|
export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
59
58
|
protected defaultName: string;
|
|
60
59
|
protected defaultVersion: string;
|
|
@@ -63,7 +62,52 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
63
62
|
private openDataTarget;
|
|
64
63
|
private loadOpenDataInFlight;
|
|
65
64
|
private loadOpenDataInFlightTarget;
|
|
65
|
+
private availabilityRuntimeOffsetMinutes;
|
|
66
|
+
private availabilityScheduleCatalog;
|
|
67
|
+
private availabilityProjectionSequence;
|
|
68
|
+
private availabilityContextSequence;
|
|
69
|
+
private availabilityLifecycleGeneration;
|
|
70
|
+
private availabilityContextRegistry;
|
|
71
|
+
private availabilityProjectionPool;
|
|
72
|
+
private availabilityPrepareInFlight;
|
|
73
|
+
private availabilityProjectionRefreshInFlight;
|
|
74
|
+
private availabilityRemoteOccupancyCache;
|
|
75
|
+
private availabilityRemoteResourceQueryInFlight;
|
|
76
|
+
private availabilityRemoteResourceQuerySequence;
|
|
77
|
+
private availabilityRemoteResourceEpoch;
|
|
78
|
+
private availabilityCommitLocks;
|
|
79
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
66
80
|
protected getSubmitOrderSalesChannel(): string;
|
|
81
|
+
private createAvailabilityFacadeError;
|
|
82
|
+
private getAvailabilityScopeDescriptor;
|
|
83
|
+
private normalizeAvailabilityIdList;
|
|
84
|
+
private normalizeAvailabilityStringList;
|
|
85
|
+
private normalizeAvailabilityPrepareDescriptor;
|
|
86
|
+
private resolveAvailabilityPrepareDefaults;
|
|
87
|
+
private buildAvailabilityPrepareKey;
|
|
88
|
+
private clearAvailabilityRemoteResourceState;
|
|
89
|
+
private buildAvailabilityRemoteResourceScopeKey;
|
|
90
|
+
private buildAvailabilityRemoteResourceQueryKey;
|
|
91
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
92
|
+
cover?: boolean;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
destroy(): Promise<void>;
|
|
95
|
+
private createAvailabilityContextId;
|
|
96
|
+
private buildAvailabilityProjectionKey;
|
|
97
|
+
private getAvailabilityRuntimeOffsetMinutes;
|
|
98
|
+
private getAvailabilityRuntimeDateTime;
|
|
99
|
+
private cloneAvailabilityPrepareParams;
|
|
100
|
+
private getAvailabilityDurationCandidateAnchorAt;
|
|
101
|
+
private createAvailabilityContextRef;
|
|
102
|
+
private emitAvailabilityDiagnostic;
|
|
103
|
+
private touchAvailabilityContext;
|
|
104
|
+
private touchAvailabilityProjection;
|
|
105
|
+
private removeAvailabilityProjection;
|
|
106
|
+
private removeAvailabilityContext;
|
|
107
|
+
private evictAvailabilityProjectionPool;
|
|
108
|
+
private evictAvailabilityContextRegistry;
|
|
109
|
+
private invalidateAvailabilityContextsAfterCommit;
|
|
110
|
+
private resetAvailabilityProjectionState;
|
|
67
111
|
protected isSessionStoragePersistEnabled(): boolean;
|
|
68
112
|
protected shouldUseSessionStorageForSubModule(moduleName?: string): boolean;
|
|
69
113
|
/**
|
|
@@ -133,17 +177,10 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
133
177
|
* diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
|
|
134
178
|
*/
|
|
135
179
|
applyPlannerDiscounts(params?: UnifiedBookingSalesApplyPlannerDiscountsParams): Promise<UnifiedBookingSalesDiscountResult>;
|
|
136
|
-
/** ResourcePlanner is a required child module; fail early instead of producing partial availability. */
|
|
137
|
-
private getPlanner;
|
|
138
180
|
private buildUnifiedOrderProduct;
|
|
139
181
|
/** Replacing a staged selection is idempotent and never removes unrelated cart lines. */
|
|
140
182
|
private removeExistingStagedLines;
|
|
141
183
|
private stageProducts;
|
|
142
|
-
/**
|
|
143
|
-
* Adds the current product choice to an otherwise clean planner cart without creating bookings.
|
|
144
|
-
* This separates "what the customer wants" from the later time/resource confirmation step.
|
|
145
|
-
*/
|
|
146
|
-
stagePlannerProducts(params: UnifiedBookingSalesStagePlannerProductsParams): Promise<Record<string, any> | null>;
|
|
147
184
|
/**
|
|
148
185
|
* Adds ordinary retail products without asking ResourcePlanner for booking facts.
|
|
149
186
|
* Its staged lines have separate ownership so planner and retail skins can coexist safely.
|
|
@@ -155,50 +192,50 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
155
192
|
* "replace the staged selection" for demo and wizard-like callers.
|
|
156
193
|
*/
|
|
157
194
|
addRetailProduct(params: UnifiedBookingSalesAddRetailProductParams): Promise<Record<string, any>[]>;
|
|
158
|
-
|
|
159
|
-
private
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*/
|
|
166
|
-
private ensurePlannerSchedulesForResources;
|
|
195
|
+
private normalizeAvailabilityDateRange;
|
|
196
|
+
private assertAvailabilityPrepareParams;
|
|
197
|
+
private captureAvailabilityScheduleCatalog;
|
|
198
|
+
/** Returns the solution-lifetime schedule snapshot captured after initialization. */
|
|
199
|
+
private getAvailabilityScheduleCatalog;
|
|
200
|
+
private buildAvailabilityOperatingHoursSnapshot;
|
|
201
|
+
private loadAvailabilityProducts;
|
|
167
202
|
/**
|
|
168
203
|
* Fetches resource metadata plus flat occupied events. Work windows are intentionally derived
|
|
169
|
-
* locally in
|
|
204
|
+
* locally in buildAvailabilityResourcesFromV2 from /schedule, rather than requested from the legacy
|
|
170
205
|
* resource dates endpoint.
|
|
171
206
|
*/
|
|
172
|
-
private
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
private
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
private fetchAvailabilityResourcesV2;
|
|
208
|
+
private fetchAndPublishAvailabilityResourcesV2;
|
|
209
|
+
private refreshAvailabilityRemoteResourceQuery;
|
|
210
|
+
private loadAvailabilityResources;
|
|
211
|
+
private resolveEditingOccupancyExclusions;
|
|
212
|
+
private occupancyIsExcluded;
|
|
213
|
+
private collectCartResourceOccupancies;
|
|
214
|
+
private getCurrentOrderRevision;
|
|
215
|
+
private getAvailabilityContextEntry;
|
|
216
|
+
private getAvailabilityProjectionByKey;
|
|
217
|
+
private getActiveAvailabilityProjectionEntry;
|
|
218
|
+
private decorateAvailabilityCandidate;
|
|
219
|
+
private assertAvailabilityCandidateFreshness;
|
|
220
|
+
private assertContextualQueryFreshness;
|
|
221
|
+
private storeAvailabilityProjectionEntry;
|
|
222
|
+
private buildAvailabilityProjectionSnapshot;
|
|
223
|
+
private getSharedPreparedAvailabilitySnapshot;
|
|
224
|
+
private refreshAvailabilityContextProjection;
|
|
225
|
+
private ensureAvailabilityContextProjection;
|
|
226
|
+
private tryAcquireAvailabilityCommitLock;
|
|
227
|
+
private releaseAvailabilityCommitLock;
|
|
228
|
+
/** IO boundary: loads catalog, schedules, resources, occupancies, and registers one context. */
|
|
229
|
+
prepareAvailabilityProjection(params: UnifiedBookingSalesPrepareAvailabilityProjectionParams): Promise<AvailabilityContextRef>;
|
|
230
|
+
/** Pure configuration calculation over the current context projection. */
|
|
231
|
+
getProductTimeRanges(contextId: string, request?: GetProductTimeRangesRequest): Promise<ContextualProductTimeRangeGroup[]>;
|
|
232
|
+
/** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
|
|
233
|
+
queryBookingAvailability(contextId: string, request: ContextualAvailabilityQuery): Promise<ContextualAvailabilityQueryResult>;
|
|
234
|
+
releaseAvailabilityContext(contextId: string): void;
|
|
235
|
+
private assertAvailabilityCommitWriteCAS;
|
|
236
|
+
private findProductLineByUid;
|
|
237
|
+
private findLinkedBooking;
|
|
238
|
+
/** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
|
|
239
|
+
commitAvailabilitySelection(contextId: string, params: ContextualCommitAvailabilitySelectionParams): Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
|
|
203
240
|
}
|
|
204
241
|
export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;
|