@pisell/pisellos 2.3.161 → 2.3.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/dist/solution/UnifiedBookingSales/index.js +867 -737
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/lib/solution/UnifiedBookingSales/index.js +85 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["date", "custom_page_id", "channel", "product_ids"];
|
|
2
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -37,8 +37,8 @@ import dayjs from 'dayjs';
|
|
|
37
37
|
import { cloneDeep } from 'lodash-es';
|
|
38
38
|
import { OpenDataModule } from "../../modules";
|
|
39
39
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
40
|
-
import { isProductFlexibleDuration } from "../../modules/BookingContext/utils";
|
|
41
40
|
import { cacheItemToBookingInput } from "../../modules/BookingContext/utils/cacheItemToBookingInput";
|
|
41
|
+
import { flexibleObj, getServiceTimes, getUsableTime, isProductFlexibleDuration, isSessionProduct } from "../../modules/BookingContext/utils";
|
|
42
42
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
|
|
43
43
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
44
44
|
import { AvailabilityError, createAvailabilityProjection, getDurationBusinessDate, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
@@ -1587,22 +1587,152 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1587
1587
|
mode: mode
|
|
1588
1588
|
}));
|
|
1589
1589
|
}
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* 列表直加没有经过 SKU availability flow,legacy cacheItem 的灵活时长可能落到
|
|
1593
|
+
* 23:59。提交前用同一套营业排期补齐结束时间,保留已选开始时间、资源和 Holder。
|
|
1594
|
+
* 仅供直加调用;手动时间选择和 availability candidate 不经过此方法。
|
|
1595
|
+
*/
|
|
1596
|
+
}, {
|
|
1597
|
+
key: "prepareDirectAddFlexibleBooking",
|
|
1598
|
+
value: (function () {
|
|
1599
|
+
var _prepareDirectAddFlexibleBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cacheItem) {
|
|
1600
|
+
var _prepare$_availabilit, _merged$, _getUsableTime;
|
|
1601
|
+
var extend, _getServiceTimes, startDate, date, dateRange, prepare, operatingHours, start, nextDay, windows, merged, _iterator, _step, window, previous, end, resourceEndAt, resourceEnd, duration, endDate;
|
|
1602
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1603
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1604
|
+
case 0:
|
|
1605
|
+
if (!(!isProductFlexibleDuration(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.duration) || isSessionProduct(cacheItem))) {
|
|
1606
|
+
_context2.next = 2;
|
|
1607
|
+
break;
|
|
1608
|
+
}
|
|
1609
|
+
return _context2.abrupt("return", cacheItem);
|
|
1610
|
+
case 2:
|
|
1611
|
+
extend = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend;
|
|
1612
|
+
_getServiceTimes = getServiceTimes(cacheItem), startDate = _getServiceTimes.startDate;
|
|
1613
|
+
if (!(!(extend !== null && extend !== void 0 && extend.start_date) || !(extend !== null && extend !== void 0 && extend.start_time) || !startDate.isValid())) {
|
|
1614
|
+
_context2.next = 6;
|
|
1615
|
+
break;
|
|
1616
|
+
}
|
|
1617
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '灵活时长商品缺少有效开始时间');
|
|
1618
|
+
case 6:
|
|
1619
|
+
date = startDate.format('YYYY-MM-DD'); // 带上前一天,覆盖凌晨仍处在前一营业时段内的情况。
|
|
1620
|
+
dateRange = {
|
|
1621
|
+
startDate: startDate.subtract(1, 'day').format('YYYY-MM-DD'),
|
|
1622
|
+
endDate: date
|
|
1623
|
+
};
|
|
1624
|
+
_context2.next = 10;
|
|
1625
|
+
return this.resolveAvailabilityPrepareDefaults({
|
|
1626
|
+
dateRange: dateRange
|
|
1627
|
+
});
|
|
1628
|
+
case 10:
|
|
1629
|
+
prepare = _context2.sent;
|
|
1630
|
+
if (!(((_prepare$_availabilit = prepare._availabilityOperatingHours) === null || _prepare$_availabilit === void 0 ? void 0 : _prepare$_availabilit.source) !== 'open_data_schedule')) {
|
|
1631
|
+
_context2.next = 13;
|
|
1632
|
+
break;
|
|
1633
|
+
}
|
|
1634
|
+
return _context2.abrupt("return", cacheItem);
|
|
1635
|
+
case 13:
|
|
1636
|
+
operatingHours = this.buildAvailabilityOperatingHoursSnapshot({
|
|
1637
|
+
prepare: prepare,
|
|
1638
|
+
dateRange: dateRange,
|
|
1639
|
+
scheduleList: this.getAvailabilityScheduleCatalog(),
|
|
1640
|
+
businessHours: DEFAULT_AVAILABILITY_BUSINESS_HOURS
|
|
1641
|
+
});
|
|
1642
|
+
if (!(operatingHours.missingScheduleIds.length > 0)) {
|
|
1643
|
+
_context2.next = 16;
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
throw new AvailabilityError('OPERATING_HOURS_RESOLVE_FAILED', '店铺营业时间排期缺失,请重试', {
|
|
1647
|
+
missingScheduleIds: operatingHours.missingScheduleIds
|
|
1648
|
+
});
|
|
1649
|
+
case 16:
|
|
1650
|
+
start = localDateTimeToScalar(parseLocalDateTime(startDate.format('YYYY-MM-DDTHH:mm:00')));
|
|
1651
|
+
nextDay = localDateTimeToScalar(parseLocalDateTime("".concat(startDate.add(1, 'day').format('YYYY-MM-DD'), "T00:00:00")));
|
|
1652
|
+
windows = operatingHours.windows.map(function (window) {
|
|
1653
|
+
return {
|
|
1654
|
+
start: localDateTimeToScalar(parseLocalDateTime(window.startAt)),
|
|
1655
|
+
end: localDateTimeToScalar(parseLocalDateTime(window.endAt))
|
|
1656
|
+
};
|
|
1657
|
+
}).filter(function (window) {
|
|
1658
|
+
return window.end > start && window.start < nextDay;
|
|
1659
|
+
}).sort(function (left, right) {
|
|
1660
|
+
return left.start - right.start;
|
|
1661
|
+
});
|
|
1662
|
+
merged = [];
|
|
1663
|
+
_iterator = _createForOfIteratorHelper(windows);
|
|
1664
|
+
try {
|
|
1665
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1666
|
+
window = _step.value;
|
|
1667
|
+
previous = merged[merged.length - 1];
|
|
1668
|
+
if (previous && window.start <= previous.end) {
|
|
1669
|
+
previous.end = Math.max(previous.end, window.end);
|
|
1670
|
+
} else {
|
|
1671
|
+
merged.push(_objectSpread({}, window));
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
// POS 可以提前售票;保留开始分钟,结束取当前或当天下一段营业时间。
|
|
1675
|
+
// 不跨越午休,也不把闭店后的直加顺延到次日。
|
|
1676
|
+
} catch (err) {
|
|
1677
|
+
_iterator.e(err);
|
|
1678
|
+
} finally {
|
|
1679
|
+
_iterator.f();
|
|
1680
|
+
}
|
|
1681
|
+
end = (_merged$ = merged[0]) === null || _merged$ === void 0 ? void 0 : _merged$.end;
|
|
1682
|
+
resourceEndAt = (_getUsableTime = getUsableTime(cacheItem)) === null || _getUsableTime === void 0 || (_getUsableTime = _getUsableTime._extend) === null || _getUsableTime === void 0 || (_getUsableTime = _getUsableTime.usableTime) === null || _getUsableTime === void 0 ? void 0 : _getUsableTime.end_at;
|
|
1683
|
+
if (resourceEndAt) {
|
|
1684
|
+
resourceEnd = localDateTimeToScalar(parseLocalDateTime(dayjs(resourceEndAt).format('YYYY-MM-DDTHH:mm:00')));
|
|
1685
|
+
if (end !== undefined) end = Math.min(end, resourceEnd);
|
|
1686
|
+
}
|
|
1687
|
+
if (!(end === undefined || end <= start)) {
|
|
1688
|
+
_context2.next = 27;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
throw new AvailabilityError('REVALIDATION_FAILED', '当前时间没有可用营业时段,请选择预约时间');
|
|
1692
|
+
case 27:
|
|
1693
|
+
duration = Math.floor((end - start) / 60000);
|
|
1694
|
+
if (!(duration <= 0)) {
|
|
1695
|
+
_context2.next = 30;
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
throw new AvailabilityError('REVALIDATION_FAILED', '灵活时长商品的结束时间必须晚于开始时间');
|
|
1699
|
+
case 30:
|
|
1700
|
+
endDate = dayjs(formatLocalDateTime(start + duration * 60000));
|
|
1701
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
1702
|
+
_extend: _objectSpread(_objectSpread({}, extend), {}, {
|
|
1703
|
+
duration: flexibleObj.create(duration),
|
|
1704
|
+
endDate: endDate,
|
|
1705
|
+
end_date: endDate.format('YYYY-MM-DD'),
|
|
1706
|
+
end_time: endDate.format('HH:mm')
|
|
1707
|
+
})
|
|
1708
|
+
}));
|
|
1709
|
+
case 32:
|
|
1710
|
+
case "end":
|
|
1711
|
+
return _context2.stop();
|
|
1712
|
+
}
|
|
1713
|
+
}, _callee2, this);
|
|
1714
|
+
}));
|
|
1715
|
+
function prepareDirectAddFlexibleBooking(_x2) {
|
|
1716
|
+
return _prepareDirectAddFlexibleBooking.apply(this, arguments);
|
|
1717
|
+
}
|
|
1718
|
+
return prepareDirectAddFlexibleBooking;
|
|
1719
|
+
}())
|
|
1590
1720
|
}, {
|
|
1591
1721
|
key: "resolveAvailabilityPrepareDefaults",
|
|
1592
1722
|
value: function () {
|
|
1593
|
-
var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1723
|
+
var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1594
1724
|
var _ref30, _this$otherParams$bus, _this$otherParams6, _this$otherParams7, _this$otherParams$cha2, _this$otherParams8, _this$otherParams9, _openData, _openData2, _openData3;
|
|
1595
1725
|
var needsOperatingHours, needsTimeSlice, businessCode, channel, currentTarget, openData, operatingScheduleIds, configuredTimeSlice;
|
|
1596
|
-
return _regeneratorRuntime().wrap(function
|
|
1597
|
-
while (1) switch (
|
|
1726
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1727
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1598
1728
|
case 0:
|
|
1599
1729
|
needsOperatingHours = params.businessHours === undefined;
|
|
1600
1730
|
needsTimeSlice = params.slotStepMinutes === undefined;
|
|
1601
1731
|
if (!(!needsOperatingHours && !needsTimeSlice)) {
|
|
1602
|
-
|
|
1732
|
+
_context3.next = 4;
|
|
1603
1733
|
break;
|
|
1604
1734
|
}
|
|
1605
|
-
return
|
|
1735
|
+
return _context3.abrupt("return", _objectSpread(_objectSpread({}, params), {}, {
|
|
1606
1736
|
_availabilityOperatingHours: {
|
|
1607
1737
|
source: 'prepare_business_hours',
|
|
1608
1738
|
scheduleIds: []
|
|
@@ -1614,34 +1744,34 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1614
1744
|
currentTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : null;
|
|
1615
1745
|
openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.openData : null;
|
|
1616
1746
|
if (!(!openData && this.store.openData)) {
|
|
1617
|
-
|
|
1747
|
+
_context3.next = 20;
|
|
1618
1748
|
break;
|
|
1619
1749
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1750
|
+
_context3.prev = 9;
|
|
1751
|
+
_context3.next = 12;
|
|
1622
1752
|
return this.getOpenData();
|
|
1623
1753
|
case 12:
|
|
1624
|
-
openData =
|
|
1625
|
-
|
|
1754
|
+
openData = _context3.sent;
|
|
1755
|
+
_context3.next = 20;
|
|
1626
1756
|
break;
|
|
1627
1757
|
case 15:
|
|
1628
|
-
|
|
1629
|
-
|
|
1758
|
+
_context3.prev = 15;
|
|
1759
|
+
_context3.t0 = _context3["catch"](9);
|
|
1630
1760
|
if (!needsOperatingHours) {
|
|
1631
|
-
|
|
1761
|
+
_context3.next = 19;
|
|
1632
1762
|
break;
|
|
1633
1763
|
}
|
|
1634
1764
|
throw this.createAvailabilityFacadeError('OPERATING_HOURS_RESOLVE_FAILED', '无法读取店铺营业时间配置,请重试', {
|
|
1635
1765
|
businessCode: businessCode,
|
|
1636
1766
|
channel: channel,
|
|
1637
|
-
cause:
|
|
1767
|
+
cause: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
1638
1768
|
});
|
|
1639
1769
|
case 19:
|
|
1640
|
-
console.warn('[UnifiedBookingSales] OpenData 时间切片配置加载失败,回退为默认值',
|
|
1770
|
+
console.warn('[UnifiedBookingSales] OpenData 时间切片配置加载失败,回退为默认值', _context3.t0);
|
|
1641
1771
|
case 20:
|
|
1642
1772
|
operatingScheduleIds = this.normalizeAvailabilityIdList(Array.isArray((_openData = openData) === null || _openData === void 0 ? void 0 : _openData['availability.operating_hours']) ? (_openData2 = openData) === null || _openData2 === void 0 ? void 0 : _openData2['availability.operating_hours'] : undefined) || [];
|
|
1643
1773
|
configuredTimeSlice = needsTimeSlice ? normalizePositiveInteger((_openData3 = openData) === null || _openData3 === void 0 ? void 0 : _openData3['reservation.time_slice']) : undefined;
|
|
1644
|
-
return
|
|
1774
|
+
return _context3.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, params), configuredTimeSlice ? {
|
|
1645
1775
|
slotStepMinutes: configuredTimeSlice
|
|
1646
1776
|
} : {}), {}, {
|
|
1647
1777
|
_availabilityOperatingHours: needsOperatingHours ? {
|
|
@@ -1654,11 +1784,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1654
1784
|
}));
|
|
1655
1785
|
case 23:
|
|
1656
1786
|
case "end":
|
|
1657
|
-
return
|
|
1787
|
+
return _context3.stop();
|
|
1658
1788
|
}
|
|
1659
|
-
},
|
|
1789
|
+
}, _callee3, this, [[9, 15]]);
|
|
1660
1790
|
}));
|
|
1661
|
-
function resolveAvailabilityPrepareDefaults(
|
|
1791
|
+
function resolveAvailabilityPrepareDefaults(_x3) {
|
|
1662
1792
|
return _resolveAvailabilityPrepareDefaults.apply(this, arguments);
|
|
1663
1793
|
}
|
|
1664
1794
|
return resolveAvailabilityPrepareDefaults;
|
|
@@ -1701,7 +1831,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1701
1831
|
}, {
|
|
1702
1832
|
key: "setOtherParams",
|
|
1703
1833
|
value: function () {
|
|
1704
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1834
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
1705
1835
|
var _this$otherParams10, _this$otherParams12;
|
|
1706
1836
|
var _ref31,
|
|
1707
1837
|
_ref31$cover,
|
|
@@ -1713,11 +1843,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1713
1843
|
nextScope,
|
|
1714
1844
|
_this$otherParams11,
|
|
1715
1845
|
shouldResetAvailabilityState,
|
|
1716
|
-
|
|
1717
|
-
return _regeneratorRuntime().wrap(function
|
|
1718
|
-
while (1) switch (
|
|
1846
|
+
_args4 = arguments;
|
|
1847
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1848
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1719
1849
|
case 0:
|
|
1720
|
-
_ref31 =
|
|
1850
|
+
_ref31 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
|
|
1721
1851
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1722
1852
|
previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
|
|
1723
1853
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
@@ -1725,7 +1855,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1725
1855
|
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
1726
1856
|
this.clearOpenDataCache();
|
|
1727
1857
|
}
|
|
1728
|
-
|
|
1858
|
+
_context4.next = 8;
|
|
1729
1859
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1730
1860
|
cover: cover
|
|
1731
1861
|
});
|
|
@@ -1736,10 +1866,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1736
1866
|
}
|
|
1737
1867
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1738
1868
|
if (!shouldResetAvailabilityState) {
|
|
1739
|
-
|
|
1869
|
+
_context4.next = 14;
|
|
1740
1870
|
break;
|
|
1741
1871
|
}
|
|
1742
|
-
|
|
1872
|
+
_context4.next = 14;
|
|
1743
1873
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1744
1874
|
case 14:
|
|
1745
1875
|
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.itemRule)) {
|
|
@@ -1747,11 +1877,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1747
1877
|
}
|
|
1748
1878
|
case 15:
|
|
1749
1879
|
case "end":
|
|
1750
|
-
return
|
|
1880
|
+
return _context4.stop();
|
|
1751
1881
|
}
|
|
1752
|
-
},
|
|
1882
|
+
}, _callee4, this);
|
|
1753
1883
|
}));
|
|
1754
|
-
function setOtherParams(
|
|
1884
|
+
function setOtherParams(_x4) {
|
|
1755
1885
|
return _setOtherParams.apply(this, arguments);
|
|
1756
1886
|
}
|
|
1757
1887
|
return setOtherParams;
|
|
@@ -1759,25 +1889,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1759
1889
|
}, {
|
|
1760
1890
|
key: "destroy",
|
|
1761
1891
|
value: function () {
|
|
1762
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1763
|
-
return _regeneratorRuntime().wrap(function
|
|
1764
|
-
while (1) switch (
|
|
1892
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
1893
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1894
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1765
1895
|
case 0:
|
|
1766
1896
|
this.runtimeOpenDataDestroyed = true;
|
|
1767
1897
|
this.clearOpenDataCache();
|
|
1768
1898
|
this.availabilityScheduleCatalog = null;
|
|
1769
1899
|
this.availabilityRuntimeOffsetMinutes = null;
|
|
1770
|
-
|
|
1900
|
+
_context5.next = 6;
|
|
1771
1901
|
return this.resetAvailabilityProjectionState('destroy');
|
|
1772
1902
|
case 6:
|
|
1773
1903
|
this.resetAllergyItemRuleState();
|
|
1774
|
-
|
|
1904
|
+
_context5.next = 9;
|
|
1775
1905
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
|
|
1776
1906
|
case 9:
|
|
1777
1907
|
case "end":
|
|
1778
|
-
return
|
|
1908
|
+
return _context5.stop();
|
|
1779
1909
|
}
|
|
1780
|
-
},
|
|
1910
|
+
}, _callee5, this);
|
|
1781
1911
|
}));
|
|
1782
1912
|
function destroy() {
|
|
1783
1913
|
return _destroy.apply(this, arguments);
|
|
@@ -1855,23 +1985,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1855
1985
|
}, {
|
|
1856
1986
|
key: "emitAvailabilityDiagnostic",
|
|
1857
1987
|
value: function () {
|
|
1858
|
-
var _emitAvailabilityDiagnostic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1988
|
+
var _emitAvailabilityDiagnostic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(payload) {
|
|
1859
1989
|
var _this$core, _this$core$emit;
|
|
1860
|
-
return _regeneratorRuntime().wrap(function
|
|
1861
|
-
while (1) switch (
|
|
1990
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1991
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1862
1992
|
case 0:
|
|
1863
|
-
|
|
1993
|
+
_context6.next = 2;
|
|
1864
1994
|
return (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.effects) === null || _this$core === void 0 || (_this$core$emit = _this$core.emit) === null || _this$core$emit === void 0 ? void 0 : _this$core$emit.call(_this$core, "".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionDiagnostic), _objectSpread(_objectSpread({}, payload), {}, {
|
|
1865
1995
|
registrySize: this.availabilityContextRegistry.size,
|
|
1866
1996
|
projectionPoolSize: this.availabilityProjectionPool.size
|
|
1867
1997
|
}));
|
|
1868
1998
|
case 2:
|
|
1869
1999
|
case "end":
|
|
1870
|
-
return
|
|
2000
|
+
return _context6.stop();
|
|
1871
2001
|
}
|
|
1872
|
-
},
|
|
2002
|
+
}, _callee6, this);
|
|
1873
2003
|
}));
|
|
1874
|
-
function emitAvailabilityDiagnostic(
|
|
2004
|
+
function emitAvailabilityDiagnostic(_x5) {
|
|
1875
2005
|
return _emitAvailabilityDiagnostic.apply(this, arguments);
|
|
1876
2006
|
}
|
|
1877
2007
|
return emitAvailabilityDiagnostic;
|
|
@@ -1952,9 +2082,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1952
2082
|
}, {
|
|
1953
2083
|
key: "resetAvailabilityProjectionState",
|
|
1954
2084
|
value: function () {
|
|
1955
|
-
var _resetAvailabilityProjectionState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1956
|
-
return _regeneratorRuntime().wrap(function
|
|
1957
|
-
while (1) switch (
|
|
2085
|
+
var _resetAvailabilityProjectionState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(action) {
|
|
2086
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2087
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1958
2088
|
case 0:
|
|
1959
2089
|
this.availabilityLifecycleGeneration += 1;
|
|
1960
2090
|
this.availabilityContextRegistry.clear();
|
|
@@ -1963,7 +2093,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1963
2093
|
this.availabilityProjectionRefreshInFlight.clear();
|
|
1964
2094
|
this.availabilityCommitLocks.clear();
|
|
1965
2095
|
this.clearAvailabilityRemoteResourceState();
|
|
1966
|
-
|
|
2096
|
+
_context7.next = 9;
|
|
1967
2097
|
return this.emitAvailabilityDiagnostic({
|
|
1968
2098
|
action: action,
|
|
1969
2099
|
contextId: null,
|
|
@@ -1973,11 +2103,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1973
2103
|
});
|
|
1974
2104
|
case 9:
|
|
1975
2105
|
case "end":
|
|
1976
|
-
return
|
|
2106
|
+
return _context7.stop();
|
|
1977
2107
|
}
|
|
1978
|
-
},
|
|
2108
|
+
}, _callee7, this);
|
|
1979
2109
|
}));
|
|
1980
|
-
function resetAvailabilityProjectionState(
|
|
2110
|
+
function resetAvailabilityProjectionState(_x6) {
|
|
1981
2111
|
return _resetAvailabilityProjectionState.apply(this, arguments);
|
|
1982
2112
|
}
|
|
1983
2113
|
return resetAvailabilityProjectionState;
|
|
@@ -2052,90 +2182,90 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2052
2182
|
}, {
|
|
2053
2183
|
key: "ensureLocalOrderNumbersForCheckout",
|
|
2054
2184
|
value: (function () {
|
|
2055
|
-
var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2185
|
+
var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
2056
2186
|
var _this$otherParams14, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
|
|
2057
2187
|
var order, tempOrder, biz, idGenerator;
|
|
2058
|
-
return _regeneratorRuntime().wrap(function
|
|
2059
|
-
while (1) switch (
|
|
2188
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
2189
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2060
2190
|
case 0:
|
|
2061
2191
|
if (!(normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform) !== 'kiosk')) {
|
|
2062
|
-
|
|
2192
|
+
_context8.next = 2;
|
|
2063
2193
|
break;
|
|
2064
2194
|
}
|
|
2065
|
-
return
|
|
2195
|
+
return _context8.abrupt("return");
|
|
2066
2196
|
case 2:
|
|
2067
2197
|
order = this.store.order;
|
|
2068
2198
|
tempOrder = order === null || order === void 0 ? void 0 : order.getTempOrder();
|
|
2069
2199
|
if (tempOrder) {
|
|
2070
|
-
|
|
2200
|
+
_context8.next = 6;
|
|
2071
2201
|
break;
|
|
2072
2202
|
}
|
|
2073
2203
|
throw new Error('当前订单不存在,无法生成订单编号');
|
|
2074
2204
|
case 6:
|
|
2075
2205
|
if (!(tempOrder.shop_order_number && tempOrder.shop_full_order_number)) {
|
|
2076
|
-
|
|
2206
|
+
_context8.next = 8;
|
|
2077
2207
|
break;
|
|
2078
2208
|
}
|
|
2079
|
-
return
|
|
2209
|
+
return _context8.abrupt("return");
|
|
2080
2210
|
case 8:
|
|
2081
2211
|
biz = this.getBookingTicketBusinessCode();
|
|
2082
2212
|
if (biz) {
|
|
2083
|
-
|
|
2213
|
+
_context8.next = 11;
|
|
2084
2214
|
break;
|
|
2085
2215
|
}
|
|
2086
2216
|
throw new Error('当前订单缺少业务类型,无法生成订单编号');
|
|
2087
2217
|
case 11:
|
|
2088
2218
|
idGenerator = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getAp = _this$appPlugin.getApp) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp = _this$appPlugin$getAp.call(_this$appPlugin)) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp2 = _this$appPlugin$getAp.getPlugin) === null || _this$appPlugin$getAp2 === void 0 ? void 0 : _this$appPlugin$getAp2.call(_this$appPlugin$getAp, 'idGenerator');
|
|
2089
2219
|
if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
|
|
2090
|
-
|
|
2220
|
+
_context8.next = 14;
|
|
2091
2221
|
break;
|
|
2092
2222
|
}
|
|
2093
2223
|
throw new Error('订单编号生成器不可用,请重启应用后重试');
|
|
2094
2224
|
case 14:
|
|
2095
|
-
|
|
2225
|
+
_context8.prev = 14;
|
|
2096
2226
|
if (tempOrder.shop_order_number) {
|
|
2097
|
-
|
|
2227
|
+
_context8.next = 19;
|
|
2098
2228
|
break;
|
|
2099
2229
|
}
|
|
2100
|
-
|
|
2230
|
+
_context8.next = 18;
|
|
2101
2231
|
return idGenerator.generateShopOrderNumber({
|
|
2102
2232
|
biz: biz
|
|
2103
2233
|
});
|
|
2104
2234
|
case 18:
|
|
2105
|
-
tempOrder.shop_order_number =
|
|
2235
|
+
tempOrder.shop_order_number = _context8.sent;
|
|
2106
2236
|
case 19:
|
|
2107
2237
|
if (tempOrder.shop_full_order_number) {
|
|
2108
|
-
|
|
2238
|
+
_context8.next = 23;
|
|
2109
2239
|
break;
|
|
2110
2240
|
}
|
|
2111
|
-
|
|
2241
|
+
_context8.next = 22;
|
|
2112
2242
|
return idGenerator.generateReceiptId({
|
|
2113
2243
|
biz: biz
|
|
2114
2244
|
});
|
|
2115
2245
|
case 22:
|
|
2116
|
-
tempOrder.shop_full_order_number =
|
|
2246
|
+
tempOrder.shop_full_order_number = _context8.sent;
|
|
2117
2247
|
case 23:
|
|
2118
2248
|
if (!(order.getTempOrder() !== tempOrder)) {
|
|
2119
|
-
|
|
2249
|
+
_context8.next = 25;
|
|
2120
2250
|
break;
|
|
2121
2251
|
}
|
|
2122
2252
|
throw new Error('当前订单已切换,请重新发起支付');
|
|
2123
2253
|
case 25:
|
|
2124
2254
|
if (!(!tempOrder.shop_order_number || !tempOrder.shop_full_order_number)) {
|
|
2125
|
-
|
|
2255
|
+
_context8.next = 27;
|
|
2126
2256
|
break;
|
|
2127
2257
|
}
|
|
2128
2258
|
throw new Error('订单编号生成失败,请重试');
|
|
2129
2259
|
case 27:
|
|
2130
|
-
|
|
2260
|
+
_context8.prev = 27;
|
|
2131
2261
|
// 部分生成成功时也保留号码,后续只补仍然缺失的字段。
|
|
2132
2262
|
if (order.getTempOrder() === tempOrder) order.persistTempOrder();
|
|
2133
|
-
return
|
|
2263
|
+
return _context8.finish(27);
|
|
2134
2264
|
case 30:
|
|
2135
2265
|
case "end":
|
|
2136
|
-
return
|
|
2266
|
+
return _context8.stop();
|
|
2137
2267
|
}
|
|
2138
|
-
},
|
|
2268
|
+
}, _callee8, this, [[14,, 27, 30]]);
|
|
2139
2269
|
}));
|
|
2140
2270
|
function ensureLocalOrderNumbersForCheckout() {
|
|
2141
2271
|
return _ensureLocalOrderNumbersForCheckout.apply(this, arguments);
|
|
@@ -2179,77 +2309,77 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2179
2309
|
}, {
|
|
2180
2310
|
key: "addNewOrder",
|
|
2181
2311
|
value: function () {
|
|
2182
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2312
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
2183
2313
|
var _this$store$order2, _this$store$order2$co, _this$store$order4;
|
|
2184
2314
|
var sessionRecord, tempOrder, _this$store$order3, didSyncAuthenticatedCustomer;
|
|
2185
|
-
return _regeneratorRuntime().wrap(function
|
|
2186
|
-
while (1) switch (
|
|
2315
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
2316
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
2187
2317
|
case 0:
|
|
2188
2318
|
sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$co = _this$store$order2.consumeSessionStorageRestore) === null || _this$store$order2$co === void 0 ? void 0 : _this$store$order2$co.call(_this$store$order2) : null;
|
|
2189
2319
|
if (!sessionRecord) {
|
|
2190
|
-
|
|
2320
|
+
_context9.next = 4;
|
|
2191
2321
|
break;
|
|
2192
2322
|
}
|
|
2193
|
-
|
|
2323
|
+
_context9.next = 4;
|
|
2194
2324
|
return this.loadSalesDetail({
|
|
2195
2325
|
preloadedSalesDetail: sessionRecord,
|
|
2196
2326
|
hydrateSource: 'sessionStorage'
|
|
2197
2327
|
});
|
|
2198
2328
|
case 4:
|
|
2199
|
-
|
|
2329
|
+
_context9.next = 6;
|
|
2200
2330
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "addNewOrder", this).call(this);
|
|
2201
2331
|
case 6:
|
|
2202
|
-
tempOrder =
|
|
2332
|
+
tempOrder = _context9.sent;
|
|
2203
2333
|
if (sessionRecord) {
|
|
2204
2334
|
(_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || _this$store$order3.persistTempOrder();
|
|
2205
2335
|
}
|
|
2206
2336
|
if (!this.isAuthenticatedCustomerUserPlatform()) {
|
|
2207
|
-
|
|
2337
|
+
_context9.next = 23;
|
|
2208
2338
|
break;
|
|
2209
2339
|
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2340
|
+
_context9.prev = 9;
|
|
2341
|
+
_context9.next = 12;
|
|
2212
2342
|
return this.syncAuthenticatedOrderCustomer();
|
|
2213
2343
|
case 12:
|
|
2214
|
-
didSyncAuthenticatedCustomer =
|
|
2344
|
+
didSyncAuthenticatedCustomer = _context9.sent;
|
|
2215
2345
|
if (!(!didSyncAuthenticatedCustomer && sessionRecord)) {
|
|
2216
|
-
|
|
2346
|
+
_context9.next = 16;
|
|
2217
2347
|
break;
|
|
2218
2348
|
}
|
|
2219
|
-
|
|
2349
|
+
_context9.next = 16;
|
|
2220
2350
|
return this.refreshLegacySessionCustomerDiscounts(tempOrder);
|
|
2221
2351
|
case 16:
|
|
2222
|
-
|
|
2352
|
+
_context9.next = 21;
|
|
2223
2353
|
break;
|
|
2224
2354
|
case 18:
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
console.warn('[UnifiedBookingSales] Failed to sync authenticated order customer after addNewOrder',
|
|
2355
|
+
_context9.prev = 18;
|
|
2356
|
+
_context9.t0 = _context9["catch"](9);
|
|
2357
|
+
console.warn('[UnifiedBookingSales] Failed to sync authenticated order customer after addNewOrder', _context9.t0);
|
|
2228
2358
|
case 21:
|
|
2229
|
-
|
|
2359
|
+
_context9.next = 32;
|
|
2230
2360
|
break;
|
|
2231
2361
|
case 23:
|
|
2232
2362
|
if (!sessionRecord) {
|
|
2233
|
-
|
|
2363
|
+
_context9.next = 32;
|
|
2234
2364
|
break;
|
|
2235
2365
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2366
|
+
_context9.prev = 24;
|
|
2367
|
+
_context9.next = 27;
|
|
2238
2368
|
return this.refreshLegacySessionCustomerDiscounts(tempOrder);
|
|
2239
2369
|
case 27:
|
|
2240
|
-
|
|
2370
|
+
_context9.next = 32;
|
|
2241
2371
|
break;
|
|
2242
2372
|
case 29:
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder',
|
|
2373
|
+
_context9.prev = 29;
|
|
2374
|
+
_context9.t1 = _context9["catch"](24);
|
|
2375
|
+
console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder', _context9.t1);
|
|
2246
2376
|
case 32:
|
|
2247
|
-
return
|
|
2377
|
+
return _context9.abrupt("return", ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) || tempOrder);
|
|
2248
2378
|
case 33:
|
|
2249
2379
|
case "end":
|
|
2250
|
-
return
|
|
2380
|
+
return _context9.stop();
|
|
2251
2381
|
}
|
|
2252
|
-
},
|
|
2382
|
+
}, _callee9, this, [[9, 18], [24, 29]]);
|
|
2253
2383
|
}));
|
|
2254
2384
|
function addNewOrder() {
|
|
2255
2385
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2259,46 +2389,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2259
2389
|
}, {
|
|
2260
2390
|
key: "syncAuthenticatedOrderCustomer",
|
|
2261
2391
|
value: function () {
|
|
2262
|
-
var _syncAuthenticatedOrderCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2392
|
+
var _syncAuthenticatedOrderCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
2263
2393
|
var _this$core2, _this$core2$getPlugin, _this$core2$getPlugin2, _this$store$customer, _this$store$customer$;
|
|
2264
2394
|
var authenticatedCustomer, authenticatedCustomerId, tempOrder, cachedCustomerId;
|
|
2265
|
-
return _regeneratorRuntime().wrap(function
|
|
2266
|
-
while (1) switch (
|
|
2395
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
2396
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
2267
2397
|
case 0:
|
|
2268
2398
|
if (this.isAuthenticatedCustomerUserPlatform()) {
|
|
2269
|
-
|
|
2399
|
+
_context10.next = 2;
|
|
2270
2400
|
break;
|
|
2271
2401
|
}
|
|
2272
|
-
return
|
|
2402
|
+
return _context10.abrupt("return", false);
|
|
2273
2403
|
case 2:
|
|
2274
2404
|
authenticatedCustomer = (_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2$getPlugin = _this$core2.getPlugin) === null || _this$core2$getPlugin === void 0 || (_this$core2$getPlugin = _this$core2$getPlugin.call(_this$core2, 'user')) === null || _this$core2$getPlugin === void 0 || (_this$core2$getPlugin2 = _this$core2$getPlugin.get) === null || _this$core2$getPlugin2 === void 0 ? void 0 : _this$core2$getPlugin2.call(_this$core2$getPlugin);
|
|
2275
2405
|
authenticatedCustomerId = toCustomerId(authenticatedCustomer === null || authenticatedCustomer === void 0 ? void 0 : authenticatedCustomer.id);
|
|
2276
2406
|
if (authenticatedCustomerId) {
|
|
2277
|
-
|
|
2407
|
+
_context10.next = 6;
|
|
2278
2408
|
break;
|
|
2279
2409
|
}
|
|
2280
|
-
return
|
|
2410
|
+
return _context10.abrupt("return", false);
|
|
2281
2411
|
case 6:
|
|
2282
2412
|
tempOrder = this.getTempOrder();
|
|
2283
2413
|
cachedCustomerId = resolveTempOrderCustomerId(tempOrder);
|
|
2284
2414
|
if (!(cachedCustomerId !== null && cachedCustomerId !== authenticatedCustomerId)) {
|
|
2285
|
-
|
|
2415
|
+
_context10.next = 11;
|
|
2286
2416
|
break;
|
|
2287
2417
|
}
|
|
2288
|
-
|
|
2418
|
+
_context10.next = 11;
|
|
2289
2419
|
return this.resetCachedCustomerDiscountState();
|
|
2290
2420
|
case 11:
|
|
2291
2421
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || (_this$store$customer$ = _this$store$customer.setSelectedCustomer) === null || _this$store$customer$ === void 0 || _this$store$customer$.call(_this$store$customer, authenticatedCustomer);
|
|
2292
2422
|
this.setOrderCustomer(authenticatedCustomer);
|
|
2293
|
-
|
|
2423
|
+
_context10.next = 15;
|
|
2294
2424
|
return Promise.all([this.refreshDiscountConfigAfterOrderCustomerChange(authenticatedCustomerId), this.waitForOrderCustomerPromotionRefresh()]);
|
|
2295
2425
|
case 15:
|
|
2296
|
-
return
|
|
2426
|
+
return _context10.abrupt("return", true);
|
|
2297
2427
|
case 16:
|
|
2298
2428
|
case "end":
|
|
2299
|
-
return
|
|
2429
|
+
return _context10.stop();
|
|
2300
2430
|
}
|
|
2301
|
-
},
|
|
2431
|
+
}, _callee10, this);
|
|
2302
2432
|
}));
|
|
2303
2433
|
function syncAuthenticatedOrderCustomer() {
|
|
2304
2434
|
return _syncAuthenticatedOrderCustomer.apply(this, arguments);
|
|
@@ -2326,11 +2456,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2326
2456
|
}, {
|
|
2327
2457
|
key: "resetCachedCustomerDiscountState",
|
|
2328
2458
|
value: function () {
|
|
2329
|
-
var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2459
|
+
var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
2330
2460
|
var _this$store$order6, _this$store$order6$cl, _this$store$customer2, _this$store$customer3, _this$store$order7, _discountModule$getOr, _discountModule$getDi, _discountModule$setOr, _discountModule$setDi, _this$store$order8, _this$store$order8$ap, _this$store$order9, _this$store$order9$re, _this$store$order10, _this$store$order10$p;
|
|
2331
2461
|
var orderStore, discountModule, filteredOriginalDiscounts, filteredCurrentDiscounts;
|
|
2332
|
-
return _regeneratorRuntime().wrap(function
|
|
2333
|
-
while (1) switch (
|
|
2462
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
2463
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
2334
2464
|
case 0:
|
|
2335
2465
|
(_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$cl = _this$store$order6.clearOrderCustomer) === null || _this$store$order6$cl === void 0 || _this$store$order6$cl.call(_this$store$order6);
|
|
2336
2466
|
(_this$store$customer2 = this.store.customer) === null || _this$store$customer2 === void 0 || (_this$store$customer3 = _this$store$customer2.setSelectedCustomer) === null || _this$store$customer3 === void 0 || _this$store$customer3.call(_this$store$customer2, null);
|
|
@@ -2340,14 +2470,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2340
2470
|
discountModule = orderStore.discount;
|
|
2341
2471
|
filteredOriginalDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || []);
|
|
2342
2472
|
filteredCurrentDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || []);
|
|
2343
|
-
|
|
2473
|
+
_context11.next = 10;
|
|
2344
2474
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, filteredOriginalDiscounts);
|
|
2345
2475
|
case 10:
|
|
2346
|
-
|
|
2476
|
+
_context11.next = 12;
|
|
2347
2477
|
return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, filteredCurrentDiscounts);
|
|
2348
2478
|
case 12:
|
|
2349
2479
|
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ap = _this$store$order8.applyDiscount) === null || _this$store$order8$ap === void 0 || _this$store$order8$ap.call(_this$store$order8);
|
|
2350
|
-
|
|
2480
|
+
_context11.next = 15;
|
|
2351
2481
|
return (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$re = _this$store$order9.recalculateSummary) === null || _this$store$order9$re === void 0 ? void 0 : _this$store$order9$re.call(_this$store$order9, {
|
|
2352
2482
|
createIfMissing: true
|
|
2353
2483
|
});
|
|
@@ -2355,9 +2485,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2355
2485
|
(_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$p = _this$store$order10.persistTempOrder) === null || _this$store$order10$p === void 0 || _this$store$order10$p.call(_this$store$order10);
|
|
2356
2486
|
case 16:
|
|
2357
2487
|
case "end":
|
|
2358
|
-
return
|
|
2488
|
+
return _context11.stop();
|
|
2359
2489
|
}
|
|
2360
|
-
},
|
|
2490
|
+
}, _callee11, this);
|
|
2361
2491
|
}));
|
|
2362
2492
|
function resetCachedCustomerDiscountState() {
|
|
2363
2493
|
return _resetCachedCustomerDiscountState.apply(this, arguments);
|
|
@@ -2367,33 +2497,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2367
2497
|
}, {
|
|
2368
2498
|
key: "refreshLegacySessionCustomerDiscounts",
|
|
2369
2499
|
value: function () {
|
|
2370
|
-
var _refreshLegacySessionCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2500
|
+
var _refreshLegacySessionCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(tempOrder) {
|
|
2371
2501
|
var customerId, loadDiscountConfig;
|
|
2372
|
-
return _regeneratorRuntime().wrap(function
|
|
2373
|
-
while (1) switch (
|
|
2502
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2503
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
2374
2504
|
case 0:
|
|
2375
2505
|
customerId = resolveTempOrderCustomerId(tempOrder);
|
|
2376
2506
|
if (customerId) {
|
|
2377
|
-
|
|
2507
|
+
_context12.next = 3;
|
|
2378
2508
|
break;
|
|
2379
2509
|
}
|
|
2380
|
-
return
|
|
2510
|
+
return _context12.abrupt("return", undefined);
|
|
2381
2511
|
case 3:
|
|
2382
2512
|
loadDiscountConfig = _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "loadDiscountConfig", this).bind(this);
|
|
2383
|
-
|
|
2513
|
+
_context12.next = 6;
|
|
2384
2514
|
return loadDiscountConfig({
|
|
2385
2515
|
customerId: customerId,
|
|
2386
2516
|
action: this.resolveDiscountAction(this.resolveDiscountOrderIdentity(tempOrder))
|
|
2387
2517
|
});
|
|
2388
2518
|
case 6:
|
|
2389
|
-
return
|
|
2519
|
+
return _context12.abrupt("return", _context12.sent);
|
|
2390
2520
|
case 7:
|
|
2391
2521
|
case "end":
|
|
2392
|
-
return
|
|
2522
|
+
return _context12.stop();
|
|
2393
2523
|
}
|
|
2394
|
-
},
|
|
2524
|
+
}, _callee12, this);
|
|
2395
2525
|
}));
|
|
2396
|
-
function refreshLegacySessionCustomerDiscounts(
|
|
2526
|
+
function refreshLegacySessionCustomerDiscounts(_x7) {
|
|
2397
2527
|
return _refreshLegacySessionCustomerDiscounts.apply(this, arguments);
|
|
2398
2528
|
}
|
|
2399
2529
|
return refreshLegacySessionCustomerDiscounts;
|
|
@@ -2436,39 +2566,39 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2436
2566
|
}, {
|
|
2437
2567
|
key: "prepareInvoiceTemplateAtSolutionReady",
|
|
2438
2568
|
value: function () {
|
|
2439
|
-
var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2569
|
+
var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(injectedOpenData) {
|
|
2440
2570
|
var businessCode;
|
|
2441
|
-
return _regeneratorRuntime().wrap(function
|
|
2442
|
-
while (1) switch (
|
|
2571
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2572
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2443
2573
|
case 0:
|
|
2444
2574
|
businessCode = this.getBookingTicketBusinessCode();
|
|
2445
2575
|
if (!(!businessCode || !this.store.openData)) {
|
|
2446
|
-
|
|
2576
|
+
_context13.next = 3;
|
|
2447
2577
|
break;
|
|
2448
2578
|
}
|
|
2449
|
-
return
|
|
2579
|
+
return _context13.abrupt("return");
|
|
2450
2580
|
case 3:
|
|
2451
2581
|
if (injectedOpenData) {
|
|
2452
2582
|
this.otherParams.openData = injectedOpenData;
|
|
2453
2583
|
this.openDataTarget = "".concat(businessCode, "+").concat(this.getSubmitOrderSalesChannel());
|
|
2454
2584
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2585
|
+
_context13.prev = 4;
|
|
2586
|
+
_context13.next = 7;
|
|
2457
2587
|
return this.loadOpenDataConfig();
|
|
2458
2588
|
case 7:
|
|
2459
|
-
|
|
2589
|
+
_context13.next = 12;
|
|
2460
2590
|
break;
|
|
2461
2591
|
case 9:
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置',
|
|
2592
|
+
_context13.prev = 9;
|
|
2593
|
+
_context13.t0 = _context13["catch"](4);
|
|
2594
|
+
console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', _context13.t0);
|
|
2465
2595
|
case 12:
|
|
2466
2596
|
case "end":
|
|
2467
|
-
return
|
|
2597
|
+
return _context13.stop();
|
|
2468
2598
|
}
|
|
2469
|
-
},
|
|
2599
|
+
}, _callee13, this, [[4, 9]]);
|
|
2470
2600
|
}));
|
|
2471
|
-
function prepareInvoiceTemplateAtSolutionReady(
|
|
2601
|
+
function prepareInvoiceTemplateAtSolutionReady(_x8) {
|
|
2472
2602
|
return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
|
|
2473
2603
|
}
|
|
2474
2604
|
return prepareInvoiceTemplateAtSolutionReady;
|
|
@@ -2476,27 +2606,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2476
2606
|
}, {
|
|
2477
2607
|
key: "loadOpenDataConfig",
|
|
2478
2608
|
value: function () {
|
|
2479
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2609
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2480
2610
|
var businessCode;
|
|
2481
|
-
return _regeneratorRuntime().wrap(function
|
|
2482
|
-
while (1) switch (
|
|
2611
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2612
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2483
2613
|
case 0:
|
|
2484
2614
|
businessCode = this.getBookingTicketBusinessCode();
|
|
2485
2615
|
if (businessCode) {
|
|
2486
|
-
|
|
2616
|
+
_context14.next = 3;
|
|
2487
2617
|
break;
|
|
2488
2618
|
}
|
|
2489
|
-
return
|
|
2619
|
+
return _context14.abrupt("return", null);
|
|
2490
2620
|
case 3:
|
|
2491
|
-
return
|
|
2621
|
+
return _context14.abrupt("return", this.loadOpenData({
|
|
2492
2622
|
businessCode: businessCode,
|
|
2493
2623
|
channel: this.getSubmitOrderSalesChannel()
|
|
2494
2624
|
}));
|
|
2495
2625
|
case 4:
|
|
2496
2626
|
case "end":
|
|
2497
|
-
return
|
|
2627
|
+
return _context14.stop();
|
|
2498
2628
|
}
|
|
2499
|
-
},
|
|
2629
|
+
}, _callee14, this);
|
|
2500
2630
|
}));
|
|
2501
2631
|
function loadOpenDataConfig() {
|
|
2502
2632
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2506,21 +2636,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2506
2636
|
}, {
|
|
2507
2637
|
key: "loadOpenData",
|
|
2508
2638
|
value: (function () {
|
|
2509
|
-
var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2639
|
+
var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
2510
2640
|
var _this5 = this;
|
|
2511
2641
|
var module, businessCode, channel, target, scope, injectedOpenData, generation, core, request;
|
|
2512
|
-
return _regeneratorRuntime().wrap(function
|
|
2513
|
-
while (1) switch (
|
|
2642
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2643
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2514
2644
|
case 0:
|
|
2515
2645
|
module = this.store.openData;
|
|
2516
2646
|
if (module) {
|
|
2517
|
-
|
|
2647
|
+
_context16.next = 3;
|
|
2518
2648
|
break;
|
|
2519
2649
|
}
|
|
2520
2650
|
throw new Error('[UnifiedBookingSales] openData 模块未初始化');
|
|
2521
2651
|
case 3:
|
|
2522
2652
|
if (!this.runtimeOpenDataDestroyed) {
|
|
2523
|
-
|
|
2653
|
+
_context16.next = 5;
|
|
2524
2654
|
break;
|
|
2525
2655
|
}
|
|
2526
2656
|
throw new Error('Store settings changed. Please try again.');
|
|
@@ -2528,7 +2658,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2528
2658
|
businessCode = String(params.businessCode || '').trim();
|
|
2529
2659
|
channel = String(params.channel || '').trim();
|
|
2530
2660
|
if (!(!businessCode || !channel)) {
|
|
2531
|
-
|
|
2661
|
+
_context16.next = 9;
|
|
2532
2662
|
break;
|
|
2533
2663
|
}
|
|
2534
2664
|
throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
|
|
@@ -2553,40 +2683,40 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2553
2683
|
this.runtimeOpenDataSnapshot = injectedOpenData;
|
|
2554
2684
|
}
|
|
2555
2685
|
if (!this.loadOpenDataInFlight) {
|
|
2556
|
-
|
|
2686
|
+
_context16.next = 17;
|
|
2557
2687
|
break;
|
|
2558
2688
|
}
|
|
2559
|
-
return
|
|
2689
|
+
return _context16.abrupt("return", this.loadOpenDataInFlight);
|
|
2560
2690
|
case 17:
|
|
2561
2691
|
generation = this.runtimeOpenDataGeneration;
|
|
2562
2692
|
core = this.core;
|
|
2563
|
-
request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2693
|
+
request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
2564
2694
|
var openData, _module$ensureInvoice;
|
|
2565
|
-
return _regeneratorRuntime().wrap(function
|
|
2566
|
-
while (1) switch (
|
|
2695
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2696
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2567
2697
|
case 0:
|
|
2568
2698
|
openData = _this5.runtimeOpenDataSnapshot;
|
|
2569
2699
|
if (!openData) {
|
|
2570
|
-
|
|
2700
|
+
_context15.next = 6;
|
|
2571
2701
|
break;
|
|
2572
2702
|
}
|
|
2573
|
-
|
|
2703
|
+
_context15.next = 4;
|
|
2574
2704
|
return (_module$ensureInvoice = module.ensureInvoiceTemplateSettings) === null || _module$ensureInvoice === void 0 ? void 0 : _module$ensureInvoice.call(module, target, openData);
|
|
2575
2705
|
case 4:
|
|
2576
|
-
|
|
2706
|
+
_context15.next = 9;
|
|
2577
2707
|
break;
|
|
2578
2708
|
case 6:
|
|
2579
|
-
|
|
2709
|
+
_context15.next = 8;
|
|
2580
2710
|
return module.fetchOpenData({
|
|
2581
2711
|
scope: 'board',
|
|
2582
2712
|
target: target,
|
|
2583
2713
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2584
2714
|
});
|
|
2585
2715
|
case 8:
|
|
2586
|
-
openData =
|
|
2716
|
+
openData = _context15.sent;
|
|
2587
2717
|
case 9:
|
|
2588
2718
|
if (!(_this5.runtimeOpenDataDestroyed || generation !== _this5.runtimeOpenDataGeneration || scope !== _this5.getRuntimeOpenDataScope() || module !== _this5.store.openData || core !== _this5.core)) {
|
|
2589
|
-
|
|
2719
|
+
_context15.next = 11;
|
|
2590
2720
|
break;
|
|
2591
2721
|
}
|
|
2592
2722
|
throw new Error('Store settings changed. Please try again.');
|
|
@@ -2594,34 +2724,34 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2594
2724
|
_this5.runtimeOpenDataSnapshot = openData;
|
|
2595
2725
|
_this5.openDataTarget = target;
|
|
2596
2726
|
_this5.otherParams.openData = openData;
|
|
2597
|
-
return
|
|
2727
|
+
return _context15.abrupt("return", openData);
|
|
2598
2728
|
case 15:
|
|
2599
2729
|
case "end":
|
|
2600
|
-
return
|
|
2730
|
+
return _context15.stop();
|
|
2601
2731
|
}
|
|
2602
|
-
},
|
|
2732
|
+
}, _callee15);
|
|
2603
2733
|
}))();
|
|
2604
2734
|
this.loadOpenDataInFlightTarget = target;
|
|
2605
2735
|
this.loadOpenDataInFlight = request;
|
|
2606
|
-
|
|
2607
|
-
|
|
2736
|
+
_context16.prev = 22;
|
|
2737
|
+
_context16.next = 25;
|
|
2608
2738
|
return request;
|
|
2609
2739
|
case 25:
|
|
2610
|
-
return
|
|
2740
|
+
return _context16.abrupt("return", _context16.sent);
|
|
2611
2741
|
case 26:
|
|
2612
|
-
|
|
2742
|
+
_context16.prev = 26;
|
|
2613
2743
|
if (this.loadOpenDataInFlight === request) {
|
|
2614
2744
|
this.loadOpenDataInFlight = null;
|
|
2615
2745
|
this.loadOpenDataInFlightTarget = null;
|
|
2616
2746
|
}
|
|
2617
|
-
return
|
|
2747
|
+
return _context16.finish(26);
|
|
2618
2748
|
case 29:
|
|
2619
2749
|
case "end":
|
|
2620
|
-
return
|
|
2750
|
+
return _context16.stop();
|
|
2621
2751
|
}
|
|
2622
|
-
},
|
|
2752
|
+
}, _callee16, this, [[22,, 26, 29]]);
|
|
2623
2753
|
}));
|
|
2624
|
-
function loadOpenData(
|
|
2754
|
+
function loadOpenData(_x9) {
|
|
2625
2755
|
return _loadOpenData.apply(this, arguments);
|
|
2626
2756
|
}
|
|
2627
2757
|
return loadOpenData;
|
|
@@ -2629,16 +2759,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2629
2759
|
}, {
|
|
2630
2760
|
key: "getOpenData",
|
|
2631
2761
|
value: function () {
|
|
2632
|
-
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2633
|
-
return _regeneratorRuntime().wrap(function
|
|
2634
|
-
while (1) switch (
|
|
2762
|
+
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
2763
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2764
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2635
2765
|
case 0:
|
|
2636
|
-
return
|
|
2766
|
+
return _context17.abrupt("return", this.loadOpenDataConfig());
|
|
2637
2767
|
case 1:
|
|
2638
2768
|
case "end":
|
|
2639
|
-
return
|
|
2769
|
+
return _context17.stop();
|
|
2640
2770
|
}
|
|
2641
|
-
},
|
|
2771
|
+
}, _callee17, this);
|
|
2642
2772
|
}));
|
|
2643
2773
|
function getOpenData() {
|
|
2644
2774
|
return _getOpenData.apply(this, arguments);
|
|
@@ -2648,35 +2778,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2648
2778
|
}, {
|
|
2649
2779
|
key: "loadPickupTimingOpenData",
|
|
2650
2780
|
value: function () {
|
|
2651
|
-
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2781
|
+
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_force) {
|
|
2652
2782
|
var _ref34, _this$otherParams$bus2, _this$otherParams18, _this$otherParams19;
|
|
2653
2783
|
var scope, businessCode, config;
|
|
2654
|
-
return _regeneratorRuntime().wrap(function
|
|
2655
|
-
while (1) switch (
|
|
2784
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2785
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2656
2786
|
case 0:
|
|
2657
2787
|
scope = this.getPickupTimingScope();
|
|
2658
2788
|
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
|
|
2659
|
-
|
|
2789
|
+
_context18.next = 4;
|
|
2660
2790
|
return this.loadOpenData({
|
|
2661
2791
|
businessCode: businessCode,
|
|
2662
2792
|
channel: this.getSubmitOrderSalesChannel()
|
|
2663
2793
|
});
|
|
2664
2794
|
case 4:
|
|
2665
|
-
config =
|
|
2795
|
+
config = _context18.sent;
|
|
2666
2796
|
if (!(scope !== this.getPickupTimingScope())) {
|
|
2667
|
-
|
|
2797
|
+
_context18.next = 7;
|
|
2668
2798
|
break;
|
|
2669
2799
|
}
|
|
2670
2800
|
throw new Error('Store settings changed. Please try again.');
|
|
2671
2801
|
case 7:
|
|
2672
|
-
return
|
|
2802
|
+
return _context18.abrupt("return", config);
|
|
2673
2803
|
case 8:
|
|
2674
2804
|
case "end":
|
|
2675
|
-
return
|
|
2805
|
+
return _context18.stop();
|
|
2676
2806
|
}
|
|
2677
|
-
},
|
|
2807
|
+
}, _callee18, this);
|
|
2678
2808
|
}));
|
|
2679
|
-
function loadPickupTimingOpenData(
|
|
2809
|
+
function loadPickupTimingOpenData(_x10) {
|
|
2680
2810
|
return _loadPickupTimingOpenData.apply(this, arguments);
|
|
2681
2811
|
}
|
|
2682
2812
|
return loadPickupTimingOpenData;
|
|
@@ -2691,19 +2821,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2691
2821
|
}, {
|
|
2692
2822
|
key: "fetchAllergyItemRuleConfigs",
|
|
2693
2823
|
value: function () {
|
|
2694
|
-
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2824
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(strategyModelIds) {
|
|
2695
2825
|
var _response$data, response, list;
|
|
2696
|
-
return _regeneratorRuntime().wrap(function
|
|
2697
|
-
while (1) switch (
|
|
2826
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2827
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2698
2828
|
case 0:
|
|
2699
2829
|
if (strategyModelIds.length) {
|
|
2700
|
-
|
|
2830
|
+
_context19.next = 2;
|
|
2701
2831
|
break;
|
|
2702
2832
|
}
|
|
2703
|
-
return
|
|
2833
|
+
return _context19.abrupt("return", []);
|
|
2704
2834
|
case 2:
|
|
2705
|
-
|
|
2706
|
-
|
|
2835
|
+
_context19.prev = 2;
|
|
2836
|
+
_context19.next = 5;
|
|
2707
2837
|
return this.request.get('/promotion', {
|
|
2708
2838
|
skip: 1,
|
|
2709
2839
|
num: 99,
|
|
@@ -2711,28 +2841,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2711
2841
|
ids: strategyModelIds
|
|
2712
2842
|
});
|
|
2713
2843
|
case 5:
|
|
2714
|
-
response =
|
|
2844
|
+
response = _context19.sent;
|
|
2715
2845
|
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))) {
|
|
2716
|
-
|
|
2846
|
+
_context19.next = 8;
|
|
2717
2847
|
break;
|
|
2718
2848
|
}
|
|
2719
2849
|
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2720
2850
|
case 8:
|
|
2721
2851
|
list = response.data.list;
|
|
2722
|
-
return
|
|
2852
|
+
return _context19.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2723
2853
|
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2724
2854
|
})));
|
|
2725
2855
|
case 12:
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
throw
|
|
2856
|
+
_context19.prev = 12;
|
|
2857
|
+
_context19.t0 = _context19["catch"](2);
|
|
2858
|
+
throw _context19.t0;
|
|
2729
2859
|
case 15:
|
|
2730
2860
|
case "end":
|
|
2731
|
-
return
|
|
2861
|
+
return _context19.stop();
|
|
2732
2862
|
}
|
|
2733
|
-
},
|
|
2863
|
+
}, _callee19, this, [[2, 12]]);
|
|
2734
2864
|
}));
|
|
2735
|
-
function fetchAllergyItemRuleConfigs(
|
|
2865
|
+
function fetchAllergyItemRuleConfigs(_x11) {
|
|
2736
2866
|
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2737
2867
|
}
|
|
2738
2868
|
return fetchAllergyItemRuleConfigs;
|
|
@@ -2740,72 +2870,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2740
2870
|
}, {
|
|
2741
2871
|
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2742
2872
|
value: function () {
|
|
2743
|
-
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2873
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2744
2874
|
var _this6 = this;
|
|
2745
|
-
return _regeneratorRuntime().wrap(function
|
|
2746
|
-
while (1) switch (
|
|
2875
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2876
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2747
2877
|
case 0:
|
|
2748
2878
|
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2749
|
-
|
|
2879
|
+
_context21.next = 2;
|
|
2750
2880
|
break;
|
|
2751
2881
|
}
|
|
2752
|
-
return
|
|
2882
|
+
return _context21.abrupt("return", this.allergyItemRuleConfigs);
|
|
2753
2883
|
case 2:
|
|
2754
2884
|
if (!this.allergyItemRuleConfigsPromise) {
|
|
2755
|
-
|
|
2885
|
+
_context21.next = 4;
|
|
2756
2886
|
break;
|
|
2757
2887
|
}
|
|
2758
|
-
return
|
|
2888
|
+
return _context21.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2759
2889
|
case 4:
|
|
2760
|
-
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2890
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
2761
2891
|
var _this6$otherParams;
|
|
2762
2892
|
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2763
|
-
return _regeneratorRuntime().wrap(function
|
|
2764
|
-
while (1) switch (
|
|
2893
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2894
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2765
2895
|
case 0:
|
|
2766
2896
|
staticConfigs = normalizeItemRuleStrategyConfigs((_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 || (_this6$otherParams = _this6$otherParams.itemRule) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.strategyConfigs);
|
|
2767
2897
|
if (!(staticConfigs.length > 0)) {
|
|
2768
|
-
|
|
2898
|
+
_context20.next = 5;
|
|
2769
2899
|
break;
|
|
2770
2900
|
}
|
|
2771
2901
|
_this6.allergyItemRuleConfigs = staticConfigs;
|
|
2772
2902
|
_this6.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2773
|
-
return
|
|
2903
|
+
return _context20.abrupt("return", staticConfigs);
|
|
2774
2904
|
case 5:
|
|
2775
|
-
|
|
2905
|
+
_context20.next = 7;
|
|
2776
2906
|
return _this6.getOpenData();
|
|
2777
2907
|
case 7:
|
|
2778
|
-
openData =
|
|
2908
|
+
openData = _context20.sent;
|
|
2779
2909
|
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2780
2910
|
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2781
2911
|
if (!(!enabled || !strategyModelIds.length)) {
|
|
2782
|
-
|
|
2912
|
+
_context20.next = 13;
|
|
2783
2913
|
break;
|
|
2784
2914
|
}
|
|
2785
2915
|
_this6.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2786
|
-
return
|
|
2916
|
+
return _context20.abrupt("return", []);
|
|
2787
2917
|
case 13:
|
|
2788
|
-
|
|
2918
|
+
_context20.next = 15;
|
|
2789
2919
|
return _this6.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2790
2920
|
case 15:
|
|
2791
|
-
loaded =
|
|
2921
|
+
loaded = _context20.sent;
|
|
2792
2922
|
_this6.allergyItemRuleConfigs = loaded;
|
|
2793
2923
|
_this6.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
2794
|
-
return
|
|
2924
|
+
return _context20.abrupt("return", loaded);
|
|
2795
2925
|
case 19:
|
|
2796
2926
|
case "end":
|
|
2797
|
-
return
|
|
2927
|
+
return _context20.stop();
|
|
2798
2928
|
}
|
|
2799
|
-
},
|
|
2929
|
+
}, _callee20);
|
|
2800
2930
|
}))().catch(function () {
|
|
2801
2931
|
return [];
|
|
2802
2932
|
});
|
|
2803
|
-
return
|
|
2933
|
+
return _context21.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2804
2934
|
case 6:
|
|
2805
2935
|
case "end":
|
|
2806
|
-
return
|
|
2936
|
+
return _context21.stop();
|
|
2807
2937
|
}
|
|
2808
|
-
},
|
|
2938
|
+
}, _callee21, this);
|
|
2809
2939
|
}));
|
|
2810
2940
|
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2811
2941
|
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2819,28 +2949,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2819
2949
|
}, {
|
|
2820
2950
|
key: "resolveProductAllergyRequirement",
|
|
2821
2951
|
value: (function () {
|
|
2822
|
-
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2952
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2823
2953
|
var _this$otherParams20, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams21, _ref38, _ref39, _params$channel, _this$otherParams22, _this$otherParams23, _runtimeConfig$submis;
|
|
2824
2954
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2825
|
-
return _regeneratorRuntime().wrap(function
|
|
2826
|
-
while (1) switch (
|
|
2955
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2956
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2827
2957
|
case 0:
|
|
2828
2958
|
productId = normalizePositiveInteger(params.productId);
|
|
2829
2959
|
if (productId) {
|
|
2830
|
-
|
|
2960
|
+
_context22.next = 3;
|
|
2831
2961
|
break;
|
|
2832
2962
|
}
|
|
2833
|
-
return
|
|
2963
|
+
return _context22.abrupt("return", null);
|
|
2834
2964
|
case 3:
|
|
2835
|
-
|
|
2965
|
+
_context22.next = 5;
|
|
2836
2966
|
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2837
2967
|
case 5:
|
|
2838
|
-
strategyConfigs =
|
|
2968
|
+
strategyConfigs = _context22.sent;
|
|
2839
2969
|
if (strategyConfigs.length) {
|
|
2840
|
-
|
|
2970
|
+
_context22.next = 8;
|
|
2841
2971
|
break;
|
|
2842
2972
|
}
|
|
2843
|
-
return
|
|
2973
|
+
return _context22.abrupt("return", null);
|
|
2844
2974
|
case 8:
|
|
2845
2975
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2846
2976
|
runtimeConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.itemRule) || {};
|
|
@@ -2855,7 +2985,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2855
2985
|
}).filter(function (item) {
|
|
2856
2986
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2857
2987
|
});
|
|
2858
|
-
return
|
|
2988
|
+
return _context22.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2859
2989
|
pax: {
|
|
2860
2990
|
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2861
2991
|
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
@@ -2875,11 +3005,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2875
3005
|
}));
|
|
2876
3006
|
case 13:
|
|
2877
3007
|
case "end":
|
|
2878
|
-
return
|
|
3008
|
+
return _context22.stop();
|
|
2879
3009
|
}
|
|
2880
|
-
},
|
|
3010
|
+
}, _callee22, this);
|
|
2881
3011
|
}));
|
|
2882
|
-
function resolveProductAllergyRequirement(
|
|
3012
|
+
function resolveProductAllergyRequirement(_x12) {
|
|
2883
3013
|
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
2884
3014
|
}
|
|
2885
3015
|
return resolveProductAllergyRequirement;
|
|
@@ -2893,27 +3023,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2893
3023
|
}, {
|
|
2894
3024
|
key: "getInvoiceLayoutConfig",
|
|
2895
3025
|
value: function () {
|
|
2896
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3026
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2897
3027
|
var openData;
|
|
2898
|
-
return _regeneratorRuntime().wrap(function
|
|
2899
|
-
while (1) switch (
|
|
3028
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
3029
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2900
3030
|
case 0:
|
|
2901
|
-
|
|
3031
|
+
_context23.next = 2;
|
|
2902
3032
|
return this.getOpenData();
|
|
2903
3033
|
case 2:
|
|
2904
|
-
openData =
|
|
3034
|
+
openData = _context23.sent;
|
|
2905
3035
|
if (!(!openData || !this.store.openData)) {
|
|
2906
|
-
|
|
3036
|
+
_context23.next = 5;
|
|
2907
3037
|
break;
|
|
2908
3038
|
}
|
|
2909
|
-
return
|
|
3039
|
+
return _context23.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
2910
3040
|
case 5:
|
|
2911
|
-
return
|
|
3041
|
+
return _context23.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
2912
3042
|
case 6:
|
|
2913
3043
|
case "end":
|
|
2914
|
-
return
|
|
3044
|
+
return _context23.stop();
|
|
2915
3045
|
}
|
|
2916
|
-
},
|
|
3046
|
+
}, _callee23, this);
|
|
2917
3047
|
}));
|
|
2918
3048
|
function getInvoiceLayoutConfig() {
|
|
2919
3049
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -2923,27 +3053,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2923
3053
|
}, {
|
|
2924
3054
|
key: "getInvoiceTemplateSettings",
|
|
2925
3055
|
value: function () {
|
|
2926
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3056
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2927
3057
|
var openData;
|
|
2928
|
-
return _regeneratorRuntime().wrap(function
|
|
2929
|
-
while (1) switch (
|
|
3058
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
3059
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2930
3060
|
case 0:
|
|
2931
|
-
|
|
3061
|
+
_context24.next = 2;
|
|
2932
3062
|
return this.getOpenData();
|
|
2933
3063
|
case 2:
|
|
2934
|
-
openData =
|
|
3064
|
+
openData = _context24.sent;
|
|
2935
3065
|
if (!(!openData || !this.store.openData)) {
|
|
2936
|
-
|
|
3066
|
+
_context24.next = 5;
|
|
2937
3067
|
break;
|
|
2938
3068
|
}
|
|
2939
|
-
return
|
|
3069
|
+
return _context24.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
2940
3070
|
case 5:
|
|
2941
|
-
return
|
|
3071
|
+
return _context24.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
2942
3072
|
case 6:
|
|
2943
3073
|
case "end":
|
|
2944
|
-
return
|
|
3074
|
+
return _context24.stop();
|
|
2945
3075
|
}
|
|
2946
|
-
},
|
|
3076
|
+
}, _callee24, this);
|
|
2947
3077
|
}));
|
|
2948
3078
|
function getInvoiceTemplateSettings() {
|
|
2949
3079
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -2966,14 +3096,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2966
3096
|
}, {
|
|
2967
3097
|
key: "getProtocol",
|
|
2968
3098
|
value: (function () {
|
|
2969
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3099
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(policyId) {
|
|
2970
3100
|
var normalizedPolicyId, policyUrl;
|
|
2971
|
-
return _regeneratorRuntime().wrap(function
|
|
2972
|
-
while (1) switch (
|
|
3101
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3102
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2973
3103
|
case 0:
|
|
2974
3104
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
2975
3105
|
if (normalizedPolicyId) {
|
|
2976
|
-
|
|
3106
|
+
_context25.next = 3;
|
|
2977
3107
|
break;
|
|
2978
3108
|
}
|
|
2979
3109
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -2982,14 +3112,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2982
3112
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2983
3113
|
policyUrl = 'policy';
|
|
2984
3114
|
}
|
|
2985
|
-
return
|
|
3115
|
+
return _context25.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
2986
3116
|
case 6:
|
|
2987
3117
|
case "end":
|
|
2988
|
-
return
|
|
3118
|
+
return _context25.stop();
|
|
2989
3119
|
}
|
|
2990
|
-
},
|
|
3120
|
+
}, _callee25, this);
|
|
2991
3121
|
}));
|
|
2992
|
-
function getProtocol(
|
|
3122
|
+
function getProtocol(_x13) {
|
|
2993
3123
|
return _getProtocol.apply(this, arguments);
|
|
2994
3124
|
}
|
|
2995
3125
|
return getProtocol;
|
|
@@ -3002,27 +3132,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3002
3132
|
}, {
|
|
3003
3133
|
key: "loadProducts",
|
|
3004
3134
|
value: (function () {
|
|
3005
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3135
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
3006
3136
|
var params,
|
|
3007
3137
|
options,
|
|
3008
3138
|
schedule_date,
|
|
3009
3139
|
schedule_datetime,
|
|
3010
3140
|
result,
|
|
3011
|
-
|
|
3012
|
-
return _regeneratorRuntime().wrap(function
|
|
3013
|
-
while (1) switch (
|
|
3141
|
+
_args26 = arguments;
|
|
3142
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3143
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3014
3144
|
case 0:
|
|
3015
|
-
params =
|
|
3016
|
-
options =
|
|
3145
|
+
params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
|
|
3146
|
+
options = _args26.length > 1 ? _args26[1] : undefined;
|
|
3017
3147
|
if (this.store.products) {
|
|
3018
|
-
|
|
3148
|
+
_context26.next = 4;
|
|
3019
3149
|
break;
|
|
3020
3150
|
}
|
|
3021
3151
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3022
3152
|
case 4:
|
|
3023
3153
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3024
3154
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3025
|
-
|
|
3155
|
+
_context26.next = 8;
|
|
3026
3156
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
3027
3157
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
3028
3158
|
with_schedule: 1
|
|
@@ -3032,17 +3162,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3032
3162
|
cacheId: this.cacheId
|
|
3033
3163
|
}), options);
|
|
3034
3164
|
case 8:
|
|
3035
|
-
result =
|
|
3165
|
+
result = _context26.sent;
|
|
3036
3166
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
3037
|
-
|
|
3167
|
+
_context26.next = 12;
|
|
3038
3168
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
3039
3169
|
case 12:
|
|
3040
|
-
return
|
|
3170
|
+
return _context26.abrupt("return", result);
|
|
3041
3171
|
case 13:
|
|
3042
3172
|
case "end":
|
|
3043
|
-
return
|
|
3173
|
+
return _context26.stop();
|
|
3044
3174
|
}
|
|
3045
|
-
},
|
|
3175
|
+
}, _callee26, this);
|
|
3046
3176
|
}));
|
|
3047
3177
|
function loadProducts() {
|
|
3048
3178
|
return _loadProducts.apply(this, arguments);
|
|
@@ -3052,25 +3182,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3052
3182
|
}, {
|
|
3053
3183
|
key: "queryProducts",
|
|
3054
3184
|
value: function () {
|
|
3055
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3185
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
3056
3186
|
var params,
|
|
3057
|
-
|
|
3058
|
-
return _regeneratorRuntime().wrap(function
|
|
3059
|
-
while (1) switch (
|
|
3187
|
+
_args27 = arguments;
|
|
3188
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3189
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3060
3190
|
case 0:
|
|
3061
|
-
params =
|
|
3191
|
+
params = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
|
|
3062
3192
|
if (this.store.products) {
|
|
3063
|
-
|
|
3193
|
+
_context27.next = 3;
|
|
3064
3194
|
break;
|
|
3065
3195
|
}
|
|
3066
3196
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3067
3197
|
case 3:
|
|
3068
|
-
return
|
|
3198
|
+
return _context27.abrupt("return", this.store.products.queryProducts(params));
|
|
3069
3199
|
case 4:
|
|
3070
3200
|
case "end":
|
|
3071
|
-
return
|
|
3201
|
+
return _context27.stop();
|
|
3072
3202
|
}
|
|
3073
|
-
},
|
|
3203
|
+
}, _callee27, this);
|
|
3074
3204
|
}));
|
|
3075
3205
|
function queryProducts() {
|
|
3076
3206
|
return _queryProducts.apply(this, arguments);
|
|
@@ -3080,24 +3210,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3080
3210
|
}, {
|
|
3081
3211
|
key: "loadScheduleAvailableDate",
|
|
3082
3212
|
value: (function () {
|
|
3083
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3084
|
-
return _regeneratorRuntime().wrap(function
|
|
3085
|
-
while (1) switch (
|
|
3213
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3214
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3215
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3086
3216
|
case 0:
|
|
3087
3217
|
if (this.store.schedule) {
|
|
3088
|
-
|
|
3218
|
+
_context28.next = 2;
|
|
3089
3219
|
break;
|
|
3090
3220
|
}
|
|
3091
3221
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
3092
3222
|
case 2:
|
|
3093
|
-
return
|
|
3223
|
+
return _context28.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
3094
3224
|
case 3:
|
|
3095
3225
|
case "end":
|
|
3096
|
-
return
|
|
3226
|
+
return _context28.stop();
|
|
3097
3227
|
}
|
|
3098
|
-
},
|
|
3228
|
+
}, _callee28, this);
|
|
3099
3229
|
}));
|
|
3100
|
-
function loadScheduleAvailableDate(
|
|
3230
|
+
function loadScheduleAvailableDate(_x14) {
|
|
3101
3231
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
3102
3232
|
}
|
|
3103
3233
|
return loadScheduleAvailableDate;
|
|
@@ -3111,15 +3241,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3111
3241
|
}, {
|
|
3112
3242
|
key: "loadProductsByScheduleDate",
|
|
3113
3243
|
value: (function () {
|
|
3114
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3244
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3115
3245
|
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;
|
|
3116
|
-
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts,
|
|
3117
|
-
return _regeneratorRuntime().wrap(function
|
|
3118
|
-
while (1) switch (
|
|
3246
|
+
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator2, _step2, productId, result;
|
|
3247
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3248
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3119
3249
|
case 0:
|
|
3120
3250
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
3121
3251
|
if (this.store.schedule) {
|
|
3122
|
-
|
|
3252
|
+
_context29.next = 3;
|
|
3123
3253
|
break;
|
|
3124
3254
|
}
|
|
3125
3255
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -3130,10 +3260,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3130
3260
|
});
|
|
3131
3261
|
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;
|
|
3132
3262
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3133
|
-
|
|
3263
|
+
_context29.next = 9;
|
|
3134
3264
|
break;
|
|
3135
3265
|
}
|
|
3136
|
-
|
|
3266
|
+
_context29.next = 9;
|
|
3137
3267
|
return this.loadScheduleAvailableDate({
|
|
3138
3268
|
startDate: date,
|
|
3139
3269
|
endDate: date,
|
|
@@ -3153,45 +3283,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3153
3283
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3154
3284
|
});
|
|
3155
3285
|
if (availableProductIds.length) {
|
|
3156
|
-
|
|
3286
|
+
_context29.next = 17;
|
|
3157
3287
|
break;
|
|
3158
3288
|
}
|
|
3159
3289
|
this.unifiedProductCatalog = [];
|
|
3160
|
-
|
|
3290
|
+
_context29.next = 16;
|
|
3161
3291
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3162
3292
|
case 16:
|
|
3163
|
-
return
|
|
3293
|
+
return _context29.abrupt("return", []);
|
|
3164
3294
|
case 17:
|
|
3165
|
-
|
|
3295
|
+
_context29.next = 19;
|
|
3166
3296
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3167
3297
|
product_ids: availableProductIds,
|
|
3168
3298
|
schedule_date: date
|
|
3169
3299
|
}));
|
|
3170
3300
|
case 19:
|
|
3171
|
-
products =
|
|
3301
|
+
products = _context29.sent;
|
|
3172
3302
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3173
|
-
|
|
3303
|
+
_context29.next = 22;
|
|
3174
3304
|
break;
|
|
3175
3305
|
}
|
|
3176
|
-
return
|
|
3306
|
+
return _context29.abrupt("return", products);
|
|
3177
3307
|
case 22:
|
|
3178
3308
|
fallbackProducts = [];
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3309
|
+
_iterator2 = _createForOfIteratorHelper(availableProductIds);
|
|
3310
|
+
_context29.prev = 24;
|
|
3311
|
+
_iterator2.s();
|
|
3182
3312
|
case 26:
|
|
3183
|
-
if ((
|
|
3184
|
-
|
|
3313
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
3314
|
+
_context29.next = 34;
|
|
3185
3315
|
break;
|
|
3186
3316
|
}
|
|
3187
|
-
productId =
|
|
3188
|
-
|
|
3317
|
+
productId = _step2.value;
|
|
3318
|
+
_context29.next = 30;
|
|
3189
3319
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3190
3320
|
product_ids: [productId],
|
|
3191
3321
|
schedule_date: date
|
|
3192
3322
|
}));
|
|
3193
3323
|
case 30:
|
|
3194
|
-
result =
|
|
3324
|
+
result = _context29.sent;
|
|
3195
3325
|
result.forEach(function (product) {
|
|
3196
3326
|
var _id;
|
|
3197
3327
|
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;
|
|
@@ -3203,32 +3333,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3203
3333
|
}
|
|
3204
3334
|
});
|
|
3205
3335
|
case 32:
|
|
3206
|
-
|
|
3336
|
+
_context29.next = 26;
|
|
3207
3337
|
break;
|
|
3208
3338
|
case 34:
|
|
3209
|
-
|
|
3339
|
+
_context29.next = 39;
|
|
3210
3340
|
break;
|
|
3211
3341
|
case 36:
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3342
|
+
_context29.prev = 36;
|
|
3343
|
+
_context29.t0 = _context29["catch"](24);
|
|
3344
|
+
_iterator2.e(_context29.t0);
|
|
3215
3345
|
case 39:
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
return
|
|
3346
|
+
_context29.prev = 39;
|
|
3347
|
+
_iterator2.f();
|
|
3348
|
+
return _context29.finish(39);
|
|
3219
3349
|
case 42:
|
|
3220
3350
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3221
|
-
|
|
3351
|
+
_context29.next = 45;
|
|
3222
3352
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3223
3353
|
case 45:
|
|
3224
|
-
return
|
|
3354
|
+
return _context29.abrupt("return", fallbackProducts);
|
|
3225
3355
|
case 46:
|
|
3226
3356
|
case "end":
|
|
3227
|
-
return
|
|
3357
|
+
return _context29.stop();
|
|
3228
3358
|
}
|
|
3229
|
-
},
|
|
3359
|
+
}, _callee29, this, [[24, 36, 39, 42]]);
|
|
3230
3360
|
}));
|
|
3231
|
-
function loadProductsByScheduleDate(
|
|
3361
|
+
function loadProductsByScheduleDate(_x15) {
|
|
3232
3362
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3233
3363
|
}
|
|
3234
3364
|
return loadProductsByScheduleDate;
|
|
@@ -3281,7 +3411,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3281
3411
|
}, {
|
|
3282
3412
|
key: "applyPlannerDiscounts",
|
|
3283
3413
|
value: (function () {
|
|
3284
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3414
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3285
3415
|
var _params$customerId;
|
|
3286
3416
|
var params,
|
|
3287
3417
|
tempOrder,
|
|
@@ -3293,29 +3423,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3293
3423
|
preferredDiscount,
|
|
3294
3424
|
preferredId,
|
|
3295
3425
|
selectedOtherDiscounts,
|
|
3296
|
-
|
|
3297
|
-
|
|
3426
|
+
_iterator3,
|
|
3427
|
+
_step3,
|
|
3298
3428
|
discount,
|
|
3299
3429
|
discountId,
|
|
3300
3430
|
nextTempOrder,
|
|
3301
|
-
|
|
3302
|
-
return _regeneratorRuntime().wrap(function
|
|
3303
|
-
while (1) switch (
|
|
3431
|
+
_args30 = arguments;
|
|
3432
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3433
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3304
3434
|
case 0:
|
|
3305
|
-
params =
|
|
3435
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
3306
3436
|
tempOrder = this.getTempOrder();
|
|
3307
3437
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3308
3438
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3309
3439
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3310
|
-
|
|
3440
|
+
_context30.next = 7;
|
|
3311
3441
|
return this.getSummary();
|
|
3312
3442
|
case 7:
|
|
3313
|
-
summaryBefore =
|
|
3443
|
+
summaryBefore = _context30.sent;
|
|
3314
3444
|
if (customerId) {
|
|
3315
|
-
|
|
3445
|
+
_context30.next = 10;
|
|
3316
3446
|
break;
|
|
3317
3447
|
}
|
|
3318
|
-
return
|
|
3448
|
+
return _context30.abrupt("return", buildPlannerDiscountResult({
|
|
3319
3449
|
customerId: null,
|
|
3320
3450
|
discountList: this.getDiscountList(),
|
|
3321
3451
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3324,7 +3454,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3324
3454
|
status: 'no_customer'
|
|
3325
3455
|
}));
|
|
3326
3456
|
case 10:
|
|
3327
|
-
|
|
3457
|
+
_context30.next = 12;
|
|
3328
3458
|
return this.loadDiscountConfig({
|
|
3329
3459
|
customerId: customerId,
|
|
3330
3460
|
action: 'create'
|
|
@@ -3336,7 +3466,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3336
3466
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3337
3467
|
});
|
|
3338
3468
|
if (!preferredDiscount) {
|
|
3339
|
-
|
|
3469
|
+
_context30.next = 40;
|
|
3340
3470
|
break;
|
|
3341
3471
|
}
|
|
3342
3472
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3347,99 +3477,99 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3347
3477
|
var _resolvePlannerDiscou2;
|
|
3348
3478
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3349
3479
|
});
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3480
|
+
_iterator3 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
3481
|
+
_context30.prev = 18;
|
|
3482
|
+
_iterator3.s();
|
|
3353
3483
|
case 20:
|
|
3354
|
-
if ((
|
|
3355
|
-
|
|
3484
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
3485
|
+
_context30.next = 28;
|
|
3356
3486
|
break;
|
|
3357
3487
|
}
|
|
3358
|
-
discount =
|
|
3488
|
+
discount = _step3.value;
|
|
3359
3489
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3360
3490
|
if (!Number.isFinite(discountId)) {
|
|
3361
|
-
|
|
3491
|
+
_context30.next = 26;
|
|
3362
3492
|
break;
|
|
3363
3493
|
}
|
|
3364
|
-
|
|
3494
|
+
_context30.next = 26;
|
|
3365
3495
|
return this.setDiscountSelected({
|
|
3366
3496
|
discountId: discountId,
|
|
3367
3497
|
isSelected: false
|
|
3368
3498
|
});
|
|
3369
3499
|
case 26:
|
|
3370
|
-
|
|
3500
|
+
_context30.next = 20;
|
|
3371
3501
|
break;
|
|
3372
3502
|
case 28:
|
|
3373
|
-
|
|
3503
|
+
_context30.next = 33;
|
|
3374
3504
|
break;
|
|
3375
3505
|
case 30:
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3506
|
+
_context30.prev = 30;
|
|
3507
|
+
_context30.t0 = _context30["catch"](18);
|
|
3508
|
+
_iterator3.e(_context30.t0);
|
|
3379
3509
|
case 33:
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
return
|
|
3510
|
+
_context30.prev = 33;
|
|
3511
|
+
_iterator3.f();
|
|
3512
|
+
return _context30.finish(33);
|
|
3383
3513
|
case 36:
|
|
3384
|
-
|
|
3514
|
+
_context30.next = 38;
|
|
3385
3515
|
return this.setDiscountSelected({
|
|
3386
3516
|
discountId: Number(preferredId),
|
|
3387
3517
|
isSelected: true
|
|
3388
3518
|
});
|
|
3389
3519
|
case 38:
|
|
3390
|
-
|
|
3520
|
+
_context30.next = 49;
|
|
3391
3521
|
break;
|
|
3392
3522
|
case 40:
|
|
3393
3523
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3394
|
-
|
|
3524
|
+
_context30.next = 46;
|
|
3395
3525
|
break;
|
|
3396
3526
|
}
|
|
3397
3527
|
if (!(params.applyBestDiscount !== false)) {
|
|
3398
|
-
|
|
3528
|
+
_context30.next = 44;
|
|
3399
3529
|
break;
|
|
3400
3530
|
}
|
|
3401
|
-
|
|
3531
|
+
_context30.next = 44;
|
|
3402
3532
|
return this.bestDiscount();
|
|
3403
3533
|
case 44:
|
|
3404
|
-
|
|
3534
|
+
_context30.next = 49;
|
|
3405
3535
|
break;
|
|
3406
3536
|
case 46:
|
|
3407
3537
|
if (!(params.applyBestDiscount !== false)) {
|
|
3408
|
-
|
|
3538
|
+
_context30.next = 49;
|
|
3409
3539
|
break;
|
|
3410
3540
|
}
|
|
3411
|
-
|
|
3541
|
+
_context30.next = 49;
|
|
3412
3542
|
return this.bestDiscount();
|
|
3413
3543
|
case 49:
|
|
3414
3544
|
nextTempOrder = this.getTempOrder();
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3545
|
+
_context30.t1 = buildPlannerDiscountResult;
|
|
3546
|
+
_context30.t2 = customerId;
|
|
3547
|
+
_context30.t3 = this.getDiscountList();
|
|
3548
|
+
_context30.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3549
|
+
_context30.t5 = summaryBefore;
|
|
3550
|
+
_context30.next = 57;
|
|
3421
3551
|
return this.getSummary();
|
|
3422
3552
|
case 57:
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
customerId:
|
|
3429
|
-
discountList:
|
|
3430
|
-
products:
|
|
3431
|
-
summaryBefore:
|
|
3432
|
-
summaryAfter:
|
|
3433
|
-
status:
|
|
3434
|
-
preferredDiscountId:
|
|
3435
|
-
preferredDiscountFound:
|
|
3553
|
+
_context30.t6 = _context30.sent;
|
|
3554
|
+
_context30.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3555
|
+
_context30.t8 = preferredDiscountId;
|
|
3556
|
+
_context30.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3557
|
+
_context30.t10 = {
|
|
3558
|
+
customerId: _context30.t2,
|
|
3559
|
+
discountList: _context30.t3,
|
|
3560
|
+
products: _context30.t4,
|
|
3561
|
+
summaryBefore: _context30.t5,
|
|
3562
|
+
summaryAfter: _context30.t6,
|
|
3563
|
+
status: _context30.t7,
|
|
3564
|
+
preferredDiscountId: _context30.t8,
|
|
3565
|
+
preferredDiscountFound: _context30.t9
|
|
3436
3566
|
};
|
|
3437
|
-
return
|
|
3567
|
+
return _context30.abrupt("return", (0, _context30.t1)(_context30.t10));
|
|
3438
3568
|
case 63:
|
|
3439
3569
|
case "end":
|
|
3440
|
-
return
|
|
3570
|
+
return _context30.stop();
|
|
3441
3571
|
}
|
|
3442
|
-
},
|
|
3572
|
+
}, _callee30, this, [[18, 30, 33, 36]]);
|
|
3443
3573
|
}));
|
|
3444
3574
|
function applyPlannerDiscounts() {
|
|
3445
3575
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3477,29 +3607,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3477
3607
|
}, {
|
|
3478
3608
|
key: "removeExistingStagedLines",
|
|
3479
3609
|
value: (function () {
|
|
3480
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3610
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(ownershipKey) {
|
|
3481
3611
|
var _this$getTempOrder;
|
|
3482
3612
|
var existingLines;
|
|
3483
|
-
return _regeneratorRuntime().wrap(function
|
|
3484
|
-
while (1) switch (
|
|
3613
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3614
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3485
3615
|
case 0:
|
|
3486
3616
|
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
3487
3617
|
var _product$metadata4;
|
|
3488
3618
|
return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
|
|
3489
3619
|
});
|
|
3490
3620
|
if (!(existingLines.length > 0)) {
|
|
3491
|
-
|
|
3621
|
+
_context31.next = 4;
|
|
3492
3622
|
break;
|
|
3493
3623
|
}
|
|
3494
|
-
|
|
3624
|
+
_context31.next = 4;
|
|
3495
3625
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3496
3626
|
case 4:
|
|
3497
3627
|
case "end":
|
|
3498
|
-
return
|
|
3628
|
+
return _context31.stop();
|
|
3499
3629
|
}
|
|
3500
|
-
},
|
|
3630
|
+
}, _callee31, this);
|
|
3501
3631
|
}));
|
|
3502
|
-
function removeExistingStagedLines(
|
|
3632
|
+
function removeExistingStagedLines(_x16) {
|
|
3503
3633
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3504
3634
|
}
|
|
3505
3635
|
return removeExistingStagedLines;
|
|
@@ -3507,25 +3637,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3507
3637
|
}, {
|
|
3508
3638
|
key: "stageProducts",
|
|
3509
3639
|
value: function () {
|
|
3510
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3640
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params, ownershipKey) {
|
|
3511
3641
|
var _params$rawProducts;
|
|
3512
3642
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
3513
|
-
return _regeneratorRuntime().wrap(function
|
|
3514
|
-
while (1) switch (
|
|
3643
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3644
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3515
3645
|
case 0:
|
|
3516
3646
|
productIds = params.productIds || [];
|
|
3517
3647
|
if (productIds.length) {
|
|
3518
|
-
|
|
3648
|
+
_context32.next = 3;
|
|
3519
3649
|
break;
|
|
3520
3650
|
}
|
|
3521
|
-
return
|
|
3651
|
+
return _context32.abrupt("return", this.getTempOrder());
|
|
3522
3652
|
case 3:
|
|
3523
3653
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3524
|
-
|
|
3654
|
+
_context32.next = 7;
|
|
3525
3655
|
break;
|
|
3526
3656
|
}
|
|
3527
3657
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3528
|
-
|
|
3658
|
+
_context32.next = 12;
|
|
3529
3659
|
break;
|
|
3530
3660
|
case 7:
|
|
3531
3661
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -3536,15 +3666,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3536
3666
|
return !existingIds.has(String(id));
|
|
3537
3667
|
});
|
|
3538
3668
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3539
|
-
|
|
3669
|
+
_context32.next = 12;
|
|
3540
3670
|
break;
|
|
3541
3671
|
}
|
|
3542
|
-
|
|
3672
|
+
_context32.next = 12;
|
|
3543
3673
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3544
3674
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3545
3675
|
}));
|
|
3546
3676
|
case 12:
|
|
3547
|
-
|
|
3677
|
+
_context32.next = 14;
|
|
3548
3678
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3549
3679
|
case 14:
|
|
3550
3680
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -3557,30 +3687,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3557
3687
|
_i = 0, _arr = selectedProducts;
|
|
3558
3688
|
case 17:
|
|
3559
3689
|
if (!(_i < _arr.length)) {
|
|
3560
|
-
|
|
3690
|
+
_context32.next = 26;
|
|
3561
3691
|
break;
|
|
3562
3692
|
}
|
|
3563
3693
|
sourceProduct = _arr[_i];
|
|
3564
3694
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3565
3695
|
if (!productInput) {
|
|
3566
|
-
|
|
3696
|
+
_context32.next = 23;
|
|
3567
3697
|
break;
|
|
3568
3698
|
}
|
|
3569
|
-
|
|
3699
|
+
_context32.next = 23;
|
|
3570
3700
|
return this.addProductToOrder(productInput);
|
|
3571
3701
|
case 23:
|
|
3572
3702
|
_i++;
|
|
3573
|
-
|
|
3703
|
+
_context32.next = 17;
|
|
3574
3704
|
break;
|
|
3575
3705
|
case 26:
|
|
3576
|
-
return
|
|
3706
|
+
return _context32.abrupt("return", this.getTempOrder());
|
|
3577
3707
|
case 27:
|
|
3578
3708
|
case "end":
|
|
3579
|
-
return
|
|
3709
|
+
return _context32.stop();
|
|
3580
3710
|
}
|
|
3581
|
-
},
|
|
3711
|
+
}, _callee32, this);
|
|
3582
3712
|
}));
|
|
3583
|
-
function stageProducts(
|
|
3713
|
+
function stageProducts(_x17, _x18) {
|
|
3584
3714
|
return _stageProducts.apply(this, arguments);
|
|
3585
3715
|
}
|
|
3586
3716
|
return stageProducts;
|
|
@@ -3592,18 +3722,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3592
3722
|
}, {
|
|
3593
3723
|
key: "stageRetailProducts",
|
|
3594
3724
|
value: (function () {
|
|
3595
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3596
|
-
return _regeneratorRuntime().wrap(function
|
|
3597
|
-
while (1) switch (
|
|
3725
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3726
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3727
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3598
3728
|
case 0:
|
|
3599
|
-
return
|
|
3729
|
+
return _context33.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3600
3730
|
case 1:
|
|
3601
3731
|
case "end":
|
|
3602
|
-
return
|
|
3732
|
+
return _context33.stop();
|
|
3603
3733
|
}
|
|
3604
|
-
},
|
|
3734
|
+
}, _callee33, this);
|
|
3605
3735
|
}));
|
|
3606
|
-
function stageRetailProducts(
|
|
3736
|
+
function stageRetailProducts(_x19) {
|
|
3607
3737
|
return _stageRetailProducts.apply(this, arguments);
|
|
3608
3738
|
}
|
|
3609
3739
|
return stageRetailProducts;
|
|
@@ -3617,15 +3747,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3617
3747
|
}, {
|
|
3618
3748
|
key: "addRetailProduct",
|
|
3619
3749
|
value: (function () {
|
|
3620
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3750
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3621
3751
|
var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
|
|
3622
3752
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
3623
|
-
return _regeneratorRuntime().wrap(function
|
|
3624
|
-
while (1) switch (
|
|
3753
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3754
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3625
3755
|
case 0:
|
|
3626
3756
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
3627
3757
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
3628
|
-
|
|
3758
|
+
_context34.next = 3;
|
|
3629
3759
|
break;
|
|
3630
3760
|
}
|
|
3631
3761
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
@@ -3639,22 +3769,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3639
3769
|
});
|
|
3640
3770
|
}
|
|
3641
3771
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
3642
|
-
|
|
3772
|
+
_context34.next = 11;
|
|
3643
3773
|
break;
|
|
3644
3774
|
}
|
|
3645
|
-
|
|
3775
|
+
_context34.next = 9;
|
|
3646
3776
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3647
3777
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
3648
3778
|
}));
|
|
3649
3779
|
case 9:
|
|
3650
|
-
products =
|
|
3780
|
+
products = _context34.sent;
|
|
3651
3781
|
sourceProduct = products.find(function (product) {
|
|
3652
3782
|
var _product$id4;
|
|
3653
3783
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
3654
3784
|
});
|
|
3655
3785
|
case 11:
|
|
3656
3786
|
if (sourceProduct) {
|
|
3657
|
-
|
|
3787
|
+
_context34.next = 13;
|
|
3658
3788
|
break;
|
|
3659
3789
|
}
|
|
3660
3790
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3663,19 +3793,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3663
3793
|
quantity: quantity
|
|
3664
3794
|
}), 'unified_booking_sales_retail');
|
|
3665
3795
|
if (orderProduct) {
|
|
3666
|
-
|
|
3796
|
+
_context34.next = 16;
|
|
3667
3797
|
break;
|
|
3668
3798
|
}
|
|
3669
3799
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3670
3800
|
case 16:
|
|
3671
|
-
return
|
|
3801
|
+
return _context34.abrupt("return", this.addProductToOrder(orderProduct));
|
|
3672
3802
|
case 17:
|
|
3673
3803
|
case "end":
|
|
3674
|
-
return
|
|
3804
|
+
return _context34.stop();
|
|
3675
3805
|
}
|
|
3676
|
-
},
|
|
3806
|
+
}, _callee34, this);
|
|
3677
3807
|
}));
|
|
3678
|
-
function addRetailProduct(
|
|
3808
|
+
function addRetailProduct(_x20) {
|
|
3679
3809
|
return _addRetailProduct.apply(this, arguments);
|
|
3680
3810
|
}
|
|
3681
3811
|
return addRetailProduct;
|
|
@@ -3877,46 +4007,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3877
4007
|
}, {
|
|
3878
4008
|
key: "loadAvailabilityProducts",
|
|
3879
4009
|
value: function () {
|
|
3880
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4010
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3881
4011
|
var _prepare$catalogScope,
|
|
3882
4012
|
_prepare$catalogScope2,
|
|
3883
4013
|
_this8 = this,
|
|
3884
4014
|
_prepare$resourceIds;
|
|
3885
4015
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3886
|
-
return _regeneratorRuntime().wrap(function
|
|
3887
|
-
while (1) switch (
|
|
4016
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
4017
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3888
4018
|
case 0:
|
|
3889
4019
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3890
4020
|
explicitProductIds = prepare.productIds || [];
|
|
3891
4021
|
rawProducts = [];
|
|
3892
4022
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3893
|
-
|
|
4023
|
+
_context35.next = 8;
|
|
3894
4024
|
break;
|
|
3895
4025
|
}
|
|
3896
4026
|
rawProducts = prepare.rawProducts;
|
|
3897
4027
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3898
|
-
|
|
4028
|
+
_context35.next = 34;
|
|
3899
4029
|
break;
|
|
3900
4030
|
case 8:
|
|
3901
4031
|
if (!(explicitProductIds.length > 0)) {
|
|
3902
|
-
|
|
4032
|
+
_context35.next = 14;
|
|
3903
4033
|
break;
|
|
3904
4034
|
}
|
|
3905
|
-
|
|
4035
|
+
_context35.next = 11;
|
|
3906
4036
|
return this.loadProducts({
|
|
3907
4037
|
product_ids: explicitProductIds,
|
|
3908
4038
|
schedule_date: dateRange.startDate
|
|
3909
4039
|
});
|
|
3910
4040
|
case 11:
|
|
3911
|
-
rawProducts =
|
|
3912
|
-
|
|
4041
|
+
rawProducts = _context35.sent;
|
|
4042
|
+
_context35.next = 34;
|
|
3913
4043
|
break;
|
|
3914
4044
|
case 14:
|
|
3915
4045
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
3916
|
-
|
|
4046
|
+
_context35.next = 30;
|
|
3917
4047
|
break;
|
|
3918
4048
|
}
|
|
3919
|
-
|
|
4049
|
+
_context35.next = 17;
|
|
3920
4050
|
return this.loadScheduleAvailableDate({
|
|
3921
4051
|
startDate: dateRange.startDate,
|
|
3922
4052
|
endDate: dateRange.endDate,
|
|
@@ -3932,44 +4062,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3932
4062
|
});
|
|
3933
4063
|
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)) || [])));
|
|
3934
4064
|
if (!(productIds.length > 0)) {
|
|
3935
|
-
|
|
4065
|
+
_context35.next = 27;
|
|
3936
4066
|
break;
|
|
3937
4067
|
}
|
|
3938
4068
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3939
|
-
|
|
4069
|
+
_context35.next = 24;
|
|
3940
4070
|
return this.loadProducts({
|
|
3941
4071
|
product_ids: productIds,
|
|
3942
4072
|
schedule_date: dateRange.startDate
|
|
3943
4073
|
});
|
|
3944
4074
|
case 24:
|
|
3945
|
-
rawProducts =
|
|
3946
|
-
|
|
4075
|
+
rawProducts = _context35.sent;
|
|
4076
|
+
_context35.next = 28;
|
|
3947
4077
|
break;
|
|
3948
4078
|
case 27:
|
|
3949
4079
|
this.unifiedProductCatalog = [];
|
|
3950
4080
|
case 28:
|
|
3951
|
-
|
|
4081
|
+
_context35.next = 34;
|
|
3952
4082
|
break;
|
|
3953
4083
|
case 30:
|
|
3954
4084
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
3955
|
-
|
|
4085
|
+
_context35.next = 34;
|
|
3956
4086
|
break;
|
|
3957
4087
|
}
|
|
3958
|
-
|
|
4088
|
+
_context35.next = 33;
|
|
3959
4089
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3960
4090
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3961
4091
|
}));
|
|
3962
4092
|
case 33:
|
|
3963
|
-
rawProducts =
|
|
4093
|
+
rawProducts = _context35.sent;
|
|
3964
4094
|
case 34:
|
|
3965
4095
|
normalized = rawProducts.map(function (product) {
|
|
3966
4096
|
return normalizeProductForAvailability(product, params.scheduleList, _this8.getAvailabilityRuntimeOffsetMinutes());
|
|
3967
4097
|
});
|
|
3968
4098
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3969
|
-
|
|
4099
|
+
_context35.next = 37;
|
|
3970
4100
|
break;
|
|
3971
4101
|
}
|
|
3972
|
-
return
|
|
4102
|
+
return _context35.abrupt("return", normalized.filter(function (product) {
|
|
3973
4103
|
var _product$requirementG2;
|
|
3974
4104
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3975
4105
|
var _group$resourceIds3;
|
|
@@ -3982,16 +4112,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3982
4112
|
}));
|
|
3983
4113
|
case 37:
|
|
3984
4114
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3985
|
-
return
|
|
4115
|
+
return _context35.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3986
4116
|
return productIdSet.has(String(product.id));
|
|
3987
4117
|
}) : normalized);
|
|
3988
4118
|
case 39:
|
|
3989
4119
|
case "end":
|
|
3990
|
-
return
|
|
4120
|
+
return _context35.stop();
|
|
3991
4121
|
}
|
|
3992
|
-
},
|
|
4122
|
+
}, _callee35, this);
|
|
3993
4123
|
}));
|
|
3994
|
-
function loadAvailabilityProducts(
|
|
4124
|
+
function loadAvailabilityProducts(_x21) {
|
|
3995
4125
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3996
4126
|
}
|
|
3997
4127
|
return loadAvailabilityProducts;
|
|
@@ -4004,12 +4134,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4004
4134
|
}, {
|
|
4005
4135
|
key: "fetchAvailabilityResourcesV2",
|
|
4006
4136
|
value: (function () {
|
|
4007
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4137
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
4008
4138
|
var response, data;
|
|
4009
|
-
return _regeneratorRuntime().wrap(function
|
|
4010
|
-
while (1) switch (
|
|
4139
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
4140
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
4011
4141
|
case 0:
|
|
4012
|
-
|
|
4142
|
+
_context36.next = 2;
|
|
4013
4143
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4014
4144
|
start_date: params.dateRange.startDate,
|
|
4015
4145
|
end_date: params.dateRange.endDate,
|
|
@@ -4019,28 +4149,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4019
4149
|
useCache: false
|
|
4020
4150
|
});
|
|
4021
4151
|
case 2:
|
|
4022
|
-
response =
|
|
4152
|
+
response = _context36.sent;
|
|
4023
4153
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4024
4154
|
if (!Array.isArray(data)) {
|
|
4025
|
-
|
|
4155
|
+
_context36.next = 6;
|
|
4026
4156
|
break;
|
|
4027
4157
|
}
|
|
4028
|
-
return
|
|
4158
|
+
return _context36.abrupt("return", data);
|
|
4029
4159
|
case 6:
|
|
4030
4160
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4031
|
-
|
|
4161
|
+
_context36.next = 8;
|
|
4032
4162
|
break;
|
|
4033
4163
|
}
|
|
4034
|
-
return
|
|
4164
|
+
return _context36.abrupt("return", data.list);
|
|
4035
4165
|
case 8:
|
|
4036
|
-
return
|
|
4166
|
+
return _context36.abrupt("return", []);
|
|
4037
4167
|
case 9:
|
|
4038
4168
|
case "end":
|
|
4039
|
-
return
|
|
4169
|
+
return _context36.stop();
|
|
4040
4170
|
}
|
|
4041
|
-
},
|
|
4171
|
+
}, _callee36, this);
|
|
4042
4172
|
}));
|
|
4043
|
-
function fetchAvailabilityResourcesV2(
|
|
4173
|
+
function fetchAvailabilityResourcesV2(_x22) {
|
|
4044
4174
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4045
4175
|
}
|
|
4046
4176
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4048,17 +4178,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4048
4178
|
}, {
|
|
4049
4179
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4050
4180
|
value: function () {
|
|
4051
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4181
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
4052
4182
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4053
|
-
return _regeneratorRuntime().wrap(function
|
|
4054
|
-
while (1) switch (
|
|
4183
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4184
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
4055
4185
|
case 0:
|
|
4056
4186
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4057
4187
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4058
|
-
|
|
4188
|
+
_context37.next = 3;
|
|
4059
4189
|
break;
|
|
4060
4190
|
}
|
|
4061
|
-
return
|
|
4191
|
+
return _context37.abrupt("return", []);
|
|
4062
4192
|
case 3:
|
|
4063
4193
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4064
4194
|
cacheParams = {
|
|
@@ -4068,7 +4198,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4068
4198
|
};
|
|
4069
4199
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4070
4200
|
if (!cachedRawResources) {
|
|
4071
|
-
|
|
4201
|
+
_context37.next = 9;
|
|
4072
4202
|
break;
|
|
4073
4203
|
}
|
|
4074
4204
|
if (params.useCacheOnHit) {
|
|
@@ -4080,23 +4210,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4080
4210
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4081
4211
|
});
|
|
4082
4212
|
}
|
|
4083
|
-
return
|
|
4213
|
+
return _context37.abrupt("return", cachedRawResources);
|
|
4084
4214
|
case 9:
|
|
4085
|
-
|
|
4215
|
+
_context37.next = 11;
|
|
4086
4216
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4087
4217
|
timezone: params.timezone,
|
|
4088
4218
|
dateRange: params.dateRange,
|
|
4089
4219
|
resourceIds: normalizedResourceIds
|
|
4090
4220
|
});
|
|
4091
4221
|
case 11:
|
|
4092
|
-
return
|
|
4222
|
+
return _context37.abrupt("return", _context37.sent);
|
|
4093
4223
|
case 12:
|
|
4094
4224
|
case "end":
|
|
4095
|
-
return
|
|
4225
|
+
return _context37.stop();
|
|
4096
4226
|
}
|
|
4097
|
-
},
|
|
4227
|
+
}, _callee37, this);
|
|
4098
4228
|
}));
|
|
4099
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
4229
|
+
function fetchAndPublishAvailabilityResourcesV2(_x23) {
|
|
4100
4230
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4101
4231
|
}
|
|
4102
4232
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4104,17 +4234,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4104
4234
|
}, {
|
|
4105
4235
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4106
4236
|
value: function () {
|
|
4107
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4237
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
4108
4238
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
4109
|
-
return _regeneratorRuntime().wrap(function
|
|
4110
|
-
while (1) switch (
|
|
4239
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4240
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4111
4241
|
case 0:
|
|
4112
4242
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4113
4243
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4114
|
-
|
|
4244
|
+
_context38.next = 3;
|
|
4115
4245
|
break;
|
|
4116
4246
|
}
|
|
4117
|
-
return
|
|
4247
|
+
return _context38.abrupt("return", []);
|
|
4118
4248
|
case 3:
|
|
4119
4249
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4120
4250
|
timezone: params.timezone,
|
|
@@ -4124,13 +4254,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4124
4254
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4125
4255
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4126
4256
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4127
|
-
|
|
4257
|
+
_context38.next = 10;
|
|
4128
4258
|
break;
|
|
4129
4259
|
}
|
|
4130
|
-
|
|
4260
|
+
_context38.next = 9;
|
|
4131
4261
|
return existing.promise;
|
|
4132
4262
|
case 9:
|
|
4133
|
-
return
|
|
4263
|
+
return _context38.abrupt("return", _context38.sent);
|
|
4134
4264
|
case 10:
|
|
4135
4265
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4136
4266
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4142,11 +4272,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4142
4272
|
epoch: epoch,
|
|
4143
4273
|
promise: promise
|
|
4144
4274
|
});
|
|
4145
|
-
|
|
4146
|
-
|
|
4275
|
+
_context38.prev = 14;
|
|
4276
|
+
_context38.next = 17;
|
|
4147
4277
|
return promise;
|
|
4148
4278
|
case 17:
|
|
4149
|
-
rawResources =
|
|
4279
|
+
rawResources = _context38.sent;
|
|
4150
4280
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4151
4281
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4152
4282
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4157,21 +4287,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4157
4287
|
version: writeVersion
|
|
4158
4288
|
});
|
|
4159
4289
|
}
|
|
4160
|
-
return
|
|
4290
|
+
return _context38.abrupt("return", rawResources);
|
|
4161
4291
|
case 20:
|
|
4162
|
-
|
|
4292
|
+
_context38.prev = 20;
|
|
4163
4293
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4164
4294
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4165
4295
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4166
4296
|
}
|
|
4167
|
-
return
|
|
4297
|
+
return _context38.finish(20);
|
|
4168
4298
|
case 24:
|
|
4169
4299
|
case "end":
|
|
4170
|
-
return
|
|
4300
|
+
return _context38.stop();
|
|
4171
4301
|
}
|
|
4172
|
-
},
|
|
4302
|
+
}, _callee38, this, [[14,, 20, 24]]);
|
|
4173
4303
|
}));
|
|
4174
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4304
|
+
function refreshAvailabilityRemoteResourceQuery(_x24) {
|
|
4175
4305
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4176
4306
|
}
|
|
4177
4307
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4179,26 +4309,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4179
4309
|
}, {
|
|
4180
4310
|
key: "loadAvailabilityResources",
|
|
4181
4311
|
value: function () {
|
|
4182
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4312
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4183
4313
|
var resourceIds, cachedRawResources, rawResources;
|
|
4184
|
-
return _regeneratorRuntime().wrap(function
|
|
4185
|
-
while (1) switch (
|
|
4314
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4315
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4186
4316
|
case 0:
|
|
4187
4317
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4188
4318
|
if (!(resourceIds.length === 0)) {
|
|
4189
|
-
|
|
4319
|
+
_context39.next = 3;
|
|
4190
4320
|
break;
|
|
4191
4321
|
}
|
|
4192
|
-
return
|
|
4322
|
+
return _context39.abrupt("return", {
|
|
4193
4323
|
resources: [],
|
|
4194
4324
|
resourceOccupancies: []
|
|
4195
4325
|
});
|
|
4196
4326
|
case 3:
|
|
4197
4327
|
if (!Array.isArray(params.rawResources)) {
|
|
4198
|
-
|
|
4328
|
+
_context39.next = 5;
|
|
4199
4329
|
break;
|
|
4200
4330
|
}
|
|
4201
|
-
return
|
|
4331
|
+
return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4202
4332
|
rawResources: params.rawResources,
|
|
4203
4333
|
scheduleList: params.scheduleList,
|
|
4204
4334
|
dateRange: params.dateRange,
|
|
@@ -4206,7 +4336,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4206
4336
|
}));
|
|
4207
4337
|
case 5:
|
|
4208
4338
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4209
|
-
|
|
4339
|
+
_context39.next = 10;
|
|
4210
4340
|
break;
|
|
4211
4341
|
}
|
|
4212
4342
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4215,22 +4345,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4215
4345
|
dateRange: params.dateRange
|
|
4216
4346
|
});
|
|
4217
4347
|
if (!cachedRawResources) {
|
|
4218
|
-
|
|
4348
|
+
_context39.next = 9;
|
|
4219
4349
|
break;
|
|
4220
4350
|
}
|
|
4221
|
-
return
|
|
4351
|
+
return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4222
4352
|
rawResources: cachedRawResources,
|
|
4223
4353
|
scheduleList: params.scheduleList,
|
|
4224
4354
|
dateRange: params.dateRange,
|
|
4225
4355
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4226
4356
|
}));
|
|
4227
4357
|
case 9:
|
|
4228
|
-
return
|
|
4358
|
+
return _context39.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4229
4359
|
resources: [],
|
|
4230
4360
|
resourceOccupancies: []
|
|
4231
4361
|
});
|
|
4232
4362
|
case 10:
|
|
4233
|
-
|
|
4363
|
+
_context39.next = 12;
|
|
4234
4364
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
4235
4365
|
timezone: params.timezone,
|
|
4236
4366
|
dateRange: params.dateRange,
|
|
@@ -4238,8 +4368,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4238
4368
|
useCacheOnHit: true
|
|
4239
4369
|
});
|
|
4240
4370
|
case 12:
|
|
4241
|
-
rawResources =
|
|
4242
|
-
return
|
|
4371
|
+
rawResources = _context39.sent;
|
|
4372
|
+
return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4243
4373
|
rawResources: rawResources,
|
|
4244
4374
|
scheduleList: params.scheduleList,
|
|
4245
4375
|
dateRange: params.dateRange,
|
|
@@ -4247,11 +4377,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4247
4377
|
}));
|
|
4248
4378
|
case 14:
|
|
4249
4379
|
case "end":
|
|
4250
|
-
return
|
|
4380
|
+
return _context39.stop();
|
|
4251
4381
|
}
|
|
4252
|
-
},
|
|
4382
|
+
}, _callee39, this);
|
|
4253
4383
|
}));
|
|
4254
|
-
function loadAvailabilityResources(
|
|
4384
|
+
function loadAvailabilityResources(_x25) {
|
|
4255
4385
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4256
4386
|
}
|
|
4257
4387
|
return loadAvailabilityResources;
|
|
@@ -4482,7 +4612,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4482
4612
|
}, {
|
|
4483
4613
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4484
4614
|
value: function () {
|
|
4485
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4615
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4486
4616
|
var _this11 = this;
|
|
4487
4617
|
var options,
|
|
4488
4618
|
normalizedPrepareParams,
|
|
@@ -4506,23 +4636,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4506
4636
|
durationCandidateAnchorAt,
|
|
4507
4637
|
orderRevision,
|
|
4508
4638
|
projection,
|
|
4509
|
-
|
|
4510
|
-
return _regeneratorRuntime().wrap(function
|
|
4511
|
-
while (1) switch (
|
|
4639
|
+
_args40 = arguments;
|
|
4640
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4641
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4512
4642
|
case 0:
|
|
4513
|
-
options =
|
|
4643
|
+
options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
|
|
4514
4644
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4515
4645
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4516
4646
|
dateRange = normalizedPrepareParams.dateRange;
|
|
4517
4647
|
scheduleList = this.getAvailabilityScheduleCatalog();
|
|
4518
|
-
|
|
4648
|
+
_context40.next = 7;
|
|
4519
4649
|
return this.loadAvailabilityProducts({
|
|
4520
4650
|
prepare: normalizedPrepareParams,
|
|
4521
4651
|
dateRange: dateRange,
|
|
4522
4652
|
scheduleList: scheduleList
|
|
4523
4653
|
});
|
|
4524
4654
|
case 7:
|
|
4525
|
-
products =
|
|
4655
|
+
products = _context40.sent;
|
|
4526
4656
|
// Coverage is physical local time; the caller's date range remains business
|
|
4527
4657
|
// dates. Keep yesterday's opening and the last business day's overnight tail.
|
|
4528
4658
|
useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
|
|
@@ -4544,7 +4674,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4544
4674
|
scheduleList: scheduleList,
|
|
4545
4675
|
businessHours: businessHours
|
|
4546
4676
|
});
|
|
4547
|
-
|
|
4677
|
+
_context40.next = 16;
|
|
4548
4678
|
return this.loadAvailabilityResources({
|
|
4549
4679
|
timezone: timezoneLabel,
|
|
4550
4680
|
dateRange: coverageDateRange,
|
|
@@ -4556,7 +4686,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4556
4686
|
fallbackResources: options.fallbackResources
|
|
4557
4687
|
});
|
|
4558
4688
|
case 16:
|
|
4559
|
-
loadedResources =
|
|
4689
|
+
loadedResources = _context40.sent;
|
|
4560
4690
|
tempOrder = this.getTempOrder();
|
|
4561
4691
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4562
4692
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
@@ -4602,18 +4732,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4602
4732
|
prepareParams: normalizedPrepareParams,
|
|
4603
4733
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4604
4734
|
});
|
|
4605
|
-
return
|
|
4735
|
+
return _context40.abrupt("return", {
|
|
4606
4736
|
projection: projection,
|
|
4607
4737
|
prepareParams: normalizedPrepareParams,
|
|
4608
4738
|
orderRevision: orderRevision
|
|
4609
4739
|
});
|
|
4610
4740
|
case 28:
|
|
4611
4741
|
case "end":
|
|
4612
|
-
return
|
|
4742
|
+
return _context40.stop();
|
|
4613
4743
|
}
|
|
4614
|
-
},
|
|
4744
|
+
}, _callee40, this);
|
|
4615
4745
|
}));
|
|
4616
|
-
function buildAvailabilityProjectionSnapshot(
|
|
4746
|
+
function buildAvailabilityProjectionSnapshot(_x26) {
|
|
4617
4747
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
4618
4748
|
}
|
|
4619
4749
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -4621,10 +4751,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4621
4751
|
}, {
|
|
4622
4752
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
4623
4753
|
value: function () {
|
|
4624
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4754
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4625
4755
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
4626
|
-
return _regeneratorRuntime().wrap(function
|
|
4627
|
-
while (1) switch (
|
|
4756
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4757
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4628
4758
|
case 0:
|
|
4629
4759
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4630
4760
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -4643,15 +4773,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4643
4773
|
}
|
|
4644
4774
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
4645
4775
|
if (!hasRawInputs) {
|
|
4646
|
-
|
|
4776
|
+
_context41.next = 11;
|
|
4647
4777
|
break;
|
|
4648
4778
|
}
|
|
4649
|
-
|
|
4779
|
+
_context41.next = 7;
|
|
4650
4780
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
4651
4781
|
case 7:
|
|
4652
|
-
snapshot =
|
|
4782
|
+
snapshot = _context41.sent;
|
|
4653
4783
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4654
|
-
|
|
4784
|
+
_context41.next = 10;
|
|
4655
4785
|
break;
|
|
4656
4786
|
}
|
|
4657
4787
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4660,7 +4790,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4660
4790
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4661
4791
|
});
|
|
4662
4792
|
case 10:
|
|
4663
|
-
return
|
|
4793
|
+
return _context41.abrupt("return", {
|
|
4664
4794
|
prepareKey: prepareKey,
|
|
4665
4795
|
snapshot: snapshot
|
|
4666
4796
|
});
|
|
@@ -4674,13 +4804,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4674
4804
|
promise: promise
|
|
4675
4805
|
});
|
|
4676
4806
|
}
|
|
4677
|
-
|
|
4678
|
-
|
|
4807
|
+
_context41.prev = 14;
|
|
4808
|
+
_context41.next = 17;
|
|
4679
4809
|
return promise;
|
|
4680
4810
|
case 17:
|
|
4681
|
-
_snapshot =
|
|
4811
|
+
_snapshot = _context41.sent;
|
|
4682
4812
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4683
|
-
|
|
4813
|
+
_context41.next = 20;
|
|
4684
4814
|
break;
|
|
4685
4815
|
}
|
|
4686
4816
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4689,24 +4819,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4689
4819
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4690
4820
|
});
|
|
4691
4821
|
case 20:
|
|
4692
|
-
return
|
|
4822
|
+
return _context41.abrupt("return", {
|
|
4693
4823
|
prepareKey: prepareKey,
|
|
4694
4824
|
snapshot: _snapshot
|
|
4695
4825
|
});
|
|
4696
4826
|
case 21:
|
|
4697
|
-
|
|
4827
|
+
_context41.prev = 21;
|
|
4698
4828
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4699
4829
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4700
4830
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4701
4831
|
}
|
|
4702
|
-
return
|
|
4832
|
+
return _context41.finish(21);
|
|
4703
4833
|
case 25:
|
|
4704
4834
|
case "end":
|
|
4705
|
-
return
|
|
4835
|
+
return _context41.stop();
|
|
4706
4836
|
}
|
|
4707
|
-
},
|
|
4837
|
+
}, _callee41, this, [[14,, 21, 25]]);
|
|
4708
4838
|
}));
|
|
4709
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
4839
|
+
function getSharedPreparedAvailabilitySnapshot(_x27) {
|
|
4710
4840
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4711
4841
|
}
|
|
4712
4842
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4714,49 +4844,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4714
4844
|
}, {
|
|
4715
4845
|
key: "refreshAvailabilityContextProjection",
|
|
4716
4846
|
value: function () {
|
|
4717
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4847
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4718
4848
|
var _this12 = this;
|
|
4719
4849
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4720
|
-
return _regeneratorRuntime().wrap(function
|
|
4721
|
-
while (1) switch (
|
|
4850
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4851
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4722
4852
|
case 0:
|
|
4723
4853
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4724
4854
|
if (!existingInFlight) {
|
|
4725
|
-
|
|
4855
|
+
_context43.next = 5;
|
|
4726
4856
|
break;
|
|
4727
4857
|
}
|
|
4728
|
-
|
|
4858
|
+
_context43.next = 4;
|
|
4729
4859
|
return existingInFlight;
|
|
4730
4860
|
case 4:
|
|
4731
|
-
return
|
|
4861
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4732
4862
|
case 5:
|
|
4733
4863
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4734
4864
|
expectedVersion = context.activeVersion;
|
|
4735
4865
|
expectedRefreshNonce = context.refreshNonce;
|
|
4736
4866
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4737
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4867
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
4738
4868
|
var snapshot, currentContext, projectionEntry;
|
|
4739
|
-
return _regeneratorRuntime().wrap(function
|
|
4740
|
-
while (1) switch (
|
|
4869
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4870
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4741
4871
|
case 0:
|
|
4742
|
-
|
|
4872
|
+
_context42.next = 2;
|
|
4743
4873
|
return _this12.buildAvailabilityProjectionSnapshot(_this12.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4744
4874
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4745
4875
|
});
|
|
4746
4876
|
case 2:
|
|
4747
|
-
snapshot =
|
|
4877
|
+
snapshot = _context42.sent;
|
|
4748
4878
|
currentContext = _this12.availabilityContextRegistry.get(params.contextId);
|
|
4749
4879
|
if (currentContext) {
|
|
4750
|
-
|
|
4880
|
+
_context42.next = 6;
|
|
4751
4881
|
break;
|
|
4752
4882
|
}
|
|
4753
|
-
return
|
|
4883
|
+
return _context42.abrupt("return", null);
|
|
4754
4884
|
case 6:
|
|
4755
4885
|
if (!(expectedLifecycleGeneration !== _this12.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
4756
|
-
|
|
4886
|
+
_context42.next = 8;
|
|
4757
4887
|
break;
|
|
4758
4888
|
}
|
|
4759
|
-
return
|
|
4889
|
+
return _context42.abrupt("return", null);
|
|
4760
4890
|
case 8:
|
|
4761
4891
|
projectionEntry = _this12.storeAvailabilityProjectionEntry({
|
|
4762
4892
|
contextId: currentContext.contextId,
|
|
@@ -4766,7 +4896,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4766
4896
|
orderRevision: snapshot.orderRevision,
|
|
4767
4897
|
incrementVersion: true
|
|
4768
4898
|
});
|
|
4769
|
-
|
|
4899
|
+
_context42.next = 11;
|
|
4770
4900
|
return _this12.emitAvailabilityDiagnostic({
|
|
4771
4901
|
action: 'refresh',
|
|
4772
4902
|
contextId: currentContext.contextId,
|
|
@@ -4778,33 +4908,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4778
4908
|
reason: params.reason
|
|
4779
4909
|
});
|
|
4780
4910
|
case 11:
|
|
4781
|
-
return
|
|
4911
|
+
return _context42.abrupt("return", projectionEntry);
|
|
4782
4912
|
case 12:
|
|
4783
4913
|
case "end":
|
|
4784
|
-
return
|
|
4914
|
+
return _context42.stop();
|
|
4785
4915
|
}
|
|
4786
|
-
},
|
|
4916
|
+
}, _callee42);
|
|
4787
4917
|
}))();
|
|
4788
4918
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4789
|
-
|
|
4790
|
-
|
|
4919
|
+
_context43.prev = 11;
|
|
4920
|
+
_context43.next = 14;
|
|
4791
4921
|
return refreshPromise;
|
|
4792
4922
|
case 14:
|
|
4793
|
-
return
|
|
4923
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4794
4924
|
case 15:
|
|
4795
|
-
|
|
4925
|
+
_context43.prev = 15;
|
|
4796
4926
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4797
4927
|
if (current === refreshPromise) {
|
|
4798
4928
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4799
4929
|
}
|
|
4800
|
-
return
|
|
4930
|
+
return _context43.finish(15);
|
|
4801
4931
|
case 19:
|
|
4802
4932
|
case "end":
|
|
4803
|
-
return
|
|
4933
|
+
return _context43.stop();
|
|
4804
4934
|
}
|
|
4805
|
-
},
|
|
4935
|
+
}, _callee43, this, [[11,, 15, 19]]);
|
|
4806
4936
|
}));
|
|
4807
|
-
function refreshAvailabilityContextProjection(
|
|
4937
|
+
function refreshAvailabilityContextProjection(_x28) {
|
|
4808
4938
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4809
4939
|
}
|
|
4810
4940
|
return refreshAvailabilityContextProjection;
|
|
@@ -4812,53 +4942,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4812
4942
|
}, {
|
|
4813
4943
|
key: "ensureAvailabilityContextProjection",
|
|
4814
4944
|
value: function () {
|
|
4815
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4945
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, reason) {
|
|
4816
4946
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4817
|
-
return _regeneratorRuntime().wrap(function
|
|
4818
|
-
while (1) switch (
|
|
4947
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4948
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4819
4949
|
case 0:
|
|
4820
4950
|
retries = 0;
|
|
4821
4951
|
case 1:
|
|
4822
4952
|
if (!(retries < 3)) {
|
|
4823
|
-
|
|
4953
|
+
_context44.next = 19;
|
|
4824
4954
|
break;
|
|
4825
4955
|
}
|
|
4826
4956
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4827
4957
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4828
4958
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4829
4959
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4830
|
-
|
|
4960
|
+
_context44.next = 7;
|
|
4831
4961
|
break;
|
|
4832
4962
|
}
|
|
4833
|
-
return
|
|
4963
|
+
return _context44.abrupt("return", {
|
|
4834
4964
|
context: context,
|
|
4835
4965
|
projectionEntry: projectionEntry,
|
|
4836
4966
|
refreshed: false
|
|
4837
4967
|
});
|
|
4838
4968
|
case 7:
|
|
4839
|
-
|
|
4969
|
+
_context44.next = 9;
|
|
4840
4970
|
return this.refreshAvailabilityContextProjection({
|
|
4841
4971
|
contextId: contextId,
|
|
4842
4972
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4843
4973
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4844
4974
|
});
|
|
4845
4975
|
case 9:
|
|
4846
|
-
refreshedProjectionEntry =
|
|
4976
|
+
refreshedProjectionEntry = _context44.sent;
|
|
4847
4977
|
if (refreshedProjectionEntry) {
|
|
4848
|
-
|
|
4978
|
+
_context44.next = 13;
|
|
4849
4979
|
break;
|
|
4850
4980
|
}
|
|
4851
4981
|
retries += 1;
|
|
4852
|
-
return
|
|
4982
|
+
return _context44.abrupt("continue", 1);
|
|
4853
4983
|
case 13:
|
|
4854
4984
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4855
|
-
|
|
4985
|
+
_context44.next = 16;
|
|
4856
4986
|
break;
|
|
4857
4987
|
}
|
|
4858
4988
|
retries += 1;
|
|
4859
|
-
return
|
|
4989
|
+
return _context44.abrupt("continue", 1);
|
|
4860
4990
|
case 16:
|
|
4861
|
-
return
|
|
4991
|
+
return _context44.abrupt("return", {
|
|
4862
4992
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4863
4993
|
projectionEntry: refreshedProjectionEntry,
|
|
4864
4994
|
refreshed: true
|
|
@@ -4870,11 +5000,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4870
5000
|
});
|
|
4871
5001
|
case 20:
|
|
4872
5002
|
case "end":
|
|
4873
|
-
return
|
|
5003
|
+
return _context44.stop();
|
|
4874
5004
|
}
|
|
4875
|
-
},
|
|
5005
|
+
}, _callee44, this);
|
|
4876
5006
|
}));
|
|
4877
|
-
function ensureAvailabilityContextProjection(
|
|
5007
|
+
function ensureAvailabilityContextProjection(_x29, _x30) {
|
|
4878
5008
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4879
5009
|
}
|
|
4880
5010
|
return ensureAvailabilityContextProjection;
|
|
@@ -4882,18 +5012,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4882
5012
|
}, {
|
|
4883
5013
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4884
5014
|
value: function () {
|
|
4885
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5015
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(contextId) {
|
|
4886
5016
|
var _currentContext$activ;
|
|
4887
5017
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4888
|
-
return _regeneratorRuntime().wrap(function
|
|
4889
|
-
while (1) switch (
|
|
5018
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
5019
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4890
5020
|
case 0:
|
|
4891
5021
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4892
|
-
|
|
5022
|
+
_context45.next = 5;
|
|
4893
5023
|
break;
|
|
4894
5024
|
}
|
|
4895
5025
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4896
|
-
|
|
5026
|
+
_context45.next = 4;
|
|
4897
5027
|
return this.emitAvailabilityDiagnostic({
|
|
4898
5028
|
action: 'commit_lock_wait',
|
|
4899
5029
|
contextId: contextId,
|
|
@@ -4910,7 +5040,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4910
5040
|
case 5:
|
|
4911
5041
|
this.availabilityCommitLocks.add(contextId);
|
|
4912
5042
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4913
|
-
|
|
5043
|
+
_context45.next = 9;
|
|
4914
5044
|
return this.emitAvailabilityDiagnostic({
|
|
4915
5045
|
action: 'commit_lock_acquired',
|
|
4916
5046
|
contextId: contextId,
|
|
@@ -4922,11 +5052,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4922
5052
|
});
|
|
4923
5053
|
case 9:
|
|
4924
5054
|
case "end":
|
|
4925
|
-
return
|
|
5055
|
+
return _context45.stop();
|
|
4926
5056
|
}
|
|
4927
|
-
},
|
|
5057
|
+
}, _callee45, this);
|
|
4928
5058
|
}));
|
|
4929
|
-
function tryAcquireAvailabilityCommitLock(
|
|
5059
|
+
function tryAcquireAvailabilityCommitLock(_x31) {
|
|
4930
5060
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4931
5061
|
}
|
|
4932
5062
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4934,15 +5064,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4934
5064
|
}, {
|
|
4935
5065
|
key: "releaseAvailabilityCommitLock",
|
|
4936
5066
|
value: function () {
|
|
4937
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5067
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
|
|
4938
5068
|
var _releasedContext$acti;
|
|
4939
5069
|
var releasedContext;
|
|
4940
|
-
return _regeneratorRuntime().wrap(function
|
|
4941
|
-
while (1) switch (
|
|
5070
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
5071
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4942
5072
|
case 0:
|
|
4943
5073
|
this.availabilityCommitLocks.delete(contextId);
|
|
4944
5074
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4945
|
-
|
|
5075
|
+
_context46.next = 4;
|
|
4946
5076
|
return this.emitAvailabilityDiagnostic({
|
|
4947
5077
|
action: 'commit_lock_released',
|
|
4948
5078
|
contextId: contextId,
|
|
@@ -4954,11 +5084,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4954
5084
|
});
|
|
4955
5085
|
case 4:
|
|
4956
5086
|
case "end":
|
|
4957
|
-
return
|
|
5087
|
+
return _context46.stop();
|
|
4958
5088
|
}
|
|
4959
|
-
},
|
|
5089
|
+
}, _callee46, this);
|
|
4960
5090
|
}));
|
|
4961
|
-
function releaseAvailabilityCommitLock(
|
|
5091
|
+
function releaseAvailabilityCommitLock(_x32) {
|
|
4962
5092
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4963
5093
|
}
|
|
4964
5094
|
return releaseAvailabilityCommitLock;
|
|
@@ -4966,20 +5096,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4966
5096
|
}, {
|
|
4967
5097
|
key: "prepareAvailabilityProjection",
|
|
4968
5098
|
value: (function () {
|
|
4969
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5099
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4970
5100
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4971
|
-
return _regeneratorRuntime().wrap(function
|
|
4972
|
-
while (1) switch (
|
|
5101
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5102
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4973
5103
|
case 0:
|
|
4974
5104
|
this.assertAvailabilityPrepareParams(params);
|
|
4975
|
-
|
|
5105
|
+
_context47.next = 3;
|
|
4976
5106
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4977
5107
|
case 3:
|
|
4978
|
-
paramsWithDefaults =
|
|
4979
|
-
|
|
5108
|
+
paramsWithDefaults = _context47.sent;
|
|
5109
|
+
_context47.next = 6;
|
|
4980
5110
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4981
5111
|
case 6:
|
|
4982
|
-
_yield$this$getShared =
|
|
5112
|
+
_yield$this$getShared = _context47.sent;
|
|
4983
5113
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4984
5114
|
snapshot = _yield$this$getShared.snapshot;
|
|
4985
5115
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5000,7 +5130,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5000
5130
|
refreshed: false,
|
|
5001
5131
|
reason: 'prepare'
|
|
5002
5132
|
};
|
|
5003
|
-
|
|
5133
|
+
_context47.next = 16;
|
|
5004
5134
|
return this.emitAvailabilityDiagnostic({
|
|
5005
5135
|
action: 'prepare',
|
|
5006
5136
|
contextId: contextId,
|
|
@@ -5011,17 +5141,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5011
5141
|
reason: 'prepare'
|
|
5012
5142
|
});
|
|
5013
5143
|
case 16:
|
|
5014
|
-
|
|
5144
|
+
_context47.next = 18;
|
|
5015
5145
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5016
5146
|
case 18:
|
|
5017
|
-
return
|
|
5147
|
+
return _context47.abrupt("return", handle);
|
|
5018
5148
|
case 19:
|
|
5019
5149
|
case "end":
|
|
5020
|
-
return
|
|
5150
|
+
return _context47.stop();
|
|
5021
5151
|
}
|
|
5022
|
-
},
|
|
5152
|
+
}, _callee47, this);
|
|
5023
5153
|
}));
|
|
5024
|
-
function prepareAvailabilityProjection(
|
|
5154
|
+
function prepareAvailabilityProjection(_x33) {
|
|
5025
5155
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5026
5156
|
}
|
|
5027
5157
|
return prepareAvailabilityProjection;
|
|
@@ -5029,7 +5159,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5029
5159
|
}, {
|
|
5030
5160
|
key: "getProductTimeRanges",
|
|
5031
5161
|
value: (function () {
|
|
5032
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5162
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId) {
|
|
5033
5163
|
var _this$otherParams$pla2,
|
|
5034
5164
|
_this$otherParams26,
|
|
5035
5165
|
_context$prepareParam,
|
|
@@ -5049,15 +5179,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5049
5179
|
businessDate,
|
|
5050
5180
|
rememberedStartAtByProductId,
|
|
5051
5181
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5052
|
-
|
|
5053
|
-
return _regeneratorRuntime().wrap(function
|
|
5054
|
-
while (1) switch (
|
|
5182
|
+
_args48 = arguments;
|
|
5183
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5184
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
5055
5185
|
case 0:
|
|
5056
|
-
request =
|
|
5057
|
-
|
|
5186
|
+
request = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
|
|
5187
|
+
_context48.next = 3;
|
|
5058
5188
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5059
5189
|
case 3:
|
|
5060
|
-
_yield$this$ensureAva =
|
|
5190
|
+
_yield$this$ensureAva = _context48.sent;
|
|
5061
5191
|
context = _yield$this$ensureAva.context;
|
|
5062
5192
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5063
5193
|
contextVersion = context.activeVersion;
|
|
@@ -5092,7 +5222,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5092
5222
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5093
5223
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5094
5224
|
}));
|
|
5095
|
-
return
|
|
5225
|
+
return _context48.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
|
|
5096
5226
|
dateRange: dateRange,
|
|
5097
5227
|
editingStartAtByProductId: editingStartAtByProductId,
|
|
5098
5228
|
rememberedStartAtByProductId: rememberedStartAtByProductId
|
|
@@ -5116,11 +5246,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5116
5246
|
}));
|
|
5117
5247
|
case 17:
|
|
5118
5248
|
case "end":
|
|
5119
|
-
return
|
|
5249
|
+
return _context48.stop();
|
|
5120
5250
|
}
|
|
5121
|
-
},
|
|
5251
|
+
}, _callee48, this);
|
|
5122
5252
|
}));
|
|
5123
|
-
function getProductTimeRanges(
|
|
5253
|
+
function getProductTimeRanges(_x34) {
|
|
5124
5254
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5125
5255
|
}
|
|
5126
5256
|
return getProductTimeRanges;
|
|
@@ -5128,16 +5258,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5128
5258
|
}, {
|
|
5129
5259
|
key: "queryBookingAvailability",
|
|
5130
5260
|
value: (function () {
|
|
5131
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5261
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId, request) {
|
|
5132
5262
|
var _this$otherParams$pla3, _this$otherParams27, _context$prepareParam2;
|
|
5133
5263
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
|
|
5134
|
-
return _regeneratorRuntime().wrap(function
|
|
5135
|
-
while (1) switch (
|
|
5264
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5265
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
5136
5266
|
case 0:
|
|
5137
|
-
|
|
5267
|
+
_context49.next = 2;
|
|
5138
5268
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5139
5269
|
case 2:
|
|
5140
|
-
_yield$this$ensureAva2 =
|
|
5270
|
+
_yield$this$ensureAva2 = _context49.sent;
|
|
5141
5271
|
context = _yield$this$ensureAva2.context;
|
|
5142
5272
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5143
5273
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
@@ -5178,18 +5308,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5178
5308
|
});
|
|
5179
5309
|
})
|
|
5180
5310
|
}) : result;
|
|
5181
|
-
return
|
|
5311
|
+
return _context49.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5182
5312
|
contextId: context.contextId,
|
|
5183
5313
|
contextVersion: contextVersion,
|
|
5184
5314
|
refreshed: refreshed
|
|
5185
5315
|
}));
|
|
5186
5316
|
case 13:
|
|
5187
5317
|
case "end":
|
|
5188
|
-
return
|
|
5318
|
+
return _context49.stop();
|
|
5189
5319
|
}
|
|
5190
|
-
},
|
|
5320
|
+
}, _callee49, this);
|
|
5191
5321
|
}));
|
|
5192
|
-
function queryBookingAvailability(
|
|
5322
|
+
function queryBookingAvailability(_x35, _x36) {
|
|
5193
5323
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5194
5324
|
}
|
|
5195
5325
|
return queryBookingAvailability;
|
|
@@ -5257,27 +5387,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5257
5387
|
}, {
|
|
5258
5388
|
key: "removeBookingProductsOutsideStartDate",
|
|
5259
5389
|
value: function () {
|
|
5260
|
-
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5390
|
+
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(startDate) {
|
|
5261
5391
|
var _this$getTempOrder4,
|
|
5262
5392
|
_this$otherParams28,
|
|
5263
5393
|
_this14 = this;
|
|
5264
5394
|
var products, targetDate, identities;
|
|
5265
|
-
return _regeneratorRuntime().wrap(function
|
|
5266
|
-
while (1) switch (
|
|
5395
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5396
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
5267
5397
|
case 0:
|
|
5268
5398
|
products = ((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || [];
|
|
5269
5399
|
if (!(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.enforceSingleBookingStartDate) !== true)) {
|
|
5270
|
-
|
|
5400
|
+
_context50.next = 3;
|
|
5271
5401
|
break;
|
|
5272
5402
|
}
|
|
5273
|
-
return
|
|
5403
|
+
return _context50.abrupt("return", products);
|
|
5274
5404
|
case 3:
|
|
5275
5405
|
targetDate = getVisibleCalendarDate(startDate);
|
|
5276
5406
|
if (targetDate) {
|
|
5277
|
-
|
|
5407
|
+
_context50.next = 6;
|
|
5278
5408
|
break;
|
|
5279
5409
|
}
|
|
5280
|
-
return
|
|
5410
|
+
return _context50.abrupt("return", products);
|
|
5281
5411
|
case 6:
|
|
5282
5412
|
identities = products.flatMap(function (product) {
|
|
5283
5413
|
var _product$metadata7;
|
|
@@ -5289,14 +5419,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5289
5419
|
var bookingDate = getVisibleCalendarDate(booking.start_date);
|
|
5290
5420
|
return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
|
|
5291
5421
|
});
|
|
5292
|
-
return
|
|
5422
|
+
return _context50.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
|
|
5293
5423
|
case 8:
|
|
5294
5424
|
case "end":
|
|
5295
|
-
return
|
|
5425
|
+
return _context50.stop();
|
|
5296
5426
|
}
|
|
5297
|
-
},
|
|
5427
|
+
}, _callee50, this);
|
|
5298
5428
|
}));
|
|
5299
|
-
function removeBookingProductsOutsideStartDate(
|
|
5429
|
+
function removeBookingProductsOutsideStartDate(_x37) {
|
|
5300
5430
|
return _removeBookingProductsOutsideStartDate.apply(this, arguments);
|
|
5301
5431
|
}
|
|
5302
5432
|
return removeBookingProductsOutsideStartDate;
|
|
@@ -5304,7 +5434,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5304
5434
|
}, {
|
|
5305
5435
|
key: "commitAvailabilitySelection",
|
|
5306
5436
|
value: (function () {
|
|
5307
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5437
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId, params) {
|
|
5308
5438
|
var _this$otherParams$pla4,
|
|
5309
5439
|
_this$otherParams29,
|
|
5310
5440
|
_params$availabilityC,
|
|
@@ -5312,12 +5442,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5312
5442
|
_this$store$order11$e,
|
|
5313
5443
|
_this15 = this;
|
|
5314
5444
|
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams30, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams31, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5315
|
-
return _regeneratorRuntime().wrap(function
|
|
5316
|
-
while (1) switch (
|
|
5445
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5446
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
5317
5447
|
case 0:
|
|
5318
5448
|
normalizedContextId = String(contextId || '').trim();
|
|
5319
5449
|
if (normalizedContextId) {
|
|
5320
|
-
|
|
5450
|
+
_context51.next = 3;
|
|
5321
5451
|
break;
|
|
5322
5452
|
}
|
|
5323
5453
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5326,7 +5456,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5326
5456
|
case 3:
|
|
5327
5457
|
isRememberedSelection = params.selectionIntent === 'remembered';
|
|
5328
5458
|
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
|
|
5329
|
-
|
|
5459
|
+
_context51.next = 6;
|
|
5330
5460
|
break;
|
|
5331
5461
|
}
|
|
5332
5462
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5351,13 +5481,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5351
5481
|
return _this15.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
5352
5482
|
};
|
|
5353
5483
|
guardedCommitPublished = false;
|
|
5354
|
-
|
|
5484
|
+
_context51.next = 16;
|
|
5355
5485
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5356
5486
|
case 16:
|
|
5357
|
-
|
|
5487
|
+
_context51.prev = 16;
|
|
5358
5488
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5359
5489
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5360
|
-
|
|
5490
|
+
_context51.next = 20;
|
|
5361
5491
|
break;
|
|
5362
5492
|
}
|
|
5363
5493
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5365,7 +5495,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5365
5495
|
});
|
|
5366
5496
|
case 20:
|
|
5367
5497
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5368
|
-
|
|
5498
|
+
_context51.next = 22;
|
|
5369
5499
|
break;
|
|
5370
5500
|
}
|
|
5371
5501
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
@@ -5374,7 +5504,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5374
5504
|
case 22:
|
|
5375
5505
|
orderProductQuantity = (_ref55 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref55 !== void 0 ? _ref55 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5376
5506
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5377
|
-
|
|
5507
|
+
_context51.next = 25;
|
|
5378
5508
|
break;
|
|
5379
5509
|
}
|
|
5380
5510
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5384,22 +5514,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5384
5514
|
case 25:
|
|
5385
5515
|
partySize = Number(params.partySize);
|
|
5386
5516
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5387
|
-
|
|
5517
|
+
_context51.next = 28;
|
|
5388
5518
|
break;
|
|
5389
5519
|
}
|
|
5390
5520
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5391
5521
|
partySize: params.partySize
|
|
5392
5522
|
});
|
|
5393
5523
|
case 28:
|
|
5394
|
-
|
|
5524
|
+
_context51.next = 30;
|
|
5395
5525
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5396
5526
|
case 30:
|
|
5397
|
-
_yield$this$ensureAva3 =
|
|
5527
|
+
_yield$this$ensureAva3 = _context51.sent;
|
|
5398
5528
|
context = _yield$this$ensureAva3.context;
|
|
5399
5529
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5400
5530
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5401
5531
|
if (!refreshed) {
|
|
5402
|
-
|
|
5532
|
+
_context51.next = 36;
|
|
5403
5533
|
break;
|
|
5404
5534
|
}
|
|
5405
5535
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5410,11 +5540,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5410
5540
|
case 36:
|
|
5411
5541
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5412
5542
|
if (!(params.mode === 'edit')) {
|
|
5413
|
-
|
|
5543
|
+
_context51.next = 42;
|
|
5414
5544
|
break;
|
|
5415
5545
|
}
|
|
5416
5546
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5417
|
-
|
|
5547
|
+
_context51.next = 40;
|
|
5418
5548
|
break;
|
|
5419
5549
|
}
|
|
5420
5550
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5423,11 +5553,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5423
5553
|
editingProductLineUids: boundEditingUids
|
|
5424
5554
|
});
|
|
5425
5555
|
case 40:
|
|
5426
|
-
|
|
5556
|
+
_context51.next = 44;
|
|
5427
5557
|
break;
|
|
5428
5558
|
case 42:
|
|
5429
5559
|
if (!(boundEditingUids.length > 0)) {
|
|
5430
|
-
|
|
5560
|
+
_context51.next = 44;
|
|
5431
5561
|
break;
|
|
5432
5562
|
}
|
|
5433
5563
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -5436,7 +5566,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5436
5566
|
});
|
|
5437
5567
|
case 44:
|
|
5438
5568
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5439
|
-
|
|
5569
|
+
_context51.next = 46;
|
|
5440
5570
|
break;
|
|
5441
5571
|
}
|
|
5442
5572
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5446,7 +5576,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5446
5576
|
});
|
|
5447
5577
|
case 46:
|
|
5448
5578
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5449
|
-
|
|
5579
|
+
_context51.next = 48;
|
|
5450
5580
|
break;
|
|
5451
5581
|
}
|
|
5452
5582
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5457,7 +5587,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5457
5587
|
});
|
|
5458
5588
|
case 48:
|
|
5459
5589
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5460
|
-
|
|
5590
|
+
_context51.next = 50;
|
|
5461
5591
|
break;
|
|
5462
5592
|
}
|
|
5463
5593
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5469,7 +5599,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5469
5599
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5470
5600
|
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;
|
|
5471
5601
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5472
|
-
|
|
5602
|
+
_context51.next = 54;
|
|
5473
5603
|
break;
|
|
5474
5604
|
}
|
|
5475
5605
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -5478,14 +5608,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5478
5608
|
});
|
|
5479
5609
|
case 54:
|
|
5480
5610
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
5481
|
-
|
|
5611
|
+
_context51.next = 56;
|
|
5482
5612
|
break;
|
|
5483
5613
|
}
|
|
5484
5614
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5485
5615
|
case 56:
|
|
5486
5616
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5487
5617
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
5488
|
-
|
|
5618
|
+
_context51.next = 59;
|
|
5489
5619
|
break;
|
|
5490
5620
|
}
|
|
5491
5621
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -5493,7 +5623,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5493
5623
|
});
|
|
5494
5624
|
case 59:
|
|
5495
5625
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5496
|
-
|
|
5626
|
+
_context51.next = 61;
|
|
5497
5627
|
break;
|
|
5498
5628
|
}
|
|
5499
5629
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5503,7 +5633,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5503
5633
|
});
|
|
5504
5634
|
case 61:
|
|
5505
5635
|
if (Array.isArray(params.requirementSelections)) {
|
|
5506
|
-
|
|
5636
|
+
_context51.next = 63;
|
|
5507
5637
|
break;
|
|
5508
5638
|
}
|
|
5509
5639
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -5515,7 +5645,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5515
5645
|
return sameAvailabilityId(item.id, params.candidate.productId);
|
|
5516
5646
|
});
|
|
5517
5647
|
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
|
|
5518
|
-
|
|
5648
|
+
_context51.next = 67;
|
|
5519
5649
|
break;
|
|
5520
5650
|
}
|
|
5521
5651
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5529,7 +5659,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5529
5659
|
};
|
|
5530
5660
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5531
5661
|
if (prepareParams) {
|
|
5532
|
-
|
|
5662
|
+
_context51.next = 71;
|
|
5533
5663
|
break;
|
|
5534
5664
|
}
|
|
5535
5665
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -5541,7 +5671,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5541
5671
|
})),
|
|
5542
5672
|
includesInjectedRawOccupancies: true
|
|
5543
5673
|
};
|
|
5544
|
-
|
|
5674
|
+
_context51.next = 74;
|
|
5545
5675
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5546
5676
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
5547
5677
|
}), {
|
|
@@ -5550,13 +5680,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5550
5680
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5551
5681
|
});
|
|
5552
5682
|
case 74:
|
|
5553
|
-
commitSnapshot =
|
|
5683
|
+
commitSnapshot = _context51.sent;
|
|
5554
5684
|
refreshedProjection = commitSnapshot.projection;
|
|
5555
5685
|
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 : ''))) {
|
|
5556
|
-
|
|
5686
|
+
_context51.next = 81;
|
|
5557
5687
|
break;
|
|
5558
5688
|
}
|
|
5559
|
-
|
|
5689
|
+
_context51.next = 79;
|
|
5560
5690
|
return this.refreshAvailabilityContextProjection({
|
|
5561
5691
|
contextId: normalizedContextId,
|
|
5562
5692
|
reason: 'commit_order_revision_changed',
|
|
@@ -5611,7 +5741,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5611
5741
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5612
5742
|
});
|
|
5613
5743
|
if (refreshedCandidateBase) {
|
|
5614
|
-
|
|
5744
|
+
_context51.next = 90;
|
|
5615
5745
|
break;
|
|
5616
5746
|
}
|
|
5617
5747
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5624,7 +5754,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5624
5754
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5625
5755
|
});
|
|
5626
5756
|
if (product) {
|
|
5627
|
-
|
|
5757
|
+
_context51.next = 93;
|
|
5628
5758
|
break;
|
|
5629
5759
|
}
|
|
5630
5760
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -5663,7 +5793,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5663
5793
|
});
|
|
5664
5794
|
}
|
|
5665
5795
|
if (validation.ok) {
|
|
5666
|
-
|
|
5796
|
+
_context51.next = 98;
|
|
5667
5797
|
break;
|
|
5668
5798
|
}
|
|
5669
5799
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5686,7 +5816,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5686
5816
|
incrementVersion: true
|
|
5687
5817
|
});
|
|
5688
5818
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5689
|
-
|
|
5819
|
+
_context51.next = 102;
|
|
5690
5820
|
return this.emitAvailabilityDiagnostic({
|
|
5691
5821
|
action: 'refresh',
|
|
5692
5822
|
contextId: normalizedContextId,
|
|
@@ -5733,7 +5863,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5733
5863
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5734
5864
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5735
5865
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
5736
|
-
|
|
5866
|
+
_context51.next = 109;
|
|
5737
5867
|
break;
|
|
5738
5868
|
}
|
|
5739
5869
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -5751,7 +5881,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5751
5881
|
holderIds: (_ref57 = (_ref58 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
5752
5882
|
});
|
|
5753
5883
|
if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
|
|
5754
|
-
|
|
5884
|
+
_context51.next = 119;
|
|
5755
5885
|
break;
|
|
5756
5886
|
}
|
|
5757
5887
|
// AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
|
|
@@ -5771,7 +5901,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5771
5901
|
return sameAvailabilityId(selected.form_id, resource.form_id);
|
|
5772
5902
|
});
|
|
5773
5903
|
}))) {
|
|
5774
|
-
|
|
5904
|
+
_context51.next = 118;
|
|
5775
5905
|
break;
|
|
5776
5906
|
}
|
|
5777
5907
|
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
|
|
@@ -5788,7 +5918,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5788
5918
|
quantity: bookingCount
|
|
5789
5919
|
}), 'unified_booking_sales', product);
|
|
5790
5920
|
if (transformed) {
|
|
5791
|
-
|
|
5921
|
+
_context51.next = 122;
|
|
5792
5922
|
break;
|
|
5793
5923
|
}
|
|
5794
5924
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -5807,7 +5937,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5807
5937
|
productLineUids = [];
|
|
5808
5938
|
bookingUids = [];
|
|
5809
5939
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5810
|
-
|
|
5940
|
+
_context51.next = 143;
|
|
5811
5941
|
break;
|
|
5812
5942
|
}
|
|
5813
5943
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5817,7 +5947,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5817
5947
|
unique_identification_number: params.productLineUid,
|
|
5818
5948
|
booking_uid: existingBookingUid
|
|
5819
5949
|
});
|
|
5820
|
-
|
|
5950
|
+
_context51.next = 135;
|
|
5821
5951
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
5822
5952
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5823
5953
|
product_variant_id: (_ref59 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref59 !== void 0 ? _ref59 : 0,
|
|
@@ -5830,14 +5960,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5830
5960
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
5831
5961
|
} : {}));
|
|
5832
5962
|
case 135:
|
|
5833
|
-
|
|
5963
|
+
_context51.next = 137;
|
|
5834
5964
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
5835
5965
|
case 137:
|
|
5836
5966
|
productLineUid = params.productLineUid;
|
|
5837
5967
|
bookingUid = existingBookingUid;
|
|
5838
5968
|
productLineUids = [productLineUid];
|
|
5839
5969
|
bookingUids = [bookingUid];
|
|
5840
|
-
|
|
5970
|
+
_context51.next = 160;
|
|
5841
5971
|
break;
|
|
5842
5972
|
case 143:
|
|
5843
5973
|
beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
|
|
@@ -5847,7 +5977,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5847
5977
|
return getBookingUid(item);
|
|
5848
5978
|
}).filter(Boolean));
|
|
5849
5979
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
5850
|
-
|
|
5980
|
+
_context51.next = 148;
|
|
5851
5981
|
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
|
|
5852
5982
|
salesNotes: params.salesNotes
|
|
5853
5983
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -5855,11 +5985,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5855
5985
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
5856
5986
|
} : {}) : undefined);
|
|
5857
5987
|
case 148:
|
|
5858
|
-
products =
|
|
5859
|
-
|
|
5988
|
+
products = _context51.sent;
|
|
5989
|
+
_context51.next = 151;
|
|
5860
5990
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
5861
5991
|
case 151:
|
|
5862
|
-
products =
|
|
5992
|
+
products = _context51.sent;
|
|
5863
5993
|
guardedCommitPublished = hasCommitGuard;
|
|
5864
5994
|
addedLines = products.filter(function (line) {
|
|
5865
5995
|
var _line$product_id, _line$metadata;
|
|
@@ -5899,7 +6029,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5899
6029
|
bookingUids: bookingUids
|
|
5900
6030
|
};
|
|
5901
6031
|
if (!targetStillCurrent) {
|
|
5902
|
-
|
|
6032
|
+
_context51.next = 178;
|
|
5903
6033
|
break;
|
|
5904
6034
|
}
|
|
5905
6035
|
// A notification failure after publication must not invite a duplicate add.
|
|
@@ -5907,52 +6037,52 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5907
6037
|
return _this15.core.effects.emit("".concat(_this15.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
5908
6038
|
};
|
|
5909
6039
|
if (!guardedCommitPublished) {
|
|
5910
|
-
|
|
6040
|
+
_context51.next = 176;
|
|
5911
6041
|
break;
|
|
5912
6042
|
}
|
|
5913
|
-
|
|
5914
|
-
|
|
6043
|
+
_context51.prev = 167;
|
|
6044
|
+
_context51.next = 170;
|
|
5915
6045
|
return emit();
|
|
5916
6046
|
case 170:
|
|
5917
|
-
|
|
6047
|
+
_context51.next = 174;
|
|
5918
6048
|
break;
|
|
5919
6049
|
case 172:
|
|
5920
|
-
|
|
5921
|
-
|
|
6050
|
+
_context51.prev = 172;
|
|
6051
|
+
_context51.t0 = _context51["catch"](167);
|
|
5922
6052
|
case 174:
|
|
5923
|
-
|
|
6053
|
+
_context51.next = 178;
|
|
5924
6054
|
break;
|
|
5925
6055
|
case 176:
|
|
5926
|
-
|
|
6056
|
+
_context51.next = 178;
|
|
5927
6057
|
return emit();
|
|
5928
6058
|
case 178:
|
|
5929
|
-
return
|
|
6059
|
+
return _context51.abrupt("return", result);
|
|
5930
6060
|
case 179:
|
|
5931
|
-
|
|
6061
|
+
_context51.prev = 179;
|
|
5932
6062
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
5933
6063
|
if (!guardedCommitPublished) {
|
|
5934
|
-
|
|
6064
|
+
_context51.next = 186;
|
|
5935
6065
|
break;
|
|
5936
6066
|
}
|
|
5937
|
-
|
|
6067
|
+
_context51.next = 184;
|
|
5938
6068
|
return release.catch(function () {
|
|
5939
6069
|
return undefined;
|
|
5940
6070
|
});
|
|
5941
6071
|
case 184:
|
|
5942
|
-
|
|
6072
|
+
_context51.next = 188;
|
|
5943
6073
|
break;
|
|
5944
6074
|
case 186:
|
|
5945
|
-
|
|
6075
|
+
_context51.next = 188;
|
|
5946
6076
|
return release;
|
|
5947
6077
|
case 188:
|
|
5948
|
-
return
|
|
6078
|
+
return _context51.finish(179);
|
|
5949
6079
|
case 189:
|
|
5950
6080
|
case "end":
|
|
5951
|
-
return
|
|
6081
|
+
return _context51.stop();
|
|
5952
6082
|
}
|
|
5953
|
-
},
|
|
6083
|
+
}, _callee51, this, [[16,, 179, 189], [167, 172]]);
|
|
5954
6084
|
}));
|
|
5955
|
-
function commitAvailabilitySelection(
|
|
6085
|
+
function commitAvailabilitySelection(_x38, _x39) {
|
|
5956
6086
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
5957
6087
|
}
|
|
5958
6088
|
return commitAvailabilitySelection;
|