@pisell/pisellos 2.3.172 → 2.3.174

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 (83) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +14 -8
  5. package/dist/modules/BookingContext/utils/productExtend.d.ts +5 -0
  6. package/dist/modules/BookingContext/utils/productExtend.js +61 -23
  7. package/dist/modules/Discount/index.js +0 -1
  8. package/dist/modules/OpenData/index.d.ts +1 -0
  9. package/dist/modules/OpenData/index.js +1 -0
  10. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  11. package/dist/modules/OpenData/salesSettings.js +80 -0
  12. package/dist/modules/OpenData/types.d.ts +13 -0
  13. package/dist/modules/Order/index.d.ts +3 -25
  14. package/dist/modules/Order/index.js +1313 -1772
  15. package/dist/modules/Order/types.d.ts +0 -7
  16. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  17. package/dist/modules/ProductList/index.js +12 -33
  18. package/dist/modules/Rules/index.d.ts +0 -2
  19. package/dist/modules/Rules/index.js +21 -29
  20. package/dist/solution/BaseSales/index.d.ts +1 -16
  21. package/dist/solution/BaseSales/index.js +1325 -1511
  22. package/dist/solution/BookingTicket/index.d.ts +2 -2
  23. package/dist/solution/BookingTicket/index.js +108 -200
  24. package/dist/solution/BookingTicket/types.d.ts +2 -14
  25. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  26. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -4
  27. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
  28. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
  29. package/dist/solution/BookingTicket/utils/scan/handleScan.js +1 -2
  30. package/dist/solution/UnifiedBookingSales/index.d.ts +23 -2
  31. package/dist/solution/UnifiedBookingSales/index.js +923 -683
  32. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  33. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  34. package/dist/utils/platform.d.ts +0 -2
  35. package/dist/utils/platform.js +0 -6
  36. package/lib/index.d.ts +0 -1
  37. package/lib/index.js +0 -12
  38. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
  39. package/lib/model/strategy/adapter/promotion/evaluator.js +13 -7
  40. package/lib/modules/BookingContext/utils/productExtend.d.ts +5 -0
  41. package/lib/modules/BookingContext/utils/productExtend.js +36 -3
  42. package/lib/modules/Discount/index.js +0 -1
  43. package/lib/modules/OpenData/index.d.ts +1 -0
  44. package/lib/modules/OpenData/index.js +12 -0
  45. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  46. package/lib/modules/OpenData/salesSettings.js +70 -0
  47. package/lib/modules/OpenData/types.d.ts +13 -0
  48. package/lib/modules/Order/index.d.ts +3 -25
  49. package/lib/modules/Order/index.js +38 -192
  50. package/lib/modules/Order/types.d.ts +0 -7
  51. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  52. package/lib/modules/ProductList/index.js +0 -15
  53. package/lib/modules/Rules/index.d.ts +0 -2
  54. package/lib/modules/Rules/index.js +0 -6
  55. package/lib/solution/BaseSales/index.d.ts +1 -16
  56. package/lib/solution/BaseSales/index.js +9 -89
  57. package/lib/solution/BookingTicket/index.d.ts +2 -2
  58. package/lib/solution/BookingTicket/index.js +2 -38
  59. package/lib/solution/BookingTicket/types.d.ts +2 -14
  60. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  61. package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -4
  62. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
  63. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
  64. package/lib/solution/BookingTicket/utils/scan/handleScan.js +1 -2
  65. package/lib/solution/UnifiedBookingSales/index.d.ts +23 -2
  66. package/lib/solution/UnifiedBookingSales/index.js +131 -15
  67. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  68. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  69. package/lib/utils/platform.d.ts +0 -2
  70. package/lib/utils/platform.js +0 -7
  71. package/package.json +1 -1
  72. package/dist/inventory/index.d.ts +0 -92
  73. package/dist/inventory/index.js +0 -509
  74. package/dist/modules/Order/utils/productVoucherGroups.d.ts +0 -15
  75. package/dist/modules/Order/utils/productVoucherGroups.js +0 -115
  76. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
  77. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -117
  78. package/lib/inventory/index.d.ts +0 -92
  79. package/lib/inventory/index.js +0 -287
  80. package/lib/modules/Order/utils/productVoucherGroups.d.ts +0 -15
  81. package/lib/modules/Order/utils/productVoucherGroups.js +0 -64
  82. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
  83. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -71
@@ -38,8 +38,9 @@ import { cloneDeep } from 'lodash-es';
38
38
  import { OpenDataModule } from "../../modules";
39
39
  import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
40
40
  import { cacheItemToBookingInput } from "../../modules/BookingContext/utils/cacheItemToBookingInput";
41
- import { flexibleObj, getServiceTimes, getUsableTime, isProductFlexibleDuration, isSessionProduct } from "../../modules/BookingContext/utils";
42
- import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
41
+ import { flexibleObj, getServiceTimes, getUsableTime, isProductFlexibleDuration, isSessionProduct, isBookingProduct, isMultiDayProduct } from "../../modules/BookingContext/utils";
42
+ import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeSalesSettings } from "../../modules/OpenData";
43
+ import { getBookingBoundary, getBookingHolderIds, normalizeBookingDateTime, resolveDefaultBookingStart } from "./salesSettings";
43
44
  import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
44
45
  import { AvailabilityError, createAvailabilityProjection, getDurationBusinessDate, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
45
46
  import { UnifiedBookingSalesHooks } from "./types";
@@ -47,11 +48,12 @@ import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
47
48
  import { BusinessAvailabilityController } from "./businessAvailability";
48
49
  import { BookingTicket } from "../BookingTicket";
49
50
  import { addLocalCalendarDays, captureRuntimeOffsetMinutes, extractFixedOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
50
- import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
51
+ import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
51
52
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
52
53
  export * from "./types";
54
+ export * from "./salesSettings";
53
55
  export { AvailabilityError } from "../../modules/ResourcePlanner";
54
- var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
56
+ var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability', 'interface'];
55
57
  function normalizePositiveInteger(value) {
56
58
  var normalized = Number(value);
57
59
  if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
@@ -1832,17 +1834,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1832
1834
  key: "setOtherParams",
1833
1835
  value: function () {
1834
1836
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
1835
- var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams15;
1837
+ var _this$otherParams10, _this$otherParams12;
1836
1838
  var _ref31,
1837
1839
  _ref31$cover,
1838
1840
  cover,
1839
1841
  previousScope,
1840
- previousCatalogScope,
1841
1842
  previousItemRuleConfig,
1842
1843
  explicitlySetsOpenData,
1843
1844
  nextParams,
1844
1845
  nextScope,
1845
- _this$otherParams14,
1846
+ _this$otherParams11,
1846
1847
  shouldResetAvailabilityState,
1847
1848
  _args4 = arguments;
1848
1849
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -1850,42 +1851,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1850
1851
  case 0:
1851
1852
  _ref31 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
1852
1853
  previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1853
- previousCatalogScope = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.catalogScopeKey;
1854
- previousItemRuleConfig = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule;
1854
+ previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
1855
1855
  explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
1856
1856
  nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
1857
1857
  if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
1858
1858
  this.clearOpenDataCache();
1859
1859
  }
1860
- _context4.next = 9;
1860
+ _context4.next = 8;
1861
1861
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
1862
1862
  cover: cover
1863
1863
  });
1864
- case 9:
1865
- if (!(previousCatalogScope !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.catalogScopeKey) && (previousCatalogScope || (_this$otherParams13 = this.otherParams) !== null && _this$otherParams13 !== void 0 && _this$otherParams13.catalogScopeKey))) {
1866
- _context4.next = 13;
1867
- break;
1868
- }
1869
- this.unifiedProductCatalog = [];
1870
- _context4.next = 13;
1871
- return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
1872
- case 13:
1864
+ case 8:
1873
1865
  nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1874
1866
  if (explicitlySetsOpenData) {
1875
- this.openDataTarget = (_this$otherParams14 = this.otherParams) !== null && _this$otherParams14 !== void 0 && _this$otherParams14.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1867
+ this.openDataTarget = (_this$otherParams11 = this.otherParams) !== null && _this$otherParams11 !== void 0 && _this$otherParams11.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1876
1868
  }
1877
1869
  shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
1878
1870
  if (!shouldResetAvailabilityState) {
1879
- _context4.next = 19;
1871
+ _context4.next = 14;
1880
1872
  break;
1881
1873
  }
1882
- _context4.next = 19;
1874
+ _context4.next = 14;
1883
1875
  return this.resetAvailabilityProjectionState('set_other_params_reset');
1884
- case 19:
1885
- if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.itemRule)) {
1876
+ case 14:
1877
+ if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.itemRule)) {
1886
1878
  this.resetAllergyItemRuleState();
1887
1879
  }
1888
- case 20:
1880
+ case 15:
1889
1881
  case "end":
1890
1882
  return _context4.stop();
1891
1883
  }
@@ -2125,8 +2117,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2125
2117
  }, {
2126
2118
  key: "isSessionStoragePersistEnabled",
2127
2119
  value: function isSessionStoragePersistEnabled() {
2128
- var _this$otherParams16;
2129
- return Boolean(this.cacheId && ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.enableSessionStoragePersist) === true);
2120
+ var _this$otherParams13;
2121
+ return Boolean(this.cacheId && ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableSessionStoragePersist) === true);
2130
2122
  }
2131
2123
  }, {
2132
2124
  key: "shouldUseSessionStorageForSubModule",
@@ -2193,12 +2185,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2193
2185
  key: "ensureLocalOrderNumbersForCheckout",
2194
2186
  value: (function () {
2195
2187
  var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
2196
- var _this$otherParams17, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2188
+ var _this$otherParams14, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2197
2189
  var order, tempOrder, biz, idGenerator;
2198
2190
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2199
2191
  while (1) switch (_context8.prev = _context8.next) {
2200
2192
  case 0:
2201
- if (!(normalizeRuntimePlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform) !== 'kiosk')) {
2193
+ if (!(normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform) !== 'kiosk')) {
2202
2194
  _context8.next = 2;
2203
2195
  break;
2204
2196
  }
@@ -2283,18 +2275,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2283
2275
  return ensureLocalOrderNumbersForCheckout;
2284
2276
  }()
2285
2277
  /**
2286
- * PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
2278
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
2287
2279
  * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
2288
2280
  */
2289
2281
  )
2290
2282
  }, {
2291
2283
  key: "shouldUseCheckoutSyncTask",
2292
2284
  value: function shouldUseCheckoutSyncTask() {
2293
- var _this$otherParams18, _this$otherParams19;
2294
- var configured = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.checkoutSyncTaskEnabled;
2285
+ var _this$otherParams15, _this$otherParams16;
2286
+ var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
2295
2287
  if (configured === true) return true;
2296
- var platform = normalizeRuntimePlatform((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform);
2297
- return !isCustomerUserPlatform(platform) && !isSelfServicePlatform(platform);
2288
+ var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
2289
+ return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
2298
2290
  }
2299
2291
 
2300
2292
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
@@ -2448,8 +2440,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2448
2440
  }, {
2449
2441
  key: "isAuthenticatedCustomerUserPlatform",
2450
2442
  value: function isAuthenticatedCustomerUserPlatform() {
2451
- var _this$otherParams20;
2452
- return isCustomerUserPlatform((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
2443
+ var _this$otherParams17;
2444
+ return isCustomerUserPlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
2453
2445
  }
2454
2446
  }, {
2455
2447
  key: "resolveDiscountOrderIdentity",
@@ -2784,39 +2776,297 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2784
2776
  return _getOpenData.apply(this, arguments);
2785
2777
  }
2786
2778
  return getOpenData;
2787
- }()
2779
+ }() /** One policy snapshot for all Sales 2.0 consumers. Network errors must reach the caller. */
2780
+ }, {
2781
+ key: "getSalesSettings",
2782
+ value: (function () {
2783
+ var _getSalesSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2784
+ var _this$otherParams18;
2785
+ var config;
2786
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2787
+ while (1) switch (_context18.prev = _context18.next) {
2788
+ case 0:
2789
+ _context18.next = 2;
2790
+ return this.getOpenData();
2791
+ case 2:
2792
+ config = _context18.sent;
2793
+ if (config) {
2794
+ _context18.next = 5;
2795
+ break;
2796
+ }
2797
+ throw new Error('Sales settings are unavailable without a business context.');
2798
+ case 5:
2799
+ return _context18.abrupt("return", normalizeSalesSettings(config, (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform));
2800
+ case 6:
2801
+ case "end":
2802
+ return _context18.stop();
2803
+ }
2804
+ }, _callee18, this);
2805
+ }));
2806
+ function getSalesSettings() {
2807
+ return _getSalesSettings.apply(this, arguments);
2808
+ }
2809
+ return getSalesSettings;
2810
+ }())
2811
+ }, {
2812
+ key: "getLoadedSalesSettings",
2813
+ value: function getLoadedSalesSettings() {
2814
+ var _this$otherParams19;
2815
+ if (!this.runtimeOpenDataSnapshot) {
2816
+ throw new Error('Sales settings are not loaded. Call getSalesSettings before preparing a booking.');
2817
+ }
2818
+ return normalizeSalesSettings(this.runtimeOpenDataSnapshot, (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform);
2819
+ }
2820
+ }, {
2821
+ key: "getProductBookingsForScheduling",
2822
+ value: function getProductBookingsForScheduling() {
2823
+ var _this$getTempOrder,
2824
+ _this6 = this;
2825
+ var seen = new Set();
2826
+ return (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).flatMap(function (product) {
2827
+ var _product$metadata4;
2828
+ if (((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.product_add_schedule_time) != null || product.deleted_at) return [];
2829
+ var booking = _this6.findLinkedBooking(product);
2830
+ if (!booking || isFulfillmentTimingBooking(booking) || seen.has(booking)) return [];
2831
+ seen.add(booking);
2832
+ return [booking];
2833
+ });
2834
+ }
2835
+ }, {
2836
+ key: "shouldApplyMultipleBookingScheduling",
2837
+ value: function shouldApplyMultipleBookingScheduling() {
2838
+ var _this$otherParams20;
2839
+ var platform = normalizeRuntimePlatform((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
2840
+ return platform === 'pos' || platform === 'webpos';
2841
+ }
2842
+ }, {
2843
+ key: "resolveLoadedDefaultBookingStart",
2844
+ value: function resolveLoadedDefaultBookingStart(holderIds, fallback) {
2845
+ // Customer channels keep their entry default instead of following cart bookings.
2846
+ // Keep this callback installed so BookingContext cannot fall back to Board.
2847
+ if (!this.shouldApplyMultipleBookingScheduling()) return normalizeBookingDateTime(fallback);
2848
+ var settings = this.getLoadedSalesSettings();
2849
+ return resolveDefaultBookingStart({
2850
+ bookings: this.getProductBookingsForScheduling(),
2851
+ holderIds: holderIds,
2852
+ mode: settings.reservation.multipleBookingScheduling,
2853
+ fallback: fallback
2854
+ });
2855
+ }
2856
+
2857
+ /** Used by the SKU flow after Holder changes, without changing an explicit user-selected time. */
2858
+ }, {
2859
+ key: "resolveDefaultBookingStart",
2860
+ value: (function () {
2861
+ var _resolveDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
2862
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2863
+ while (1) switch (_context19.prev = _context19.next) {
2864
+ case 0:
2865
+ if (this.shouldApplyMultipleBookingScheduling()) {
2866
+ _context19.next = 2;
2867
+ break;
2868
+ }
2869
+ return _context19.abrupt("return", normalizeBookingDateTime(params.fallback));
2870
+ case 2:
2871
+ _context19.next = 4;
2872
+ return this.getSalesSettings();
2873
+ case 4:
2874
+ return _context19.abrupt("return", this.resolveLoadedDefaultBookingStart(params.holderIds, params.fallback));
2875
+ case 5:
2876
+ case "end":
2877
+ return _context19.stop();
2878
+ }
2879
+ }, _callee19, this);
2880
+ }));
2881
+ function resolveDefaultBookingStart(_x10) {
2882
+ return _resolveDefaultBookingStart.apply(this, arguments);
2883
+ }
2884
+ return resolveDefaultBookingStart;
2885
+ }())
2886
+ }, {
2887
+ key: "buildBookingCalcContext",
2888
+ value: function buildBookingCalcContext(extra) {
2889
+ var _this7 = this;
2890
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildBookingCalcContext", this).call(this, extra)), {}, {
2891
+ resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
2892
+ var _extra$holderIds;
2893
+ return _this7.resolveLoadedDefaultBookingStart((_extra$holderIds = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds !== void 0 ? _extra$holderIds : getBookingHolderIds(cacheItem), fallback);
2894
+ }
2895
+ });
2896
+ }
2897
+ }, {
2898
+ key: "buildAddProductCtx",
2899
+ value: function buildAddProductCtx(extra) {
2900
+ var _this8 = this;
2901
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildAddProductCtx", this).call(this, extra)), {}, {
2902
+ resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
2903
+ var _extra$holderIds2;
2904
+ return _this8.resolveLoadedDefaultBookingStart((_extra$holderIds2 = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds2 !== void 0 ? _extra$holderIds2 : getBookingHolderIds(cacheItem), fallback);
2905
+ }
2906
+ });
2907
+ }
2908
+
2909
+ /** Re-evaluate an automatic default after Holder enrichment, or restore a known explicit TimeBar start. */
2910
+ }, {
2911
+ key: "applyDefaultBookingStart",
2912
+ value: (function () {
2913
+ var _applyDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(cacheItem) {
2914
+ var _cacheItem$_extend, _cacheItem$_data, _options$holderIds, _ref34, _normalizeBookingDate, _cacheItem$_data2;
2915
+ var options,
2916
+ extend,
2917
+ currentStart,
2918
+ automaticStart,
2919
+ explicitStart,
2920
+ holderIds,
2921
+ fallback,
2922
+ nextStart,
2923
+ data,
2924
+ nextExtend,
2925
+ _i,
2926
+ _arr,
2927
+ key,
2928
+ shiftDays,
2929
+ _args20 = arguments;
2930
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2931
+ while (1) switch (_context20.prev = _context20.next) {
2932
+ case 0:
2933
+ options = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
2934
+ if (this.shouldApplyMultipleBookingScheduling()) {
2935
+ _context20.next = 3;
2936
+ break;
2937
+ }
2938
+ return _context20.abrupt("return", cacheItem);
2939
+ case 3:
2940
+ if (!(!(cacheItem !== null && cacheItem !== void 0 && cacheItem.new) || !isBookingProduct(cacheItem) || isSessionProduct(cacheItem) || cacheItem !== null && cacheItem !== void 0 && (_cacheItem$_extend = cacheItem._extend) !== null && _cacheItem$_extend !== void 0 && (_cacheItem$_extend = _cacheItem$_extend.other) !== null && _cacheItem$_extend !== void 0 && _cacheItem$_extend.session)) {
2941
+ _context20.next = 5;
2942
+ break;
2943
+ }
2944
+ return _context20.abrupt("return", cacheItem);
2945
+ case 5:
2946
+ extend = cacheItem._extend || {};
2947
+ currentStart = getBookingBoundary(extend, 'start');
2948
+ automaticStart = normalizeBookingDateTime((_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.salesDefaultBookingStart);
2949
+ if (!(extend.start_time && (!automaticStart || !currentStart || dayjs(currentStart).valueOf() !== dayjs(automaticStart).valueOf()))) {
2950
+ _context20.next = 10;
2951
+ break;
2952
+ }
2953
+ return _context20.abrupt("return", cacheItem);
2954
+ case 10:
2955
+ explicitStart = normalizeBookingDateTime(options.explicitStart);
2956
+ if (!(options.explicitStart !== undefined && !explicitStart)) {
2957
+ _context20.next = 13;
2958
+ break;
2959
+ }
2960
+ throw new Error('The explicit booking start must be a valid date and time.');
2961
+ case 13:
2962
+ holderIds = (_options$holderIds = options.holderIds) !== null && _options$holderIds !== void 0 ? _options$holderIds : getBookingHolderIds(cacheItem);
2963
+ fallback = (_ref34 = (_normalizeBookingDate = normalizeBookingDateTime((_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.salesDefaultBookingFallback)) !== null && _normalizeBookingDate !== void 0 ? _normalizeBookingDate : currentStart) !== null && _ref34 !== void 0 ? _ref34 : normalizeBookingDateTime(String(this.getBookingDate() || ''));
2964
+ if (!(explicitStart !== null && explicitStart !== void 0)) {
2965
+ _context20.next = 19;
2966
+ break;
2967
+ }
2968
+ _context20.t0 = explicitStart;
2969
+ _context20.next = 22;
2970
+ break;
2971
+ case 19:
2972
+ _context20.next = 21;
2973
+ return this.resolveDefaultBookingStart({
2974
+ holderIds: holderIds,
2975
+ fallback: fallback
2976
+ });
2977
+ case 21:
2978
+ _context20.t0 = _context20.sent;
2979
+ case 22:
2980
+ nextStart = _context20.t0;
2981
+ if (nextStart) {
2982
+ _context20.next = 25;
2983
+ break;
2984
+ }
2985
+ return _context20.abrupt("return", cacheItem);
2986
+ case 25:
2987
+ if (!(currentStart && dayjs(nextStart).valueOf() === dayjs(currentStart).valueOf())) {
2988
+ _context20.next = 32;
2989
+ break;
2990
+ }
2991
+ if (explicitStart) {
2992
+ _context20.next = 28;
2993
+ break;
2994
+ }
2995
+ return _context20.abrupt("return", cacheItem);
2996
+ case 28:
2997
+ data = _objectSpread({}, cacheItem._data);
2998
+ delete data.salesDefaultBookingStart;
2999
+ delete data.salesDefaultBookingFallback;
3000
+ return _context20.abrupt("return", _objectSpread(_objectSpread({}, cacheItem), {}, {
3001
+ _data: data
3002
+ }));
3003
+ case 32:
3004
+ nextExtend = _objectSpread(_objectSpread({}, extend), {}, {
3005
+ start_date: nextStart.slice(0, 10),
3006
+ start_time: nextStart.slice(11)
3007
+ });
3008
+ for (_i = 0, _arr = ['startDate', 'endDate', 'end_time', 'resource', 'resources', 'availabilitySelection']; _i < _arr.length; _i++) {
3009
+ key = _arr[_i];
3010
+ delete nextExtend[key];
3011
+ }
3012
+ if (isMultiDayProduct(cacheItem) && currentStart && extend.end_date) {
3013
+ shiftDays = dayjs(nextStart.slice(0, 10)).diff(dayjs(currentStart.slice(0, 10)), 'day');
3014
+ nextExtend.end_date = dayjs(extend.end_date).add(shiftDays, 'day').format('YYYY-MM-DD');
3015
+ } else {
3016
+ delete nextExtend.end_date;
3017
+ }
3018
+ return _context20.abrupt("return", this.getProductExtend(_objectSpread(_objectSpread({}, cacheItem), {}, {
3019
+ _extend: nextExtend,
3020
+ _data: explicitStart ? {} : {
3021
+ salesDefaultBookingStart: nextStart,
3022
+ salesDefaultBookingFallback: fallback
3023
+ }
3024
+ }), {
3025
+ holderIds: holderIds
3026
+ }));
3027
+ case 36:
3028
+ case "end":
3029
+ return _context20.stop();
3030
+ }
3031
+ }, _callee20, this);
3032
+ }));
3033
+ function applyDefaultBookingStart(_x11) {
3034
+ return _applyDefaultBookingStart.apply(this, arguments);
3035
+ }
3036
+ return applyDefaultBookingStart;
3037
+ }())
2788
3038
  }, {
2789
3039
  key: "loadPickupTimingOpenData",
2790
3040
  value: function () {
2791
- var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_force) {
2792
- var _ref34, _this$otherParams$bus2, _this$otherParams21, _this$otherParams22;
3041
+ var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_force) {
3042
+ var _ref35, _this$otherParams$bus2, _this$otherParams21, _this$otherParams22;
2793
3043
  var scope, businessCode, config;
2794
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2795
- while (1) switch (_context18.prev = _context18.next) {
3044
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3045
+ while (1) switch (_context21.prev = _context21.next) {
2796
3046
  case 0:
2797
3047
  scope = this.getPickupTimingScope();
2798
- businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2799
- _context18.next = 4;
3048
+ businessCode = String((_ref35 = (_this$otherParams$bus2 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code) !== null && _ref35 !== void 0 ? _ref35 : '').trim();
3049
+ _context21.next = 4;
2800
3050
  return this.loadOpenData({
2801
3051
  businessCode: businessCode,
2802
3052
  channel: this.getSubmitOrderSalesChannel()
2803
3053
  });
2804
3054
  case 4:
2805
- config = _context18.sent;
3055
+ config = _context21.sent;
2806
3056
  if (!(scope !== this.getPickupTimingScope())) {
2807
- _context18.next = 7;
3057
+ _context21.next = 7;
2808
3058
  break;
2809
3059
  }
2810
3060
  throw new Error('Store settings changed. Please try again.');
2811
3061
  case 7:
2812
- return _context18.abrupt("return", config);
3062
+ return _context21.abrupt("return", config);
2813
3063
  case 8:
2814
3064
  case "end":
2815
- return _context18.stop();
3065
+ return _context21.stop();
2816
3066
  }
2817
- }, _callee18, this);
3067
+ }, _callee21, this);
2818
3068
  }));
