@pisell/pisellos 0.10.16 → 0.10.18

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.
Files changed (63) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/index.d.ts +5 -2
  3. package/dist/modules/OpenData/index.js +27 -12
  4. package/dist/modules/OpenData/types.d.ts +42 -0
  5. package/dist/modules/OpenData/types.js +7 -1
  6. package/dist/modules/OpenData/utils.d.ts +15 -1
  7. package/dist/modules/OpenData/utils.js +85 -0
  8. package/dist/modules/Order/index.d.ts +3 -1
  9. package/dist/modules/Order/index.js +68 -44
  10. package/dist/modules/Order/types.d.ts +3 -0
  11. package/dist/modules/Order/types.js +1 -0
  12. package/dist/modules/ProductList/index.js +96 -74
  13. package/dist/modules/Rules/index.js +11 -8
  14. package/dist/modules/SalesSummary/index.js +6 -4
  15. package/dist/server/index.d.ts +11 -0
  16. package/dist/server/index.js +845 -481
  17. package/dist/server/modules/order/index.d.ts +8 -0
  18. package/dist/server/modules/order/index.js +251 -215
  19. package/dist/server/utils/small-ticket.d.ts +9 -1
  20. package/dist/server/utils/small-ticket.js +117 -43
  21. package/dist/solution/BaseSales/index.d.ts +7 -0
  22. package/dist/solution/BaseSales/index.js +251 -144
  23. package/dist/solution/BookingByStep/index.d.ts +2 -2
  24. package/dist/solution/BookingTicket/index.d.ts +14 -19
  25. package/dist/solution/BookingTicket/index.js +545 -429
  26. package/dist/solution/Sales/index.d.ts +20 -4
  27. package/dist/solution/Sales/index.js +348 -75
  28. package/dist/solution/Sales/types.d.ts +10 -0
  29. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  30. package/dist/solution/UnifiedBookingSales/index.js +495 -422
  31. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
  32. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  33. package/lib/modules/OpenData/index.d.ts +5 -2
  34. package/lib/modules/OpenData/index.js +50 -3
  35. package/lib/modules/OpenData/types.d.ts +42 -0
  36. package/lib/modules/OpenData/types.js +9 -1
  37. package/lib/modules/OpenData/utils.d.ts +15 -1
  38. package/lib/modules/OpenData/utils.js +85 -0
  39. package/lib/modules/Order/index.d.ts +3 -1
  40. package/lib/modules/Order/index.js +41 -21
  41. package/lib/modules/Order/types.d.ts +3 -0
  42. package/lib/modules/Order/types.js +1 -0
  43. package/lib/modules/ProductList/index.js +9 -6
  44. package/lib/modules/Rules/index.js +8 -6
  45. package/lib/modules/SalesSummary/index.js +3 -1
  46. package/lib/server/index.d.ts +11 -0
  47. package/lib/server/index.js +395 -96
  48. package/lib/server/modules/order/index.d.ts +8 -0
  49. package/lib/server/modules/order/index.js +23 -0
  50. package/lib/server/utils/small-ticket.d.ts +9 -1
  51. package/lib/server/utils/small-ticket.js +107 -35
  52. package/lib/solution/BaseSales/index.d.ts +7 -0
  53. package/lib/solution/BaseSales/index.js +125 -28
  54. package/lib/solution/BookingByStep/index.d.ts +2 -2
  55. package/lib/solution/BookingTicket/index.d.ts +14 -19
  56. package/lib/solution/BookingTicket/index.js +70 -17
  57. package/lib/solution/Sales/index.d.ts +20 -4
  58. package/lib/solution/Sales/index.js +183 -15
  59. package/lib/solution/Sales/types.d.ts +10 -0
  60. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  61. package/lib/solution/UnifiedBookingSales/index.js +41 -15
  62. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
  63. package/package.json +1 -1
@@ -36,6 +36,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
36
36
  import dayjs from 'dayjs';
37
37
  import { cloneDeep } from 'lodash-es';
38
38
  import { OpenDataModule } from "../../modules";
39
+ import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
39
40
  import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
40
41
  import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
41
42
  import { UnifiedBookingSalesHooks } from "./types";
@@ -44,7 +45,7 @@ import { BookingTicket } from "../BookingTicket";
44
45
  import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
45
46
  export * from "./types";
46
47
  export { AvailabilityError } from "../../modules/ResourcePlanner";
47
- var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
48
+ var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability', 'documents'];
48
49
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
49
50
  function normalizePositiveInteger(value) {
50
51
  var normalized = Number(value);
@@ -1076,9 +1077,6 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1076
1077
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
1077
1078
  _defineProperty(_assertThisInitialized(_this), "store", {});
1078
1079
  _defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
1079
- _defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
1080
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
1081
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
1082
1080
  _defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
1083
1081
  _defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
1084
1082
  _defineProperty(_assertThisInitialized(_this), "availabilityProjectionSequence", 0);
@@ -1917,7 +1915,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1917
1915
  key: "loadOpenData",
1918
1916
  value: (function () {
1919
1917
  var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
1920
- var businessCode, channel, target, cachedData, lastFetchedAt, openData;
1918
+ var businessCode, channel, target, cachedData, lastFetchedAt, request, openData;
1921
1919
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1922
1920
  while (1) switch (_context11.prev = _context11.next) {
1923
1921
  case 0:
@@ -1963,31 +1961,36 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1963
1961
  return _context11.abrupt("return", this.loadOpenData(params));
1964
1962
  case 19:
1965
1963
  this.loadOpenDataInFlightTarget = target;
1966
- this.loadOpenDataInFlight = this.store.openData.fetchOpenData({
1964
+ request = this.store.openData.fetchOpenData({
1967
1965
  scope: 'board',
1968
1966
  target: target,
1969
1967
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
1970
1968
  });
1971
- _context11.prev = 21;
1972
- _context11.next = 24;
1973
- return this.loadOpenDataInFlight;
1974
- case 24:
1969
+ this.loadOpenDataInFlight = request;
1970
+ _context11.prev = 22;
1971
+ _context11.next = 25;
1972
+ return request;
1973
+ case 25:
1975
1974
  openData = _context11.sent;
1976
- this.openDataTarget = target;
1977
- this.otherParams.openData = openData;
1978
- this.otherParams.businessCode = businessCode;
1979
- this.otherParams.channel = channel;
1975
+ if (this.loadOpenDataInFlight === request) {
1976
+ this.openDataTarget = target;
1977
+ this.otherParams.openData = openData;
1978
+ this.otherParams.businessCode = businessCode;
1979
+ this.otherParams.channel = channel;
1980
+ }
1980
1981
  return _context11.abrupt("return", openData);
1981
- case 30:
1982
- _context11.prev = 30;
1983
- this.loadOpenDataInFlight = null;
1984
- this.loadOpenDataInFlightTarget = null;
1985
- return _context11.finish(30);
1986
- case 34:
1982
+ case 28:
1983
+ _context11.prev = 28;
1984
+ if (this.loadOpenDataInFlight === request) {
1985
+ this.loadOpenDataInFlight = null;
1986
+ this.loadOpenDataInFlightTarget = null;
1987
+ }
1988
+ return _context11.finish(28);
1989
+ case 31:
1987
1990
  case "end":
1988
1991
  return _context11.stop();
1989
1992
  }
1990
- }, _callee11, this, [[21,, 30, 34]]);
1993
+ }, _callee11, this, [[22,, 28, 31]]);
1991
1994
  }));
1992
1995
  function loadOpenData(_x7) {
1993
1996
  return _loadOpenData.apply(this, arguments);
@@ -1998,8 +2001,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1998
2001
  key: "getOpenData",
1999
2002
  value: function () {
2000
2003
  var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2001
- var _this$otherParams15, _this$otherParams16, _this$store$openData;
2002
- var businessCode, channel, target, cachedData;
2004
+ var _this$otherParams15, _this$otherParams16;
2005
+ var businessCode, channel;
2003
2006
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2004
2007
  while (1) switch (_context12.prev = _context12.next) {
2005
2008
  case 0:
@@ -2011,19 +2014,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2011
2014
  }
2012
2015
  return _context12.abrupt("return", null);
2013
2016
  case 4:
2014
- target = "".concat(businessCode, "+").concat(channel);
2015
- cachedData = ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData()) || null;
2016
- if (!(cachedData && this.openDataTarget === target)) {
2017
- _context12.next = 8;
2018
- break;
2019
- }
2020
- return _context12.abrupt("return", cachedData);
2021
- case 8:
2022
2017
  return _context12.abrupt("return", this.loadOpenData({
2023
2018
  businessCode: businessCode,
2024
2019
  channel: channel
2025
2020
  }));
2026
- case 9:
2021
+ case 5:
2027
2022
  case "end":
2028
2023
  return _context12.stop();
2029
2024
  }
@@ -2034,30 +2029,108 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2034
2029
  }
2035
2030
  return getOpenData;
2036
2031
  }()
