@pisell/pisellos 2.3.144 → 2.3.145
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/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +380 -198
- package/dist/modules/Order/types.d.ts +9 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +327 -22
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.js +432 -163
- package/dist/solution/UnifiedBookingSales/types.d.ts +14 -2
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +92 -10
- package/lib/modules/Order/types.d.ts +9 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +247 -7
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.js +220 -27
- package/lib/solution/UnifiedBookingSales/types.d.ts +14 -2
- package/package.json +1 -1
|
@@ -37,14 +37,15 @@ import dayjs from 'dayjs';
|
|
|
37
37
|
import { cloneDeep } from 'lodash-es';
|
|
38
38
|
import { OpenDataModule } from "../../modules";
|
|
39
39
|
import { isProductFlexibleDuration } from "../../modules/BookingContext/utils";
|
|
40
|
+
import { cacheItemToBookingInput } from "../../modules/BookingContext/utils/cacheItemToBookingInput";
|
|
40
41
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
|
|
41
42
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
42
|
-
import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
43
|
+
import { AvailabilityError, createAvailabilityProjection, getDurationBusinessDate, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
43
44
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
44
45
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
45
46
|
import { BusinessAvailabilityController } from "./businessAvailability";
|
|
46
47
|
import { BookingTicket } from "../BookingTicket";
|
|
47
|
-
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
48
|
+
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, extractFixedOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
48
49
|
import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
49
50
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
50
51
|
export * from "./types";
|
|
@@ -1483,6 +1484,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1483
1484
|
businessTimezone: String((_otherParams$business2 = otherParams.businessTimezone) !== null && _otherParams$business2 !== void 0 ? _otherParams$business2 : '')
|
|
1484
1485
|
};
|
|
1485
1486
|
}
|
|
1487
|
+
}, {
|
|
1488
|
+
key: "usesDurationTimeGrid",
|
|
1489
|
+
value: function usesDurationTimeGrid(projection) {
|
|
1490
|
+
var _this$otherParams$pla, _this$otherParams4;
|
|
1491
|
+
var platform = String((_this$otherParams$pla = (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase();
|
|
1492
|
+
return (platform === 'pos' || platform === 'kiosk') && (!projection || projection.products.some(function (product) {
|
|
1493
|
+
return product.kind === 'duration';
|
|
1494
|
+
}));
|
|
1495
|
+
}
|
|
1496
|
+
}, {
|
|
1497
|
+
key: "getCurrentAvailabilityBusinessDate",
|
|
1498
|
+
value: function getCurrentAvailabilityBusinessDate(projection) {
|
|
1499
|
+
return getDurationBusinessDate(projection, this.getAvailabilityRuntimeDateTime());
|
|
1500
|
+
}
|
|
1501
|
+
}, {
|
|
1502
|
+
key: "getAvailabilityBusinessDateRange",
|
|
1503
|
+
value: function getAvailabilityBusinessDateRange(projection) {
|
|
1504
|
+
var prepare = projection.meta.prepareParams;
|
|
1505
|
+
var range = prepare === null || prepare === void 0 ? void 0 : prepare.dateRange;
|
|
1506
|
+
if (!this.usesDurationTimeGrid(projection) || !(range !== null && range !== void 0 && range.startDate) || !range.endDate) {
|
|
1507
|
+
return projection.meta.coverage;
|
|
1508
|
+
}
|
|
1509
|
+
var businessDate = this.getCurrentAvailabilityBusinessDate(projection);
|
|
1510
|
+
var today = this.getAvailabilityRuntimeDateTime().slice(0, 10);
|
|
1511
|
+
return {
|
|
1512
|
+
startDate: range.startDate === today && businessDate < today ? businessDate : range.startDate,
|
|
1513
|
+
endDate: range.endDate
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1486
1516
|
}, {
|
|
1487
1517
|
key: "normalizeAvailabilityIdList",
|
|
1488
1518
|
value: function normalizeAvailabilityIdList(values) {
|
|
@@ -1514,9 +1544,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1514
1544
|
}, {
|
|
1515
1545
|
key: "normalizeAvailabilityPrepareDescriptor",
|
|
1516
1546
|
value: function normalizeAvailabilityPrepareDescriptor(params) {
|
|
1517
|
-
var _this$
|
|
1547
|
+
var _this$otherParams5;
|
|
1518
1548
|
this.assertAvailabilityPrepareParams(params);
|
|
1519
|
-
var timezone = String(params.timezone || ((_this$
|
|
1549
|
+
var timezone = String(params.timezone || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai');
|
|
1520
1550
|
assertValidAvailabilityTimezone(timezone);
|
|
1521
1551
|
var dateRange = this.normalizeAvailabilityDateRange(params, timezone);
|
|
1522
1552
|
var slotStepMinutes = params.slotStepMinutes || DEFAULT_AVAILABILITY_SLOT_STEP_MINUTES;
|
|
@@ -1546,7 +1576,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1546
1576
|
key: "resolveAvailabilityPrepareDefaults",
|
|
1547
1577
|
value: function () {
|
|
1548
1578
|
var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
1549
|
-
var _ref30, _this$otherParams$bus, _this$
|
|
1579
|
+
var _ref30, _this$otherParams$bus, _this$otherParams6, _this$otherParams7, _this$otherParams$cha2, _this$otherParams8, _this$otherParams9, _openData, _openData2, _openData3;
|
|
1550
1580
|
var needsOperatingHours, needsTimeSlice, businessCode, channel, currentTarget, openData, operatingScheduleIds, configuredTimeSlice;
|
|
1551
1581
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1552
1582
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -1564,10 +1594,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1564
1594
|
}
|
|
1565
1595
|
}));
|
|
1566
1596
|
case 4:
|
|
1567
|
-
businessCode = String((_ref30 = (_this$otherParams$bus = (_this$
|
|
1568
|
-
channel = String((_this$otherParams$cha2 = (_this$
|
|
1597
|
+
businessCode = String((_ref30 = (_this$otherParams$bus = (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code) !== null && _ref30 !== void 0 ? _ref30 : '').trim();
|
|
1598
|
+
channel = String((_this$otherParams$cha2 = (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel) !== null && _this$otherParams$cha2 !== void 0 ? _this$otherParams$cha2 : '').trim();
|
|
1569
1599
|
currentTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : null;
|
|
1570
|
-
openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? (_this$
|
|
1600
|
+
openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.openData : null;
|
|
1571
1601
|
if (!(!openData && this.store.openData)) {
|
|
1572
1602
|
_context2.next = 20;
|
|
1573
1603
|
break;
|
|
@@ -1657,7 +1687,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1657
1687
|
key: "setOtherParams",
|
|
1658
1688
|
value: function () {
|
|
1659
1689
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1660
|
-
var _this$
|
|
1690
|
+
var _this$otherParams10, _this$otherParams12;
|
|
1661
1691
|
var _ref31,
|
|
1662
1692
|
_ref31$cover,
|
|
1663
1693
|
cover,
|
|
@@ -1666,7 +1696,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1666
1696
|
explicitlySetsOpenData,
|
|
1667
1697
|
nextParams,
|
|
1668
1698
|
nextScope,
|
|
1669
|
-
_this$
|
|
1699
|
+
_this$otherParams11,
|
|
1670
1700
|
shouldResetAvailabilityState,
|
|
1671
1701
|
_args3 = arguments;
|
|
1672
1702
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -1674,7 +1704,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1674
1704
|
case 0:
|
|
1675
1705
|
_ref31 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
|
|
1676
1706
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1677
|
-
previousItemRuleConfig = (_this$
|
|
1707
|
+
previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
|
|
1678
1708
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1679
1709
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
1680
1710
|
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
@@ -1687,7 +1717,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1687
1717
|
case 8:
|
|
1688
1718
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1689
1719
|
if (explicitlySetsOpenData) {
|
|
1690
|
-
this.openDataTarget = (_this$
|
|
1720
|
+
this.openDataTarget = (_this$otherParams11 = this.otherParams) !== null && _this$otherParams11 !== void 0 && _this$otherParams11.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
|
|
1691
1721
|
}
|
|
1692
1722
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1693
1723
|
if (!shouldResetAvailabilityState) {
|
|
@@ -1697,7 +1727,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1697
1727
|
_context3.next = 14;
|
|
1698
1728
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1699
1729
|
case 14:
|
|
1700
|
-
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$
|
|
1730
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.itemRule)) {
|
|
1701
1731
|
this.resetAllergyItemRuleState();
|
|
1702
1732
|
}
|
|
1703
1733
|
case 15:
|
|
@@ -1796,9 +1826,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1796
1826
|
}, {
|
|
1797
1827
|
key: "createAvailabilityContextRef",
|
|
1798
1828
|
value: function createAvailabilityContextRef(context) {
|
|
1799
|
-
|
|
1829
|
+
var _this$getActiveAvaila;
|
|
1830
|
+
var projection = (_this$getActiveAvaila = this.getActiveAvailabilityProjectionEntry(context)) === null || _this$getActiveAvaila === void 0 ? void 0 : _this$getActiveAvaila.projection;
|
|
1831
|
+
return _objectSpread({
|
|
1800
1832
|
contextId: context.contextId
|
|
1801
|
-
}
|
|
1833
|
+
}, projection && this.usesDurationTimeGrid(projection) ? {
|
|
1834
|
+
durationTimeSelection: {
|
|
1835
|
+
version: 1,
|
|
1836
|
+
currentBusinessDate: this.getCurrentAvailabilityBusinessDate(projection)
|
|
1837
|
+
}
|
|
1838
|
+
} : {});
|
|
1802
1839
|
}
|
|
1803
1840
|
}, {
|
|
1804
1841
|
key: "emitAvailabilityDiagnostic",
|
|
@@ -1933,8 +1970,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1933
1970
|
}, {
|
|
1934
1971
|
key: "isSessionStoragePersistEnabled",
|
|
1935
1972
|
value: function isSessionStoragePersistEnabled() {
|
|
1936
|
-
var _this$
|
|
1937
|
-
return Boolean(this.cacheId && ((_this$
|
|
1973
|
+
var _this$otherParams13;
|
|
1974
|
+
return Boolean(this.cacheId && ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableSessionStoragePersist) === true);
|
|
1938
1975
|
}
|
|
1939
1976
|
}, {
|
|
1940
1977
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -2003,10 +2040,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2003
2040
|
}, {
|
|
2004
2041
|
key: "shouldUseCheckoutSyncTask",
|
|
2005
2042
|
value: function shouldUseCheckoutSyncTask() {
|
|
2006
|
-
var _this$
|
|
2007
|
-
var configured = (_this$
|
|
2043
|
+
var _this$otherParams14, _this$otherParams15;
|
|
2044
|
+
var configured = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.checkoutSyncTaskEnabled;
|
|
2008
2045
|
if (configured === true) return true;
|
|
2009
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2046
|
+
var platform = normalizeRuntimePlatform((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform);
|
|
2010
2047
|
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
2011
2048
|
}
|
|
2012
2049
|
|
|
@@ -2161,8 +2198,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2161
2198
|
}, {
|
|
2162
2199
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2163
2200
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2164
|
-
var _this$
|
|
2165
|
-
return isCustomerUserPlatform((_this$
|
|
2201
|
+
var _this$otherParams16;
|
|
2202
|
+
return isCustomerUserPlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
|
|
2166
2203
|
}
|
|
2167
2204
|
}, {
|
|
2168
2205
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2502,13 +2539,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2502
2539
|
key: "loadPickupTimingOpenData",
|
|
2503
2540
|
value: function () {
|
|
2504
2541
|
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
|
|
2505
|
-
var _ref34, _this$otherParams$bus2, _this$
|
|
2542
|
+
var _ref34, _this$otherParams$bus2, _this$otherParams17, _this$otherParams18;
|
|
2506
2543
|
var scope, businessCode, config;
|
|
2507
2544
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2508
2545
|
while (1) switch (_context16.prev = _context16.next) {
|
|
2509
2546
|
case 0:
|
|
2510
2547
|
scope = this.getPickupTimingScope();
|
|
2511
|
-
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$
|
|
2548
|
+
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
|
|
2512
2549
|
_context16.next = 4;
|
|
2513
2550
|
return this.loadOpenData({
|
|
2514
2551
|
businessCode: businessCode,
|
|
@@ -2673,7 +2710,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2673
2710
|
key: "resolveProductAllergyRequirement",
|
|
2674
2711
|
value: (function () {
|
|
2675
2712
|
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2676
|
-
var _this$
|
|
2713
|
+
var _this$otherParams19, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams20, _ref38, _ref39, _params$channel, _this$otherParams21, _this$otherParams22, _runtimeConfig$submis;
|
|
2677
2714
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2678
2715
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2679
2716
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2696,7 +2733,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2696
2733
|
return _context20.abrupt("return", null);
|
|
2697
2734
|
case 8:
|
|
2698
2735
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2699
|
-
runtimeConfig = ((_this$
|
|
2736
|
+
runtimeConfig = ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.itemRule) || {};
|
|
2700
2737
|
runtimePax = runtimeConfig.pax || {};
|
|
2701
2738
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2702
2739
|
var _item$product_id, _item$product_variant, _ref36, _item$num;
|
|
@@ -2715,8 +2752,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2715
2752
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2716
2753
|
},
|
|
2717
2754
|
cartItems: cartItems,
|
|
2718
|
-
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$
|
|
2719
|
-
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$
|
|
2755
|
+
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
|
|
2756
|
+
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
2720
2757
|
currentProduct: _objectSpread({
|
|
2721
2758
|
product_id: productId
|
|
2722
2759
|
}, productVariantId ? {
|
|
@@ -2806,9 +2843,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2806
2843
|
}, {
|
|
2807
2844
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2808
2845
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2809
|
-
var _this$
|
|
2810
|
-
var businessCode = String(((_this$
|
|
2811
|
-
var channel = String(((_this$
|
|
2846
|
+
var _this$otherParams23, _this$otherParams24;
|
|
2847
|
+
var businessCode = String(((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) || '').trim();
|
|
2848
|
+
var channel = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.channel) || '').trim();
|
|
2812
2849
|
if (!businessCode || !channel) return false;
|
|
2813
2850
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
2814
2851
|
}
|
|
@@ -3644,7 +3681,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3644
3681
|
return range ? [{
|
|
3645
3682
|
startAt: range.startAt,
|
|
3646
3683
|
endAt: range.endAt,
|
|
3647
|
-
source: descriptor.source
|
|
3684
|
+
source: descriptor.source,
|
|
3685
|
+
businessDate: date,
|
|
3686
|
+
openingAnchorAt: range.startAt
|
|
3648
3687
|
}] : [];
|
|
3649
3688
|
});
|
|
3650
3689
|
return {
|
|
@@ -3679,7 +3718,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3679
3718
|
return range ? [{
|
|
3680
3719
|
startAt: range.startAt,
|
|
3681
3720
|
endAt: range.endAt,
|
|
3682
|
-
source: "operating_schedule:".concat(descriptor.scheduleIds.map(String).join(','))
|
|
3721
|
+
source: "operating_schedule:".concat(descriptor.scheduleIds.map(String).join(',')),
|
|
3722
|
+
businessDate: date
|
|
3683
3723
|
}] : [];
|
|
3684
3724
|
});
|
|
3685
3725
|
});
|
|
@@ -3696,6 +3736,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3696
3736
|
startAt: range.startAt,
|
|
3697
3737
|
endAt: range.endAt,
|
|
3698
3738
|
source: "operating_schedule_excluded:".concat(schedule.id),
|
|
3739
|
+
businessDate: date,
|
|
3699
3740
|
raw: {
|
|
3700
3741
|
scheduleId: schedule.id,
|
|
3701
3742
|
excludedDate: date
|
|
@@ -3704,6 +3745,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3704
3745
|
});
|
|
3705
3746
|
});
|
|
3706
3747
|
});
|
|
3748
|
+
// All lunch-break windows share the first opening of their business day.
|
|
3749
|
+
var openings = new Map();
|
|
3750
|
+
[].concat(_toConsumableArray(windows), _toConsumableArray(excludedWindows)).forEach(function (window) {
|
|
3751
|
+
var date = window.businessDate || window.startAt.slice(0, 10);
|
|
3752
|
+
var previous = openings.get(date);
|
|
3753
|
+
if (!previous || window.startAt < previous) openings.set(date, window.startAt);
|
|
3754
|
+
});
|
|
3755
|
+
[].concat(_toConsumableArray(windows), _toConsumableArray(excludedWindows)).forEach(function (window) {
|
|
3756
|
+
window.openingAnchorAt = openings.get(window.businessDate || window.startAt.slice(0, 10));
|
|
3757
|
+
});
|
|
3707
3758
|
return _objectSpread({
|
|
3708
3759
|
source: descriptor.source,
|
|
3709
3760
|
scheduleIds: _toConsumableArray(descriptor.scheduleIds),
|
|
@@ -4327,12 +4378,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4327
4378
|
normalizedPrepareParams,
|
|
4328
4379
|
timezoneLabel,
|
|
4329
4380
|
dateRange,
|
|
4381
|
+
scheduleList,
|
|
4382
|
+
products,
|
|
4383
|
+
useDurationTimeGrid,
|
|
4384
|
+
coverageDateRange,
|
|
4330
4385
|
slotStepMinutes,
|
|
4331
4386
|
businessHours,
|
|
4332
4387
|
mode,
|
|
4333
|
-
scheduleList,
|
|
4334
4388
|
operatingHours,
|
|
4335
|
-
products,
|
|
4336
4389
|
loadedResources,
|
|
4337
4390
|
tempOrder,
|
|
4338
4391
|
exclusions,
|
|
@@ -4351,28 +4404,40 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4351
4404
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4352
4405
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4353
4406
|
dateRange = normalizedPrepareParams.dateRange;
|
|
4407
|
+
scheduleList = this.getAvailabilityScheduleCatalog();
|
|
4408
|
+
_context38.next = 7;
|
|
4409
|
+
return this.loadAvailabilityProducts({
|
|
4410
|
+
prepare: normalizedPrepareParams,
|
|
4411
|
+
dateRange: dateRange,
|
|
4412
|
+
scheduleList: scheduleList
|
|
4413
|
+
});
|
|
4414
|
+
case 7:
|
|
4415
|
+
products = _context38.sent;
|
|
4416
|
+
// Coverage is physical local time; the caller's date range remains business
|
|
4417
|
+
// dates. Keep yesterday's opening and the last business day's overnight tail.
|
|
4418
|
+
useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
|
|
4419
|
+
return product.kind === 'duration';
|
|
4420
|
+
});
|
|
4421
|
+
coverageDateRange = useDurationTimeGrid ? {
|
|
4422
|
+
startDate: formatLocalDate(addLocalCalendarDays(localDateToScalarStart(parseLocalDate(dateRange.startDate)), -1)),
|
|
4423
|
+
endDate: formatLocalDate(addLocalCalendarDays(localDateToScalarStart(parseLocalDate(dateRange.endDate)), 1))
|
|
4424
|
+
} : dateRange;
|
|
4354
4425
|
slotStepMinutes = normalizedPrepareParams.slotStepMinutes || DEFAULT_AVAILABILITY_SLOT_STEP_MINUTES;
|
|
4355
4426
|
businessHours = normalizedPrepareParams.businessHours || DEFAULT_AVAILABILITY_BUSINESS_HOURS;
|
|
4356
4427
|
mode = normalizedPrepareParams.mode || 'appointment';
|
|
4357
|
-
scheduleList = this.getAvailabilityScheduleCatalog();
|
|
4358
4428
|
operatingHours = this.buildAvailabilityOperatingHoursSnapshot({
|
|
4359
4429
|
prepare: normalizedPrepareParams,
|
|
4360
|
-
dateRange:
|
|
4430
|
+
dateRange: useDurationTimeGrid ? {
|
|
4431
|
+
startDate: coverageDateRange.startDate,
|
|
4432
|
+
endDate: dateRange.endDate
|
|
4433
|
+
} : dateRange,
|
|
4361
4434
|
scheduleList: scheduleList,
|
|
4362
4435
|
businessHours: businessHours
|
|
4363
4436
|
});
|
|
4364
|
-
_context38.next =
|
|
4365
|
-
return this.loadAvailabilityProducts({
|
|
4366
|
-
prepare: normalizedPrepareParams,
|
|
4367
|
-
dateRange: dateRange,
|
|
4368
|
-
scheduleList: scheduleList
|
|
4369
|
-
});
|
|
4370
|
-
case 11:
|
|
4371
|
-
products = _context38.sent;
|
|
4372
|
-
_context38.next = 14;
|
|
4437
|
+
_context38.next = 16;
|
|
4373
4438
|
return this.loadAvailabilityResources({
|
|
4374
4439
|
timezone: timezoneLabel,
|
|
4375
|
-
dateRange:
|
|
4440
|
+
dateRange: coverageDateRange,
|
|
4376
4441
|
resourceIds: normalizedPrepareParams.resourceIds,
|
|
4377
4442
|
products: products,
|
|
4378
4443
|
rawResources: normalizedPrepareParams.rawResources,
|
|
@@ -4380,7 +4445,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4380
4445
|
fetchPolicy: options.resourceFetchPolicy || 'default',
|
|
4381
4446
|
fallbackResources: options.fallbackResources
|
|
4382
4447
|
});
|
|
4383
|
-
case
|
|
4448
|
+
case 16:
|
|
4384
4449
|
loadedResources = _context38.sent;
|
|
4385
4450
|
tempOrder = this.getTempOrder();
|
|
4386
4451
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
@@ -4411,7 +4476,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4411
4476
|
resourceOccupancies: [].concat(_toConsumableArray(remoteOccupancies), _toConsumableArray(cartOccupancies)),
|
|
4412
4477
|
mode: mode,
|
|
4413
4478
|
timezone: timezoneLabel,
|
|
4414
|
-
coverage:
|
|
4479
|
+
coverage: coverageDateRange,
|
|
4415
4480
|
slotStepMinutes: slotStepMinutes,
|
|
4416
4481
|
businessHours: businessHours,
|
|
4417
4482
|
operatingHours: operatingHours,
|
|
@@ -4432,7 +4497,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4432
4497
|
prepareParams: normalizedPrepareParams,
|
|
4433
4498
|
orderRevision: orderRevision
|
|
4434
4499
|
});
|
|
4435
|
-
case
|
|
4500
|
+
case 28:
|
|
4436
4501
|
case "end":
|
|
4437
4502
|
return _context38.stop();
|
|
4438
4503
|
}
|
|
@@ -4855,8 +4920,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4855
4920
|
key: "getProductTimeRanges",
|
|
4856
4921
|
value: (function () {
|
|
4857
4922
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
|
|
4858
|
-
var _this$otherParams$
|
|
4859
|
-
_this$
|
|
4923
|
+
var _this$otherParams$pla2,
|
|
4924
|
+
_this$otherParams25,
|
|
4925
|
+
_context$prepareParam,
|
|
4926
|
+
_extractFixedOffsetMi,
|
|
4860
4927
|
_this13 = this;
|
|
4861
4928
|
var request,
|
|
4862
4929
|
_yield$this$ensureAva,
|
|
@@ -4864,6 +4931,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4864
4931
|
projectionEntry,
|
|
4865
4932
|
contextVersion,
|
|
4866
4933
|
isPosAvailabilityRequest,
|
|
4934
|
+
isEditingContext,
|
|
4935
|
+
editingOffset,
|
|
4936
|
+
editingStartAtByProductId,
|
|
4937
|
+
dateRange,
|
|
4938
|
+
editingStarts,
|
|
4939
|
+
businessDate,
|
|
4940
|
+
rememberedStartAtByProductId,
|
|
4867
4941
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
4868
4942
|
_args46 = arguments;
|
|
4869
4943
|
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
@@ -4877,14 +4951,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4877
4951
|
context = _yield$this$ensureAva.context;
|
|
4878
4952
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4879
4953
|
contextVersion = context.activeVersion;
|
|
4880
|
-
isPosAvailabilityRequest = String((_this$otherParams$
|
|
4881
|
-
|
|
4954
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4955
|
+
isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
|
|
4956
|
+
editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
|
|
4957
|
+
// to the projection's fixed business clock before the wall-clock planner.
|
|
4958
|
+
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref52) {
|
|
4959
|
+
var _ref53 = _slicedToArray(_ref52, 2),
|
|
4960
|
+
productId = _ref53[0],
|
|
4961
|
+
startAt = _ref53[1];
|
|
4962
|
+
try {
|
|
4963
|
+
var _extractFixedOffsetMi2;
|
|
4964
|
+
var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
|
|
4965
|
+
var inputOffset = (_extractFixedOffsetMi2 = extractFixedOffsetMinutes(startAt)) !== null && _extractFixedOffsetMi2 !== void 0 ? _extractFixedOffsetMi2 : editingOffset;
|
|
4966
|
+
return [productId, formatLocalDateTime(scalar + (editingOffset - inputOffset) * 60000, editingOffset)];
|
|
4967
|
+
} catch (_unused5) {
|
|
4968
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑开始时间必须是完整有效日期时间');
|
|
4969
|
+
}
|
|
4970
|
+
})) : undefined;
|
|
4971
|
+
dateRange = request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection); // Older edit drafts carry the real calendar date, not a business-date label.
|
|
4972
|
+
// The explicit absolute start disambiguates the previous day's overnight tail.
|
|
4973
|
+
editingStarts = Object.values(editingStartAtByProductId || {});
|
|
4974
|
+
if (this.usesDurationTimeGrid(projectionEntry.projection) && editingStarts.length === 1 && dateRange.startDate === dateRange.endDate && dateRange.startDate === formatLocalDate(parseLocalDateTime(editingStarts[0]))) {
|
|
4975
|
+
businessDate = getDurationBusinessDate(projectionEntry.projection, editingStarts[0]);
|
|
4976
|
+
dateRange = {
|
|
4977
|
+
startDate: businessDate,
|
|
4978
|
+
endDate: businessDate
|
|
4979
|
+
};
|
|
4980
|
+
}
|
|
4981
|
+
rememberedStartAtByProductId = isPosAvailabilityRequest && !isEditingContext ? request.rememberedStartAtByProductId : undefined;
|
|
4982
|
+
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4882
4983
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4883
|
-
});
|
|
4884
|
-
return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request),
|
|
4984
|
+
}));
|
|
4985
|
+
return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
|
|
4986
|
+
dateRange: dateRange,
|
|
4987
|
+
editingStartAtByProductId: editingStartAtByProductId,
|
|
4988
|
+
rememberedStartAtByProductId: rememberedStartAtByProductId
|
|
4989
|
+
}, rememberedStartAtByProductId ? {
|
|
4990
|
+
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
4991
|
+
} : {}), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
4885
4992
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
4886
4993
|
} : {}), {
|
|
4887
4994
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
4995
|
+
useDurationTimeGrid: this.usesDurationTimeGrid(projectionEntry.projection),
|
|
4996
|
+
enforceSaleCutoff: Boolean(rememberedStartAtByProductId),
|
|
4888
4997
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4889
4998
|
allowSessionCustomRanges: isPosAvailabilityRequest,
|
|
4890
4999
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -4895,7 +5004,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4895
5004
|
})
|
|
4896
5005
|
});
|
|
4897
5006
|
}));
|
|
4898
|
-
case
|
|
5007
|
+
case 17:
|
|
4899
5008
|
case "end":
|
|
4900
5009
|
return _context46.stop();
|
|
4901
5010
|
}
|
|
@@ -4910,8 +5019,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4910
5019
|
key: "queryBookingAvailability",
|
|
4911
5020
|
value: (function () {
|
|
4912
5021
|
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
|
|
4913
|
-
var _this$otherParams$
|
|
4914
|
-
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5022
|
+
var _this$otherParams$pla3, _this$otherParams26, _context$prepareParam2;
|
|
5023
|
+
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
|
|
4915
5024
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4916
5025
|
while (1) switch (_context47.prev = _context47.next) {
|
|
4917
5026
|
case 0:
|
|
@@ -4923,8 +5032,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4923
5032
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4924
5033
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
4925
5034
|
this.assertContextualQueryFreshness(context, request);
|
|
4926
|
-
isPosAvailabilityRequest = String((_this$otherParams$
|
|
4927
|
-
|
|
5035
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5036
|
+
queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
|
|
5037
|
+
dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
|
|
5038
|
+
}) : request;
|
|
5039
|
+
result = queryAvailabilityProjection(projectionEntry.projection, queryRequest, {
|
|
5040
|
+
useDurationTimeGrid: this.usesDurationTimeGrid(projectionEntry.projection),
|
|
5041
|
+
enforceSaleCutoff: isPosAvailabilityRequest && !((_context$prepareParam2 = context.prepareParams.editingProductLineUids) !== null && _context$prepareParam2 !== void 0 && _context$prepareParam2.length) && request.selectionIntent === 'remembered',
|
|
4928
5042
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4929
5043
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
4930
5044
|
});
|
|
@@ -4959,7 +5073,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4959
5073
|
contextVersion: contextVersion,
|
|
4960
5074
|
refreshed: refreshed
|
|
4961
5075
|
}));
|
|
4962
|
-
case
|
|
5076
|
+
case 13:
|
|
4963
5077
|
case "end":
|
|
4964
5078
|
return _context47.stop();
|
|
4965
5079
|
}
|
|
@@ -4973,7 +5087,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4973
5087
|
}, {
|
|
4974
5088
|
key: "releaseAvailabilityContext",
|
|
4975
5089
|
value: function releaseAvailabilityContext(contextId) {
|
|
4976
|
-
var _this$
|
|
5090
|
+
var _this$getActiveAvaila2;
|
|
4977
5091
|
var context = this.availabilityContextRegistry.get(contextId);
|
|
4978
5092
|
if (!context) return;
|
|
4979
5093
|
this.removeAvailabilityContext(contextId);
|
|
@@ -4981,7 +5095,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4981
5095
|
action: 'release',
|
|
4982
5096
|
contextId: contextId,
|
|
4983
5097
|
contextVersion: context.activeVersion,
|
|
4984
|
-
projection: ((_this$
|
|
5098
|
+
projection: ((_this$getActiveAvaila2 = this.getActiveAvailabilityProjectionEntry(context)) === null || _this$getActiveAvaila2 === void 0 ? void 0 : _this$getActiveAvaila2.projection) || null,
|
|
4985
5099
|
snapshotId: context.lastSnapshotId,
|
|
4986
5100
|
orderRevision: context.lastKnownOrderRevision,
|
|
4987
5101
|
reason: 'explicit_release'
|
|
@@ -5022,9 +5136,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5022
5136
|
}, {
|
|
5023
5137
|
key: "findLinkedBooking",
|
|
5024
5138
|
value: function findLinkedBooking(product) {
|
|
5025
|
-
var
|
|
5139
|
+
var _ref54, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
|
|
5026
5140
|
var productUid = getProductLineUid(product);
|
|
5027
|
-
var bookingUid = String((
|
|
5141
|
+
var bookingUid = String((_ref54 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref54 !== void 0 ? _ref54 : '');
|
|
5028
5142
|
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
|
|
5029
5143
|
var _booking$product_uid3;
|
|
5030
5144
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -5036,7 +5150,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5036
5150
|
key: "commitAvailabilitySelection",
|
|
5037
5151
|
value: (function () {
|
|
5038
5152
|
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
|
|
5039
|
-
var
|
|
5153
|
+
var _this$otherParams$pla4,
|
|
5154
|
+
_this$otherParams27,
|
|
5155
|
+
_params$availabilityC,
|
|
5156
|
+
_this$store$order11,
|
|
5157
|
+
_this$store$order11$e,
|
|
5158
|
+
_this14 = this;
|
|
5159
|
+
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams28, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams29, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5040
5160
|
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5041
5161
|
while (1) switch (_context48.prev = _context48.next) {
|
|
5042
5162
|
case 0:
|
|
@@ -5049,55 +5169,82 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5049
5169
|
candidate: params.candidate
|
|
5050
5170
|
});
|
|
5051
5171
|
case 3:
|
|
5052
|
-
|
|
5172
|
+
isRememberedSelection = params.selectionIntent === 'remembered';
|
|
5173
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
|
|
5174
|
+
_context48.next = 6;
|
|
5175
|
+
break;
|
|
5176
|
+
}
|
|
5177
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
5178
|
+
case 6:
|
|
5179
|
+
hasCommitGuard = isRememberedSelection || Boolean(params.availabilityCommitGuard);
|
|
5180
|
+
(_params$availabilityC = params.availabilityCommitGuard) === null || _params$availabilityC === void 0 || _params$availabilityC.call(params);
|
|
5181
|
+
// Stabilize the locally generated sale identity before taking the guard snapshot.
|
|
5182
|
+
if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
|
|
5183
|
+
rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5184
|
+
getRememberedCommitIdentity = function getRememberedCommitIdentity() {
|
|
5185
|
+
var _this14$otherParams$s, _this14$otherParams, _this14$otherParams2, _this14$core, _this14$getTempOrder, _this14$getTempOrder2;
|
|
5186
|
+
return JSON.stringify(stableValue({
|
|
5187
|
+
scope: _this14.getAvailabilityScopeDescriptor(),
|
|
5188
|
+
shopId: (_this14$otherParams$s = (_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.shop_id) !== null && _this14$otherParams$s !== void 0 ? _this14$otherParams$s : (_this14$otherParams2 = _this14.otherParams) === null || _this14$otherParams2 === void 0 ? void 0 : _this14$otherParams2.shopId,
|
|
5189
|
+
contextShopId: (_this14$core = _this14.core) === null || _this14$core === void 0 || (_this14$core = _this14$core.context) === null || _this14$core === void 0 ? void 0 : _this14$core.shop_id,
|
|
5190
|
+
orderId: (_this14$getTempOrder = _this14.getTempOrder()) === null || _this14$getTempOrder === void 0 ? void 0 : _this14$getTempOrder.order_id,
|
|
5191
|
+
externalSaleNumber: (_this14$getTempOrder2 = _this14.getTempOrder()) === null || _this14$getTempOrder2 === void 0 ? void 0 : _this14$getTempOrder2.external_sale_number
|
|
5192
|
+
}));
|
|
5193
|
+
};
|
|
5194
|
+
rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
|
|
5195
|
+
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5196
|
+
return _this14.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
5197
|
+
};
|
|
5198
|
+
guardedCommitPublished = false;
|
|
5199
|
+
_context48.next = 16;
|
|
5053
5200
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5054
|
-
case
|
|
5055
|
-
_context48.prev =
|
|
5201
|
+
case 16:
|
|
5202
|
+
_context48.prev = 16;
|
|
5056
5203
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5057
5204
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5058
|
-
_context48.next =
|
|
5205
|
+
_context48.next = 20;
|
|
5059
5206
|
break;
|
|
5060
5207
|
}
|
|
5061
5208
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
5062
5209
|
bookingCount: params.bookingCount
|
|
5063
5210
|
});
|
|
5064
|
-
case
|
|
5211
|
+
case 20:
|
|
5065
5212
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5066
|
-
_context48.next =
|
|
5213
|
+
_context48.next = 22;
|
|
5067
5214
|
break;
|
|
5068
5215
|
}
|
|
5069
5216
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5070
5217
|
bookingCount: bookingCount
|
|
5071
5218
|
});
|
|
5072
|
-
case
|
|
5073
|
-
orderProductQuantity = (
|
|
5219
|
+
case 22:
|
|
5220
|
+
orderProductQuantity = (_ref55 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref55 !== void 0 ? _ref55 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5074
5221
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5075
|
-
_context48.next =
|
|
5222
|
+
_context48.next = 25;
|
|
5076
5223
|
break;
|
|
5077
5224
|
}
|
|
5078
5225
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
5079
5226
|
bookingCount: bookingCount,
|
|
5080
5227
|
orderProductQuantity: orderProductQuantity
|
|
5081
5228
|
});
|
|
5082
|
-
case
|
|
5229
|
+
case 25:
|
|
5083
5230
|
partySize = Number(params.partySize);
|
|
5084
5231
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5085
|
-
_context48.next =
|
|
5232
|
+
_context48.next = 28;
|
|
5086
5233
|
break;
|
|
5087
5234
|
}
|
|
5088
5235
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5089
5236
|
partySize: params.partySize
|
|
5090
5237
|
});
|
|
5091
|
-
case
|
|
5092
|
-
_context48.next =
|
|
5238
|
+
case 28:
|
|
5239
|
+
_context48.next = 30;
|
|
5093
5240
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5094
|
-
case
|
|
5241
|
+
case 30:
|
|
5095
5242
|
_yield$this$ensureAva3 = _context48.sent;
|
|
5096
5243
|
context = _yield$this$ensureAva3.context;
|
|
5097
5244
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5098
5245
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5099
5246
|
if (!refreshed) {
|
|
5100
|
-
_context48.next =
|
|
5247
|
+
_context48.next = 36;
|
|
5101
5248
|
break;
|
|
5102
5249
|
}
|
|
5103
5250
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5105,14 +5252,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5105
5252
|
currentContextVersion: context.activeVersion,
|
|
5106
5253
|
candidateContextVersion: params.candidate.availabilityContextVersion
|
|
5107
5254
|
});
|
|
5108
|
-
case
|
|
5255
|
+
case 36:
|
|
5109
5256
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5110
5257
|
if (!(params.mode === 'edit')) {
|
|
5111
|
-
_context48.next =
|
|
5258
|
+
_context48.next = 42;
|
|
5112
5259
|
break;
|
|
5113
5260
|
}
|
|
5114
5261
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5115
|
-
_context48.next =
|
|
5262
|
+
_context48.next = 40;
|
|
5116
5263
|
break;
|
|
5117
5264
|
}
|
|
5118
5265
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5120,21 +5267,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5120
5267
|
productLineUid: params.productLineUid,
|
|
5121
5268
|
editingProductLineUids: boundEditingUids
|
|
5122
5269
|
});
|
|
5123
|
-
case
|
|
5124
|
-
_context48.next =
|
|
5270
|
+
case 40:
|
|
5271
|
+
_context48.next = 44;
|
|
5125
5272
|
break;
|
|
5126
|
-
case
|
|
5273
|
+
case 42:
|
|
5127
5274
|
if (!(boundEditingUids.length > 0)) {
|
|
5128
|
-
_context48.next =
|
|
5275
|
+
_context48.next = 44;
|
|
5129
5276
|
break;
|
|
5130
5277
|
}
|
|
5131
5278
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
5132
5279
|
contextId: normalizedContextId,
|
|
5133
5280
|
editingProductLineUids: boundEditingUids
|
|
5134
5281
|
});
|
|
5135
|
-
case
|
|
5282
|
+
case 44:
|
|
5136
5283
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5137
|
-
_context48.next =
|
|
5284
|
+
_context48.next = 46;
|
|
5138
5285
|
break;
|
|
5139
5286
|
}
|
|
5140
5287
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5142,9 +5289,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5142
5289
|
currentContextVersion: context.activeVersion,
|
|
5143
5290
|
projectionContextVersion: projectionEntry.contextVersion
|
|
5144
5291
|
});
|
|
5145
|
-
case
|
|
5292
|
+
case 46:
|
|
5146
5293
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5147
|
-
_context48.next =
|
|
5294
|
+
_context48.next = 48;
|
|
5148
5295
|
break;
|
|
5149
5296
|
}
|
|
5150
5297
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5153,9 +5300,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5153
5300
|
projectionOrderRevision: projectionEntry.orderRevision,
|
|
5154
5301
|
currentOrderRevision: this.getCurrentOrderRevision()
|
|
5155
5302
|
});
|
|
5156
|
-
case
|
|
5303
|
+
case 48:
|
|
5157
5304
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5158
|
-
_context48.next =
|
|
5305
|
+
_context48.next = 50;
|
|
5159
5306
|
break;
|
|
5160
5307
|
}
|
|
5161
5308
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5163,35 +5310,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5163
5310
|
candidateContextVersion: params.candidate.availabilityContextVersion,
|
|
5164
5311
|
currentContextVersion: context.activeVersion
|
|
5165
5312
|
});
|
|
5166
|
-
case
|
|
5313
|
+
case 50:
|
|
5167
5314
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5168
5315
|
orderProductId = (_params$orderProduct$2 = (_params$orderProduct4 = params.orderProduct) === null || _params$orderProduct4 === void 0 ? void 0 : _params$orderProduct4.product_id) !== null && _params$orderProduct$2 !== void 0 ? _params$orderProduct$2 : (_params$orderProduct5 = params.orderProduct) === null || _params$orderProduct5 === void 0 ? void 0 : _params$orderProduct5.id;
|
|
5169
5316
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5170
|
-
_context48.next =
|
|
5317
|
+
_context48.next = 54;
|
|
5171
5318
|
break;
|
|
5172
5319
|
}
|
|
5173
5320
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
5174
5321
|
orderProductId: orderProductId,
|
|
5175
5322
|
candidateProductId: params.candidate.productId
|
|
5176
5323
|
});
|
|
5177
|
-
case
|
|
5324
|
+
case 54:
|
|
5178
5325
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
5179
|
-
_context48.next =
|
|
5326
|
+
_context48.next = 56;
|
|
5180
5327
|
break;
|
|
5181
5328
|
}
|
|
5182
5329
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5183
|
-
case
|
|
5330
|
+
case 56:
|
|
5184
5331
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5185
5332
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
5186
|
-
_context48.next =
|
|
5333
|
+
_context48.next = 59;
|
|
5187
5334
|
break;
|
|
5188
5335
|
}
|
|
5189
5336
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
5190
5337
|
productLineUid: params.productLineUid
|
|
5191
5338
|
});
|
|
5192
|
-
case
|
|
5339
|
+
case 59:
|
|
5193
5340
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5194
|
-
_context48.next =
|
|
5341
|
+
_context48.next = 61;
|
|
5195
5342
|
break;
|
|
5196
5343
|
}
|
|
5197
5344
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5199,16 +5346,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5199
5346
|
productLineProductId: (_editingLine$product_2 = editingLine.product_id) !== null && _editingLine$product_2 !== void 0 ? _editingLine$product_2 : editingLine.id,
|
|
5200
5347
|
candidateProductId: params.candidate.productId
|
|
5201
5348
|
});
|
|
5202
|
-
case
|
|
5349
|
+
case 61:
|
|
5203
5350
|
if (Array.isArray(params.requirementSelections)) {
|
|
5204
|
-
_context48.next =
|
|
5351
|
+
_context48.next = 63;
|
|
5205
5352
|
break;
|
|
5206
5353
|
}
|
|
5207
5354
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
5208
5355
|
requirementSelections: params.requirementSelections
|
|
5209
5356
|
});
|
|
5210
|
-
case
|
|
5357
|
+
case 63:
|
|
5211
5358
|
baseProjection = projectionEntry.projection;
|
|
5359
|
+
selectedProduct = baseProjection.products.find(function (item) {
|
|
5360
|
+
return sameAvailabilityId(item.id, params.candidate.productId);
|
|
5361
|
+
});
|
|
5362
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
|
|
5363
|
+
_context48.next = 67;
|
|
5364
|
+
break;
|
|
5365
|
+
}
|
|
5366
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
5367
|
+
case 67:
|
|
5212
5368
|
commitWriteGuard = {
|
|
5213
5369
|
contextId: normalizedContextId,
|
|
5214
5370
|
expectedVersion: context.activeVersion,
|
|
@@ -5218,11 +5374,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5218
5374
|
};
|
|
5219
5375
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5220
5376
|
if (prepareParams) {
|
|
5221
|
-
_context48.next =
|
|
5377
|
+
_context48.next = 71;
|
|
5222
5378
|
break;
|
|
5223
5379
|
}
|
|
5224
5380
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
5225
|
-
case
|
|
5381
|
+
case 71:
|
|
5226
5382
|
fallbackResources = {
|
|
5227
5383
|
resources: cloneDeep(_toConsumableArray(baseProjection.resources || [])),
|
|
5228
5384
|
resourceOccupancies: cloneDeep(_toConsumableArray(baseProjection.resourceOccupancies || []).filter(function (occupancy) {
|
|
@@ -5230,7 +5386,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5230
5386
|
})),
|
|
5231
5387
|
includesInjectedRawOccupancies: true
|
|
5232
5388
|
};
|
|
5233
|
-
_context48.next =
|
|
5389
|
+
_context48.next = 74;
|
|
5234
5390
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5235
5391
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
5236
5392
|
}), {
|
|
@@ -5238,20 +5394,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5238
5394
|
fallbackResources: fallbackResources,
|
|
5239
5395
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5240
5396
|
});
|
|
5241
|
-
case
|
|
5397
|
+
case 74:
|
|
5242
5398
|
commitSnapshot = _context48.sent;
|
|
5243
5399
|
refreshedProjection = commitSnapshot.projection;
|
|
5244
5400
|
if (!(String((_refreshedProjection$ = refreshedProjection.meta.orderRevision) !== null && _refreshedProjection$ !== void 0 ? _refreshedProjection$ : '') !== String((_baseProjection$meta$2 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$2 !== void 0 ? _baseProjection$meta$2 : ''))) {
|
|
5245
|
-
_context48.next =
|
|
5401
|
+
_context48.next = 81;
|
|
5246
5402
|
break;
|
|
5247
5403
|
}
|
|
5248
|
-
_context48.next =
|
|
5404
|
+
_context48.next = 79;
|
|
5249
5405
|
return this.refreshAvailabilityContextProjection({
|
|
5250
5406
|
contextId: normalizedContextId,
|
|
5251
5407
|
reason: 'commit_order_revision_changed',
|
|
5252
5408
|
previousOrderRevision: String((_baseProjection$meta$3 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$3 !== void 0 ? _baseProjection$meta$3 : '')
|
|
5253
5409
|
});
|
|
5254
|
-
case
|
|
5410
|
+
case 79:
|
|
5255
5411
|
latestContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5256
5412
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '最终缓存重校验期间购物车已变化,请重新获取候选', {
|
|
5257
5413
|
contextId: normalizedContextId,
|
|
@@ -5262,24 +5418,34 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5262
5418
|
snapshotId: baseProjection.meta.snapshotId,
|
|
5263
5419
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5264
5420
|
});
|
|
5265
|
-
case
|
|
5421
|
+
case 81:
|
|
5266
5422
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5267
5423
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5268
5424
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5269
|
-
allowPosAvailabilityOverride = String((_this$otherParams$
|
|
5425
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
|
|
5426
|
+
candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
|
|
5270
5427
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5271
5428
|
productIds: [params.candidate.productId],
|
|
5272
5429
|
dateRange: {
|
|
5273
|
-
startDate:
|
|
5274
|
-
endDate:
|
|
5430
|
+
startDate: candidateBusinessDate,
|
|
5431
|
+
endDate: candidateBusinessDate
|
|
5275
5432
|
}
|
|
5276
|
-
},
|
|
5433
|
+
}, isRememberedSelection ? _objectSpread({
|
|
5434
|
+
rememberedStartAtByProductId: _defineProperty({}, String(params.candidate.productId), params.candidate.bookingStartAt)
|
|
5435
|
+
}, !(selectedProduct !== null && selectedProduct !== void 0 && selectedProduct.isFlexibleDuration) && candidateDurationMinutes ? {
|
|
5277
5436
|
durationMinutesByProductId: _defineProperty({}, String(params.candidate.productId), candidateDurationMinutes)
|
|
5278
|
-
}
|
|
5437
|
+
} : {}) : candidateDurationMinutes ? _objectSpread(_objectSpread({
|
|
5438
|
+
durationMinutesByProductId: _defineProperty({}, String(params.candidate.productId), candidateDurationMinutes)
|
|
5439
|
+
}, params.mode === 'edit' && (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' ? {
|
|
5440
|
+
editingStartAtByProductId: _defineProperty({}, String(params.candidate.productId), params.candidate.bookingStartAt)
|
|
5441
|
+
} : {}), candidateStartTime ? _objectSpread({
|
|
5279
5442
|
durationStartTimesByProductId: _defineProperty({}, String(params.candidate.productId), [candidateStartTime])
|
|
5280
5443
|
}, allowPosAvailabilityOverride ? {
|
|
5281
5444
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5282
5445
|
} : {}) : {}) : {}), {
|
|
5446
|
+
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
5447
|
+
useDurationTimeGrid: this.usesDurationTimeGrid(refreshedProjection),
|
|
5448
|
+
enforceSaleCutoff: isRememberedSelection,
|
|
5283
5449
|
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
5284
5450
|
allowSessionCustomRanges: allowPosAvailabilityOverride,
|
|
5285
5451
|
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
@@ -5290,7 +5456,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5290
5456
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5291
5457
|
});
|
|
5292
5458
|
if (refreshedCandidateBase) {
|
|
5293
|
-
_context48.next =
|
|
5459
|
+
_context48.next = 90;
|
|
5294
5460
|
break;
|
|
5295
5461
|
}
|
|
5296
5462
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5298,24 +5464,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5298
5464
|
candidate: params.candidate,
|
|
5299
5465
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5300
5466
|
});
|
|
5301
|
-
case
|
|
5467
|
+
case 90:
|
|
5302
5468
|
product = refreshedProjection.products.find(function (item) {
|
|
5303
5469
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5304
5470
|
});
|
|
5305
5471
|
if (product) {
|
|
5306
|
-
_context48.next =
|
|
5472
|
+
_context48.next = 93;
|
|
5307
5473
|
break;
|
|
5308
5474
|
}
|
|
5309
5475
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
5310
5476
|
productId: refreshedCandidateBase.productId
|
|
5311
5477
|
});
|
|
5312
|
-
case
|
|
5478
|
+
case 93:
|
|
5313
5479
|
validation = validateAvailabilitySelection(refreshedProjection, {
|
|
5314
5480
|
candidate: refreshedCandidateBase,
|
|
5315
5481
|
requirementSelections: params.requirementSelections,
|
|
5316
5482
|
partySize: partySize,
|
|
5317
5483
|
bookingCount: bookingCount
|
|
5318
5484
|
}, {
|
|
5485
|
+
useDurationTimeGrid: this.usesDurationTimeGrid(refreshedProjection),
|
|
5486
|
+
enforceSaleCutoff: isRememberedSelection,
|
|
5319
5487
|
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
5320
5488
|
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
5321
5489
|
});
|
|
@@ -5340,7 +5508,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5340
5508
|
});
|
|
5341
5509
|
}
|
|
5342
5510
|
if (validation.ok) {
|
|
5343
|
-
_context48.next =
|
|
5511
|
+
_context48.next = 98;
|
|
5344
5512
|
break;
|
|
5345
5513
|
}
|
|
5346
5514
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5350,7 +5518,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5350
5518
|
validation: validation,
|
|
5351
5519
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5352
5520
|
});
|
|
5353
|
-
case
|
|
5521
|
+
case 98:
|
|
5354
5522
|
// Revalidation failure must leave the caller's candidate reusable. Only publish the
|
|
5355
5523
|
// refreshed projection/version after candidate and resource validation has passed;
|
|
5356
5524
|
// otherwise a second Confirm from the still-open modal would incorrectly become stale.
|
|
@@ -5363,7 +5531,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5363
5531
|
incrementVersion: true
|
|
5364
5532
|
});
|
|
5365
5533
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5366
|
-
_context48.next =
|
|
5534
|
+
_context48.next = 102;
|
|
5367
5535
|
return this.emitAvailabilityDiagnostic({
|
|
5368
5536
|
action: 'refresh',
|
|
5369
5537
|
contextId: normalizedContextId,
|
|
@@ -5374,7 +5542,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5374
5542
|
previousOrderRevision: baseProjection.meta.orderRevision,
|
|
5375
5543
|
reason: 'commit_cached_occupancy_revalidation'
|
|
5376
5544
|
});
|
|
5377
|
-
case
|
|
5545
|
+
case 102:
|
|
5378
5546
|
commitWriteGuard = {
|
|
5379
5547
|
contextId: normalizedContextId,
|
|
5380
5548
|
expectedVersion: revalidatedContext.activeVersion,
|
|
@@ -5382,17 +5550,41 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5382
5550
|
expectedLifecycleGeneration: this.availabilityLifecycleGeneration,
|
|
5383
5551
|
expectedOrderRevision: revalidationEntry.orderRevision
|
|
5384
5552
|
};
|
|
5385
|
-
refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase);
|
|
5553
|
+
refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase); // Order may await line/runtime setup. Its guarded transaction invokes this
|
|
5554
|
+
// again immediately before publishing, while the live cart is unchanged.
|
|
5555
|
+
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
5556
|
+
var _params$availabilityC2;
|
|
5557
|
+
(_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
|
|
5558
|
+
_this14.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5559
|
+
if (!availabilityCommitTargetGuard()) {
|
|
5560
|
+
throw _this14.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
|
|
5561
|
+
}
|
|
5562
|
+
if (!isRememberedSelection) return;
|
|
5563
|
+
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
5564
|
+
candidate: refreshedCandidateBase,
|
|
5565
|
+
requirementSelections: params.requirementSelections,
|
|
5566
|
+
partySize: partySize,
|
|
5567
|
+
bookingCount: bookingCount
|
|
5568
|
+
}, {
|
|
5569
|
+
useDurationTimeGrid: true,
|
|
5570
|
+
enforceSaleCutoff: true
|
|
5571
|
+
});
|
|
5572
|
+
if (!currentValidation.ok) {
|
|
5573
|
+
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间在加购前已不可用,请重新选择', {
|
|
5574
|
+
validation: currentValidation
|
|
5575
|
+
});
|
|
5576
|
+
}
|
|
5577
|
+
} : undefined;
|
|
5386
5578
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5387
5579
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5388
5580
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
5389
|
-
_context48.next =
|
|
5581
|
+
_context48.next = 109;
|
|
5390
5582
|
break;
|
|
5391
5583
|
}
|
|
5392
5584
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
5393
5585
|
productLineUid: params.productLineUid
|
|
5394
5586
|
});
|
|
5395
|
-
case
|
|
5587
|
+
case 109:
|
|
5396
5588
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5397
5589
|
booking = buildBookingFromAvailabilitySelection({
|
|
5398
5590
|
assignments: validation.assignments,
|
|
@@ -5400,21 +5592,54 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5400
5592
|
product: product,
|
|
5401
5593
|
resources: refreshedProjection.resources,
|
|
5402
5594
|
bookingUid: existingBookingUid || undefined,
|
|
5403
|
-
holder: (
|
|
5404
|
-
holderIds: (
|
|
5595
|
+
holder: (_ref56 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref56 !== void 0 ? _ref56 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
5596
|
+
holderIds: (_ref57 = (_ref58 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
5405
5597
|
});
|
|
5598
|
+
if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
|
|
5599
|
+
_context48.next = 119;
|
|
5600
|
+
break;
|
|
5601
|
+
}
|
|
5602
|
+
// AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
|
|
5603
|
+
// 必须与本次严格校验结果一致;时间、Holder 和校验元数据仍使用上面的结果。
|
|
5604
|
+
legacyBooking = cacheItemToBookingInput(params.orderProduct);
|
|
5605
|
+
legacyResources = legacyBooking.resources || [];
|
|
5606
|
+
selectedResources = legacyResources.filter(function (resource) {
|
|
5607
|
+
return Number(resource.relation_id) !== 0;
|
|
5608
|
+
});
|
|
5609
|
+
resourceKeys = function resourceKeys(resources) {
|
|
5610
|
+
return resources.map(function (resource) {
|
|
5611
|
+
return JSON.stringify([String(resource.form_id), String(resource.relation_id), resource.relation_type, Number(resource.capacity)]);
|
|
5612
|
+
}).sort();
|
|
5613
|
+
};
|
|
5614
|
+
if (!(JSON.stringify(resourceKeys(selectedResources)) !== JSON.stringify(resourceKeys(booking.resources)) || legacyResources.some(function (resource) {
|
|
5615
|
+
return Number(resource.relation_id) === 0 && !selectedResources.some(function (selected) {
|
|
5616
|
+
return sameAvailabilityId(selected.form_id, resource.form_id);
|
|
5617
|
+
});
|
|
5618
|
+
}))) {
|
|
5619
|
+
_context48.next = 118;
|
|
5620
|
+
break;
|
|
5621
|
+
}
|
|
5622
|
+
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
|
|
5623
|
+
case 118:
|
|
5624
|
+
Object.assign(booking, {
|
|
5625
|
+
relation_id: legacyBooking.relation_id,
|
|
5626
|
+
form_id: legacyBooking.form_id,
|
|
5627
|
+
relation_type: legacyBooking.relation_type,
|
|
5628
|
+
resources: cloneDeep(legacyResources)
|
|
5629
|
+
});
|
|
5630
|
+
case 119:
|
|
5406
5631
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
5407
5632
|
num: bookingCount,
|
|
5408
5633
|
quantity: bookingCount
|
|
5409
5634
|
}), 'unified_booking_sales', product);
|
|
5410
5635
|
if (transformed) {
|
|
5411
|
-
_context48.next =
|
|
5636
|
+
_context48.next = 122;
|
|
5412
5637
|
break;
|
|
5413
5638
|
}
|
|
5414
5639
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
5415
5640
|
orderProduct: params.orderProduct
|
|
5416
5641
|
});
|
|
5417
|
-
case
|
|
5642
|
+
case 122:
|
|
5418
5643
|
transformed.num = bookingCount;
|
|
5419
5644
|
transformed.metadata = _objectSpread(_objectSpread({}, transformed.metadata || {}), {}, {
|
|
5420
5645
|
unified_booking_sales: true,
|
|
@@ -5427,7 +5652,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5427
5652
|
productLineUids = [];
|
|
5428
5653
|
bookingUids = [];
|
|
5429
5654
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5430
|
-
_context48.next =
|
|
5655
|
+
_context48.next = 141;
|
|
5431
5656
|
break;
|
|
5432
5657
|
}
|
|
5433
5658
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5437,10 +5662,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5437
5662
|
unique_identification_number: params.productLineUid,
|
|
5438
5663
|
booking_uid: existingBookingUid
|
|
5439
5664
|
});
|
|
5440
|
-
_context48.next =
|
|
5665
|
+
_context48.next = 135;
|
|
5441
5666
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
5442
5667
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5443
|
-
product_variant_id: (
|
|
5668
|
+
product_variant_id: (_ref59 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref59 !== void 0 ? _ref59 : 0,
|
|
5444
5669
|
unique_identification_number: params.productLineUid,
|
|
5445
5670
|
updates: transformed,
|
|
5446
5671
|
booking: booking
|
|
@@ -5449,26 +5674,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5449
5674
|
} : {}), params.allowBookingDiscountReapply !== undefined ? {
|
|
5450
5675
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
5451
5676
|
} : {}));
|
|
5452
|
-
case
|
|
5677
|
+
case 135:
|
|
5453
5678
|
productLineUid = params.productLineUid;
|
|
5454
5679
|
bookingUid = existingBookingUid;
|
|
5455
5680
|
productLineUids = [productLineUid];
|
|
5456
5681
|
bookingUids = [bookingUid];
|
|
5457
|
-
_context48.next =
|
|
5682
|
+
_context48.next = 155;
|
|
5458
5683
|
break;
|
|
5459
|
-
case
|
|
5684
|
+
case 141:
|
|
5460
5685
|
beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
|
|
5461
5686
|
return getProductLineUid(line);
|
|
5462
5687
|
}).filter(Boolean));
|
|
5463
5688
|
beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
|
|
5464
5689
|
return getBookingUid(item);
|
|
5465
5690
|
}).filter(Boolean));
|
|
5466
|
-
|
|
5467
|
-
|
|
5691
|
+
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
5692
|
+
_context48.next = 146;
|
|
5693
|
+
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
|
|
5468
5694
|
salesNotes: params.salesNotes
|
|
5469
|
-
} :
|
|
5470
|
-
|
|
5695
|
+
} : {}), availabilityCommitGuard ? {
|
|
5696
|
+
availabilityCommitGuard: availabilityCommitGuard,
|
|
5697
|
+
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
5698
|
+
} : {}) : undefined);
|
|
5699
|
+
case 146:
|
|
5471
5700
|
products = _context48.sent;
|
|
5701
|
+
guardedCommitPublished = hasCommitGuard;
|
|
5472
5702
|
addedLines = products.filter(function (line) {
|
|
5473
5703
|
var _line$product_id, _line$metadata;
|
|
5474
5704
|
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
|
|
@@ -5476,7 +5706,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5476
5706
|
productLineUids = addedLines.map(function (line) {
|
|
5477
5707
|
return getProductLineUid(line);
|
|
5478
5708
|
}).filter(Boolean);
|
|
5479
|
-
addedBookings = (((
|
|
5709
|
+
addedBookings = (((_ref60 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref60 === void 0 ? void 0 : _ref60.bookings) || []).filter(function (item) {
|
|
5480
5710
|
var _item$metadata;
|
|
5481
5711
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
5482
5712
|
});
|
|
@@ -5485,19 +5715,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5485
5715
|
}).filter(Boolean);
|
|
5486
5716
|
if (bookingUids.length === 0) {
|
|
5487
5717
|
bookingUids = addedLines.map(function (line) {
|
|
5488
|
-
var
|
|
5489
|
-
return String((
|
|
5718
|
+
var _ref61, _line$booking_uid, _line$metadata2;
|
|
5719
|
+
return String((_ref61 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref61 !== void 0 ? _ref61 : '');
|
|
5490
5720
|
}).filter(Boolean);
|
|
5491
5721
|
}
|
|
5492
5722
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
5493
5723
|
bookingUid = bookingUids[bookingUids.length - 1] || '';
|
|
5494
|
-
case
|
|
5495
|
-
|
|
5496
|
-
|
|
5724
|
+
case 155:
|
|
5725
|
+
targetStillCurrent = !hasCommitGuard || availabilityCommitTargetGuard();
|
|
5726
|
+
if (targetStillCurrent) this.invalidateAvailabilityContextsAfterCommit();else this.removeAvailabilityContext(normalizedContextId);
|
|
5727
|
+
nextContext = hasCommitGuard ? this.availabilityContextRegistry.get(normalizedContextId) : this.getAvailabilityContextEntry(normalizedContextId);
|
|
5497
5728
|
result = {
|
|
5498
5729
|
contextId: normalizedContextId,
|
|
5499
|
-
contextVersion: nextContext.activeVersion,
|
|
5500
|
-
tempOrder: this.getTempOrder(),
|
|
5730
|
+
contextVersion: (_nextContext$activeVe = nextContext === null || nextContext === void 0 ? void 0 : nextContext.activeVersion) !== null && _nextContext$activeVe !== void 0 ? _nextContext$activeVe : refreshedCandidate.availabilityContextVersion,
|
|
5731
|
+
tempOrder: hasCommitGuard ? rememberedOrder : this.getTempOrder(),
|
|
5501
5732
|
validation: validation,
|
|
5502
5733
|
candidate: refreshedCandidate,
|
|
5503
5734
|
productLineUid: productLineUid,
|
|
@@ -5505,21 +5736,59 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5505
5736
|
productLineUids: productLineUids,
|
|
5506
5737
|
bookingUids: bookingUids
|
|
5507
5738
|
};
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5739
|
+
if (!targetStillCurrent) {
|
|
5740
|
+
_context48.next = 173;
|
|
5741
|
+
break;
|
|
5742
|
+
}
|
|
5743
|
+
// A notification failure after publication must not invite a duplicate add.
|
|
5744
|
+
emit = function emit() {
|
|
5745
|
+
return _this14.core.effects.emit("".concat(_this14.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
5746
|
+
};
|
|
5747
|
+
if (!guardedCommitPublished) {
|
|
5748
|
+
_context48.next = 171;
|
|
5749
|
+
break;
|
|
5750
|
+
}
|
|
5751
|
+
_context48.prev = 162;
|
|
5752
|
+
_context48.next = 165;
|
|
5753
|
+
return emit();
|
|
5754
|
+
case 165:
|
|
5755
|
+
_context48.next = 169;
|
|
5756
|
+
break;
|
|
5757
|
+
case 167:
|
|
5758
|
+
_context48.prev = 167;
|
|
5759
|
+
_context48.t0 = _context48["catch"](162);
|
|
5760
|
+
case 169:
|
|
5761
|
+
_context48.next = 173;
|
|
5762
|
+
break;
|
|
5763
|
+
case 171:
|
|
5764
|
+
_context48.next = 173;
|
|
5765
|
+
return emit();
|
|
5766
|
+
case 173:
|
|
5511
5767
|
return _context48.abrupt("return", result);
|
|
5512
|
-
case
|
|
5513
|
-
_context48.prev =
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5768
|
+
case 174:
|
|
5769
|
+
_context48.prev = 174;
|
|
5770
|
+
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
5771
|
+
if (!guardedCommitPublished) {
|
|
5772
|
+
_context48.next = 181;
|
|
5773
|
+
break;
|
|
5774
|
+
}
|
|
5775
|
+
_context48.next = 179;
|
|
5776
|
+
return release.catch(function () {
|
|
5777
|
+
return undefined;
|
|
5778
|
+
});
|
|
5779
|
+
case 179:
|
|
5780
|
+
_context48.next = 183;
|
|
5781
|
+
break;
|
|
5782
|
+
case 181:
|
|
5783
|
+
_context48.next = 183;
|
|
5784
|
+
return release;
|
|
5785
|
+
case 183:
|
|
5786
|
+
return _context48.finish(174);
|
|
5787
|
+
case 184:
|
|
5519
5788
|
case "end":
|
|
5520
5789
|
return _context48.stop();
|
|
5521
5790
|
}
|
|
5522
|
-
}, _callee48, this, [[
|
|
5791
|
+
}, _callee48, this, [[16,, 174, 184], [162, 167]]);
|
|
5523
5792
|
}));
|
|
5524
5793
|
function commitAvailabilitySelection(_x36, _x37) {
|
|
5525
5794
|
return _commitAvailabilitySelection.apply(this, arguments);
|