2819
- function loadPickupTimingOpenData(_x10) {
3069
+ function loadPickupTimingOpenData(_x12) {
2820
3070
  return _loadPickupTimingOpenData.apply(this, arguments);
2821
3071
  }
2822
3072
  return loadPickupTimingOpenData;
@@ -2831,19 +3081,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2831
3081
  }, {
2832
3082
  key: "fetchAllergyItemRuleConfigs",
2833
3083
  value: function () {
2834
- var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(strategyModelIds) {
3084
+ var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(strategyModelIds) {
2835
3085
  var _response$data, response, list;
2836
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2837
- while (1) switch (_context19.prev = _context19.next) {
3086
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
3087
+ while (1) switch (_context22.prev = _context22.next) {
2838
3088
  case 0:
2839
3089
  if (strategyModelIds.length) {
2840
- _context19.next = 2;
3090
+ _context22.next = 2;
2841
3091
  break;
2842
3092
  }
2843
- return _context19.abrupt("return", []);
3093
+ return _context22.abrupt("return", []);
2844
3094
  case 2:
2845
- _context19.prev = 2;
2846
- _context19.next = 5;
3095
+ _context22.prev = 2;
3096
+ _context22.next = 5;
2847
3097
  return this.request.get('/promotion', {
2848
3098
  skip: 1,
2849
3099
  num: 99,
@@ -2851,28 +3101,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2851
3101
  ids: strategyModelIds
2852
3102
  });
2853
3103
  case 5:
2854
- response = _context19.sent;
3104
+ response = _context22.sent;
2855
3105
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
2856
- _context19.next = 8;
3106
+ _context22.next = 8;
2857
3107
  break;
2858
3108
  }
2859
3109
  throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
2860
3110
  case 8:
2861
3111
  list = response.data.list;
2862
- return _context19.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
3112
+ return _context22.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2863
3113
  return item === null || item === void 0 ? void 0 : item.metadata;
2864
3114
  })));
2865
3115
  case 12:
2866
- _context19.prev = 12;
2867
- _context19.t0 = _context19["catch"](2);
2868
- throw _context19.t0;
3116
+ _context22.prev = 12;
3117
+ _context22.t0 = _context22["catch"](2);
3118
+ throw _context22.t0;
2869
3119
  case 15:
2870
3120
  case "end":
2871
- return _context19.stop();
3121
+ return _context22.stop();
2872
3122
  }
2873
- }, _callee19, this, [[2, 12]]);
3123
+ }, _callee22, this, [[2, 12]]);
2874
3124
  }));
2875
- function fetchAllergyItemRuleConfigs(_x11) {
3125
+ function fetchAllergyItemRuleConfigs(_x13) {
2876
3126
  return _fetchAllergyItemRuleConfigs.apply(this, arguments);
2877
3127
  }
2878
3128
  return fetchAllergyItemRuleConfigs;
@@ -2880,72 +3130,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2880
3130
  }, {
2881
3131
  key: "ensureAllergyItemRuleConfigsLoaded",
2882
3132
  value: function () {
2883
- var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2884
- var _this6 = this;
2885
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2886
- while (1) switch (_context21.prev = _context21.next) {
3133
+ var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
3134
+ var _this9 = this;
3135
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3136
+ while (1) switch (_context24.prev = _context24.next) {
2887
3137
  case 0:
2888
3138
  if (!(this.allergyItemRuleConfigs.length > 0)) {
2889
- _context21.next = 2;
3139
+ _context24.next = 2;
2890
3140
  break;
2891
3141
  }
2892
- return _context21.abrupt("return", this.allergyItemRuleConfigs);
3142
+ return _context24.abrupt("return", this.allergyItemRuleConfigs);
2893
3143
  case 2:
2894
3144
  if (!this.allergyItemRuleConfigsPromise) {
2895
- _context21.next = 4;
3145
+ _context24.next = 4;
2896
3146
  break;
2897
3147
  }
2898
- return _context21.abrupt("return", this.allergyItemRuleConfigsPromise);
3148
+ return _context24.abrupt("return", this.allergyItemRuleConfigsPromise);
2899
3149
  case 4:
2900
- this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2901
- var _this6$otherParams;
3150
+ this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
3151
+ var _this9$otherParams;
2902
3152
  var staticConfigs, openData, enabled, strategyModelIds, loaded;
2903
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2904
- while (1) switch (_context20.prev = _context20.next) {
3153
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3154
+ while (1) switch (_context23.prev = _context23.next) {
2905
3155
  case 0:
2906
- staticConfigs = normalizeItemRuleStrategyConfigs((_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 || (_this6$otherParams = _this6$otherParams.itemRule) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.strategyConfigs);
3156
+ staticConfigs = normalizeItemRuleStrategyConfigs((_this9$otherParams = _this9.otherParams) === null || _this9$otherParams === void 0 || (_this9$otherParams = _this9$otherParams.itemRule) === null || _this9$otherParams === void 0 ? void 0 : _this9$otherParams.strategyConfigs);
2907
3157
  if (!(staticConfigs.length > 0)) {
2908
- _context20.next = 5;
3158
+ _context23.next = 5;
2909
3159
  break;
2910
3160
  }
2911
- _this6.allergyItemRuleConfigs = staticConfigs;
2912
- _this6.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
2913
- return _context20.abrupt("return", staticConfigs);
3161
+ _this9.allergyItemRuleConfigs = staticConfigs;
3162
+ _this9.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
3163
+ return _context23.abrupt("return", staticConfigs);
2914
3164
  case 5:
2915
- _context20.next = 7;
2916
- return _this6.getOpenData();
3165
+ _context23.next = 7;
3166
+ return _this9.getOpenData();
2917
3167
  case 7:
2918
- openData = _context20.sent;
3168
+ openData = _context23.sent;
2919
3169
  enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
2920
3170
  strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
2921
3171
  if (!(!enabled || !strategyModelIds.length)) {
2922
- _context20.next = 13;
3172
+ _context23.next = 13;
2923
3173
  break;
2924
3174
  }
2925
- _this6.allergyItemRuleEvaluator.setStrategyConfigs([]);
2926
- return _context20.abrupt("return", []);
3175
+ _this9.allergyItemRuleEvaluator.setStrategyConfigs([]);
3176
+ return _context23.abrupt("return", []);
2927
3177
  case 13:
2928
- _context20.next = 15;
2929
- return _this6.fetchAllergyItemRuleConfigs(strategyModelIds);
3178
+ _context23.next = 15;
3179
+ return _this9.fetchAllergyItemRuleConfigs(strategyModelIds);
2930
3180
  case 15:
2931
- loaded = _context20.sent;
2932
- _this6.allergyItemRuleConfigs = loaded;
2933
- _this6.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
2934
- return _context20.abrupt("return", loaded);
3181
+ loaded = _context23.sent;
3182
+ _this9.allergyItemRuleConfigs = loaded;
3183
+ _this9.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
3184
+ return _context23.abrupt("return", loaded);
2935
3185
  case 19:
2936
3186
  case "end":
2937
- return _context20.stop();
3187
+ return _context23.stop();
2938
3188
  }
2939
- }, _callee20);
3189
+ }, _callee23);
2940
3190
  }))().catch(function () {
2941
3191
  return [];
2942
3192
  });
2943
- return _context21.abrupt("return", this.allergyItemRuleConfigsPromise);
3193
+ return _context24.abrupt("return", this.allergyItemRuleConfigsPromise);
2944
3194
  case 6:
2945
3195
  case "end":
2946
- return _context21.stop();
3196
+ return _context24.stop();
2947
3197
  }
2948
- }, _callee21, this);
3198
+ }, _callee24, this);
2949
3199
  }));
2950
3200
  function ensureAllergyItemRuleConfigsLoaded() {
2951
3201
  return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
@@ -2959,51 +3209,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2959
3209
  }, {
2960
3210
  key: "resolveProductAllergyRequirement",
2961
3211
  value: (function () {
2962
- var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2963
- var _this$otherParams23, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams24, _ref38, _ref39, _params$channel, _this$otherParams25, _this$otherParams26, _runtimeConfig$submis;
3212
+ var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3213
+ var _this$otherParams23, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref38, _runtimeConfig$servic, _this$otherParams24, _ref39, _ref40, _params$channel, _this$otherParams25, _this$otherParams26, _runtimeConfig$submis;
2964
3214
  var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
2965
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2966
- while (1) switch (_context22.prev = _context22.next) {
3215
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3216
+ while (1) switch (_context25.prev = _context25.next) {
2967
3217
  case 0:
2968
3218
  productId = normalizePositiveInteger(params.productId);
2969
3219
  if (productId) {
2970
- _context22.next = 3;
3220
+ _context25.next = 3;
2971
3221
  break;
2972
3222
  }
2973
- return _context22.abrupt("return", null);
3223
+ return _context25.abrupt("return", null);
2974
3224
  case 3:
2975
- _context22.next = 5;
3225
+ _context25.next = 5;
2976
3226
  return this.ensureAllergyItemRuleConfigsLoaded();
2977
3227
  case 5:
2978
- strategyConfigs = _context22.sent;
3228
+ strategyConfigs = _context25.sent;
2979
3229
  if (strategyConfigs.length) {
2980
- _context22.next = 8;
3230
+ _context25.next = 8;
2981
3231
  break;
2982
3232
  }
2983
- return _context22.abrupt("return", null);
3233
+ return _context25.abrupt("return", null);
2984
3234
  case 8:
2985
3235
  productVariantId = normalizePositiveInteger(params.productVariantId);
2986
3236
  runtimeConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.itemRule) || {};
2987
3237
  runtimePax = runtimeConfig.pax || {};
2988
3238
  cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
2989
- var _item$product_id, _item$product_variant, _ref36, _item$num;
3239
+ var _item$product_id, _item$product_variant, _ref37, _item$num;
2990
3240
  return {
2991
3241
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
2992
3242
  product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
2993
- quantity: Number((_ref36 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref36 !== void 0 ? _ref36 : 0)
3243
+ quantity: Number((_ref37 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref37 !== void 0 ? _ref37 : 0)
2994
3244
  };
2995
3245
  }).filter(function (item) {
2996
3246
  return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
2997
3247
  });
2998
- return _context22.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
3248
+ return _context25.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2999
3249
  pax: {
3000
3250
  total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
3001
3251
  adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
3002
3252
  child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
3003
3253
  },
3004
3254
  cartItems: cartItems,
3005
- serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
3006
- channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
3255
+ serviceType: String((_ref38 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.serviceType) !== null && _ref38 !== void 0 ? _ref38 : ''),
3256
+ channel: String((_ref39 = (_ref40 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) !== null && _ref40 !== void 0 ? _ref40 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _ref39 !== void 0 ? _ref39 : ''),
3007
3257
  currentProduct: _objectSpread({
3008
3258
  product_id: productId
3009
3259
  }, productVariantId ? {
@@ -3015,11 +3265,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3015
3265
  }));
3016
3266
  case 13:
3017
3267
  case "end":
3018
- return _context22.stop();
3268
+ return _context25.stop();
3019
3269
  }
3020
- }, _callee22, this);
3270
+ }, _callee25, this);
3021
3271
  }));