2032
+ }, {
2033
+ key: "clearOpenDataCache",
2034
+ value: function clearOpenDataCache() {
2035
+ this.openDataTarget = null;
2036
+ this.loadOpenDataInFlight = null;
2037
+ this.loadOpenDataInFlightTarget = null;
2038
+ _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "clearOpenDataCache", this).call(this);
2039
+ }
2040
+ }, {
2041
+ key: "getInvoiceLayoutConfig",
2042
+ value: function () {
2043
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2044
+ var openData;
2045
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2046
+ while (1) switch (_context13.prev = _context13.next) {
2047
+ case 0:
2048
+ _context13.next = 2;
2049
+ return this.getOpenData();
2050
+ case 2:
2051
+ openData = _context13.sent;
2052
+ if (!(!openData || !this.store.openData)) {
2053
+ _context13.next = 5;
2054
+ break;
2055
+ }
2056
+ return _context13.abrupt("return", getDefaultInvoiceLayoutConfig());
2057
+ case 5:
2058
+ return _context13.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2059
+ case 6:
2060
+ case "end":
2061
+ return _context13.stop();
2062
+ }
2063
+ }, _callee13, this);
2064
+ }));
2065
+ function getInvoiceLayoutConfig() {
2066
+ return _getInvoiceLayoutConfig.apply(this, arguments);
2067
+ }
2068
+ return getInvoiceLayoutConfig;
2069
+ }()
2070
+ }, {
2071
+ key: "getInvoiceTemplateSettings",
2072
+ value: function () {
2073
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2074
+ var openData;
2075
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2076
+ while (1) switch (_context14.prev = _context14.next) {
2077
+ case 0:
2078
+ _context14.next = 2;
2079
+ return this.getOpenData();
2080
+ case 2:
2081
+ openData = _context14.sent;
2082
+ if (!(!openData || !this.store.openData)) {
2083
+ _context14.next = 5;
2084
+ break;
2085
+ }
2086
+ return _context14.abrupt("return", getDefaultInvoiceTemplateSettings());
2087
+ case 5:
2088
+ return _context14.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2089
+ case 6:
2090
+ case "end":
2091
+ return _context14.stop();
2092
+ }
2093
+ }, _callee14, this);
2094
+ }));
2095
+ function getInvoiceTemplateSettings() {
2096
+ return _getInvoiceTemplateSettings.apply(this, arguments);
2097
+ }
2098
+ return getInvoiceTemplateSettings;
2099
+ }()
2100
+ }, {
2101
+ key: "isInvoiceOpenDataCacheCurrent",
2102
+ value: function isInvoiceOpenDataCacheCurrent() {
2103
+ var _this$otherParams17, _this$otherParams18;
2104
+ var businessCode = String(((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) || '').trim();
2105
+ var channel = String(((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.channel) || '').trim();
2106
+ if (!businessCode || !channel) return false;
2107
+ return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
2108
+ }
2109
+
2037
2110
  /**
2038
2111
  * Load a resource policy without depending on the legacy appointmentBooking solution.
2039
2112
  */
2040
2113
  }, {
2041
2114
  key: "getProtocol",
2042
2115
  value: (function () {
2043
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(policyId) {
2116
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(policyId) {
2044
2117
  var normalizedPolicyId;
2045
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2046
- while (1) switch (_context13.prev = _context13.next) {
2118
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2119
+ while (1) switch (_context15.prev = _context15.next) {
2047
2120
  case 0:
2048
2121
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2049
2122
  if (normalizedPolicyId) {
2050
- _context13.next = 3;
2123
+ _context15.next = 3;
2051
2124
  break;
2052
2125
  }
2053
2126
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
2054
2127
  case 3:
2055
- return _context13.abrupt("return", this.request.get("/shop-policy/".concat(encodeURIComponent(normalizedPolicyId))));
2128
+ return _context15.abrupt("return", this.request.get("/shop-policy/".concat(encodeURIComponent(normalizedPolicyId))));
2056
2129
  case 4:
2057
2130
  case "end":
2058
- return _context13.stop();
2131
+ return _context15.stop();
2059
2132
  }
2060
- }, _callee13, this);
2133
+ }, _callee15, this);
2061
2134
  }));
2062
2135
  function getProtocol(_x8) {
2063
2136
  return _getProtocol.apply(this, arguments);
@@ -2072,27 +2145,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2072
2145
  }, {
2073
2146
  key: "loadProducts",
2074
2147
  value: (function () {
2075
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2148
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2076
2149
  var params,
2077
2150
  options,
2078
2151
  schedule_date,
2079
2152
  schedule_datetime,
2080
2153
  result,
2081
- _args14 = arguments;
2082
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2083
- while (1) switch (_context14.prev = _context14.next) {
2154
+ _args16 = arguments;
2155
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2156
+ while (1) switch (_context16.prev = _context16.next) {
2084
2157
  case 0:
2085
- params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2086
- options = _args14.length > 1 ? _args14[1] : undefined;
2158
+ params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
2159
+ options = _args16.length > 1 ? _args16[1] : undefined;
2087
2160
  if (this.store.products) {
2088
- _context14.next = 4;
2161
+ _context16.next = 4;
2089
2162
  break;
2090
2163
  }
2091
2164
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2092
2165
  case 4:
2093
2166
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2094
2167
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2095
- _context14.next = 8;
2168
+ _context16.next = 8;
2096
2169
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2097
2170
  with_count: ['bundleGroup', 'optionGroup'],
2098
2171
  with_schedule: 1
@@ -2102,17 +2175,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2102
2175
  cacheId: this.cacheId
2103
2176
  }), options);
2104
2177
  case 8:
2105
- result = _context14.sent;
2178
+ result = _context16.sent;
2106
2179
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2107
- _context14.next = 12;
2180
+ _context16.next = 12;
2108
2181
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2109
2182
  case 12:
2110
- return _context14.abrupt("return", result);
2183
+ return _context16.abrupt("return", result);
2111
2184
  case 13:
2112
2185
  case "end":
2113
- return _context14.stop();
2186
+ return _context16.stop();
2114
2187
  }
2115
- }, _callee14, this);
2188
+ }, _callee16, this);
2116
2189
  }));
2117
2190
  function loadProducts() {
2118
2191
  return _loadProducts.apply(this, arguments);
@@ -2122,22 +2195,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2122
2195
  }, {
2123
2196
  key: "loadScheduleAvailableDate",
2124
2197
  value: (function () {
2125
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
2126
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2127
- while (1) switch (_context15.prev = _context15.next) {
2198
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
2199
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2200
+ while (1) switch (_context17.prev = _context17.next) {
2128
2201
  case 0:
2129
2202
  if (this.store.schedule) {
2130
- _context15.next = 2;
2203
+ _context17.next = 2;
2131
2204
  break;
2132
2205
  }
2133
2206
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2134
2207
  case 2:
2135
- return _context15.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2208
+ return _context17.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2136
2209
  case 3:
2137
2210
  case "end":
2138
- return _context15.stop();
2211
+ return _context17.stop();
2139
2212
  }
2140
- }, _callee15, this);
2213
+ }, _callee17, this);
2141
2214
  }));
2142
2215
  function loadScheduleAvailableDate(_x9) {
2143
2216
  return _loadScheduleAvailableDate.apply(this, arguments);
@@ -2153,15 +2226,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2153
2226
  }, {
2154
2227
  key: "loadProductsByScheduleDate",
2155
2228
  value: (function () {
2156
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
2229
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
2157
2230
  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;
2158
2231
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
2159
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2160
- while (1) switch (_context16.prev = _context16.next) {
2232
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2233
+ while (1) switch (_context18.prev = _context18.next) {
2161
2234
  case 0:
2162
2235
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
2163
2236
  if (this.store.schedule) {
2164
- _context16.next = 3;
2237
+ _context18.next = 3;
2165
2238
  break;
2166
2239
  }
2167
2240
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -2172,10 +2245,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2172
2245
  });
2173
2246
  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;
2174
2247
  if (!(!hasCachedDate && !hasOtherProducts)) {
2175
- _context16.next = 9;
2248
+ _context18.next = 9;
2176
2249
  break;
2177
2250
  }
2178
- _context16.next = 9;
2251
+ _context18.next = 9;
2179
2252
  return this.loadScheduleAvailableDate({
2180
2253
  startDate: date,
2181
2254
  endDate: date,
@@ -2195,45 +2268,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2195
2268
  return !productIdFilter || productIdFilter.has(String(id));
2196
2269
  });
2197
2270
  if (availableProductIds.length) {
2198
- _context16.next = 17;
2271
+ _context18.next = 17;
2199
2272
  break;
2200
2273
  }
2201
2274
  this.unifiedProductCatalog = [];
2202
- _context16.next = 16;
2275
+ _context18.next = 16;
2203
2276
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
2204
2277
  case 16:
2205
- return _context16.abrupt("return", []);
2278
+ return _context18.abrupt("return", []);
2206
2279
  case 17:
2207
- _context16.next = 19;
2280
+ _context18.next = 19;
2208
2281
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2209
2282
  product_ids: availableProductIds,
2210
2283
  schedule_date: date
2211
2284
  }));
2212
2285
  case 19:
2213
- products = _context16.sent;
2286
+ products = _context18.sent;
2214
2287
  if (!(products.length || availableProductIds.length <= 1)) {
2215
- _context16.next = 22;
2288
+ _context18.next = 22;
2216
2289
  break;
2217
2290
  }
2218
- return _context16.abrupt("return", products);
2291
+ return _context18.abrupt("return", products);
2219
2292
  case 22:
2220
2293
  fallbackProducts = [];
2221
2294
  _iterator = _createForOfIteratorHelper(availableProductIds);
2222
- _context16.prev = 24;
2295
+ _context18.prev = 24;
2223
2296
  _iterator.s();
2224
2297
  case 26:
2225
2298
  if ((_step = _iterator.n()).done) {
2226
- _context16.next = 34;
2299
+ _context18.next = 34;
2227
2300
  break;
2228
2301
  }
2229
2302
  productId = _step.value;
2230
- _context16.next = 30;
2303
+ _context18.next = 30;
2231
2304
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2232
2305
  product_ids: [productId],
2233
2306
  schedule_date: date
2234
2307
  }));
2235
2308
  case 30:
2236
- result = _context16.sent;
2309
+ result = _context18.sent;
2237
2310
  result.forEach(function (product) {
2238
2311
  var _id;
2239
2312
  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;
@@ -2245,30 +2318,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2245
2318
  }
2246
2319
  });
2247
2320
  case 32:
2248
- _context16.next = 26;
2321
+ _context18.next = 26;
2249
2322
  break;
2250
2323
  case 34:
2251
- _context16.next = 39;
2324
+ _context18.next = 39;
2252
2325
  break;
2253
2326
  case 36:
2254
- _context16.prev = 36;
2255
- _context16.t0 = _context16["catch"](24);
2256
- _iterator.e(_context16.t0);
2327
+ _context18.prev = 36;
2328
+ _context18.t0 = _context18["catch"](24);
2329
+ _iterator.e(_context18.t0);
2257
2330
  case 39:
2258
- _context16.prev = 39;
2331
+ _context18.prev = 39;
2259
2332
  _iterator.f();
2260
- return _context16.finish(39);
2333
+ return _context18.finish(39);
2261
2334
  case 42:
2262
2335
  this.unifiedProductCatalog = [].concat(fallbackProducts);
2263
- _context16.next = 45;
2336
+ _context18.next = 45;
2264
2337
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
2265
2338
  case 45:
2266
- return _context16.abrupt("return", fallbackProducts);
2339
+ return _context18.abrupt("return", fallbackProducts);
2267
2340
  case 46:
2268
2341
  case "end":
2269
- return _context16.stop();
2342
+ return _context18.stop();
2270
2343
  }
2271
- }, _callee16, this, [[24, 36, 39, 42]]);
2344
+ }, _callee18, this, [[24, 36, 39, 42]]);
2272
2345
  }));
