@pisell/pisellos 0.10.51 → 0.10.53

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.
@@ -44,12 +44,11 @@ import { UnifiedBookingSalesHooks } from "./types";
44
44
  import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
45
45
  import { BookingTicket } from "../BookingTicket";
46
46
  import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
47
- import { isCustomerUserPlatform } from "../../utils/platform";
47
+ import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
48
48
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
49
49
  export * from "./types";
50
50
  export { AvailabilityError } from "../../modules/ResourcePlanner";
51
51
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability', 'documents'];
52
- var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
53
52
  function normalizePositiveInteger(value) {
54
53
  var normalized = Number(value);
55
54
  if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
@@ -1315,6 +1314,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1315
1314
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
1316
1315
  _defineProperty(_assertThisInitialized(_this), "store", {});
1317
1316
  _defineProperty(_assertThisInitialized(_this), "pickupTimingEnabled", true);
1317
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataScope", null);
1318
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataSnapshot", null);
1319
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataModule", null);
1320
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataCore", void 0);
1321
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataGeneration", 0);
1322
+ _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
1318
1323
  _defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
1319
1324
  _defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
1320
1325
  _defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
@@ -1339,30 +1344,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1339
1344
  key: "initialize",
1340
1345
  value: function () {
1341
1346
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
1342
- var _ref23, _this$otherParams$bus, _this$otherParams, _this$otherParams2, _this$otherParams$cha, _this$otherParams3, _this$otherParams4;
1343
1347
  var options,
1344
- openDataBusinessCode,
1345
- openDataChannel,
1348
+ openDataGeneration,
1346
1349
  _args = arguments;
1347
1350
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1348
1351
  while (1) switch (_context.prev = _context.next) {
1349
1352
  case 0:
1350
1353
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
1354
+ this.resetRuntimeOpenData();
1355
+ this.runtimeOpenDataDestroyed = false;
1356
+ openDataGeneration = this.runtimeOpenDataGeneration;
1351
1357
  this.availabilityScheduleCatalog = null;
1352
- this.openDataTarget = null;
1353
1358
  this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
1354
1359
  this.clearAvailabilityRemoteResourceState();
1355
1360
  this.resetAllergyItemRuleState();
1356
- _context.next = 8;
1361
+ _context.next = 10;
1357
1362
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
1358
- case 8:
1359
- openDataBusinessCode = String((_ref23 = (_this$otherParams$bus = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.business_code) !== null && _ref23 !== void 0 ? _ref23 : '').trim();
1360
- openDataChannel = String((_this$otherParams$cha = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
1361
- if ((_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.openData && openDataBusinessCode && openDataChannel) {
1362
- this.openDataTarget = "".concat(openDataBusinessCode, "+").concat(openDataChannel);
1363
+ case 10:
1364
+ if (!(this.runtimeOpenDataDestroyed || openDataGeneration !== this.runtimeOpenDataGeneration)) {
1365
+ _context.next = 12;
1366
+ break;
1363
1367
  }
1364
- this.captureAvailabilityScheduleCatalog();
1368
+ throw new Error('Store settings changed. Please try again.');
1365
1369
  case 12:
1370
+ this.captureAvailabilityScheduleCatalog();
1371
+ case 13:
1366
1372
  case "end":
1367
1373
  return _context.stop();
1368
1374
  }
@@ -1376,8 +1382,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1376
1382
  }, {
1377
1383
  key: "getSubmitOrderSalesChannel",
1378
1384
  value: function getSubmitOrderSalesChannel() {
1379
- var _this$otherParams$cha2, _this$otherParams5;
1380
- var channel = String((_this$otherParams$cha2 = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel) !== null && _this$otherParams$cha2 !== void 0 ? _this$otherParams$cha2 : '').trim();
1385
+ var _this$otherParams$cha, _this$otherParams;
1386
+ var channel = String((_this$otherParams$cha = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
1381
1387
  return channel || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this);
1382
1388
  }
1383
1389
  }, {
@@ -1388,11 +1394,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1388
1394
  }, {
1389
1395
  key: "getAvailabilityScopeDescriptor",
1390
1396
  value: function getAvailabilityScopeDescriptor() {
1391
- var _ref24, _otherParams$business, _otherParams$channel, _otherParams$platform, _otherParams$business2;
1397
+ var _ref23, _otherParams$business, _otherParams$channel, _otherParams$platform, _otherParams$business2;
1392
1398
  var otherParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams || {};
1393
1399
  return {
1394
1400
  cacheId: this.cacheId || '',
1395
- businessCode: String((_ref24 = (_otherParams$business = otherParams.businessCode) !== null && _otherParams$business !== void 0 ? _otherParams$business : otherParams.business_code) !== null && _ref24 !== void 0 ? _ref24 : ''),
1401
+ businessCode: String((_ref23 = (_otherParams$business = otherParams.businessCode) !== null && _otherParams$business !== void 0 ? _otherParams$business : otherParams.business_code) !== null && _ref23 !== void 0 ? _ref23 : ''),
1396
1402
  channel: String((_otherParams$channel = otherParams.channel) !== null && _otherParams$channel !== void 0 ? _otherParams$channel : ''),
1397
1403
  platform: String((_otherParams$platform = otherParams.platform) !== null && _otherParams$platform !== void 0 ? _otherParams$platform : ''),
1398
1404
  businessTimezone: String((_otherParams$business2 = otherParams.businessTimezone) !== null && _otherParams$business2 !== void 0 ? _otherParams$business2 : '')
@@ -1406,15 +1412,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1406
1412
  values.forEach(function (value) {
1407
1413
  uniqueMap.set(String(value), value);
1408
1414
  });
1409
- return Array.from(uniqueMap.entries()).sort(function (_ref25, _ref26) {
1415
+ return Array.from(uniqueMap.entries()).sort(function (_ref24, _ref25) {
1416
+ var _ref26 = _slicedToArray(_ref24, 1),
1417
+ left = _ref26[0];
1410
1418
  var _ref27 = _slicedToArray(_ref25, 1),
1411
- left = _ref27[0];
1412
- var _ref28 = _slicedToArray(_ref26, 1),
1413
- right = _ref28[0];
1419
+ right = _ref27[0];
1414
1420
  return left.localeCompare(right);
1415
- }).map(function (_ref29) {
1416
- var _ref30 = _slicedToArray(_ref29, 2),
1417
- value = _ref30[1];
1421
+ }).map(function (_ref28) {
1422
+ var _ref29 = _slicedToArray(_ref28, 2),
1423
+ value = _ref29[1];
1418
1424
  return value;
1419
1425
  });
1420
1426
  }
@@ -1429,9 +1435,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1429
1435
  }, {
1430
1436
  key: "normalizeAvailabilityPrepareDescriptor",
1431
1437
  value: function normalizeAvailabilityPrepareDescriptor(params) {
1432
- var _this$otherParams6;
1438
+ var _this$otherParams2;
1433
1439
  this.assertAvailabilityPrepareParams(params);
1434
- var timezone = String(params.timezone || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai');
1440
+ var timezone = String(params.timezone || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai');
1435
1441
  assertValidAvailabilityTimezone(timezone);
1436
1442
  var dateRange = this.normalizeAvailabilityDateRange(params, timezone);
1437
1443
  var slotStepMinutes = params.slotStepMinutes || DEFAULT_AVAILABILITY_SLOT_STEP_MINUTES;
@@ -1461,7 +1467,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1461
1467
  key: "resolveAvailabilityPrepareDefaults",
1462
1468
  value: function () {
1463
1469
  var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
1464
- var _ref31, _this$otherParams$bus2, _this$otherParams7, _this$otherParams8, _this$otherParams$cha3, _this$otherParams9, _this$otherParams10, _openData, _openData2, _openData3;
1470
+ var _ref30, _this$otherParams$bus, _this$otherParams3, _this$otherParams4, _this$otherParams$cha2, _this$otherParams5, _this$otherParams6, _openData, _openData2, _openData3;
1465
1471
  var needsOperatingHours, needsTimeSlice, businessCode, channel, currentTarget, openData, operatingScheduleIds, configuredTimeSlice;
1466
1472
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1467
1473
  while (1) switch (_context2.prev = _context2.next) {
@@ -1479,10 +1485,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1479
1485
  }
1480
1486
  }));
1481
1487
  case 4:
1482
- businessCode = String((_ref31 = (_this$otherParams$bus2 = (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code) !== null && _ref31 !== void 0 ? _ref31 : '').trim();
1483
- channel = String((_this$otherParams$cha3 = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel) !== null && _this$otherParams$cha3 !== void 0 ? _this$otherParams$cha3 : '').trim();
1488
+ businessCode = String((_ref30 = (_this$otherParams$bus = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code) !== null && _ref30 !== void 0 ? _ref30 : '').trim();
1489
+ channel = String((_this$otherParams$cha2 = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel) !== null && _this$otherParams$cha2 !== void 0 ? _this$otherParams$cha2 : '').trim();
1484
1490
  currentTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : null;
1485
- openData = !currentTarget || this.openDataTarget === currentTarget ? (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.openData : null;
1491
+ openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.openData : null;
1486
1492
  if (!(!openData && this.store.openData)) {
1487
1493
  _context2.next = 20;
1488
1494
  break;
@@ -1572,45 +1578,50 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1572
1578
  key: "setOtherParams",
1573
1579
  value: function () {
1574
1580
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
1575
- var _this$otherParams11, _this$otherParams13;
1576
- var _ref32,
1577
- _ref32$cover,
1581
+ var _this$otherParams7, _this$otherParams9;
1582
+ var _ref31,
1583
+ _ref31$cover,
1578
1584
  cover,
1579
1585
  previousScope,
1580
1586
  previousItemRuleConfig,
1581
1587
  explicitlySetsOpenData,
1588
+ nextParams,
1582
1589
  nextScope,
1583
- _this$otherParams12,
1590
+ _this$otherParams8,
1584
1591
  shouldResetAvailabilityState,
1585
1592
  _args3 = arguments;
1586
1593
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1587
1594
  while (1) switch (_context3.prev = _context3.next) {
1588
1595
  case 0:
1589
- _ref32 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref32$cover = _ref32.cover, cover = _ref32$cover === void 0 ? false : _ref32$cover;
1596
+ _ref31 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
1590
1597
  previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1591
- previousItemRuleConfig = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule;
1598
+ previousItemRuleConfig = (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.itemRule;
1592
1599
  explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
1593
- _context3.next = 6;
1600
+ nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
1601
+ if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
1602
+ this.clearOpenDataCache();
1603
+ }
1604
+ _context3.next = 8;
1594
1605
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
1595
1606
  cover: cover
1596
1607
  });
1597
- case 6:
1608
+ case 8:
1598
1609
  nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1599
1610
  if (explicitlySetsOpenData) {
1600
- this.openDataTarget = (_this$otherParams12 = this.otherParams) !== null && _this$otherParams12 !== void 0 && _this$otherParams12.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1611
+ this.openDataTarget = (_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1601
1612
  }
1602
1613
  shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
1603
1614
  if (!shouldResetAvailabilityState) {
1604
- _context3.next = 12;
1615
+ _context3.next = 14;
1605
1616
  break;
1606
1617
  }
1607
- _context3.next = 12;
1618
+ _context3.next = 14;
1608
1619
  return this.resetAvailabilityProjectionState('set_other_params_reset');
1609
- case 12:
1610
- if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.itemRule)) {
1620
+ case 14:
1621
+ if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.itemRule)) {
1611
1622
  this.resetAllergyItemRuleState();
1612
1623
  }
1613
- case 13:
1624
+ case 15:
1614
1625
  case "end":
1615
1626
  return _context3.stop();
1616
1627
  }
@@ -1628,15 +1639,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1628
1639
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1629
1640
  while (1) switch (_context4.prev = _context4.next) {
1630
1641
  case 0:
1642
+ this.runtimeOpenDataDestroyed = true;
1643
+ this.clearOpenDataCache();
1631
1644
  this.availabilityScheduleCatalog = null;
1632
1645
  this.availabilityRuntimeOffsetMinutes = null;
1633
- _context4.next = 4;
1646
+ _context4.next = 6;
1634
1647
  return this.resetAvailabilityProjectionState('destroy');
1635
- case 4:
1648
+ case 6:
1636
1649
  this.resetAllergyItemRuleState();
1637
- _context4.next = 7;
1650
+ _context4.next = 9;
1638
1651
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
1639
- case 7:
1652
+ case 9:
1640
1653
  case "end":
1641
1654
  return _context4.stop();
1642
1655
  }
@@ -1841,8 +1854,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1841
1854
  }, {
1842
1855
  key: "isSessionStoragePersistEnabled",
1843
1856
  value: function isSessionStoragePersistEnabled() {
1844
- var _this$otherParams14;
1845
- return Boolean(this.cacheId && ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.enableSessionStoragePersist) === true);
1857
+ var _this$otherParams10;
1858
+ return Boolean(this.cacheId && ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.enableSessionStoragePersist) === true);
1846
1859
  }
1847
1860
  }, {
1848
1861
  key: "shouldUseSessionStorageForSubModule",
@@ -1911,10 +1924,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1911
1924
  }, {
1912
1925
  key: "shouldUseCheckoutSyncTask",
1913
1926
  value: function shouldUseCheckoutSyncTask() {
1914
- var _this$otherParams15, _this$otherParams$pla, _this$otherParams16;
1915
- var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
1927
+ var _this$otherParams11, _this$otherParams$pla, _this$otherParams12;
1928
+ var configured = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.checkoutSyncTaskEnabled;
1916
1929
  if (configured === true) return true;
1917
- var platform = String((_this$otherParams$pla = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase();
1930
+ var platform = String((_this$otherParams$pla = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase();
1918
1931
  return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
1919
1932
  }
1920
1933
 
@@ -2069,8 +2082,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2069
2082
  }, {
2070
2083
  key: "isAuthenticatedCustomerUserPlatform",
2071
2084
  value: function isAuthenticatedCustomerUserPlatform() {
2072
- var _this$otherParams17;
2073
- return isCustomerUserPlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
2085
+ var _this$otherParams13;
2086
+ return isCustomerUserPlatform((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform);
2074
2087
  }
2075
2088
  }, {
2076
2089
  key: "resolveDiscountOrderIdentity",
@@ -2159,99 +2172,229 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2159
2172
  }
2160
2173
  return refreshLegacySessionCustomerDiscounts;
2161
2174
  }()
2162
- /**
2163
- * Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
2164
- * business/channel target so a reused solution instance cannot leak another entry's menus.
2165
- */
2166
2175
  }, {
2167
- key: "loadOpenData",
2168
- value: (function () {
2169
- var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
2170
- var businessCode, channel, target, cachedData, lastFetchedAt, request, openData;
2176
+ key: "getRuntimeOpenDataScope",
2177
+ value: function getRuntimeOpenDataScope() {
2178
+ var _ref32, _otherParams$business3;
2179
+ var otherParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams;
2180
+ return JSON.stringify({
2181
+ shop: this.getPickupTimingContextData('shop_id'),
2182
+ appShop: this.appPlugin ? this.getAppData('shop_id') : undefined,
2183
+ tenant: this.appPlugin ? this.getAppData('tenant_id') : undefined,
2184
+ businessCode: String((_ref32 = (_otherParams$business3 = otherParams === null || otherParams === void 0 ? void 0 : otherParams.businessCode) !== null && _otherParams$business3 !== void 0 ? _otherParams$business3 : otherParams === null || otherParams === void 0 ? void 0 : otherParams.business_code) !== null && _ref32 !== void 0 ? _ref32 : '').trim(),
2185
+ channel: String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.channel) || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this)).trim(),
2186
+ platform: normalizeRuntimePlatform(otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform),
2187
+ timezone: this.getPickupTimingContextData('timezone'),
2188
+ businessTimezone: otherParams === null || otherParams === void 0 ? void 0 : otherParams.businessTimezone,
2189
+ cacheId: otherParams === this.otherParams ? this.cacheId : otherParams === null || otherParams === void 0 ? void 0 : otherParams.cacheId
2190
+ });
2191
+ }
2192
+ }, {
2193
+ key: "resetRuntimeOpenData",
2194
+ value: function resetRuntimeOpenData() {
2195
+ var _this$store$openData, _this$store$openData$;
2196
+ this.runtimeOpenDataGeneration += 1;
2197
+ this.runtimeOpenDataScope = null;
2198
+ this.runtimeOpenDataSnapshot = null;
2199
+ this.runtimeOpenDataModule = null;
2200
+ this.runtimeOpenDataCore = undefined;
2201
+ this.openDataTarget = null;
2202
+ this.loadOpenDataInFlight = null;
2203
+ this.loadOpenDataInFlightTarget = null;
2204
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), {}, {
2205
+ openData: null
2206
+ });
2207
+ (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || (_this$store$openData$ = _this$store$openData.clearCache) === null || _this$store$openData$ === void 0 || _this$store$openData$.call(_this$store$openData);
2208
+ }
2209
+ }, {
2210
+ key: "prepareInvoiceTemplateAtSolutionReady",
2211
+ value: function () {
2212
+ var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(injectedOpenData) {
2213
+ var businessCode;
2171
2214
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2172
2215
  while (1) switch (_context11.prev = _context11.next) {
2173
2216
  case 0:
2174
- if (this.store.openData) {
2175
- _context11.next = 2;
2217
+ businessCode = this.getBookingTicketBusinessCode();
2218
+ if (!(!businessCode || !this.store.openData)) {
2219
+ _context11.next = 3;
2220
+ break;
2221
+ }
2222
+ return _context11.abrupt("return");
2223
+ case 3:
2224
+ if (injectedOpenData) {
2225
+ this.otherParams.openData = injectedOpenData;
2226
+ this.openDataTarget = "".concat(businessCode, "+").concat(this.getSubmitOrderSalesChannel());
2227
+ }
2228
+ _context11.prev = 4;
2229
+ _context11.next = 7;
2230
+ return this.loadOpenDataConfig();
2231
+ case 7:
2232
+ _context11.next = 12;
2233
+ break;
2234
+ case 9:
2235
+ _context11.prev = 9;
2236
+ _context11.t0 = _context11["catch"](4);
2237
+ console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', _context11.t0);
2238
+ case 12:
2239
+ case "end":
2240
+ return _context11.stop();
2241
+ }
2242
+ }, _callee11, this, [[4, 9]]);
2243
+ }));
2244
+ function prepareInvoiceTemplateAtSolutionReady(_x7) {
2245
+ return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
2246
+ }
2247
+ return prepareInvoiceTemplateAtSolutionReady;
2248
+ }()
2249
+ }, {
2250
+ key: "loadOpenDataConfig",
2251
+ value: function () {
2252
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2253
+ var businessCode;
2254
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2255
+ while (1) switch (_context12.prev = _context12.next) {
2256
+ case 0:
2257
+ businessCode = this.getBookingTicketBusinessCode();
2258
+ if (businessCode) {
2259
+ _context12.next = 3;
2260
+ break;
2261
+ }
2262
+ return _context12.abrupt("return", null);
2263
+ case 3:
2264
+ return _context12.abrupt("return", this.loadOpenData({
2265
+ businessCode: businessCode,
2266
+ channel: this.getSubmitOrderSalesChannel()
2267
+ }));
2268
+ case 4:
2269
+ case "end":
2270
+ return _context12.stop();
2271
+ }
2272
+ }, _callee12, this);
2273
+ }));
2274
+ function loadOpenDataConfig() {
2275
+ return _loadOpenDataConfig.apply(this, arguments);
2276
+ }
2277
+ return loadOpenDataConfig;
2278
+ }() /** A successful configuration belongs to this business runtime until an explicit refresh. */
2279
+ }, {
2280
+ key: "loadOpenData",
2281
+ value: (function () {
2282
+ var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
2283
+ var _this3 = this;
2284
+ var module, businessCode, channel, target, scope, injectedOpenData, generation, core, request;
2285
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2286
+ while (1) switch (_context14.prev = _context14.next) {
2287
+ case 0:
2288
+ module = this.store.openData;
2289
+ if (module) {
2290
+ _context14.next = 3;
2176
2291
  break;
2177
2292
  }
2178
2293
  throw new Error('[UnifiedBookingSales] openData 模块未初始化');
2179
- case 2:
2294
+ case 3:
2295
+ if (!this.runtimeOpenDataDestroyed) {
2296
+ _context14.next = 5;
2297
+ break;
2298
+ }
2299
+ throw new Error('Store settings changed. Please try again.');
2300
+ case 5:
2180
2301
  businessCode = String(params.businessCode || '').trim();
2181
2302
  channel = String(params.channel || '').trim();
2182
2303
  if (!(!businessCode || !channel)) {
2183
- _context11.next = 6;
2304
+ _context14.next = 9;
2184
2305
  break;
2185
2306
  }
2186
2307
  throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
2187
- case 6:
2308
+ case 9:
2188
2309
  target = "".concat(businessCode, "+").concat(channel);
2189
- cachedData = this.store.openData.getOpenData();
2190
- lastFetchedAt = this.store.openData.getLastFetchedAt();
2191
- if (!(!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
2192
- _context11.next = 14;
2193
- break;
2310
+ this.otherParams.businessCode = businessCode;
2311
+ this.otherParams.channel = channel;
2312
+ scope = this.getRuntimeOpenDataScope();
2313
+ if (params.force) {
2314
+ this.clearOpenDataCache();
2194
2315
  }
2195
- if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
2196
- _context11.next = 13;
2197
- break;
2316
+ if (this.runtimeOpenDataScope !== scope || this.runtimeOpenDataModule !== module || this.runtimeOpenDataCore !== this.core) {
2317
+ // Only the first, explicitly injected target may seed a new runtime snapshot.
2318
+ injectedOpenData = this.runtimeOpenDataScope === null && (!this.openDataTarget || this.openDataTarget === target) && isRecord(this.otherParams.openData) ? this.otherParams.openData : null;
2319
+ if (this.runtimeOpenDataScope !== null) {
2320
+ // The caller's Pickup Timing scope already changes with this runtime scope.
2321
+ this.resetRuntimeOpenData();
2322
+ }
2323
+ this.runtimeOpenDataScope = scope;
2324
+ this.runtimeOpenDataModule = module;
2325
+ this.runtimeOpenDataCore = this.core;
2326
+ this.runtimeOpenDataSnapshot = injectedOpenData;
2198
2327
  }
2199
- _context11.next = 13;
2200
- return this.store.openData.ensureInvoiceTemplateSettings(target);
2201
- case 13:
2202
- return _context11.abrupt("return", cachedData);
2203
- case 14:
2204
2328
  if (!this.loadOpenDataInFlight) {
2205
- _context11.next = 22;
2329
+ _context14.next = 17;
2206
2330
  break;
2207
2331
  }
2208
- if (!(this.loadOpenDataInFlightTarget === target)) {
2209
- _context11.next = 19;
2210
- break;
2211
- }
2212
- _context11.next = 18;
2213
- return this.loadOpenDataInFlight;
2214
- case 18:
2215
- return _context11.abrupt("return", _context11.sent);
2216
- case 19:
2217
- _context11.next = 21;
2218
- return this.loadOpenDataInFlight;
2219
- case 21:
2220
- return _context11.abrupt("return", this.loadOpenData(params));
2221
- case 22:
2332
+ return _context14.abrupt("return", this.loadOpenDataInFlight);
2333
+ case 17:
2334
+ generation = this.runtimeOpenDataGeneration;
2335
+ core = this.core;
2336
+ request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2337
+ var openData, _module$ensureInvoice;
2338
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2339
+ while (1) switch (_context13.prev = _context13.next) {
2340
+ case 0:
2341
+ openData = _this3.runtimeOpenDataSnapshot;
2342
+ if (!openData) {
2343
+ _context13.next = 6;
2344
+ break;
2345
+ }
2346
+ _context13.next = 4;
2347
+ return (_module$ensureInvoice = module.ensureInvoiceTemplateSettings) === null || _module$ensureInvoice === void 0 ? void 0 : _module$ensureInvoice.call(module, target, openData);
2348
+ case 4:
2349
+ _context13.next = 9;
2350
+ break;
2351
+ case 6:
2352
+ _context13.next = 8;
2353
+ return module.fetchOpenData({
2354
+ scope: 'board',
2355
+ target: target,
2356
+ section_code: [].concat(OPEN_DATA_SECTION_CODES)
2357
+ });
2358
+ case 8:
2359
+ openData = _context13.sent;
2360
+ case 9:
2361
+ if (!(_this3.runtimeOpenDataDestroyed || generation !== _this3.runtimeOpenDataGeneration || scope !== _this3.getRuntimeOpenDataScope() || module !== _this3.store.openData || core !== _this3.core)) {
2362
+ _context13.next = 11;
2363
+ break;
2364
+ }
2365
+ throw new Error('Store settings changed. Please try again.');
2366
+ case 11:
2367
+ _this3.runtimeOpenDataSnapshot = openData;
2368
+ _this3.openDataTarget = target;
2369
+ _this3.otherParams.openData = openData;
2370
+ return _context13.abrupt("return", openData);
2371
+ case 15:
2372
+ case "end":
2373
+ return _context13.stop();
2374
+ }
2375
+ }, _callee13);
2376
+ }))();
2222
2377
  this.loadOpenDataInFlightTarget = target;
2223
- request = this.store.openData.fetchOpenData({
2224
- scope: 'board',
2225
- target: target,
2226
- section_code: [].concat(OPEN_DATA_SECTION_CODES)
2227
- });
2228
2378
  this.loadOpenDataInFlight = request;
2229
- _context11.prev = 25;
2230
- _context11.next = 28;
2379
+ _context14.prev = 22;
2380
+ _context14.next = 25;
2231
2381
  return request;
2232
- case 28:
2233
- openData = _context11.sent;
2234
- if (this.loadOpenDataInFlight === request) {
2235
- this.openDataTarget = target;
2236
- this.otherParams.openData = openData;
2237
- this.otherParams.businessCode = businessCode;
2238
- this.otherParams.channel = channel;
2239
- }
2240
- return _context11.abrupt("return", openData);
2241
- case 31:
2242
- _context11.prev = 31;
2382
+ case 25:
2383
+ return _context14.abrupt("return", _context14.sent);
2384
+ case 26:
2385
+ _context14.prev = 26;
2243
2386
  if (this.loadOpenDataInFlight === request) {
2244
2387
  this.loadOpenDataInFlight = null;
2245
2388
  this.loadOpenDataInFlightTarget = null;
2246
2389
  }
2247
- return _context11.finish(31);
2248
- case 34:
2390
+ return _context14.finish(26);
2391
+ case 29:
2249
2392
  case "end":
2250
- return _context11.stop();
2393
+ return _context14.stop();
2251
2394
  }
2252
- }, _callee11, this, [[25,, 31, 34]]);
2395
+ }, _callee14, this, [[22,, 26, 29]]);
2253
2396
  }));