3022
- function resolveProductAllergyRequirement(_x12) {
3272
+ function resolveProductAllergyRequirement(_x14) {
3023
3273
  return _resolveProductAllergyRequirement.apply(this, arguments);
3024
3274
  }
3025
3275
  return resolveProductAllergyRequirement;
@@ -3033,27 +3283,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3033
3283
  }, {
3034
3284
  key: "getInvoiceLayoutConfig",
3035
3285
  value: function () {
3036
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
3286
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3037
3287
  var openData;
3038
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3039
- while (1) switch (_context23.prev = _context23.next) {
3288
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3289
+ while (1) switch (_context26.prev = _context26.next) {
3040
3290
  case 0:
3041
- _context23.next = 2;
3291
+ _context26.next = 2;
3042
3292
  return this.getOpenData();
3043
3293
  case 2:
3044
- openData = _context23.sent;
3294
+ openData = _context26.sent;
3045
3295
  if (!(!openData || !this.store.openData)) {
3046
- _context23.next = 5;
3296
+ _context26.next = 5;
3047
3297
  break;
3048
3298
  }
3049
- return _context23.abrupt("return", getDefaultInvoiceLayoutConfig());
3299
+ return _context26.abrupt("return", getDefaultInvoiceLayoutConfig());
3050
3300
  case 5:
3051
- return _context23.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
3301
+ return _context26.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
3052
3302
  case 6:
3053
3303
  case "end":
3054
- return _context23.stop();
3304
+ return _context26.stop();
3055
3305
  }
3056
- }, _callee23, this);
3306
+ }, _callee26, this);
3057
3307
  }));
3058
3308
  function getInvoiceLayoutConfig() {
3059
3309
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -3063,27 +3313,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3063
3313
  }, {
3064
3314
  key: "getInvoiceTemplateSettings",
3065
3315
  value: function () {
3066
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
3316
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3067
3317
  var openData;
3068
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3069
- while (1) switch (_context24.prev = _context24.next) {
3318
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3319
+ while (1) switch (_context27.prev = _context27.next) {
3070
3320
  case 0:
3071
- _context24.next = 2;
3321
+ _context27.next = 2;
3072
3322
  return this.getOpenData();
3073
3323
  case 2:
3074
- openData = _context24.sent;
3324
+ openData = _context27.sent;
3075
3325
  if (!(!openData || !this.store.openData)) {
3076
- _context24.next = 5;
3326
+ _context27.next = 5;
3077
3327
  break;
3078
3328
  }
3079
- return _context24.abrupt("return", getDefaultInvoiceTemplateSettings());
3329
+ return _context27.abrupt("return", getDefaultInvoiceTemplateSettings());
3080
3330
  case 5:
3081
- return _context24.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
3331
+ return _context27.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
3082
3332
  case 6:
3083
3333
  case "end":
3084
- return _context24.stop();
3334
+ return _context27.stop();
3085
3335
  }
3086
- }, _callee24, this);
3336
+ }, _callee27, this);
3087
3337
  }));
3088
3338
  function getInvoiceTemplateSettings() {
3089
3339
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -3106,30 +3356,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3106
3356
  }, {
3107
3357
  key: "getProtocol",
3108
3358
  value: (function () {
3109
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(policyId) {
3359
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(policyId) {
3110
3360
  var normalizedPolicyId, policyUrl;
3111
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3112
- while (1) switch (_context25.prev = _context25.next) {
3361
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3362
+ while (1) switch (_context28.prev = _context28.next) {
3113
3363
  case 0:
3114
3364
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
3115
3365
  if (normalizedPolicyId) {
3116
- _context25.next = 3;
3366
+ _context28.next = 3;
3117
3367
  break;
3118
3368
  }
3119
3369
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
3120
3370
  case 3:
3121
3371
  policyUrl = 'shop-policy';
3122
- if (isSelfServicePlatform(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
3372
+ if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
3123
3373
  policyUrl = 'policy';
3124
3374
  }
3125
- return _context25.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
3375
+ return _context28.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
3126
3376
  case 6:
3127
3377
  case "end":
3128
- return _context25.stop();
3378
+ return _context28.stop();
3129
3379
  }
3130
- }, _callee25, this);
3380
+ }, _callee28, this);
3131
3381
  }));
3132
- function getProtocol(_x13) {
3382
+ function getProtocol(_x15) {
3133
3383
  return _getProtocol.apply(this, arguments);
3134
3384
  }
3135
3385
  return getProtocol;
@@ -3142,29 +3392,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3142
3392
  }, {
3143
3393
  key: "loadProducts",
3144
3394
  value: (function () {
3145
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3395
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3146
3396
  var params,
3147
3397
  options,
3148
- catalogScope,
3149
3398
  schedule_date,
3150
3399
  schedule_datetime,
3151
3400
  result,
3152
- _args26 = arguments;
3153
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3154
- while (1) switch (_context26.prev = _context26.next) {
3401
+ _args29 = arguments;
3402
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3403
+ while (1) switch (_context29.prev = _context29.next) {
3155
3404
  case 0:
3156
- params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
3157
- options = _args26.length > 1 ? _args26[1] : undefined;
3405
+ params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
3406
+ options = _args29.length > 1 ? _args29[1] : undefined;
3158
3407
  if (this.store.products) {
3159
- _context26.next = 4;
3408
+ _context29.next = 4;
3160
3409
  break;
3161
3410
  }
3162
3411
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
3163
3412
  case 4:
3164
- catalogScope = this.otherParams.catalogScopeKey;
3165
3413
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
3166
3414
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
3167
- _context26.next = 9;
3415
+ _context29.next = 8;
3168
3416
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
3169
3417
  with_count: ['bundleGroup', 'optionGroup'],
3170
3418
  with_schedule: 1
@@ -3173,26 +3421,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3173
3421
  schedule_datetime: schedule_datetime,
3174
3422
  cacheId: this.cacheId
3175
3423
  }), options);
3176
- case 9:
3177
- result = _context26.sent;
3178
- if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
3179
- _context26.next = 12;
3180
- break;
3181
- }
3182
- throw Object.assign(new Error('Product scope changed'), {
3183
- name: 'AbortError'
3184
- });
3185
- case 12:
3424
+ case 8:
3425
+ result = _context29.sent;
3186
3426
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
3187
- _context26.next = 15;
3427
+ _context29.next = 12;
3188
3428
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
3189
- case 15:
3190
- return _context26.abrupt("return", result);
3191
- case 16:
3429
+ case 12:
3430
+ return _context29.abrupt("return", result);
3431
+ case 13:
3192
3432
  case "end":
3193
- return _context26.stop();
3433
+ return _context29.stop();
3194
3434
  }
3195
- }, _callee26, this);
3435
+ }, _callee29, this);
3196
3436
  }));
3197
3437
  function loadProducts() {
3198
3438
  return _loadProducts.apply(this, arguments);
@@ -3202,25 +3442,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3202
3442
  }, {
3203
3443
  key: "queryProducts",
3204
3444
  value: function () {
3205
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3445
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3206
3446
  var params,
3207
- _args27 = arguments;
3208
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3209
- while (1) switch (_context27.prev = _context27.next) {
3447
+ _args30 = arguments;
3448
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3449
+ while (1) switch (_context30.prev = _context30.next) {
3210
3450
  case 0:
3211
- params = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
3451
+ params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
3212
3452
  if (this.store.products) {
3213
- _context27.next = 3;
3453
+ _context30.next = 3;
3214
3454
  break;
3215
3455
  }
3216
3456
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
3217
3457
  case 3:
3218
- return _context27.abrupt("return", this.store.products.queryProducts(params));
3458
+ return _context30.abrupt("return", this.store.products.queryProducts(params));
3219
3459
  case 4:
3220
3460
  case "end":
3221
- return _context27.stop();
3461
+ return _context30.stop();
3222
3462
  }
3223
- }, _callee27, this);
3463
+ }, _callee30, this);
3224
3464
  }));
3225
3465
  function queryProducts() {
3226
3466
  return _queryProducts.apply(this, arguments);
@@ -3230,24 +3470,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3230
3470
  }, {
3231
3471
  key: "loadScheduleAvailableDate",
3232
3472
  value: (function () {
3233
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3234
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3235
- while (1) switch (_context28.prev = _context28.next) {
3473
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3474
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3475
+ while (1) switch (_context31.prev = _context31.next) {
3236
3476
  case 0:
3237
3477
  if (this.store.schedule) {
3238
- _context28.next = 2;
3478
+ _context31.next = 2;
3239
3479
  break;
3240
3480
  }
3241
3481
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
3242
3482
  case 2:
3243
- return _context28.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
3483
+ return _context31.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
3244
3484
  case 3:
3245
3485
  case "end":
3246
- return _context28.stop();
3486
+ return _context31.stop();
3247
3487
  }
3248
- }, _callee28, this);
3488
+ }, _callee31, this);
3249
3489
  }));
3250
- function loadScheduleAvailableDate(_x14) {
3490
+ function loadScheduleAvailableDate(_x16) {
3251
3491
  return _loadScheduleAvailableDate.apply(this, arguments);
3252
3492
  }
3253
3493
  return loadScheduleAvailableDate;
@@ -3261,15 +3501,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3261
3501
  }, {
3262
3502
  key: "loadProductsByScheduleDate",
3263
3503
  value: (function () {
3264
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3504
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3265
3505
  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;
3266
3506
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator2, _step2, productId, result;
3267
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3268
- while (1) switch (_context29.prev = _context29.next) {
3507
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3508
+ while (1) switch (_context32.prev = _context32.next) {
3269
3509
  case 0:
3270
3510
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
3271
3511
  if (this.store.schedule) {
3272
- _context29.next = 3;
3512
+ _context32.next = 3;
3273
3513
  break;
3274
3514
  }
3275
3515
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -3280,10 +3520,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3280
3520
  });
3281
3521
  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;
3282
3522
  if (!(!hasCachedDate && !hasOtherProducts)) {
3283
- _context29.next = 9;
3523
+ _context32.next = 9;
3284
3524
  break;
3285
3525
  }
3286
- _context29.next = 9;
3526
+ _context32.next = 9;
3287
3527
  return this.loadScheduleAvailableDate({
3288
3528
  startDate: date,
3289
3529
  endDate: date,
@@ -3303,45 +3543,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3303
3543
  return !productIdFilter || productIdFilter.has(String(id));
3304
3544
  });
3305
3545
  if (availableProductIds.length) {
3306
- _context29.next = 17;
3546
+ _context32.next = 17;
3307
3547
  break;
3308
3548
  }
3309
3549
  this.unifiedProductCatalog = [];
3310
- _context29.next = 16;
3550
+ _context32.next = 16;
3311
3551
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
3312
3552
  case 16:
3313
- return _context29.abrupt("return", []);
3553
+ return _context32.abrupt("return", []);
3314
3554
  case 17:
3315
- _context29.next = 19;
3555
+ _context32.next = 19;
3316
3556
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3317
3557
  product_ids: availableProductIds,
3318
3558
  schedule_date: date
3319
3559
  }));
3320
3560
  case 19:
3321
- products = _context29.sent;
3561
+ products = _context32.sent;
3322
3562
  if (!(products.length || availableProductIds.length <= 1)) {
3323
- _context29.next = 22;
3563
+ _context32.next = 22;
3324
3564
  break;
3325
3565
  }
3326
- return _context29.abrupt("return", products);
3566
+ return _context32.abrupt("return", products);
3327
3567
  case 22:
3328
3568
  fallbackProducts = [];
3329
3569
  _iterator2 = _createForOfIteratorHelper(availableProductIds);
3330
- _context29.prev = 24;
3570
+ _context32.prev = 24;
3331
3571
  _iterator2.s();
3332
3572
  case 26:
3333
3573
  if ((_step2 = _iterator2.n()).done) {
3334
- _context29.next = 34;
3574
+ _context32.next = 34;
3335
3575
  break;
3336
3576
  }
3337
3577
  productId = _step2.value;
3338
- _context29.next = 30;
3578
+ _context32.next = 30;
3339
3579
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3340
3580
  product_ids: [productId],
3341
3581
  schedule_date: date
3342
3582
  }));
3343
3583
  case 30:
3344
- result = _context29.sent;
3584
+ result = _context32.sent;
3345
3585
  result.forEach(function (product) {
3346
3586
  var _id;
3347
3587
  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;
@@ -3353,32 +3593,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3353
3593
  }
3354
3594
  });
3355
3595
  case 32:
3356
- _context29.next = 26;
3596
+ _context32.next = 26;
3357
3597
  break;
3358
3598
  case 34:
3359
- _context29.next = 39;
3599
+ _context32.next = 39;
3360
3600
  break;
3361
3601
  case 36:
3362
- _context29.prev = 36;
3363
- _context29.t0 = _context29["catch"](24);
3364
- _iterator2.e(_context29.t0);
3602
+ _context32.prev = 36;
3603
+ _context32.t0 = _context32["catch"](24);
3604
+ _iterator2.e(_context32.t0);
3365
3605
  case 39:
3366
- _context29.prev = 39;
3606
+ _context32.prev = 39;
3367
3607
  _iterator2.f();
3368
- return _context29.finish(39);
3608
+ return _context32.finish(39);
3369
3609
  case 42:
3370
3610
  this.unifiedProductCatalog = [].concat(fallbackProducts);
3371
- _context29.next = 45;
3611
+ _context32.next = 45;
3372
3612
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
3373
3613
  case 45:
3374
- return _context29.abrupt("return", fallbackProducts);
3614
+ return _context32.abrupt("return", fallbackProducts);
3375
3615
  case 46:
3376
3616
  case "end":
3377
- return _context29.stop();
3617
+ return _context32.stop();
3378
3618
  }
3379
- }, _callee29, this, [[24, 36, 39, 42]]);
3619
+ }, _callee32, this, [[24, 36, 39, 42]]);
3380
3620
  }));