2273
2346
  function loadProductsByScheduleDate(_x10) {
2274
2347
  return _loadProductsByScheduleDate.apply(this, arguments);
@@ -2323,7 +2396,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2323
2396
  }, {
2324
2397
  key: "applyPlannerDiscounts",
2325
2398
  value: (function () {
2326
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2399
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2327
2400
  var _params$customerId;
2328
2401
  var params,
2329
2402
  tempOrder,
@@ -2340,24 +2413,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2340
2413
  discount,
2341
2414
  discountId,
2342
2415
  nextTempOrder,
2343
- _args17 = arguments;
2344
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2345
- while (1) switch (_context17.prev = _context17.next) {
2416
+ _args19 = arguments;
2417
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2418
+ while (1) switch (_context19.prev = _context19.next) {
2346
2419
  case 0:
2347
- params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
2420
+ params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
2348
2421
  tempOrder = this.getTempOrder();
2349
2422
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
2350
2423
  parsedCustomerId = Number(requestedCustomerId);
2351
2424
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
2352
- _context17.next = 7;
2425
+ _context19.next = 7;
2353
2426
  return this.getSummary();
2354
2427
  case 7:
2355
- summaryBefore = _context17.sent;
2428
+ summaryBefore = _context19.sent;
2356
2429
  if (customerId) {
2357
- _context17.next = 10;
2430
+ _context19.next = 10;
2358
2431
  break;
2359
2432
  }
2360
- return _context17.abrupt("return", buildPlannerDiscountResult({
2433
+ return _context19.abrupt("return", buildPlannerDiscountResult({
2361
2434
  customerId: null,
2362
2435
  discountList: this.getDiscountList(),
2363
2436
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -2366,7 +2439,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2366
2439
  status: 'no_customer'
2367
2440
  }));
2368
2441
  case 10:
2369
- _context17.next = 12;
2442
+ _context19.next = 12;
2370
2443
  return this.loadDiscountConfig({
2371
2444
  customerId: customerId,
2372
2445
  action: 'create'
@@ -2378,7 +2451,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2378
2451
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
2379
2452
  });
2380
2453
  if (!preferredDiscount) {
2381
- _context17.next = 40;
2454
+ _context19.next = 40;
2382
2455
  break;
2383
2456
  }
2384
2457
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -2390,98 +2463,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2390
2463
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
2391
2464
  });
2392
2465
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
2393
- _context17.prev = 18;
2466
+ _context19.prev = 18;
2394
2467
  _iterator2.s();
2395
2468
  case 20:
2396
2469
  if ((_step2 = _iterator2.n()).done) {
2397
- _context17.next = 28;
2470
+ _context19.next = 28;
2398
2471
  break;
2399
2472
  }
2400
2473
  discount = _step2.value;
2401
2474
  discountId = Number(resolvePlannerDiscountId(discount));
2402
2475
  if (!Number.isFinite(discountId)) {
2403
- _context17.next = 26;
2476
+ _context19.next = 26;
2404
2477
  break;
2405
2478
  }
2406
- _context17.next = 26;
2479
+ _context19.next = 26;
2407
2480
  return this.setDiscountSelected({
2408
2481
  discountId: discountId,
2409
2482
  isSelected: false
2410
2483
  });
2411
2484
  case 26:
2412
- _context17.next = 20;
2485
+ _context19.next = 20;
2413
2486
  break;
2414
2487
  case 28:
2415
- _context17.next = 33;
2488
+ _context19.next = 33;
2416
2489
  break;
2417
2490
  case 30:
2418
- _context17.prev = 30;
2419
- _context17.t0 = _context17["catch"](18);
2420
- _iterator2.e(_context17.t0);
2491
+ _context19.prev = 30;
2492
+ _context19.t0 = _context19["catch"](18);
2493
+ _iterator2.e(_context19.t0);
2421
2494
  case 33:
2422
- _context17.prev = 33;
2495
+ _context19.prev = 33;
2423
2496
  _iterator2.f();
2424
- return _context17.finish(33);
2497
+ return _context19.finish(33);
2425
2498
  case 36:
2426
- _context17.next = 38;
2499
+ _context19.next = 38;
2427
2500
  return this.setDiscountSelected({
2428
2501
  discountId: Number(preferredId),
2429
2502
  isSelected: true
2430
2503
  });
2431
2504
  case 38:
2432
- _context17.next = 49;
2505
+ _context19.next = 49;
2433
2506
  break;
2434
2507
  case 40:
2435
2508
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
2436
- _context17.next = 46;
2509
+ _context19.next = 46;
2437
2510
  break;
2438
2511
  }
2439
2512
  if (!(params.applyBestDiscount !== false)) {
2440
- _context17.next = 44;
2513
+ _context19.next = 44;
2441
2514
  break;
2442
2515
  }
2443
- _context17.next = 44;
2516
+ _context19.next = 44;
2444
2517
  return this.bestDiscount();
2445
2518
  case 44:
2446
- _context17.next = 49;
2519
+ _context19.next = 49;
2447
2520
  break;
2448
2521
  case 46:
2449
2522
  if (!(params.applyBestDiscount !== false)) {
2450
- _context17.next = 49;
2523
+ _context19.next = 49;
2451
2524
  break;
2452
2525
  }
2453
- _context17.next = 49;
2526
+ _context19.next = 49;
2454
2527
  return this.bestDiscount();
2455
2528
  case 49:
2456
2529
  nextTempOrder = this.getTempOrder();
2457
- _context17.t1 = buildPlannerDiscountResult;
2458
- _context17.t2 = customerId;
2459
- _context17.t3 = this.getDiscountList();
2460
- _context17.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
2461
- _context17.t5 = summaryBefore;
2462
- _context17.next = 57;
2530
+ _context19.t1 = buildPlannerDiscountResult;
2531
+ _context19.t2 = customerId;
2532
+ _context19.t3 = this.getDiscountList();
2533
+ _context19.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
2534
+ _context19.t5 = summaryBefore;
2535
+ _context19.next = 57;
2463
2536
  return this.getSummary();
2464
2537
  case 57:
2465
- _context17.t6 = _context17.sent;
2466
- _context17.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
2467
- _context17.t8 = preferredDiscountId;
2468
- _context17.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
2469
- _context17.t10 = {
2470
- customerId: _context17.t2,
2471
- discountList: _context17.t3,
2472
- products: _context17.t4,
2473
- summaryBefore: _context17.t5,
2474
- summaryAfter: _context17.t6,
2475
- status: _context17.t7,
2476
- preferredDiscountId: _context17.t8,
2477
- preferredDiscountFound: _context17.t9
2538
+ _context19.t6 = _context19.sent;
2539
+ _context19.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
2540
+ _context19.t8 = preferredDiscountId;
2541
+ _context19.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
2542
+ _context19.t10 = {
2543
+ customerId: _context19.t2,
2544
+ discountList: _context19.t3,
2545
+ products: _context19.t4,
2546
+ summaryBefore: _context19.t5,
2547
+ summaryAfter: _context19.t6,
2548
+ status: _context19.t7,
2549
+ preferredDiscountId: _context19.t8,
2550
+ preferredDiscountFound: _context19.t9
2478
2551
  };
2479
- return _context17.abrupt("return", (0, _context17.t1)(_context17.t10));
2552
+ return _context19.abrupt("return", (0, _context19.t1)(_context19.t10));
2480
2553
  case 63:
2481
2554
  case "end":
2482
- return _context17.stop();
2555
+ return _context19.stop();
2483
2556
  }
2484
- }, _callee17, this, [[18, 30, 33, 36]]);
2557
+ }, _callee19, this, [[18, 30, 33, 36]]);
2485
2558
  }));
2486
2559
  function applyPlannerDiscounts() {
2487
2560
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -2516,27 +2589,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2516
2589
  }, {
2517
2590
  key: "removeExistingStagedLines",
2518
2591
  value: (function () {
2519
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ownershipKey) {
2592
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(ownershipKey) {
2520
2593
  var _this$getTempOrder;
2521
2594
  var existingLines;
2522
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2523
- while (1) switch (_context18.prev = _context18.next) {
2595
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2596
+ while (1) switch (_context20.prev = _context20.next) {
2524
2597
  case 0:
2525
2598
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
2526
2599
  var _product$metadata4;
2527
2600
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
2528
2601
  });
2529
2602
  if (!(existingLines.length > 0)) {
2530
- _context18.next = 4;
2603
+ _context20.next = 4;
2531
2604
  break;
2532
2605
  }
2533
- _context18.next = 4;
2606
+ _context20.next = 4;
2534
2607
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
2535
2608
  case 4:
2536
2609
  case "end":
2537
- return _context18.stop();
2610
+ return _context20.stop();
2538
2611
  }
2539
- }, _callee18, this);
2612
+ }, _callee20, this);
2540
2613
  }));
2541
2614
  function removeExistingStagedLines(_x11) {
2542
2615
  return _removeExistingStagedLines.apply(this, arguments);
@@ -2546,25 +2619,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2546
2619
  }, {
2547
2620
  key: "stageProducts",
2548
2621
  value: function () {
2549
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, ownershipKey) {
2622
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params, ownershipKey) {
2550
2623
  var _params$rawProducts;
2551
2624
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
2552
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2553
- while (1) switch (_context19.prev = _context19.next) {
2625
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2626
+ while (1) switch (_context21.prev = _context21.next) {
2554
2627
  case 0:
2555
2628
  productIds = params.productIds || [];
2556
2629
  if (productIds.length) {
2557
- _context19.next = 3;
2630
+ _context21.next = 3;
2558
2631
  break;
2559
2632
  }
2560
- return _context19.abrupt("return", this.getTempOrder());
2633
+ return _context21.abrupt("return", this.getTempOrder());
2561
2634
  case 3:
2562
2635
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
2563
- _context19.next = 7;
2636
+ _context21.next = 7;
2564
2637
  break;
2565
2638
  }
2566
2639
  this.unifiedProductCatalog = params.rawProducts;
2567
- _context19.next = 12;
2640
+ _context21.next = 12;
2568
2641
  break;
2569
2642
  case 7:
2570
2643
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -2575,15 +2648,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2575
2648
  return !existingIds.has(String(id));
2576
2649
  });
2577
2650
  if (!(missingIds.length || params.productLoadParams)) {
2578
- _context19.next = 12;
2651
+ _context21.next = 12;
2579
2652
  break;
2580
2653
  }
2581
- _context19.next = 12;
2654
+ _context21.next = 12;
2582
2655
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
2583
2656
  product_ids: productIds.map(Number).filter(Number.isFinite)
2584
2657
  }));
2585
2658
  case 12:
2586
- _context19.next = 14;
2659
+ _context21.next = 14;
2587
2660
  return this.removeExistingStagedLines(ownershipKey);
2588
2661
  case 14:
2589
2662
  productIdSet = new Set(productIds.map(function (id) {
@@ -2596,28 +2669,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2596
2669
  _i = 0, _arr = selectedProducts;
2597
2670
  case 17:
2598
2671
  if (!(_i < _arr.length)) {
2599
- _context19.next = 26;
2672
+ _context21.next = 26;
2600
2673
  break;
2601
2674
  }
2602
2675
  sourceProduct = _arr[_i];
2603
2676
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
2604
2677
  if (!productInput) {
2605
- _context19.next = 23;
2678
+ _context21.next = 23;
2606
2679
  break;
2607
2680
  }
2608
- _context19.next = 23;
2681
+ _context21.next = 23;
2609
2682
  return this.addProductToOrder(productInput);
2610
2683
  case 23:
2611
2684
  _i++;
2612
- _context19.next = 17;
2685
+ _context21.next = 17;
2613
2686
  break;
2614
2687
  case 26:
2615
- return _context19.abrupt("return", this.getTempOrder());
2688
+ return _context21.abrupt("return", this.getTempOrder());
2616
2689
  case 27:
2617
2690
  case "end":
2618
- return _context19.stop();
2691
+ return _context21.stop();
2619
2692
  }
2620
- }, _callee19, this);
2693
+ }, _callee21, this);
2621
2694
  }));
2622
2695
  function stageProducts(_x12, _x13) {
2623
2696
  return _stageProducts.apply(this, arguments);
@@ -2631,16 +2704,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2631
2704
  }, {
2632
2705
  key: "stageRetailProducts",
2633
2706
  value: (function () {
2634
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2635
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2636
- while (1) switch (_context20.prev = _context20.next) {
2707
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2708
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2709
+ while (1) switch (_context22.prev = _context22.next) {
2637
2710
  case 0:
2638
- return _context20.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
2711
+ return _context22.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
2639
2712
  case 1:
2640
2713
  case "end":
2641
- return _context20.stop();
2714
+ return _context22.stop();
2642
2715
  }
2643
- }, _callee20, this);
2716
+ }, _callee22, this);
2644
2717
  }));
2645
2718
  function stageRetailProducts(_x14) {
2646
2719
  return _stageRetailProducts.apply(this, arguments);
@@ -2656,15 +2729,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2656
2729
  }, {
2657
2730
  key: "addRetailProduct",
2658
2731
  value: (function () {
2659
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2732
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2660
2733
  var _params$quantity, _ref38, _params$productId, _params$product, _params$product2;
2661
2734
  var quantity, productId, sourceProduct, products, orderProduct;
2662
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2663
- while (1) switch (_context21.prev = _context21.next) {
2735
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2736
+ while (1) switch (_context23.prev = _context23.next) {
2664
2737
  case 0:
2665
2738
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
2666
2739
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
2667
- _context21.next = 3;
2740
+ _context23.next = 3;
2668
2741
  break;
2669
2742
  }
2670
2743
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
@@ -2678,22 +2751,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2678
2751
  });
2679
2752
  }
2680
2753
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
2681
- _context21.next = 11;
2754
+ _context23.next = 11;
2682
2755
  break;
2683
2756
  }
2684
- _context21.next = 9;
2757
+ _context23.next = 9;
2685
2758
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
2686
2759
  product_ids: [Number(productId)].filter(Number.isFinite)
2687
2760
  }));
2688
2761
  case 9:
2689
- products = _context21.sent;
2762
+ products = _context23.sent;
2690
2763
  sourceProduct = products.find(function (product) {
2691
2764
  var _product$id4;
2692
2765
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
2693
2766
  });
2694
2767
  case 11:
2695
2768
  if (sourceProduct) {
2696
- _context21.next = 13;
2769
+ _context23.next = 13;
2697
2770
  break;
2698
2771
  }
2699
2772
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -2702,17 +2775,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2702
2775
  quantity: quantity
2703
2776
  }), 'unified_booking_sales_retail');
2704
2777
  if (orderProduct) {
2705
- _context21.next = 16;
2778
+ _context23.next = 16;
2706
2779
  break;
2707
2780
  }
2708
2781
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
2709
2782
  case 16:
2710
- return _context21.abrupt("return", this.addProductToOrder(orderProduct));
2783
+ return _context23.abrupt("return", this.addProductToOrder(orderProduct));
2711
2784
  case 17:
2712
2785
  case "end":
2713
- return _context21.stop();
2786
+ return _context23.stop();
2714
2787
  }
2715
- }, _callee21, this);
2788
+ }, _callee23, this);
2716
2789
  }));
2717
2790
  function addRetailProduct(_x15) {
2718
2791
  return _addRetailProduct.apply(this, arguments);
@@ -2879,46 +2952,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2879
2952
  }, {
2880
2953
  key: "loadAvailabilityProducts",
2881
2954
  value: function () {
2882
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2955
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2883
2956
  var _prepare$catalogScope,
2884
2957
  _prepare$catalogScope2,
2885
2958
  _this4 = this,
2886
2959
  _prepare$resourceIds;
2887
2960
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
2888
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2889
- while (1) switch (_context22.prev = _context22.next) {
2961
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2962
+ while (1) switch (_context24.prev = _context24.next) {
2890
2963
  case 0:
2891
2964
  prepare = params.prepare, dateRange = params.dateRange;
2892
2965
  explicitProductIds = prepare.productIds || [];
2893
2966
  rawProducts = [];
2894
2967
  if (!Array.isArray(prepare.rawProducts)) {
2895
- _context22.next = 8;
2968
+ _context24.next = 8;
2896
2969
  break;
2897
2970
  }
2898
2971
  rawProducts = prepare.rawProducts;
2899
2972
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
2900
- _context22.next = 34;
2973
+ _context24.next = 34;
2901
2974
  break;
2902
2975
  case 8:
2903
2976
  if (!(explicitProductIds.length > 0)) {
2904
- _context22.next = 14;
2977
+ _context24.next = 14;
2905
2978
  break;
2906
2979
  }
2907
- _context22.next = 11;
2980
+ _context24.next = 11;
2908
2981
  return this.loadProducts({
2909
2982
  product_ids: explicitProductIds,
2910
2983
  schedule_date: dateRange.startDate
2911
2984
  });
2912
2985
  case 11:
2913
- rawProducts = _context22.sent;
2914
- _context22.next = 34;
2986
+ rawProducts = _context24.sent;
2987
+ _context24.next = 34;
2915
2988
  break;
2916
2989
  case 14:
2917
2990
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
2918
- _context22.next = 30;
2991
+ _context24.next = 30;
2919
2992
  break;
2920
2993
  }
2921
- _context22.next = 17;
2994
+ _context24.next = 17;
2922
2995
  return this.loadScheduleAvailableDate({
2923
2996
  startDate: dateRange.startDate,
2924
2997
  endDate: dateRange.endDate,
@@ -2934,44 +3007,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2934
3007
  });
2935
3008
  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)) || [])));
2936
3009
  if (!(productIds.length > 0)) {
2937
- _context22.next = 27;
3010
+ _context24.next = 27;
2938
3011
  break;
2939
3012
  }
2940
3013
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
2941
- _context22.next = 24;
3014
+ _context24.next = 24;
2942
3015
  return this.loadProducts({
2943
3016
  product_ids: productIds,
2944
3017
  schedule_date: dateRange.startDate
2945
3018
  });
2946
3019
  case 24:
2947
- rawProducts = _context22.sent;
2948
- _context22.next = 28;
3020
+ rawProducts = _context24.sent;
3021
+ _context24.next = 28;
2949
3022
  break;
2950
3023
  case 27:
2951
3024
  this.unifiedProductCatalog = [];
2952
3025
  case 28:
2953
- _context22.next = 34;
3026
+ _context24.next = 34;
2954
3027
  break;
2955
3028
  case 30:
2956
3029
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
2957
- _context22.next = 34;
3030
+ _context24.next = 34;
2958
3031
  break;
2959
3032
  }
2960
- _context22.next = 33;
3033
+ _context24.next = 33;
2961
3034
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
2962
3035
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
2963
3036
  }));
2964
3037
  case 33:
2965
- rawProducts = _context22.sent;
3038
+ rawProducts = _context24.sent;
2966
3039
  case 34:
2967
3040
  normalized = rawProducts.map(function (product) {
2968
3041
  return normalizeProductForAvailability(product, params.scheduleList, _this4.getAvailabilityRuntimeOffsetMinutes());
2969
3042
  });
2970
3043
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
2971
- _context22.next = 37;
3044
+ _context24.next = 37;
2972
3045
  break;
2973
3046
  }
2974
- return _context22.abrupt("return", normalized.filter(function (product) {
3047
+ return _context24.abrupt("return", normalized.filter(function (product) {
2975
3048
  var _product$requirementG2;
2976
3049
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
2977
3050
  var _group$resourceIds2;
@@ -2984,14 +3057,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2984
3057
  }));
2985
3058
  case 37:
2986
3059
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
2987
- return _context22.abrupt("return", productIdSet ? normalized.filter(function (product) {
3060
+ return _context24.abrupt("return", productIdSet ? normalized.filter(function (product) {
2988
3061
  return productIdSet.has(String(product.id));
2989
3062
  }) : normalized);
2990
3063
  case 39:
2991
3064
  case "end":
2992
- return _context22.stop();
3065
+ return _context24.stop();
2993
3066
  }
2994
- }, _callee22, this);
3067
+ }, _callee24, this);
2995
3068
  }));
2996
3069
  function loadAvailabilityProducts(_x16) {
2997
3070
  return _loadAvailabilityProducts.apply(this, arguments);
@@ -3006,12 +3079,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3006
3079
  }, {
3007
3080
  key: "fetchAvailabilityResourcesV2",
3008
3081
  value: (function () {
3009
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
3082
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3010
3083
  var response, data;
3011
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3012
- while (1) switch (_context23.prev = _context23.next) {
3084
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3085
+ while (1) switch (_context25.prev = _context25.next) {
3013
3086
  case 0:
3014
- _context23.next = 2;
3087
+ _context25.next = 2;
3015
3088
  return this.request.get('/schedule/resource/list/v2', {
3016
3089
  start_date: params.dateRange.startDate,
3017
3090
  end_date: params.dateRange.endDate,
@@ -3021,26 +3094,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3021
3094
  useCache: false
3022
3095
  });
3023
3096
  case 2:
3024
- response = _context23.sent;
3097
+ response = _context25.sent;
3025
3098
  data = response === null || response === void 0 ? void 0 : response.data;
3026
3099
  if (!Array.isArray(data)) {
3027
- _context23.next = 6;
3100
+ _context25.next = 6;
3028
3101
  break;
3029
3102
  }
3030
- return _context23.abrupt("return", data);
3103
+ return _context25.abrupt("return", data);
3031
3104
  case 6:
3032
3105
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
3033
- _context23.next = 8;
3106
+ _context25.next = 8;
3034
3107
  break;
3035
3108
  }
3036
- return _context23.abrupt("return", data.list);
3109
+ return _context25.abrupt("return", data.list);
3037
3110
  case 8:
3038
- return _context23.abrupt("return", []);
3111
+ return _context25.abrupt("return", []);
3039
3112
  case 9:
3040
3113
  case "end":
3041
- return _context23.stop();
3114
+ return _context25.stop();
3042
3115
  }
3043
- }, _callee23, this);
3116
+ }, _callee25, this);
3044
3117
  }));
