@pisell/pisellos 2.2.307 → 2.2.308
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/ResourcePlanner/planner.js +10 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +3 -4
- package/lib/modules/ResourcePlanner/planner.js +10 -8
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +3 -4
- package/package.json +1 -1
|
@@ -436,7 +436,7 @@ function normalizeOccupancy(occupancy, coverage, timezoneName, fixedOffsetMinute
|
|
|
436
436
|
}
|
|
437
437
|
function normalizeRequirementGroup(product, requirementGroup) {
|
|
438
438
|
var _requirementGroup$for;
|
|
439
|
-
var resourceType = 'single';
|
|
439
|
+
var resourceType = requirementGroup.resourceType === 'multiple' || requirementGroup.resourceType === 'capacity' ? requirementGroup.resourceType : 'single';
|
|
440
440
|
var required = requirementGroup.required !== false;
|
|
441
441
|
var min = required ? 1 : 0;
|
|
442
442
|
return _objectSpread(_objectSpread({}, requirementGroup), {}, {
|
|
@@ -482,7 +482,7 @@ function normalizeProducts(products) {
|
|
|
482
482
|
function normalizeResources(resources) {
|
|
483
483
|
return resources.map(function (resource) {
|
|
484
484
|
return _objectSpread(_objectSpread({}, resource), {}, {
|
|
485
|
-
resourceType: 'single',
|
|
485
|
+
resourceType: resource.resourceType === 'multiple' || resource.resourceType === 'capacity' ? resource.resourceType : 'single',
|
|
486
486
|
capacity: Math.max(1, Number(resource.capacity || 1) || 1),
|
|
487
487
|
windows: (resource.windows || []).map(function (window) {
|
|
488
488
|
return _objectSpread({}, window);
|
|
@@ -637,7 +637,8 @@ function buildCells(projection) {
|
|
|
637
637
|
var usedCapacity = segmentOccupancies.reduce(function (sum, occupancy) {
|
|
638
638
|
return sum + Math.max(1, Number(occupancy.pax || 1) || 1);
|
|
639
639
|
}, 0);
|
|
640
|
-
|
|
640
|
+
// 预约模式来自商品资源组;v2 资源记录可能不包含 type。
|
|
641
|
+
var remainingCapacity = requirementGroup.resourceType === 'single' && segmentOccupancies.length > 0 ? 0 : Math.max(0, resource.capacity - usedCapacity);
|
|
641
642
|
var requiredCapacity = resolveRequiredCapacity(requirementGroup, product);
|
|
642
643
|
var reasonCodes = Array.from(new Set(segmentOccupancies.flatMap(function (occupancy) {
|
|
643
644
|
var source = occupancy.source || 'remote';
|
|
@@ -671,7 +672,7 @@ function buildCells(projection) {
|
|
|
671
672
|
requirementFormId: requirementGroup.formId,
|
|
672
673
|
resourceId: resource.id,
|
|
673
674
|
resourceName: resource.name,
|
|
674
|
-
resourceType:
|
|
675
|
+
resourceType: requirementGroup.resourceType,
|
|
675
676
|
startAt: formatDateTime(start, timezoneName, fixedOffsetMinutes),
|
|
676
677
|
endAt: formatDateTime(end, timezoneName, fixedOffsetMinutes),
|
|
677
678
|
date: formatDate(start, timezoneName),
|
|
@@ -679,7 +680,7 @@ function buildCells(projection) {
|
|
|
679
680
|
endTime: formatTime(end, timezoneName),
|
|
680
681
|
timezone: projection.meta.timezone,
|
|
681
682
|
status: status,
|
|
682
|
-
//
|
|
683
|
+
// capacity 表示人数;single 被占用时不再贡献可用容量。
|
|
683
684
|
remainingCapacity: remainingCapacity,
|
|
684
685
|
maxCapacity: resource.capacity,
|
|
685
686
|
reasonCodes: Array.from(new Set(reasonCodes)),
|
|
@@ -1739,7 +1740,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1739
1740
|
resourceName: resource.name,
|
|
1740
1741
|
resourceFormId: resource.formId,
|
|
1741
1742
|
policyId: (_resource$raw = resource.raw) === null || _resource$raw === void 0 ? void 0 : _resource$raw.policy_id,
|
|
1742
|
-
resourceType:
|
|
1743
|
+
resourceType: requirementGroup.resourceType,
|
|
1743
1744
|
status: _isPast ? 'past' : 'unavailable',
|
|
1744
1745
|
maxPartySize: 0,
|
|
1745
1746
|
reasonCodes: _isPast ? ['past'] : [].concat(_toConsumableArray(isExcludedScheduleDate ? ['schedule_excluded_date'] : []), ['outside_resource_window'])
|
|
@@ -1763,7 +1764,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1763
1764
|
resourceName: resource.name,
|
|
1764
1765
|
resourceFormId: resource.formId,
|
|
1765
1766
|
policyId: (_resource$raw2 = resource.raw) === null || _resource$raw2 === void 0 ? void 0 : _resource$raw2.policy_id,
|
|
1766
|
-
resourceType:
|
|
1767
|
+
resourceType: requirementGroup.resourceType,
|
|
1767
1768
|
status: status,
|
|
1768
1769
|
remainingCapacity: remainingCapacity,
|
|
1769
1770
|
maxCapacity: maxCapacity,
|
|
@@ -2330,7 +2331,8 @@ export function validateAvailabilitySelection(projection, params) {
|
|
|
2330
2331
|
var remainingCapacity = matchedCell === null || matchedCell === void 0 ? void 0 : matchedCell.remainingCapacity;
|
|
2331
2332
|
if (option && (option.status === 'available' || option.status === 'limited') && remainingCapacity !== undefined) {
|
|
2332
2333
|
var capacityPerBooking = normalizedPartySize !== null && normalizedPartySize !== void 0 ? normalizedPartySize : 1;
|
|
2333
|
-
var
|
|
2334
|
+
var capacityQuantity = Math.max(0, Math.floor(remainingCapacity / capacityPerBooking));
|
|
2335
|
+
var availableQuantity = matchedGroup.resourceType === 'single' ? Math.min(1, capacityQuantity) : capacityQuantity;
|
|
2334
2336
|
if (normalizedBookingCount > availableQuantity) {
|
|
2335
2337
|
conflicts.push({
|
|
2336
2338
|
code: 'resource_capacity_exceeded',
|
|
@@ -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 | 1 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -339,7 +339,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
339
339
|
* 获取当前的客户搜索条件
|
|
340
340
|
* @returns 当前搜索条件
|
|
341
341
|
*/
|
|
342
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
342
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
343
343
|
/**
|
|
344
344
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
345
345
|
* @returns 客户状态
|
|
@@ -304,10 +304,9 @@ function assertAvailabilityCatalogProductIds(productIds, context) {
|
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
function normalizeResourceType(
|
|
308
|
-
//
|
|
309
|
-
|
|
310
|
-
return 'single';
|
|
307
|
+
function normalizeResourceType(value) {
|
|
308
|
+
// 预约是否独占与每组选择几个资源是两个独立配置。
|
|
309
|
+
return value === 'multiple' || value === 'capacity' ? value : 'single';
|
|
311
310
|
}
|
|
312
311
|
function resolveProductKind(product) {
|
|
313
312
|
var _product$cartDetailVa, _product$_extend;
|
|
@@ -412,7 +412,7 @@ function normalizeOccupancy(occupancy, coverage, timezoneName, fixedOffsetMinute
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
function normalizeRequirementGroup(product, requirementGroup) {
|
|
415
|
-
const resourceType = 'single';
|
|
415
|
+
const resourceType = requirementGroup.resourceType === 'multiple' || requirementGroup.resourceType === 'capacity' ? requirementGroup.resourceType : 'single';
|
|
416
416
|
const required = requirementGroup.required !== false;
|
|
417
417
|
const min = required ? 1 : 0;
|
|
418
418
|
return {
|
|
@@ -457,7 +457,7 @@ function normalizeProducts(products) {
|
|
|
457
457
|
function normalizeResources(resources) {
|
|
458
458
|
return resources.map(resource => ({
|
|
459
459
|
...resource,
|
|
460
|
-
resourceType: 'single',
|
|
460
|
+
resourceType: resource.resourceType === 'multiple' || resource.resourceType === 'capacity' ? resource.resourceType : 'single',
|
|
461
461
|
capacity: Math.max(1, Number(resource.capacity || 1) || 1),
|
|
462
462
|
windows: (resource.windows || []).map(window => ({
|
|
463
463
|
...window
|
|
@@ -573,7 +573,8 @@ function buildCells(projection) {
|
|
|
573
573
|
occupancy
|
|
574
574
|
}) => occupancy) : [];
|
|
575
575
|
const usedCapacity = segmentOccupancies.reduce((sum, occupancy) => sum + Math.max(1, Number(occupancy.pax || 1) || 1), 0);
|
|
576
|
-
|
|
576
|
+
// 预约模式来自商品资源组;v2 资源记录可能不包含 type。
|
|
577
|
+
const remainingCapacity = requirementGroup.resourceType === 'single' && segmentOccupancies.length > 0 ? 0 : Math.max(0, resource.capacity - usedCapacity);
|
|
577
578
|
const requiredCapacity = resolveRequiredCapacity(requirementGroup, product);
|
|
578
579
|
const reasonCodes = Array.from(new Set(segmentOccupancies.flatMap(occupancy => {
|
|
579
580
|
const source = occupancy.source || 'remote';
|
|
@@ -607,7 +608,7 @@ function buildCells(projection) {
|
|
|
607
608
|
requirementFormId: requirementGroup.formId,
|
|
608
609
|
resourceId: resource.id,
|
|
609
610
|
resourceName: resource.name,
|
|
610
|
-
resourceType:
|
|
611
|
+
resourceType: requirementGroup.resourceType,
|
|
611
612
|
startAt: formatDateTime(start, timezoneName, fixedOffsetMinutes),
|
|
612
613
|
endAt: formatDateTime(end, timezoneName, fixedOffsetMinutes),
|
|
613
614
|
date: formatDate(start, timezoneName),
|
|
@@ -615,7 +616,7 @@ function buildCells(projection) {
|
|
|
615
616
|
endTime: formatTime(end, timezoneName),
|
|
616
617
|
timezone: projection.meta.timezone,
|
|
617
618
|
status,
|
|
618
|
-
//
|
|
619
|
+
// capacity 表示人数;single 被占用时不再贡献可用容量。
|
|
619
620
|
remainingCapacity,
|
|
620
621
|
maxCapacity: resource.capacity,
|
|
621
622
|
reasonCodes: Array.from(new Set(reasonCodes)),
|
|
@@ -1500,7 +1501,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1500
1501
|
resourceName: resource.name,
|
|
1501
1502
|
resourceFormId: resource.formId,
|
|
1502
1503
|
policyId: resource.raw?.policy_id,
|
|
1503
|
-
resourceType:
|
|
1504
|
+
resourceType: requirementGroup.resourceType,
|
|
1504
1505
|
status: isPast ? 'past' : 'unavailable',
|
|
1505
1506
|
maxPartySize: 0,
|
|
1506
1507
|
reasonCodes: isPast ? ['past'] : [...(isExcludedScheduleDate ? ['schedule_excluded_date'] : []), 'outside_resource_window']
|
|
@@ -1524,7 +1525,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1524
1525
|
resourceName: resource.name,
|
|
1525
1526
|
resourceFormId: resource.formId,
|
|
1526
1527
|
policyId: resource.raw?.policy_id,
|
|
1527
|
-
resourceType:
|
|
1528
|
+
resourceType: requirementGroup.resourceType,
|
|
1528
1529
|
status,
|
|
1529
1530
|
remainingCapacity,
|
|
1530
1531
|
maxCapacity,
|
|
@@ -2008,7 +2009,8 @@ function validateAvailabilitySelection(projection, params, runtimeOptions = {})
|
|
|
2008
2009
|
const remainingCapacity = matchedCell?.remainingCapacity;
|
|
2009
2010
|
if (option && (option.status === 'available' || option.status === 'limited') && remainingCapacity !== undefined) {
|
|
2010
2011
|
const capacityPerBooking = normalizedPartySize ?? 1;
|
|
2011
|
-
const
|
|
2012
|
+
const capacityQuantity = Math.max(0, Math.floor(remainingCapacity / capacityPerBooking));
|
|
2013
|
+
const availableQuantity = matchedGroup.resourceType === 'single' ? Math.min(1, capacityQuantity) : capacityQuantity;
|
|
2012
2014
|
if (normalizedBookingCount > availableQuantity) {
|
|
2013
2015
|
conflicts.push({
|
|
2014
2016
|
code: 'resource_capacity_exceeded',
|
|
@@ -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 | 1 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -339,7 +339,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
339
339
|
* 获取当前的客户搜索条件
|
|
340
340
|
* @returns 当前搜索条件
|
|
341
341
|
*/
|
|
342
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
342
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
343
343
|
/**
|
|
344
344
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
345
345
|
* @returns 客户状态
|
|
@@ -283,10 +283,9 @@ function assertAvailabilityCatalogProductIds(productIds, context) {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function normalizeResourceType(
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
return 'single';
|
|
286
|
+
function normalizeResourceType(value) {
|
|
287
|
+
// 预约是否独占与每组选择几个资源是两个独立配置。
|
|
288
|
+
return value === 'multiple' || value === 'capacity' ? value : 'single';
|
|
290
289
|
}
|
|
291
290
|
function resolveProductKind(product) {
|
|
292
291
|
if (product.duration || product.service_duration) return 'duration';
|