3381
- function loadProductsByScheduleDate(_x15) {
3621
+ function loadProductsByScheduleDate(_x17) {
3382
3622
  return _loadProductsByScheduleDate.apply(this, arguments);
3383
3623
  }
3384
3624
  return loadProductsByScheduleDate;
@@ -3431,7 +3671,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3431
3671
  }, {
3432
3672
  key: "applyPlannerDiscounts",
3433
3673
  value: (function () {
3434
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3674
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3435
3675
  var _params$customerId;
3436
3676
  var params,
3437
3677
  tempOrder,
@@ -3448,24 +3688,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3448
3688
  discount,
3449
3689
  discountId,
3450
3690
  nextTempOrder,
3451
- _args30 = arguments;
3452
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3453
- while (1) switch (_context30.prev = _context30.next) {
3691
+ _args33 = arguments;
3692
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3693
+ while (1) switch (_context33.prev = _context33.next) {
3454
3694
  case 0:
3455
- params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
3695
+ params = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {};
3456
3696
  tempOrder = this.getTempOrder();
3457
3697
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
3458
3698
  parsedCustomerId = Number(requestedCustomerId);
3459
3699
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
3460
- _context30.next = 7;
3700
+ _context33.next = 7;
3461
3701
  return this.getSummary();
3462
3702
  case 7:
3463
- summaryBefore = _context30.sent;
3703
+ summaryBefore = _context33.sent;
3464
3704
  if (customerId) {
3465
- _context30.next = 10;
3705
+ _context33.next = 10;
3466
3706
  break;
3467
3707
  }
3468
- return _context30.abrupt("return", buildPlannerDiscountResult({
3708
+ return _context33.abrupt("return", buildPlannerDiscountResult({
3469
3709
  customerId: null,
3470
3710
  discountList: this.getDiscountList(),
3471
3711
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -3474,7 +3714,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3474
3714
  status: 'no_customer'
3475
3715
  }));
3476
3716
  case 10:
3477
- _context30.next = 12;
3717
+ _context33.next = 12;
3478
3718
  return this.loadDiscountConfig({
3479
3719
  customerId: customerId,
3480
3720
  action: 'create'
@@ -3486,7 +3726,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3486
3726
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
3487
3727
  });
3488
3728
  if (!preferredDiscount) {
3489
- _context30.next = 40;
3729
+ _context33.next = 40;
3490
3730
  break;
3491
3731
  }
3492
3732
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -3498,98 +3738,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3498
3738
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
3499
3739
  });
3500
3740
  _iterator3 = _createForOfIteratorHelper(selectedOtherDiscounts);
3501
- _context30.prev = 18;
3741
+ _context33.prev = 18;
3502
3742
  _iterator3.s();
3503
3743
  case 20:
3504
3744
  if ((_step3 = _iterator3.n()).done) {
3505
- _context30.next = 28;
3745
+ _context33.next = 28;
3506
3746
  break;
3507
3747
  }
3508
3748
  discount = _step3.value;
3509
3749
  discountId = Number(resolvePlannerDiscountId(discount));
3510
3750
  if (!Number.isFinite(discountId)) {
3511
- _context30.next = 26;
3751
+ _context33.next = 26;
3512
3752
  break;
3513
3753
  }
3514
- _context30.next = 26;
3754
+ _context33.next = 26;
3515
3755
  return this.setDiscountSelected({
3516
3756
  discountId: discountId,
3517
3757
  isSelected: false
3518
3758
  });
3519
3759
  case 26:
3520
- _context30.next = 20;
3760
+ _context33.next = 20;
3521
3761
  break;
3522
3762
  case 28:
3523
- _context30.next = 33;
3763
+ _context33.next = 33;
3524
3764
  break;
3525
3765
  case 30:
3526
- _context30.prev = 30;
3527
- _context30.t0 = _context30["catch"](18);
3528
- _iterator3.e(_context30.t0);
3766
+ _context33.prev = 30;
3767
+ _context33.t0 = _context33["catch"](18);
3768
+ _iterator3.e(_context33.t0);
3529
3769
  case 33:
3530
- _context30.prev = 33;
3770
+ _context33.prev = 33;
3531
3771
  _iterator3.f();
3532
- return _context30.finish(33);
3772
+ return _context33.finish(33);
3533
3773
  case 36:
3534
- _context30.next = 38;
3774
+ _context33.next = 38;
3535
3775
  return this.setDiscountSelected({
3536
3776
  discountId: Number(preferredId),
3537
3777
  isSelected: true
3538
3778
  });
3539
3779
  case 38:
3540
- _context30.next = 49;
3780
+ _context33.next = 49;
3541
3781
  break;
3542
3782
  case 40:
3543
3783
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
3544
- _context30.next = 46;
3784
+ _context33.next = 46;
3545
3785
  break;
3546
3786
  }
3547
3787
  if (!(params.applyBestDiscount !== false)) {
3548
- _context30.next = 44;
3788
+ _context33.next = 44;
3549
3789
  break;
3550
3790
  }
3551
- _context30.next = 44;
3791
+ _context33.next = 44;
3552
3792
  return this.bestDiscount();
3553
3793
  case 44:
3554
- _context30.next = 49;
3794
+ _context33.next = 49;
3555
3795
  break;
3556
3796
  case 46:
3557
3797
  if (!(params.applyBestDiscount !== false)) {
3558
- _context30.next = 49;
3798
+ _context33.next = 49;
3559
3799
  break;
3560
3800
  }
3561
- _context30.next = 49;
3801
+ _context33.next = 49;
3562
3802
  return this.bestDiscount();
3563
3803
  case 49:
3564
3804
  nextTempOrder = this.getTempOrder();
3565
- _context30.t1 = buildPlannerDiscountResult;
3566
- _context30.t2 = customerId;
3567
- _context30.t3 = this.getDiscountList();
3568
- _context30.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3569
- _context30.t5 = summaryBefore;
3570
- _context30.next = 57;
3805
+ _context33.t1 = buildPlannerDiscountResult;
3806
+ _context33.t2 = customerId;
3807
+ _context33.t3 = this.getDiscountList();
3808
+ _context33.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3809
+ _context33.t5 = summaryBefore;
3810
+ _context33.next = 57;
3571
3811
  return this.getSummary();
3572
3812
  case 57:
3573
- _context30.t6 = _context30.sent;
3574
- _context30.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3575
- _context30.t8 = preferredDiscountId;
3576
- _context30.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3577
- _context30.t10 = {
3578
- customerId: _context30.t2,
3579
- discountList: _context30.t3,
3580
- products: _context30.t4,
3581
- summaryBefore: _context30.t5,
3582
- summaryAfter: _context30.t6,
3583
- status: _context30.t7,
3584
- preferredDiscountId: _context30.t8,
3585
- preferredDiscountFound: _context30.t9
3813
+ _context33.t6 = _context33.sent;
3814
+ _context33.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3815
+ _context33.t8 = preferredDiscountId;
3816
+ _context33.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3817
+ _context33.t10 = {
3818
+ customerId: _context33.t2,
3819
+ discountList: _context33.t3,
3820
+ products: _context33.t4,
3821
+ summaryBefore: _context33.t5,
3822
+ summaryAfter: _context33.t6,
3823
+ status: _context33.t7,
3824
+ preferredDiscountId: _context33.t8,
3825
+ preferredDiscountFound: _context33.t9
3586
3826
  };
3587
- return _context30.abrupt("return", (0, _context30.t1)(_context30.t10));
3827
+ return _context33.abrupt("return", (0, _context33.t1)(_context33.t10));
3588
3828
  case 63:
3589
3829
  case "end":
3590
- return _context30.stop();
3830
+ return _context33.stop();
3591
3831
  }
3592
- }, _callee30, this, [[18, 30, 33, 36]]);
3832
+ }, _callee33, this, [[18, 30, 33, 36]]);
3593
3833
  }));
3594
3834
  function applyPlannerDiscounts() {
3595
3835
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -3599,16 +3839,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3599
3839
  }, {
3600
3840
  key: "buildUnifiedOrderProduct",
3601
3841
  value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
3602
- var _ref40, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref41, _sourceProduct$produc, _ref42, _ref43, _sourceProduct$quanti, _sourceProduct$price, _ref44, _ref45, _sourceProduct$sellin;
3842
+ var _ref41, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref42, _sourceProduct$produc, _ref43, _ref44, _sourceProduct$quanti, _sourceProduct$price, _ref45, _ref46, _sourceProduct$sellin;
3603
3843
  var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
3604
- var quotationShelfId = (_ref40 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref40 !== void 0 ? _ref40 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3844
+ var quotationShelfId = (_ref41 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref41 !== void 0 ? _ref41 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3605
3845
  var orderProduct = this.transformBaseProductToOrderProduct({
3606
3846
  payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
3607
3847
  id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
3608
- product_id: (_ref41 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref41 !== void 0 ? _ref41 : product === null || product === void 0 ? void 0 : product.id,
3609
- quantity: (_ref42 = (_ref43 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref43 !== void 0 ? _ref43 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref42 !== void 0 ? _ref42 : 1,
3848
+ product_id: (_ref42 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref42 !== void 0 ? _ref42 : product === null || product === void 0 ? void 0 : product.id,
3849
+ quantity: (_ref43 = (_ref44 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref44 !== void 0 ? _ref44 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref43 !== void 0 ? _ref43 : 1,
3610
3850
  price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
3611
- selling_price: (_ref44 = (_ref45 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.selling_price) !== null && _ref44 !== void 0 ? _ref44 : normalizedProductRaw.price,
3851
+ selling_price: (_ref45 = (_ref46 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref46 !== void 0 ? _ref46 : normalizedProductRaw.selling_price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.price,
3612
3852
  metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
3613
3853
  }),
3614
3854
  sourceProduct: sourceProduct
@@ -3627,29 +3867,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3627
3867
  }, {
3628
3868
  key: "removeExistingStagedLines",
3629
3869
  value: (function () {
3630
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(ownershipKey) {
3631
- var _this$getTempOrder;
3870
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(ownershipKey) {
3871
+ var _this$getTempOrder2;
3632
3872
  var existingLines;
3633
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3634
- while (1) switch (_context31.prev = _context31.next) {
3873
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3874
+ while (1) switch (_context34.prev = _context34.next) {
3635
3875
  case 0:
3636
- existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
3637
- var _product$metadata4;
3638
- return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
3876
+ existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
3877
+ var _product$metadata5;
3878
+ return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
3639
3879
  });
3640
3880
  if (!(existingLines.length > 0)) {
3641
- _context31.next = 4;
3881
+ _context34.next = 4;
3642
3882
  break;
3643
3883
  }
3644
- _context31.next = 4;
3884
+ _context34.next = 4;
3645
3885
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
3646
3886
  case 4:
3647
3887
  case "end":
3648
- return _context31.stop();
3888
+ return _context34.stop();
3649
3889
  }
3650
- }, _callee31, this);
3890
+ }, _callee34, this);
3651
3891
  }));
3652
- function removeExistingStagedLines(_x16) {
3892
+ function removeExistingStagedLines(_x18) {
3653
3893
  return _removeExistingStagedLines.apply(this, arguments);
3654
3894
  }
3655
3895
  return removeExistingStagedLines;
@@ -3657,25 +3897,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3657
3897
  }, {
3658
3898
  key: "stageProducts",
3659
3899
  value: function () {
3660
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params, ownershipKey) {
3900
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params, ownershipKey) {
3661
3901
  var _params$rawProducts;
3662
- var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
3663
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3664
- while (1) switch (_context32.prev = _context32.next) {
3902
+ var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i2, _arr2, sourceProduct, productInput;
3903
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3904
+ while (1) switch (_context35.prev = _context35.next) {
3665
3905
  case 0:
3666
3906
  productIds = params.productIds || [];
3667
3907
  if (productIds.length) {
3668
- _context32.next = 3;
3908
+ _context35.next = 3;
3669
3909
  break;
3670
3910
  }
3671
- return _context32.abrupt("return", this.getTempOrder());
3911
+ return _context35.abrupt("return", this.getTempOrder());
3672
3912
  case 3:
3673
3913
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3674
- _context32.next = 7;
3914
+ _context35.next = 7;
3675
3915
  break;
3676
3916
  }
3677
3917
  this.unifiedProductCatalog = params.rawProducts;
3678
- _context32.next = 12;
3918
+ _context35.next = 12;
3679
3919
  break;
3680
3920
  case 7:
3681
3921
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3686,15 +3926,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3686
3926
  return !existingIds.has(String(id));
3687
3927
  });
3688
3928
  if (!(missingIds.length || params.productLoadParams)) {
3689
- _context32.next = 12;
3929
+ _context35.next = 12;
3690
3930
  break;
3691
3931
  }
3692
- _context32.next = 12;
3932
+ _context35.next = 12;
3693
3933
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3694
3934
  product_ids: productIds.map(Number).filter(Number.isFinite)
3695
3935
  }));
3696
3936
  case 12:
3697
- _context32.next = 14;
3937
+ _context35.next = 14;
3698
3938
  return this.removeExistingStagedLines(ownershipKey);
3699
3939
  case 14:
3700
3940
  productIdSet = new Set(productIds.map(function (id) {
@@ -3704,33 +3944,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3704
3944
  var _product$id2;
3705
3945
  return productIdSet.has(String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id));
3706
3946
  });
3707
- _i = 0, _arr = selectedProducts;
3947
+ _i2 = 0, _arr2 = selectedProducts;
3708
3948
  case 17:
3709
- if (!(_i < _arr.length)) {
3710
- _context32.next = 26;
3949
+ if (!(_i2 < _arr2.length)) {
3950
+ _context35.next = 26;
3711
3951
  break;
3712
3952
  }
3713
- sourceProduct = _arr[_i];
3953
+ sourceProduct = _arr2[_i2];
3714
3954
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3715
3955
  if (!productInput) {
3716
- _context32.next = 23;
3956
+ _context35.next = 23;
3717
3957
  break;
3718
3958
  }
3719
- _context32.next = 23;
3959
+ _context35.next = 23;
3720
3960
  return this.addProductToOrder(productInput);
3721
3961
  case 23:
3722
- _i++;
3723
- _context32.next = 17;
3962
+ _i2++;
3963
+ _context35.next = 17;
3724
3964
  break;
3725
3965
  case 26:
3726
- return _context32.abrupt("return", this.getTempOrder());
3966
+ return _context35.abrupt("return", this.getTempOrder());
3727
3967
  case 27:
3728
3968
  case "end":
3729
- return _context32.stop();
3969
+ return _context35.stop();
3730
3970
  }
3731
- }, _callee32, this);
3971
+ }, _callee35, this);
3732
3972
  }));
3733
- function stageProducts(_x17, _x18) {
3973
+ function stageProducts(_x19, _x20) {
3734
3974
  return _stageProducts.apply(this, arguments);
3735
3975
  }
3736
3976
  return stageProducts;
@@ -3742,18 +3982,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3742
3982
  }, {
3743
3983
  key: "stageRetailProducts",
3744
3984
  value: (function () {
3745
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3746
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3747
- while (1) switch (_context33.prev = _context33.next) {
3985
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3986
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3987
+ while (1) switch (_context36.prev = _context36.next) {
3748
3988
  case 0:
3749
- return _context33.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3989
+ return _context36.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3750
3990
  case 1:
3751
3991
  case "end":
3752
- return _context33.stop();
3992
+ return _context36.stop();
3753
3993
  }
3754
- }, _callee33, this);
3994
+ }, _callee36, this);
3755
3995
  }));
3756
- function stageRetailProducts(_x19) {
3996
+ function stageRetailProducts(_x21) {
3757
3997
  return _stageRetailProducts.apply(this, arguments);
3758
3998
  }
3759
3999
  return stageRetailProducts;
@@ -3767,20 +4007,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3767
4007
  }, {
3768
4008
  key: "addRetailProduct",
3769
4009
  value: (function () {
3770
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3771
- var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
4010
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4011
+ var _params$quantity, _ref47, _params$productId, _params$product, _params$product2;
3772
4012
  var quantity, productId, sourceProduct, products, orderProduct;
3773
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3774
- while (1) switch (_context34.prev = _context34.next) {
4013
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4014
+ while (1) switch (_context37.prev = _context37.next) {
3775
4015
  case 0:
3776
4016
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3777
4017
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3778
- _context34.next = 3;
4018
+ _context37.next = 3;
3779
4019
  break;
3780
4020
  }
3781
4021
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
3782
4022
  case 3:
3783
- productId = (_ref46 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref46 !== void 0 ? _ref46 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
4023
+ productId = (_ref47 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref47 !== void 0 ? _ref47 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3784
4024
  sourceProduct = params.product;
3785
4025
  if (!sourceProduct && productId !== undefined && productId !== null) {
3786
4026
  sourceProduct = this.unifiedProductCatalog.find(function (product) {
@@ -3789,22 +4029,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3789
4029
  });
3790
4030
  }
3791
4031
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
3792
- _context34.next = 11;
4032
+ _context37.next = 11;
3793
4033
  break;
3794
4034
  }
3795
- _context34.next = 9;
4035
+ _context37.next = 9;
3796
4036
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3797
4037
  product_ids: [Number(productId)].filter(Number.isFinite)
3798
4038
  }));
3799
4039
  case 9:
3800
- products = _context34.sent;
4040
+ products = _context37.sent;
3801
4041
  sourceProduct = products.find(function (product) {
3802
4042
  var _product$id4;
3803
4043
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
3804
4044
  });
3805
4045
  case 11:
3806
4046
  if (sourceProduct) {
3807
- _context34.next = 13;
4047
+ _context37.next = 13;
3808
4048
  break;
3809
4049
  }
3810
4050
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -3813,19 +4053,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3813
4053
  quantity: quantity
3814
4054
  }), 'unified_booking_sales_retail');
3815
4055
  if (orderProduct) {
3816
- _context34.next = 16;
4056
+ _context37.next = 16;
3817
4057
  break;
3818
4058
  }
3819
4059
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
3820
4060
  case 16:
3821
- return _context34.abrupt("return", this.addProductToOrder(orderProduct));
4061
+ return _context37.abrupt("return", this.addProductToOrder(orderProduct));
3822
4062
  case 17:
3823
4063
  case "end":
3824
- return _context34.stop();
4064
+ return _context37.stop();
3825
4065
  }
3826
- }, _callee34, this);
4066
+ }, _callee37, this);
3827
4067
  }));