3045
3118
  function fetchAvailabilityResourcesV2(_x17) {
3046
3119
  return _fetchAvailabilityResourcesV.apply(this, arguments);
@@ -3050,17 +3123,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3050
3123
  }, {
3051
3124
  key: "fetchAndPublishAvailabilityResourcesV2",
3052
3125
  value: function () {
3053
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
3126
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3054
3127
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3055
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3056
- while (1) switch (_context24.prev = _context24.next) {
3128
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3129
+ while (1) switch (_context26.prev = _context26.next) {
3057
3130
  case 0:
3058
3131
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3059
3132
  if (!(normalizedResourceIds.length === 0)) {
3060
- _context24.next = 3;
3133
+ _context26.next = 3;
3061
3134
  break;
3062
3135
  }
3063
- return _context24.abrupt("return", []);
3136
+ return _context26.abrupt("return", []);
3064
3137
  case 3:
3065
3138
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3066
3139
  cacheParams = {
@@ -3070,7 +3143,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3070
3143
  };
3071
3144
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3072
3145
  if (!cachedRawResources) {
3073
- _context24.next = 9;
3146
+ _context26.next = 9;
3074
3147
  break;
3075
3148
  }
3076
3149
  if (params.useCacheOnHit) {
@@ -3082,21 +3155,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3082
3155
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3083
3156
  });
3084
3157
  }
3085
- return _context24.abrupt("return", cachedRawResources);
3158
+ return _context26.abrupt("return", cachedRawResources);
3086
3159
  case 9:
3087
- _context24.next = 11;
3160
+ _context26.next = 11;
3088
3161
  return this.refreshAvailabilityRemoteResourceQuery({
3089
3162
  timezone: params.timezone,
3090
3163
  dateRange: params.dateRange,
3091
3164
  resourceIds: normalizedResourceIds
3092
3165
  });
3093
3166
  case 11:
3094
- return _context24.abrupt("return", _context24.sent);
3167
+ return _context26.abrupt("return", _context26.sent);
3095
3168
  case 12:
3096
3169
  case "end":
3097
- return _context24.stop();
3170
+ return _context26.stop();
3098
3171
  }
3099
- }, _callee24, this);
3172
+ }, _callee26, this);
3100
3173
  }));
3101
3174
  function fetchAndPublishAvailabilityResourcesV2(_x18) {
3102
3175
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
@@ -3106,17 +3179,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3106
3179
  }, {
3107
3180
  key: "refreshAvailabilityRemoteResourceQuery",
3108
3181
  value: function () {
3109
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3182
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3110
3183
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3111
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3112
- while (1) switch (_context25.prev = _context25.next) {
3184
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3185
+ while (1) switch (_context27.prev = _context27.next) {
3113
3186
  case 0:
3114
3187
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3115
3188
  if (!(normalizedResourceIds.length === 0)) {
3116
- _context25.next = 3;
3189
+ _context27.next = 3;
3117
3190
  break;
3118
3191
  }
3119
- return _context25.abrupt("return", []);
3192
+ return _context27.abrupt("return", []);
3120
3193
  case 3:
3121
3194
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
3122
3195
  timezone: params.timezone,
@@ -3126,13 +3199,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3126
3199
  epoch = this.availabilityRemoteResourceEpoch;
3127
3200
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3128
3201
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
3129
- _context25.next = 10;
3202
+ _context27.next = 10;
3130
3203
  break;
3131
3204
  }
3132
- _context25.next = 9;
3205
+ _context27.next = 9;
3133
3206
  return existing.promise;
3134
3207
  case 9:
3135
- return _context25.abrupt("return", _context25.sent);
3208
+ return _context27.abrupt("return", _context27.sent);
3136
3209
  case 10:
3137
3210
  this.availabilityRemoteResourceQuerySequence += 1;
3138
3211
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -3144,11 +3217,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3144
3217
  epoch: epoch,
3145
3218
  promise: promise
3146
3219
  });
3147
- _context25.prev = 14;
3148
- _context25.next = 17;
3220
+ _context27.prev = 14;
3221
+ _context27.next = 17;
3149
3222
  return promise;
3150
3223
  case 17:
3151
- rawResources = _context25.sent;
3224
+ rawResources = _context27.sent;
3152
3225
  if (epoch === this.availabilityRemoteResourceEpoch) {
3153
3226
  this.availabilityRemoteOccupancyCache.publish({
3154
3227
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -3159,19 +3232,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3159
3232
  version: writeVersion
3160
3233
  });
3161
3234
  }
3162
- return _context25.abrupt("return", rawResources);
3235
+ return _context27.abrupt("return", rawResources);
3163
3236
  case 20:
3164
- _context25.prev = 20;
3237
+ _context27.prev = 20;
3165
3238
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3166
3239
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3167
3240
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
3168
3241
  }
3169
- return _context25.finish(20);
3242
+ return _context27.finish(20);
3170
3243
  case 24:
3171
3244
  case "end":
3172
- return _context25.stop();
3245
+ return _context27.stop();
3173
3246
  }
3174
- }, _callee25, this, [[14,, 20, 24]]);
3247
+ }, _callee27, this, [[14,, 20, 24]]);
3175
3248
  }));
3176
3249
  function refreshAvailabilityRemoteResourceQuery(_x19) {
3177
3250
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
@@ -3181,26 +3254,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3181
3254
  }, {
3182
3255
  key: "loadAvailabilityResources",
3183
3256
  value: function () {
3184
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3257
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3185
3258
  var resourceIds, cachedRawResources, rawResources;
3186
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3187
- while (1) switch (_context26.prev = _context26.next) {
3259
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3260
+ while (1) switch (_context28.prev = _context28.next) {
3188
3261
  case 0:
3189
3262
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
3190
3263
  if (!(resourceIds.length === 0)) {
3191
- _context26.next = 3;
3264
+ _context28.next = 3;
3192
3265
  break;
3193
3266
  }
3194
- return _context26.abrupt("return", {
3267
+ return _context28.abrupt("return", {
3195
3268
  resources: [],
3196
3269
  resourceOccupancies: []
3197
3270
  });
3198
3271
  case 3:
3199
3272
  if (!Array.isArray(params.rawResources)) {
3200
- _context26.next = 5;
3273
+ _context28.next = 5;
3201
3274
  break;
3202
3275
  }
3203
- return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3276
+ return _context28.abrupt("return", buildAvailabilityResourcesFromV2({
3204
3277
  rawResources: params.rawResources,
3205
3278
  scheduleList: params.scheduleList,
3206
3279
  dateRange: params.dateRange,
@@ -3208,7 +3281,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3208
3281
  }));
3209
3282
  case 5:
3210
3283
  if (!(params.fetchPolicy === 'cache_only')) {
3211
- _context26.next = 10;
3284
+ _context28.next = 10;
3212
3285
  break;
3213
3286
  }
3214
3287
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -3217,22 +3290,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3217
3290
  dateRange: params.dateRange
3218
3291
  });
3219
3292
  if (!cachedRawResources) {
3220
- _context26.next = 9;
3293
+ _context28.next = 9;
3221
3294
  break;
3222
3295
  }
3223
- return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3296
+ return _context28.abrupt("return", buildAvailabilityResourcesFromV2({
3224
3297
  rawResources: cachedRawResources,
3225
3298
  scheduleList: params.scheduleList,
3226
3299
  dateRange: params.dateRange,
3227
3300
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
3228
3301
  }));
3229
3302
  case 9:
3230
- return _context26.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3303
+ return _context28.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3231
3304
  resources: [],
3232
3305
  resourceOccupancies: []
3233
3306
  });
3234
3307
  case 10:
3235
- _context26.next = 12;
3308
+ _context28.next = 12;
3236
3309
  return this.fetchAndPublishAvailabilityResourcesV2({
3237
3310
  timezone: params.timezone,
3238
3311
  dateRange: params.dateRange,
@@ -3240,8 +3313,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3240
3313
  useCacheOnHit: true
3241
3314
  });
3242
3315
  case 12:
3243
- rawResources = _context26.sent;
3244
- return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3316
+ rawResources = _context28.sent;
3317
+ return _context28.abrupt("return", buildAvailabilityResourcesFromV2({
3245
3318
  rawResources: rawResources,
3246
3319
  scheduleList: params.scheduleList,
3247
3320
  dateRange: params.dateRange,
@@ -3249,9 +3322,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3249
3322
  }));
3250
3323
  case 14:
3251
3324
  case "end":
3252
- return _context26.stop();
3325
+ return _context28.stop();
3253
3326
  }
3254
- }, _callee26, this);
3327
+ }, _callee28, this);
3255
3328
  }));
3256
3329
  function loadAvailabilityResources(_x20) {
3257
3330
  return _loadAvailabilityResources.apply(this, arguments);
@@ -3484,7 +3557,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3484
3557
  }, {
3485
3558
  key: "buildAvailabilityProjectionSnapshot",
3486
3559
  value: function () {
3487
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3560
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3488
3561
  var _this7 = this;
3489
3562
  var options,
3490
3563
  normalizedPrepareParams,
@@ -3506,11 +3579,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3506
3579
  durationCandidateAnchorAt,
3507
3580
  orderRevision,
3508
3581
  projection,
3509
- _args27 = arguments;
3510
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3511
- while (1) switch (_context27.prev = _context27.next) {
3582
+ _args29 = arguments;
3583
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3584
+ while (1) switch (_context29.prev = _context29.next) {
3512
3585
  case 0:
3513
- options = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {};
3586
+ options = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
3514
3587
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
3515
3588
  timezoneLabel = String(normalizedPrepareParams.timezone);
3516
3589
  dateRange = normalizedPrepareParams.dateRange;
@@ -3524,15 +3597,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3524
3597
  scheduleList: scheduleList,
3525
3598
  businessHours: businessHours
3526
3599
  });
3527
- _context27.next = 11;
3600
+ _context29.next = 11;
3528
3601
  return this.loadAvailabilityProducts({
3529
3602
  prepare: normalizedPrepareParams,
3530
3603
  dateRange: dateRange,
3531
3604
  scheduleList: scheduleList
3532
3605
  });
3533
3606
  case 11:
3534
- products = _context27.sent;
3535
- _context27.next = 14;
3607
+ products = _context29.sent;
3608
+ _context29.next = 14;
3536
3609
  return this.loadAvailabilityResources({
3537
3610
  timezone: timezoneLabel,
3538
3611
  dateRange: dateRange,
@@ -3544,7 +3617,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3544
3617
  fallbackResources: options.fallbackResources
3545
3618
  });
3546
3619
  case 14:
3547
- loadedResources = _context27.sent;
3620
+ loadedResources = _context29.sent;
3548
3621
  tempOrder = this.getTempOrder();
3549
3622
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
3550
3623
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
@@ -3590,16 +3663,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3590
3663
  prepareParams: normalizedPrepareParams,
3591
3664
  durationCandidateAnchorAt: durationCandidateAnchorAt
3592
3665
  });