2254
- function loadOpenData(_x7) {
2397
+ function loadOpenData(_x8) {
2255
2398
  return _loadOpenData.apply(this, arguments);
2256
2399
  }
2257
2400
  return loadOpenData;
@@ -2259,29 +2402,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2259
2402
  }, {
2260
2403
  key: "getOpenData",
2261
2404
  value: function () {
2262
- var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2263
- var _this$otherParams18, _this$otherParams19;
2264
- var businessCode, channel;
2265
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2266
- while (1) switch (_context12.prev = _context12.next) {
2405
+ var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2406
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2407
+ while (1) switch (_context15.prev = _context15.next) {
2267
2408
  case 0:
2268
- businessCode = String(((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) || '').trim();
2269
- channel = String(((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.channel) || '').trim();
2270
- if (!(!businessCode || !channel)) {
2271
- _context12.next = 4;
2272
- break;
2273
- }
2274
- return _context12.abrupt("return", null);
2275
- case 4:
2276
- return _context12.abrupt("return", this.loadOpenData({
2277
- businessCode: businessCode,
2278
- channel: channel
2279
- }));
2280
- case 5:
2409
+ return _context15.abrupt("return", this.loadOpenDataConfig());
2410
+ case 1:
2281
2411
  case "end":
2282
- return _context12.stop();
2412
+ return _context15.stop();
2283
2413
  }
2284
- }, _callee12, this);
2414
+ }, _callee15, this);
2285
2415
  }));
2286
2416
  function getOpenData() {
2287
2417
  return _getOpenData.apply(this, arguments);
@@ -2291,50 +2421,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2291
2421
  }, {
2292
2422
  key: "loadPickupTimingOpenData",
2293
2423
  value: function () {
2294
- var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(force) {
2295
- var _ref33, _this$otherParams$bus3, _this$otherParams20, _this$otherParams21, _this$getSubmitOrderS;
2296
- var scope, businessCode, channel, config;
2297
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2298
- while (1) switch (_context13.prev = _context13.next) {
2424
+ var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
2425
+ var _ref34, _this$otherParams$bus2, _this$otherParams14, _this$otherParams15;
2426
+ var scope, businessCode, config;
2427
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2428
+ while (1) switch (_context16.prev = _context16.next) {
2299
2429
  case 0:
2300
- scope = this.getPickupTimingScope(); // A fresh validation must not borrow a request started for a previous store/context.
2301
- if (!(force && this.loadOpenDataInFlight)) {
2302
- _context13.next = 4;
2303
- break;
2304
- }
2305
- _context13.next = 4;
2306
- return this.loadOpenDataInFlight;
2307
- case 4:
2308
- if (!(scope !== this.getPickupTimingScope())) {
2309
- _context13.next = 6;
2310
- break;
2311
- }
2312
- throw new Error('Store settings changed. Please try again.');
2313
- case 6:
2314
- businessCode = String((_ref33 = (_this$otherParams$bus3 = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.business_code) !== null && _ref33 !== void 0 ? _ref33 : '').trim();
2315
- channel = String((_this$getSubmitOrderS = this.getSubmitOrderSalesChannel()) !== null && _this$getSubmitOrderS !== void 0 ? _this$getSubmitOrderS : '').trim();
2316
- _context13.next = 10;
2430
+ scope = this.getPickupTimingScope();
2431
+ businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2432
+ _context16.next = 4;
2317
2433
  return this.loadOpenData({
2318
2434
  businessCode: businessCode,
2319
- channel: channel,
2320
- force: force
2435
+ channel: this.getSubmitOrderSalesChannel()
2321
2436
  });
2322
- case 10:
2323
- config = _context13.sent;
2437
+ case 4:
2438
+ config = _context16.sent;
2324
2439
  if (!(scope !== this.getPickupTimingScope())) {
2325
- _context13.next = 13;
2440
+ _context16.next = 7;
2326
2441
  break;
2327
2442
  }
2328
2443
  throw new Error('Store settings changed. Please try again.');
2329
- case 13:
2330
- return _context13.abrupt("return", config);
2331
- case 14:
2444
+ case 7:
2445
+ return _context16.abrupt("return", config);
2446
+ case 8:
2332
2447
  case "end":
2333
- return _context13.stop();
2448
+ return _context16.stop();
2334
2449
  }
2335
- }, _callee13, this);
2450
+ }, _callee16, this);
2336
2451
  }));
2337
- function loadPickupTimingOpenData(_x8) {
2452
+ function loadPickupTimingOpenData(_x9) {
2338
2453
  return _loadPickupTimingOpenData.apply(this, arguments);
2339
2454
  }
2340
2455
  return loadPickupTimingOpenData;
@@ -2349,19 +2464,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2349
2464
  }, {
2350
2465
  key: "fetchAllergyItemRuleConfigs",
2351
2466
  value: function () {
2352
- var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(strategyModelIds) {
2467
+ var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(strategyModelIds) {
2353
2468
  var _response$data, response, list;
2354
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2355
- while (1) switch (_context14.prev = _context14.next) {
2469
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2470
+ while (1) switch (_context17.prev = _context17.next) {
2356
2471
  case 0:
2357
2472
  if (strategyModelIds.length) {
2358
- _context14.next = 2;
2473
+ _context17.next = 2;
2359
2474
  break;
2360
2475
  }
2361
- return _context14.abrupt("return", []);
2476
+ return _context17.abrupt("return", []);
2362
2477
  case 2:
2363
- _context14.prev = 2;
2364
- _context14.next = 5;
2478
+ _context17.prev = 2;
2479
+ _context17.next = 5;
2365
2480
  return this.request.get('/promotion', {
2366
2481
  skip: 1,
2367
2482
  num: 99,
@@ -2369,28 +2484,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2369
2484
  ids: strategyModelIds
2370
2485
  });
2371
2486
  case 5:
2372
- response = _context14.sent;
2487
+ response = _context17.sent;
2373
2488
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
2374
- _context14.next = 8;
2489
+ _context17.next = 8;
2375
2490
  break;
2376
2491
  }
2377
2492
  throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
2378
2493
  case 8:
2379
2494
  list = response.data.list;
2380
- return _context14.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2495
+ return _context17.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2381
2496
  return item === null || item === void 0 ? void 0 : item.metadata;
2382
2497
  })));
2383
2498
  case 12:
2384
- _context14.prev = 12;
2385
- _context14.t0 = _context14["catch"](2);
2386
- throw _context14.t0;
2499
+ _context17.prev = 12;
2500
+ _context17.t0 = _context17["catch"](2);
2501
+ throw _context17.t0;
2387
2502
  case 15:
2388
2503
  case "end":
2389
- return _context14.stop();
2504
+ return _context17.stop();
2390
2505
  }
2391
- }, _callee14, this, [[2, 12]]);
2506
+ }, _callee17, this, [[2, 12]]);
2392
2507
  }));