3828
- function addRetailProduct(_x20) {
4068
+ function addRetailProduct(_x22) {
3829
4069
  return _addRetailProduct.apply(this, arguments);
3830
4070
  }
3831
4071
  return addRetailProduct;
@@ -3925,7 +4165,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3925
4165
  }, {
3926
4166
  key: "buildAvailabilityOperatingHoursSnapshot",
3927
4167
  value: function buildAvailabilityOperatingHoursSnapshot(params) {
3928
- var _this7 = this;
4168
+ var _this10 = this;
3929
4169
  var descriptor = params.prepare._availabilityOperatingHours || {
3930
4170
  source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
3931
4171
  scheduleIds: []
@@ -3935,7 +4175,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3935
4175
  var range = normalizeAvailabilityLocalDateTimeRange({
3936
4176
  startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
3937
4177
  endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
3938
- fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
4178
+ fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
3939
4179
  rollOverEnd: true
3940
4180
  });
3941
4181
  return range ? [{
@@ -3972,7 +4212,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3972
4212
  var range = normalizeAvailabilityLocalDateTimeRange({
3973
4213
  startAt: slot.start_at,
3974
4214
  endAt: slot.end_at,
3975
- fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
4215
+ fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
3976
4216
  rollOverEnd: true
3977
4217
  });
3978
4218
  return range ? [{
@@ -3989,7 +4229,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3989
4229
  var range = normalizeAvailabilityLocalDateTimeRange({
3990
4230
  startAt: slot.start_at,
3991
4231
  endAt: slot.end_at,
3992
- fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
4232
+ fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
3993
4233
  rollOverEnd: true
3994
4234
  });
3995
4235
  return range ? [{
@@ -4027,46 +4267,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4027
4267
  }, {
4028
4268
  key: "loadAvailabilityProducts",
4029
4269
  value: function () {
4030
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4270
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4031
4271
  var _prepare$catalogScope,
4032
4272
  _prepare$catalogScope2,
4033
- _this8 = this,
4273
+ _this11 = this,
4034
4274
  _prepare$resourceIds;
4035
4275
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
4036
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4037
- while (1) switch (_context35.prev = _context35.next) {
4276
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4277
+ while (1) switch (_context38.prev = _context38.next) {
4038
4278
  case 0:
4039
4279
  prepare = params.prepare, dateRange = params.dateRange;
4040
4280
  explicitProductIds = prepare.productIds || [];
4041
4281
  rawProducts = [];
4042
4282
  if (!Array.isArray(prepare.rawProducts)) {
4043
- _context35.next = 8;
4283
+ _context38.next = 8;
4044
4284
  break;
4045
4285
  }
4046
4286
  rawProducts = prepare.rawProducts;
4047
4287
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
4048
- _context35.next = 34;
4288
+ _context38.next = 34;
4049
4289
  break;
4050
4290
  case 8:
4051
4291
  if (!(explicitProductIds.length > 0)) {
4052
- _context35.next = 14;
4292
+ _context38.next = 14;
4053
4293
  break;
4054
4294
  }
4055
- _context35.next = 11;
4295
+ _context38.next = 11;
4056
4296
  return this.loadProducts({
4057
4297
  product_ids: explicitProductIds,
4058
4298
  schedule_date: dateRange.startDate
4059
4299
  });
4060
4300
  case 11:
4061
- rawProducts = _context35.sent;
4062
- _context35.next = 34;
4301
+ rawProducts = _context38.sent;
4302
+ _context38.next = 34;
4063
4303
  break;
4064
4304
  case 14:
4065
4305
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
4066
- _context35.next = 30;
4306
+ _context38.next = 30;
4067
4307
  break;
4068
4308
  }
4069
- _context35.next = 17;
4309
+ _context38.next = 17;
4070
4310
  return this.loadScheduleAvailableDate({
4071
4311
  startDate: dateRange.startDate,
4072
4312
  endDate: dateRange.endDate,
@@ -4082,44 +4322,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4082
4322
  });
4083
4323
  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)) || [])));
4084
4324
  if (!(productIds.length > 0)) {
4085
- _context35.next = 27;
4325
+ _context38.next = 27;
4086
4326
  break;
4087
4327
  }
4088
4328
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
4089
- _context35.next = 24;
4329
+ _context38.next = 24;
4090
4330
  return this.loadProducts({
4091
4331
  product_ids: productIds,
4092
4332
  schedule_date: dateRange.startDate
4093
4333
  });
4094
4334
  case 24:
4095
- rawProducts = _context35.sent;
4096
- _context35.next = 28;
4335
+ rawProducts = _context38.sent;
4336
+ _context38.next = 28;
4097
4337
  break;
4098
4338
  case 27:
4099
4339
  this.unifiedProductCatalog = [];
4100
4340
  case 28:
4101
- _context35.next = 34;
4341
+ _context38.next = 34;
4102
4342
  break;
4103
4343
  case 30:
4104
4344
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
4105
- _context35.next = 34;
4345
+ _context38.next = 34;
4106
4346
  break;
4107
4347
  }
4108
- _context35.next = 33;
4348
+ _context38.next = 33;
4109
4349
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
4110
4350
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
4111
4351
  }));
4112
4352
  case 33:
4113
- rawProducts = _context35.sent;
4353
+ rawProducts = _context38.sent;
4114
4354
  case 34:
4115
4355
  normalized = rawProducts.map(function (product) {
4116
- return normalizeProductForAvailability(product, params.scheduleList, _this8.getAvailabilityRuntimeOffsetMinutes());
4356
+ return normalizeProductForAvailability(product, params.scheduleList, _this11.getAvailabilityRuntimeOffsetMinutes());
4117
4357
  });
4118
4358
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
4119
- _context35.next = 37;
4359
+ _context38.next = 37;
4120
4360
  break;
4121
4361
  }
4122
- return _context35.abrupt("return", normalized.filter(function (product) {
4362
+ return _context38.abrupt("return", normalized.filter(function (product) {
4123
4363
  var _product$requirementG2;
4124
4364
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
4125
4365
  var _group$resourceIds3;
@@ -4132,16 +4372,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4132
4372
  }));
4133
4373
  case 37:
4134
4374
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
4135
- return _context35.abrupt("return", productIdSet ? normalized.filter(function (product) {
4375
+ return _context38.abrupt("return", productIdSet ? normalized.filter(function (product) {
4136
4376
  return productIdSet.has(String(product.id));
4137
4377
  }) : normalized);
4138
4378
  case 39:
4139
4379
  case "end":
4140
- return _context35.stop();
4380
+ return _context38.stop();
4141
4381
  }
4142
- }, _callee35, this);
4382
+ }, _callee38, this);
4143
4383
  }));
4144
- function loadAvailabilityProducts(_x21) {
4384
+ function loadAvailabilityProducts(_x23) {
4145
4385
  return _loadAvailabilityProducts.apply(this, arguments);
4146
4386
  }
4147
4387
  return loadAvailabilityProducts;
@@ -4154,12 +4394,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4154
4394
  }, {
4155
4395
  key: "fetchAvailabilityResourcesV2",
4156
4396
  value: (function () {
4157
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4397
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4158
4398
  var response, data;
4159
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4160
- while (1) switch (_context36.prev = _context36.next) {
4399
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4400
+ while (1) switch (_context39.prev = _context39.next) {
4161
4401
  case 0:
4162
- _context36.next = 2;
4402
+ _context39.next = 2;
4163
4403
  return this.request.get('/schedule/resource/list/v2', {
4164
4404
  start_date: params.dateRange.startDate,
4165
4405
  end_date: params.dateRange.endDate,
@@ -4169,28 +4409,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4169
4409
  useCache: false
4170
4410
  });
4171
4411
  case 2:
4172
- response = _context36.sent;
4412
+ response = _context39.sent;
4173
4413
  data = response === null || response === void 0 ? void 0 : response.data;
4174
4414
  if (!Array.isArray(data)) {
4175
- _context36.next = 6;
4415
+ _context39.next = 6;
4176
4416
  break;
4177
4417
  }
4178
- return _context36.abrupt("return", data);
4418
+ return _context39.abrupt("return", data);
4179
4419
  case 6:
4180
4420
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
4181
- _context36.next = 8;
4421
+ _context39.next = 8;
4182
4422
  break;
4183
4423
  }
4184
- return _context36.abrupt("return", data.list);
4424
+ return _context39.abrupt("return", data.list);
4185
4425
  case 8:
4186
- return _context36.abrupt("return", []);
4426
+ return _context39.abrupt("return", []);
4187
4427
  case 9:
4188
4428
  case "end":
4189
- return _context36.stop();
4429
+ return _context39.stop();
4190
4430
  }
4191
- }, _callee36, this);
4431
+ }, _callee39, this);
4192
4432
  }));
4193
- function fetchAvailabilityResourcesV2(_x22) {
4433
+ function fetchAvailabilityResourcesV2(_x24) {
4194
4434
  return _fetchAvailabilityResourcesV.apply(this, arguments);
4195
4435
  }
4196
4436
  return fetchAvailabilityResourcesV2;
@@ -4198,17 +4438,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4198
4438
  }, {
4199
4439
  key: "fetchAndPublishAvailabilityResourcesV2",
4200
4440
  value: function () {
4201
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4441
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4202
4442
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
4203
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4204
- while (1) switch (_context37.prev = _context37.next) {
4443
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4444
+ while (1) switch (_context40.prev = _context40.next) {
4205
4445
  case 0:
4206
4446
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
4207
4447
  if (!(normalizedResourceIds.length === 0)) {
4208
- _context37.next = 3;
4448
+ _context40.next = 3;
4209
4449
  break;
4210
4450
  }
4211
- return _context37.abrupt("return", []);
4451
+ return _context40.abrupt("return", []);
4212
4452
  case 3:
4213
4453
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
4214
4454
  cacheParams = {
@@ -4218,7 +4458,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4218
4458
  };
4219
4459
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
4220
4460
  if (!cachedRawResources) {
4221
- _context37.next = 9;
4461
+ _context40.next = 9;
4222
4462
  break;
4223
4463
  }
4224
4464
  if (params.useCacheOnHit) {
@@ -4230,23 +4470,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4230
4470
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
4231
4471
  });
4232
4472
  }
4233
- return _context37.abrupt("return", cachedRawResources);
4473
+ return _context40.abrupt("return", cachedRawResources);
4234
4474
  case 9:
4235
- _context37.next = 11;
4475
+ _context40.next = 11;
4236
4476
  return this.refreshAvailabilityRemoteResourceQuery({
4237
4477
  timezone: params.timezone,
4238
4478
  dateRange: params.dateRange,
4239
4479
  resourceIds: normalizedResourceIds
4240
4480
  });
4241
4481
  case 11:
4242
- return _context37.abrupt("return", _context37.sent);
4482
+ return _context40.abrupt("return", _context40.sent);
4243
4483
  case 12:
4244
4484
  case "end":
4245
- return _context37.stop();
4485
+ return _context40.stop();
4246
4486
  }
4247
- }, _callee37, this);
4487
+ }, _callee40, this);
4248
4488
  }));
4249
- function fetchAndPublishAvailabilityResourcesV2(_x23) {
4489
+ function fetchAndPublishAvailabilityResourcesV2(_x25) {
4250
4490
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
4251
4491
  }
4252
4492
  return fetchAndPublishAvailabilityResourcesV2;
@@ -4254,17 +4494,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4254
4494
  }, {
4255
4495
  key: "refreshAvailabilityRemoteResourceQuery",
4256
4496
  value: function () {
4257
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4497
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4258
4498
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
4259
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4260
- while (1) switch (_context38.prev = _context38.next) {
4499
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4500
+ while (1) switch (_context41.prev = _context41.next) {
4261
4501
  case 0:
4262
4502
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
4263
4503
  if (!(normalizedResourceIds.length === 0)) {
4264
- _context38.next = 3;
4504
+ _context41.next = 3;
4265
4505
  break;
4266
4506
  }
4267
- return _context38.abrupt("return", []);
4507
+ return _context41.abrupt("return", []);
4268
4508
  case 3:
4269
4509
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
4270
4510
  timezone: params.timezone,
@@ -4274,13 +4514,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4274
4514
  epoch = this.availabilityRemoteResourceEpoch;
4275
4515
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4276
4516
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
4277
- _context38.next = 10;
4517
+ _context41.next = 10;
4278
4518
  break;
4279
4519
  }
4280
- _context38.next = 9;
4520
+ _context41.next = 9;
4281
4521
  return existing.promise;
4282
4522
  case 9:
4283
- return _context38.abrupt("return", _context38.sent);
4523
+ return _context41.abrupt("return", _context41.sent);
4284
4524
  case 10:
4285
4525
  this.availabilityRemoteResourceQuerySequence += 1;
4286
4526
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -4292,11 +4532,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4292
4532
  epoch: epoch,
4293
4533
  promise: promise
4294
4534
  });
4295
- _context38.prev = 14;
4296
- _context38.next = 17;
4535
+ _context41.prev = 14;
4536
+ _context41.next = 17;
4297
4537
  return promise;
4298
4538
  case 17:
4299
- rawResources = _context38.sent;
4539
+ rawResources = _context41.sent;
4300
4540
  if (epoch === this.availabilityRemoteResourceEpoch) {
4301
4541
  this.availabilityRemoteOccupancyCache.publish({
4302
4542
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -4307,21 +4547,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4307
4547
  version: writeVersion
4308
4548
  });
4309
4549
  }
4310
- return _context38.abrupt("return", rawResources);
4550
+ return _context41.abrupt("return", rawResources);
4311
4551
  case 20:
4312
- _context38.prev = 20;
4552
+ _context41.prev = 20;
4313
4553
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4314
4554
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4315
4555
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
4316
4556
  }
4317
- return _context38.finish(20);
4557
+ return _context41.finish(20);
4318
4558
  case 24:
4319
4559
  case "end":
4320
- return _context38.stop();
4560
+ return _context41.stop();
4321
4561
  }
4322
- }, _callee38, this, [[14,, 20, 24]]);
4562
+ }, _callee41, this, [[14,, 20, 24]]);
4323
4563
  }));
4324
- function refreshAvailabilityRemoteResourceQuery(_x24) {
4564
+ function refreshAvailabilityRemoteResourceQuery(_x26) {
4325
4565
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
4326
4566
  }
4327
4567
  return refreshAvailabilityRemoteResourceQuery;
@@ -4329,26 +4569,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4329
4569
  }, {
4330
4570
  key: "loadAvailabilityResources",
4331
4571
  value: function () {
4332
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4572
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4333
4573
  var resourceIds, cachedRawResources, rawResources;
4334
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4335
- while (1) switch (_context39.prev = _context39.next) {
4574
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4575
+ while (1) switch (_context42.prev = _context42.next) {
4336
4576
  case 0:
4337
4577
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
4338
4578
  if (!(resourceIds.length === 0)) {
4339
- _context39.next = 3;
4579
+ _context42.next = 3;
4340
4580
  break;
4341
4581
  }
4342
- return _context39.abrupt("return", {
4582
+ return _context42.abrupt("return", {
4343
4583
  resources: [],
4344
4584
  resourceOccupancies: []
4345
4585
  });
4346
4586
  case 3:
4347
4587
  if (!Array.isArray(params.rawResources)) {
4348
- _context39.next = 5;
4588
+ _context42.next = 5;
4349
4589
  break;
4350
4590
  }
4351
- return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
4591
+ return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
4352
4592
  rawResources: params.rawResources,
4353
4593
  scheduleList: params.scheduleList,
4354
4594
  dateRange: params.dateRange,
@@ -4356,7 +4596,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4356
4596
  }));
4357
4597
  case 5:
4358
4598
  if (!(params.fetchPolicy === 'cache_only')) {
4359
- _context39.next = 10;
4599
+ _context42.next = 10;
4360
4600
  break;
4361
4601
  }
4362
4602
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -4365,22 +4605,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4365
4605
  dateRange: params.dateRange
4366
4606
  });
4367
4607
  if (!cachedRawResources) {
4368
- _context39.next = 9;
4608
+ _context42.next = 9;
4369
4609
  break;
4370
4610
  }
4371
- return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
4611
+ return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
4372
4612
  rawResources: cachedRawResources,
4373
4613
  scheduleList: params.scheduleList,
4374
4614
  dateRange: params.dateRange,
4375
4615
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
4376
4616
  }));
4377
4617
  case 9:
4378
- return _context39.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4618
+ return _context42.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4379
4619
  resources: [],
4380
4620
  resourceOccupancies: []
4381
4621
  });
4382
4622
  case 10:
4383
- _context39.next = 12;
4623
+ _context42.next = 12;
4384
4624
  return this.fetchAndPublishAvailabilityResourcesV2({
4385
4625
  timezone: params.timezone,
4386
4626
  dateRange: params.dateRange,
@@ -4388,8 +4628,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4388
4628
  useCacheOnHit: true
4389
4629
  });
4390
4630
  case 12:
4391
- rawResources = _context39.sent;
4392
- return _context39.abrupt("return", buildAvailabilityResourcesFromV2({
4631
+ rawResources = _context42.sent;
4632
+ return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
4393
4633
  rawResources: rawResources,
4394
4634
  scheduleList: params.scheduleList,
4395
4635
  dateRange: params.dateRange,
@@ -4397,11 +4637,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4397
4637
  }));
4398
4638
  case 14:
4399
4639
  case "end":
4400
- return _context39.stop();
4640
+ return _context42.stop();
4401
4641
  }
4402
- }, _callee39, this);
4642
+ }, _callee42, this);
4403
4643
  }));
4404
- function loadAvailabilityResources(_x25) {
4644
+ function loadAvailabilityResources(_x27) {
4405
4645
  return _loadAvailabilityResources.apply(this, arguments);
4406
4646
  }
4407
4647
  return loadAvailabilityResources;
@@ -4421,7 +4661,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4421
4661
  var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
4422
4662
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
4423
4663
  productLineUids.forEach(function (requestedUid) {
4424
- var _ref47, _product$booking_uid2, _product$metadata5;
4664
+ var _ref48, _product$booking_uid2, _product$metadata6;
4425
4665
  var product = products.find(function (line) {
4426
4666
  return getProductLineUid(line) === String(requestedUid);
4427
4667
  });
@@ -4431,7 +4671,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4431
4671
  });
4432
4672
  }
4433
4673
  var productUid = getProductLineUid(product);