3593
- return _context27.abrupt("return", {
3666
+ return _context29.abrupt("return", {
3594
3667
  projection: projection,
3595
3668
  prepareParams: normalizedPrepareParams,
3596
3669
  orderRevision: orderRevision
3597
3670
  });
3598
3671
  case 26:
3599
3672
  case "end":
3600
- return _context27.stop();
3673
+ return _context29.stop();
3601
3674
  }
3602
- }, _callee27, this);
3675
+ }, _callee29, this);
3603
3676
  }));
3604
3677
  function buildAvailabilityProjectionSnapshot(_x21) {
3605
3678
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
@@ -3609,10 +3682,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3609
3682
  }, {
3610
3683
  key: "getSharedPreparedAvailabilitySnapshot",
3611
3684
  value: function () {
3612
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3685
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3613
3686
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
3614
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3615
- while (1) switch (_context28.prev = _context28.next) {
3687
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3688
+ while (1) switch (_context30.prev = _context30.next) {
3616
3689
  case 0:
3617
3690
  lifecycleGeneration = this.availabilityLifecycleGeneration;
3618
3691
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -3631,15 +3704,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3631
3704
  }
3632
3705
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
3633
3706
  if (!hasRawInputs) {
3634
- _context28.next = 11;
3707
+ _context30.next = 11;
3635
3708
  break;
3636
3709
  }
3637
- _context28.next = 7;
3710
+ _context30.next = 7;
3638
3711
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
3639
3712
  case 7:
3640
- snapshot = _context28.sent;
3713
+ snapshot = _context30.sent;
3641
3714
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
3642
- _context28.next = 10;
3715
+ _context30.next = 10;
3643
3716
  break;
3644
3717
  }
3645
3718
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -3648,7 +3721,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3648
3721
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
3649
3722
  });
3650
3723
  case 10:
3651
- return _context28.abrupt("return", {
3724
+ return _context30.abrupt("return", {
3652
3725
  prepareKey: prepareKey,
3653
3726
  snapshot: snapshot
3654
3727
  });
@@ -3662,13 +3735,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3662
3735
  promise: promise
3663
3736
  });
3664
3737
  }
3665
- _context28.prev = 14;
3666
- _context28.next = 17;
3738
+ _context30.prev = 14;
3739
+ _context30.next = 17;
3667
3740
  return promise;
3668
3741
  case 17:
3669
- _snapshot = _context28.sent;
3742
+ _snapshot = _context30.sent;
3670
3743
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
3671
- _context28.next = 20;
3744
+ _context30.next = 20;
3672
3745
  break;
3673
3746
  }
3674
3747
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -3677,22 +3750,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3677
3750
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
3678
3751
  });
3679
3752
  case 20:
3680
- return _context28.abrupt("return", {
3753
+ return _context30.abrupt("return", {
3681
3754
  prepareKey: prepareKey,
3682
3755
  snapshot: _snapshot
3683
3756
  });
3684
3757
  case 21:
3685
- _context28.prev = 21;
3758
+ _context30.prev = 21;
3686
3759
  current = this.availabilityPrepareInFlight.get(prepareKey);
3687
3760
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3688
3761
  this.availabilityPrepareInFlight.delete(prepareKey);
3689
3762
  }
3690
- return _context28.finish(21);
3763
+ return _context30.finish(21);
3691
3764
  case 25:
3692
3765
  case "end":
3693
- return _context28.stop();
3766
+ return _context30.stop();
3694
3767
  }
3695
- }, _callee28, this, [[14,, 21, 25]]);
3768
+ }, _callee30, this, [[14,, 21, 25]]);
3696
3769
  }));
3697
3770
  function getSharedPreparedAvailabilitySnapshot(_x22) {
3698
3771
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
@@ -3702,49 +3775,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3702
3775
  }, {
3703
3776
  key: "refreshAvailabilityContextProjection",
3704
3777
  value: function () {
3705
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3778
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3706
3779
  var _this8 = this;
3707
3780
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
3708
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3709
- while (1) switch (_context30.prev = _context30.next) {
3781
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3782
+ while (1) switch (_context32.prev = _context32.next) {
3710
3783
  case 0:
3711
3784
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
3712
3785
  if (!existingInFlight) {
3713
- _context30.next = 5;
3786
+ _context32.next = 5;
3714
3787
  break;
3715
3788
  }
3716
- _context30.next = 4;
3789
+ _context32.next = 4;
3717
3790
  return existingInFlight;
3718
3791
  case 4:
3719
- return _context30.abrupt("return", _context30.sent);
3792
+ return _context32.abrupt("return", _context32.sent);
3720
3793
  case 5:
3721
3794
  context = this.getAvailabilityContextEntry(params.contextId);
3722
3795
  expectedVersion = context.activeVersion;
3723
3796
  expectedRefreshNonce = context.refreshNonce;
3724
3797
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
3725
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3798
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
3726
3799
  var snapshot, currentContext, projectionEntry;
3727
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3728
- while (1) switch (_context29.prev = _context29.next) {
3800
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3801
+ while (1) switch (_context31.prev = _context31.next) {
3729
3802
  case 0:
3730
- _context29.next = 2;
3803
+ _context31.next = 2;
3731
3804
  return _this8.buildAvailabilityProjectionSnapshot(_this8.cloneAvailabilityPrepareParams(context.prepareParams), {
3732
3805
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
3733
3806
  });
3734
3807
  case 2:
3735
- snapshot = _context29.sent;
3808
+ snapshot = _context31.sent;
3736
3809
  currentContext = _this8.availabilityContextRegistry.get(params.contextId);
3737
3810
  if (currentContext) {
3738
- _context29.next = 6;
3811
+ _context31.next = 6;
3739
3812
  break;
3740
3813
  }
3741
- return _context29.abrupt("return", null);
3814
+ return _context31.abrupt("return", null);
3742
3815
  case 6:
3743
3816
  if (!(expectedLifecycleGeneration !== _this8.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
3744
- _context29.next = 8;
3817
+ _context31.next = 8;
3745
3818
  break;
3746
3819
  }
3747
- return _context29.abrupt("return", null);
3820
+ return _context31.abrupt("return", null);
3748
3821
  case 8:
3749
3822
  projectionEntry = _this8.storeAvailabilityProjectionEntry({
3750
3823
  contextId: currentContext.contextId,
@@ -3754,7 +3827,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3754
3827
  orderRevision: snapshot.orderRevision,
3755
3828
  incrementVersion: true
3756
3829
  });
3757
- _context29.next = 11;
3830
+ _context31.next = 11;
3758
3831
  return _this8.emitAvailabilityDiagnostic({
3759
3832
  action: 'refresh',
3760
3833
  contextId: currentContext.contextId,
@@ -3766,31 +3839,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3766
3839
  reason: params.reason
3767
3840
  });
3768
3841
  case 11:
3769
- return _context29.abrupt("return", projectionEntry);
3842
+ return _context31.abrupt("return", projectionEntry);
3770
3843
  case 12:
3771
3844
  case "end":
3772
- return _context29.stop();
3845
+ return _context31.stop();
3773
3846
  }
3774
- }, _callee29);
3847
+ }, _callee31);
3775
3848
  }))();
3776
3849
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
3777
- _context30.prev = 11;
3778
- _context30.next = 14;
3850
+ _context32.prev = 11;
3851
+ _context32.next = 14;
3779
3852
  return refreshPromise;
3780
3853
  case 14:
3781
- return _context30.abrupt("return", _context30.sent);
3854
+ return _context32.abrupt("return", _context32.sent);
3782
3855
  case 15:
3783
- _context30.prev = 15;
3856
+ _context32.prev = 15;
3784
3857
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
3785
3858
  if (current === refreshPromise) {
3786
3859
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
3787
3860
  }
3788
- return _context30.finish(15);
3861
+ return _context32.finish(15);
3789
3862
  case 19:
3790
3863
  case "end":
3791
- return _context30.stop();
3864
+ return _context32.stop();
3792
3865
  }
3793
- }, _callee30, this, [[11,, 15, 19]]);
3866
+ }, _callee32, this, [[11,, 15, 19]]);
3794
3867
  }));
3795
3868
  function refreshAvailabilityContextProjection(_x23) {
3796
3869
  return _refreshAvailabilityContextProjection.apply(this, arguments);
@@ -3800,53 +3873,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3800
3873
  }, {
3801
3874
  key: "ensureAvailabilityContextProjection",
3802
3875
  value: function () {
3803
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(contextId, reason) {
3876
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(contextId, reason) {
3804
3877
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
3805
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3806
- while (1) switch (_context31.prev = _context31.next) {
3878
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3879
+ while (1) switch (_context33.prev = _context33.next) {
3807
3880
  case 0:
3808
3881
  retries = 0;
3809
3882
  case 1:
3810
3883
  if (!(retries < 3)) {
3811
- _context31.next = 19;
3884
+ _context33.next = 19;
3812
3885
  break;
3813
3886
  }
3814
3887
  context = this.getAvailabilityContextEntry(contextId);
3815
3888
  currentOrderRevision = this.getCurrentOrderRevision();
3816
3889
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
3817
3890
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
3818
- _context31.next = 7;
3891
+ _context33.next = 7;
3819
3892
  break;
3820
3893
  }
3821
- return _context31.abrupt("return", {
3894
+ return _context33.abrupt("return", {
3822
3895
  context: context,
3823
3896
  projectionEntry: projectionEntry,
3824
3897
  refreshed: false
3825
3898
  });
3826
3899
  case 7:
3827
- _context31.next = 9;
3900
+ _context33.next = 9;
3828
3901
  return this.refreshAvailabilityContextProjection({
3829
3902
  contextId: contextId,
3830
3903
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
3831
3904
  previousOrderRevision: context.lastKnownOrderRevision
3832
3905
  });
3833
3906
  case 9:
3834
- refreshedProjectionEntry = _context31.sent;
3907
+ refreshedProjectionEntry = _context33.sent;
3835
3908
  if (refreshedProjectionEntry) {
3836
- _context31.next = 13;
3909
+ _context33.next = 13;
3837
3910
  break;
3838
3911
  }
3839
3912
  retries += 1;
3840
- return _context31.abrupt("continue", 1);
3913
+ return _context33.abrupt("continue", 1);
3841
3914
  case 13:
3842
3915
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
3843
- _context31.next = 16;
3916
+ _context33.next = 16;
3844
3917
  break;
3845
3918
  }
3846
3919
  retries += 1;
3847
- return _context31.abrupt("continue", 1);
3920
+ return _context33.abrupt("continue", 1);
3848
3921
  case 16:
3849
- return _context31.abrupt("return", {
3922
+ return _context33.abrupt("return", {
3850
3923
  context: this.getAvailabilityContextEntry(contextId),
3851
3924
  projectionEntry: refreshedProjectionEntry,
3852
3925
  refreshed: true
@@ -3858,9 +3931,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3858
3931
  });
3859
3932
  case 20:
3860
3933
  case "end":
3861
- return _context31.stop();
3934
+ return _context33.stop();
3862
3935
  }
3863
- }, _callee31, this);
3936
+ }, _callee33, this);
3864
3937
  }));
