@pisell/pisellos 2.3.105 → 2.3.106
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/promotion/index.js +9 -0
- package/dist/modules/Order/index.js +21 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
- package/dist/modules/ResourcePlanner/planner.js +172 -49
- package/dist/modules/ResourcePlanner/types.d.ts +19 -0
- package/dist/modules/Rules/index.js +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +2 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +92 -19
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/index.js +17 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
- package/lib/modules/ResourcePlanner/planner.js +141 -35
- package/lib/modules/ResourcePlanner/types.d.ts +19 -0
- package/lib/modules/Rules/index.js +1 -1
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +2 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +84 -20
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -32,7 +32,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
32
32
|
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); }
|
|
33
33
|
import { BaseModule } from "../BaseModule";
|
|
34
34
|
import { OrderHooks } from "./types";
|
|
35
|
-
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
|
|
35
|
+
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
38
|
import { buildSalesNoteText, decodeSalesNotesSnapshot, getSalesNotePolicy } from "./salesNotes";
|
|
@@ -7347,6 +7347,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7347
7347
|
row.metadata.booking_uid = row.booking_uid;
|
|
7348
7348
|
}
|
|
7349
7349
|
row = restoreHydratedBundleDiscounts(row, normalizeOrderProductDiscountList);
|
|
7350
|
+
var rawOriginalPrice = Number(row.original_price);
|
|
7351
|
+
var rawSellingPrice = Number(row.selling_price);
|
|
7352
|
+
var hasProductDiscounts = Array.isArray(row.discount_list) && row.discount_list.length > 0;
|
|
7353
|
+
var hasBundleDiscounts = row.product_bundle.some(function (bundle) {
|
|
7354
|
+
return Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
|
|
7355
|
+
});
|
|
7356
|
+
var isUndiscountedV2Line = String(row.metadata.price_schema_version) === '2' && Number.isFinite(rawOriginalPrice) && Number.isFinite(rawSellingPrice) && new Decimal(rawOriginalPrice).eq(rawSellingPrice) && !hasProductDiscounts && !hasBundleDiscounts;
|
|
7357
|
+
if (isUndiscountedV2Line) {
|
|
7358
|
+
var hasPriceValue = function hasPriceValue(value) {
|
|
7359
|
+
return value !== undefined && value !== null && value !== '';
|
|
7360
|
+
};
|
|
7361
|
+
row.product_bundle = row.product_bundle.map(function (bundle) {
|
|
7362
|
+
if (!bundle || isMarkdownBundle(bundle) || hasPriceValue(bundle.original_price) || hasPriceValue(bundle.product_price) || !hasPriceValue(bundle.bundle_selling_price)) {
|
|
7363
|
+
return bundle;
|
|
7364
|
+
}
|
|
7365
|
+
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
7366
|
+
original_price: bundle.bundle_selling_price
|
|
7367
|
+
});
|
|
7368
|
+
});
|
|
7369
|
+
}
|
|
7350
7370
|
var existingIdentity = row.metadata.unique_identification_number || row.unique_identification_number;
|
|
7351
7371
|
if (!existingIdentity) {
|
|
7352
7372
|
row.metadata.unique_identification_number = createUuidV4();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AvailabilityProjection, AvailabilityProjectionInput, AvailabilityQuery, AvailabilityQueryResult, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, GetProductTimeRangesRequest, GetProductTimeRangesRuntimeOptions, ProductTimeRangeGroup } from './types';
|
|
2
2
|
export declare function createAvailabilityProjection(input: AvailabilityProjectionInput): AvailabilityProjection;
|
|
3
3
|
export declare function getProductTimeRanges(projection: AvailabilityProjection, request?: GetProductTimeRangesRequest, runtimeOptions?: GetProductTimeRangesRuntimeOptions): ProductTimeRangeGroup[];
|
|
4
|
-
export declare function queryAvailabilityProjection(projection: AvailabilityProjection, request: AvailabilityQuery): AvailabilityQueryResult;
|
|
5
|
-
export declare function validateAvailabilitySelection(projection: AvailabilityProjection, params: AvailabilitySelectionValidationParams): AvailabilitySelectionValidationResult;
|
|
4
|
+
export declare function queryAvailabilityProjection(projection: AvailabilityProjection, request: AvailabilityQuery, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilityQueryResult;
|
|
5
|
+
export declare function validateAvailabilitySelection(projection: AvailabilityProjection, params: AvailabilitySelectionValidationParams, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilitySelectionValidationResult;
|
|
@@ -175,8 +175,70 @@ function addLeadWindow(base, unit, unitType, _timezoneName) {
|
|
|
175
175
|
if (unitType === 'hours') return addLocalHours(base, unit);
|
|
176
176
|
return addLocalMinutes(base, unit);
|
|
177
177
|
}
|
|
178
|
+
function normalizedWindowContainsRange(windows, candidateRange, timezoneName) {
|
|
179
|
+
return windows.some(function (window) {
|
|
180
|
+
var normalized = normalizeAbsoluteRange(window, timezoneName);
|
|
181
|
+
return Boolean(normalized && contains(normalized, candidateRange));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function normalizedWindowsContainDate(windows, date, timezoneName) {
|
|
185
|
+
return windows.some(function (window) {
|
|
186
|
+
var normalized = normalizeAbsoluteRange(window, timezoneName);
|
|
187
|
+
return Boolean(normalized && formatDate(normalized.start, timezoneName) === date);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function isRangeFromExcludedWindows(params) {
|
|
191
|
+
var candidateDate = formatDate(params.candidateRange.start, params.timezoneName);
|
|
192
|
+
var hasNormalWindowOnDate = normalizedWindowsContainDate(params.normalWindows, candidateDate, params.timezoneName);
|
|
193
|
+
var hasExcludedWindowOnDate = normalizedWindowsContainDate(params.excludedWindows, candidateDate, params.timezoneName);
|
|
194
|
+
if (!hasNormalWindowOnDate && hasExcludedWindowOnDate) return true;
|
|
195
|
+
return !normalizedWindowContainsRange(params.normalWindows, params.candidateRange, params.timezoneName) && normalizedWindowContainsRange(params.excludedWindows, params.candidateRange, params.timezoneName);
|
|
196
|
+
}
|
|
197
|
+
function isCandidateFromExcludedScheduleDate(params) {
|
|
198
|
+
var projection = params.projection,
|
|
199
|
+
product = params.product,
|
|
200
|
+
candidate = params.candidate,
|
|
201
|
+
candidateRange = params.candidateRange;
|
|
202
|
+
var operatingHours = projection.meta.defaults.operatingHours;
|
|
203
|
+
if (isRangeFromExcludedWindows({
|
|
204
|
+
normalWindows: operatingHours.windows,
|
|
205
|
+
excludedWindows: operatingHours.excludedWindows || [],
|
|
206
|
+
candidateRange: candidateRange,
|
|
207
|
+
timezoneName: projection.meta.timezone
|
|
208
|
+
})) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (product.kind !== 'session' && product.kind !== 'venue_slot') {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (candidate.source !== 'session_schedule') {
|
|
215
|
+
var hasNormalRule = (product.sessionRules || []).some(function (rule) {
|
|
216
|
+
return matchesScheduleRuleDate(rule, candidate.date, projection.meta.timezone);
|
|
217
|
+
});
|
|
218
|
+
var hasExcludedOverrideRule = (product.sessionRules || []).some(function (rule) {
|
|
219
|
+
return !matchesScheduleRuleDate(rule, candidate.date, projection.meta.timezone) && matchesScheduleRuleDate(rule, candidate.date, projection.meta.timezone, true);
|
|
220
|
+
});
|
|
221
|
+
return !hasNormalRule && hasExcludedOverrideRule;
|
|
222
|
+
}
|
|
223
|
+
var candidateDateRange = {
|
|
224
|
+
startDate: candidate.date,
|
|
225
|
+
endDate: candidate.date
|
|
226
|
+
};
|
|
227
|
+
var candidateIdentity = getProductTimeRangeIdentity(candidate);
|
|
228
|
+
var normalRanges = getSessionRangesForProduct(projection, product, candidateDateRange);
|
|
229
|
+
if (normalRanges.some(function (range) {
|
|
230
|
+
return getProductTimeRangeIdentity(range) === candidateIdentity;
|
|
231
|
+
})) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
return getSessionRangesForProduct(projection, product, candidateDateRange, true).some(function (range) {
|
|
235
|
+
return getProductTimeRangeIdentity(range) === candidateIdentity;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
178
238
|
function evaluateCandidateTimeGate(params) {
|
|
179
|
-
var
|
|
239
|
+
var projection = params.projection,
|
|
240
|
+
product = params.product,
|
|
241
|
+
candidate = params.candidate,
|
|
180
242
|
candidateRange = params.candidateRange,
|
|
181
243
|
evaluationContext = params.evaluationContext,
|
|
182
244
|
timezoneName = params.timezoneName;
|
|
@@ -188,6 +250,18 @@ function evaluateCandidateTimeGate(params) {
|
|
|
188
250
|
conflictCode: 'past'
|
|
189
251
|
};
|
|
190
252
|
}
|
|
253
|
+
if (evaluationContext.allowExcludedScheduleDateOverride && isCandidateFromExcludedScheduleDate({
|
|
254
|
+
projection: projection,
|
|
255
|
+
product: product,
|
|
256
|
+
candidate: candidate,
|
|
257
|
+
candidateRange: candidateRange
|
|
258
|
+
})) {
|
|
259
|
+
return {
|
|
260
|
+
status: 'unavailable',
|
|
261
|
+
reasonCodes: ['schedule_excluded_date'],
|
|
262
|
+
conflictCode: 'schedule_excluded_date'
|
|
263
|
+
};
|
|
264
|
+
}
|
|
191
265
|
var policy = product.cutOffPolicy;
|
|
192
266
|
if (!policy) return null;
|
|
193
267
|
if (resolveCutOffPolicyIssue(policy)) {
|
|
@@ -220,10 +294,12 @@ function evaluateCandidateTimeGate(params) {
|
|
|
220
294
|
};
|
|
221
295
|
}
|
|
222
296
|
if (policy.type === 'before_start') {
|
|
223
|
-
// Flexible-duration candidates
|
|
224
|
-
// minute
|
|
225
|
-
// already started because the query
|
|
226
|
-
|
|
297
|
+
// Flexible-duration candidates and POS fixed-duration anchors start at
|
|
298
|
+
// minute precision. Keep that current minute selectable instead of treating
|
|
299
|
+
// the freshly generated candidate as already started because the query
|
|
300
|
+
// clock still contains seconds.
|
|
301
|
+
var usesMinutePrecision = product.isFlexibleDuration || evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration';
|
|
302
|
+
var hasNotReachedStart = usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start;
|
|
227
303
|
if (hasNotReachedStart) return null;
|
|
228
304
|
return {
|
|
229
305
|
status: 'unavailable',
|
|
@@ -334,7 +410,8 @@ function normalizeCoverage(input) {
|
|
|
334
410
|
};
|
|
335
411
|
}
|
|
336
412
|
function normalizeResourceWindow(resource, coverage, timezoneName) {
|
|
337
|
-
|
|
413
|
+
var includeExcludedWindows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
414
|
+
return mergeRanges([].concat(_toConsumableArray(resource.windows || []), _toConsumableArray(includeExcludedWindows ? resource.excludedWindows || [] : [])).map(function (window) {
|
|
338
415
|
return normalizeAbsoluteRange(window, timezoneName);
|
|
339
416
|
}).filter(function (window) {
|
|
340
417
|
return Boolean(window);
|
|
@@ -407,12 +484,15 @@ function normalizeResources(resources) {
|
|
|
407
484
|
capacity: Math.max(1, Number(resource.capacity || 1) || 1),
|
|
408
485
|
windows: (resource.windows || []).map(function (window) {
|
|
409
486
|
return _objectSpread({}, window);
|
|
487
|
+
}),
|
|
488
|
+
excludedWindows: (resource.excludedWindows || []).map(function (window) {
|
|
489
|
+
return _objectSpread({}, window);
|
|
410
490
|
})
|
|
411
491
|
});
|
|
412
492
|
});
|
|
413
493
|
}
|
|
414
494
|
function normalizeOperatingHours(params) {
|
|
415
|
-
var _params$input, _params$input2, _params$input3;
|
|
495
|
+
var _params$input, _params$input2, _params$input3, _params$input4;
|
|
416
496
|
var fallbackWindows = enumerateDates(params.dateRange.startDate, params.dateRange.endDate).map(function (date) {
|
|
417
497
|
var start = toDateTimeInDate(date, params.businessHours.startTime, params.timezoneName);
|
|
418
498
|
var end = toDateTimeInDate(date, params.businessHours.endTime, params.timezoneName);
|
|
@@ -430,26 +510,32 @@ function normalizeOperatingHours(params) {
|
|
|
430
510
|
endAt: formatDateTime(range.end, params.timezoneName, params.fixedOffsetMinutes)
|
|
431
511
|
};
|
|
432
512
|
});
|
|
433
|
-
var
|
|
434
|
-
return
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
source: ((_params$input = params.input) === null || _params$input === void 0 ? void 0 : _params$input.source) || params.fallbackSource,
|
|
449
|
-
scheduleIds: uniqById(((_params$input2 = params.input) === null || _params$input2 === void 0 ? void 0 : _params$input2.scheduleIds) || []),
|
|
450
|
-
missingScheduleIds: uniqById(((_params$input3 = params.input) === null || _params$input3 === void 0 ? void 0 : _params$input3.missingScheduleIds) || []),
|
|
451
|
-
windows: windows
|
|
513
|
+
var normalizeWindows = function normalizeWindows(source) {
|
|
514
|
+
return mergeRanges(source.map(function (window) {
|
|
515
|
+
return normalizeAbsoluteRange(window, params.timezoneName);
|
|
516
|
+
}).filter(function (window) {
|
|
517
|
+
return Boolean(window);
|
|
518
|
+
}).map(function (window) {
|
|
519
|
+
return clipRange(window, params.coverage);
|
|
520
|
+
}).filter(function (window) {
|
|
521
|
+
return Boolean(window);
|
|
522
|
+
})).map(function (range) {
|
|
523
|
+
return {
|
|
524
|
+
startAt: formatDateTime(range.start, params.timezoneName, params.fixedOffsetMinutes),
|
|
525
|
+
endAt: formatDateTime(range.end, params.timezoneName, params.fixedOffsetMinutes)
|
|
526
|
+
};
|
|
527
|
+
});
|
|
452
528
|
};
|
|
529
|
+
var windows = normalizeWindows(sourceWindows);
|
|
530
|
+
var excludedWindows = normalizeWindows(((_params$input = params.input) === null || _params$input === void 0 ? void 0 : _params$input.excludedWindows) || []);
|
|
531
|
+
return _objectSpread({
|
|
532
|
+
source: ((_params$input2 = params.input) === null || _params$input2 === void 0 ? void 0 : _params$input2.source) || params.fallbackSource,
|
|
533
|
+
scheduleIds: uniqById(((_params$input3 = params.input) === null || _params$input3 === void 0 ? void 0 : _params$input3.scheduleIds) || []),
|
|
534
|
+
missingScheduleIds: uniqById(((_params$input4 = params.input) === null || _params$input4 === void 0 ? void 0 : _params$input4.missingScheduleIds) || []),
|
|
535
|
+
windows: windows
|
|
536
|
+
}, excludedWindows.length > 0 ? {
|
|
537
|
+
excludedWindows: excludedWindows
|
|
538
|
+
} : {});
|
|
453
539
|
}
|
|
454
540
|
function matchesRequirementGroup(requirementGroup, resource, product) {
|
|
455
541
|
var _requirementGroup$res;
|
|
@@ -759,11 +845,12 @@ function resolveProjectionDateRange(projection, requestDateRange) {
|
|
|
759
845
|
};
|
|
760
846
|
}
|
|
761
847
|
function buildOperatingRanges(projection, dateRange) {
|
|
848
|
+
var includeExcludedWindows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
762
849
|
var coverage = {
|
|
763
850
|
start: toDateStart(dateRange.startDate, projection.meta.timezone),
|
|
764
851
|
end: toDateEnd(nextDate(dateRange.endDate), projection.meta.timezone)
|
|
765
852
|
};
|
|
766
|
-
return mergeRanges(projection.meta.defaults.operatingHours.windows.map(function (window) {
|
|
853
|
+
return mergeRanges([].concat(_toConsumableArray(projection.meta.defaults.operatingHours.windows), _toConsumableArray(includeExcludedWindows ? projection.meta.defaults.operatingHours.excludedWindows || [] : [])).map(function (window) {
|
|
767
854
|
return normalizeAbsoluteRange(window, projection.meta.timezone);
|
|
768
855
|
}).filter(function (window) {
|
|
769
856
|
return Boolean(window);
|
|
@@ -774,12 +861,13 @@ function buildOperatingRanges(projection, dateRange) {
|
|
|
774
861
|
}));
|
|
775
862
|
}
|
|
776
863
|
function buildResourceWindowIndex(projection) {
|
|
864
|
+
var includeExcludedWindows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
777
865
|
var coverage = {
|
|
778
866
|
start: toDateTime(projection.meta.coverage.startAt, projection.meta.timezone),
|
|
779
867
|
end: toDateTime(projection.meta.coverage.endAt, projection.meta.timezone)
|
|
780
868
|
};
|
|
781
869
|
return new Map(projection.resources.map(function (resource) {
|
|
782
|
-
return [String(resource.id), normalizeResourceWindow(resource, coverage, projection.meta.timezone)];
|
|
870
|
+
return [String(resource.id), normalizeResourceWindow(resource, coverage, projection.meta.timezone, includeExcludedWindows)];
|
|
783
871
|
}));
|
|
784
872
|
}
|
|
785
873
|
function buildGroupWorkingRanges(params) {
|
|
@@ -801,7 +889,7 @@ function buildGroupWorkingRanges(params) {
|
|
|
801
889
|
return !filteredResourceIdSet || filteredResourceIdSet.has(String(resource.id));
|
|
802
890
|
}).map(function (resource) {
|
|
803
891
|
var _params$resourceWindo;
|
|
804
|
-
var windows = ((_params$resourceWindo = params.resourceWindowIndex) === null || _params$resourceWindo === void 0 ? void 0 : _params$resourceWindo.get(String(resource.id))) || normalizeResourceWindow(resource, coverage, projection.meta.timezone);
|
|
892
|
+
var windows = ((_params$resourceWindo = params.resourceWindowIndex) === null || _params$resourceWindo === void 0 ? void 0 : _params$resourceWindo.get(String(resource.id))) || normalizeResourceWindow(resource, coverage, projection.meta.timezone, params.includeExcludedWindows === true);
|
|
805
893
|
return windows.map(function (window) {
|
|
806
894
|
return clipRange(window, coverage);
|
|
807
895
|
}).filter(function (window) {
|
|
@@ -848,11 +936,12 @@ function buildGroupWorkingRanges(params) {
|
|
|
848
936
|
return mergeRanges(satisfiedRanges);
|
|
849
937
|
}
|
|
850
938
|
function materializeScheduleRules(rules, dateRange, timezoneName, fixedOffsetMinutes) {
|
|
939
|
+
var allowExcludedScheduleDates = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
851
940
|
var dates = enumerateDates(dateRange.startDate, dateRange.endDate);
|
|
852
941
|
var seen = new Map();
|
|
853
942
|
rules.forEach(function (rule) {
|
|
854
943
|
dates.forEach(function (date) {
|
|
855
|
-
if (!matchesScheduleRuleDate(rule, date, timezoneName)) return;
|
|
944
|
+
if (!matchesScheduleRuleDate(rule, date, timezoneName, allowExcludedScheduleDates)) return;
|
|
856
945
|
var start = toDateTimeInDate(date, rule.startTime, timezoneName);
|
|
857
946
|
var end = toDateTimeInDate(date, rule.endTime, timezoneName);
|
|
858
947
|
if (end <= start) end = toDateTimeInDate(nextDate(date, timezoneName), rule.endTime, timezoneName);
|
|
@@ -885,8 +974,9 @@ function materializeScheduleRules(rules, dateRange, timezoneName, fixedOffsetMin
|
|
|
885
974
|
}
|
|
886
975
|
function matchesScheduleRuleDate(rule, date, _timezoneName) {
|
|
887
976
|
var _rule$includeDates, _rule$excludeDates;
|
|
977
|
+
var allowExcludedScheduleDate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
888
978
|
if ((_rule$includeDates = rule.includeDates) !== null && _rule$includeDates !== void 0 && _rule$includeDates.includes(date)) return true;
|
|
889
|
-
if ((_rule$excludeDates = rule.excludeDates) !== null && _rule$excludeDates !== void 0 && _rule$excludeDates.includes(date)) return false;
|
|
979
|
+
if (!allowExcludedScheduleDate && (_rule$excludeDates = rule.excludeDates) !== null && _rule$excludeDates !== void 0 && _rule$excludeDates.includes(date)) return false;
|
|
890
980
|
if (rule.startDate && date < rule.startDate) return false;
|
|
891
981
|
if (rule.endDate && date > rule.endDate) return false;
|
|
892
982
|
if (rule.mode === 'designation') {
|
|
@@ -942,6 +1032,7 @@ function buildGroupResourceIndex(params) {
|
|
|
942
1032
|
}
|
|
943
1033
|
function getSessionRangesForProduct(projection, product, dateRange) {
|
|
944
1034
|
var _extractFixedOffsetMi2;
|
|
1035
|
+
var allowExcludedScheduleDates = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
945
1036
|
var fixedOffsetMinutes = (_extractFixedOffsetMi2 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi2 !== void 0 ? _extractFixedOffsetMi2 : captureRuntimeOffsetMinutes();
|
|
946
1037
|
var ranges = (product.sessionRanges || []).map(function (range) {
|
|
947
1038
|
var _range$scheduleRefs2;
|
|
@@ -967,7 +1058,7 @@ function getSessionRangesForProduct(projection, product, dateRange) {
|
|
|
967
1058
|
primaryScheduleRef: (_range$scheduleRefs2 = range.scheduleRefs) === null || _range$scheduleRefs2 === void 0 ? void 0 : _range$scheduleRefs2[0]
|
|
968
1059
|
};
|
|
969
1060
|
}).filter(Boolean);
|
|
970
|
-
var ruleRanges = materializeScheduleRules(product.sessionRules || [], dateRange, projection.meta.timezone, fixedOffsetMinutes);
|
|
1061
|
+
var ruleRanges = materializeScheduleRules(product.sessionRules || [], dateRange, projection.meta.timezone, fixedOffsetMinutes, allowExcludedScheduleDates);
|
|
971
1062
|
return dedupeProductRanges([].concat(_toConsumableArray(ranges), _toConsumableArray(ruleRanges.map(function (range) {
|
|
972
1063
|
return _objectSpread(_objectSpread({}, range), {}, {
|
|
973
1064
|
key: "".concat(String(product.id), ":").concat(range.startAt, ":").concat(range.endAt),
|
|
@@ -1022,7 +1113,8 @@ export function getProductTimeRanges(projection) {
|
|
|
1022
1113
|
var dateRange = resolveProjectionDateRange(projection, request.dateRange);
|
|
1023
1114
|
var slotStepMinutes = projection.meta.defaults.slotStepMinutes;
|
|
1024
1115
|
var fixedOffsetMinutes = (_extractFixedOffsetMi3 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi3 !== void 0 ? _extractFixedOffsetMi3 : captureRuntimeOffsetMinutes();
|
|
1025
|
-
var
|
|
1116
|
+
var allowExcludedScheduleDateOverride = runtimeOptions.allowExcludedScheduleDateOverride === true;
|
|
1117
|
+
var resourceWindowIndex = buildResourceWindowIndex(projection, allowExcludedScheduleDateOverride);
|
|
1026
1118
|
var filteredProductIdSet = (_request$productIds = request.productIds) !== null && _request$productIds !== void 0 && _request$productIds.length ? new Set(request.productIds.map(String)) : null;
|
|
1027
1119
|
return projection.products.filter(function (product) {
|
|
1028
1120
|
return !filteredProductIdSet || filteredProductIdSet.has(String(product.id));
|
|
@@ -1037,7 +1129,7 @@ export function getProductTimeRanges(projection) {
|
|
|
1037
1129
|
};
|
|
1038
1130
|
}
|
|
1039
1131
|
if (product.kind === 'session' || product.kind === 'venue_slot') {
|
|
1040
|
-
var fixedRanges = getSessionRangesForProduct(projection, product, dateRange);
|
|
1132
|
+
var fixedRanges = getSessionRangesForProduct(projection, product, dateRange, allowExcludedScheduleDateOverride);
|
|
1041
1133
|
var customRanges = [];
|
|
1042
1134
|
var customDurationMinutes = resolveRequestedSessionDurationMinutes(product, request, runtimeOptions.allowSessionCustomRanges === true);
|
|
1043
1135
|
var _requestedStartTimes = resolveRequestedDurationStartTimes(product, request, runtimeOptions.allowSessionCustomRanges === true);
|
|
@@ -1059,7 +1151,10 @@ export function getProductTimeRanges(projection) {
|
|
|
1059
1151
|
var requiredGroups = (product.requirementGroups || []).filter(function (group) {
|
|
1060
1152
|
return group.required !== false;
|
|
1061
1153
|
});
|
|
1062
|
-
var operatingRanges = buildOperatingRanges(projection, dateRange);
|
|
1154
|
+
var operatingRanges = buildOperatingRanges(projection, dateRange, allowExcludedScheduleDateOverride);
|
|
1155
|
+
var operatingEndAt = dateRange.startDate === dateRange.endDate && operatingRanges.length > 0 ? formatDateTime(Math.max.apply(Math, _toConsumableArray(operatingRanges.map(function (range) {
|
|
1156
|
+
return range.end;
|
|
1157
|
+
}))), projection.meta.timezone, fixedOffsetMinutes) : undefined;
|
|
1063
1158
|
var resourceRanges = requiredGroups.length ? requiredGroups.map(function (group) {
|
|
1064
1159
|
return buildGroupWorkingRanges({
|
|
1065
1160
|
projection: projection,
|
|
@@ -1068,7 +1163,8 @@ export function getProductTimeRanges(projection) {
|
|
|
1068
1163
|
dateRange: dateRange,
|
|
1069
1164
|
resourceIds: request.resourceIds,
|
|
1070
1165
|
partySize: normalizedPartySize,
|
|
1071
|
-
resourceWindowIndex: resourceWindowIndex
|
|
1166
|
+
resourceWindowIndex: resourceWindowIndex,
|
|
1167
|
+
includeExcludedWindows: allowExcludedScheduleDateOverride
|
|
1072
1168
|
});
|
|
1073
1169
|
}).reduce(function (current, ranges) {
|
|
1074
1170
|
return current === null ? ranges : intersectRangeLists(current, ranges);
|
|
@@ -1085,7 +1181,8 @@ export function getProductTimeRanges(projection) {
|
|
|
1085
1181
|
}
|
|
1086
1182
|
return floorToMinute(evaluatedAt);
|
|
1087
1183
|
}();
|
|
1088
|
-
var
|
|
1184
|
+
var durationCandidateAnchor = toDateTime(projection.meta.durationCandidateAnchorAt, projection.meta.timezone);
|
|
1185
|
+
var durationAnchor = runtimeOptions.useExactDurationCandidateMinute ? floorToMinute(durationCandidateAnchor) : ceilToTenMinutes(durationCandidateAnchor, projection.meta.timezone);
|
|
1089
1186
|
var requestedStartTimes = resolveRequestedDurationStartTimes(product, request);
|
|
1090
1187
|
var ranges = [];
|
|
1091
1188
|
baseRanges.forEach(function (range) {
|
|
@@ -1127,13 +1224,16 @@ export function getProductTimeRanges(projection) {
|
|
|
1127
1224
|
ranges.push(createDurationTimeRange(product, start, durationMinutes, projection, fixedOffsetMinutes));
|
|
1128
1225
|
});
|
|
1129
1226
|
}
|
|
1130
|
-
return {
|
|
1227
|
+
return _objectSpread(_objectSpread({
|
|
1131
1228
|
productId: product.id,
|
|
1132
1229
|
title: product.title,
|
|
1133
1230
|
kind: product.kind,
|
|
1134
|
-
slotStepMinutes: slotStepMinutes
|
|
1231
|
+
slotStepMinutes: slotStepMinutes
|
|
1232
|
+
}, operatingEndAt ? {
|
|
1233
|
+
operatingEndAt: operatingEndAt
|
|
1234
|
+
} : {}), {}, {
|
|
1135
1235
|
ranges: dedupeProductRanges(ranges)
|
|
1136
|
-
};
|
|
1236
|
+
});
|
|
1137
1237
|
});
|
|
1138
1238
|
}
|
|
1139
1239
|
function aggregateMatchedCells(productId, requirementGroupId, resourceId, candidateRange, indexedCells) {
|
|
@@ -1347,7 +1447,9 @@ function buildEvaluationContext(params) {
|
|
|
1347
1447
|
evaluatedAt: evaluatedAt,
|
|
1348
1448
|
evaluatedAtMs: evaluatedAt,
|
|
1349
1449
|
resourceIdSet: (_params$resourceIds2 = params.resourceIds) !== null && _params$resourceIds2 !== void 0 && _params$resourceIds2.length ? new Set(params.resourceIds.map(String)) : null,
|
|
1350
|
-
selectionsByGroupKey: selectionsByGroupKey
|
|
1450
|
+
selectionsByGroupKey: selectionsByGroupKey,
|
|
1451
|
+
useExactDurationCandidateMinute: params.useExactDurationCandidateMinute === true,
|
|
1452
|
+
allowExcludedScheduleDateOverride: params.allowExcludedScheduleDateOverride === true
|
|
1351
1453
|
};
|
|
1352
1454
|
}
|
|
1353
1455
|
function summarizeStatuses(statuses) {
|
|
@@ -1519,7 +1621,8 @@ function evaluateCandidateSummary(projection, candidate, request) {
|
|
|
1519
1621
|
var evaluationContext = request.evaluationContext || buildEvaluationContext({
|
|
1520
1622
|
projection: projection,
|
|
1521
1623
|
evaluatedAt: request.evaluatedAt,
|
|
1522
|
-
resourceIds: request.resourceIds
|
|
1624
|
+
resourceIds: request.resourceIds,
|
|
1625
|
+
allowExcludedScheduleDateOverride: request.allowExcludedScheduleDateOverride
|
|
1523
1626
|
});
|
|
1524
1627
|
var requestedPartySize = normalizePartySize(request.partySize);
|
|
1525
1628
|
var requiredGroups = (product.requirementGroups || []).filter(function (group) {
|
|
@@ -1537,7 +1640,9 @@ function evaluateCandidateSummary(projection, candidate, request) {
|
|
|
1537
1640
|
});
|
|
1538
1641
|
});
|
|
1539
1642
|
var gate = evaluateCandidateTimeGate({
|
|
1643
|
+
projection: projection,
|
|
1540
1644
|
product: product,
|
|
1645
|
+
candidate: candidate,
|
|
1541
1646
|
candidateRange: candidateRange,
|
|
1542
1647
|
evaluationContext: evaluationContext,
|
|
1543
1648
|
timezoneName: projection.meta.timezone
|
|
@@ -1592,7 +1697,8 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1592
1697
|
projection: projection,
|
|
1593
1698
|
evaluatedAt: request.evaluatedAt,
|
|
1594
1699
|
resourceIds: request.resourceIds,
|
|
1595
|
-
requirementSelections: request.requirementSelections
|
|
1700
|
+
requirementSelections: request.requirementSelections,
|
|
1701
|
+
allowExcludedScheduleDateOverride: request.allowExcludedScheduleDateOverride
|
|
1596
1702
|
});
|
|
1597
1703
|
var requestedPartySize = normalizePartySize(request.partySize);
|
|
1598
1704
|
var partySize = requestedPartySize !== null && requestedPartySize !== void 0 ? requestedPartySize : 1;
|
|
@@ -1615,6 +1721,12 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1615
1721
|
var options = matchedResources.map(function (resource) {
|
|
1616
1722
|
var _request$cellIndex, _resource$raw2;
|
|
1617
1723
|
var matchedCell = aggregateMatchedCells(product.id, requirementGroup.id, resource.id, candidateRange, ((_request$cellIndex = request.cellIndex) === null || _request$cellIndex === void 0 ? void 0 : _request$cellIndex.get([String(product.id), requirementGroup.id, String(resource.id)].join(':'))) || []);
|
|
1724
|
+
var isExcludedScheduleDate = evaluationContext.allowExcludedScheduleDateOverride && isRangeFromExcludedWindows({
|
|
1725
|
+
normalWindows: resource.windows || [],
|
|
1726
|
+
excludedWindows: resource.excludedWindows || [],
|
|
1727
|
+
candidateRange: candidateRange,
|
|
1728
|
+
timezoneName: projection.meta.timezone
|
|
1729
|
+
});
|
|
1618
1730
|
if (!matchedCell) {
|
|
1619
1731
|
var _resource$raw;
|
|
1620
1732
|
var _isPast = candidateRange.endMs <= evaluationContext.evaluatedAtMs;
|
|
@@ -1626,7 +1738,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1626
1738
|
resourceType: resource.resourceType,
|
|
1627
1739
|
status: _isPast ? 'past' : 'unavailable',
|
|
1628
1740
|
maxPartySize: 0,
|
|
1629
|
-
reasonCodes: _isPast ? ['past'] : ['outside_resource_window']
|
|
1741
|
+
reasonCodes: _isPast ? ['past'] : [].concat(_toConsumableArray(isExcludedScheduleDate ? ['schedule_excluded_date'] : []), ['outside_resource_window'])
|
|
1630
1742
|
};
|
|
1631
1743
|
}
|
|
1632
1744
|
var remainingCapacity = matchedCell.remainingCapacity;
|
|
@@ -1634,6 +1746,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1634
1746
|
var isPast = candidateRange.endMs <= evaluationContext.evaluatedAtMs;
|
|
1635
1747
|
var maxPartySize = isPast ? 0 : Math.max(0, remainingCapacity || 0);
|
|
1636
1748
|
var requiredCapacity = resolveRequiredCapacity(requirementGroup, product, requestedPartySize);
|
|
1749
|
+
var reasonCodes = Array.from(new Set([].concat(_toConsumableArray(matchedCell.reasonCodes), _toConsumableArray(isExcludedScheduleDate ? ['schedule_excluded_date'] : []))));
|
|
1637
1750
|
var status = function () {
|
|
1638
1751
|
if (isPast) return 'past';
|
|
1639
1752
|
if (matchedCell.status === 'unavailable') return 'unavailable';
|
|
@@ -1651,7 +1764,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1651
1764
|
remainingCapacity: remainingCapacity,
|
|
1652
1765
|
maxCapacity: maxCapacity,
|
|
1653
1766
|
maxPartySize: maxPartySize,
|
|
1654
|
-
reasonCodes: isPast ? Array.from(new Set([].concat(
|
|
1767
|
+
reasonCodes: isPast ? Array.from(new Set([].concat(reasonCodes, ['past']))) : reasonCodes,
|
|
1655
1768
|
matchedCell: matchedCell
|
|
1656
1769
|
};
|
|
1657
1770
|
});
|
|
@@ -1709,7 +1822,9 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1709
1822
|
return group.status;
|
|
1710
1823
|
});
|
|
1711
1824
|
var gate = evaluateCandidateTimeGate({
|
|
1825
|
+
projection: projection,
|
|
1712
1826
|
product: product,
|
|
1827
|
+
candidate: candidate,
|
|
1713
1828
|
candidateRange: candidateRange,
|
|
1714
1829
|
evaluationContext: evaluationContext,
|
|
1715
1830
|
timezoneName: projection.meta.timezone
|
|
@@ -1798,6 +1913,7 @@ function assertRangesWithinProjection(projection, ranges) {
|
|
|
1798
1913
|
}
|
|
1799
1914
|
export function queryAvailabilityProjection(projection, request) {
|
|
1800
1915
|
var _extractFixedOffsetMi6, _request$productIds2;
|
|
1916
|
+
var runtimeOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1801
1917
|
var normalizedPartySize = normalizePartySize(request.partySize);
|
|
1802
1918
|
var evaluatedAt = formatDateTime(localDateToScalar(new Date()), projection.meta.timezone, (_extractFixedOffsetMi6 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi6 !== void 0 ? _extractFixedOffsetMi6 : captureRuntimeOffsetMinutes());
|
|
1803
1919
|
if (request.target === 'time') {
|
|
@@ -1820,7 +1936,9 @@ export function queryAvailabilityProjection(projection, request) {
|
|
|
1820
1936
|
var evaluationContext = buildEvaluationContext({
|
|
1821
1937
|
projection: projection,
|
|
1822
1938
|
evaluatedAt: evaluatedAt,
|
|
1823
|
-
resourceIds: request.resourceIds
|
|
1939
|
+
resourceIds: request.resourceIds,
|
|
1940
|
+
useExactDurationCandidateMinute: runtimeOptions.useExactDurationCandidateMinute,
|
|
1941
|
+
allowExcludedScheduleDateOverride: runtimeOptions.allowExcludedScheduleDateOverride
|
|
1824
1942
|
});
|
|
1825
1943
|
if (request.target === 'time') {
|
|
1826
1944
|
var candidates = dedupeProductRanges(request.candidates);
|
|
@@ -1908,7 +2026,9 @@ export function queryAvailabilityProjection(projection, request) {
|
|
|
1908
2026
|
resourceIds: request.resourceIds,
|
|
1909
2027
|
partySize: normalizedPartySize
|
|
1910
2028
|
}, {
|
|
1911
|
-
evaluatedAt: evaluatedAt
|
|
2029
|
+
evaluatedAt: evaluatedAt,
|
|
2030
|
+
useExactDurationCandidateMinute: runtimeOptions.useExactDurationCandidateMinute,
|
|
2031
|
+
allowExcludedScheduleDateOverride: runtimeOptions.allowExcludedScheduleDateOverride
|
|
1912
2032
|
});
|
|
1913
2033
|
var candidateGroupMap = new Map(candidateGroups.map(function (group) {
|
|
1914
2034
|
return [String(group.productId), group];
|
|
@@ -2086,6 +2206,7 @@ function summarizeProductStatus(statuses) {
|
|
|
2086
2206
|
}
|
|
2087
2207
|
export function validateAvailabilitySelection(projection, params) {
|
|
2088
2208
|
var _extractFixedOffsetMi7;
|
|
2209
|
+
var runtimeOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2089
2210
|
var normalizedPartySize = normalizePartySize(params.partySize);
|
|
2090
2211
|
var normalizedBookingCount = normalizeBookingCount(params.bookingCount);
|
|
2091
2212
|
assertRangesWithinProjection(projection, [params.candidate]);
|
|
@@ -2106,14 +2227,16 @@ export function validateAvailabilitySelection(projection, params) {
|
|
|
2106
2227
|
evaluationContext: buildEvaluationContext({
|
|
2107
2228
|
projection: projection,
|
|
2108
2229
|
evaluatedAt: evaluatedAt,
|
|
2109
|
-
requirementSelections: params.requirementSelections
|
|
2230
|
+
requirementSelections: params.requirementSelections,
|
|
2231
|
+
useExactDurationCandidateMinute: runtimeOptions.useExactDurationCandidateMinute,
|
|
2232
|
+
allowExcludedScheduleDateOverride: runtimeOptions.allowExcludedScheduleDateOverride
|
|
2110
2233
|
})
|
|
2111
2234
|
});
|
|
2112
2235
|
var conflicts = [];
|
|
2113
2236
|
if (evaluated.gate) {
|
|
2114
2237
|
conflicts.push({
|
|
2115
2238
|
code: evaluated.gate.conflictCode,
|
|
2116
|
-
message: evaluated.gate.
|
|
2239
|
+
message: evaluated.gate.conflictCode === 'past' ? '候选时间已过期' : evaluated.gate.conflictCode === 'schedule_excluded_date' ? '候选日期已被日程排除' : '候选时间不满足预订时间门禁',
|
|
2117
2240
|
reasonCodes: evaluated.gate.reasonCodes,
|
|
2118
2241
|
productId: params.candidate.productId,
|
|
2119
2242
|
candidateKey: params.candidate.key
|
|
@@ -101,6 +101,9 @@ export interface AvailabilityOperatingHoursSnapshot {
|
|
|
101
101
|
scheduleIds: AvailabilityId[];
|
|
102
102
|
missingScheduleIds: AvailabilityId[];
|
|
103
103
|
windows: AvailabilityResourceWindow[];
|
|
104
|
+
/** Schedule windows omitted only because their date is excluded. POS may use
|
|
105
|
+
* these to surface an unavailable, manually selectable candidate. */
|
|
106
|
+
excludedWindows?: AvailabilityResourceWindow[];
|
|
104
107
|
}
|
|
105
108
|
export interface AvailabilityResource {
|
|
106
109
|
id: AvailabilityId;
|
|
@@ -110,6 +113,8 @@ export interface AvailabilityResource {
|
|
|
110
113
|
resourceType: AvailabilityResourceType;
|
|
111
114
|
capacity: number;
|
|
112
115
|
windows: AvailabilityResourceWindow[];
|
|
116
|
+
/** Resource work windows omitted only by an excluded schedule date. */
|
|
117
|
+
excludedWindows?: AvailabilityResourceWindow[];
|
|
113
118
|
raw?: Record<string, any>;
|
|
114
119
|
}
|
|
115
120
|
export interface AvailabilityOccupancy extends AvailabilityAbsoluteRange {
|
|
@@ -213,6 +218,8 @@ export interface ProductTimeRangeGroup {
|
|
|
213
218
|
title?: string;
|
|
214
219
|
kind: AvailabilityProductKind;
|
|
215
220
|
slotStepMinutes?: number;
|
|
221
|
+
/** 单日查询对应营业窗口的最终结束时刻,不受资源排班是否为空影响。 */
|
|
222
|
+
operatingEndAt?: string;
|
|
216
223
|
ranges: ProductTimeRange[];
|
|
217
224
|
}
|
|
218
225
|
export interface AvailabilityAssignment extends AvailabilityAbsoluteRange {
|
|
@@ -243,6 +250,13 @@ export interface GetProductTimeRangesRequest {
|
|
|
243
250
|
}
|
|
244
251
|
export interface GetProductTimeRangesRuntimeOptions {
|
|
245
252
|
evaluatedAt?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Internal POS capability: fixed-duration candidates start from the stable
|
|
255
|
+
* context anchor's current minute instead of rounding up to ten minutes, and
|
|
256
|
+
* that minute remains selectable during before-start cutoff evaluation.
|
|
257
|
+
* Other callers keep the legacy alignment and strict second-level cutoff.
|
|
258
|
+
*/
|
|
259
|
+
useExactDurationCandidateMinute?: boolean;
|
|
246
260
|
/**
|
|
247
261
|
* Internal POS capability: allow explicit duration/start overrides to append
|
|
248
262
|
* a custom duration candidate for Session products. Fixed Session ranges are
|
|
@@ -250,6 +264,11 @@ export interface GetProductTimeRangesRuntimeOptions {
|
|
|
250
264
|
* disabled.
|
|
251
265
|
*/
|
|
252
266
|
allowSessionCustomRanges?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Internal POS capability: materialize candidates whose schedule date was
|
|
269
|
+
* explicitly excluded, while availability evaluation keeps them unavailable.
|
|
270
|
+
*/
|
|
271
|
+
allowExcludedScheduleDateOverride?: boolean;
|
|
253
272
|
}
|
|
254
273
|
export interface QueryAvailabilityBaseRequest {
|
|
255
274
|
productIds?: AvailabilityId[];
|
|
@@ -1388,7 +1388,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1388
1388
|
// bundle子商品:保存到扁平化Map
|
|
1389
1389
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1390
1390
|
discount_list: isManualDiscount ? _this4.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this4.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
|
|
1391
|
-
price:
|
|
1391
|
+
price: flatItem.bundleItem.price,
|
|
1392
1392
|
bundle_selling_price: (_flatItem$bundleItem$ = flatItem.bundleItem.bundle_selling_price) !== null && _flatItem$bundleItem$ !== void 0 ? _flatItem$bundleItem$ : isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
1393
1393
|
processed: true
|
|
1394
1394
|
})]);
|
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -4262,12 +4262,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
4262
4262
|
|
|
4263
4263
|
/**
|
|
4264
4264
|
* 预约查询是否走本地:
|
|
4265
|
+
* - 日历周/月/资源视图通过 compact_fields 显式标识,始终走远端;
|
|
4265
4266
|
* - 当 sales_time_between 的开始和结束都不是今天时,走远端;
|
|
4266
4267
|
* - 其余情况走本地。
|
|
4267
4268
|
*/
|
|
4268
4269
|
}, {
|
|
4269
4270
|
key: "shouldUseLocalBookingQuery",
|
|
4270
4271
|
value: function shouldUseLocalBookingQuery(data) {
|
|
4272
|
+
if ((data === null || data === void 0 ? void 0 : data.compact_fields) === true) return false;
|
|
4271
4273
|
var range = data === null || data === void 0 ? void 0 : data.sales_time_between;
|
|
4272
4274
|
if (!Array.isArray(range) || range.length < 2) return true;
|
|
4273
4275
|
return !this.isRangeBothNotToday(range[0], range[1]);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 3 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|