4434
- var linkedBookingUid = String((_ref47 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
4674
+ var linkedBookingUid = String((_ref48 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
4435
4675
  var linkedBookings = bookings.filter(function (booking) {
4436
4676
  var _booking$product_uid;
4437
4677
  return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
@@ -4474,24 +4714,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4474
4714
  }, {
4475
4715
  key: "collectCartResourceOccupancies",
4476
4716
  value: function collectCartResourceOccupancies(tempOrder, exclusions) {
4477
- var _this9 = this;
4717
+ var _this12 = this;
4478
4718
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
4479
4719
  return bookings.flatMap(function (booking) {
4480
- var _ref48, _booking$product_uid2, _booking$metadata2;
4720
+ var _ref49, _booking$product_uid2, _booking$metadata2;
4481
4721
  var bookingUid = getBookingUid(booking);
4482
- var productUid = String((_ref48 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
4722
+ var productUid = String((_ref49 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref49 !== void 0 ? _ref49 : '');
4483
4723
  var scheduleEventId = toNumberId(booking.schedule_event_id);
4484
4724
  var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
4485
4725
  var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
4486
4726
  var resources = Array.isArray(booking.resources) ? booking.resources : [];
4487
4727
  return resources.flatMap(function (resource) {
4488
- var _ref49, _resource$resource_id, _ref50, _resource$capacity;
4489
- var resourceId = (_ref49 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref49 !== void 0 ? _ref49 : resource.id;
4728
+ var _ref50, _resource$resource_id, _ref51, _resource$capacity;
4729
+ var resourceId = (_ref50 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref50 !== void 0 ? _ref50 : resource.id;
4490
4730
  if (resourceId == null || !startAt || !endAt) return [];
4491
4731
  var range = normalizeAvailabilityLocalDateTimeRange({
4492
4732
  startAt: startAt,
4493
4733
  endAt: endAt,
4494
- fixedOffsetMinutes: _this9.getAvailabilityRuntimeOffsetMinutes(),
4734
+ fixedOffsetMinutes: _this12.getAvailabilityRuntimeOffsetMinutes(),
4495
4735
  rollOverEnd: false
4496
4736
  });
4497
4737
  if (!range) return [];
@@ -4499,7 +4739,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4499
4739
  resourceId: resourceId,
4500
4740
  startAt: range.startAt,
4501
4741
  endAt: range.endAt,
4502
- pax: Math.max(1, Number((_ref50 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref50 !== void 0 ? _ref50 : 1) || 1),
4742
+ pax: Math.max(1, Number((_ref51 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref51 !== void 0 ? _ref51 : 1) || 1),
4503
4743
  source: 'cart',
4504
4744
  scheduleEventId: scheduleEventId,
4505
4745
  bookingUid: bookingUid || undefined,
@@ -4509,7 +4749,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4509
4749
  resource: resource
4510
4750
  }
4511
4751
  };
4512
- return _this9.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
4752
+ return _this12.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
4513
4753
  });
4514
4754
  });
4515
4755
  }
@@ -4576,16 +4816,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4576
4816
  }, {
4577
4817
  key: "assertContextualQueryFreshness",
4578
4818
  value: function assertContextualQueryFreshness(context, request) {
4579
- var _this10 = this;
4819
+ var _this13 = this;
4580
4820
  if (request.target === 'time') {
4581
4821
  request.candidates.forEach(function (candidate) {
4582
- _this10.assertAvailabilityCandidateFreshness(context, candidate);
4822
+ _this13.assertAvailabilityCandidateFreshness(context, candidate);
4583
4823
  });
4584
4824
  return;
4585
4825
  }
4586
4826
  if (request.target === 'resource') {
4587
4827
  request.selectedRanges.forEach(function (candidate) {
4588
- _this10.assertAvailabilityCandidateFreshness(context, candidate);
4828
+ _this13.assertAvailabilityCandidateFreshness(context, candidate);
4589
4829
  });
4590
4830
  }
4591
4831
  }
@@ -4632,8 +4872,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4632
4872
  }, {
4633
4873
  key: "buildAvailabilityProjectionSnapshot",
4634
4874
  value: function () {
4635
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4636
- var _this11 = this;
4875
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4876
+ var _this14 = this;
4637
4877
  var options,
4638
4878
  normalizedPrepareParams,
4639
4879
  timezoneLabel,
@@ -4656,23 +4896,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4656
4896
  durationCandidateAnchorAt,
4657
4897
  orderRevision,
4658
4898
  projection,
4659
- _args40 = arguments;
4660
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4661
- while (1) switch (_context40.prev = _context40.next) {
4899
+ _args43 = arguments;
4900
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4901
+ while (1) switch (_context43.prev = _context43.next) {
4662
4902
  case 0:
4663
- options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
4903
+ options = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {};
4664
4904
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
4665
4905
  timezoneLabel = String(normalizedPrepareParams.timezone);
4666
4906
  dateRange = normalizedPrepareParams.dateRange;
4667
4907
  scheduleList = this.getAvailabilityScheduleCatalog();
4668
- _context40.next = 7;
4908
+ _context43.next = 7;
4669
4909
  return this.loadAvailabilityProducts({
4670
4910
  prepare: normalizedPrepareParams,
4671
4911
  dateRange: dateRange,
4672
4912
  scheduleList: scheduleList
4673
4913
  });
4674
4914
  case 7:
4675
- products = _context40.sent;
4915
+ products = _context43.sent;
4676
4916
  // Coverage is physical local time; the caller's date range remains business
4677
4917
  // dates. Keep yesterday's opening and the last business day's overnight tail.
4678
4918
  useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
@@ -4694,7 +4934,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4694
4934
  scheduleList: scheduleList,
4695
4935
  businessHours: businessHours
4696
4936
  });
4697
- _context40.next = 16;
4937
+ _context43.next = 16;
4698
4938
  return this.loadAvailabilityResources({
4699
4939
  timezone: timezoneLabel,
4700
4940
  dateRange: coverageDateRange,
@@ -4706,14 +4946,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4706
4946
  fallbackResources: options.fallbackResources
4707
4947
  });
4708
4948
  case 16:
4709
- loadedResources = _context40.sent;
4949
+ loadedResources = _context43.sent;
4710
4950
  tempOrder = this.getTempOrder();
4711
4951
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4712
4952
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
4713
4953
  var range = normalizeAvailabilityLocalDateTimeRange({
4714
4954
  startAt: occupancy.startAt,
4715
4955
  endAt: occupancy.endAt,
4716
- fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
4956
+ fixedOffsetMinutes: _this14.getAvailabilityRuntimeOffsetMinutes(),
4717
4957
  rollOverEnd: false
4718
4958
  });
4719
4959
  if (!range) return [];
@@ -4723,7 +4963,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4723
4963
  })];
4724
4964
  });
4725
4965
  remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
4726
- return !_this11.occupancyIsExcluded(occupancy, exclusions);
4966
+ return !_this14.occupancyIsExcluded(occupancy, exclusions);
4727
4967
  });
4728
4968
  cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
4729
4969
  preparedAt = this.getAvailabilityRuntimeDateTime();
@@ -4752,18 +4992,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4752
4992
  prepareParams: normalizedPrepareParams,
4753
4993
  durationCandidateAnchorAt: durationCandidateAnchorAt
4754
4994
  });
4755
- return _context40.abrupt("return", {
4995
+ return _context43.abrupt("return", {
4756
4996
  projection: projection,
4757
4997
  prepareParams: normalizedPrepareParams,
4758
4998
  orderRevision: orderRevision
4759
4999
  });
4760
5000
  case 28:
4761
5001
  case "end":
4762
- return _context40.stop();
5002
+ return _context43.stop();
4763
5003
  }
4764
- }, _callee40, this);
5004
+ }, _callee43, this);
4765
5005
  }));
4766
- function buildAvailabilityProjectionSnapshot(_x26) {
5006
+ function buildAvailabilityProjectionSnapshot(_x28) {
4767
5007
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
4768
5008
  }
4769
5009
  return buildAvailabilityProjectionSnapshot;
@@ -4771,10 +5011,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4771
5011
  }, {
4772
5012
  key: "getSharedPreparedAvailabilitySnapshot",
4773
5013
  value: function () {
4774
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
5014
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4775
5015
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
4776
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4777
- while (1) switch (_context41.prev = _context41.next) {
5016
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5017
+ while (1) switch (_context44.prev = _context44.next) {
4778
5018
  case 0:
4779
5019
  lifecycleGeneration = this.availabilityLifecycleGeneration;
4780
5020
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -4793,15 +5033,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4793
5033
  }
4794
5034
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
4795
5035
  if (!hasRawInputs) {
4796
- _context41.next = 11;
5036
+ _context44.next = 11;
4797
5037
  break;
4798
5038
  }
4799
- _context41.next = 7;
5039
+ _context44.next = 7;
4800
5040
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
4801
5041
  case 7:
4802
- snapshot = _context41.sent;
5042
+ snapshot = _context44.sent;
4803
5043
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4804
- _context41.next = 10;
5044
+ _context44.next = 10;
4805
5045
  break;
4806
5046
  }
4807
5047
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4810,7 +5050,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4810
5050
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4811
5051
  });
4812
5052
  case 10:
4813
- return _context41.abrupt("return", {
5053
+ return _context44.abrupt("return", {
4814
5054
  prepareKey: prepareKey,
4815
5055
  snapshot: snapshot
4816
5056
  });
@@ -4824,13 +5064,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4824
5064
  promise: promise
4825
5065
  });
4826
5066
  }
4827
- _context41.prev = 14;
4828
- _context41.next = 17;
5067
+ _context44.prev = 14;
5068
+ _context44.next = 17;
4829
5069
  return promise;
4830
5070
  case 17:
4831
- _snapshot = _context41.sent;
5071
+ _snapshot = _context44.sent;
4832
5072
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4833
- _context41.next = 20;
5073
+ _context44.next = 20;
4834
5074
  break;
4835
5075
  }
4836
5076
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4839,24 +5079,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4839
5079
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4840
5080
  });
4841
5081
  case 20:
4842
- return _context41.abrupt("return", {
5082
+ return _context44.abrupt("return", {
4843
5083
  prepareKey: prepareKey,
4844
5084
  snapshot: _snapshot
4845
5085
  });
4846
5086
  case 21:
4847
- _context41.prev = 21;
5087
+ _context44.prev = 21;
4848
5088
  current = this.availabilityPrepareInFlight.get(prepareKey);
4849
5089
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4850
5090
  this.availabilityPrepareInFlight.delete(prepareKey);
4851
5091
  }
4852
- return _context41.finish(21);
5092
+ return _context44.finish(21);
4853
5093
  case 25:
4854
5094
  case "end":
4855
- return _context41.stop();
5095
+ return _context44.stop();
4856
5096
  }
4857
- }, _callee41, this, [[14,, 21, 25]]);
5097
+ }, _callee44, this, [[14,, 21, 25]]);
4858
5098
  }));
4859
- function getSharedPreparedAvailabilitySnapshot(_x27) {
5099
+ function getSharedPreparedAvailabilitySnapshot(_x29) {
4860
5100
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
4861
5101
  }
4862
5102
  return getSharedPreparedAvailabilitySnapshot;
@@ -4864,51 +5104,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4864
5104
  }, {
4865
5105
  key: "refreshAvailabilityContextProjection",
4866
5106
  value: function () {
4867
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4868
- var _this12 = this;
5107
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5108
+ var _this15 = this;
4869
5109
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
4870
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4871
- while (1) switch (_context43.prev = _context43.next) {
5110
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5111
+ while (1) switch (_context46.prev = _context46.next) {
4872
5112
  case 0:
4873
5113
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4874
5114
  if (!existingInFlight) {
4875
- _context43.next = 5;
5115
+ _context46.next = 5;
4876
5116
  break;
4877
5117
  }
4878
- _context43.next = 4;
5118
+ _context46.next = 4;
4879
5119
  return existingInFlight;
4880
5120
  case 4:
4881
- return _context43.abrupt("return", _context43.sent);
5121
+ return _context46.abrupt("return", _context46.sent);
4882
5122
  case 5:
4883
5123
  context = this.getAvailabilityContextEntry(params.contextId);
4884
5124
  expectedVersion = context.activeVersion;
4885
5125
  expectedRefreshNonce = context.refreshNonce;
4886
5126
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
4887
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
5127
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
4888
5128
  var snapshot, currentContext, projectionEntry;
4889
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4890
- while (1) switch (_context42.prev = _context42.next) {
5129
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5130
+ while (1) switch (_context45.prev = _context45.next) {
4891
5131
  case 0:
4892
- _context42.next = 2;
4893
- return _this12.buildAvailabilityProjectionSnapshot(_this12.cloneAvailabilityPrepareParams(context.prepareParams), {
5132
+ _context45.next = 2;
5133
+ return _this15.buildAvailabilityProjectionSnapshot(_this15.cloneAvailabilityPrepareParams(context.prepareParams), {
4894
5134
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
4895
5135
  });
4896
5136
  case 2:
4897
- snapshot = _context42.sent;
4898
- currentContext = _this12.availabilityContextRegistry.get(params.contextId);
5137
+ snapshot = _context45.sent;
5138
+ currentContext = _this15.availabilityContextRegistry.get(params.contextId);
4899
5139
  if (currentContext) {
4900
- _context42.next = 6;
5140
+ _context45.next = 6;
4901
5141
  break;
4902
5142
  }
4903
- return _context42.abrupt("return", null);
5143
+ return _context45.abrupt("return", null);
4904
5144
  case 6:
4905
- if (!(expectedLifecycleGeneration !== _this12.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4906
- _context42.next = 8;
5145
+ if (!(expectedLifecycleGeneration !== _this15.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
5146
+ _context45.next = 8;
4907
5147
  break;
4908
5148
  }
4909
- return _context42.abrupt("return", null);
5149
+ return _context45.abrupt("return", null);
4910
5150
  case 8:
4911
- projectionEntry = _this12.storeAvailabilityProjectionEntry({
5151
+ projectionEntry = _this15.storeAvailabilityProjectionEntry({
4912
5152
  contextId: currentContext.contextId,
4913
5153
  prepareParams: snapshot.prepareParams,
4914
5154
  prepareKey: currentContext.prepareKey,
@@ -4916,8 +5156,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4916
5156
  orderRevision: snapshot.orderRevision,
4917
5157
  incrementVersion: true
4918
5158
  });
4919
- _context42.next = 11;
4920
- return _this12.emitAvailabilityDiagnostic({
5159
+ _context45.next = 11;
5160
+ return _this15.emitAvailabilityDiagnostic({
4921
5161
  action: 'refresh',
4922
5162
  contextId: currentContext.contextId,
4923
5163
  contextVersion: projectionEntry.contextVersion,
@@ -4928,33 +5168,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4928
5168
  reason: params.reason
4929
5169
  });
4930
5170
  case 11:
4931
- return _context42.abrupt("return", projectionEntry);
5171
+ return _context45.abrupt("return", projectionEntry);
4932
5172
  case 12:
4933
5173
  case "end":
4934
- return _context42.stop();
5174
+ return _context45.stop();
4935
5175
  }
4936
- }, _callee42);
5176
+ }, _callee45);
4937
5177
  }))();
4938
5178
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
4939
- _context43.prev = 11;
4940
- _context43.next = 14;
5179
+ _context46.prev = 11;
5180
+ _context46.next = 14;
4941
5181
  return refreshPromise;
4942
5182
  case 14:
4943
- return _context43.abrupt("return", _context43.sent);
5183
+ return _context46.abrupt("return", _context46.sent);
4944
5184
  case 15:
4945
- _context43.prev = 15;
5185
+ _context46.prev = 15;
4946
5186
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4947
5187
  if (current === refreshPromise) {
4948
5188
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
4949
5189
  }
4950
- return _context43.finish(15);
5190
+ return _context46.finish(15);
4951
5191
  case 19:
4952
5192
  case "end":
4953
- return _context43.stop();
5193
+ return _context46.stop();
4954
5194
  }
4955
- }, _callee43, this, [[11,, 15, 19]]);
5195
+ }, _callee46, this, [[11,, 15, 19]]);
4956
5196
  }));
4957
- function refreshAvailabilityContextProjection(_x28) {
5197
+ function refreshAvailabilityContextProjection(_x30) {
4958
5198
  return _refreshAvailabilityContextProjection.apply(this, arguments);
4959
5199
  }
4960
5200
  return refreshAvailabilityContextProjection;
@@ -4962,53 +5202,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4962
5202
  }, {
4963
5203
  key: "ensureAvailabilityContextProjection",
4964
5204
  value: function () {
4965
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, reason) {
5205
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, reason) {
4966
5206
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
4967
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4968
- while (1) switch (_context44.prev = _context44.next) {
5207
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5208
+ while (1) switch (_context47.prev = _context47.next) {
4969
5209
  case 0:
4970
5210
  retries = 0;
4971
5211
  case 1:
4972
5212
  if (!(retries < 3)) {
4973
- _context44.next = 19;
5213
+ _context47.next = 19;
4974
5214
  break;
4975
5215
  }
4976
5216
  context = this.getAvailabilityContextEntry(contextId);
4977
5217
  currentOrderRevision = this.getCurrentOrderRevision();
4978
5218
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
4979
5219
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
4980
- _context44.next = 7;
5220
+ _context47.next = 7;
4981
5221
  break;
4982
5222
  }
4983
- return _context44.abrupt("return", {
5223
+ return _context47.abrupt("return", {
4984
5224
  context: context,
4985
5225
  projectionEntry: projectionEntry,
4986
5226
  refreshed: false
4987
5227
  });
4988
5228
  case 7:
4989
- _context44.next = 9;
5229
+ _context47.next = 9;
4990
5230
  return this.refreshAvailabilityContextProjection({
4991
5231
  contextId: contextId,
4992
5232
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
4993
5233
  previousOrderRevision: context.lastKnownOrderRevision
4994
5234
  });
4995
5235
  case 9:
4996
- refreshedProjectionEntry = _context44.sent;
5236
+ refreshedProjectionEntry = _context47.sent;
4997
5237
  if (refreshedProjectionEntry) {
4998
- _context44.next = 13;
5238
+ _context47.next = 13;
4999
5239
  break;
5000
5240
  }
5001
5241
  retries += 1;
5002
- return _context44.abrupt("continue", 1);
5242
+ return _context47.abrupt("continue", 1);
5003
5243
  case 13:
5004
5244
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
5005
- _context44.next = 16;
5245
+ _context47.next = 16;
5006
5246
  break;
5007
5247
  }
5008
5248
  retries += 1;
5009
- return _context44.abrupt("continue", 1);
5249
+ return _context47.abrupt("continue", 1);
5010
5250
  case 16:
5011
- return _context44.abrupt("return", {
5251
+ return _context47.abrupt("return", {
5012
5252
  context: this.getAvailabilityContextEntry(contextId),
5013
5253
  projectionEntry: refreshedProjectionEntry,
5014
5254
  refreshed: true
@@ -5020,11 +5260,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5020
5260
  });
5021
5261
  case 20:
5022
5262
  case "end":
5023
- return _context44.stop();
5263
+ return _context47.stop();
5024
5264
  }
5025
- }, _callee44, this);
5265
+ }, _callee47, this);
5026
5266
  }));