3865
3938
  function ensureAvailabilityContextProjection(_x24, _x25) {
3866
3939
  return _ensureAvailabilityContextProjection.apply(this, arguments);
@@ -3870,18 +3943,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3870
3943
  }, {
3871
3944
  key: "tryAcquireAvailabilityCommitLock",
3872
3945
  value: function () {
3873
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(contextId) {
3946
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(contextId) {
3874
3947
  var _currentContext$activ;
3875
3948
  var _waitingContext$activ, waitingContext, currentContext;
3876
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3877
- while (1) switch (_context32.prev = _context32.next) {
3949
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3950
+ while (1) switch (_context34.prev = _context34.next) {
3878
3951
  case 0:
3879
3952
  if (!this.availabilityCommitLocks.has(contextId)) {
3880
- _context32.next = 5;
3953
+ _context34.next = 5;
3881
3954
  break;
3882
3955
  }
3883
3956
  waitingContext = this.availabilityContextRegistry.get(contextId);
3884
- _context32.next = 4;
3957
+ _context34.next = 4;
3885
3958
  return this.emitAvailabilityDiagnostic({
3886
3959
  action: 'commit_lock_wait',
3887
3960
  contextId: contextId,
@@ -3898,7 +3971,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3898
3971
  case 5:
3899
3972
  this.availabilityCommitLocks.add(contextId);
3900
3973
  currentContext = this.availabilityContextRegistry.get(contextId);
3901
- _context32.next = 9;
3974
+ _context34.next = 9;
3902
3975
  return this.emitAvailabilityDiagnostic({
3903
3976
  action: 'commit_lock_acquired',
3904
3977
  contextId: contextId,
@@ -3910,9 +3983,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3910
3983
  });
3911
3984
  case 9:
3912
3985
  case "end":
3913
- return _context32.stop();
3986
+ return _context34.stop();
3914
3987
  }
3915
- }, _callee32, this);
3988
+ }, _callee34, this);
3916
3989
  }));
3917
3990
  function tryAcquireAvailabilityCommitLock(_x26) {
3918
3991
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
@@ -3922,15 +3995,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3922
3995
  }, {
3923
3996
  key: "releaseAvailabilityCommitLock",
3924
3997
  value: function () {
3925
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(contextId) {
3998
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(contextId) {
3926
3999
  var _releasedContext$acti;
3927
4000
  var releasedContext;
3928
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3929
- while (1) switch (_context33.prev = _context33.next) {
4001
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4002
+ while (1) switch (_context35.prev = _context35.next) {
3930
4003
  case 0:
3931
4004
  this.availabilityCommitLocks.delete(contextId);
3932
4005
  releasedContext = this.availabilityContextRegistry.get(contextId);
3933
- _context33.next = 4;
4006
+ _context35.next = 4;
3934
4007
  return this.emitAvailabilityDiagnostic({
3935
4008
  action: 'commit_lock_released',
3936
4009
  contextId: contextId,
@@ -3942,9 +4015,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3942
4015
  });
3943
4016
  case 4:
3944
4017
  case "end":
3945
- return _context33.stop();
4018
+ return _context35.stop();
3946
4019
  }
3947
- }, _callee33, this);
4020
+ }, _callee35, this);
3948
4021
  }));
3949
4022
  function releaseAvailabilityCommitLock(_x27) {
3950
4023
  return _releaseAvailabilityCommitLock.apply(this, arguments);
@@ -3954,20 +4027,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3954
4027
  }, {
3955
4028
  key: "prepareAvailabilityProjection",
3956
4029
  value: (function () {
3957
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
4030
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3958
4031
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
3959
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3960
- while (1) switch (_context34.prev = _context34.next) {
4032
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4033
+ while (1) switch (_context36.prev = _context36.next) {
3961
4034
  case 0:
3962
4035
  this.assertAvailabilityPrepareParams(params);
3963
- _context34.next = 3;
4036
+ _context36.next = 3;
3964
4037
  return this.resolveAvailabilityPrepareDefaults(params);
3965
4038
  case 3:
3966
- paramsWithDefaults = _context34.sent;
3967
- _context34.next = 6;
4039
+ paramsWithDefaults = _context36.sent;
4040
+ _context36.next = 6;
3968
4041
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
3969
4042
  case 6:
3970
- _yield$this$getShared = _context34.sent;
4043
+ _yield$this$getShared = _context36.sent;
3971
4044
  prepareKey = _yield$this$getShared.prepareKey;
3972
4045
  snapshot = _yield$this$getShared.snapshot;
3973
4046
  contextId = this.createAvailabilityContextId();
@@ -3988,7 +4061,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3988
4061
  refreshed: false,
3989
4062
  reason: 'prepare'
3990
4063
  };
3991
- _context34.next = 16;
4064
+ _context36.next = 16;
3992
4065
  return this.emitAvailabilityDiagnostic({
3993
4066
  action: 'prepare',
3994
4067
  contextId: contextId,
@@ -3999,15 +4072,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3999
4072
  reason: 'prepare'
4000
4073
  });
4001
4074
  case 16:
4002
- _context34.next = 18;
4075
+ _context36.next = 18;
4003
4076
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
4004
4077
  case 18:
4005
- return _context34.abrupt("return", handle);
4078
+ return _context36.abrupt("return", handle);
4006
4079
  case 19:
4007
4080
  case "end":
4008
- return _context34.stop();
4081
+ return _context36.stop();
4009
4082
  }
4010
- }, _callee34, this);
4083
+ }, _callee36, this);
4011
4084
  }));
4012
4085
  function prepareAvailabilityProjection(_x28) {
4013
4086
  return _prepareAvailabilityProjection.apply(this, arguments);
@@ -4017,26 +4090,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4017
4090
  }, {
4018
4091
  key: "getProductTimeRanges",
4019
4092
  value: (function () {
4020
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(contextId) {
4093
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId) {
4021
4094
  var _this9 = this;
4022
4095
  var request,
4023
4096
  _yield$this$ensureAva,
4024
4097
  context,
4025
4098
  projectionEntry,
4026
4099
  contextVersion,
4027
- _args35 = arguments;
4028
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4029
- while (1) switch (_context35.prev = _context35.next) {
4100
+ _args37 = arguments;
4101
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4102
+ while (1) switch (_context37.prev = _context37.next) {
4030
4103
  case 0:
4031
- request = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
4032
- _context35.next = 3;
4104
+ request = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
4105
+ _context37.next = 3;
4033
4106
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
4034
4107
  case 3:
4035
- _yield$this$ensureAva = _context35.sent;
4108
+ _yield$this$ensureAva = _context37.sent;
4036
4109
  context = _yield$this$ensureAva.context;
4037
4110
  projectionEntry = _yield$this$ensureAva.projectionEntry;
4038
4111
  contextVersion = context.activeVersion;
4039
- return _context35.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, request).map(function (group) {
4112
+ return _context37.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, request).map(function (group) {
4040
4113
  return _objectSpread(_objectSpread({}, group), {}, {
4041
4114
  ranges: group.ranges.map(function (candidate) {
4042
4115
  return _this9.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
@@ -4045,9 +4118,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4045
4118
  }));
4046
4119
  case 8:
4047
4120
  case "end":
4048
- return _context35.stop();
4121
+ return _context37.stop();
4049
4122
  }
4050
- }, _callee35, this);
4123
+ }, _callee37, this);
4051
4124
  }));
4052
4125
  function getProductTimeRanges(_x29) {
4053
4126
  return _getProductTimeRanges.apply(this, arguments);
@@ -4057,15 +4130,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4057
4130
  }, {
4058
4131
  key: "queryBookingAvailability",
4059
4132
  value: (function () {
4060
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, request) {
4133
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId, request) {
4061
4134
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, result, contextVersion, contextualResult;
4062
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4063
- while (1) switch (_context36.prev = _context36.next) {
4135
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4136
+ while (1) switch (_context38.prev = _context38.next) {
4064
4137
  case 0:
4065
- _context36.next = 2;
4138
+ _context38.next = 2;
4066
4139
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
4067
4140
  case 2:
4068
- _yield$this$ensureAva2 = _context36.sent;
4141
+ _yield$this$ensureAva2 = _context38.sent;
4069
4142
  context = _yield$this$ensureAva2.context;
4070
4143
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
4071
4144
  refreshed = _yield$this$ensureAva2.refreshed;
@@ -4097,16 +4170,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4097
4170
  });
4098
4171
  })
4099
4172
  }) : result;
4100
- return _context36.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4173
+ return _context38.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4101
4174
  contextId: context.contextId,
4102
4175
  contextVersion: contextVersion,
4103
4176
  refreshed: refreshed
4104
4177
  }));
4105
4178
  case 11:
4106
4179
  case "end":
4107
- return _context36.stop();
4180
+ return _context38.stop();
4108
4181
  }
4109
- }, _callee36, this);
4182
+ }, _callee38, this);
4110
4183
  }));
4111
4184
  function queryBookingAvailability(_x30, _x31) {
4112
4185
  return _queryBookingAvailability.apply(this, arguments);
@@ -4178,27 +4251,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4178
4251
  }, {
4179
4252
  key: "commitAvailabilitySelection",
4180
4253
  value: (function () {
4181
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId, params) {
4254
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId, params) {
4182
4255
  var normalizedContextId, _params$bookingCount, _ref45, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _ref46, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref47, _ref48, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, refreshedRanges, refreshedCandidateBase, validation, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, product, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref49, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4183
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4184
- while (1) switch (_context37.prev = _context37.next) {
4256
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4257
+ while (1) switch (_context39.prev = _context39.next) {
4185
4258
  case 0:
4186
4259
  normalizedContextId = String(contextId || '').trim();
4187
4260
  if (normalizedContextId) {
4188
- _context37.next = 3;
4261
+ _context39.next = 3;
4189
4262
  break;
4190
4263
  }
4191
4264
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
4192
4265
  candidate: params.candidate
4193
4266
  });
4194
4267
  case 3:
4195
- _context37.next = 5;
4268
+ _context39.next = 5;
4196
4269
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
4197
4270
  case 5:
4198
- _context37.prev = 5;
4271
+ _context39.prev = 5;
4199
4272
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
4200
4273
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
4201
- _context37.next = 9;
4274
+ _context39.next = 9;
4202
4275
  break;
4203
4276
  }
4204
4277
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -4206,7 +4279,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4206
4279
  });