2393
- function fetchAllergyItemRuleConfigs(_x9) {
2508
+ function fetchAllergyItemRuleConfigs(_x10) {
2394
2509
  return _fetchAllergyItemRuleConfigs.apply(this, arguments);
2395
2510
  }
2396
2511
  return fetchAllergyItemRuleConfigs;
@@ -2398,70 +2513,70 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2398
2513
  }, {
2399
2514
  key: "ensureAllergyItemRuleConfigsLoaded",
2400
2515
  value: function () {
2401
- var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2402
- var _this3 = this;
2403
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2404
- while (1) switch (_context16.prev = _context16.next) {
2516
+ var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2517
+ var _this4 = this;
2518
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2519
+ while (1) switch (_context19.prev = _context19.next) {
2405
2520
  case 0:
2406
2521
  if (!(this.allergyItemRuleConfigs.length > 0)) {
2407
- _context16.next = 2;
2522
+ _context19.next = 2;
2408
2523
  break;
2409
2524
  }
2410
- return _context16.abrupt("return", this.allergyItemRuleConfigs);
2525
+ return _context19.abrupt("return", this.allergyItemRuleConfigs);
2411
2526
  case 2:
2412
2527
  if (!this.allergyItemRuleConfigsPromise) {
2413
- _context16.next = 4;
2528
+ _context19.next = 4;
2414
2529
  break;
2415
2530
  }
2416
- return _context16.abrupt("return", this.allergyItemRuleConfigsPromise);
2531
+ return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
2417
2532
  case 4:
2418
- this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2419
- var _this3$otherParams;
2533
+ this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2534
+ var _this4$otherParams;
2420
2535
  var staticConfigs, openData, enabled, strategyModelIds, loaded;
2421
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2422
- while (1) switch (_context15.prev = _context15.next) {
2536
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2537
+ while (1) switch (_context18.prev = _context18.next) {
2423
2538
  case 0:
2424
- staticConfigs = normalizeItemRuleStrategyConfigs((_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 || (_this3$otherParams = _this3$otherParams.itemRule) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.strategyConfigs);
2539
+ staticConfigs = normalizeItemRuleStrategyConfigs((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 || (_this4$otherParams = _this4$otherParams.itemRule) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.strategyConfigs);
2425
2540
  if (!(staticConfigs.length > 0)) {
2426
- _context15.next = 5;
2541
+ _context18.next = 5;
2427
2542
  break;
2428
2543
  }
2429
- _this3.allergyItemRuleConfigs = staticConfigs;
2430
- _this3.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
2431
- return _context15.abrupt("return", staticConfigs);
2544
+ _this4.allergyItemRuleConfigs = staticConfigs;
2545
+ _this4.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
2546
+ return _context18.abrupt("return", staticConfigs);
2432
2547
  case 5:
2433
- _context15.next = 7;
2434
- return _this3.getOpenData();
2548
+ _context18.next = 7;
2549
+ return _this4.getOpenData();
2435
2550
  case 7:
2436
- openData = _context15.sent;
2551
+ openData = _context18.sent;
2437
2552
  enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
2438
2553
  strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
2439
2554
  if (!(!enabled || !strategyModelIds.length)) {
2440
- _context15.next = 13;
2555
+ _context18.next = 13;
2441
2556
  break;
2442
2557
  }
2443
- _this3.allergyItemRuleEvaluator.setStrategyConfigs([]);
2444
- return _context15.abrupt("return", []);
2558
+ _this4.allergyItemRuleEvaluator.setStrategyConfigs([]);
2559
+ return _context18.abrupt("return", []);
2445
2560
  case 13:
2446
- _context15.next = 15;
2447
- return _this3.fetchAllergyItemRuleConfigs(strategyModelIds);
2561
+ _context18.next = 15;
2562
+ return _this4.fetchAllergyItemRuleConfigs(strategyModelIds);
2448
2563
  case 15:
2449
- loaded = _context15.sent;
2450
- _this3.allergyItemRuleConfigs = loaded;
2451
- _this3.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
2452
- return _context15.abrupt("return", loaded);
2564
+ loaded = _context18.sent;
2565
+ _this4.allergyItemRuleConfigs = loaded;
2566
+ _this4.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
2567
+ return _context18.abrupt("return", loaded);
2453
2568
  case 19:
2454
2569
  case "end":
2455
- return _context15.stop();
2570
+ return _context18.stop();
2456
2571
  }
2457
- }, _callee15);
2572
+ }, _callee18);
2458
2573
  }))();
2459
- return _context16.abrupt("return", this.allergyItemRuleConfigsPromise);
2574
+ return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
2460
2575
  case 6:
2461
2576
  case "end":
2462
- return _context16.stop();
2577
+ return _context19.stop();
2463
2578
  }
2464
- }, _callee16, this);
2579
+ }, _callee19, this);
2465
2580
  }));
2466
2581
  function ensureAllergyItemRuleConfigsLoaded() {
2467
2582
  return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
@@ -2475,51 +2590,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2475
2590
  }, {
2476
2591
  key: "resolveProductAllergyRequirement",
2477
2592
  value: (function () {
2478
- var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
2479
- var _this$otherParams22, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref36, _runtimeConfig$servic, _this$otherParams23, _ref37, _ref38, _params$channel, _this$otherParams24, _this$otherParams25, _runtimeConfig$submis;
2593
+ var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2594
+ var _this$otherParams16, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams17, _ref38, _ref39, _params$channel, _this$otherParams18, _this$otherParams19, _runtimeConfig$submis;
2480
2595
  var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
2481
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2482
- while (1) switch (_context17.prev = _context17.next) {
2596
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2597
+ while (1) switch (_context20.prev = _context20.next) {
2483
2598
  case 0:
2484
2599
  productId = normalizePositiveInteger(params.productId);
2485
2600
  if (productId) {
2486
- _context17.next = 3;
2601
+ _context20.next = 3;
2487
2602
  break;
2488
2603
  }
2489
- return _context17.abrupt("return", null);
2604
+ return _context20.abrupt("return", null);
2490
2605
  case 3:
2491
- _context17.next = 5;
2606
+ _context20.next = 5;
2492
2607
  return this.ensureAllergyItemRuleConfigsLoaded();
2493
2608
  case 5:
2494
- strategyConfigs = _context17.sent;
2609
+ strategyConfigs = _context20.sent;
2495
2610
  if (strategyConfigs.length) {
2496
- _context17.next = 8;
2611
+ _context20.next = 8;
2497
2612
  break;
2498
2613
  }
2499
- return _context17.abrupt("return", null);
2614
+ return _context20.abrupt("return", null);
2500
2615
  case 8:
2501
2616
  productVariantId = normalizePositiveInteger(params.productVariantId);
2502
- runtimeConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.itemRule) || {};
2617
+ runtimeConfig = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.itemRule) || {};
2503
2618
  runtimePax = runtimeConfig.pax || {};
2504
2619
  cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
2505
- var _item$product_id, _item$product_variant, _ref35, _item$num;
2620
+ var _item$product_id, _item$product_variant, _ref36, _item$num;
2506
2621
  return {
2507
2622
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
2508
2623
  product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
2509
- quantity: Number((_ref35 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref35 !== void 0 ? _ref35 : 0)
2624
+ quantity: Number((_ref36 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref36 !== void 0 ? _ref36 : 0)
2510
2625
  };
2511
2626
  }).filter(function (item) {
2512
2627
  return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
2513
2628
  });
2514
- return _context17.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2629
+ return _context20.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2515
2630
  pax: {
2516
2631
  total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
2517
2632
  adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
2518
2633
  child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
2519
2634
  },
2520
2635
  cartItems: cartItems,
2521
- serviceType: String((_ref36 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.serviceType) !== null && _ref36 !== void 0 ? _ref36 : ''),
2522
- channel: String((_ref37 = (_ref38 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.channel) !== null && _ref38 !== void 0 ? _ref38 : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _ref37 !== void 0 ? _ref37 : ''),
2636
+ serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
2637
+ channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
2523
2638
  currentProduct: _objectSpread({
2524
2639
  product_id: productId
2525
2640
  }, productVariantId ? {
@@ -2531,11 +2646,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2531
2646
  }));
2532
2647
  case 13:
2533
2648
  case "end":
2534
- return _context17.stop();
2649
+ return _context20.stop();
2535
2650
  }
2536
- }, _callee17, this);
2651
+ }, _callee20, this);
2537
2652
  }));
2538
- function resolveProductAllergyRequirement(_x10) {
2653
+ function resolveProductAllergyRequirement(_x11) {
2539
2654
  return _resolveProductAllergyRequirement.apply(this, arguments);
2540
2655
  }
2541
2656
  return resolveProductAllergyRequirement;
@@ -2543,35 +2658,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2543
2658
  }, {
2544
2659
  key: "clearOpenDataCache",
2545
2660
  value: function clearOpenDataCache() {
2546
- this.openDataTarget = null;
2547
- this.loadOpenDataInFlight = null;
2548
- this.loadOpenDataInFlightTarget = null;
2549
- _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "clearOpenDataCache", this).call(this);
2661
+ this.resetRuntimeOpenData();
2662
+ this.resetPickupTimingCache();
2550
2663
  }
2551
2664
  }, {
2552
2665
  key: "getInvoiceLayoutConfig",
2553
2666
  value: function () {
2554
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2667
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2555
2668
  var openData;
2556
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2557
- while (1) switch (_context18.prev = _context18.next) {
2669
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2670
+ while (1) switch (_context21.prev = _context21.next) {
2558
2671
  case 0:
2559
- _context18.next = 2;
2672
+ _context21.next = 2;
2560
2673
  return this.getOpenData();
2561
2674
  case 2:
2562
- openData = _context18.sent;
2675
+ openData = _context21.sent;
2563
2676
  if (!(!openData || !this.store.openData)) {
2564
- _context18.next = 5;
2677
+ _context21.next = 5;
2565
2678
  break;
2566
2679
  }
2567
- return _context18.abrupt("return", getDefaultInvoiceLayoutConfig());
2680
+ return _context21.abrupt("return", getDefaultInvoiceLayoutConfig());
2568
2681
  case 5:
2569
- return _context18.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2682
+ return _context21.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2570
2683
  case 6:
2571
2684
  case "end":
2572
- return _context18.stop();
2685
+ return _context21.stop();
2573
2686
  }
2574
- }, _callee18, this);
2687
+ }, _callee21, this);
2575
2688
  }));
2576
2689
  function getInvoiceLayoutConfig() {
2577
2690
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -2581,27 +2694,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2581
2694
  }, {
2582
2695
  key: "getInvoiceTemplateSettings",
2583
2696
  value: function () {
2584
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2697
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2585
2698
  var openData;
2586
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2587
- while (1) switch (_context19.prev = _context19.next) {
2699
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2700
+ while (1) switch (_context22.prev = _context22.next) {
2588
2701
  case 0:
2589
- _context19.next = 2;
2702
+ _context22.next = 2;
2590
2703
  return this.getOpenData();
2591
2704
  case 2:
2592
- openData = _context19.sent;
2705
+ openData = _context22.sent;
2593
2706
  if (!(!openData || !this.store.openData)) {
2594
- _context19.next = 5;
2707
+ _context22.next = 5;
2595
2708
  break;
2596
2709
  }
2597
- return _context19.abrupt("return", getDefaultInvoiceTemplateSettings());
2710
+ return _context22.abrupt("return", getDefaultInvoiceTemplateSettings());
2598
2711
  case 5:
2599
- return _context19.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2712
+ return _context22.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2600
2713
  case 6:
2601
2714
  case "end":
2602
- return _context19.stop();
2715
+ return _context22.stop();
2603
2716
  }
2604
- }, _callee19, this);
2717
+ }, _callee22, this);
2605
2718
  }));