5027
- function ensureAvailabilityContextProjection(_x29, _x30) {
5267
+ function ensureAvailabilityContextProjection(_x31, _x32) {
5028
5268
  return _ensureAvailabilityContextProjection.apply(this, arguments);
5029
5269
  }
5030
5270
  return ensureAvailabilityContextProjection;
@@ -5032,18 +5272,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5032
5272
  }, {
5033
5273
  key: "tryAcquireAvailabilityCommitLock",
5034
5274
  value: function () {
5035
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(contextId) {
5275
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId) {
5036
5276
  var _currentContext$activ;
5037
5277
  var _waitingContext$activ, waitingContext, currentContext;
5038
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5039
- while (1) switch (_context45.prev = _context45.next) {
5278
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5279
+ while (1) switch (_context48.prev = _context48.next) {
5040
5280
  case 0:
5041
5281
  if (!this.availabilityCommitLocks.has(contextId)) {
5042
- _context45.next = 5;
5282
+ _context48.next = 5;
5043
5283
  break;
5044
5284
  }
5045
5285
  waitingContext = this.availabilityContextRegistry.get(contextId);
5046
- _context45.next = 4;
5286
+ _context48.next = 4;
5047
5287
  return this.emitAvailabilityDiagnostic({
5048
5288
  action: 'commit_lock_wait',
5049
5289
  contextId: contextId,
@@ -5060,7 +5300,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5060
5300
  case 5:
5061
5301
  this.availabilityCommitLocks.add(contextId);
5062
5302
  currentContext = this.availabilityContextRegistry.get(contextId);
5063
- _context45.next = 9;
5303
+ _context48.next = 9;
5064
5304
  return this.emitAvailabilityDiagnostic({
5065
5305
  action: 'commit_lock_acquired',
5066
5306
  contextId: contextId,
@@ -5072,11 +5312,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5072
5312
  });
5073
5313
  case 9:
5074
5314
  case "end":
5075
- return _context45.stop();
5315
+ return _context48.stop();
5076
5316
  }
5077
- }, _callee45, this);
5317
+ }, _callee48, this);
5078
5318
  }));
5079
- function tryAcquireAvailabilityCommitLock(_x31) {
5319
+ function tryAcquireAvailabilityCommitLock(_x33) {
5080
5320
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
5081
5321
  }
5082
5322
  return tryAcquireAvailabilityCommitLock;
@@ -5084,15 +5324,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5084
5324
  }, {
5085
5325
  key: "releaseAvailabilityCommitLock",
5086
5326
  value: function () {
5087
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
5327
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId) {
5088
5328
  var _releasedContext$acti;
5089
5329
  var releasedContext;
5090
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5091
- while (1) switch (_context46.prev = _context46.next) {
5330
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5331
+ while (1) switch (_context49.prev = _context49.next) {
5092
5332
  case 0:
5093
5333
  this.availabilityCommitLocks.delete(contextId);
5094
5334
  releasedContext = this.availabilityContextRegistry.get(contextId);
5095
- _context46.next = 4;
5335
+ _context49.next = 4;
5096
5336
  return this.emitAvailabilityDiagnostic({
5097
5337
  action: 'commit_lock_released',
5098
5338
  contextId: contextId,
@@ -5104,11 +5344,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5104
5344
  });
5105
5345
  case 4:
5106
5346
  case "end":
5107
- return _context46.stop();
5347
+ return _context49.stop();
5108
5348
  }
5109
- }, _callee46, this);
5349
+ }, _callee49, this);
5110
5350
  }));
5111
- function releaseAvailabilityCommitLock(_x32) {
5351
+ function releaseAvailabilityCommitLock(_x34) {
5112
5352
  return _releaseAvailabilityCommitLock.apply(this, arguments);
5113
5353
  }
5114
5354
  return releaseAvailabilityCommitLock;
@@ -5116,20 +5356,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5116
5356
  }, {
5117
5357
  key: "prepareAvailabilityProjection",
5118
5358
  value: (function () {
5119
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5359
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5120
5360
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
5121
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5122
- while (1) switch (_context47.prev = _context47.next) {
5361
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5362
+ while (1) switch (_context50.prev = _context50.next) {
5123
5363
  case 0:
5124
5364
  this.assertAvailabilityPrepareParams(params);
5125
- _context47.next = 3;
5365
+ _context50.next = 3;
5126
5366
  return this.resolveAvailabilityPrepareDefaults(params);
5127
5367
  case 3:
5128
- paramsWithDefaults = _context47.sent;
5129
- _context47.next = 6;
5368
+ paramsWithDefaults = _context50.sent;
5369
+ _context50.next = 6;
5130
5370
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
5131
5371
  case 6:
5132
- _yield$this$getShared = _context47.sent;
5372
+ _yield$this$getShared = _context50.sent;
5133
5373
  prepareKey = _yield$this$getShared.prepareKey;
5134
5374
  snapshot = _yield$this$getShared.snapshot;
5135
5375
  contextId = this.createAvailabilityContextId();
@@ -5150,7 +5390,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5150
5390
  refreshed: false,
5151
5391
  reason: 'prepare'
5152
5392
  };
5153
- _context47.next = 16;
5393
+ _context50.next = 16;
5154
5394
  return this.emitAvailabilityDiagnostic({
5155
5395
  action: 'prepare',
5156
5396
  contextId: contextId,
@@ -5161,17 +5401,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5161
5401
  reason: 'prepare'
5162
5402
  });
5163
5403
  case 16:
5164
- _context47.next = 18;
5404
+ _context50.next = 18;
5165
5405
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
5166
5406
  case 18:
5167
- return _context47.abrupt("return", handle);
5407
+ return _context50.abrupt("return", handle);
5168
5408
  case 19:
5169
5409
  case "end":
5170
- return _context47.stop();
5410
+ return _context50.stop();
5171
5411
  }
5172
- }, _callee47, this);
5412
+ }, _callee50, this);
5173
5413
  }));
5174
- function prepareAvailabilityProjection(_x33) {
5414
+ function prepareAvailabilityProjection(_x35) {
5175
5415
  return _prepareAvailabilityProjection.apply(this, arguments);
5176
5416
  }
5177
5417
  return prepareAvailabilityProjection;
@@ -5179,12 +5419,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5179
5419
  }, {
5180
5420
  key: "getProductTimeRanges",
5181
5421
  value: (function () {
5182
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId) {
5422
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId) {
5183
5423
  var _this$otherParams$pla2,
5184
5424
  _this$otherParams29,
5185
5425
  _context$prepareParam,
5186
5426
  _extractFixedOffsetMi,
5187
- _this13 = this;
5427
+ _this16 = this;
5188
5428
  var request,
5189
5429
  _yield$this$ensureAva,
5190
5430
  context,
@@ -5199,15 +5439,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5199
5439
  businessDate,
5200
5440
  rememberedStartAtByProductId,
5201
5441
  allowOutsideOperatingHoursForRequestedStartTimes,
5202
- _args48 = arguments;
5203
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5204
- while (1) switch (_context48.prev = _context48.next) {
5442
+ _args51 = arguments;
5443
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5444
+ while (1) switch (_context51.prev = _context51.next) {
5205
5445
  case 0:
5206
- request = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
5207
- _context48.next = 3;
5446
+ request = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
5447
+ _context51.next = 3;
5208
5448
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
5209
5449
  case 3:
5210
- _yield$this$ensureAva = _context48.sent;
5450
+ _yield$this$ensureAva = _context51.sent;
5211
5451
  context = _yield$this$ensureAva.context;
5212
5452
  projectionEntry = _yield$this$ensureAva.projectionEntry;
5213
5453
  contextVersion = context.activeVersion;
@@ -5215,10 +5455,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5215
5455
  isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
5216
5456
  editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
5217
5457
  // to the projection's fixed business clock before the wall-clock planner.
5218
- editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref52) {
5219
- var _ref53 = _slicedToArray(_ref52, 2),
5220
- productId = _ref53[0],
5221
- startAt = _ref53[1];
5458
+ editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref53) {
5459
+ var _ref54 = _slicedToArray(_ref53, 2),
5460
+ productId = _ref54[0],
5461
+ startAt = _ref54[1];
5222
5462
  try {
5223
5463
  var _extractFixedOffsetMi2;
5224
5464
  var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
@@ -5242,7 +5482,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5242
5482
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
5243
5483
  return Array.isArray(startTimes) && startTimes.length > 0;
5244
5484
  }));
5245
- return _context48.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
5485
+ return _context51.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
5246
5486
  dateRange: dateRange,
5247
5487
  editingStartAtByProductId: editingStartAtByProductId,
5248
5488
  rememberedStartAtByProductId: rememberedStartAtByProductId
@@ -5260,17 +5500,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5260
5500
  }).map(function (group) {
5261
5501
  return _objectSpread(_objectSpread({}, group), {}, {
5262
5502
  ranges: group.ranges.map(function (candidate) {
5263
- return _this13.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
5503
+ return _this16.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
5264
5504
  })
5265
5505
  });
5266
5506
  }));
5267
5507
  case 17:
5268
5508
  case "end":
5269
- return _context48.stop();
5509
+ return _context51.stop();
5270
5510
  }
5271
- }, _callee48, this);
5511
+ }, _callee51, this);
5272
5512
  }));
5273
- function getProductTimeRanges(_x34) {
5513
+ function getProductTimeRanges(_x36) {
5274
5514
  return _getProductTimeRanges.apply(this, arguments);
5275
5515
  }
5276
5516
  return getProductTimeRanges;
@@ -5278,16 +5518,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5278
5518
  }, {
5279
5519
  key: "queryBookingAvailability",
5280
5520
  value: (function () {
5281
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId, request) {
5521
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(contextId, request) {
5282
5522
  var _this$otherParams$pla3, _this$otherParams30, _context$prepareParam2;
5283
5523
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
5284
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5285
- while (1) switch (_context49.prev = _context49.next) {
5524
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5525
+ while (1) switch (_context52.prev = _context52.next) {
5286
5526
  case 0:
5287
- _context49.next = 2;
5527
+ _context52.next = 2;
5288
5528
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
5289
5529
  case 2:
5290
- _yield$this$ensureAva2 = _context49.sent;
5530
+ _yield$this$ensureAva2 = _context52.sent;
5291
5531
  context = _yield$this$ensureAva2.context;
5292
5532
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
5293
5533
  refreshed = _yield$this$ensureAva2.refreshed;
@@ -5328,18 +5568,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5328
5568
  });
5329
5569
  })
5330
5570
  }) : result;
5331
- return _context49.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5571
+ return _context52.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5332
5572
  contextId: context.contextId,
5333
5573
  contextVersion: contextVersion,
5334
5574
  refreshed: refreshed
5335
5575
  }));
5336
5576
  case 13:
5337
5577
  case "end":
5338
- return _context49.stop();
5578
+ return _context52.stop();
5339
5579
  }
5340
- }, _callee49, this);
5580
+ }, _callee52, this);
5341
5581
  }));
5342
- function queryBookingAvailability(_x35, _x36) {
5582
+ function queryBookingAvailability(_x37, _x38) {
5343
5583
  return _queryBookingAvailability.apply(this, arguments);
5344
5584
  }
5345
5585
  return queryBookingAvailability;
@@ -5388,18 +5628,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5388
5628
  }, {
5389
5629
  key: "findProductLineByUid",
5390
5630
  value: function findProductLineByUid(productLineUid) {
5391
- var _this$getTempOrder2;
5392
- return (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).find(function (product) {
5631
+ var _this$getTempOrder3;
5632
+ return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.products) || []).find(function (product) {
5393
5633
  return getProductLineUid(product) === String(productLineUid);
5394
5634
  });
5395
5635
  }
5396
5636
  }, {
5397
5637
  key: "findLinkedBooking",
5398
5638
  value: function findLinkedBooking(product) {
5399
- var _ref54, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
5639
+ var _ref55, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
5400
5640
  var productUid = getProductLineUid(product);
5401
- var bookingUid = String((_ref54 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref54 !== void 0 ? _ref54 : '');
5402
- return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
5641
+ var bookingUid = String((_ref55 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref55 !== void 0 ? _ref55 : '');
5642
+ return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
5403
5643
  var _booking$product_uid3;
5404
5644
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
5405
5645
  });
@@ -5407,46 +5647,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5407
5647
  }, {
5408
5648
  key: "removeBookingProductsOutsideStartDate",
5409
5649
  value: function () {
5410
- var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(startDate) {
5411
- var _this$getTempOrder4,
5650
+ var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(startDate) {
5651
+ var _this$getTempOrder5,
5412
5652
  _this$otherParams31,
5413
- _this14 = this;
5653
+ _this17 = this;
5414
5654
  var products, targetDate, identities;
5415
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5416
- while (1) switch (_context50.prev = _context50.next) {
5655
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5656
+ while (1) switch (_context53.prev = _context53.next) {
5417
5657
  case 0:
5418
- products = ((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || [];
5658
+ products = ((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || [];
5419
5659
  if (!(((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.enforceSingleBookingStartDate) !== true)) {
5420
- _context50.next = 3;
5660
+ _context53.next = 3;
5421
5661
  break;
5422
5662
  }
5423
- return _context50.abrupt("return", products);
5663
+ return _context53.abrupt("return", products);
5424
5664
  case 3:
5425
5665
  targetDate = getVisibleCalendarDate(startDate);
5426
5666
  if (targetDate) {
5427
- _context50.next = 6;
5667
+ _context53.next = 6;
5428
5668
  break;
5429
5669
  }
5430
- return _context50.abrupt("return", products);
5670
+ return _context53.abrupt("return", products);
5431
5671
  case 6:
5432
5672
  identities = products.flatMap(function (product) {
5433
- var _product$metadata7;
5434
- if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.product_add_schedule_time) != null) {
5673
+ var _product$metadata8;
5674
+ if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.product_add_schedule_time) != null) {
5435
5675
  return [];
5436
5676
  }
5437
- var booking = _this14.findLinkedBooking(product);
5677
+ var booking = _this17.findLinkedBooking(product);
5438
5678
  if (!booking || isFulfillmentTimingBooking(booking)) return [];
5439
5679
  var bookingDate = getVisibleCalendarDate(booking.start_date);
5440
5680
  return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
5441
5681
  });
5442
- return _context50.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
5682
+ return _context53.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
5443
5683
  case 8:
5444
5684
  case "end":
5445
- return _context50.stop();
5685
+ return _context53.stop();
5446
5686
  }
5447
- }, _callee50, this);
5687
+ }, _callee53, this);
5448
5688
  }));
5449
- function removeBookingProductsOutsideStartDate(_x37) {
5689
+ function removeBookingProductsOutsideStartDate(_x39) {
5450
5690
  return _removeBookingProductsOutsideStartDate.apply(this, arguments);
5451
5691
  }
5452
5692
  return removeBookingProductsOutsideStartDate;
@@ -5454,20 +5694,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5454
5694
  }, {
5455
5695
  key: "commitAvailabilitySelection",
5456
5696
  value: (function () {
5457
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId, params) {
5697
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, params) {
5458
5698
  var _this$otherParams$pla4,
5459
5699
  _this$otherParams32,
5460
5700
  _params$availabilityC,
5461
5701
  _this$store$order11,
5462
5702
  _this$store$order11$e,
5463
- _this15 = this;
5464
- var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams33, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams34, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5465
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5466
- while (1) switch (_context51.prev = _context51.next) {
5703
+ _this18 = this;
5704
+ var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref56, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams33, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams34, _ref57, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref58, _ref59, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref60, _transformed$product_4, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref61, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5705
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5706
+ while (1) switch (_context54.prev = _context54.next) {
5467
5707
  case 0:
5468
5708
  normalizedContextId = String(contextId || '').trim();
5469
5709
  if (normalizedContextId) {
5470
- _context51.next = 3;
5710
+ _context54.next = 3;
5471
5711
  break;
5472
5712
  }
5473
5713
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
@@ -5476,7 +5716,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5476
5716
  case 3:
5477
5717
  isRememberedSelection = params.selectionIntent === 'remembered';
5478
5718
  if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
5479
- _context51.next = 6;
5719
+ _context54.next = 6;
5480
5720
  break;
5481
5721
  }
5482
5722
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
@@ -5487,27 +5727,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5487
5727
  if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
5488
5728
  rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
5489
5729
  getRememberedCommitIdentity = function getRememberedCommitIdentity() {
5490
- var _this15$otherParams$s, _this15$otherParams, _this15$otherParams2, _this15$core, _this15$getTempOrder, _this15$getTempOrder2;
5730
+ var _this18$otherParams$s, _this18$otherParams, _this18$otherParams2, _this18$core, _this18$getTempOrder, _this18$getTempOrder2;
5491
5731
  return JSON.stringify(stableValue({
5492
- scope: _this15.getAvailabilityScopeDescriptor(),
5493
- shopId: (_this15$otherParams$s = (_this15$otherParams = _this15.otherParams) === null || _this15$otherParams === void 0 ? void 0 : _this15$otherParams.shop_id) !== null && _this15$otherParams$s !== void 0 ? _this15$otherParams$s : (_this15$otherParams2 = _this15.otherParams) === null || _this15$otherParams2 === void 0 ? void 0 : _this15$otherParams2.shopId,
5494
- contextShopId: (_this15$core = _this15.core) === null || _this15$core === void 0 || (_this15$core = _this15$core.context) === null || _this15$core === void 0 ? void 0 : _this15$core.shop_id,
5495
- orderId: (_this15$getTempOrder = _this15.getTempOrder()) === null || _this15$getTempOrder === void 0 ? void 0 : _this15$getTempOrder.order_id,
5496
- externalSaleNumber: (_this15$getTempOrder2 = _this15.getTempOrder()) === null || _this15$getTempOrder2 === void 0 ? void 0 : _this15$getTempOrder2.external_sale_number
5732
+ scope: _this18.getAvailabilityScopeDescriptor(),
5733
+ shopId: (_this18$otherParams$s = (_this18$otherParams = _this18.otherParams) === null || _this18$otherParams === void 0 ? void 0 : _this18$otherParams.shop_id) !== null && _this18$otherParams$s !== void 0 ? _this18$otherParams$s : (_this18$otherParams2 = _this18.otherParams) === null || _this18$otherParams2 === void 0 ? void 0 : _this18$otherParams2.shopId,
5734
+ contextShopId: (_this18$core = _this18.core) === null || _this18$core === void 0 || (_this18$core = _this18$core.context) === null || _this18$core === void 0 ? void 0 : _this18$core.shop_id,
5735
+ orderId: (_this18$getTempOrder = _this18.getTempOrder()) === null || _this18$getTempOrder === void 0 ? void 0 : _this18$getTempOrder.order_id,
5736
+ externalSaleNumber: (_this18$getTempOrder2 = _this18.getTempOrder()) === null || _this18$getTempOrder2 === void 0 ? void 0 : _this18$getTempOrder2.external_sale_number
5497
5737
  }));
5498
5738
  };
5499
5739
  rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
5500
5740
  availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
5501
- return _this15.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
5741
+ return _this18.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
5502
5742
  };
5503
5743
  guardedCommitPublished = false;
5504
- _context51.next = 16;
5744
+ _context54.next = 16;
5505
5745
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
5506
5746
  case 16:
5507
- _context51.prev = 16;
5747
+ _context54.prev = 16;
5508
5748
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
5509
5749
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
5510
- _context51.next = 20;
5750
+ _context54.next = 20;
5511
5751
  break;
5512
5752
  }
5513
5753
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -5515,16 +5755,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5515
5755
  });
5516
5756
  case 20:
5517
5757
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
5518
- _context51.next = 22;
5758
+ _context54.next = 22;
5519
5759
  break;
5520
5760
  }