4207
4280
  case 9:
4208
4281
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
4209
- _context37.next = 11;
4282
+ _context39.next = 11;
4210
4283
  break;
4211
4284
  }
4212
4285
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
@@ -4215,7 +4288,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4215
4288
  case 11:
4216
4289
  orderProductQuantity = (_ref45 = (_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 && _ref45 !== void 0 ? _ref45 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4217
4290
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
4218
- _context37.next = 14;
4291
+ _context39.next = 14;
4219
4292
  break;
4220
4293
  }
4221
4294
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -4225,22 +4298,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4225
4298
  case 14:
4226
4299
  partySize = Number(params.partySize);
4227
4300
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
4228
- _context37.next = 17;
4301
+ _context39.next = 17;
4229
4302
  break;
4230
4303
  }
4231
4304
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
4232
4305
  partySize: params.partySize
4233
4306
  });
4234
4307
  case 17:
4235
- _context37.next = 19;
4308
+ _context39.next = 19;
4236
4309
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
4237
4310
  case 19:
4238
- _yield$this$ensureAva3 = _context37.sent;
4311
+ _yield$this$ensureAva3 = _context39.sent;
4239
4312
  context = _yield$this$ensureAva3.context;
4240
4313
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
4241
4314
  refreshed = _yield$this$ensureAva3.refreshed;
4242
4315
  if (!refreshed) {
4243
- _context37.next = 25;
4316
+ _context39.next = 25;
4244
4317
  break;
4245
4318
  }
4246
4319
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4251,11 +4324,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4251
4324
  case 25:
4252
4325
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
4253
4326
  if (!(params.mode === 'edit')) {
4254
- _context37.next = 31;
4327
+ _context39.next = 31;
4255
4328
  break;
4256
4329
  }
4257
4330
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
4258
- _context37.next = 29;
4331
+ _context39.next = 29;
4259
4332
  break;
4260
4333
  }
4261
4334
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -4264,11 +4337,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4264
4337
  editingProductLineUids: boundEditingUids
4265
4338
  });
4266
4339
  case 29:
4267
- _context37.next = 33;
4340
+ _context39.next = 33;
4268
4341
  break;
4269
4342
  case 31:
4270
4343
  if (!(boundEditingUids.length > 0)) {
4271
- _context37.next = 33;
4344
+ _context39.next = 33;
4272
4345
  break;
4273
4346
  }
4274
4347
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -4277,7 +4350,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4277
4350
  });
4278
4351
  case 33:
4279
4352
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
4280
- _context37.next = 35;
4353
+ _context39.next = 35;
4281
4354
  break;
4282
4355
  }
4283
4356
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4287,7 +4360,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4287
4360
  });
4288
4361
  case 35:
4289
4362
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4290
- _context37.next = 37;
4363
+ _context39.next = 37;
4291
4364
  break;
4292
4365
  }
4293
4366
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -4298,7 +4371,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4298
4371
  });
4299
4372
  case 37:
4300
4373
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
4301
- _context37.next = 39;
4374
+ _context39.next = 39;
4302
4375
  break;
4303
4376
  }
4304
4377
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -4310,7 +4383,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4310
4383
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
4311
4384
  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;
4312
4385
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
4313
- _context37.next = 43;
4386
+ _context39.next = 43;
4314
4387
  break;
4315
4388
  }
4316
4389
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -4319,14 +4392,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4319
4392
  });
4320
4393
  case 43:
4321
4394
  if (!(params.mode === 'edit' && !params.productLineUid)) {
4322
- _context37.next = 45;
4395
+ _context39.next = 45;
4323
4396
  break;
4324
4397
  }
4325
4398
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
4326
4399
  case 45:
4327
4400
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
4328
4401
  if (!(params.mode === 'edit' && !editingLine)) {
4329
- _context37.next = 48;
4402
+ _context39.next = 48;
4330
4403
  break;
4331
4404
  }
4332
4405
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -4334,7 +4407,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4334
4407
  });
4335
4408
  case 48:
4336
4409
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
4337
- _context37.next = 50;
4410
+ _context39.next = 50;
4338
4411
  break;
4339
4412
  }
4340
4413
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -4344,7 +4417,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4344
4417
  });
4345
4418
  case 50:
4346
4419
  if (Array.isArray(params.requirementSelections)) {
4347
- _context37.next = 52;
4420
+ _context39.next = 52;
4348
4421
  break;
4349
4422
  }
4350
4423
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -4361,7 +4434,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4361
4434
  };
4362
4435
  prepareParams = baseProjection.meta.prepareParams;
4363
4436
  if (prepareParams) {
4364
- _context37.next = 57;
4437
+ _context39.next = 57;
4365
4438
  break;
4366
4439
  }
4367
4440
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -4373,7 +4446,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4373
4446
  })),
4374
4447
  includesInjectedRawOccupancies: true
4375
4448
  };
4376
- _context37.next = 60;
4449
+ _context39.next = 60;
4377
4450
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
4378
4451
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
4379
4452
  }), {
@@ -4382,13 +4455,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4382
4455
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
4383
4456
  });
4384
4457
  case 60:
4385
- commitSnapshot = _context37.sent;
4458
+ commitSnapshot = _context39.sent;
4386
4459
  refreshedProjection = commitSnapshot.projection;
4387
4460
  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 : ''))) {
4388
- _context37.next = 67;
4461
+ _context39.next = 67;
4389
4462
  break;
4390
4463
  }
4391
- _context37.next = 65;
4464
+ _context39.next = 65;
4392
4465
  return this.refreshAvailabilityContextProjection({
4393
4466
  contextId: normalizedContextId,
4394
4467
  reason: 'commit_order_revision_changed',
@@ -4420,7 +4493,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4420
4493
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
4421
4494
  });
4422
4495
  if (refreshedCandidateBase) {
4423
- _context37.next = 72;
4496
+ _context39.next = 72;
4424
4497
  break;
4425
4498
  }
4426
4499
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -4436,7 +4509,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4436
4509
  bookingCount: bookingCount
4437
4510
  });
4438
4511
  if (validation.ok) {
4439
- _context37.next = 76;
4512
+ _context39.next = 76;
4440
4513
  break;
4441
4514
  }
4442
4515
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -4459,7 +4532,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4459
4532
  incrementVersion: true
4460
4533
  });
4461
4534
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
4462
- _context37.next = 80;
4535
+ _context39.next = 80;
4463
4536
  return this.emitAvailabilityDiagnostic({
4464
4537
  action: 'refresh',
4465
4538
  contextId: normalizedContextId,
@@ -4483,7 +4556,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4483
4556
  return sameAvailabilityId(item.id, refreshedCandidate.productId);
4484
4557
  });
4485
4558
  if (product) {
4486
- _context37.next = 85;
4559
+ _context39.next = 85;
4487
4560
  break;
4488
4561
  }
4489
4562
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -4493,7 +4566,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4493
4566
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
4494
4567
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
4495
4568
  if (!(params.mode === 'edit' && !existingBookingUid)) {
4496
- _context37.next = 89;
4569
+ _context39.next = 89;
4497
4570
  break;
4498
4571
  }
4499
4572
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -4515,7 +4588,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4515
4588
  quantity: bookingCount
4516
4589
  }), 'unified_booking_sales', product);
4517
4590
  if (transformed) {
4518
- _context37.next = 94;
4591
+ _context39.next = 94;
4519
4592
  break;
4520
4593
  }
4521
4594
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -4534,7 +4607,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4534
4607
  productLineUids = [];
4535
4608
  bookingUids = [];
4536
4609
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
4537
- _context37.next = 113;
4610
+ _context39.next = 113;
4538
4611
  break;
4539
4612
  }
4540
4613
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -4544,7 +4617,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4544
4617
  unique_identification_number: params.productLineUid,
4545
4618
  booking_uid: existingBookingUid
4546
4619
  });
4547
- _context37.next = 107;
4620
+ _context39.next = 107;
4548
4621
  return this.updateOrderProduct({
4549
4622
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
4550
4623
  product_variant_id: (_ref49 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref49 !== void 0 ? _ref49 : 0,
@@ -4557,7 +4630,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4557
4630
  bookingUid = existingBookingUid;
4558
4631
  productLineUids = [productLineUid];
4559
4632
  bookingUids = [bookingUid];
4560
- _context37.next = 125;
4633
+ _context39.next = 125;
4561
4634
  break;
4562
4635
  case 113:
4563
4636
  beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
@@ -4566,10 +4639,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4566
4639
  beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
4567
4640
  return getBookingUid(item);
4568
4641
  }).filter(Boolean));
4569
- _context37.next = 117;
4642
+ _context39.next = 117;
4570
4643
  return this.addProductToOrder(transformed, booking);
4571
4644
  case 117:
4572
- products = _context37.sent;
4645
+ products = _context39.sent;
4573
4646
  addedLines = products.filter(function (line) {
4574
4647
  var _line$product_id, _line$metadata;
4575
4648
  return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
@@ -4606,21 +4679,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4606
4679
  productLineUids: productLineUids,
4607
4680
  bookingUids: bookingUids
4608
4681
  };
4609
- _context37.next = 130;
4682
+ _context39.next = 130;
4610
4683
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
4611
4684
  case 130:
4612
- return _context37.abrupt("return", result);
4685
+ return _context39.abrupt("return", result);
4613
4686
  case 131:
4614
- _context37.prev = 131;
4615
- _context37.next = 134;
4687
+ _context39.prev = 131;
4688
+ _context39.next = 134;
4616
4689
  return this.releaseAvailabilityCommitLock(normalizedContextId);
4617
4690
  case 134:
4618
- return _context37.finish(131);
4691
+ return _context39.finish(131);
4619
4692
  case 135:
4620
4693
  case "end":
4621
- return _context37.stop();
4694
+ return _context39.stop();
4622
4695
  }
4623
- }, _callee37, this, [[5,, 131, 135]]);
4696
+ }, _callee39, this, [[5,, 131, 135]]);
4624
4697
  }));
4625
4698
  function commitAvailabilitySelection(_x32, _x33) {
4626
4699
  return _commitAvailabilitySelection.apply(this, arguments);