2606
2719
  function getInvoiceTemplateSettings() {
2607
2720
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -2611,11 +2724,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2611
2724
  }, {
2612
2725
  key: "isInvoiceOpenDataCacheCurrent",
2613
2726
  value: function isInvoiceOpenDataCacheCurrent() {
2614
- var _this$otherParams26, _this$otherParams27;
2615
- var businessCode = String(((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.businessCode) || '').trim();
2616
- var channel = String(((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.channel) || '').trim();
2727
+ var _this$otherParams20, _this$otherParams21;
2728
+ var businessCode = String(((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) || '').trim();
2729
+ var channel = String(((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.channel) || '').trim();
2617
2730
  if (!businessCode || !channel) return false;
2618
- return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
2731
+ return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
2619
2732
  }
2620
2733
 
2621
2734
  /**
@@ -2624,14 +2737,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2624
2737
  }, {
2625
2738
  key: "getProtocol",
2626
2739
  value: (function () {
2627
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(policyId) {
2740
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(policyId) {
2628
2741
  var normalizedPolicyId, policyUrl;
2629
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2630
- while (1) switch (_context20.prev = _context20.next) {
2742
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2743
+ while (1) switch (_context23.prev = _context23.next) {
2631
2744
  case 0:
2632
2745
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2633
2746
  if (normalizedPolicyId) {
2634
- _context20.next = 3;
2747
+ _context23.next = 3;
2635
2748
  break;
2636
2749
  }
2637
2750
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
@@ -2640,14 +2753,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2640
2753
  if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
2641
2754
  policyUrl = 'policy';
2642
2755
  }
2643
- return _context20.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2756
+ return _context23.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2644
2757
  case 6:
2645
2758
  case "end":
2646
- return _context20.stop();
2759
+ return _context23.stop();
2647
2760
  }
2648
- }, _callee20, this);
2761
+ }, _callee23, this);
2649
2762
  }));
2650
- function getProtocol(_x11) {
2763
+ function getProtocol(_x12) {
2651
2764
  return _getProtocol.apply(this, arguments);
2652
2765
  }
2653
2766
  return getProtocol;
@@ -2660,27 +2773,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2660
2773
  }, {
2661
2774
  key: "loadProducts",
2662
2775
  value: (function () {
2663
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2776
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2664
2777
  var params,
2665
2778
  options,
2666
2779
  schedule_date,
2667
2780
  schedule_datetime,
2668
2781
  result,
2669
- _args21 = arguments;
2670
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2671
- while (1) switch (_context21.prev = _context21.next) {
2782
+ _args24 = arguments;
2783
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2784
+ while (1) switch (_context24.prev = _context24.next) {
2672
2785
  case 0:
2673
- params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
2674
- options = _args21.length > 1 ? _args21[1] : undefined;
2786
+ params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
2787
+ options = _args24.length > 1 ? _args24[1] : undefined;
2675
2788
  if (this.store.products) {
2676
- _context21.next = 4;
2789
+ _context24.next = 4;
2677
2790
  break;
2678
2791
  }
2679
2792
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2680
2793
  case 4:
2681
2794
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2682
2795
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2683
- _context21.next = 8;
2796
+ _context24.next = 8;
2684
2797
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2685
2798
  with_count: ['bundleGroup', 'optionGroup'],
2686
2799
  with_schedule: 1
@@ -2690,17 +2803,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2690
2803
  cacheId: this.cacheId
2691
2804
  }), options);
2692
2805
  case 8:
2693
- result = _context21.sent;
2806
+ result = _context24.sent;
2694
2807
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2695
- _context21.next = 12;
2808
+ _context24.next = 12;
2696
2809
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2697
2810
  case 12:
2698
- return _context21.abrupt("return", result);
2811
+ return _context24.abrupt("return", result);
2699
2812
  case 13:
2700
2813
  case "end":
2701
- return _context21.stop();
2814
+ return _context24.stop();
2702
2815
  }
2703
- }, _callee21, this);
2816
+ }, _callee24, this);
2704
2817
  }));
2705
2818
  function loadProducts() {
2706
2819
  return _loadProducts.apply(this, arguments);
@@ -2710,25 +2823,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2710
2823
  }, {
2711
2824
  key: "queryProducts",
2712
2825
  value: function () {
2713
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2826
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2714
2827
  var params,
2715
- _args22 = arguments;
2716
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2717
- while (1) switch (_context22.prev = _context22.next) {
2828
+ _args25 = arguments;
2829
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2830
+ while (1) switch (_context25.prev = _context25.next) {
2718
2831
  case 0:
2719
- params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2832
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
2720
2833
  if (this.store.products) {
2721
- _context22.next = 3;
2834
+ _context25.next = 3;
2722
2835
  break;
2723
2836
  }
2724
2837
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2725
2838
  case 3:
2726
- return _context22.abrupt("return", this.store.products.queryProducts(params));
2839
+ return _context25.abrupt("return", this.store.products.queryProducts(params));
2727
2840
  case 4:
2728
2841
  case "end":
2729
- return _context22.stop();
2842
+ return _context25.stop();
2730
2843
  }
2731
- }, _callee22, this);
2844
+ }, _callee25, this);
2732
2845
  }));
2733
2846
  function queryProducts() {
2734
2847
  return _queryProducts.apply(this, arguments);
@@ -2738,24 +2851,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2738
2851
  }, {
2739
2852
  key: "loadScheduleAvailableDate",
2740
2853
  value: (function () {
2741
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2742
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2743
- while (1) switch (_context23.prev = _context23.next) {
2854
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2855
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2856
+ while (1) switch (_context26.prev = _context26.next) {
2744
2857
  case 0:
2745
2858
  if (this.store.schedule) {
2746
- _context23.next = 2;
2859
+ _context26.next = 2;
2747
2860
  break;
2748
2861
  }
2749
2862
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2750
2863
  case 2:
2751
- return _context23.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2864
+ return _context26.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2752
2865
  case 3:
2753
2866
  case "end":
2754
- return _context23.stop();
2867
+ return _context26.stop();
2755
2868
  }
2756
- }, _callee23, this);
2869
+ }, _callee26, this);
2757
2870
  }));
2758
- function loadScheduleAvailableDate(_x12) {
2871
+ function loadScheduleAvailableDate(_x13) {
2759
2872
  return _loadScheduleAvailableDate.apply(this, arguments);
2760
2873
  }
2761
2874
  return loadScheduleAvailableDate;
@@ -2769,15 +2882,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2769
2882
  }, {
2770
2883
  key: "loadProductsByScheduleDate",
2771
2884
  value: (function () {
2772
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2885
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2773
2886
  var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
2774
2887
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
2775
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2776
- while (1) switch (_context24.prev = _context24.next) {
2888
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2889
+ while (1) switch (_context27.prev = _context27.next) {
2777
2890
  case 0:
2778
2891
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
2779
2892
  if (this.store.schedule) {
2780
- _context24.next = 3;
2893
+ _context27.next = 3;
2781
2894
  break;
2782
2895
  }
2783
2896
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -2788,10 +2901,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2788
2901
  });
2789
2902
  hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
2790
2903
  if (!(!hasCachedDate && !hasOtherProducts)) {
2791
- _context24.next = 9;
2904
+ _context27.next = 9;
2792
2905
  break;
2793
2906
  }
2794
- _context24.next = 9;
2907
+ _context27.next = 9;
2795
2908
  return this.loadScheduleAvailableDate({
2796
2909
  startDate: date,
2797
2910
  endDate: date,
@@ -2811,45 +2924,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2811
2924
  return !productIdFilter || productIdFilter.has(String(id));
2812
2925
  });
2813
2926
  if (availableProductIds.length) {
2814
- _context24.next = 17;
2927
+ _context27.next = 17;
2815
2928
  break;
2816
2929
  }
2817
2930
  this.unifiedProductCatalog = [];
2818
- _context24.next = 16;
2931
+ _context27.next = 16;
2819
2932
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
2820
2933
  case 16:
2821
- return _context24.abrupt("return", []);
2934
+ return _context27.abrupt("return", []);
2822
2935
  case 17:
2823
- _context24.next = 19;
2936
+ _context27.next = 19;
2824
2937
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2825
2938
  product_ids: availableProductIds,
2826
2939
  schedule_date: date
2827
2940
  }));
2828
2941
  case 19:
2829
- products = _context24.sent;
2942
+ products = _context27.sent;
2830
2943
  if (!(products.length || availableProductIds.length <= 1)) {
2831
- _context24.next = 22;
2944
+ _context27.next = 22;
2832
2945
  break;
2833
2946
  }
2834
- return _context24.abrupt("return", products);
2947
+ return _context27.abrupt("return", products);
2835
2948
  case 22:
2836
2949
  fallbackProducts = [];
2837
2950
  _iterator = _createForOfIteratorHelper(availableProductIds);
2838
- _context24.prev = 24;
2951
+ _context27.prev = 24;
2839
2952
  _iterator.s();
2840
2953
  case 26:
2841
2954
  if ((_step = _iterator.n()).done) {
2842
- _context24.next = 34;
2955
+ _context27.next = 34;
2843
2956
  break;
2844
2957
  }
2845
2958
  productId = _step.value;
2846
- _context24.next = 30;
2959
+ _context27.next = 30;
2847
2960
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2848
2961
  product_ids: [productId],
2849
2962
  schedule_date: date
2850
2963
  }));
2851
2964
  case 30:
2852
- result = _context24.sent;
2965
+ result = _context27.sent;
2853
2966
  result.forEach(function (product) {
2854
2967
  var _id;
2855
2968
  var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
@@ -2861,32 +2974,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2861
2974
  }
2862
2975
  });
2863
2976
  case 32:
2864
- _context24.next = 26;
2977
+ _context27.next = 26;
2865
2978
  break;
2866
2979
  case 34:
2867
- _context24.next = 39;
2980
+ _context27.next = 39;
2868
2981
  break;
2869
2982
  case 36:
2870
- _context24.prev = 36;
2871
- _context24.t0 = _context24["catch"](24);
2872
- _iterator.e(_context24.t0);
2983
+ _context27.prev = 36;
2984
+ _context27.t0 = _context27["catch"](24);
2985
+ _iterator.e(_context27.t0);
2873
2986
  case 39:
2874
- _context24.prev = 39;
2987
+ _context27.prev = 39;
2875
2988
  _iterator.f();
2876
- return _context24.finish(39);
2989
+ return _context27.finish(39);
2877
2990
  case 42:
2878
2991
  this.unifiedProductCatalog = [].concat(fallbackProducts);
2879
- _context24.next = 45;
2992
+ _context27.next = 45;
2880
2993
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
2881
2994
  case 45:
2882
- return _context24.abrupt("return", fallbackProducts);
2995
+ return _context27.abrupt("return", fallbackProducts);
2883
2996
  case 46:
2884
2997
  case "end":
2885
- return _context24.stop();
2998
+ return _context27.stop();
2886
2999
  }
2887
- }, _callee24, this, [[24, 36, 39, 42]]);
3000
+ }, _callee27, this, [[24, 36, 39, 42]]);
2888
3001
  }));
2889
- function loadProductsByScheduleDate(_x13) {
3002
+ function loadProductsByScheduleDate(_x14) {
2890
3003
  return _loadProductsByScheduleDate.apply(this, arguments);
2891
3004
  }
2892
3005
  return loadProductsByScheduleDate;
@@ -2939,7 +3052,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2939
3052
  }, {
2940
3053
  key: "applyPlannerDiscounts",
2941
3054
  value: (function () {
2942
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
3055
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2943
3056
  var _params$customerId;
2944
3057
  var params,
2945
3058
  tempOrder,
@@ -2956,24 +3069,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2956
3069
  discount,
2957
3070
  discountId,
2958
3071
  nextTempOrder,
2959
- _args25 = arguments;
2960
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2961
- while (1) switch (_context25.prev = _context25.next) {
3072
+ _args28 = arguments;
3073
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3074
+ while (1) switch (_context28.prev = _context28.next) {
2962
3075
  case 0:
2963
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
3076
+ params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
2964
3077
  tempOrder = this.getTempOrder();
2965
3078
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
2966
3079
  parsedCustomerId = Number(requestedCustomerId);
2967
3080
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
2968
- _context25.next = 7;
3081
+ _context28.next = 7;
2969
3082
  return this.getSummary();
2970
3083
  case 7:
2971
- summaryBefore = _context25.sent;
3084
+ summaryBefore = _context28.sent;
2972
3085
  if (customerId) {
2973
- _context25.next = 10;
3086
+ _context28.next = 10;
2974
3087
  break;
2975
3088
  }
2976
- return _context25.abrupt("return", buildPlannerDiscountResult({
3089
+ return _context28.abrupt("return", buildPlannerDiscountResult({
2977
3090
  customerId: null,
2978
3091
  discountList: this.getDiscountList(),
2979
3092
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -2982,7 +3095,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2982
3095
  status: 'no_customer'
2983
3096
  }));
2984
3097
  case 10:
2985
- _context25.next = 12;
3098
+ _context28.next = 12;
2986
3099
  return this.loadDiscountConfig({
2987
3100
  customerId: customerId,
2988
3101
  action: 'create'
@@ -2994,7 +3107,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2994
3107
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
2995
3108
  });
2996
3109
  if (!preferredDiscount) {
2997
- _context25.next = 40;
3110
+ _context28.next = 40;
2998
3111
  break;
2999
3112
  }
3000
3113
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -3006,98 +3119,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3006
3119
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
3007
3120
  });
3008
3121
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
3009
- _context25.prev = 18;
3122
+ _context28.prev = 18;
3010
3123
  _iterator2.s();
3011
3124
  case 20:
3012
3125
  if ((_step2 = _iterator2.n()).done) {
3013
- _context25.next = 28;
3126
+ _context28.next = 28;
3014
3127
  break;
3015
3128
  }
3016
3129
  discount = _step2.value;
3017
3130
  discountId = Number(resolvePlannerDiscountId(discount));
3018
3131
  if (!Number.isFinite(discountId)) {
3019
- _context25.next = 26;
3132
+ _context28.next = 26;
3020
3133
  break;
3021
3134
  }
3022
- _context25.next = 26;
3135
+ _context28.next = 26;
3023
3136
  return this.setDiscountSelected({
3024
3137
  discountId: discountId,
3025
3138
  isSelected: false
3026
3139
  });
3027
3140
  case 26:
3028
- _context25.next = 20;
3141
+ _context28.next = 20;
3029
3142
  break;
3030
3143
  case 28:
3031
- _context25.next = 33;
3144
+ _context28.next = 33;
3032
3145
  break;
3033
3146
  case 30:
3034
- _context25.prev = 30;
3035
- _context25.t0 = _context25["catch"](18);
3036
- _iterator2.e(_context25.t0);
3147
+ _context28.prev = 30;
3148
+ _context28.t0 = _context28["catch"](18);
3149
+ _iterator2.e(_context28.t0);
3037
3150
  case 33:
3038
- _context25.prev = 33;
3151
+ _context28.prev = 33;
3039
3152
  _iterator2.f();
3040
- return _context25.finish(33);
3153
+ return _context28.finish(33);
3041
3154
  case 36:
3042
- _context25.next = 38;
3155
+ _context28.next = 38;
3043
3156
  return this.setDiscountSelected({
3044
3157
  discountId: Number(preferredId),
3045
3158
  isSelected: true
3046
3159
  });
3047
3160
  case 38:
3048
- _context25.next = 49;
3161
+ _context28.next = 49;
3049
3162
  break;
3050
3163
  case 40:
3051
3164
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
3052
- _context25.next = 46;
3165
+ _context28.next = 46;
3053
3166
  break;
3054
3167
  }
3055
3168
  if (!(params.applyBestDiscount !== false)) {
3056
- _context25.next = 44;
3169
+ _context28.next = 44;
3057
3170
  break;
3058
3171
  }
3059
- _context25.next = 44;
3172
+ _context28.next = 44;
3060
3173
  return this.bestDiscount();
3061
3174
  case 44:
3062
- _context25.next = 49;
3175
+ _context28.next = 49;
3063
3176
  break;
3064
3177
  case 46:
3065
3178
  if (!(params.applyBestDiscount !== false)) {
3066
- _context25.next = 49;
3179
+ _context28.next = 49;
3067
3180
  break;
3068
3181
  }
3069
- _context25.next = 49;
3182
+ _context28.next = 49;
3070
3183
  return this.bestDiscount();
3071
3184
  case 49:
3072
3185
  nextTempOrder = this.getTempOrder();
3073
- _context25.t1 = buildPlannerDiscountResult;
3074
- _context25.t2 = customerId;
3075
- _context25.t3 = this.getDiscountList();
3076
- _context25.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3077
- _context25.t5 = summaryBefore;
3078
- _context25.next = 57;
3186
+ _context28.t1 = buildPlannerDiscountResult;
3187
+ _context28.t2 = customerId;
3188
+ _context28.t3 = this.getDiscountList();
3189
+ _context28.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3190
+ _context28.t5 = summaryBefore;
3191
+ _context28.next = 57;
3079
3192
  return this.getSummary();
3080
3193
  case 57:
3081
- _context25.t6 = _context25.sent;
3082
- _context25.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3083
- _context25.t8 = preferredDiscountId;
3084
- _context25.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3085
- _context25.t10 = {
3086
- customerId: _context25.t2,
3087
- discountList: _context25.t3,
3088
- products: _context25.t4,
3089
- summaryBefore: _context25.t5,
3090
- summaryAfter: _context25.t6,
3091
- status: _context25.t7,
3092
- preferredDiscountId: _context25.t8,
3093
- preferredDiscountFound: _context25.t9
3194
+ _context28.t6 = _context28.sent;
3195
+ _context28.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3196
+ _context28.t8 = preferredDiscountId;
3197
+ _context28.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3198
+ _context28.t10 = {
3199
+ customerId: _context28.t2,
3200
+ discountList: _context28.t3,
3201
+ products: _context28.t4,
3202
+ summaryBefore: _context28.t5,
3203
+ summaryAfter: _context28.t6,
3204
+ status: _context28.t7,
3205
+ preferredDiscountId: _context28.t8,
3206
+ preferredDiscountFound: _context28.t9
3094
3207
  };
3095
- return _context25.abrupt("return", (0, _context25.t1)(_context25.t10));
3208
+ return _context28.abrupt("return", (0, _context28.t1)(_context28.t10));
3096
3209
  case 63:
3097
3210
  case "end":
3098
- return _context25.stop();
3211
+ return _context28.stop();
3099
3212
  }
3100
- }, _callee25, this, [[18, 30, 33, 36]]);
3213
+ }, _callee28, this, [[18, 30, 33, 36]]);
3101
3214
  }));
3102
3215
  function applyPlannerDiscounts() {
3103
3216
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -3107,16 +3220,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3107
3220
  }, {
3108
3221
  key: "buildUnifiedOrderProduct",
3109
3222
  value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
3110
- var _ref39, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref40, _sourceProduct$produc, _ref41, _ref42, _sourceProduct$quanti, _sourceProduct$price, _ref43, _ref44, _sourceProduct$sellin;
3223
+ var _ref40, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref41, _sourceProduct$produc, _ref42, _ref43, _sourceProduct$quanti, _sourceProduct$price, _ref44, _ref45, _sourceProduct$sellin;
3111
3224
  var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
3112
- var quotationShelfId = (_ref39 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref39 !== void 0 ? _ref39 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3225
+ var quotationShelfId = (_ref40 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref40 !== void 0 ? _ref40 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3113
3226
  var orderProduct = this.transformBaseProductToOrderProduct({
3114
3227
  payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
3115
3228
  id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
3116
- product_id: (_ref40 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref40 !== void 0 ? _ref40 : product === null || product === void 0 ? void 0 : product.id,
3117
- quantity: (_ref41 = (_ref42 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref42 !== void 0 ? _ref42 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref41 !== void 0 ? _ref41 : 1,
3229
+ product_id: (_ref41 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref41 !== void 0 ? _ref41 : product === null || product === void 0 ? void 0 : product.id,
3230
+ quantity: (_ref42 = (_ref43 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref43 !== void 0 ? _ref43 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref42 !== void 0 ? _ref42 : 1,
3118
3231
  price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
3119
- selling_price: (_ref43 = (_ref44 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref44 !== void 0 ? _ref44 : normalizedProductRaw.selling_price) !== null && _ref43 !== void 0 ? _ref43 : normalizedProductRaw.price,
3232
+ selling_price: (_ref44 = (_ref45 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.selling_price) !== null && _ref44 !== void 0 ? _ref44 : normalizedProductRaw.price,
3120
3233
  metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
3121
3234
  }),
3122
3235
  sourceProduct: sourceProduct
@@ -3135,29 +3248,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3135
3248
  }, {
3136
3249
  key: "removeExistingStagedLines",
3137
3250
  value: (function () {
3138
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ownershipKey) {
3251
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(ownershipKey) {
3139
3252
  var _this$getTempOrder;
3140
3253
  var existingLines;
3141
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3142
- while (1) switch (_context26.prev = _context26.next) {
3254
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3255
+ while (1) switch (_context29.prev = _context29.next) {
3143
3256
  case 0:
3144
3257
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
3145
3258
  var _product$metadata4;
3146
3259
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
3147
3260
  });
3148
3261
  if (!(existingLines.length > 0)) {
3149
- _context26.next = 4;
3262
+ _context29.next = 4;
3150
3263
  break;
3151
3264
  }
3152
- _context26.next = 4;
3265
+ _context29.next = 4;
3153
3266
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
3154
3267
  case 4:
3155
3268
  case "end":
3156
- return _context26.stop();
3269
+ return _context29.stop();
3157
3270
  }
3158
- }, _callee26, this);
3271
+ }, _callee29, this);
3159
3272
  }));
3160
- function removeExistingStagedLines(_x14) {
3273
+ function removeExistingStagedLines(_x15) {
3161
3274
  return _removeExistingStagedLines.apply(this, arguments);
3162
3275
  }
3163
3276
  return removeExistingStagedLines;
@@ -3165,25 +3278,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3165
3278
  }, {
3166
3279
  key: "stageProducts",
3167
3280
  value: function () {
3168
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params, ownershipKey) {
3281
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params, ownershipKey) {
3169
3282
  var _params$rawProducts;
3170
3283
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
3171
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3172
- while (1) switch (_context27.prev = _context27.next) {
3284
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3285
+ while (1) switch (_context30.prev = _context30.next) {
3173
3286
  case 0:
3174
3287
  productIds = params.productIds || [];
3175
3288
  if (productIds.length) {
3176
- _context27.next = 3;
3289
+ _context30.next = 3;
3177
3290
  break;
3178
3291
  }
3179
- return _context27.abrupt("return", this.getTempOrder());
3292
+ return _context30.abrupt("return", this.getTempOrder());
3180
3293
  case 3:
3181
3294
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3182
- _context27.next = 7;
3295
+ _context30.next = 7;
3183
3296
  break;
3184
3297
  }
3185
3298
  this.unifiedProductCatalog = params.rawProducts;
3186
- _context27.next = 12;
3299
+ _context30.next = 12;
3187
3300
  break;
3188
3301
  case 7:
3189
3302
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3194,15 +3307,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3194
3307
  return !existingIds.has(String(id));
3195
3308
  });
3196
3309
  if (!(missingIds.length || params.productLoadParams)) {
3197
- _context27.next = 12;
3310
+ _context30.next = 12;
3198
3311
  break;
3199
3312
  }
3200
- _context27.next = 12;
3313
+ _context30.next = 12;
3201
3314
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3202
3315
  product_ids: productIds.map(Number).filter(Number.isFinite)
3203
3316
  }));
3204
3317
  case 12:
3205
- _context27.next = 14;
3318
+ _context30.next = 14;
3206
3319
  return this.removeExistingStagedLines(ownershipKey);
3207
3320
  case 14:
3208
3321
  productIdSet = new Set(productIds.map(function (id) {
@@ -3215,30 +3328,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3215
3328
  _i = 0, _arr = selectedProducts;
3216
3329
  case 17:
3217
3330
  if (!(_i < _arr.length)) {
3218
- _context27.next = 26;
3331
+ _context30.next = 26;
3219
3332
  break;
3220
3333
  }
3221
3334
  sourceProduct = _arr[_i];
3222
3335
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3223
3336
  if (!productInput) {
3224
- _context27.next = 23;
3337
+ _context30.next = 23;
3225
3338
  break;
3226
3339
  }
3227
- _context27.next = 23;
3340
+ _context30.next = 23;
3228
3341
  return this.addProductToOrder(productInput);
3229
3342
  case 23:
3230
3343
  _i++;
3231
- _context27.next = 17;
3344
+ _context30.next = 17;
3232
3345
  break;
3233
3346
  case 26:
3234
- return _context27.abrupt("return", this.getTempOrder());
3347
+ return _context30.abrupt("return", this.getTempOrder());
3235
3348
  case 27:
3236
3349
  case "end":
3237
- return _context27.stop();
3350
+ return _context30.stop();
3238
3351
  }
3239
- }, _callee27, this);
3352
+ }, _callee30, this);
3240
3353
  }));
3241
- function stageProducts(_x15, _x16) {
3354
+ function stageProducts(_x16, _x17) {
3242
3355
  return _stageProducts.apply(this, arguments);
3243
3356
  }
3244
3357
  return stageProducts;
@@ -3250,18 +3363,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3250
3363
  }, {
3251
3364
  key: "stageRetailProducts",
3252
3365
  value: (function () {
3253
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3254
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3255
- while (1) switch (_context28.prev = _context28.next) {
3366
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3367
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3368
+ while (1) switch (_context31.prev = _context31.next) {
3256
3369
  case 0:
3257
- return _context28.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3370
+ return _context31.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3258
3371
  case 1:
3259
3372
  case "end":
3260
- return _context28.stop();
3373
+ return _context31.stop();
3261
3374
  }
3262
- }, _callee28, this);
3375
+ }, _callee31, this);
3263
3376
  }));
3264
- function stageRetailProducts(_x17) {
3377
+ function stageRetailProducts(_x18) {
3265
3378
  return _stageRetailProducts.apply(this, arguments);
3266
3379
  }
3267
3380
  return stageRetailProducts;
@@ -3275,20 +3388,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3275
3388
  }, {
3276
3389
  key: "addRetailProduct",
3277
3390
  value: (function () {
3278
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3279
- var _params$quantity, _ref45, _params$productId, _params$product, _params$product2;
3391
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3392
+ var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
3280
3393
  var quantity, productId, sourceProduct, products, orderProduct;
3281
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3282
- while (1) switch (_context29.prev = _context29.next) {
3394
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3395
+ while (1) switch (_context32.prev = _context32.next) {
3283
3396
  case 0:
3284
3397
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3285
3398
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3286
- _context29.next = 3;
3399
+ _context32.next = 3;
3287
3400
  break;
3288
3401
  }
3289
3402
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
3290
3403
  case 3:
3291
- productId = (_ref45 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref45 !== void 0 ? _ref45 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3404
+ productId = (_ref46 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref46 !== void 0 ? _ref46 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3292
3405
  sourceProduct = params.product;
3293
3406
  if (!sourceProduct && productId !== undefined && productId !== null) {
3294
3407
  sourceProduct = this.unifiedProductCatalog.find(function (product) {
@@ -3297,22 +3410,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3297
3410
  });
3298
3411
  }
3299
3412
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
3300
- _context29.next = 11;
3413
+ _context32.next = 11;
3301
3414
  break;
3302
3415
  }
3303
- _context29.next = 9;
3416
+ _context32.next = 9;
3304
3417
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3305
3418
  product_ids: [Number(productId)].filter(Number.isFinite)
3306
3419
  }));
3307
3420
  case 9:
3308
- products = _context29.sent;
3421
+ products = _context32.sent;
3309
3422
  sourceProduct = products.find(function (product) {
3310
3423
  var _product$id4;
3311
3424
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
3312
3425
  });
3313
3426
  case 11:
3314
3427
  if (sourceProduct) {
3315
- _context29.next = 13;
3428
+ _context32.next = 13;
3316
3429
  break;
3317
3430
  }
3318
3431
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -3321,19 +3434,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3321
3434
  quantity: quantity
3322
3435
  }), 'unified_booking_sales_retail');
3323
3436
  if (orderProduct) {
3324
- _context29.next = 16;
3437
+ _context32.next = 16;
3325
3438
  break;
3326
3439
  }
3327
3440
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
3328
3441
  case 16:
3329
- return _context29.abrupt("return", this.addProductToOrder(orderProduct));
3442
+ return _context32.abrupt("return", this.addProductToOrder(orderProduct));
3330
3443
  case 17:
3331
3444
  case "end":
3332
- return _context29.stop();
3445
+ return _context32.stop();
3333
3446
  }
3334
- }, _callee29, this);
3447
+ }, _callee32, this);
3335
3448
  }));
3336
- function addRetailProduct(_x18) {
3449
+ function addRetailProduct(_x19) {
3337
3450
  return _addRetailProduct.apply(this, arguments);
3338
3451
  }
3339
3452
  return addRetailProduct;
@@ -3433,7 +3546,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3433
3546
  }, {
3434
3547
  key: "buildAvailabilityOperatingHoursSnapshot",
3435
3548
  value: function buildAvailabilityOperatingHoursSnapshot(params) {
3436
- var _this4 = this;
3549
+ var _this5 = this;
3437
3550
  var descriptor = params.prepare._availabilityOperatingHours || {
3438
3551
  source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
3439
3552
  scheduleIds: []
@@ -3443,7 +3556,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3443
3556
  var range = normalizeAvailabilityLocalDateTimeRange({
3444
3557
  startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
3445
3558
  endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
3446
- fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
3559
+ fixedOffsetMinutes: _this5.getAvailabilityRuntimeOffsetMinutes(),
3447
3560
  rollOverEnd: true
3448
3561
  });
3449
3562
  return range ? [{
@@ -3478,7 +3591,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3478
3591
  var range = normalizeAvailabilityLocalDateTimeRange({
3479
3592
  startAt: slot.start_at,
3480
3593
  endAt: slot.end_at,
3481
- fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
3594
+ fixedOffsetMinutes: _this5.getAvailabilityRuntimeOffsetMinutes(),
3482
3595
  rollOverEnd: true
3483
3596
  });
3484
3597
  return range ? [{
@@ -3494,7 +3607,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3494
3607
  var range = normalizeAvailabilityLocalDateTimeRange({
3495
3608
  startAt: slot.start_at,
3496
3609
  endAt: slot.end_at,
3497
- fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
3610
+ fixedOffsetMinutes: _this5.getAvailabilityRuntimeOffsetMinutes(),
3498
3611
  rollOverEnd: true
3499
3612
  });
3500
3613
  return range ? [{
@@ -3521,46 +3634,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3521
3634
  }, {
3522
3635
  key: "loadAvailabilityProducts",
3523
3636
  value: function () {
3524
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3637
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3525
3638
  var _prepare$catalogScope,
3526
3639
  _prepare$catalogScope2,
3527
- _this5 = this,
3640
+ _this6 = this,
3528
3641
  _prepare$resourceIds;
3529
3642
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
3530
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3531
- while (1) switch (_context30.prev = _context30.next) {
3643
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3644
+ while (1) switch (_context33.prev = _context33.next) {
3532
3645
  case 0:
3533
3646
  prepare = params.prepare, dateRange = params.dateRange;
3534
3647
  explicitProductIds = prepare.productIds || [];
3535
3648
  rawProducts = [];
3536
3649
  if (!Array.isArray(prepare.rawProducts)) {
3537
- _context30.next = 8;
3650
+ _context33.next = 8;
3538
3651
  break;
3539
3652
  }
3540
3653
  rawProducts = prepare.rawProducts;
3541
3654
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
3542
- _context30.next = 34;
3655
+ _context33.next = 34;
3543
3656
  break;
3544
3657
  case 8:
3545
3658
  if (!(explicitProductIds.length > 0)) {
3546
- _context30.next = 14;
3659
+ _context33.next = 14;
3547
3660
  break;
3548
3661
  }
3549
- _context30.next = 11;
3662
+ _context33.next = 11;
3550
3663
  return this.loadProducts({
3551
3664
  product_ids: explicitProductIds,
3552
3665
  schedule_date: dateRange.startDate
3553
3666
  });
3554
3667
  case 11:
3555
- rawProducts = _context30.sent;
3556
- _context30.next = 34;
3668
+ rawProducts = _context33.sent;
3669
+ _context33.next = 34;
3557
3670
  break;
3558
3671
  case 14:
3559
3672
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
3560
- _context30.next = 30;
3673
+ _context33.next = 30;
3561
3674
  break;
3562
3675
  }
3563
- _context30.next = 17;
3676
+ _context33.next = 17;
3564
3677
  return this.loadScheduleAvailableDate({
3565
3678
  startDate: dateRange.startDate,
3566
3679
  endDate: dateRange.endDate,
@@ -3576,44 +3689,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3576
3689
  });
3577
3690
  productIds = uniqueAvailabilityIds([].concat(_toConsumableArray(scheduleProductIds), _toConsumableArray(((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || [])));
3578
3691
  if (!(productIds.length > 0)) {
3579
- _context30.next = 27;
3692
+ _context33.next = 27;
3580
3693
  break;
3581
3694
  }
3582
3695
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
3583
- _context30.next = 24;
3696
+ _context33.next = 24;
3584
3697
  return this.loadProducts({
3585
3698
  product_ids: productIds,
3586
3699
  schedule_date: dateRange.startDate
3587
3700
  });
3588
3701
  case 24:
3589
- rawProducts = _context30.sent;
3590
- _context30.next = 28;
3702
+ rawProducts = _context33.sent;
3703
+ _context33.next = 28;
3591
3704
  break;
3592
3705
  case 27:
3593
3706
  this.unifiedProductCatalog = [];
3594
3707
  case 28:
3595
- _context30.next = 34;
3708
+ _context33.next = 34;
3596
3709
  break;
3597
3710
  case 30:
3598
3711
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
3599
- _context30.next = 34;
3712
+ _context33.next = 34;
3600
3713
  break;
3601
3714
  }
3602
- _context30.next = 33;
3715
+ _context33.next = 33;
3603
3716
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
3604
3717
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
3605
3718
  }));
3606
3719
  case 33:
3607
- rawProducts = _context30.sent;
3720
+ rawProducts = _context33.sent;
3608
3721
  case 34:
3609
3722
  normalized = rawProducts.map(function (product) {
3610
- return normalizeProductForAvailability(product, params.scheduleList, _this5.getAvailabilityRuntimeOffsetMinutes());
3723
+ return normalizeProductForAvailability(product, params.scheduleList, _this6.getAvailabilityRuntimeOffsetMinutes());
3611
3724
  });
3612
3725
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
3613
- _context30.next = 37;
3726
+ _context33.next = 37;
3614
3727
  break;
3615
3728
  }
3616
- return _context30.abrupt("return", normalized.filter(function (product) {
3729
+ return _context33.abrupt("return", normalized.filter(function (product) {
3617
3730
  var _product$requirementG2;
3618
3731
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
3619
3732
  var _group$resourceIds3;
@@ -3626,16 +3739,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3626
3739
  }));
3627
3740
  case 37:
3628
3741
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
3629
- return _context30.abrupt("return", productIdSet ? normalized.filter(function (product) {
3742
+ return _context33.abrupt("return", productIdSet ? normalized.filter(function (product) {
3630
3743
  return productIdSet.has(String(product.id));
3631
3744
  }) : normalized);
3632
3745
  case 39:
3633
3746
  case "end":
3634
- return _context30.stop();
3747
+ return _context33.stop();
3635
3748
  }
3636
- }, _callee30, this);
3749
+ }, _callee33, this);
3637
3750
  }));
3638
- function loadAvailabilityProducts(_x19) {
3751
+ function loadAvailabilityProducts(_x20) {
3639
3752
  return _loadAvailabilityProducts.apply(this, arguments);
3640
3753
  }
3641
3754
  return loadAvailabilityProducts;
@@ -3648,12 +3761,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3648
3761
  }, {
3649
3762
  key: "fetchAvailabilityResourcesV2",
3650
3763
  value: (function () {
3651
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3764
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3652
3765
  var response, data;
3653
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3654
- while (1) switch (_context31.prev = _context31.next) {
3766
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3767
+ while (1) switch (_context34.prev = _context34.next) {
3655
3768
  case 0:
3656
- _context31.next = 2;
3769
+ _context34.next = 2;
3657
3770
  return this.request.get('/schedule/resource/list/v2', {
3658
3771
  start_date: params.dateRange.startDate,
3659
3772
  end_date: params.dateRange.endDate,
@@ -3663,28 +3776,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3663
3776
  useCache: false
3664
3777
  });
3665
3778
  case 2:
3666
- response = _context31.sent;
3779
+ response = _context34.sent;
3667
3780
  data = response === null || response === void 0 ? void 0 : response.data;
3668
3781
  if (!Array.isArray(data)) {
3669
- _context31.next = 6;
3782
+ _context34.next = 6;
3670
3783
  break;
3671
3784
  }
3672
- return _context31.abrupt("return", data);
3785
+ return _context34.abrupt("return", data);
3673
3786
  case 6:
3674
3787
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
3675
- _context31.next = 8;
3788
+ _context34.next = 8;
3676
3789
  break;
3677
3790
  }
3678
- return _context31.abrupt("return", data.list);
3791
+ return _context34.abrupt("return", data.list);
3679
3792
  case 8:
3680
- return _context31.abrupt("return", []);
3793
+ return _context34.abrupt("return", []);
3681
3794
  case 9:
3682
3795
  case "end":
3683
- return _context31.stop();
3796
+ return _context34.stop();
3684
3797
  }
3685
- }, _callee31, this);
3798
+ }, _callee34, this);
3686
3799
  }));
3687
- function fetchAvailabilityResourcesV2(_x20) {
3800
+ function fetchAvailabilityResourcesV2(_x21) {
3688
3801
  return _fetchAvailabilityResourcesV.apply(this, arguments);
3689
3802
  }
3690
3803
  return fetchAvailabilityResourcesV2;
@@ -3692,17 +3805,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3692
3805
  }, {
3693
3806
  key: "fetchAndPublishAvailabilityResourcesV2",
3694
3807
  value: function () {
3695
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3808
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3696
3809
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3697
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3698
- while (1) switch (_context32.prev = _context32.next) {
3810
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3811
+ while (1) switch (_context35.prev = _context35.next) {
3699
3812
  case 0:
3700
3813
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3701
3814
  if (!(normalizedResourceIds.length === 0)) {
3702
- _context32.next = 3;
3815
+ _context35.next = 3;
3703
3816
  break;
3704
3817
  }
3705
- return _context32.abrupt("return", []);
3818
+ return _context35.abrupt("return", []);
3706
3819
  case 3:
3707
3820
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3708
3821
  cacheParams = {
@@ -3712,7 +3825,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3712
3825
  };
3713
3826
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3714
3827
  if (!cachedRawResources) {
3715
- _context32.next = 9;
3828
+ _context35.next = 9;
3716
3829
  break;
3717
3830
  }
3718
3831
  if (params.useCacheOnHit) {
@@ -3724,23 +3837,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3724
3837
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3725
3838
  });
3726
3839
  }
3727
- return _context32.abrupt("return", cachedRawResources);
3840
+ return _context35.abrupt("return", cachedRawResources);
3728
3841
  case 9:
3729
- _context32.next = 11;
3842
+ _context35.next = 11;
3730
3843
  return this.refreshAvailabilityRemoteResourceQuery({
3731
3844
  timezone: params.timezone,
3732
3845
  dateRange: params.dateRange,
3733
3846
  resourceIds: normalizedResourceIds
3734
3847
  });
3735
3848
  case 11:
3736
- return _context32.abrupt("return", _context32.sent);
3849
+ return _context35.abrupt("return", _context35.sent);
3737
3850
  case 12:
3738
3851
  case "end":
3739
- return _context32.stop();
3852
+ return _context35.stop();
3740
3853
  }
3741
- }, _callee32, this);
3854
+ }, _callee35, this);
3742
3855
  }));
3743
- function fetchAndPublishAvailabilityResourcesV2(_x21) {
3856
+ function fetchAndPublishAvailabilityResourcesV2(_x22) {
3744
3857
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
3745
3858
  }
3746
3859
  return fetchAndPublishAvailabilityResourcesV2;
@@ -3748,17 +3861,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3748
3861
  }, {
3749
3862
  key: "refreshAvailabilityRemoteResourceQuery",
3750
3863
  value: function () {
3751
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3864
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3752
3865
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3753
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3754
- while (1) switch (_context33.prev = _context33.next) {
3866
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3867
+ while (1) switch (_context36.prev = _context36.next) {
3755
3868
  case 0:
3756
3869
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3757
3870
  if (!(normalizedResourceIds.length === 0)) {
3758
- _context33.next = 3;
3871
+ _context36.next = 3;
3759
3872
  break;
3760
3873
  }
3761
- return _context33.abrupt("return", []);
3874
+ return _context36.abrupt("return", []);
3762
3875
  case 3:
3763
3876
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
3764
3877
  timezone: params.timezone,
@@ -3768,13 +3881,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3768
3881
  epoch = this.availabilityRemoteResourceEpoch;
3769
3882
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3770
3883
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
3771
- _context33.next = 10;
3884
+ _context36.next = 10;
3772
3885
  break;
3773
3886
  }
3774
- _context33.next = 9;
3887
+ _context36.next = 9;
3775
3888
  return existing.promise;
3776
3889
  case 9:
3777
- return _context33.abrupt("return", _context33.sent);
3890
+ return _context36.abrupt("return", _context36.sent);
3778
3891
  case 10:
3779
3892
  this.availabilityRemoteResourceQuerySequence += 1;
3780
3893
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -3786,11 +3899,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3786
3899
  epoch: epoch,
3787
3900
  promise: promise
3788
3901
  });
3789
- _context33.prev = 14;
3790
- _context33.next = 17;
3902
+ _context36.prev = 14;
3903
+ _context36.next = 17;
3791
3904
  return promise;
3792
3905
  case 17:
3793
- rawResources = _context33.sent;
3906
+ rawResources = _context36.sent;
3794
3907
  if (epoch === this.availabilityRemoteResourceEpoch) {
3795
3908
  this.availabilityRemoteOccupancyCache.publish({
3796
3909
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -3801,21 +3914,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3801
3914
  version: writeVersion
3802
3915
  });
3803
3916
  }
3804
- return _context33.abrupt("return", rawResources);
3917
+ return _context36.abrupt("return", rawResources);
3805
3918
  case 20:
3806
- _context33.prev = 20;
3919
+ _context36.prev = 20;
3807
3920
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3808
3921
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3809
3922
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
3810
3923
  }
3811
- return _context33.finish(20);
3924
+ return _context36.finish(20);
3812
3925
  case 24:
3813
3926
  case "end":
3814
- return _context33.stop();
3927
+ return _context36.stop();
3815
3928
  }
3816
- }, _callee33, this, [[14,, 20, 24]]);
3929
+ }, _callee36, this, [[14,, 20, 24]]);
3817
3930
  }));
3818
- function refreshAvailabilityRemoteResourceQuery(_x22) {
3931
+ function refreshAvailabilityRemoteResourceQuery(_x23) {
3819
3932
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
3820
3933
  }
3821
3934
  return refreshAvailabilityRemoteResourceQuery;
@@ -3823,26 +3936,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3823
3936
  }, {
3824
3937
  key: "loadAvailabilityResources",
3825
3938
  value: function () {
3826
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3939
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3827
3940
  var resourceIds, cachedRawResources, rawResources;
3828
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3829
- while (1) switch (_context34.prev = _context34.next) {
3941
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3942
+ while (1) switch (_context37.prev = _context37.next) {
3830
3943
  case 0:
3831
3944
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
3832
3945
  if (!(resourceIds.length === 0)) {
3833
- _context34.next = 3;
3946
+ _context37.next = 3;
3834
3947
  break;
3835
3948
  }
3836
- return _context34.abrupt("return", {
3949
+ return _context37.abrupt("return", {
3837
3950
  resources: [],
3838
3951
  resourceOccupancies: []
3839
3952
  });
3840
3953
  case 3:
3841
3954
  if (!Array.isArray(params.rawResources)) {
3842
- _context34.next = 5;
3955
+ _context37.next = 5;
3843
3956
  break;
3844
3957
  }
3845
- return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3958
+ return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
3846
3959
  rawResources: params.rawResources,
3847
3960
  scheduleList: params.scheduleList,
3848
3961
  dateRange: params.dateRange,
@@ -3850,7 +3963,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3850
3963
  }));
3851
3964
  case 5:
3852
3965
  if (!(params.fetchPolicy === 'cache_only')) {
3853
- _context34.next = 10;
3966
+ _context37.next = 10;
3854
3967
  break;
3855
3968
  }
3856
3969
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -3859,22 +3972,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3859
3972
  dateRange: params.dateRange
3860
3973
  });
3861
3974
  if (!cachedRawResources) {
3862
- _context34.next = 9;
3975
+ _context37.next = 9;
3863
3976
  break;
3864
3977
  }
3865
- return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3978
+ return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
3866
3979
  rawResources: cachedRawResources,
3867
3980
  scheduleList: params.scheduleList,
3868
3981
  dateRange: params.dateRange,
3869
3982
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
3870
3983
  }));
3871
3984
  case 9:
3872
- return _context34.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3985
+ return _context37.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3873
3986
  resources: [],
3874
3987
  resourceOccupancies: []
3875
3988
  });
3876
3989
  case 10:
3877
- _context34.next = 12;
3990
+ _context37.next = 12;
3878
3991
  return this.fetchAndPublishAvailabilityResourcesV2({
3879
3992
  timezone: params.timezone,
3880
3993
  dateRange: params.dateRange,
@@ -3882,8 +3995,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3882
3995
  useCacheOnHit: true
3883
3996
  });
3884
3997
  case 12:
3885
- rawResources = _context34.sent;
3886
- return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3998
+ rawResources = _context37.sent;
3999
+ return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
3887
4000
  rawResources: rawResources,
3888
4001
  scheduleList: params.scheduleList,
3889
4002
  dateRange: params.dateRange,
@@ -3891,11 +4004,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3891
4004
  }));
3892
4005
  case 14:
3893
4006
  case "end":
3894
- return _context34.stop();
4007
+ return _context37.stop();
3895
4008
  }
3896
- }, _callee34, this);
4009
+ }, _callee37, this);
3897
4010
  }));
3898
- function loadAvailabilityResources(_x23) {
4011
+ function loadAvailabilityResources(_x24) {
3899
4012
  return _loadAvailabilityResources.apply(this, arguments);
3900
4013
  }
3901
4014
  return loadAvailabilityResources;
@@ -3915,7 +4028,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3915
4028
  var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
3916
4029
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
3917
4030
  productLineUids.forEach(function (requestedUid) {
3918
- var _ref46, _product$booking_uid2, _product$metadata5;
4031
+ var _ref47, _product$booking_uid2, _product$metadata5;
3919
4032
  var product = products.find(function (line) {
3920
4033
  return getProductLineUid(line) === String(requestedUid);
3921
4034
  });
@@ -3925,7 +4038,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3925
4038
  });
3926
4039
  }
3927
4040
  var productUid = getProductLineUid(product);
3928
- var linkedBookingUid = String((_ref46 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref46 !== void 0 ? _ref46 : '');
4041
+ var linkedBookingUid = String((_ref47 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
3929
4042
  var linkedBookings = bookings.filter(function (booking) {
3930
4043
  var _booking$product_uid;
3931
4044
  return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
@@ -3968,24 +4081,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3968
4081
  }, {
3969
4082
  key: "collectCartResourceOccupancies",
3970
4083
  value: function collectCartResourceOccupancies(tempOrder, exclusions) {
3971
- var _this6 = this;
4084
+ var _this7 = this;
3972
4085
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
3973
4086
  return bookings.flatMap(function (booking) {
3974
- var _ref47, _booking$product_uid2, _booking$metadata2;
4087
+ var _ref48, _booking$product_uid2, _booking$metadata2;
3975
4088
  var bookingUid = getBookingUid(booking);
3976
- var productUid = String((_ref47 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
4089
+ var productUid = String((_ref48 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
3977
4090
  var scheduleEventId = toNumberId(booking.schedule_event_id);
3978
4091
  var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
3979
4092
  var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
3980
4093
  var resources = Array.isArray(booking.resources) ? booking.resources : [];
3981
4094
  return resources.flatMap(function (resource) {
3982
- var _ref48, _resource$resource_id, _ref49, _resource$capacity;
3983
- var resourceId = (_ref48 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref48 !== void 0 ? _ref48 : resource.id;
4095
+ var _ref49, _resource$resource_id, _ref50, _resource$capacity;
4096
+ var resourceId = (_ref49 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref49 !== void 0 ? _ref49 : resource.id;
3984
4097
  if (resourceId == null || !startAt || !endAt) return [];
3985
4098
  var range = normalizeAvailabilityLocalDateTimeRange({
3986
4099
  startAt: startAt,
3987
4100
  endAt: endAt,
3988
- fixedOffsetMinutes: _this6.getAvailabilityRuntimeOffsetMinutes(),
4101
+ fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
3989
4102
  rollOverEnd: false
3990
4103
  });
3991
4104
  if (!range) return [];
@@ -3993,7 +4106,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3993
4106
  resourceId: resourceId,
3994
4107
  startAt: range.startAt,
3995
4108
  endAt: range.endAt,
3996
- pax: Math.max(1, Number((_ref49 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref49 !== void 0 ? _ref49 : 1) || 1),
4109
+ pax: Math.max(1, Number((_ref50 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref50 !== void 0 ? _ref50 : 1) || 1),
3997
4110
  source: 'cart',
3998
4111
  scheduleEventId: scheduleEventId,
3999
4112
  bookingUid: bookingUid || undefined,
@@ -4003,7 +4116,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4003
4116
  resource: resource
4004
4117
  }
4005
4118
  };
4006
- return _this6.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
4119
+ return _this7.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
4007
4120
  });
4008
4121
  });
4009
4122
  }
@@ -4070,16 +4183,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4070
4183
  }, {
4071
4184
  key: "assertContextualQueryFreshness",
4072
4185
  value: function assertContextualQueryFreshness(context, request) {
4073
- var _this7 = this;
4186
+ var _this8 = this;
4074
4187
  if (request.target === 'time') {
4075
4188
  request.candidates.forEach(function (candidate) {
4076
- _this7.assertAvailabilityCandidateFreshness(context, candidate);
4189
+ _this8.assertAvailabilityCandidateFreshness(context, candidate);
4077
4190
  });
4078
4191
  return;
4079
4192
  }
4080
4193
  if (request.target === 'resource') {
4081
4194
  request.selectedRanges.forEach(function (candidate) {
4082
- _this7.assertAvailabilityCandidateFreshness(context, candidate);
4195
+ _this8.assertAvailabilityCandidateFreshness(context, candidate);
4083
4196
  });
4084
4197
  }
4085
4198
  }
@@ -4126,8 +4239,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4126
4239
  }, {
4127
4240
  key: "buildAvailabilityProjectionSnapshot",
4128
4241
  value: function () {
4129
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4130
- var _this8 = this;
4242
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4243
+ var _this9 = this;
4131
4244
  var options,
4132
4245
  normalizedPrepareParams,
4133
4246
  timezoneLabel,
@@ -4148,11 +4261,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4148
4261
  durationCandidateAnchorAt,
4149
4262
  orderRevision,
4150
4263
  projection,
4151
- _args35 = arguments;
4152
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4153
- while (1) switch (_context35.prev = _context35.next) {
4264
+ _args38 = arguments;
4265
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4266
+ while (1) switch (_context38.prev = _context38.next) {
4154
4267
  case 0:
4155
- options = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
4268
+ options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
4156
4269
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
4157
4270
  timezoneLabel = String(normalizedPrepareParams.timezone);
4158
4271
  dateRange = normalizedPrepareParams.dateRange;
@@ -4166,15 +4279,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4166
4279
  scheduleList: scheduleList,
4167
4280
  businessHours: businessHours
4168
4281
  });
4169
- _context35.next = 11;
4282
+ _context38.next = 11;
4170
4283
  return this.loadAvailabilityProducts({
4171
4284
  prepare: normalizedPrepareParams,
4172
4285
  dateRange: dateRange,
4173
4286
  scheduleList: scheduleList
4174
4287
  });
4175
4288
  case 11:
4176
- products = _context35.sent;
4177
- _context35.next = 14;
4289
+ products = _context38.sent;
4290
+ _context38.next = 14;
4178
4291
  return this.loadAvailabilityResources({
4179
4292
  timezone: timezoneLabel,
4180
4293
  dateRange: dateRange,
@@ -4186,14 +4299,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4186
4299
  fallbackResources: options.fallbackResources
4187
4300
  });
4188
4301
  case 14:
4189
- loadedResources = _context35.sent;
4302
+ loadedResources = _context38.sent;
4190
4303
  tempOrder = this.getTempOrder();
4191
4304
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4192
4305
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
4193
4306
  var range = normalizeAvailabilityLocalDateTimeRange({
4194
4307
  startAt: occupancy.startAt,
4195
4308
  endAt: occupancy.endAt,
4196
- fixedOffsetMinutes: _this8.getAvailabilityRuntimeOffsetMinutes(),
4309
+ fixedOffsetMinutes: _this9.getAvailabilityRuntimeOffsetMinutes(),
4197
4310
  rollOverEnd: false
4198
4311
  });
4199
4312
  if (!range) return [];
@@ -4203,7 +4316,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4203
4316
  })];
4204
4317
  });
4205
4318
  remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
4206
- return !_this8.occupancyIsExcluded(occupancy, exclusions);
4319
+ return !_this9.occupancyIsExcluded(occupancy, exclusions);
4207
4320
  });
4208
4321
  cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
4209
4322
  preparedAt = this.getAvailabilityRuntimeDateTime();
@@ -4232,18 +4345,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4232
4345
  prepareParams: normalizedPrepareParams,
4233
4346
  durationCandidateAnchorAt: durationCandidateAnchorAt
4234
4347
  });
4235
- return _context35.abrupt("return", {
4348
+ return _context38.abrupt("return", {
4236
4349
  projection: projection,
4237
4350
  prepareParams: normalizedPrepareParams,
4238
4351
  orderRevision: orderRevision
4239
4352
  });
4240
4353
  case 26:
4241
4354
  case "end":
4242
- return _context35.stop();
4355
+ return _context38.stop();
4243
4356
  }
4244
- }, _callee35, this);
4357
+ }, _callee38, this);
4245
4358
  }));
4246
- function buildAvailabilityProjectionSnapshot(_x24) {
4359
+ function buildAvailabilityProjectionSnapshot(_x25) {
4247
4360
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
4248
4361
  }
4249
4362
  return buildAvailabilityProjectionSnapshot;
@@ -4251,10 +4364,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4251
4364
  }, {
4252
4365
  key: "getSharedPreparedAvailabilitySnapshot",
4253
4366
  value: function () {
4254
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4367
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4255
4368
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
4256
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4257
- while (1) switch (_context36.prev = _context36.next) {
4369
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4370
+ while (1) switch (_context39.prev = _context39.next) {
4258
4371
  case 0:
4259
4372
  lifecycleGeneration = this.availabilityLifecycleGeneration;
4260
4373
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -4273,15 +4386,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4273
4386
  }
4274
4387
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
4275
4388
  if (!hasRawInputs) {
4276
- _context36.next = 11;
4389
+ _context39.next = 11;
4277
4390
  break;
4278
4391
  }
4279
- _context36.next = 7;
4392
+ _context39.next = 7;
4280
4393
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
4281
4394
  case 7:
4282
- snapshot = _context36.sent;
4395
+ snapshot = _context39.sent;
4283
4396
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4284
- _context36.next = 10;
4397
+ _context39.next = 10;
4285
4398
  break;
4286
4399
  }
4287
4400
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4290,7 +4403,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4290
4403
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4291
4404
  });
4292
4405
  case 10:
4293
- return _context36.abrupt("return", {
4406
+ return _context39.abrupt("return", {
4294
4407
  prepareKey: prepareKey,
4295
4408
  snapshot: snapshot
4296
4409
  });
@@ -4304,13 +4417,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4304
4417
  promise: promise
4305
4418
  });
4306
4419
  }
4307
- _context36.prev = 14;
4308
- _context36.next = 17;
4420
+ _context39.prev = 14;
4421
+ _context39.next = 17;
4309
4422
  return promise;
4310
4423
  case 17:
4311
- _snapshot = _context36.sent;
4424
+ _snapshot = _context39.sent;
4312
4425
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4313
- _context36.next = 20;
4426
+ _context39.next = 20;
4314
4427
  break;
4315
4428
  }
4316
4429
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4319,24 +4432,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4319
4432
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4320
4433
  });
4321
4434
  case 20:
4322
- return _context36.abrupt("return", {
4435
+ return _context39.abrupt("return", {
4323
4436
  prepareKey: prepareKey,
4324
4437
  snapshot: _snapshot
4325
4438
  });
4326
4439
  case 21:
4327
- _context36.prev = 21;
4440
+ _context39.prev = 21;
4328
4441
  current = this.availabilityPrepareInFlight.get(prepareKey);
4329
4442
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4330
4443
  this.availabilityPrepareInFlight.delete(prepareKey);
4331
4444
  }
4332
- return _context36.finish(21);
4445
+ return _context39.finish(21);
4333
4446
  case 25:
4334
4447
  case "end":
4335
- return _context36.stop();
4448
+ return _context39.stop();
4336
4449
  }
4337
- }, _callee36, this, [[14,, 21, 25]]);
4450
+ }, _callee39, this, [[14,, 21, 25]]);
4338
4451
  }));
4339
- function getSharedPreparedAvailabilitySnapshot(_x25) {
4452
+ function getSharedPreparedAvailabilitySnapshot(_x26) {
4340
4453
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
4341
4454
  }
4342
4455
  return getSharedPreparedAvailabilitySnapshot;
@@ -4344,51 +4457,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4344
4457
  }, {
4345
4458
  key: "refreshAvailabilityContextProjection",
4346
4459
  value: function () {
4347
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4348
- var _this9 = this;
4460
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4461
+ var _this10 = this;
4349
4462
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
4350
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4351
- while (1) switch (_context38.prev = _context38.next) {
4463
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4464
+ while (1) switch (_context41.prev = _context41.next) {
4352
4465
  case 0:
4353
4466
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4354
4467
  if (!existingInFlight) {
4355
- _context38.next = 5;
4468
+ _context41.next = 5;
4356
4469
  break;
4357
4470
  }
4358
- _context38.next = 4;
4471
+ _context41.next = 4;
4359
4472
  return existingInFlight;
4360
4473
  case 4:
4361
- return _context38.abrupt("return", _context38.sent);
4474
+ return _context41.abrupt("return", _context41.sent);
4362
4475
  case 5:
4363
4476
  context = this.getAvailabilityContextEntry(params.contextId);
4364
4477
  expectedVersion = context.activeVersion;
4365
4478
  expectedRefreshNonce = context.refreshNonce;
4366
4479
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
4367
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
4480
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
4368
4481
  var snapshot, currentContext, projectionEntry;
4369
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4370
- while (1) switch (_context37.prev = _context37.next) {
4482
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4483
+ while (1) switch (_context40.prev = _context40.next) {
4371
4484
  case 0:
4372
- _context37.next = 2;
4373
- return _this9.buildAvailabilityProjectionSnapshot(_this9.cloneAvailabilityPrepareParams(context.prepareParams), {
4485
+ _context40.next = 2;
4486
+ return _this10.buildAvailabilityProjectionSnapshot(_this10.cloneAvailabilityPrepareParams(context.prepareParams), {
4374
4487
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
4375
4488
  });
4376
4489
  case 2:
4377
- snapshot = _context37.sent;
4378
- currentContext = _this9.availabilityContextRegistry.get(params.contextId);
4490
+ snapshot = _context40.sent;
4491
+ currentContext = _this10.availabilityContextRegistry.get(params.contextId);
4379
4492
  if (currentContext) {
4380
- _context37.next = 6;
4493
+ _context40.next = 6;
4381
4494
  break;
4382
4495
  }
4383
- return _context37.abrupt("return", null);
4496
+ return _context40.abrupt("return", null);
4384
4497
  case 6:
4385
- if (!(expectedLifecycleGeneration !== _this9.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4386
- _context37.next = 8;
4498
+ if (!(expectedLifecycleGeneration !== _this10.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4499
+ _context40.next = 8;
4387
4500
  break;
4388
4501
  }
4389
- return _context37.abrupt("return", null);
4502
+ return _context40.abrupt("return", null);
4390
4503
  case 8:
4391
- projectionEntry = _this9.storeAvailabilityProjectionEntry({
4504
+ projectionEntry = _this10.storeAvailabilityProjectionEntry({
4392
4505
  contextId: currentContext.contextId,
4393
4506
  prepareParams: snapshot.prepareParams,
4394
4507
  prepareKey: currentContext.prepareKey,
@@ -4396,8 +4509,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4396
4509
  orderRevision: snapshot.orderRevision,
4397
4510
  incrementVersion: true
4398
4511
  });
4399
- _context37.next = 11;
4400
- return _this9.emitAvailabilityDiagnostic({
4512
+ _context40.next = 11;
4513
+ return _this10.emitAvailabilityDiagnostic({
4401
4514
  action: 'refresh',
4402
4515
  contextId: currentContext.contextId,
4403
4516
  contextVersion: projectionEntry.contextVersion,
@@ -4408,33 +4521,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4408
4521
  reason: params.reason
4409
4522
  });
4410
4523
  case 11:
4411
- return _context37.abrupt("return", projectionEntry);
4524
+ return _context40.abrupt("return", projectionEntry);
4412
4525
  case 12:
4413
4526
  case "end":
4414
- return _context37.stop();
4527
+ return _context40.stop();
4415
4528
  }
4416
- }, _callee37);
4529
+ }, _callee40);
4417
4530
  }))();
4418
4531
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
4419
- _context38.prev = 11;
4420
- _context38.next = 14;
4532
+ _context41.prev = 11;
4533
+ _context41.next = 14;
4421
4534
  return refreshPromise;
4422
4535
  case 14:
4423
- return _context38.abrupt("return", _context38.sent);
4536
+ return _context41.abrupt("return", _context41.sent);
4424
4537
  case 15:
4425
- _context38.prev = 15;
4538
+ _context41.prev = 15;
4426
4539
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4427
4540
  if (current === refreshPromise) {
4428
4541
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
4429
4542
  }
4430
- return _context38.finish(15);
4543
+ return _context41.finish(15);
4431
4544
  case 19:
4432
4545
  case "end":
4433
- return _context38.stop();
4546
+ return _context41.stop();
4434
4547
  }
4435
- }, _callee38, this, [[11,, 15, 19]]);
4548
+ }, _callee41, this, [[11,, 15, 19]]);
4436
4549
  }));
4437
- function refreshAvailabilityContextProjection(_x26) {
4550
+ function refreshAvailabilityContextProjection(_x27) {
4438
4551
  return _refreshAvailabilityContextProjection.apply(this, arguments);
4439
4552
  }
4440
4553
  return refreshAvailabilityContextProjection;
@@ -4442,53 +4555,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4442
4555
  }, {
4443
4556
  key: "ensureAvailabilityContextProjection",
4444
4557
  value: function () {
4445
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId, reason) {
4558
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, reason) {
4446
4559
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
4447
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4448
- while (1) switch (_context39.prev = _context39.next) {
4560
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4561
+ while (1) switch (_context42.prev = _context42.next) {
4449
4562
  case 0:
4450
4563
  retries = 0;
4451
4564
  case 1:
4452
4565
  if (!(retries < 3)) {
4453
- _context39.next = 19;
4566
+ _context42.next = 19;
4454
4567
  break;
4455
4568
  }
4456
4569
  context = this.getAvailabilityContextEntry(contextId);
4457
4570
  currentOrderRevision = this.getCurrentOrderRevision();
4458
4571
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
4459
4572
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
4460
- _context39.next = 7;
4573
+ _context42.next = 7;
4461
4574
  break;
4462
4575
  }
4463
- return _context39.abrupt("return", {
4576
+ return _context42.abrupt("return", {
4464
4577
  context: context,
4465
4578
  projectionEntry: projectionEntry,
4466
4579
  refreshed: false
4467
4580
  });
4468
4581
  case 7:
4469
- _context39.next = 9;
4582
+ _context42.next = 9;
4470
4583
  return this.refreshAvailabilityContextProjection({
4471
4584
  contextId: contextId,
4472
4585
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
4473
4586
  previousOrderRevision: context.lastKnownOrderRevision
4474
4587
  });
4475
4588
  case 9:
4476
- refreshedProjectionEntry = _context39.sent;
4589
+ refreshedProjectionEntry = _context42.sent;
4477
4590
  if (refreshedProjectionEntry) {
4478
- _context39.next = 13;
4591
+ _context42.next = 13;
4479
4592
  break;
4480
4593
  }
4481
4594
  retries += 1;
4482
- return _context39.abrupt("continue", 1);
4595
+ return _context42.abrupt("continue", 1);
4483
4596
  case 13:
4484
4597
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4485
- _context39.next = 16;
4598
+ _context42.next = 16;
4486
4599
  break;
4487
4600
  }
4488
4601
  retries += 1;
4489
- return _context39.abrupt("continue", 1);
4602
+ return _context42.abrupt("continue", 1);
4490
4603
  case 16:
4491
- return _context39.abrupt("return", {
4604
+ return _context42.abrupt("return", {
4492
4605
  context: this.getAvailabilityContextEntry(contextId),
4493
4606
  projectionEntry: refreshedProjectionEntry,
4494
4607
  refreshed: true
@@ -4500,11 +4613,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4500
4613
  });
4501
4614
  case 20:
4502
4615
  case "end":
4503
- return _context39.stop();
4616
+ return _context42.stop();
4504
4617
  }
4505
- }, _callee39, this);
4618
+ }, _callee42, this);
4506
4619
  }));
4507
- function ensureAvailabilityContextProjection(_x27, _x28) {
4620
+ function ensureAvailabilityContextProjection(_x28, _x29) {
4508
4621
  return _ensureAvailabilityContextProjection.apply(this, arguments);
4509
4622
  }
4510
4623
  return ensureAvailabilityContextProjection;
@@ -4512,18 +4625,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4512
4625
  }, {
4513
4626
  key: "tryAcquireAvailabilityCommitLock",
4514
4627
  value: function () {
4515
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
4628
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
4516
4629
  var _currentContext$activ;
4517
4630
  var _waitingContext$activ, waitingContext, currentContext;
4518
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4519
- while (1) switch (_context40.prev = _context40.next) {
4631
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4632
+ while (1) switch (_context43.prev = _context43.next) {
4520
4633
  case 0:
4521
4634
  if (!this.availabilityCommitLocks.has(contextId)) {
4522
- _context40.next = 5;
4635
+ _context43.next = 5;
4523
4636
  break;
4524
4637
  }
4525
4638
  waitingContext = this.availabilityContextRegistry.get(contextId);
4526
- _context40.next = 4;
4639
+ _context43.next = 4;
4527
4640
  return this.emitAvailabilityDiagnostic({
4528
4641
  action: 'commit_lock_wait',
4529
4642
  contextId: contextId,
@@ -4540,7 +4653,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4540
4653
  case 5:
4541
4654
  this.availabilityCommitLocks.add(contextId);
4542
4655
  currentContext = this.availabilityContextRegistry.get(contextId);
4543
- _context40.next = 9;
4656
+ _context43.next = 9;
4544
4657
  return this.emitAvailabilityDiagnostic({
4545
4658
  action: 'commit_lock_acquired',
4546
4659
  contextId: contextId,
@@ -4552,11 +4665,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4552
4665
  });
4553
4666
  case 9:
4554
4667
  case "end":
4555
- return _context40.stop();
4668
+ return _context43.stop();
4556
4669
  }
4557
- }, _callee40, this);
4670
+ }, _callee43, this);
4558
4671
  }));
4559
- function tryAcquireAvailabilityCommitLock(_x29) {
4672
+ function tryAcquireAvailabilityCommitLock(_x30) {
4560
4673
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
4561
4674
  }
4562
4675
  return tryAcquireAvailabilityCommitLock;
@@ -4564,15 +4677,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4564
4677
  }, {
4565
4678
  key: "releaseAvailabilityCommitLock",
4566
4679
  value: function () {
4567
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(contextId) {
4680
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId) {
4568
4681
  var _releasedContext$acti;
4569
4682
  var releasedContext;
4570
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4571
- while (1) switch (_context41.prev = _context41.next) {
4683
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4684
+ while (1) switch (_context44.prev = _context44.next) {
4572
4685
  case 0:
4573
4686
  this.availabilityCommitLocks.delete(contextId);
4574
4687
  releasedContext = this.availabilityContextRegistry.get(contextId);
4575
- _context41.next = 4;
4688
+ _context44.next = 4;
4576
4689
  return this.emitAvailabilityDiagnostic({
4577
4690
  action: 'commit_lock_released',
4578
4691
  contextId: contextId,
@@ -4584,11 +4697,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4584
4697
  });
4585
4698
  case 4:
4586
4699
  case "end":
4587
- return _context41.stop();
4700
+ return _context44.stop();
4588
4701
  }
4589
- }, _callee41, this);
4702
+ }, _callee44, this);
4590
4703
  }));
4591
- function releaseAvailabilityCommitLock(_x30) {
4704
+ function releaseAvailabilityCommitLock(_x31) {
4592
4705
  return _releaseAvailabilityCommitLock.apply(this, arguments);
4593
4706
  }
4594
4707
  return releaseAvailabilityCommitLock;
@@ -4596,20 +4709,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4596
4709
  }, {
4597
4710
  key: "prepareAvailabilityProjection",
4598
4711
  value: (function () {
4599
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4712
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4600
4713
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
4601
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4602
- while (1) switch (_context42.prev = _context42.next) {
4714
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4715
+ while (1) switch (_context45.prev = _context45.next) {
4603
4716
  case 0:
4604
4717
  this.assertAvailabilityPrepareParams(params);
4605
- _context42.next = 3;
4718
+ _context45.next = 3;
4606
4719
  return this.resolveAvailabilityPrepareDefaults(params);
4607
4720
  case 3:
4608
- paramsWithDefaults = _context42.sent;
4609
- _context42.next = 6;
4721
+ paramsWithDefaults = _context45.sent;
4722
+ _context45.next = 6;
4610
4723
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
4611
4724
  case 6:
4612
- _yield$this$getShared = _context42.sent;
4725
+ _yield$this$getShared = _context45.sent;
4613
4726
  prepareKey = _yield$this$getShared.prepareKey;
4614
4727
  snapshot = _yield$this$getShared.snapshot;
4615
4728
  contextId = this.createAvailabilityContextId();
@@ -4630,7 +4743,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4630
4743
  refreshed: false,
4631
4744
  reason: 'prepare'
4632
4745
  };
4633
- _context42.next = 16;
4746
+ _context45.next = 16;
4634
4747
  return this.emitAvailabilityDiagnostic({
4635
4748
  action: 'prepare',
4636
4749
  contextId: contextId,
@@ -4641,17 +4754,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4641
4754
  reason: 'prepare'
4642
4755
  });
4643
4756
  case 16:
4644
- _context42.next = 18;
4757
+ _context45.next = 18;
4645
4758
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
4646
4759
  case 18:
4647
- return _context42.abrupt("return", handle);
4760
+ return _context45.abrupt("return", handle);
4648
4761
  case 19:
4649
4762
  case "end":
4650
- return _context42.stop();
4763
+ return _context45.stop();
4651
4764
  }
4652
- }, _callee42, this);
4765
+ }, _callee45, this);
4653
4766
  }));
4654
- function prepareAvailabilityProjection(_x31) {
4767
+ function prepareAvailabilityProjection(_x32) {
4655
4768
  return _prepareAvailabilityProjection.apply(this, arguments);
4656
4769
  }
4657
4770
  return prepareAvailabilityProjection;
@@ -4659,10 +4772,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4659
4772
  }, {
4660
4773
  key: "getProductTimeRanges",
4661
4774
  value: (function () {
4662
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
4775
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
4663
4776
  var _this$otherParams$pla2,
4664
- _this$otherParams28,
4665
- _this10 = this;
4777
+ _this$otherParams22,
4778
+ _this11 = this;
4666
4779
  var request,
4667
4780
  _yield$this$ensureAva,
4668
4781
  context,
@@ -4670,23 +4783,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4670
4783
  contextVersion,
4671
4784
  isPosAvailabilityRequest,
4672
4785
  allowOutsideOperatingHoursForRequestedStartTimes,
4673
- _args43 = arguments;
4674
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4675
- while (1) switch (_context43.prev = _context43.next) {
4786
+ _args46 = arguments;
4787
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4788
+ while (1) switch (_context46.prev = _context46.next) {
4676
4789
  case 0:
4677
- request = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {};
4678
- _context43.next = 3;
4790
+ request = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
4791
+ _context46.next = 3;
4679
4792
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
4680
4793
  case 3:
4681
- _yield$this$ensureAva = _context43.sent;
4794
+ _yield$this$ensureAva = _context46.sent;
4682
4795
  context = _yield$this$ensureAva.context;
4683
4796
  projectionEntry = _yield$this$ensureAva.projectionEntry;
4684
4797
  contextVersion = context.activeVersion;
4685
- isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4798
+ isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4686
4799
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
4687
4800
  return Array.isArray(startTimes) && startTimes.length > 0;
4688
4801
  });
4689
- return _context43.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4802
+ return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4690
4803
  allowOutsideOperatingHoursForRequestedStartTimes: true
4691
4804
  } : {}), {
4692
4805
  evaluatedAt: this.getAvailabilityRuntimeDateTime(),
@@ -4696,17 +4809,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4696
4809
  }).map(function (group) {
4697
4810
  return _objectSpread(_objectSpread({}, group), {}, {
4698
4811
  ranges: group.ranges.map(function (candidate) {
4699
- return _this10.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
4812
+ return _this11.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
4700
4813
  })
4701
4814
  });
4702
4815
  }));
4703
4816
  case 10:
4704
4817
  case "end":
4705
- return _context43.stop();
4818
+ return _context46.stop();
4706
4819
  }
4707
- }, _callee43, this);
4820
+ }, _callee46, this);
4708
4821
  }));
4709
- function getProductTimeRanges(_x32) {
4822
+ function getProductTimeRanges(_x33) {
4710
4823
  return _getProductTimeRanges.apply(this, arguments);
4711
4824
  }
4712
4825
  return getProductTimeRanges;
@@ -4714,21 +4827,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4714
4827
  }, {
4715
4828
  key: "queryBookingAvailability",
4716
4829
  value: (function () {
4717
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, request) {
4718
- var _this$otherParams$pla3, _this$otherParams29;
4830
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
4831
+ var _this$otherParams$pla3, _this$otherParams23;
4719
4832
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
4720
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4721
- while (1) switch (_context44.prev = _context44.next) {
4833
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4834
+ while (1) switch (_context47.prev = _context47.next) {
4722
4835
  case 0:
4723
- _context44.next = 2;
4836
+ _context47.next = 2;
4724
4837
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
4725
4838
  case 2:
4726
- _yield$this$ensureAva2 = _context44.sent;
4839
+ _yield$this$ensureAva2 = _context47.sent;
4727
4840
  context = _yield$this$ensureAva2.context;
4728
4841
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
4729
4842
  refreshed = _yield$this$ensureAva2.refreshed;
4730
4843
  this.assertContextualQueryFreshness(context, request);
4731
- isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
4844
+ isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
4732
4845
  result = queryAvailabilityProjection(projectionEntry.projection, request, {
4733
4846
  useExactDurationCandidateMinute: isPosAvailabilityRequest,
4734
4847
  allowExcludedScheduleDateOverride: isPosAvailabilityRequest
@@ -4759,18 +4872,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4759
4872
  });
4760
4873
  })
4761
4874
  }) : result;
4762
- return _context44.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4875
+ return _context47.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4763
4876
  contextId: context.contextId,
4764
4877
  contextVersion: contextVersion,
4765
4878
  refreshed: refreshed
4766
4879
  }));
4767
4880
  case 12:
4768
4881
  case "end":
4769
- return _context44.stop();
4882
+ return _context47.stop();
4770
4883
  }
4771
- }, _callee44, this);
4884
+ }, _callee47, this);
4772
4885
  }));
4773
- function queryBookingAvailability(_x33, _x34) {
4886
+ function queryBookingAvailability(_x34, _x35) {
4774
4887
  return _queryBookingAvailability.apply(this, arguments);
4775
4888
  }
4776
4889
  return queryBookingAvailability;
@@ -4827,9 +4940,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4827
4940
  }, {
4828
4941
  key: "findLinkedBooking",
4829
4942
  value: function findLinkedBooking(product) {
4830
- var _ref51, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
4943
+ var _ref52, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
4831
4944
  var productUid = getProductLineUid(product);
4832
- var bookingUid = String((_ref51 = (_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 && _ref51 !== void 0 ? _ref51 : '');
4945
+ var bookingUid = String((_ref52 = (_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 && _ref52 !== void 0 ? _ref52 : '');
4833
4946
  return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
4834
4947
  var _booking$product_uid3;
4835
4948
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
@@ -4840,27 +4953,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4840
4953
  }, {
4841
4954
  key: "commitAvailabilitySelection",
4842
4955
  value: (function () {
4843
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(contextId, params) {
4844
- var normalizedContextId, _params$bookingCount, _ref52, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla4, _this$otherParams30, _ref53, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref54, _ref55, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref56, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4845
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4846
- while (1) switch (_context45.prev = _context45.next) {
4956
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
4957
+ var normalizedContextId, _params$bookingCount, _ref53, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla4, _this$otherParams24, _ref54, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref55, _ref56, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref57, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4958
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4959
+ while (1) switch (_context48.prev = _context48.next) {
4847
4960
  case 0:
4848
4961
  normalizedContextId = String(contextId || '').trim();
4849
4962
  if (normalizedContextId) {
4850
- _context45.next = 3;
4963
+ _context48.next = 3;
4851
4964
  break;
4852
4965
  }
4853
4966
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
4854
4967
  candidate: params.candidate
4855
4968
  });
4856
4969
  case 3:
4857
- _context45.next = 5;
4970
+ _context48.next = 5;
4858
4971
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
4859
4972
  case 5:
4860
- _context45.prev = 5;
4973
+ _context48.prev = 5;
4861
4974
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
4862
4975
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
4863
- _context45.next = 9;
4976
+ _context48.next = 9;
4864
4977
  break;
4865
4978
  }
4866
4979
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -4868,16 +4981,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4868
4981
  });
4869
4982
  case 9:
4870
4983
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
4871
- _context45.next = 11;
4984
+ _context48.next = 11;
4872
4985
  break;
4873
4986
  }
4874
4987
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
4875
4988
  bookingCount: bookingCount
4876
4989
  });
4877
4990
  case 11:
4878
- orderProductQuantity = (_ref52 = (_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 && _ref52 !== void 0 ? _ref52 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4991
+ orderProductQuantity = (_ref53 = (_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 && _ref53 !== void 0 ? _ref53 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4879
4992
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
4880
- _context45.next = 14;
4993
+ _context48.next = 14;
4881
4994
  break;
4882
4995
  }
4883
4996
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -4887,22 +5000,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4887
5000
  case 14:
4888
5001
  partySize = Number(params.partySize);
4889
5002
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
4890
- _context45.next = 17;
5003
+ _context48.next = 17;
4891
5004
  break;
4892
5005
  }
4893
5006
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
4894
5007
  partySize: params.partySize
4895
5008
  });
4896
5009
  case 17:
4897
- _context45.next = 19;
5010
+ _context48.next = 19;
4898
5011
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
4899
5012
  case 19:
4900
- _yield$this$ensureAva3 = _context45.sent;
5013
+ _yield$this$ensureAva3 = _context48.sent;
4901
5014
  context = _yield$this$ensureAva3.context;
4902
5015
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
4903
5016
  refreshed = _yield$this$ensureAva3.refreshed;
4904
5017
  if (!refreshed) {
4905
- _context45.next = 25;
5018
+ _context48.next = 25;
4906
5019
  break;
4907
5020
  }
4908
5021
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4913,11 +5026,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4913
5026
  case 25:
4914
5027
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
4915
5028
  if (!(params.mode === 'edit')) {
4916
- _context45.next = 31;
5029
+ _context48.next = 31;
4917
5030
  break;
4918
5031
  }
4919
5032
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
4920
- _context45.next = 29;
5033
+ _context48.next = 29;
4921
5034
  break;
4922
5035
  }
4923
5036
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -4926,11 +5039,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4926
5039
  editingProductLineUids: boundEditingUids
4927
5040
  });
4928
5041
  case 29:
4929
- _context45.next = 33;
5042
+ _context48.next = 33;
4930
5043
  break;
4931
5044
  case 31:
4932
5045
  if (!(boundEditingUids.length > 0)) {
4933
- _context45.next = 33;
5046
+ _context48.next = 33;
4934
5047
  break;
4935
5048
  }
4936
5049
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -4939,7 +5052,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4939
5052
  });
4940
5053
  case 33:
4941
5054
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
4942
- _context45.next = 35;
5055
+ _context48.next = 35;
4943
5056
  break;
4944
5057
  }
4945
5058
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4949,7 +5062,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4949
5062
  });
4950
5063
  case 35:
4951
5064
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4952
- _context45.next = 37;
5065
+ _context48.next = 37;
4953
5066
  break;
4954
5067
  }
4955
5068
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -4960,7 +5073,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4960
5073
  });
4961
5074
  case 37:
4962
5075
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
4963
- _context45.next = 39;
5076
+ _context48.next = 39;
4964
5077
  break;
4965
5078
  }
4966
5079
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -4972,7 +5085,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4972
5085
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
4973
5086
  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;
4974
5087
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
4975
- _context45.next = 43;
5088
+ _context48.next = 43;
4976
5089
  break;
4977
5090
  }
4978
5091
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -4981,14 +5094,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4981
5094
  });
4982
5095
  case 43:
4983
5096
  if (!(params.mode === 'edit' && !params.productLineUid)) {
4984
- _context45.next = 45;
5097
+ _context48.next = 45;
4985
5098
  break;
4986
5099
  }
4987
5100
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
4988
5101
  case 45:
4989
5102
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
4990
5103
  if (!(params.mode === 'edit' && !editingLine)) {
4991
- _context45.next = 48;
5104
+ _context48.next = 48;
4992
5105
  break;
4993
5106
  }
4994
5107
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -4996,7 +5109,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4996
5109
  });
4997
5110
  case 48:
4998
5111
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
4999
- _context45.next = 50;
5112
+ _context48.next = 50;
5000
5113
  break;
5001
5114
  }
5002
5115
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -5006,7 +5119,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5006
5119
  });
5007
5120
  case 50:
5008
5121
  if (Array.isArray(params.requirementSelections)) {
5009
- _context45.next = 52;
5122
+ _context48.next = 52;
5010
5123
  break;
5011
5124
  }
5012
5125
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -5023,7 +5136,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5023
5136
  };
5024
5137
  prepareParams = baseProjection.meta.prepareParams;
5025
5138
  if (prepareParams) {
5026
- _context45.next = 57;
5139
+ _context48.next = 57;
5027
5140
  break;
5028
5141
  }
5029
5142
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -5035,7 +5148,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5035
5148
  })),
5036
5149
  includesInjectedRawOccupancies: true
5037
5150
  };
5038
- _context45.next = 60;
5151
+ _context48.next = 60;
5039
5152
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
5040
5153
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
5041
5154
  }), {
@@ -5044,13 +5157,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5044
5157
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
5045
5158
  });
5046
5159
  case 60:
5047
- commitSnapshot = _context45.sent;
5160
+ commitSnapshot = _context48.sent;
5048
5161
  refreshedProjection = commitSnapshot.projection;
5049
5162
  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 : ''))) {
5050
- _context45.next = 67;
5163
+ _context48.next = 67;
5051
5164
  break;
5052
5165
  }
5053
- _context45.next = 65;
5166
+ _context48.next = 65;
5054
5167
  return this.refreshAvailabilityContextProjection({
5055
5168
  contextId: normalizedContextId,
5056
5169
  reason: 'commit_order_revision_changed',
@@ -5071,7 +5184,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5071
5184
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5072
5185
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
5073
5186
  candidateStartTime = getCandidateStartTime(params.candidate);
5074
- allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
5187
+ allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
5075
5188
  refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
5076
5189
  productIds: [params.candidate.productId],
5077
5190
  dateRange: {
@@ -5095,7 +5208,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5095
5208
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
5096
5209
  });
5097
5210
  if (refreshedCandidateBase) {
5098
- _context45.next = 75;
5211
+ _context48.next = 75;
5099
5212
  break;
5100
5213
  }
5101
5214
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -5108,7 +5221,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5108
5221
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
5109
5222
  });
5110
5223
  if (product) {
5111
- _context45.next = 78;
5224
+ _context48.next = 78;
5112
5225
  break;
5113
5226
  }
5114
5227
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -5145,7 +5258,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5145
5258
  });
5146
5259
  }
5147
5260
  if (validation.ok) {
5148
- _context45.next = 83;
5261
+ _context48.next = 83;
5149
5262
  break;
5150
5263
  }
5151
5264
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -5168,7 +5281,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5168
5281
  incrementVersion: true
5169
5282
  });
5170
5283
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
5171
- _context45.next = 87;
5284
+ _context48.next = 87;
5172
5285
  return this.emitAvailabilityDiagnostic({
5173
5286
  action: 'refresh',
5174
5287
  contextId: normalizedContextId,
@@ -5191,7 +5304,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5191
5304
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
5192
5305
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
5193
5306
  if (!(params.mode === 'edit' && !existingBookingUid)) {
5194
- _context45.next = 93;
5307
+ _context48.next = 93;
5195
5308
  break;
5196
5309
  }
5197
5310
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -5205,15 +5318,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5205
5318
  product: product,
5206
5319
  resources: refreshedProjection.resources,
5207
5320
  bookingUid: existingBookingUid || undefined,
5208
- holder: (_ref53 = (_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 && _ref53 !== void 0 ? _ref53 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
5209
- holderIds: (_ref54 = (_ref55 = (_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 && _ref55 !== void 0 ? _ref55 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5321
+ holder: (_ref54 = (_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 && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
5322
+ holderIds: (_ref55 = (_ref56 = (_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 && _ref56 !== void 0 ? _ref56 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref55 !== void 0 ? _ref55 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5210
5323
  });
5211
5324
  transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
5212
5325
  num: bookingCount,
5213
5326
  quantity: bookingCount
5214
5327
  }), 'unified_booking_sales', product);
5215
5328
  if (transformed) {
5216
- _context45.next = 98;
5329
+ _context48.next = 98;
5217
5330
  break;
5218
5331
  }
5219
5332
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -5232,7 +5345,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5232
5345
  productLineUids = [];
5233
5346
  bookingUids = [];
5234
5347
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
5235
- _context45.next = 117;
5348
+ _context48.next = 117;
5236
5349
  break;
5237
5350
  }
5238
5351
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -5242,10 +5355,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5242
5355
  unique_identification_number: params.productLineUid,
5243
5356
  booking_uid: existingBookingUid
5244
5357
  });
5245
- _context45.next = 111;
5358
+ _context48.next = 111;
5246
5359
  return this.updateOrderProduct(_objectSpread(_objectSpread({
5247
5360
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
5248
- product_variant_id: (_ref56 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref56 !== void 0 ? _ref56 : 0,
5361
+ product_variant_id: (_ref57 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref57 !== void 0 ? _ref57 : 0,
5249
5362
  unique_identification_number: params.productLineUid,
5250
5363
  updates: transformed,
5251
5364
  booking: booking
@@ -5259,7 +5372,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5259
5372
  bookingUid = existingBookingUid;
5260
5373
  productLineUids = [productLineUid];
5261
5374
  bookingUids = [bookingUid];
5262
- _context45.next = 129;
5375
+ _context48.next = 129;
5263
5376
  break;
5264
5377
  case 117:
5265
5378
  beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
@@ -5268,12 +5381,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5268
5381
  beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
5269
5382
  return getBookingUid(item);
5270
5383
  }).filter(Boolean));
5271
- _context45.next = 121;
5384
+ _context48.next = 121;
5272
5385
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
5273
5386
  salesNotes: params.salesNotes
5274
5387
  } : undefined);
5275
5388
  case 121:
5276
- products = _context45.sent;
5389
+ products = _context48.sent;
5277
5390
  addedLines = products.filter(function (line) {
5278
5391
  var _line$product_id, _line$metadata;
5279
5392
  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));
@@ -5290,8 +5403,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5290
5403
  }).filter(Boolean);
5291
5404
  if (bookingUids.length === 0) {
5292
5405
  bookingUids = addedLines.map(function (line) {
5293
- var _ref57, _line$booking_uid, _line$metadata2;
5294
- return String((_ref57 = (_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 && _ref57 !== void 0 ? _ref57 : '');
5406
+ var _ref58, _line$booking_uid, _line$metadata2;
5407
+ return String((_ref58 = (_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 && _ref58 !== void 0 ? _ref58 : '');
5295
5408
  }).filter(Boolean);
5296
5409
  }
5297
5410
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -5310,23 +5423,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5310
5423
  productLineUids: productLineUids,
5311
5424
  bookingUids: bookingUids
5312
5425
  };
5313
- _context45.next = 134;
5426
+ _context48.next = 134;
5314
5427
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
5315
5428
  case 134:
5316
- return _context45.abrupt("return", result);
5429
+ return _context48.abrupt("return", result);
5317
5430
  case 135:
5318
- _context45.prev = 135;
5319
- _context45.next = 138;
5431
+ _context48.prev = 135;
5432
+ _context48.next = 138;
5320
5433
  return this.releaseAvailabilityCommitLock(normalizedContextId);
5321
5434
  case 138:
5322
- return _context45.finish(135);
5435
+ return _context48.finish(135);
5323
5436
  case 139:
5324
5437
  case "end":
5325
- return _context45.stop();
5438
+ return _context48.stop();
5326
5439
  }
5327
- }, _callee45, this, [[5,, 135, 139]]);
5440
+ }, _callee48, this, [[5,, 135, 139]]);
5328
5441
  }));
5329
- function commitAvailabilitySelection(_x35, _x36) {
5442
+ function commitAvailabilitySelection(_x36, _x37) {
5330
5443
  return _commitAvailabilitySelection.apply(this, arguments);
5331
5444
  }
5332
5445
  return commitAvailabilitySelection;