5521
5761
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
5522
5762
  bookingCount: bookingCount
5523
5763
  });
5524
5764
  case 22:
5525
- orderProductQuantity = (_ref55 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref55 !== void 0 ? _ref55 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
5765
+ orderProductQuantity = (_ref56 = (_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 && _ref56 !== void 0 ? _ref56 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
5526
5766
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
5527
- _context51.next = 25;
5767
+ _context54.next = 25;
5528
5768
  break;
5529
5769
  }
5530
5770
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -5534,22 +5774,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5534
5774
  case 25:
5535
5775
  partySize = Number(params.partySize);
5536
5776
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
5537
- _context51.next = 28;
5777
+ _context54.next = 28;
5538
5778
  break;
5539
5779
  }
5540
5780
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
5541
5781
  partySize: params.partySize
5542
5782
  });
5543
5783
  case 28:
5544
- _context51.next = 30;
5784
+ _context54.next = 30;
5545
5785
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
5546
5786
  case 30:
5547
- _yield$this$ensureAva3 = _context51.sent;
5787
+ _yield$this$ensureAva3 = _context54.sent;
5548
5788
  context = _yield$this$ensureAva3.context;
5549
5789
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
5550
5790
  refreshed = _yield$this$ensureAva3.refreshed;
5551
5791
  if (!refreshed) {
5552
- _context51.next = 36;
5792
+ _context54.next = 36;
5553
5793
  break;
5554
5794
  }
5555
5795
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5560,11 +5800,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5560
5800
  case 36:
5561
5801
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
5562
5802
  if (!(params.mode === 'edit')) {
5563
- _context51.next = 42;
5803
+ _context54.next = 42;
5564
5804
  break;
5565
5805
  }
5566
5806
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
5567
- _context51.next = 40;
5807
+ _context54.next = 40;
5568
5808
  break;
5569
5809
  }
5570
5810
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -5573,11 +5813,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5573
5813
  editingProductLineUids: boundEditingUids
5574
5814
  });
5575
5815
  case 40:
5576
- _context51.next = 44;
5816
+ _context54.next = 44;
5577
5817
  break;
5578
5818
  case 42:
5579
5819
  if (!(boundEditingUids.length > 0)) {
5580
- _context51.next = 44;
5820
+ _context54.next = 44;
5581
5821
  break;
5582
5822
  }
5583
5823
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -5586,7 +5826,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5586
5826
  });
5587
5827
  case 44:
5588
5828
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
5589
- _context51.next = 46;
5829
+ _context54.next = 46;
5590
5830
  break;
5591
5831
  }
5592
5832
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5596,7 +5836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5596
5836
  });
5597
5837
  case 46:
5598
5838
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
5599
- _context51.next = 48;
5839
+ _context54.next = 48;
5600
5840
  break;
5601
5841
  }
5602
5842
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -5607,7 +5847,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5607
5847
  });
5608
5848
  case 48:
5609
5849
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
5610
- _context51.next = 50;
5850
+ _context54.next = 50;
5611
5851
  break;
5612
5852
  }
5613
5853
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -5619,7 +5859,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5619
5859
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
5620
5860
  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;
5621
5861
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
5622
- _context51.next = 54;
5862
+ _context54.next = 54;
5623
5863
  break;
5624
5864
  }
5625
5865
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -5628,14 +5868,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5628
5868
  });
5629
5869
  case 54:
5630
5870
  if (!(params.mode === 'edit' && !params.productLineUid)) {
5631
- _context51.next = 56;
5871
+ _context54.next = 56;
5632
5872
  break;
5633
5873
  }
5634
5874
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
5635
5875
  case 56:
5636
5876
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
5637
5877
  if (!(params.mode === 'edit' && !editingLine)) {
5638
- _context51.next = 59;
5878
+ _context54.next = 59;
5639
5879
  break;
5640
5880
  }
5641
5881
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -5643,7 +5883,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5643
5883
  });
5644
5884
  case 59:
5645
5885
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
5646
- _context51.next = 61;
5886
+ _context54.next = 61;
5647
5887
  break;
5648
5888
  }
5649
5889
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -5653,7 +5893,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5653
5893
  });
5654
5894
  case 61:
5655
5895
  if (Array.isArray(params.requirementSelections)) {
5656
- _context51.next = 63;
5896
+ _context54.next = 63;
5657
5897
  break;
5658
5898
  }
5659
5899
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -5665,7 +5905,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5665
5905
  return sameAvailabilityId(item.id, params.candidate.productId);
5666
5906
  });
5667
5907
  if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
5668
- _context51.next = 67;
5908
+ _context54.next = 67;
5669
5909
  break;
5670
5910
  }
5671
5911
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
@@ -5679,7 +5919,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5679
5919
  };
5680
5920
  prepareParams = baseProjection.meta.prepareParams;
5681
5921
  if (prepareParams) {
5682
- _context51.next = 71;
5922
+ _context54.next = 71;
5683
5923
  break;
5684
5924
  }
5685
5925
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -5691,7 +5931,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5691
5931
  })),
5692
5932
  includesInjectedRawOccupancies: true
5693
5933
  };
5694
- _context51.next = 74;
5934
+ _context54.next = 74;
5695
5935
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
5696
5936
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
5697
5937
  }), {
@@ -5700,13 +5940,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5700
5940
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
5701
5941
  });
5702
5942
  case 74:
5703
- commitSnapshot = _context51.sent;
5943
+ commitSnapshot = _context54.sent;
5704
5944
  refreshedProjection = commitSnapshot.projection;
5705
5945
  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 : ''))) {
5706
- _context51.next = 81;
5946
+ _context54.next = 81;
5707
5947
  break;
5708
5948
  }
5709
- _context51.next = 79;
5949
+ _context54.next = 79;
5710
5950
  return this.refreshAvailabilityContextProjection({
5711
5951
  contextId: normalizedContextId,
5712
5952
  reason: 'commit_order_revision_changed',
@@ -5761,7 +6001,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5761
6001
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
5762
6002
  });
5763
6003
  if (refreshedCandidateBase) {
5764
- _context51.next = 90;
6004
+ _context54.next = 90;
5765
6005
  break;
5766
6006
  }
5767
6007
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -5774,7 +6014,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5774
6014
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
5775
6015
  });
5776
6016
  if (product) {
5777
- _context51.next = 93;
6017
+ _context54.next = 93;
5778
6018
  break;
5779
6019
  }
5780
6020
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -5813,7 +6053,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5813
6053
  });
5814
6054
  }
5815
6055
  if (validation.ok) {
5816
- _context51.next = 98;
6056
+ _context54.next = 98;
5817
6057
  break;
5818
6058
  }
5819
6059
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -5836,7 +6076,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5836
6076
  incrementVersion: true
5837
6077
  });
5838
6078
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
5839
- _context51.next = 102;
6079
+ _context54.next = 102;
5840
6080
  return this.emitAvailabilityDiagnostic({
5841
6081
  action: 'refresh',
5842
6082
  contextId: normalizedContextId,
@@ -5860,9 +6100,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5860
6100
  availabilityCommitGuard = hasCommitGuard ? function () {
5861
6101
  var _params$availabilityC2;
5862
6102
  (_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
5863
- _this15.assertAvailabilityCommitWriteCAS(commitWriteGuard);
6103
+ _this18.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5864
6104
  if (!availabilityCommitTargetGuard()) {
5865
- throw _this15.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
6105
+ throw _this18.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
5866
6106
  }
5867
6107
  if (!isRememberedSelection) return;
5868
6108
  var currentValidation = validateAvailabilitySelection(refreshedProjection, {
@@ -5883,7 +6123,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5883
6123
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
5884
6124
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
5885
6125
  if (!(params.mode === 'edit' && !existingBookingUid)) {
5886
- _context51.next = 109;
6126
+ _context54.next = 109;
5887
6127
  break;
5888
6128
  }
5889
6129
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -5897,11 +6137,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5897
6137
  product: product,
5898
6138
  resources: refreshedProjection.resources,
5899
6139
  bookingUid: existingBookingUid || undefined,
5900
- holder: (_ref56 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref56 !== void 0 ? _ref56 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
5901
- holderIds: (_ref57 = (_ref58 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
6140
+ holder: (_ref57 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
6141
+ holderIds: (_ref58 = (_ref59 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref59 !== void 0 ? _ref59 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5902
6142
  });
5903
6143
  if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
5904
- _context51.next = 119;
6144
+ _context54.next = 119;
5905
6145
  break;
5906
6146
  }
5907
6147
  // AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
@@ -5921,7 +6161,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5921
6161
  return sameAvailabilityId(selected.form_id, resource.form_id);
5922
6162
  });
5923
6163
  }))) {
5924
- _context51.next = 118;
6164
+ _context54.next = 118;
5925
6165
  break;
5926
6166
  }
5927
6167
  throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
@@ -5938,7 +6178,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5938
6178
  quantity: bookingCount
5939
6179
  }), 'unified_booking_sales', product);
5940
6180
  if (transformed) {
5941
- _context51.next = 122;
6181
+ _context54.next = 122;
5942
6182
  break;
5943
6183
  }
5944
6184
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -5957,7 +6197,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5957
6197
  productLineUids = [];
5958
6198
  bookingUids = [];
5959
6199
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
5960
- _context51.next = 143;
6200
+ _context54.next = 143;
5961
6201
  break;
5962
6202
  }
5963
6203
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -5967,10 +6207,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5967
6207
  unique_identification_number: params.productLineUid,
5968
6208
  booking_uid: existingBookingUid
5969
6209
  });
5970
- _context51.next = 135;
6210
+ _context54.next = 135;
5971
6211
  return this.updateOrderProduct(_objectSpread(_objectSpread({
5972
6212
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
5973
- product_variant_id: (_ref59 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref59 !== void 0 ? _ref59 : 0,
6213
+ product_variant_id: (_ref60 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref60 !== void 0 ? _ref60 : 0,
5974
6214
  unique_identification_number: params.productLineUid,
5975
6215
  updates: transformed,
5976
6216
  booking: booking
@@ -5980,24 +6220,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5980
6220
  allow_booking_discount_reapply: params.allowBookingDiscountReapply
5981
6221
  } : {}));
5982
6222
  case 135:
5983
- _context51.next = 137;
6223
+ _context54.next = 137;
5984
6224
  return this.removeBookingProductsOutsideStartDate(booking.start_date);
5985
6225
  case 137:
5986
6226
  productLineUid = params.productLineUid;
5987
6227
  bookingUid = existingBookingUid;
5988
6228
  productLineUids = [productLineUid];
5989
6229
  bookingUids = [bookingUid];
5990
- _context51.next = 160;
6230
+ _context54.next = 160;
5991
6231
  break;
5992
6232
  case 143:
5993
- beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
6233
+ beforeProductLineUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.products) || []).map(function (line) {
5994
6234
  return getProductLineUid(line);
5995
6235
  }).filter(Boolean));
5996
- beforeBookingUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.bookings) || []).map(function (item) {
6236
+ beforeBookingUids = new Set((((_this$getTempOrder7 = this.getTempOrder()) === null || _this$getTempOrder7 === void 0 ? void 0 : _this$getTempOrder7.bookings) || []).map(function (item) {
5997
6237
  return getBookingUid(item);
5998
6238
  }).filter(Boolean));
5999
6239
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6000
- _context51.next = 148;
6240
+ _context54.next = 148;
6001
6241
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
6002
6242
  salesNotes: params.salesNotes
6003
6243
  } : {}), availabilityCommitGuard ? {
@@ -6005,11 +6245,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6005
6245
  availabilityCommitTargetGuard: availabilityCommitTargetGuard
6006
6246
  } : {}) : undefined);
6007
6247
  case 148:
6008
- products = _context51.sent;
6009
- _context51.next = 151;
6248
+ products = _context54.sent;
6249
+ _context54.next = 151;
6010
6250
  return this.removeBookingProductsOutsideStartDate(booking.start_date);
6011
6251
  case 151:
6012
- products = _context51.sent;
6252
+ products = _context54.sent;
6013
6253
  guardedCommitPublished = hasCommitGuard;
6014
6254
  addedLines = products.filter(function (line) {
6015
6255
  var _line$product_id, _line$metadata;
@@ -6018,7 +6258,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6018
6258
  productLineUids = addedLines.map(function (line) {
6019
6259
  return getProductLineUid(line);
6020
6260
  }).filter(Boolean);
6021
- addedBookings = (((_ref60 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref60 === void 0 ? void 0 : _ref60.bookings) || []).filter(function (item) {
6261
+ addedBookings = (((_ref61 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref61 === void 0 ? void 0 : _ref61.bookings) || []).filter(function (item) {
6022
6262
  var _item$metadata;
6023
6263
  return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
6024
6264
  });
@@ -6027,8 +6267,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6027
6267
  }).filter(Boolean);
6028
6268
  if (bookingUids.length === 0) {
6029
6269
  bookingUids = addedLines.map(function (line) {
6030
- var _ref61, _line$booking_uid, _line$metadata2;
6031
- return String((_ref61 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref61 !== void 0 ? _ref61 : '');
6270
+ var _ref62, _line$booking_uid, _line$metadata2;
6271
+ return String((_ref62 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref62 !== void 0 ? _ref62 : '');
6032
6272
  }).filter(Boolean);
6033
6273
  }
6034
6274
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -6049,60 +6289,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6049
6289
  bookingUids: bookingUids
6050
6290
  };
6051
6291
  if (!targetStillCurrent) {
6052
- _context51.next = 178;
6292
+ _context54.next = 178;
6053
6293
  break;
6054
6294
  }
6055
6295
  // A notification failure after publication must not invite a duplicate add.
6056
6296
  emit = function emit() {
6057
- return _this15.core.effects.emit("".concat(_this15.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
6297
+ return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
6058
6298
  };
6059
6299
  if (!guardedCommitPublished) {
6060
- _context51.next = 176;
6300
+ _context54.next = 176;
6061
6301
  break;
6062
6302
  }
6063
- _context51.prev = 167;
6064
- _context51.next = 170;
6303
+ _context54.prev = 167;
6304
+ _context54.next = 170;
6065
6305
  return emit();
6066
6306
  case 170:
6067
- _context51.next = 174;
6307
+ _context54.next = 174;
6068
6308
  break;
6069
6309
  case 172:
6070
- _context51.prev = 172;
6071
- _context51.t0 = _context51["catch"](167);
6310
+ _context54.prev = 172;
6311
+ _context54.t0 = _context54["catch"](167);
6072
6312
  case 174:
6073
- _context51.next = 178;
6313
+ _context54.next = 178;
6074
6314
  break;
6075
6315
  case 176:
6076
- _context51.next = 178;
6316
+ _context54.next = 178;
6077
6317
  return emit();
6078
6318
  case 178:
6079
- return _context51.abrupt("return", result);
6319
+ return _context54.abrupt("return", result);
6080
6320
  case 179:
6081
- _context51.prev = 179;
6321
+ _context54.prev = 179;
6082
6322
  release = this.releaseAvailabilityCommitLock(normalizedContextId);
6083
6323
  if (!guardedCommitPublished) {
6084
- _context51.next = 186;
6324
+ _context54.next = 186;
6085
6325
  break;
6086
6326
  }
6087
- _context51.next = 184;
6327
+ _context54.next = 184;
6088
6328
  return release.catch(function () {
6089
6329
  return undefined;
6090
6330
  });
6091
6331
  case 184:
6092
- _context51.next = 188;
6332
+ _context54.next = 188;
6093
6333
  break;
6094
6334
  case 186:
6095
- _context51.next = 188;
6335
+ _context54.next = 188;
6096
6336
  return release;
6097
6337
  case 188:
6098
- return _context51.finish(179);
6338
+ return _context54.finish(179);
6099
6339
  case 189:
6100
6340
  case "end":
6101
- return _context51.stop();
6341
+ return _context54.stop();
6102
6342
  }
6103
- }, _callee51, this, [[16,, 179, 189], [167, 172]]);
6343
+ }, _callee54, this, [[16,, 179, 189], [167, 172]]);
6104
6344
  }));
6105
- function commitAvailabilitySelection(_x38, _x39) {
6345
+ function commitAvailabilitySelection(_x40, _x41) {
6106
6346
  return _commitAvailabilitySelection.apply(this, arguments);
6107
6347
  }
6108
6348
  return commitAvailabilitySelection;