@pisell/pisellos 2.3.195 → 2.3.196
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/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 +6 -0
- package/dist/modules/BookingContext/utils/productExtend.js +21 -0
- package/dist/modules/ResourcePlanner/planner.js +24 -0
- package/dist/modules/ResourcePlanner/types.d.ts +7 -0
- package/dist/server/index.js +27 -17
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +8 -4
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +14 -2
- package/dist/solution/UnifiedBookingSales/index.js +1619 -1335
- 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 +6 -0
- package/lib/modules/BookingContext/utils/productExtend.js +23 -0
- package/lib/modules/ResourcePlanner/planner.js +23 -0
- package/lib/modules/ResourcePlanner/types.d.ts +7 -0
- package/lib/server/index.js +5 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +4 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +33 -3
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +14 -2
- package/lib/solution/UnifiedBookingSales/index.js +139 -3
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import type { BookingCalcContext } from './productExtend';
|
|
3
|
+
export declare function isManualBookingProduct(product: any): boolean;
|
|
4
|
+
export declare function getCalendarBookingRange(product: any, ctx?: BookingCalcContext): {
|
|
5
|
+
startAt: string;
|
|
6
|
+
endAt: string;
|
|
7
|
+
duration: number;
|
|
8
|
+
startDate: dayjs.Dayjs;
|
|
9
|
+
endDate: dayjs.Dayjs;
|
|
10
|
+
} | undefined;
|
|
11
|
+
/** A prepared calendar cache is reused after SKU input; no availability-driven replacement is allowed. */
|
|
12
|
+
export declare function prepareCalendarBookingCacheItem(cacheItem: any, ctx: BookingCalcContext): any;
|
|
13
|
+
export declare function calendarBookingEntryKey(ctx: BookingCalcContext): string;
|
|
14
|
+
export declare function calendarBookingNeedsInput(cacheItem: any): boolean;
|
|
15
|
+
export declare function calendarBookingPreparationKey(cacheItem: any, ctx: BookingCalcContext): string;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.calendarBookingEntryKey = calendarBookingEntryKey;
|
|
7
|
+
exports.calendarBookingNeedsInput = calendarBookingNeedsInput;
|
|
8
|
+
exports.calendarBookingPreparationKey = calendarBookingPreparationKey;
|
|
9
|
+
exports.getCalendarBookingRange = getCalendarBookingRange;
|
|
10
|
+
exports.isManualBookingProduct = isManualBookingProduct;
|
|
11
|
+
exports.prepareCalendarBookingCacheItem = prepareCalendarBookingCacheItem;
|
|
12
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
13
|
+
var _localClock = require("../../ResourcePlanner/localClock");
|
|
14
|
+
var _serviceTimes = require("./serviceTimes");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function isManualBookingProduct(product) {
|
|
17
|
+
return !(0, _serviceTimes.isBookingProduct)(product) && Boolean(product?.extension_type === 'product_appointment' || product?.product_resource?.resources?.some(group => Number(group.status) === 1) || ['custom', 'package'].includes(product?.capacity?.type));
|
|
18
|
+
}
|
|
19
|
+
function getCalendarBookingRange(product, ctx) {
|
|
20
|
+
const range = ctx?.bookingTimeRangeFromCalendar;
|
|
21
|
+
if (!range || ctx?.platform !== 'pos' || (0, _serviceTimes.isMultiDayProduct)(product) || product?.duration_type === 'days' || product?.flexible?.duration?.type === 'days' || product?._extend?.sub_type === 'days' || !(0, _serviceTimes.isBookingProduct)(product) && !isManualBookingProduct(product)) return undefined;
|
|
22
|
+
try {
|
|
23
|
+
const offset = (0, _localClock.captureRuntimeOffsetMinutes)();
|
|
24
|
+
const normalize = text => {
|
|
25
|
+
const scalar = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(text));
|
|
26
|
+
const inputOffset = (0, _localClock.extractFixedOffsetMinutes)(text) ?? offset;
|
|
27
|
+
return (0, _localClock.formatLocalDateTime)(scalar + (offset - inputOffset) * 60000, offset);
|
|
28
|
+
};
|
|
29
|
+
const startAt = normalize(range.startAt);
|
|
30
|
+
const endAt = normalize(range.endAt);
|
|
31
|
+
const start = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(startAt));
|
|
32
|
+
const end = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(endAt));
|
|
33
|
+
const duration = (end - start) / 60000;
|
|
34
|
+
if (!Number.isInteger(duration) || duration <= 0 || start % 60000 || end % 60000) throw new Error();
|
|
35
|
+
return {
|
|
36
|
+
startAt,
|
|
37
|
+
endAt,
|
|
38
|
+
duration,
|
|
39
|
+
startDate: (0, _dayjs.default)(startAt.slice(0, 19)),
|
|
40
|
+
endDate: (0, _dayjs.default)(endAt.slice(0, 19))
|
|
41
|
+
};
|
|
42
|
+
} catch {
|
|
43
|
+
throw Object.assign(new Error('Calendar booking requires valid complete start/end times.'), {
|
|
44
|
+
code: 'INVALID_TARGET_FILTER'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A prepared calendar cache is reused after SKU input; no availability-driven replacement is allowed. */
|
|
50
|
+
function prepareCalendarBookingCacheItem(cacheItem, ctx) {
|
|
51
|
+
let range = getCalendarBookingRange(cacheItem, ctx);
|
|
52
|
+
if (!range) return cacheItem;
|
|
53
|
+
const resource = {};
|
|
54
|
+
const forms = (cacheItem.product_resource?.resources || []).filter(group => Number(group.status) === 1);
|
|
55
|
+
const entry = Number(ctx.resourceIdFromCalendar);
|
|
56
|
+
const preserveInput = cacheItem._data?.calendarBookingEntryKey === calendarBookingEntryKey(ctx);
|
|
57
|
+
let inputInvalid = false;
|
|
58
|
+
if (preserveInput) {
|
|
59
|
+
const ext = cacheItem._extend || {};
|
|
60
|
+
try {
|
|
61
|
+
if (!(ext.start_date ?? ext.startDate) || !(ext.end_date ?? ext.endDate) || !ext.start_time || !ext.end_time) throw new Error('Incomplete calendar input.');
|
|
62
|
+
range = getCalendarBookingRange(cacheItem, {
|
|
63
|
+
...ctx,
|
|
64
|
+
bookingTimeRangeFromCalendar: {
|
|
65
|
+
startAt: `${(0, _dayjs.default)(ext.start_date ?? ext.startDate).format('YYYY-MM-DD')}T${ext.start_time}:00`,
|
|
66
|
+
endAt: `${(0, _dayjs.default)(ext.end_date ?? ext.endDate).format('YYYY-MM-DD')}T${ext.end_time}:00`
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
} catch {
|
|
70
|
+
range = undefined;
|
|
71
|
+
inputInvalid = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
for (const form of forms) {
|
|
75
|
+
const ids = [...(form.optional_resource || []), ...(form.default_resource || [])];
|
|
76
|
+
const linked = ids.some(id => String(id) === String(entry));
|
|
77
|
+
const origin = ctx.resourcesOriginMap?.[entry];
|
|
78
|
+
const chosen = cacheItem._extend?.resource?.[String(form.id)];
|
|
79
|
+
const hasChosen = preserveInput && chosen !== undefined;
|
|
80
|
+
const validChosen = hasChosen && Array.isArray(chosen) && new Set(chosen.map(row => String(row.relation_id))).size === chosen.length && chosen.every(row => (row.form_id == null || String(row.form_id) === String(form.id)) && (Number(row.relation_id) === 0 || ids.some(id => String(id) === String(row.relation_id)) && ctx.resourcesOriginMap?.[row.relation_id] && (ctx.resourcesOriginMap[row.relation_id].form_id == null || String(ctx.resourcesOriginMap[row.relation_id].form_id) === String(form.id))));
|
|
81
|
+
if (hasChosen && !validChosen) inputInvalid = true;
|
|
82
|
+
if (hasChosen) {
|
|
83
|
+
resource[String(form.id)] = validChosen ? chosen : [];
|
|
84
|
+
} else if (linked && origin && (origin.form_id == null || String(origin.form_id) === String(form.id))) {
|
|
85
|
+
resource[String(form.id)] = [{
|
|
86
|
+
relation_type: origin.relation_type || 'form',
|
|
87
|
+
form_id: form.id,
|
|
88
|
+
relation_id: entry,
|
|
89
|
+
like_status: 'common',
|
|
90
|
+
metadata: {
|
|
91
|
+
form_name: form.title,
|
|
92
|
+
resource_name: origin.main_field
|
|
93
|
+
}
|
|
94
|
+
}];
|
|
95
|
+
} else {
|
|
96
|
+
resource[String(form.id)] = [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...cacheItem,
|
|
101
|
+
...(isManualBookingProduct(cacheItem) && range ? {
|
|
102
|
+
duration: {
|
|
103
|
+
type: 'minutes',
|
|
104
|
+
value: range.duration
|
|
105
|
+
}
|
|
106
|
+
} : {}),
|
|
107
|
+
_data: {
|
|
108
|
+
...cacheItem._data,
|
|
109
|
+
calendarBookingInputInvalid: inputInvalid
|
|
110
|
+
},
|
|
111
|
+
_extend: {
|
|
112
|
+
...cacheItem._extend,
|
|
113
|
+
...(range ? {
|
|
114
|
+
startDate: range.startDate,
|
|
115
|
+
start_date: range.startDate,
|
|
116
|
+
start_time: range.startAt.slice(11, 16),
|
|
117
|
+
endDate: range.endDate,
|
|
118
|
+
end_date: range.endDate,
|
|
119
|
+
end_time: range.endAt.slice(11, 16),
|
|
120
|
+
duration: range.duration
|
|
121
|
+
} : {}),
|
|
122
|
+
resource
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function calendarBookingEntryKey(ctx) {
|
|
127
|
+
return JSON.stringify([ctx.bookingTimeRangeFromCalendar, ctx.resourceIdFromCalendar]);
|
|
128
|
+
}
|
|
129
|
+
function calendarBookingNeedsInput(cacheItem) {
|
|
130
|
+
if (cacheItem._data?.calendarBookingInputInvalid) return true;
|
|
131
|
+
const capacity = cacheItem.capacity;
|
|
132
|
+
if (capacity?.type === 'custom' && (!Array.isArray(capacity.custom) || !capacity.custom.length || capacity.custom.some(item => !Number.isFinite(Number(item.min)) || item.max == null || Number(item.min) !== Number(item.max)))) return true;
|
|
133
|
+
const groups = cacheItem.product_resource?.resources;
|
|
134
|
+
if (groups != null && !Array.isArray(groups)) return true;
|
|
135
|
+
const seen = new Set();
|
|
136
|
+
return (groups || []).some(group => {
|
|
137
|
+
if (Number(group.status) === 0) return false;
|
|
138
|
+
if (group.id == null || seen.has(String(group.id))) return true;
|
|
139
|
+
seen.add(String(group.id));
|
|
140
|
+
const rule = group.select_type;
|
|
141
|
+
if (Number(group.status) !== 1 || !rule || !['single', 'multiple'].includes(rule.type)) return true;
|
|
142
|
+
const min = Number(rule.min ?? (rule.type === 'single' ? 1 : NaN));
|
|
143
|
+
const max = Number(rule.max ?? (rule.type === 'single' ? 1 : NaN));
|
|
144
|
+
const rows = cacheItem._extend?.resource?.[String(group.id)];
|
|
145
|
+
const required = group.required ?? true;
|
|
146
|
+
const minimum = Math.max(required ? 1 : 0, min);
|
|
147
|
+
return !Number.isInteger(min) || !Number.isInteger(max) || min < 0 || max < minimum || !Array.isArray(rows) || rows.length < minimum || rows.length > max;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function calendarBookingPreparationKey(cacheItem, ctx) {
|
|
151
|
+
const identities = rows => (rows || []).map(row => [row.group_id ?? row.option_group_id ?? row.bundle_group_id, row.product_option_item_id ?? row.option_group_item_id ?? row.id, row._bundle_product_id ?? row.bundle_product_id, row.product_variant_id ?? row.bundle_variant_id, row.quantity ?? row.num ?? 1, identities(row.option)]).sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
|
|
152
|
+
const sku = cacheItem._extend?.other || {};
|
|
153
|
+
const ext = cacheItem._extend || {};
|
|
154
|
+
const dateKey = value => value == null || value === '' ? null : (0, _dayjs.default)(value).format('YYYY-MM-DD');
|
|
155
|
+
return JSON.stringify([ctx.bookingTimeRangeFromCalendar, ctx.resourceIdFromCalendar, cacheItem.capacity, cacheItem.product_resource, sku.product_variant_id ?? sku.variant_id, identities(sku.option), identities(sku.bundle), dateKey(ext.start_date ?? ext.startDate), ext.start_time, dateKey(ext.end_date ?? ext.endDate), ext.end_time, Object.entries(ext.resource || {}).map(([formId, rows]) => [formId, Array.isArray(rows) ? rows.map(row => [row.form_id, row.relation_id]) : null])]);
|
|
156
|
+
}
|
|
@@ -6,6 +6,7 @@ export * from './resources';
|
|
|
6
6
|
export * from './resourceSelection';
|
|
7
7
|
export * from './resourceErrors';
|
|
8
8
|
export * from './productExtend';
|
|
9
|
+
export * from './calendarBooking';
|
|
9
10
|
export * from './cacheItemToBookingInput';
|
|
10
11
|
export * from './buildCacheItemFromOrderLine';
|
|
11
12
|
export * from './buildNormalProductCacheItemFromOrderLine';
|
|
@@ -91,6 +91,17 @@ Object.keys(_productExtend).forEach(function (key) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
+
var _calendarBooking = require("./calendarBooking");
|
|
95
|
+
Object.keys(_calendarBooking).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _calendarBooking[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _calendarBooking[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
94
105
|
var _cacheItemToBookingInput = require("./cacheItemToBookingInput");
|
|
95
106
|
Object.keys(_cacheItemToBookingInput).forEach(function (key) {
|
|
96
107
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -7,6 +7,12 @@ import { TimeSlicesResult, TimeSlice, DurationSlice } from './timeSlices';
|
|
|
7
7
|
* 让 OS 这层完全可在 Node 单测下运行(dayjs 在 Node 也是纯函数)。
|
|
8
8
|
*/
|
|
9
9
|
export interface BookingCalcContext {
|
|
10
|
+
/** Real runtime platform, injected by BookingTicket rather than inferred from sales channel. */
|
|
11
|
+
platform?: string;
|
|
12
|
+
bookingTimeRangeFromCalendar?: {
|
|
13
|
+
startAt: string;
|
|
14
|
+
endAt: string;
|
|
15
|
+
};
|
|
10
16
|
/** Sales channel; remembered duration starts are accepted only by POS. */
|
|
11
17
|
channel?: string;
|
|
12
18
|
/** Current in-memory order session, supplied by the owning Order module. */
|
|
@@ -20,6 +20,7 @@ var _resourceSelection = require("./resourceSelection");
|
|
|
20
20
|
var _serviceTimes = require("./serviceTimes");
|
|
21
21
|
var _timeSlices = require("./timeSlices");
|
|
22
22
|
var _flexible = require("./flexible");
|
|
23
|
+
var _calendarBooking = require("./calendarBooking");
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
25
|
/**
|
|
25
26
|
* 上下文(与 info2 state.bookingConfig / state.service / state.date 一一对应)。
|
|
@@ -291,6 +292,28 @@ function getProductExtend(params) {
|
|
|
291
292
|
const {
|
|
292
293
|
isDisabledTime
|
|
293
294
|
} = params;
|
|
295
|
+
if ((0, _calendarBooking.getCalendarBookingRange)(params.cacheItem, params.ctx)) {
|
|
296
|
+
const prepared = (0, _calendarBooking.prepareCalendarBookingCacheItem)(params.cacheItem, params.ctx);
|
|
297
|
+
const capacity = (0, _resources.setDefaultCapacitys)({
|
|
298
|
+
capacitys: prepared.capacity,
|
|
299
|
+
cacheItem: prepared
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
...prepared,
|
|
303
|
+
_extend: {
|
|
304
|
+
...prepared._extend,
|
|
305
|
+
capacity
|
|
306
|
+
},
|
|
307
|
+
_data: {
|
|
308
|
+
...prepared._data,
|
|
309
|
+
capacitys: prepared.capacity,
|
|
310
|
+
calendarManualBooking: params.cacheItem._data?.calendarManualBooking === true || (0, _calendarBooking.isManualBookingProduct)(params.cacheItem),
|
|
311
|
+
calendarBookingEntryKey: (0, _calendarBooking.calendarBookingEntryKey)(params.ctx),
|
|
312
|
+
calendarBookingPreparationKey: (0, _calendarBooking.calendarBookingPreparationKey)(prepared, params.ctx)
|
|
313
|
+
},
|
|
314
|
+
autoClose: !(0, _calendarBooking.calendarBookingNeedsInput)(prepared)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
294
317
|
const hasRememberedTime = params.ctx.rememberedTime !== undefined;
|
|
295
318
|
const cacheItem = hasRememberedTime ? seedRememberedBookingStart(params.cacheItem, params.ctx) : params.cacheItem;
|
|
296
319
|
const ctx = hasRememberedTime ? {
|
|
@@ -1061,6 +1061,19 @@ function getDurationBusinessDate(projection, startAt) {
|
|
|
1061
1061
|
});
|
|
1062
1062
|
return period?.businessDate || startAt.slice(0, 10);
|
|
1063
1063
|
}
|
|
1064
|
+
function getRequestedProductRange(projection, product, request, runtimeOptions, fixedOffsetMinutes) {
|
|
1065
|
+
const range = request.requestedRangesByProductId?.[String(product.id)];
|
|
1066
|
+
if (!runtimeOptions.allowRequestedRanges || !range || product.kind !== 'duration' && product.kind !== 'session') return [];
|
|
1067
|
+
const start = toDateTime(range.startAt);
|
|
1068
|
+
const end = toDateTime(range.endAt);
|
|
1069
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || !Number.isInteger((end - start) / 60000) || end <= start) {
|
|
1070
|
+
throw availabilityError('INVALID_TARGET_FILTER', '手工预约范围必须包含有效起止时间和正整数分钟时长');
|
|
1071
|
+
}
|
|
1072
|
+
const candidate = createDurationTimeRangeWithEnd(product, start, end, projection, fixedOffsetMinutes);
|
|
1073
|
+
candidate.businessDate = getDurationBusinessDate(projection, candidate.startAt);
|
|
1074
|
+
assertRangesWithinProjection(projection, [candidate]);
|
|
1075
|
+
return [candidate];
|
|
1076
|
+
}
|
|
1064
1077
|
function getAlignedDurationRanges(params) {
|
|
1065
1078
|
const {
|
|
1066
1079
|
projection,
|
|
@@ -1221,6 +1234,16 @@ function getProductTimeRanges(projection, request = {}, runtimeOptions = {}) {
|
|
|
1221
1234
|
const resourceWindowIndex = buildResourceWindowIndex(projection, allowExcludedScheduleDateOverride);
|
|
1222
1235
|
const filteredProductIdSet = request.productIds?.length ? new Set(request.productIds.map(String)) : null;
|
|
1223
1236
|
return projection.products.filter(product => !filteredProductIdSet || filteredProductIdSet.has(String(product.id))).map(product => {
|
|
1237
|
+
const requestedRanges = getRequestedProductRange(projection, product, request, runtimeOptions, fixedOffsetMinutes);
|
|
1238
|
+
if (requestedRanges.length > 0) {
|
|
1239
|
+
return {
|
|
1240
|
+
productId: product.id,
|
|
1241
|
+
title: product.title,
|
|
1242
|
+
kind: product.kind,
|
|
1243
|
+
slotStepMinutes,
|
|
1244
|
+
ranges: dedupeProductRanges(requestedRanges)
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1224
1247
|
if (product.kind === 'normal') {
|
|
1225
1248
|
return {
|
|
1226
1249
|
productId: product.id,
|
|
@@ -263,6 +263,11 @@ export interface GetProductTimeRangesRequest {
|
|
|
263
263
|
partySize?: number;
|
|
264
264
|
durationMinutesByProductId?: Record<string, number>;
|
|
265
265
|
durationStartTimesByProductId?: Record<string, string[]>;
|
|
266
|
+
/** Explicit POS manual interval. Endpoints are absolute datetimes, not business-day HH:mm. */
|
|
267
|
+
requestedRangesByProductId?: Record<string, {
|
|
268
|
+
startAt: string;
|
|
269
|
+
endAt: string;
|
|
270
|
+
}>;
|
|
266
271
|
/** Restore only the exact remembered start; recompute the end from current product/windows. */
|
|
267
272
|
rememberedStartAtByProductId?: Record<string, string>;
|
|
268
273
|
/** Order-scoped v2 memory preserves the complete actual booking interval. */
|
|
@@ -300,6 +305,8 @@ export interface GetProductTimeRangesRuntimeOptions {
|
|
|
300
305
|
* disabled.
|
|
301
306
|
*/
|
|
302
307
|
allowSessionCustomRanges?: boolean;
|
|
308
|
+
/** Internal POS manual capability; automatic/remembered selections must leave this disabled. */
|
|
309
|
+
allowRequestedRanges?: boolean;
|
|
303
310
|
/**
|
|
304
311
|
* Internal POS capability: materialize candidates whose schedule date was
|
|
305
312
|
* explicitly excluded, while availability evaluation keeps them unavailable.
|
package/lib/server/index.js
CHANGED
|
@@ -4369,7 +4369,11 @@ class Server {
|
|
|
4369
4369
|
});
|
|
4370
4370
|
return;
|
|
4371
4371
|
}
|
|
4372
|
-
|
|
4372
|
+
let localOrder = await this.order.getLocalOrderByLookup(lookup);
|
|
4373
|
+
const orderId = data?.order_id ?? data?.orderId;
|
|
4374
|
+
if (!localOrder && orderId !== undefined && orderId !== null && orderId !== '' && String(orderId) !== String(lookup)) {
|
|
4375
|
+
localOrder = await this.order.getLocalOrderByLookup(orderId);
|
|
4376
|
+
}
|
|
4373
4377
|
if (!localOrder) {
|
|
4374
4378
|
this.logWarning(`${title}: 本地订单不存在,跳过核销状态更新`, {
|
|
4375
4379
|
lookup,
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 |
|
|
331
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -375,7 +375,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
375
375
|
};
|
|
376
376
|
setOtherData(key: string, value: any): void;
|
|
377
377
|
getOtherData(key: string): any;
|
|
378
|
-
getProductTypeById(id: number): Promise<"
|
|
378
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
379
379
|
/**
|
|
380
380
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
381
381
|
*
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -1623,7 +1623,8 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1623
1623
|
presetStartTime: extra?.presetStartTime ?? (0, _BookingContext.derivePresetStartTimeFromDate)(date),
|
|
1624
1624
|
...(extra || {}),
|
|
1625
1625
|
orderSessionId: this.getOrderSessionId() ?? undefined,
|
|
1626
|
-
isOrderSessionCurrent: sessionId => this.isOrderSessionCurrent(sessionId)
|
|
1626
|
+
isOrderSessionCurrent: sessionId => this.isOrderSessionCurrent(sessionId),
|
|
1627
|
+
platform: String(this.otherParams?.platform || '').trim().toLowerCase()
|
|
1627
1628
|
};
|
|
1628
1629
|
}
|
|
1629
1630
|
|
|
@@ -1717,7 +1718,8 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1717
1718
|
...(extra || {}),
|
|
1718
1719
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1719
1720
|
orderSessionId: this.getOrderSessionId() ?? undefined,
|
|
1720
|
-
isOrderSessionCurrent: sessionId => this.isOrderSessionCurrent(sessionId)
|
|
1721
|
+
isOrderSessionCurrent: sessionId => this.isOrderSessionCurrent(sessionId),
|
|
1722
|
+
platform: String(this.otherParams?.platform || '').trim().toLowerCase()
|
|
1721
1723
|
};
|
|
1722
1724
|
}
|
|
1723
1725
|
|
|
@@ -41,6 +41,8 @@ export declare function decideAfterDetail(cacheItem: any, ctx?: AddProductDecide
|
|
|
41
41
|
* @deprecated 请用 `decideAddProduct`;保留兼容:autoClose=true 仅表示可直接加车(action=add)。
|
|
42
42
|
*/
|
|
43
43
|
export interface AddProductRequiresDetailPayload {
|
|
44
|
+
/** Same prepared decision cache supplied to the Host; never a separate Flow preflight. */
|
|
45
|
+
preparedCacheItem?: any;
|
|
44
46
|
item: ProductData | Record<string, any>;
|
|
45
47
|
/** UI 需展示的子弹窗开关。 */
|
|
46
48
|
showConfig: {
|
|
@@ -15,6 +15,7 @@ exports.prepareBookingCacheItem = prepareBookingCacheItem;
|
|
|
15
15
|
exports.transformDetailToProductAndBooking = transformDetailToProductAndBooking;
|
|
16
16
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
17
17
|
var _BookingContext = require("../../../modules/BookingContext");
|
|
18
|
+
var _resolveUniqueCartDetail = require("./resolveUniqueCartDetail");
|
|
18
19
|
var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
|
|
19
20
|
var _weighingProductSku = require("./weighingProductSku");
|
|
20
21
|
var _platform = require("../../../utils/platform");
|
|
@@ -43,6 +44,7 @@ function needsSpecDetailModal(item) {
|
|
|
43
44
|
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
44
45
|
*/
|
|
45
46
|
function needsBookingEdit(cacheItem, ctx) {
|
|
47
|
+
if ((0, _BookingContext.getCalendarBookingRange)(cacheItem, ctx)) return (0, _BookingContext.calendarBookingNeedsInput)(cacheItem);
|
|
46
48
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
47
49
|
if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
|
|
48
50
|
const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
|
|
@@ -61,13 +63,26 @@ function buildRequiresBookingEditPayload(cacheItem, ctx) {
|
|
|
61
63
|
*/
|
|
62
64
|
function decideAddProduct(item, ctx) {
|
|
63
65
|
const derivedCtx = withDerivedBookingCtx(ctx);
|
|
64
|
-
|
|
66
|
+
const calendarRange = (0, _BookingContext.getCalendarBookingRange)(item, derivedCtx);
|
|
67
|
+
const uniqueValue = calendarRange ? (0, _resolveUniqueCartDetail.resolveUniqueCartDetailValue)(item) : null;
|
|
68
|
+
const selectedItem = uniqueValue ? {
|
|
69
|
+
...item,
|
|
70
|
+
cartDetailValue: uniqueValue,
|
|
71
|
+
isOpenDetailModal: false
|
|
72
|
+
} : item;
|
|
73
|
+
if (needsSpecDetailModal(selectedItem)) {
|
|
74
|
+
const preparedCacheItem = calendarRange ? prepareBookingCacheItem(buildCacheItemFromCartDetail(item, derivedCtx), derivedCtx) : undefined;
|
|
65
75
|
return {
|
|
66
76
|
action: 'requiresDetail',
|
|
67
|
-
payload:
|
|
77
|
+
payload: {
|
|
78
|
+
...buildRequiresDetailPayload(item, derivedCtx),
|
|
79
|
+
...(preparedCacheItem ? {
|
|
80
|
+
preparedCacheItem
|
|
81
|
+
} : {})
|
|
82
|
+
}
|
|
68
83
|
};
|
|
69
84
|
}
|
|
70
|
-
const cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(
|
|
85
|
+
const cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(selectedItem, derivedCtx), derivedCtx);
|
|
71
86
|
if (needsBookingEdit(cacheItem, derivedCtx)) {
|
|
72
87
|
return {
|
|
73
88
|
action: 'requiresBookingEdit',
|
|
@@ -147,6 +162,21 @@ function isMultiDayLike(cacheItem) {
|
|
|
147
162
|
* `_extend.resource / capacity / startDate / endDate` 等后续 booking mapper 需要的字段。
|
|
148
163
|
*/
|
|
149
164
|
function prepareBookingCacheItem(cacheItem, ctx) {
|
|
165
|
+
if ((0, _BookingContext.getCalendarBookingRange)(cacheItem, ctx)) {
|
|
166
|
+
if (cacheItem._data?.calendarBookingPreparationKey === (0, _BookingContext.calendarBookingPreparationKey)(cacheItem, ctx)) return cacheItem;
|
|
167
|
+
return (0, _BookingContext.getProductExtend)({
|
|
168
|
+
cacheItem,
|
|
169
|
+
ctx: ctx,
|
|
170
|
+
isDisabledTime: true
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (ctx?.bookingTimeRangeFromCalendar && (cacheItem.duration?.type === 'days' || cacheItem.duration_type === 'days' || cacheItem._extend?.sub_type === 'days')) {
|
|
174
|
+
ctx = {
|
|
175
|
+
...ctx,
|
|
176
|
+
bookingTimeRangeFromCalendar: undefined,
|
|
177
|
+
resourceIdFromCalendar: undefined
|
|
178
|
+
};
|
|
179
|
+
}
|
|
150
180
|
if (ctx?.rememberedTime === undefined && (isNormalBookingProduct(cacheItem) || hasPreparedBookingExtend(cacheItem))) {
|
|
151
181
|
return cacheItem;
|
|
152
182
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type RecordValue = Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a whole SKU only when the original configuration proves one legal
|
|
4
|
+
* result. A default, a stock-filtered remainder, or missing detail is not proof
|
|
5
|
+
* of uniqueness. The input product and its existing selections stay untouched.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveUniqueCartDetailValue(product: RecordValue): RecordValue | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveUniqueCartDetailValue = resolveUniqueCartDetailValue;
|
|
7
|
+
const flag = value => value === true || value === 1 || value === '1';
|
|
8
|
+
const cleared = value => value === false || value === 0 || value === '0';
|
|
9
|
+
const enabled = item => item && !flag(item.disabled) && !cleared(item.is_enabled) && item.deleted_at == null;
|
|
10
|
+
const sellable = item => enabled(item) && (!flag(item.is_track) || flag(item.over_sold) || Number(item.stock_quantity) > 0);
|
|
11
|
+
const bound = (value, fallback = 0) => {
|
|
12
|
+
if (value == null || value === '') return fallback;
|
|
13
|
+
if (typeof value !== 'number' && typeof value !== 'string') return null;
|
|
14
|
+
const number = Number(value);
|
|
15
|
+
return Number.isInteger(number) && number >= 0 ? number : null;
|
|
16
|
+
};
|
|
17
|
+
const validId = value => (typeof value === 'number' || typeof value === 'string') && Number.isSafeInteger(Number(value)) && Number(value) > 0;
|
|
18
|
+
|
|
19
|
+
/** A choice is unique only if its complete allowed quantity interval is one value. */
|
|
20
|
+
function fixedQuantity(minimums, maximums) {
|
|
21
|
+
const min = Math.max(1, ...minimums);
|
|
22
|
+
const max = Math.min(...maximums.filter(value => value > 0), Infinity);
|
|
23
|
+
return min === max ? min : null;
|
|
24
|
+
}
|
|
25
|
+
function configuredGroups(product, key, countKey) {
|
|
26
|
+
const groups = product[key];
|
|
27
|
+
if (groups == null && product[countKey] == null) return null;
|
|
28
|
+
const count = bound(product[countKey]);
|
|
29
|
+
if (count == null || groups != null && !Array.isArray(groups)) return null;
|
|
30
|
+
if (count > 0 && (!Array.isArray(groups) || groups.length !== count)) return null;
|
|
31
|
+
return groups || [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a whole SKU only when the original configuration proves one legal
|
|
36
|
+
* result. A default, a stock-filtered remainder, or missing detail is not proof
|
|
37
|
+
* of uniqueness. The input product and its existing selections stay untouched.
|
|
38
|
+
*/
|
|
39
|
+
function resolveUniqueCartDetailValue(product) {
|
|
40
|
+
if (!product || !validId(product.id ?? product.product_id) || flag(product.open_sold_weight)) return null;
|
|
41
|
+
const productId = product.id ?? product.product_id;
|
|
42
|
+
const existing = product.cartDetailValue;
|
|
43
|
+
const hasConfiguredSku = flag(product.is_variant) || Number(product.variant_count) > 0 || Number(product.option_group_count) > 0 || Number(product.bundle_group_count) > 0 || product.option_group?.length > 0 || product.bundle_group?.length > 0 || product.bundle_groups?.length > 0 || product.variant_group?.length > 0;
|
|
44
|
+
if (existing && !hasConfiguredSku && !(existing.option?.length || existing.bundle?.length)) {
|
|
45
|
+
return {
|
|
46
|
+
...existing,
|
|
47
|
+
product_id: productId,
|
|
48
|
+
quantity: 1
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const knowsVariantShape = cleared(product.is_variant) || product.variant_count === 0 || product.variant_count === '0' || Array.isArray(product.variant) || Array.isArray(product.variant_group);
|
|
52
|
+
if (!knowsVariantShape) return null;
|
|
53
|
+
const optionGroups = configuredGroups(product, 'option_group', 'option_group_count');
|
|
54
|
+
const bundleKey = product.bundle_group != null ? 'bundle_group' : 'bundle_groups';
|
|
55
|
+
const bundleGroups = configuredGroups(product, bundleKey, 'bundle_group_count');
|
|
56
|
+
if (!optionGroups || !bundleGroups) return null;
|
|
57
|
+
const value = {
|
|
58
|
+
...(product.cartDetailValue || {}),
|
|
59
|
+
product_id: productId,
|
|
60
|
+
product_variant_id: 0,
|
|
61
|
+
option: [],
|
|
62
|
+
bundle: [],
|
|
63
|
+
quantity: 1
|
|
64
|
+
};
|
|
65
|
+
const hasVariant = flag(product.is_variant) || Number(product.variant_count) > 0 || Array.isArray(product.variant_group) && product.variant_group.length > 0 || Array.isArray(product.variant) && product.variant.length > 0;
|
|
66
|
+
if (hasVariant) {
|
|
67
|
+
if (!Array.isArray(product.variant) || product.variant.length !== 1 || Number(product.variant_count) > 0 && Number(product.variant_count) !== 1) return null;
|
|
68
|
+
const [variant] = product.variant;
|
|
69
|
+
if (!validId(variant?.id) || !sellable(variant)) return null;
|
|
70
|
+
value.product_variant_id = variant.id;
|
|
71
|
+
if (variant.price == null || variant.price === '' || !Number.isFinite(Number(variant.price)) || Number(variant.price) < 0) return null;
|
|
72
|
+
value.price = variant.price;
|
|
73
|
+
value.production_code = variant.production_code ?? variant.code ?? '';
|
|
74
|
+
}
|
|
75
|
+
for (const group of optionGroups) {
|
|
76
|
+
// Do not silently remove configured alternatives that are disabled or out of stock.
|
|
77
|
+
if (!validId(group?.id) || !enabled(group) || !Array.isArray(group.option_item) || group.option_item.length !== 1) return null;
|
|
78
|
+
const [item] = group.option_item;
|
|
79
|
+
if (!validId(item?.id) || !sellable(item)) return null;
|
|
80
|
+
const multiple = flag(group.is_multiple);
|
|
81
|
+
const groupMin = bound(group.min_quantity);
|
|
82
|
+
const groupMax = bound(group.max_quantity);
|
|
83
|
+
const itemMin = bound(item.min_quantity);
|
|
84
|
+
const itemMax = bound(item.max_quantity, 1);
|
|
85
|
+
if ([groupMin, groupMax, itemMin, itemMax].some(value => value == null)) return null;
|
|
86
|
+
const advanced = multiple && flag(group.metadata?.advanced_settings_enabled);
|
|
87
|
+
const minTypes = advanced ? bound(group.metadata?.option_types_config?.min) : 0;
|
|
88
|
+
const maxTypes = advanced ? bound(group.metadata?.option_types_config?.max) : 0;
|
|
89
|
+
if (minTypes == null || maxTypes == null || minTypes > 1 || maxTypes > 0 && maxTypes < minTypes) return null;
|
|
90
|
+
const required = multiple ? groupMin > 0 || minTypes > 0 : flag(group.required);
|
|
91
|
+
if (!required) return null;
|
|
92
|
+
const quantity = fixedQuantity([itemMin, ...(multiple ? [groupMin] : [])], [itemMax, ...(multiple ? [groupMax] : [])]);
|
|
93
|
+
if (!quantity) return null;
|
|
94
|
+
const price = item.price ?? item.add_price ?? 0;
|
|
95
|
+
value.option.push({
|
|
96
|
+
...item,
|
|
97
|
+
id: item.id,
|
|
98
|
+
product_option_item_id: item.id,
|
|
99
|
+
option_group_item_id: item.id,
|
|
100
|
+
option_group_id: group.id,
|
|
101
|
+
product_id: productId,
|
|
102
|
+
quantity,
|
|
103
|
+
num: quantity,
|
|
104
|
+
price,
|
|
105
|
+
original_price: price
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
for (const group of bundleGroups) {
|
|
109
|
+
if (!validId(group?.id) || !enabled(group) || !Array.isArray(group.bundle_item) || group.bundle_item.length !== 1) return null;
|
|
110
|
+
const [item] = group.bundle_item;
|
|
111
|
+
if (!validId(item?.id) || !validId(item?.bundle_product_id) || !sellable(item) || item.option_group?.length || item.variant_group?.length || item.variant?.length || item.bundle_group?.length || item.bundle_groups?.length || flag(item.is_variant) || flag(item.open_sold_weight) || Number(item.variant_count) > 0 || Number(item.option_group_count) > 0 || Number(item.bundle_group_count) > 0) return null;
|
|
112
|
+
const groupMin = bound(group.min_quantity);
|
|
113
|
+
const groupMax = bound(group.max_quantity);
|
|
114
|
+
const itemMin = bound(item.min_quantity);
|
|
115
|
+
const itemMax = bound(item.max_quantity);
|
|
116
|
+
if ([groupMin, groupMax, itemMin, itemMax].some(value => value == null) || groupMin <= 0) return null;
|
|
117
|
+
const quantity = fixedQuantity([groupMin, itemMin], [groupMax, itemMax]);
|
|
118
|
+
if (!quantity) return null;
|
|
119
|
+
value.bundle.push({
|
|
120
|
+
...item,
|
|
121
|
+
id: item.id,
|
|
122
|
+
group_id: group.id,
|
|
123
|
+
bundle_group_id: group.id,
|
|
124
|
+
_bundle_product_id: item.bundle_product_id,
|
|
125
|
+
quantity,
|
|
126
|
+
num: quantity,
|
|
127
|
+
option: []
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const key = [productId, value.product_variant_id, ...value.option.map(item => `o${item.option_group_id}:${item.id}:${item.quantity}`), ...value.bundle.map(item => `b${item.group_id}:${item.id}:${item.quantity}`), ...(value.session ? [`s${value.session.key ?? value.session.id ?? ''}`] : [])].join('_');
|
|
131
|
+
return {
|
|
132
|
+
...value,
|
|
133
|
+
key,
|
|
134
|
+
rowKey: key
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -5,8 +5,8 @@ import type { AddProductDecideContext } from '../BookingTicket/utils/addProductD
|
|
|
5
5
|
import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig, type ResolvedSalesSettings } from '../../modules/OpenData';
|
|
6
6
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
7
7
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
8
|
-
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
9
|
-
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesCatalogQueryBatch, UnifiedBookingSalesVenueCatalogSession, UnifiedBookingSalesVenueCatalogSessionParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesQueryBookingResourceDetailsParams, UnifiedBookingSalesResourceDetail, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
|
+
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityRequirementSelection, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
9
|
+
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRange, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesCatalogQueryBatch, UnifiedBookingSalesVenueCatalogSession, UnifiedBookingSalesVenueCatalogSessionParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesQueryBookingResourceDetailsParams, UnifiedBookingSalesResourceDetail, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
10
10
|
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
11
11
|
import { BookingTicket } from '../BookingTicket';
|
|
12
12
|
import type { BaseSalesSubmitSalesOrderParams } from '../BaseSales/types';
|
|
@@ -122,6 +122,18 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
122
122
|
* 仅供直加调用;手动时间选择和 availability candidate 不经过此方法。
|
|
123
123
|
*/
|
|
124
124
|
prepareDirectAddFlexibleBooking(cacheItem: any): Promise<any>;
|
|
125
|
+
/** Reuse an approved calendar cache; only the final commit may mutate the order. */
|
|
126
|
+
prepareDirectAddCalendarBooking(cacheItem: any, options?: {
|
|
127
|
+
bookingCount?: number;
|
|
128
|
+
availabilityCommitGuard?: () => void;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
cacheItem: any;
|
|
131
|
+
contextId: string;
|
|
132
|
+
candidate: ContextualProductTimeRange;
|
|
133
|
+
requirementSelections: AvailabilityRequirementSelection[];
|
|
134
|
+
partySize: number;
|
|
135
|
+
bookingCount: number;
|
|
136
|
+
} | null>;
|
|
125
137
|
private resolveAvailabilityPrepareDefaults;
|
|
126
138
|
private buildAvailabilityPrepareKey;
|
|
127
139
|
private clearAvailabilityRemoteResourceState;
|