@pisell/pisellos 2.3.105 → 2.3.107

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 (78) hide show
  1. package/dist/modules/Discount/index.js +4 -1
  2. package/dist/modules/Discount/types.d.ts +10 -0
  3. package/dist/modules/OpenData/index.d.ts +15 -2
  4. package/dist/modules/OpenData/index.js +307 -19
  5. package/dist/modules/OpenData/types.d.ts +55 -0
  6. package/dist/modules/OpenData/types.js +7 -1
  7. package/dist/modules/OpenData/utils.d.ts +21 -1
  8. package/dist/modules/OpenData/utils.js +138 -0
  9. package/dist/modules/Order/index.d.ts +3 -1
  10. package/dist/modules/Order/index.js +89 -16
  11. package/dist/modules/Order/types.d.ts +13 -0
  12. package/dist/modules/Order/utils.d.ts +4 -1
  13. package/dist/modules/Order/utils.js +57 -3
  14. package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
  15. package/dist/modules/ResourcePlanner/planner.js +172 -49
  16. package/dist/modules/ResourcePlanner/types.d.ts +19 -0
  17. package/dist/modules/Rules/index.js +1 -1
  18. package/dist/plugins/request.d.ts +2 -1
  19. package/dist/plugins/request.js +4 -2
  20. package/dist/server/index.d.ts +15 -0
  21. package/dist/server/index.js +1734 -1285
  22. package/dist/server/modules/order/types.d.ts +50 -0
  23. package/dist/server/modules/order/types.js +2 -0
  24. package/dist/server/utils/small-ticket.d.ts +4 -1
  25. package/dist/server/utils/small-ticket.js +461 -96
  26. package/dist/solution/BaseSales/index.d.ts +5 -1
  27. package/dist/solution/BaseSales/index.js +120 -45
  28. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  29. package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  30. package/dist/solution/BookingByStep/index.d.ts +1 -1
  31. package/dist/solution/BookingTicket/index.d.ts +8 -3
  32. package/dist/solution/BookingTicket/index.js +558 -443
  33. package/dist/solution/Sales/index.d.ts +16 -1
  34. package/dist/solution/Sales/index.js +338 -63
  35. package/dist/solution/Sales/types.d.ts +10 -0
  36. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  37. package/dist/solution/UnifiedBookingSales/index.js +614 -462
  38. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
  39. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  40. package/lib/modules/Discount/index.js +4 -1
  41. package/lib/modules/Discount/types.d.ts +10 -0
  42. package/lib/modules/OpenData/index.d.ts +15 -2
  43. package/lib/modules/OpenData/index.js +230 -3
  44. package/lib/modules/OpenData/types.d.ts +55 -0
  45. package/lib/modules/OpenData/types.js +9 -1
  46. package/lib/modules/OpenData/utils.d.ts +21 -1
  47. package/lib/modules/OpenData/utils.js +126 -0
  48. package/lib/modules/Order/index.d.ts +3 -1
  49. package/lib/modules/Order/index.js +69 -1
  50. package/lib/modules/Order/types.d.ts +13 -0
  51. package/lib/modules/Order/utils.d.ts +4 -1
  52. package/lib/modules/Order/utils.js +58 -1
  53. package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
  54. package/lib/modules/ResourcePlanner/planner.js +141 -35
  55. package/lib/modules/ResourcePlanner/types.d.ts +19 -0
  56. package/lib/modules/Rules/index.js +1 -1
  57. package/lib/plugins/request.d.ts +2 -1
  58. package/lib/plugins/request.js +3 -2
  59. package/lib/server/index.d.ts +15 -0
  60. package/lib/server/index.js +455 -105
  61. package/lib/server/modules/order/types.d.ts +50 -0
  62. package/lib/server/modules/order/types.js +1 -0
  63. package/lib/server/utils/small-ticket.d.ts +4 -1
  64. package/lib/server/utils/small-ticket.js +427 -72
  65. package/lib/solution/BaseSales/index.d.ts +5 -1
  66. package/lib/solution/BaseSales/index.js +84 -7
  67. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  68. package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  69. package/lib/solution/BookingByStep/index.d.ts +1 -1
  70. package/lib/solution/BookingTicket/index.d.ts +8 -3
  71. package/lib/solution/BookingTicket/index.js +60 -15
  72. package/lib/solution/Sales/index.d.ts +16 -1
  73. package/lib/solution/Sales/index.js +168 -1
  74. package/lib/solution/Sales/types.d.ts +10 -0
  75. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  76. package/lib/solution/UnifiedBookingSales/index.js +128 -35
  77. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
  78. package/package.json +1 -1
@@ -37,6 +37,7 @@ import dayjs from 'dayjs';
37
37
  import { cloneDeep } from 'lodash-es';
38
38
  import { OpenDataModule } from "../../modules";
39
39
  import { isProductFlexibleDuration } from "../../modules/BookingContext/utils";
40
+ import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
40
41
  import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
41
42
  import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
42
43
  import { UnifiedBookingSalesHooks } from "./types";
@@ -47,7 +48,7 @@ import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/pl
47
48
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
48
49
  export * from "./types";
49
50
  export { AvailabilityError } from "../../modules/ResourcePlanner";
50
- var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
51
+ var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
51
52
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
52
53
  function normalizePositiveInteger(value) {
53
54
  var normalized = Number(value);
@@ -697,14 +698,9 @@ function normalizeResource(raw) {
697
698
  var id = (_ref5 = (_raw$resourceId = raw.resourceId) !== null && _raw$resourceId !== void 0 ? _raw$resourceId : raw.resource_id) !== null && _ref5 !== void 0 ? _ref5 : raw.id;
698
699
  if (id === undefined || id === null || id === '') return null;
699
700
  var rawWindows = raw.windows || raw.times || [];
700
- return {
701
- id: id,
702
- formId: (_ref6 = (_raw$formId = raw.formId) !== null && _raw$formId !== void 0 ? _raw$formId : raw.form_id) !== null && _ref6 !== void 0 ? _ref6 : raw.resource_form_id,
703
- name: raw.resourceName || raw.main_field || raw.name || raw.title,
704
- code: raw.code,
705
- resourceType: normalizeResourceType(raw.type || raw.resourceType),
706
- capacity: Math.max(1, Number(raw.capacity || raw.max_capacity || 1) || 1),
707
- windows: (Array.isArray(rawWindows) ? rawWindows : []).flatMap(function (window) {
701
+ var rawExcludedWindows = raw.excludedWindows || raw.excluded_windows || [];
702
+ var normalizeWindows = function normalizeWindows(windows) {
703
+ return (Array.isArray(windows) ? windows : []).flatMap(function (window) {
708
704
  var range = normalizeAvailabilityLocalDateTimeRange({
709
705
  startAt: window.startAt || window.start_at || window.start,
710
706
  endAt: window.endAt || window.end_at || window.end,
@@ -718,7 +714,17 @@ function normalizeResource(raw) {
718
714
  source: window.source,
719
715
  raw: window
720
716
  }];
721
- }),
717
+ });
718
+ };
719
+ return {
720
+ id: id,
721
+ formId: (_ref6 = (_raw$formId = raw.formId) !== null && _raw$formId !== void 0 ? _raw$formId : raw.form_id) !== null && _ref6 !== void 0 ? _ref6 : raw.resource_form_id,
722
+ name: raw.resourceName || raw.main_field || raw.name || raw.title,
723
+ code: raw.code,
724
+ resourceType: normalizeResourceType(raw.type || raw.resourceType),
725
+ capacity: Math.max(1, Number(raw.capacity || raw.max_capacity || 1) || 1),
726
+ windows: normalizeWindows(rawWindows),
727
+ excludedWindows: normalizeWindows(rawExcludedWindows),
722
728
  raw: raw
723
729
  };
724
730
  }
@@ -742,6 +748,16 @@ function dateRangeDays(dateRange) {
742
748
  }
743
749
  return dates;
744
750
  }
751
+ function getExcludedScheduleDateOverrideTimePoints(date, schedule) {
752
+ var _schedule$repeat_rule;
753
+ if (!((_schedule$repeat_rule = schedule.repeat_rule) !== null && _schedule$repeat_rule !== void 0 && (_schedule$repeat_rule = _schedule$repeat_rule.excluded_date) !== null && _schedule$repeat_rule !== void 0 && _schedule$repeat_rule.length)) return [];
754
+ if (getScheduleStartEndTimePoints(date, [schedule]).length > 0) return [];
755
+ return getScheduleStartEndTimePoints(date, [_objectSpread(_objectSpread({}, schedule), {}, {
756
+ repeat_rule: _objectSpread(_objectSpread({}, schedule.repeat_rule), {}, {
757
+ excluded_date: []
758
+ })
759
+ })]);
760
+ }
745
761
  function normalizeResourceOccupancy(rawEvent, resourceId) {
746
762
  var _ref9, _ref10, _rawEvent$start_at, _ref11, _ref12, _rawEvent$end_at, _ref13, _ref14, _rawEvent$pax, _rawEvent$schedule_ev, _ref15, _rawEvent$schedule_ev2, _ref16, _rawEvent$booking_uid, _rawEvent$metadata, _ref17, _rawEvent$product_uid, _rawEvent$metadata2;
747
763
  var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'remote';
@@ -848,7 +864,30 @@ export function buildAvailabilityResourcesFromV2(params) {
848
864
  });
849
865
  });
850
866
  });
867
+ var excludedWindows = dates.flatMap(function (date) {
868
+ return schedules.flatMap(function (schedule) {
869
+ return getExcludedScheduleDateOverrideTimePoints(date, schedule).flatMap(function (slot) {
870
+ var range = normalizeAvailabilityLocalDateTimeRange({
871
+ startAt: slot.start_at,
872
+ endAt: slot.end_at,
873
+ fixedOffsetMinutes: fixedOffsetMinutes,
874
+ rollOverEnd: true
875
+ });
876
+ if (!range) return [];
877
+ return [{
878
+ startAt: range.startAt,
879
+ endAt: range.endAt,
880
+ source: "resource_schedule_excluded:".concat(schedule.id),
881
+ raw: {
882
+ scheduleId: schedule.id,
883
+ excludedDate: date
884
+ }
885
+ }];
886
+ });
887
+ });
888
+ });
851
889
  resource.windows = materializedWindows.length > 0 ? materializedWindows : explicitWindows;
890
+ resource.excludedWindows = [].concat(_toConsumableArray(resource.excludedWindows || []), _toConsumableArray(excludedWindows));
852
891
  if (resource.windows.length === 0 && missingScheduleIds.length > 0) {
853
892
  resource.windows = buildResourceWindowFallbackTimes({
854
893
  raw: raw,
@@ -1116,7 +1155,7 @@ function buildBookingFromAvailabilitySelection(params) {
1116
1155
  } : {})
1117
1156
  });
1118
1157
  }
1119
- var POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES = new Set(['past', 'booking_cutoff', 'resource_full', 'resource_unavailable', 'resource_capacity_exceeded',
1158
+ var POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES = new Set(['past', 'booking_cutoff', 'schedule_excluded_date', 'resource_full', 'resource_unavailable', 'resource_capacity_exceeded',
1120
1159
  // A required group whose selected resource is outside its window is surfaced
1121
1160
  // as missing_resource at group level. Structural validation below still
1122
1161
  // rejects a genuinely missing selection.
@@ -1276,9 +1315,6 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1276
1315
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
1277
1316
  _defineProperty(_assertThisInitialized(_this), "store", {});
1278
1317
  _defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
1279
- _defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
1280
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
1281
- _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
1282
1318
  _defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
1283
1319
  _defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
1284
1320
  _defineProperty(_assertThisInitialized(_this), "availabilityProjectionSequence", 0);
@@ -2130,7 +2166,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2130
2166
  key: "loadOpenData",
2131
2167
  value: (function () {
2132
2168
  var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
2133
- var businessCode, channel, target, cachedData, lastFetchedAt, openData;
2169
+ var businessCode, channel, target, cachedData, lastFetchedAt, request, openData;
2134
2170
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2135
2171
  while (1) switch (_context11.prev = _context11.next) {
2136
2172
  case 0:
@@ -2152,55 +2188,67 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2152
2188
  cachedData = this.store.openData.getOpenData();
2153
2189
  lastFetchedAt = this.store.openData.getLastFetchedAt();
2154
2190
  if (!(!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
2155
- _context11.next = 11;
2191
+ _context11.next = 14;
2156
2192
  break;
2157
2193
  }
2194
+ if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
2195
+ _context11.next = 13;
2196
+ break;
2197
+ }
2198
+ _context11.next = 13;
2199
+ return this.store.openData.ensureInvoiceTemplateSettings(target);
2200
+ case 13:
2158
2201
  return _context11.abrupt("return", cachedData);
2159
- case 11:
2202
+ case 14:
2160
2203
  if (!this.loadOpenDataInFlight) {
2161
- _context11.next = 19;
2204
+ _context11.next = 22;
2162
2205
  break;
2163
2206
  }
2164
2207
  if (!(this.loadOpenDataInFlightTarget === target)) {
2165
- _context11.next = 16;
2208
+ _context11.next = 19;
2166
2209
  break;
2167
2210
  }
2168
- _context11.next = 15;
2169
- return this.loadOpenDataInFlight;
2170
- case 15:
2171
- return _context11.abrupt("return", _context11.sent);
2172
- case 16:
2173
2211
  _context11.next = 18;
2174
2212
  return this.loadOpenDataInFlight;
2175
2213
  case 18:
2176
- return _context11.abrupt("return", this.loadOpenData(params));
2214
+ return _context11.abrupt("return", _context11.sent);
2177
2215
  case 19:
2216
+ _context11.next = 21;
2217
+ return this.loadOpenDataInFlight;
2218
+ case 21:
2219
+ return _context11.abrupt("return", this.loadOpenData(params));
2220
+ case 22:
2178
2221
  this.loadOpenDataInFlightTarget = target;
2179
- this.loadOpenDataInFlight = this.store.openData.fetchOpenData({
2222
+ request = this.store.openData.fetchOpenData({
2180
2223
  scope: 'board',
2181
2224
  target: target,
2182
2225
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2183
2226
  });
2184
- _context11.prev = 21;
2185
- _context11.next = 24;
2186
- return this.loadOpenDataInFlight;
2187
- case 24:
2227
+ this.loadOpenDataInFlight = request;
2228
+ _context11.prev = 25;
2229
+ _context11.next = 28;
2230
+ return request;
2231
+ case 28:
2188
2232
  openData = _context11.sent;
2189
- this.openDataTarget = target;
2190
- this.otherParams.openData = openData;
2191
- this.otherParams.businessCode = businessCode;
2192
- this.otherParams.channel = channel;
2233
+ if (this.loadOpenDataInFlight === request) {
2234
+ this.openDataTarget = target;
2235
+ this.otherParams.openData = openData;
2236
+ this.otherParams.businessCode = businessCode;
2237
+ this.otherParams.channel = channel;
2238
+ }
2193
2239
  return _context11.abrupt("return", openData);
2194
- case 30:
2195
- _context11.prev = 30;
2196
- this.loadOpenDataInFlight = null;
2197
- this.loadOpenDataInFlightTarget = null;
2198
- return _context11.finish(30);
2240
+ case 31:
2241
+ _context11.prev = 31;
2242
+ if (this.loadOpenDataInFlight === request) {
2243
+ this.loadOpenDataInFlight = null;
2244
+ this.loadOpenDataInFlightTarget = null;
2245
+ }
2246
+ return _context11.finish(31);
2199
2247
  case 34:
2200
2248
  case "end":
2201
2249
  return _context11.stop();
2202
2250
  }
2203
- }, _callee11, this, [[21,, 30, 34]]);
2251
+ }, _callee11, this, [[25,, 31, 34]]);
2204
2252
  }));
2205
2253
  function loadOpenData(_x7) {
2206
2254
  return _loadOpenData.apply(this, arguments);
@@ -2211,8 +2259,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2211
2259
  key: "getOpenData",
2212
2260
  value: function () {
2213
2261
  var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2214
- var _this$otherParams18, _this$otherParams19, _this$store$openData;
2215
- var businessCode, channel, target, cachedData;
2262
+ var _this$otherParams18, _this$otherParams19;
2263
+ var businessCode, channel;
2216
2264
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2217
2265
  while (1) switch (_context12.prev = _context12.next) {
2218
2266
  case 0:
@@ -2224,19 +2272,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2224
2272
  }
2225
2273
  return _context12.abrupt("return", null);
2226
2274
  case 4:
2227
- target = "".concat(businessCode, "+").concat(channel);
2228
- cachedData = ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData()) || null;
2229
- if (!(cachedData && this.openDataTarget === target)) {
2230
- _context12.next = 8;
2231
- break;
2232
- }
2233
- return _context12.abrupt("return", cachedData);
2234
- case 8:
2235
2275
  return _context12.abrupt("return", this.loadOpenData({
2236
2276
  businessCode: businessCode,
2237
2277
  channel: channel
2238
2278
  }));
2239
- case 9:
2279
+ case 5:
2240
2280
  case "end":
2241
2281
  return _context12.stop();
2242
2282
  }
@@ -2447,22 +2487,99 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2447
2487
  return _resolveProductAllergyRequirement.apply(this, arguments);
2448
2488
  }
2449
2489
  return resolveProductAllergyRequirement;
2490
+ }())
2491
+ }, {
2492
+ key: "clearOpenDataCache",
2493
+ value: function clearOpenDataCache() {
2494
+ this.openDataTarget = null;
2495
+ this.loadOpenDataInFlight = null;
2496
+ this.loadOpenDataInFlightTarget = null;
2497
+ _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "clearOpenDataCache", this).call(this);
2498
+ }
2499
+ }, {
2500
+ key: "getInvoiceLayoutConfig",
2501
+ value: function () {
2502
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2503
+ var openData;
2504
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2505
+ while (1) switch (_context17.prev = _context17.next) {
2506
+ case 0:
2507
+ _context17.next = 2;
2508
+ return this.getOpenData();
2509
+ case 2:
2510
+ openData = _context17.sent;
2511
+ if (!(!openData || !this.store.openData)) {
2512
+ _context17.next = 5;
2513
+ break;
2514
+ }
2515
+ return _context17.abrupt("return", getDefaultInvoiceLayoutConfig());
2516
+ case 5:
2517
+ return _context17.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2518
+ case 6:
2519
+ case "end":
2520
+ return _context17.stop();
2521
+ }
2522
+ }, _callee17, this);
2523
+ }));
2524
+ function getInvoiceLayoutConfig() {
2525
+ return _getInvoiceLayoutConfig.apply(this, arguments);
2526
+ }
2527
+ return getInvoiceLayoutConfig;
2450
2528
  }()
2529
+ }, {
2530
+ key: "getInvoiceTemplateSettings",
2531
+ value: function () {
2532
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2533
+ var openData;
2534
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2535
+ while (1) switch (_context18.prev = _context18.next) {
2536
+ case 0:
2537
+ _context18.next = 2;
2538
+ return this.getOpenData();
2539
+ case 2:
2540
+ openData = _context18.sent;
2541
+ if (!(!openData || !this.store.openData)) {
2542
+ _context18.next = 5;
2543
+ break;
2544
+ }
2545
+ return _context18.abrupt("return", getDefaultInvoiceTemplateSettings());
2546
+ case 5:
2547
+ return _context18.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2548
+ case 6:
2549
+ case "end":
2550
+ return _context18.stop();
2551
+ }
2552
+ }, _callee18, this);
2553
+ }));
2554
+ function getInvoiceTemplateSettings() {
2555
+ return _getInvoiceTemplateSettings.apply(this, arguments);
2556
+ }
2557
+ return getInvoiceTemplateSettings;
2558
+ }()
2559
+ }, {
2560
+ key: "isInvoiceOpenDataCacheCurrent",
2561
+ value: function isInvoiceOpenDataCacheCurrent() {
2562
+ var _this$otherParams24, _this$otherParams25;
2563
+ var businessCode = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || '').trim();
2564
+ var channel = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) || '').trim();
2565
+ if (!businessCode || !channel) return false;
2566
+ return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
2567
+ }
2568
+
2451
2569
  /**
2452
2570
  * Load a resource policy without depending on the legacy appointmentBooking solution.
2453
2571
  */
2454
- )
2455
2572
  }, {
2456
2573
  key: "getProtocol",
2457
2574
  value: (function () {
2458
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(policyId) {
2575
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(policyId) {
2459
2576
  var normalizedPolicyId, policyUrl;
2460
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2461
- while (1) switch (_context17.prev = _context17.next) {
2577
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2578
+ while (1) switch (_context19.prev = _context19.next) {
2462
2579
  case 0:
2463
2580
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2464
2581
  if (normalizedPolicyId) {
2465
- _context17.next = 3;
2582
+ _context19.next = 3;
2466
2583
  break;
2467
2584
  }
2468
2585
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
@@ -2471,12 +2588,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2471
2588
  if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
2472
2589
  policyUrl = 'policy';
2473
2590
  }
2474
- return _context17.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2591
+ return _context19.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2475
2592
  case 6:
2476
2593
  case "end":
2477
- return _context17.stop();
2594
+ return _context19.stop();
2478
2595
  }
2479
- }, _callee17, this);
2596
+ }, _callee19, this);
2480
2597
  }));
2481
2598
  function getProtocol(_x10) {
2482
2599
  return _getProtocol.apply(this, arguments);
@@ -2491,27 +2608,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2491
2608
  }, {
2492
2609
  key: "loadProducts",
2493
2610
  value: (function () {
2494
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2611
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2495
2612
  var params,
2496
2613
  options,
2497
2614
  schedule_date,
2498
2615
  schedule_datetime,
2499
2616
  result,
2500
- _args18 = arguments;
2501
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2502
- while (1) switch (_context18.prev = _context18.next) {
2617
+ _args20 = arguments;
2618
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2619
+ while (1) switch (_context20.prev = _context20.next) {
2503
2620
  case 0:
2504
- params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
2505
- options = _args18.length > 1 ? _args18[1] : undefined;
2621
+ params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
2622
+ options = _args20.length > 1 ? _args20[1] : undefined;
2506
2623
  if (this.store.products) {
2507
- _context18.next = 4;
2624
+ _context20.next = 4;
2508
2625
  break;
2509
2626
  }
2510
2627
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2511
2628
  case 4:
2512
2629
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2513
2630
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2514
- _context18.next = 8;
2631
+ _context20.next = 8;
2515
2632
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2516
2633
  with_count: ['bundleGroup', 'optionGroup'],
2517
2634
  with_schedule: 1
@@ -2521,17 +2638,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2521
2638
  cacheId: this.cacheId
2522
2639
  }), options);
2523
2640
  case 8:
2524
- result = _context18.sent;
2641
+ result = _context20.sent;
2525
2642
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2526
- _context18.next = 12;
2643
+ _context20.next = 12;
2527
2644
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2528
2645
  case 12:
2529
- return _context18.abrupt("return", result);
2646
+ return _context20.abrupt("return", result);
2530
2647
  case 13:
2531
2648
  case "end":
2532
- return _context18.stop();
2649
+ return _context20.stop();
2533
2650
  }
2534
- }, _callee18, this);
2651
+ }, _callee20, this);
2535
2652
  }));
2536
2653
  function loadProducts() {
2537
2654
  return _loadProducts.apply(this, arguments);
@@ -2541,25 +2658,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2541
2658
  }, {
2542
2659
  key: "queryProducts",
2543
2660
  value: function () {
2544
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2661
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2545
2662
  var params,
2546
- _args19 = arguments;
2547
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2548
- while (1) switch (_context19.prev = _context19.next) {
2663
+ _args21 = arguments;
2664
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2665
+ while (1) switch (_context21.prev = _context21.next) {
2549
2666
  case 0:
2550
- params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
2667
+ params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
2551
2668
  if (this.store.products) {
2552
- _context19.next = 3;
2669
+ _context21.next = 3;
2553
2670
  break;
2554
2671
  }
2555
2672
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2556
2673
  case 3:
2557
- return _context19.abrupt("return", this.store.products.queryProducts(params));
2674
+ return _context21.abrupt("return", this.store.products.queryProducts(params));
2558
2675
  case 4:
2559
2676
  case "end":
2560
- return _context19.stop();
2677
+ return _context21.stop();
2561
2678
  }
2562
- }, _callee19, this);
2679
+ }, _callee21, this);
2563
2680
  }));
2564
2681
  function queryProducts() {
2565
2682
  return _queryProducts.apply(this, arguments);
@@ -2569,22 +2686,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2569
2686
  }, {
2570
2687
  key: "loadScheduleAvailableDate",
2571
2688
  value: (function () {
2572
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2573
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2574
- while (1) switch (_context20.prev = _context20.next) {
2689
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2690
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2691
+ while (1) switch (_context22.prev = _context22.next) {
2575
2692
  case 0:
2576
2693
  if (this.store.schedule) {
2577
- _context20.next = 2;
2694
+ _context22.next = 2;
2578
2695
  break;
2579
2696
  }
2580
2697
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2581
2698
  case 2:
2582
- return _context20.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2699
+ return _context22.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2583
2700
  case 3:
2584
2701
  case "end":
2585
- return _context20.stop();
2702
+ return _context22.stop();
2586
2703
  }
2587
- }, _callee20, this);
2704
+ }, _callee22, this);
2588
2705
  }));
2589
2706
  function loadScheduleAvailableDate(_x11) {
2590
2707
  return _loadScheduleAvailableDate.apply(this, arguments);
@@ -2600,15 +2717,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2600
2717
  }, {
2601
2718
  key: "loadProductsByScheduleDate",
2602
2719
  value: (function () {
2603
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2720
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2604
2721
  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;
2605
2722
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
2606
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2607
- while (1) switch (_context21.prev = _context21.next) {
2723
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2724
+ while (1) switch (_context23.prev = _context23.next) {
2608
2725
  case 0:
2609
2726
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
2610
2727
  if (this.store.schedule) {
2611
- _context21.next = 3;
2728
+ _context23.next = 3;
2612
2729
  break;
2613
2730
  }
2614
2731
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -2619,10 +2736,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2619
2736
  });
2620
2737
  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;
2621
2738
  if (!(!hasCachedDate && !hasOtherProducts)) {
2622
- _context21.next = 9;
2739
+ _context23.next = 9;
2623
2740
  break;
2624
2741
  }
2625
- _context21.next = 9;
2742
+ _context23.next = 9;
2626
2743
  return this.loadScheduleAvailableDate({
2627
2744
  startDate: date,
2628
2745
  endDate: date,
@@ -2642,45 +2759,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2642
2759
  return !productIdFilter || productIdFilter.has(String(id));
2643
2760
  });
2644
2761
  if (availableProductIds.length) {
2645
- _context21.next = 17;
2762
+ _context23.next = 17;
2646
2763
  break;
2647
2764
  }
2648
2765
  this.unifiedProductCatalog = [];
2649
- _context21.next = 16;
2766
+ _context23.next = 16;
2650
2767
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
2651
2768
  case 16:
2652
- return _context21.abrupt("return", []);
2769
+ return _context23.abrupt("return", []);
2653
2770
  case 17:
2654
- _context21.next = 19;
2771
+ _context23.next = 19;
2655
2772
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2656
2773
  product_ids: availableProductIds,
2657
2774
  schedule_date: date
2658
2775
  }));
2659
2776
  case 19:
2660
- products = _context21.sent;
2777
+ products = _context23.sent;
2661
2778
  if (!(products.length || availableProductIds.length <= 1)) {
2662
- _context21.next = 22;
2779
+ _context23.next = 22;
2663
2780
  break;
2664
2781
  }
2665
- return _context21.abrupt("return", products);
2782
+ return _context23.abrupt("return", products);
2666
2783
  case 22:
2667
2784
  fallbackProducts = [];
2668
2785
  _iterator = _createForOfIteratorHelper(availableProductIds);
2669
- _context21.prev = 24;
2786
+ _context23.prev = 24;
2670
2787
  _iterator.s();
2671
2788
  case 26:
2672
2789
  if ((_step = _iterator.n()).done) {
2673
- _context21.next = 34;
2790
+ _context23.next = 34;
2674
2791
  break;
2675
2792
  }
2676
2793
  productId = _step.value;
2677
- _context21.next = 30;
2794
+ _context23.next = 30;
2678
2795
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2679
2796
  product_ids: [productId],
2680
2797
  schedule_date: date
2681
2798
  }));
2682
2799
  case 30:
2683
- result = _context21.sent;
2800
+ result = _context23.sent;
2684
2801
  result.forEach(function (product) {
2685
2802
  var _id;
2686
2803
  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;
@@ -2692,30 +2809,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2692
2809
  }
2693
2810
  });
2694
2811
  case 32:
2695
- _context21.next = 26;
2812
+ _context23.next = 26;
2696
2813
  break;
2697
2814
  case 34:
2698
- _context21.next = 39;
2815
+ _context23.next = 39;
2699
2816
  break;
2700
2817
  case 36:
2701
- _context21.prev = 36;
2702
- _context21.t0 = _context21["catch"](24);
2703
- _iterator.e(_context21.t0);
2818
+ _context23.prev = 36;
2819
+ _context23.t0 = _context23["catch"](24);
2820
+ _iterator.e(_context23.t0);
2704
2821
  case 39:
2705
- _context21.prev = 39;
2822
+ _context23.prev = 39;
2706
2823
  _iterator.f();
2707
- return _context21.finish(39);
2824
+ return _context23.finish(39);
2708
2825
  case 42:
2709
2826
  this.unifiedProductCatalog = [].concat(fallbackProducts);
2710
- _context21.next = 45;
2827
+ _context23.next = 45;
2711
2828
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
2712
2829
  case 45:
2713
- return _context21.abrupt("return", fallbackProducts);
2830
+ return _context23.abrupt("return", fallbackProducts);
2714
2831
  case 46:
2715
2832
  case "end":
2716
- return _context21.stop();
2833
+ return _context23.stop();
2717
2834
  }
2718
- }, _callee21, this, [[24, 36, 39, 42]]);
2835
+ }, _callee23, this, [[24, 36, 39, 42]]);
2719
2836
  }));
2720
2837
  function loadProductsByScheduleDate(_x12) {
2721
2838
  return _loadProductsByScheduleDate.apply(this, arguments);
@@ -2770,7 +2887,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2770
2887
  }, {
2771
2888
  key: "applyPlannerDiscounts",
2772
2889
  value: (function () {
2773
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2890
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2774
2891
  var _params$customerId;
2775
2892
  var params,
2776
2893
  tempOrder,
@@ -2787,24 +2904,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2787
2904
  discount,
2788
2905
  discountId,
2789
2906
  nextTempOrder,
2790
- _args22 = arguments;
2791
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2792
- while (1) switch (_context22.prev = _context22.next) {
2907
+ _args24 = arguments;
2908
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2909
+ while (1) switch (_context24.prev = _context24.next) {
2793
2910
  case 0:
2794
- params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2911
+ params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
2795
2912
  tempOrder = this.getTempOrder();
2796
2913
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
2797
2914
  parsedCustomerId = Number(requestedCustomerId);
2798
2915
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
2799
- _context22.next = 7;
2916
+ _context24.next = 7;
2800
2917
  return this.getSummary();
2801
2918
  case 7:
2802
- summaryBefore = _context22.sent;
2919
+ summaryBefore = _context24.sent;
2803
2920
  if (customerId) {
2804
- _context22.next = 10;
2921
+ _context24.next = 10;
2805
2922
  break;
2806
2923
  }
2807
- return _context22.abrupt("return", buildPlannerDiscountResult({
2924
+ return _context24.abrupt("return", buildPlannerDiscountResult({
2808
2925
  customerId: null,
2809
2926
  discountList: this.getDiscountList(),
2810
2927
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -2813,7 +2930,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2813
2930
  status: 'no_customer'
2814
2931
  }));
2815
2932
  case 10:
2816
- _context22.next = 12;
2933
+ _context24.next = 12;
2817
2934
  return this.loadDiscountConfig({
2818
2935
  customerId: customerId,
2819
2936
  action: 'create'
@@ -2825,7 +2942,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2825
2942
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
2826
2943
  });
2827
2944
  if (!preferredDiscount) {
2828
- _context22.next = 40;
2945
+ _context24.next = 40;
2829
2946
  break;
2830
2947
  }
2831
2948
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -2837,98 +2954,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2837
2954
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
2838
2955
  });
2839
2956
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
2840
- _context22.prev = 18;
2957
+ _context24.prev = 18;
2841
2958
  _iterator2.s();
2842
2959
  case 20:
2843
2960
  if ((_step2 = _iterator2.n()).done) {
2844
- _context22.next = 28;
2961
+ _context24.next = 28;
2845
2962
  break;
2846
2963
  }
2847
2964
  discount = _step2.value;
2848
2965
  discountId = Number(resolvePlannerDiscountId(discount));
2849
2966
  if (!Number.isFinite(discountId)) {
2850
- _context22.next = 26;
2967
+ _context24.next = 26;
2851
2968
  break;
2852
2969
  }
2853
- _context22.next = 26;
2970
+ _context24.next = 26;
2854
2971
  return this.setDiscountSelected({
2855
2972
  discountId: discountId,
2856
2973
  isSelected: false
2857
2974
  });
2858
2975
  case 26:
2859
- _context22.next = 20;
2976
+ _context24.next = 20;
2860
2977
  break;
2861
2978
  case 28:
2862
- _context22.next = 33;
2979
+ _context24.next = 33;
2863
2980
  break;
2864
2981
  case 30:
2865
- _context22.prev = 30;
2866
- _context22.t0 = _context22["catch"](18);
2867
- _iterator2.e(_context22.t0);
2982
+ _context24.prev = 30;
2983
+ _context24.t0 = _context24["catch"](18);
2984
+ _iterator2.e(_context24.t0);
2868
2985
  case 33:
2869
- _context22.prev = 33;
2986
+ _context24.prev = 33;
2870
2987
  _iterator2.f();
2871
- return _context22.finish(33);
2988
+ return _context24.finish(33);
2872
2989
  case 36:
2873
- _context22.next = 38;
2990
+ _context24.next = 38;
2874
2991
  return this.setDiscountSelected({
2875
2992
  discountId: Number(preferredId),
2876
2993
  isSelected: true
2877
2994
  });
2878
2995
  case 38:
2879
- _context22.next = 49;
2996
+ _context24.next = 49;
2880
2997
  break;
2881
2998
  case 40:
2882
2999
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
2883
- _context22.next = 46;
3000
+ _context24.next = 46;
2884
3001
  break;
2885
3002
  }
2886
3003
  if (!(params.applyBestDiscount !== false)) {
2887
- _context22.next = 44;
3004
+ _context24.next = 44;
2888
3005
  break;
2889
3006
  }
2890
- _context22.next = 44;
3007
+ _context24.next = 44;
2891
3008
  return this.bestDiscount();
2892
3009
  case 44:
2893
- _context22.next = 49;
3010
+ _context24.next = 49;
2894
3011
  break;
2895
3012
  case 46:
2896
3013
  if (!(params.applyBestDiscount !== false)) {
2897
- _context22.next = 49;
3014
+ _context24.next = 49;
2898
3015
  break;
2899
3016
  }
2900
- _context22.next = 49;
3017
+ _context24.next = 49;
2901
3018
  return this.bestDiscount();
2902
3019
  case 49:
2903
3020
  nextTempOrder = this.getTempOrder();
2904
- _context22.t1 = buildPlannerDiscountResult;
2905
- _context22.t2 = customerId;
2906
- _context22.t3 = this.getDiscountList();
2907
- _context22.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
2908
- _context22.t5 = summaryBefore;
2909
- _context22.next = 57;
3021
+ _context24.t1 = buildPlannerDiscountResult;
3022
+ _context24.t2 = customerId;
3023
+ _context24.t3 = this.getDiscountList();
3024
+ _context24.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3025
+ _context24.t5 = summaryBefore;
3026
+ _context24.next = 57;
2910
3027
  return this.getSummary();
2911
3028
  case 57:
2912
- _context22.t6 = _context22.sent;
2913
- _context22.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
2914
- _context22.t8 = preferredDiscountId;
2915
- _context22.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
2916
- _context22.t10 = {
2917
- customerId: _context22.t2,
2918
- discountList: _context22.t3,
2919
- products: _context22.t4,
2920
- summaryBefore: _context22.t5,
2921
- summaryAfter: _context22.t6,
2922
- status: _context22.t7,
2923
- preferredDiscountId: _context22.t8,
2924
- preferredDiscountFound: _context22.t9
3029
+ _context24.t6 = _context24.sent;
3030
+ _context24.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3031
+ _context24.t8 = preferredDiscountId;
3032
+ _context24.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3033
+ _context24.t10 = {
3034
+ customerId: _context24.t2,
3035
+ discountList: _context24.t3,
3036
+ products: _context24.t4,
3037
+ summaryBefore: _context24.t5,
3038
+ summaryAfter: _context24.t6,
3039
+ status: _context24.t7,
3040
+ preferredDiscountId: _context24.t8,
3041
+ preferredDiscountFound: _context24.t9
2925
3042
  };
2926
- return _context22.abrupt("return", (0, _context22.t1)(_context22.t10));
3043
+ return _context24.abrupt("return", (0, _context24.t1)(_context24.t10));
2927
3044
  case 63:
2928
3045
  case "end":
2929
- return _context22.stop();
3046
+ return _context24.stop();
2930
3047
  }
2931
- }, _callee22, this, [[18, 30, 33, 36]]);
3048
+ }, _callee24, this, [[18, 30, 33, 36]]);
2932
3049
  }));
2933
3050
  function applyPlannerDiscounts() {
2934
3051
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -2966,27 +3083,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2966
3083
  }, {
2967
3084
  key: "removeExistingStagedLines",
2968
3085
  value: (function () {
2969
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ownershipKey) {
3086
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(ownershipKey) {
2970
3087
  var _this$getTempOrder;
2971
3088
  var existingLines;
2972
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2973
- while (1) switch (_context23.prev = _context23.next) {
3089
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3090
+ while (1) switch (_context25.prev = _context25.next) {
2974
3091
  case 0:
2975
3092
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
2976
3093
  var _product$metadata4;
2977
3094
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
2978
3095
  });
2979
3096
  if (!(existingLines.length > 0)) {
2980
- _context23.next = 4;
3097
+ _context25.next = 4;
2981
3098
  break;
2982
3099
  }
2983
- _context23.next = 4;
3100
+ _context25.next = 4;
2984
3101
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
2985
3102
  case 4:
2986
3103
  case "end":
2987
- return _context23.stop();
3104
+ return _context25.stop();
2988
3105
  }
2989
- }, _callee23, this);
3106
+ }, _callee25, this);
2990
3107
  }));
2991
3108
  function removeExistingStagedLines(_x13) {
2992
3109
  return _removeExistingStagedLines.apply(this, arguments);
@@ -2996,25 +3113,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2996
3113
  }, {
2997
3114
  key: "stageProducts",
2998
3115
  value: function () {
2999
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params, ownershipKey) {
3116
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params, ownershipKey) {
3000
3117
  var _params$rawProducts;
3001
3118
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
3002
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3003
- while (1) switch (_context24.prev = _context24.next) {
3119
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3120
+ while (1) switch (_context26.prev = _context26.next) {
3004
3121
  case 0:
3005
3122
  productIds = params.productIds || [];
3006
3123
  if (productIds.length) {
3007
- _context24.next = 3;
3124
+ _context26.next = 3;
3008
3125
  break;
3009
3126
  }
3010
- return _context24.abrupt("return", this.getTempOrder());
3127
+ return _context26.abrupt("return", this.getTempOrder());
3011
3128
  case 3:
3012
3129
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3013
- _context24.next = 7;
3130
+ _context26.next = 7;
3014
3131
  break;
3015
3132
  }
3016
3133
  this.unifiedProductCatalog = params.rawProducts;
3017
- _context24.next = 12;
3134
+ _context26.next = 12;
3018
3135
  break;
3019
3136
  case 7:
3020
3137
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3025,15 +3142,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3025
3142
  return !existingIds.has(String(id));
3026
3143
  });
3027
3144
  if (!(missingIds.length || params.productLoadParams)) {
3028
- _context24.next = 12;
3145
+ _context26.next = 12;
3029
3146
  break;
3030
3147
  }
3031
- _context24.next = 12;
3148
+ _context26.next = 12;
3032
3149
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3033
3150
  product_ids: productIds.map(Number).filter(Number.isFinite)
3034
3151
  }));
3035
3152
  case 12:
3036
- _context24.next = 14;
3153
+ _context26.next = 14;
3037
3154
  return this.removeExistingStagedLines(ownershipKey);
3038
3155
  case 14:
3039
3156
  productIdSet = new Set(productIds.map(function (id) {
@@ -3046,28 +3163,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3046
3163
  _i = 0, _arr = selectedProducts;
3047
3164
  case 17:
3048
3165
  if (!(_i < _arr.length)) {
3049
- _context24.next = 26;
3166
+ _context26.next = 26;
3050
3167
  break;
3051
3168
  }
3052
3169
  sourceProduct = _arr[_i];
3053
3170
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3054
3171
  if (!productInput) {
3055
- _context24.next = 23;
3172
+ _context26.next = 23;
3056
3173
  break;
3057
3174
  }
3058
- _context24.next = 23;
3175
+ _context26.next = 23;
3059
3176
  return this.addProductToOrder(productInput);
3060
3177
  case 23:
3061
3178
  _i++;
3062
- _context24.next = 17;
3179
+ _context26.next = 17;
3063
3180
  break;
3064
3181
  case 26:
3065
- return _context24.abrupt("return", this.getTempOrder());
3182
+ return _context26.abrupt("return", this.getTempOrder());
3066
3183
  case 27:
3067
3184
  case "end":
3068
- return _context24.stop();
3185
+ return _context26.stop();
3069
3186
  }
3070
- }, _callee24, this);
3187
+ }, _callee26, this);
3071
3188
  }));
3072
3189
  function stageProducts(_x14, _x15) {
3073
3190
  return _stageProducts.apply(this, arguments);
@@ -3081,16 +3198,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3081
3198
  }, {
3082
3199
  key: "stageRetailProducts",
3083
3200
  value: (function () {
3084
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3085
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3086
- while (1) switch (_context25.prev = _context25.next) {
3201
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3202
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3203
+ while (1) switch (_context27.prev = _context27.next) {
3087
3204
  case 0:
3088
- return _context25.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3205
+ return _context27.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3089
3206
  case 1:
3090
3207
  case "end":
3091
- return _context25.stop();
3208
+ return _context27.stop();
3092
3209
  }
3093
- }, _callee25, this);
3210
+ }, _callee27, this);
3094
3211
  }));
3095
3212
  function stageRetailProducts(_x16) {
3096
3213
  return _stageRetailProducts.apply(this, arguments);
@@ -3106,15 +3223,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3106
3223
  }, {
3107
3224
  key: "addRetailProduct",
3108
3225
  value: (function () {
3109
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3226
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3110
3227
  var _params$quantity, _ref44, _params$productId, _params$product, _params$product2;
3111
3228
  var quantity, productId, sourceProduct, products, orderProduct;
3112
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3113
- while (1) switch (_context26.prev = _context26.next) {
3229
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3230
+ while (1) switch (_context28.prev = _context28.next) {
3114
3231
  case 0:
3115
3232
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3116
3233
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3117
- _context26.next = 3;
3234
+ _context28.next = 3;
3118
3235
  break;
3119
3236
  }
3120
3237
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
@@ -3128,22 +3245,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3128
3245
  });
3129
3246
  }
3130
3247
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
3131
- _context26.next = 11;
3248
+ _context28.next = 11;
3132
3249
  break;
3133
3250
  }
3134
- _context26.next = 9;
3251
+ _context28.next = 9;
3135
3252
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3136
3253
  product_ids: [Number(productId)].filter(Number.isFinite)
3137
3254
  }));
3138
3255
  case 9:
3139
- products = _context26.sent;
3256
+ products = _context28.sent;
3140
3257
  sourceProduct = products.find(function (product) {
3141
3258
  var _product$id4;
3142
3259
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
3143
3260
  });
3144
3261
  case 11:
3145
3262
  if (sourceProduct) {
3146
- _context26.next = 13;
3263
+ _context28.next = 13;
3147
3264
  break;
3148
3265
  }
3149
3266
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -3152,17 +3269,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3152
3269
  quantity: quantity
3153
3270
  }), 'unified_booking_sales_retail');
3154
3271
  if (orderProduct) {
3155
- _context26.next = 16;
3272
+ _context28.next = 16;
3156
3273
  break;
3157
3274
  }
3158
3275
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
3159
3276
  case 16:
3160
- return _context26.abrupt("return", this.addProductToOrder(orderProduct));
3277
+ return _context28.abrupt("return", this.addProductToOrder(orderProduct));
3161
3278
  case 17:
3162
3279
  case "end":
3163
- return _context26.stop();
3280
+ return _context28.stop();
3164
3281
  }
3165
- }, _callee26, this);
3282
+ }, _callee28, this);
3166
3283
  }));
3167
3284
  function addRetailProduct(_x17) {
3168
3285
  return _addRetailProduct.apply(this, arguments);
@@ -3319,56 +3436,79 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3319
3436
  }] : [];
3320
3437
  });
3321
3438
  });
3322
- return {
3439
+ var excludedWindows = dateRangeDays(params.dateRange).flatMap(function (date) {
3440
+ return schedules.flatMap(function (schedule) {
3441
+ return getExcludedScheduleDateOverrideTimePoints(date, schedule).flatMap(function (slot) {
3442
+ var range = normalizeAvailabilityLocalDateTimeRange({
3443
+ startAt: slot.start_at,
3444
+ endAt: slot.end_at,
3445
+ fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
3446
+ rollOverEnd: true
3447
+ });
3448
+ return range ? [{
3449
+ startAt: range.startAt,
3450
+ endAt: range.endAt,
3451
+ source: "operating_schedule_excluded:".concat(schedule.id),
3452
+ raw: {
3453
+ scheduleId: schedule.id,
3454
+ excludedDate: date
3455
+ }
3456
+ }] : [];
3457
+ });
3458
+ });
3459
+ });
3460
+ return _objectSpread({
3323
3461
  source: descriptor.source,
3324
3462
  scheduleIds: _toConsumableArray(descriptor.scheduleIds),
3325
3463
  missingScheduleIds: missingScheduleIds,
3326
3464
  windows: windows
3327
- };
3465
+ }, excludedWindows.length > 0 ? {
3466
+ excludedWindows: excludedWindows
3467
+ } : {});
3328
3468
  }
3329
3469
  }, {
3330
3470
  key: "loadAvailabilityProducts",
3331
3471
  value: function () {
3332
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3472
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3333
3473
  var _prepare$catalogScope,
3334
3474
  _prepare$catalogScope2,
3335
3475
  _this5 = this,
3336
3476
  _prepare$resourceIds;
3337
3477
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
3338
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3339
- while (1) switch (_context27.prev = _context27.next) {
3478
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3479
+ while (1) switch (_context29.prev = _context29.next) {
3340
3480
  case 0:
3341
3481
  prepare = params.prepare, dateRange = params.dateRange;
3342
3482
  explicitProductIds = prepare.productIds || [];
3343
3483
  rawProducts = [];
3344
3484
  if (!Array.isArray(prepare.rawProducts)) {
3345
- _context27.next = 8;
3485
+ _context29.next = 8;
3346
3486
  break;
3347
3487
  }
3348
3488
  rawProducts = prepare.rawProducts;
3349
3489
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
3350
- _context27.next = 34;
3490
+ _context29.next = 34;
3351
3491
  break;
3352
3492
  case 8:
3353
3493
  if (!(explicitProductIds.length > 0)) {
3354
- _context27.next = 14;
3494
+ _context29.next = 14;
3355
3495
  break;
3356
3496
  }
3357
- _context27.next = 11;
3497
+ _context29.next = 11;
3358
3498
  return this.loadProducts({
3359
3499
  product_ids: explicitProductIds,
3360
3500
  schedule_date: dateRange.startDate
3361
3501
  });
3362
3502
  case 11:
3363
- rawProducts = _context27.sent;
3364
- _context27.next = 34;
3503
+ rawProducts = _context29.sent;
3504
+ _context29.next = 34;
3365
3505
  break;
3366
3506
  case 14:
3367
3507
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
3368
- _context27.next = 30;
3508
+ _context29.next = 30;
3369
3509
  break;
3370
3510
  }
3371
- _context27.next = 17;
3511
+ _context29.next = 17;
3372
3512
  return this.loadScheduleAvailableDate({
3373
3513
  startDate: dateRange.startDate,
3374
3514
  endDate: dateRange.endDate,
@@ -3384,44 +3524,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3384
3524
  });
3385
3525
  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)) || [])));
3386
3526
  if (!(productIds.length > 0)) {
3387
- _context27.next = 27;
3527
+ _context29.next = 27;
3388
3528
  break;
3389
3529
  }
3390
3530
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
3391
- _context27.next = 24;
3531
+ _context29.next = 24;
3392
3532
  return this.loadProducts({
3393
3533
  product_ids: productIds,
3394
3534
  schedule_date: dateRange.startDate
3395
3535
  });
3396
3536
  case 24:
3397
- rawProducts = _context27.sent;
3398
- _context27.next = 28;
3537
+ rawProducts = _context29.sent;
3538
+ _context29.next = 28;
3399
3539
  break;
3400
3540
  case 27:
3401
3541
  this.unifiedProductCatalog = [];
3402
3542
  case 28:
3403
- _context27.next = 34;
3543
+ _context29.next = 34;
3404
3544
  break;
3405
3545
  case 30:
3406
3546
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
3407
- _context27.next = 34;
3547
+ _context29.next = 34;
3408
3548
  break;
3409
3549
  }
3410
- _context27.next = 33;
3550
+ _context29.next = 33;
3411
3551
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
3412
3552
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
3413
3553
  }));
3414
3554
  case 33:
3415
- rawProducts = _context27.sent;
3555
+ rawProducts = _context29.sent;
3416
3556
  case 34:
3417
3557
  normalized = rawProducts.map(function (product) {
3418
3558
  return normalizeProductForAvailability(product, params.scheduleList, _this5.getAvailabilityRuntimeOffsetMinutes());
3419
3559
  });
3420
3560
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
3421
- _context27.next = 37;
3561
+ _context29.next = 37;
3422
3562
  break;
3423
3563
  }
3424
- return _context27.abrupt("return", normalized.filter(function (product) {
3564
+ return _context29.abrupt("return", normalized.filter(function (product) {
3425
3565
  var _product$requirementG2;
3426
3566
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
3427
3567
  var _group$resourceIds3;
@@ -3434,14 +3574,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3434
3574
  }));
3435
3575
  case 37:
3436
3576
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
3437
- return _context27.abrupt("return", productIdSet ? normalized.filter(function (product) {
3577
+ return _context29.abrupt("return", productIdSet ? normalized.filter(function (product) {
3438
3578
  return productIdSet.has(String(product.id));
3439
3579
  }) : normalized);
3440
3580
  case 39:
3441
3581
  case "end":
3442
- return _context27.stop();
3582
+ return _context29.stop();
3443
3583
  }
3444
- }, _callee27, this);
3584
+ }, _callee29, this);
3445
3585
  }));
3446
3586
  function loadAvailabilityProducts(_x18) {
3447
3587
  return _loadAvailabilityProducts.apply(this, arguments);
@@ -3456,12 +3596,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3456
3596
  }, {
3457
3597
  key: "fetchAvailabilityResourcesV2",
3458
3598
  value: (function () {
3459
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3599
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3460
3600
  var response, data;
3461
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3462
- while (1) switch (_context28.prev = _context28.next) {
3601
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3602
+ while (1) switch (_context30.prev = _context30.next) {
3463
3603
  case 0:
3464
- _context28.next = 2;
3604
+ _context30.next = 2;
3465
3605
  return this.request.get('/schedule/resource/list/v2', {
3466
3606
  start_date: params.dateRange.startDate,
3467
3607
  end_date: params.dateRange.endDate,
@@ -3471,26 +3611,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3471
3611
  useCache: false
3472
3612
  });
3473
3613
  case 2:
3474
- response = _context28.sent;
3614
+ response = _context30.sent;
3475
3615
  data = response === null || response === void 0 ? void 0 : response.data;
3476
3616
  if (!Array.isArray(data)) {
3477
- _context28.next = 6;
3617
+ _context30.next = 6;
3478
3618
  break;
3479
3619
  }
3480
- return _context28.abrupt("return", data);
3620
+ return _context30.abrupt("return", data);
3481
3621
  case 6:
3482
3622
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
3483
- _context28.next = 8;
3623
+ _context30.next = 8;
3484
3624
  break;
3485
3625
  }
3486
- return _context28.abrupt("return", data.list);
3626
+ return _context30.abrupt("return", data.list);
3487
3627
  case 8:
3488
- return _context28.abrupt("return", []);
3628
+ return _context30.abrupt("return", []);
3489
3629
  case 9:
3490
3630
  case "end":
3491
- return _context28.stop();
3631
+ return _context30.stop();
3492
3632
  }
3493
- }, _callee28, this);
3633
+ }, _callee30, this);
3494
3634
  }));
3495
3635
  function fetchAvailabilityResourcesV2(_x19) {
3496
3636
  return _fetchAvailabilityResourcesV.apply(this, arguments);
@@ -3500,17 +3640,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3500
3640
  }, {
3501
3641
  key: "fetchAndPublishAvailabilityResourcesV2",
3502
3642
  value: function () {
3503
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3643
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3504
3644
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3505
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3506
- while (1) switch (_context29.prev = _context29.next) {
3645
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3646
+ while (1) switch (_context31.prev = _context31.next) {
3507
3647
  case 0:
3508
3648
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3509
3649
  if (!(normalizedResourceIds.length === 0)) {
3510
- _context29.next = 3;
3650
+ _context31.next = 3;
3511
3651
  break;
3512
3652
  }
3513
- return _context29.abrupt("return", []);
3653
+ return _context31.abrupt("return", []);
3514
3654
  case 3:
3515
3655
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3516
3656
  cacheParams = {
@@ -3520,7 +3660,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3520
3660
  };
3521
3661
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3522
3662
  if (!cachedRawResources) {
3523
- _context29.next = 9;
3663
+ _context31.next = 9;
3524
3664
  break;
3525
3665
  }
3526
3666
  if (params.useCacheOnHit) {
@@ -3532,21 +3672,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3532
3672
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3533
3673
  });
3534
3674
  }
3535
- return _context29.abrupt("return", cachedRawResources);
3675
+ return _context31.abrupt("return", cachedRawResources);
3536
3676
  case 9:
3537
- _context29.next = 11;
3677
+ _context31.next = 11;
3538
3678
  return this.refreshAvailabilityRemoteResourceQuery({
3539
3679
  timezone: params.timezone,
3540
3680
  dateRange: params.dateRange,
3541
3681
  resourceIds: normalizedResourceIds
3542
3682
  });
3543
3683
  case 11:
3544
- return _context29.abrupt("return", _context29.sent);
3684
+ return _context31.abrupt("return", _context31.sent);
3545
3685
  case 12:
3546
3686
  case "end":
3547
- return _context29.stop();
3687
+ return _context31.stop();
3548
3688
  }
3549
- }, _callee29, this);
3689
+ }, _callee31, this);
3550
3690
  }));
3551
3691
  function fetchAndPublishAvailabilityResourcesV2(_x20) {
3552
3692
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
@@ -3556,17 +3696,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3556
3696
  }, {
3557
3697
  key: "refreshAvailabilityRemoteResourceQuery",
3558
3698
  value: function () {
3559
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3699
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3560
3700
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3561
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3562
- while (1) switch (_context30.prev = _context30.next) {
3701
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3702
+ while (1) switch (_context32.prev = _context32.next) {
3563
3703
  case 0:
3564
3704
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3565
3705
  if (!(normalizedResourceIds.length === 0)) {
3566
- _context30.next = 3;
3706
+ _context32.next = 3;
3567
3707
  break;
3568
3708
  }
3569
- return _context30.abrupt("return", []);
3709
+ return _context32.abrupt("return", []);
3570
3710
  case 3:
3571
3711
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
3572
3712
  timezone: params.timezone,
@@ -3576,13 +3716,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3576
3716
  epoch = this.availabilityRemoteResourceEpoch;
3577
3717
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3578
3718
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
3579
- _context30.next = 10;
3719
+ _context32.next = 10;
3580
3720
  break;
3581
3721
  }
3582
- _context30.next = 9;
3722
+ _context32.next = 9;
3583
3723
  return existing.promise;
3584
3724
  case 9:
3585
- return _context30.abrupt("return", _context30.sent);
3725
+ return _context32.abrupt("return", _context32.sent);
3586
3726
  case 10:
3587
3727
  this.availabilityRemoteResourceQuerySequence += 1;
3588
3728
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -3594,11 +3734,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3594
3734
  epoch: epoch,
3595
3735
  promise: promise
3596
3736
  });
3597
- _context30.prev = 14;
3598
- _context30.next = 17;
3737
+ _context32.prev = 14;
3738
+ _context32.next = 17;
3599
3739
  return promise;
3600
3740
  case 17:
3601
- rawResources = _context30.sent;
3741
+ rawResources = _context32.sent;
3602
3742
  if (epoch === this.availabilityRemoteResourceEpoch) {
3603
3743
  this.availabilityRemoteOccupancyCache.publish({
3604
3744
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -3609,19 +3749,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3609
3749
  version: writeVersion
3610
3750
  });
3611
3751
  }
3612
- return _context30.abrupt("return", rawResources);
3752
+ return _context32.abrupt("return", rawResources);
3613
3753
  case 20:
3614
- _context30.prev = 20;
3754
+ _context32.prev = 20;
3615
3755
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3616
3756
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3617
3757
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
3618
3758
  }
3619
- return _context30.finish(20);
3759
+ return _context32.finish(20);
3620
3760
  case 24:
3621
3761
  case "end":
3622
- return _context30.stop();
3762
+ return _context32.stop();
3623
3763
  }
3624
- }, _callee30, this, [[14,, 20, 24]]);
3764
+ }, _callee32, this, [[14,, 20, 24]]);
3625
3765
  }));
3626
3766
  function refreshAvailabilityRemoteResourceQuery(_x21) {
3627
3767
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
@@ -3631,26 +3771,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3631
3771
  }, {
3632
3772
  key: "loadAvailabilityResources",
3633
3773
  value: function () {
3634
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3774
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3635
3775
  var resourceIds, cachedRawResources, rawResources;
3636
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3637
- while (1) switch (_context31.prev = _context31.next) {
3776
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3777
+ while (1) switch (_context33.prev = _context33.next) {
3638
3778
  case 0:
3639
3779
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
3640
3780
  if (!(resourceIds.length === 0)) {
3641
- _context31.next = 3;
3781
+ _context33.next = 3;
3642
3782
  break;
3643
3783
  }
3644
- return _context31.abrupt("return", {
3784
+ return _context33.abrupt("return", {
3645
3785
  resources: [],
3646
3786
  resourceOccupancies: []
3647
3787
  });
3648
3788
  case 3:
3649
3789
  if (!Array.isArray(params.rawResources)) {
3650
- _context31.next = 5;
3790
+ _context33.next = 5;
3651
3791
  break;
3652
3792
  }
3653
- return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
3793
+ return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3654
3794
  rawResources: params.rawResources,
3655
3795
  scheduleList: params.scheduleList,
3656
3796
  dateRange: params.dateRange,
@@ -3658,7 +3798,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3658
3798
  }));
3659
3799
  case 5:
3660
3800
  if (!(params.fetchPolicy === 'cache_only')) {
3661
- _context31.next = 10;
3801
+ _context33.next = 10;
3662
3802
  break;
3663
3803
  }
3664
3804
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -3667,22 +3807,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3667
3807
  dateRange: params.dateRange
3668
3808
  });
3669
3809
  if (!cachedRawResources) {
3670
- _context31.next = 9;
3810
+ _context33.next = 9;
3671
3811
  break;
3672
3812
  }
3673
- return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
3813
+ return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3674
3814
  rawResources: cachedRawResources,
3675
3815
  scheduleList: params.scheduleList,
3676
3816
  dateRange: params.dateRange,
3677
3817
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
3678
3818
  }));
3679
3819
  case 9:
3680
- return _context31.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3820
+ return _context33.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3681
3821
  resources: [],
3682
3822
  resourceOccupancies: []
3683
3823
  });
3684
3824
  case 10:
3685
- _context31.next = 12;
3825
+ _context33.next = 12;
3686
3826
  return this.fetchAndPublishAvailabilityResourcesV2({
3687
3827
  timezone: params.timezone,
3688
3828
  dateRange: params.dateRange,
@@ -3690,8 +3830,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3690
3830
  useCacheOnHit: true
3691
3831
  });
3692
3832
  case 12:
3693
- rawResources = _context31.sent;
3694
- return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
3833
+ rawResources = _context33.sent;
3834
+ return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3695
3835
  rawResources: rawResources,
3696
3836
  scheduleList: params.scheduleList,
3697
3837
  dateRange: params.dateRange,
@@ -3699,9 +3839,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3699
3839
  }));
3700
3840
  case 14:
3701
3841
  case "end":
3702
- return _context31.stop();
3842
+ return _context33.stop();
3703
3843
  }
3704
- }, _callee31, this);
3844
+ }, _callee33, this);
3705
3845
  }));
3706
3846
  function loadAvailabilityResources(_x22) {
3707
3847
  return _loadAvailabilityResources.apply(this, arguments);
@@ -3934,7 +4074,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3934
4074
  }, {
3935
4075
  key: "buildAvailabilityProjectionSnapshot",
3936
4076
  value: function () {
3937
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
4077
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3938
4078
  var _this8 = this;
3939
4079
  var options,
3940
4080
  normalizedPrepareParams,
@@ -3956,11 +4096,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3956
4096
  durationCandidateAnchorAt,
3957
4097
  orderRevision,
3958
4098
  projection,
3959
- _args32 = arguments;
3960
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3961
- while (1) switch (_context32.prev = _context32.next) {
4099
+ _args34 = arguments;
4100
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4101
+ while (1) switch (_context34.prev = _context34.next) {
3962
4102
  case 0:
3963
- options = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {};
4103
+ options = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {};
3964
4104
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
3965
4105
  timezoneLabel = String(normalizedPrepareParams.timezone);
3966
4106
  dateRange = normalizedPrepareParams.dateRange;
@@ -3974,15 +4114,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3974
4114
  scheduleList: scheduleList,
3975
4115
  businessHours: businessHours
3976
4116
  });
3977
- _context32.next = 11;
4117
+ _context34.next = 11;
3978
4118
  return this.loadAvailabilityProducts({
3979
4119
  prepare: normalizedPrepareParams,
3980
4120
  dateRange: dateRange,
3981
4121
  scheduleList: scheduleList
3982
4122
  });
3983
4123
  case 11:
3984
- products = _context32.sent;
3985
- _context32.next = 14;
4124
+ products = _context34.sent;
4125
+ _context34.next = 14;
3986
4126
  return this.loadAvailabilityResources({
3987
4127
  timezone: timezoneLabel,
3988
4128
  dateRange: dateRange,
@@ -3994,7 +4134,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3994
4134
  fallbackResources: options.fallbackResources
3995
4135
  });
3996
4136
  case 14:
3997
- loadedResources = _context32.sent;
4137
+ loadedResources = _context34.sent;
3998
4138
  tempOrder = this.getTempOrder();
3999
4139
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4000
4140
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
@@ -4040,16 +4180,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4040
4180
  prepareParams: normalizedPrepareParams,
4041
4181
  durationCandidateAnchorAt: durationCandidateAnchorAt
4042
4182
  });
4043
- return _context32.abrupt("return", {
4183
+ return _context34.abrupt("return", {
4044
4184
  projection: projection,
4045
4185
  prepareParams: normalizedPrepareParams,
4046
4186
  orderRevision: orderRevision
4047
4187
  });
4048
4188
  case 26:
4049
4189
  case "end":
4050
- return _context32.stop();
4190
+ return _context34.stop();
4051
4191
  }
4052
- }, _callee32, this);
4192
+ }, _callee34, this);
4053
4193
  }));
4054
4194
  function buildAvailabilityProjectionSnapshot(_x23) {
4055
4195
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
@@ -4059,10 +4199,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4059
4199
  }, {
4060
4200
  key: "getSharedPreparedAvailabilitySnapshot",
4061
4201
  value: function () {
4062
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
4202
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4063
4203
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
4064
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4065
- while (1) switch (_context33.prev = _context33.next) {
4204
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4205
+ while (1) switch (_context35.prev = _context35.next) {
4066
4206
  case 0:
4067
4207
  lifecycleGeneration = this.availabilityLifecycleGeneration;
4068
4208
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -4081,15 +4221,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4081
4221
  }
4082
4222
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
4083
4223
  if (!hasRawInputs) {
4084
- _context33.next = 11;
4224
+ _context35.next = 11;
4085
4225
  break;
4086
4226
  }
4087
- _context33.next = 7;
4227
+ _context35.next = 7;
4088
4228
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
4089
4229
  case 7:
4090
- snapshot = _context33.sent;
4230
+ snapshot = _context35.sent;
4091
4231
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4092
- _context33.next = 10;
4232
+ _context35.next = 10;
4093
4233
  break;
4094
4234
  }
4095
4235
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4098,7 +4238,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4098
4238
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4099
4239
  });
4100
4240
  case 10:
4101
- return _context33.abrupt("return", {
4241
+ return _context35.abrupt("return", {
4102
4242
  prepareKey: prepareKey,
4103
4243
  snapshot: snapshot
4104
4244
  });
@@ -4112,13 +4252,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4112
4252
  promise: promise
4113
4253
  });
4114
4254
  }
4115
- _context33.prev = 14;
4116
- _context33.next = 17;
4255
+ _context35.prev = 14;
4256
+ _context35.next = 17;
4117
4257
  return promise;
4118
4258
  case 17:
4119
- _snapshot = _context33.sent;
4259
+ _snapshot = _context35.sent;
4120
4260
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4121
- _context33.next = 20;
4261
+ _context35.next = 20;
4122
4262
  break;
4123
4263
  }
4124
4264
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4127,22 +4267,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4127
4267
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4128
4268
  });
4129
4269
  case 20:
4130
- return _context33.abrupt("return", {
4270
+ return _context35.abrupt("return", {
4131
4271
  prepareKey: prepareKey,
4132
4272
  snapshot: _snapshot
4133
4273
  });
4134
4274
  case 21:
4135
- _context33.prev = 21;
4275
+ _context35.prev = 21;
4136
4276
  current = this.availabilityPrepareInFlight.get(prepareKey);
4137
4277
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4138
4278
  this.availabilityPrepareInFlight.delete(prepareKey);
4139
4279
  }
4140
- return _context33.finish(21);
4280
+ return _context35.finish(21);
4141
4281
  case 25:
4142
4282
  case "end":
4143
- return _context33.stop();
4283
+ return _context35.stop();
4144
4284
  }
4145
- }, _callee33, this, [[14,, 21, 25]]);
4285
+ }, _callee35, this, [[14,, 21, 25]]);
4146
4286
  }));
4147
4287
  function getSharedPreparedAvailabilitySnapshot(_x24) {
4148
4288
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
@@ -4152,49 +4292,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4152
4292
  }, {
4153
4293
  key: "refreshAvailabilityContextProjection",
4154
4294
  value: function () {
4155
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4295
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4156
4296
  var _this9 = this;
4157
4297
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
4158
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4159
- while (1) switch (_context35.prev = _context35.next) {
4298
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4299
+ while (1) switch (_context37.prev = _context37.next) {
4160
4300
  case 0:
4161
4301
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4162
4302
  if (!existingInFlight) {
4163
- _context35.next = 5;
4303
+ _context37.next = 5;
4164
4304
  break;
4165
4305
  }
4166
- _context35.next = 4;
4306
+ _context37.next = 4;
4167
4307
  return existingInFlight;
4168
4308
  case 4:
4169
- return _context35.abrupt("return", _context35.sent);
4309
+ return _context37.abrupt("return", _context37.sent);
4170
4310
  case 5:
4171
4311
  context = this.getAvailabilityContextEntry(params.contextId);
4172
4312
  expectedVersion = context.activeVersion;
4173
4313
  expectedRefreshNonce = context.refreshNonce;
4174
4314
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
4175
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
4315
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
4176
4316
  var snapshot, currentContext, projectionEntry;
4177
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4178
- while (1) switch (_context34.prev = _context34.next) {
4317
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4318
+ while (1) switch (_context36.prev = _context36.next) {
4179
4319
  case 0:
4180
- _context34.next = 2;
4320
+ _context36.next = 2;
4181
4321
  return _this9.buildAvailabilityProjectionSnapshot(_this9.cloneAvailabilityPrepareParams(context.prepareParams), {
4182
4322
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
4183
4323
  });
4184
4324
  case 2:
4185
- snapshot = _context34.sent;
4325
+ snapshot = _context36.sent;
4186
4326
  currentContext = _this9.availabilityContextRegistry.get(params.contextId);
4187
4327
  if (currentContext) {
4188
- _context34.next = 6;
4328
+ _context36.next = 6;
4189
4329
  break;
4190
4330
  }
4191
- return _context34.abrupt("return", null);
4331
+ return _context36.abrupt("return", null);
4192
4332
  case 6:
4193
4333
  if (!(expectedLifecycleGeneration !== _this9.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4194
- _context34.next = 8;
4334
+ _context36.next = 8;
4195
4335
  break;
4196
4336
  }
4197
- return _context34.abrupt("return", null);
4337
+ return _context36.abrupt("return", null);
4198
4338
  case 8:
4199
4339
  projectionEntry = _this9.storeAvailabilityProjectionEntry({
4200
4340
  contextId: currentContext.contextId,
@@ -4204,7 +4344,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4204
4344
  orderRevision: snapshot.orderRevision,
4205
4345
  incrementVersion: true
4206
4346
  });
4207
- _context34.next = 11;
4347
+ _context36.next = 11;
4208
4348
  return _this9.emitAvailabilityDiagnostic({
4209
4349
  action: 'refresh',
4210
4350
  contextId: currentContext.contextId,
@@ -4216,31 +4356,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4216
4356
  reason: params.reason
4217
4357
  });
4218
4358
  case 11:
4219
- return _context34.abrupt("return", projectionEntry);
4359
+ return _context36.abrupt("return", projectionEntry);
4220
4360
  case 12:
4221
4361
  case "end":
4222
- return _context34.stop();
4362
+ return _context36.stop();
4223
4363
  }
4224
- }, _callee34);
4364
+ }, _callee36);
4225
4365
  }))();
4226
4366
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
4227
- _context35.prev = 11;
4228
- _context35.next = 14;
4367
+ _context37.prev = 11;
4368
+ _context37.next = 14;
4229
4369
  return refreshPromise;
4230
4370
  case 14:
4231
- return _context35.abrupt("return", _context35.sent);
4371
+ return _context37.abrupt("return", _context37.sent);
4232
4372
  case 15:
4233
- _context35.prev = 15;
4373
+ _context37.prev = 15;
4234
4374
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4235
4375
  if (current === refreshPromise) {
4236
4376
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
4237
4377
  }
4238
- return _context35.finish(15);
4378
+ return _context37.finish(15);
4239
4379
  case 19:
4240
4380
  case "end":
4241
- return _context35.stop();
4381
+ return _context37.stop();
4242
4382
  }
4243
- }, _callee35, this, [[11,, 15, 19]]);
4383
+ }, _callee37, this, [[11,, 15, 19]]);
4244
4384
  }));
4245
4385
  function refreshAvailabilityContextProjection(_x25) {
4246
4386
  return _refreshAvailabilityContextProjection.apply(this, arguments);
@@ -4250,53 +4390,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4250
4390
  }, {
4251
4391
  key: "ensureAvailabilityContextProjection",
4252
4392
  value: function () {
4253
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, reason) {
4393
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId, reason) {
4254
4394
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
4255
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4256
- while (1) switch (_context36.prev = _context36.next) {
4395
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4396
+ while (1) switch (_context38.prev = _context38.next) {
4257
4397
  case 0:
4258
4398
  retries = 0;
4259
4399
  case 1:
4260
4400
  if (!(retries < 3)) {
4261
- _context36.next = 19;
4401
+ _context38.next = 19;
4262
4402
  break;
4263
4403
  }
4264
4404
  context = this.getAvailabilityContextEntry(contextId);
4265
4405
  currentOrderRevision = this.getCurrentOrderRevision();
4266
4406
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
4267
4407
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
4268
- _context36.next = 7;
4408
+ _context38.next = 7;
4269
4409
  break;
4270
4410
  }
4271
- return _context36.abrupt("return", {
4411
+ return _context38.abrupt("return", {
4272
4412
  context: context,
4273
4413
  projectionEntry: projectionEntry,
4274
4414
  refreshed: false
4275
4415
  });
4276
4416
  case 7:
4277
- _context36.next = 9;
4417
+ _context38.next = 9;
4278
4418
  return this.refreshAvailabilityContextProjection({
4279
4419
  contextId: contextId,
4280
4420
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
4281
4421
  previousOrderRevision: context.lastKnownOrderRevision
4282
4422
  });
4283
4423
  case 9:
4284
- refreshedProjectionEntry = _context36.sent;
4424
+ refreshedProjectionEntry = _context38.sent;
4285
4425
  if (refreshedProjectionEntry) {
4286
- _context36.next = 13;
4426
+ _context38.next = 13;
4287
4427
  break;
4288
4428
  }
4289
4429
  retries += 1;
4290
- return _context36.abrupt("continue", 1);
4430
+ return _context38.abrupt("continue", 1);
4291
4431
  case 13:
4292
4432
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4293
- _context36.next = 16;
4433
+ _context38.next = 16;
4294
4434
  break;
4295
4435
  }
4296
4436
  retries += 1;
4297
- return _context36.abrupt("continue", 1);
4437
+ return _context38.abrupt("continue", 1);
4298
4438
  case 16:
4299
- return _context36.abrupt("return", {
4439
+ return _context38.abrupt("return", {
4300
4440
  context: this.getAvailabilityContextEntry(contextId),
4301
4441
  projectionEntry: refreshedProjectionEntry,
4302
4442
  refreshed: true
@@ -4308,9 +4448,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4308
4448
  });
4309
4449
  case 20:
4310
4450
  case "end":
4311
- return _context36.stop();
4451
+ return _context38.stop();
4312
4452
  }
4313
- }, _callee36, this);
4453
+ }, _callee38, this);
4314
4454
  }));
4315
4455
  function ensureAvailabilityContextProjection(_x26, _x27) {
4316
4456
  return _ensureAvailabilityContextProjection.apply(this, arguments);
@@ -4320,18 +4460,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4320
4460
  }, {
4321
4461
  key: "tryAcquireAvailabilityCommitLock",
4322
4462
  value: function () {
4323
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId) {
4463
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId) {
4324
4464
  var _currentContext$activ;
4325
4465
  var _waitingContext$activ, waitingContext, currentContext;
4326
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4327
- while (1) switch (_context37.prev = _context37.next) {
4466
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4467
+ while (1) switch (_context39.prev = _context39.next) {
4328
4468
  case 0:
4329
4469
  if (!this.availabilityCommitLocks.has(contextId)) {
4330
- _context37.next = 5;
4470
+ _context39.next = 5;
4331
4471
  break;
4332
4472
  }
4333
4473
  waitingContext = this.availabilityContextRegistry.get(contextId);
4334
- _context37.next = 4;
4474
+ _context39.next = 4;
4335
4475
  return this.emitAvailabilityDiagnostic({
4336
4476
  action: 'commit_lock_wait',
4337
4477
  contextId: contextId,
@@ -4348,7 +4488,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4348
4488
  case 5:
4349
4489
  this.availabilityCommitLocks.add(contextId);
4350
4490
  currentContext = this.availabilityContextRegistry.get(contextId);
4351
- _context37.next = 9;
4491
+ _context39.next = 9;
4352
4492
  return this.emitAvailabilityDiagnostic({
4353
4493
  action: 'commit_lock_acquired',
4354
4494
  contextId: contextId,
@@ -4360,9 +4500,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4360
4500
  });
4361
4501
  case 9:
4362
4502
  case "end":
4363
- return _context37.stop();
4503
+ return _context39.stop();
4364
4504
  }
4365
- }, _callee37, this);
4505
+ }, _callee39, this);
4366
4506
  }));
4367
4507
  function tryAcquireAvailabilityCommitLock(_x28) {
4368
4508
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
@@ -4372,15 +4512,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4372
4512
  }, {
4373
4513
  key: "releaseAvailabilityCommitLock",
4374
4514
  value: function () {
4375
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId) {
4515
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
4376
4516
  var _releasedContext$acti;
4377
4517
  var releasedContext;
4378
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4379
- while (1) switch (_context38.prev = _context38.next) {
4518
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4519
+ while (1) switch (_context40.prev = _context40.next) {
4380
4520
  case 0:
4381
4521
  this.availabilityCommitLocks.delete(contextId);
4382
4522
  releasedContext = this.availabilityContextRegistry.get(contextId);
4383
- _context38.next = 4;
4523
+ _context40.next = 4;
4384
4524
  return this.emitAvailabilityDiagnostic({
4385
4525
  action: 'commit_lock_released',
4386
4526
  contextId: contextId,
@@ -4392,9 +4532,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4392
4532
  });
4393
4533
  case 4:
4394
4534
  case "end":
4395
- return _context38.stop();
4535
+ return _context40.stop();
4396
4536
  }
4397
- }, _callee38, this);
4537
+ }, _callee40, this);
4398
4538
  }));
4399
4539
  function releaseAvailabilityCommitLock(_x29) {
4400
4540
  return _releaseAvailabilityCommitLock.apply(this, arguments);
@@ -4404,20 +4544,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4404
4544
  }, {
4405
4545
  key: "prepareAvailabilityProjection",
4406
4546
  value: (function () {
4407
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4547
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4408
4548
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
4409
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4410
- while (1) switch (_context39.prev = _context39.next) {
4549
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4550
+ while (1) switch (_context41.prev = _context41.next) {
4411
4551
  case 0:
4412
4552
  this.assertAvailabilityPrepareParams(params);
4413
- _context39.next = 3;
4553
+ _context41.next = 3;
4414
4554
  return this.resolveAvailabilityPrepareDefaults(params);
4415
4555
  case 3:
4416
- paramsWithDefaults = _context39.sent;
4417
- _context39.next = 6;
4556
+ paramsWithDefaults = _context41.sent;
4557
+ _context41.next = 6;
4418
4558
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
4419
4559
  case 6:
4420
- _yield$this$getShared = _context39.sent;
4560
+ _yield$this$getShared = _context41.sent;
4421
4561
  prepareKey = _yield$this$getShared.prepareKey;
4422
4562
  snapshot = _yield$this$getShared.snapshot;
4423
4563
  contextId = this.createAvailabilityContextId();
@@ -4438,7 +4578,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4438
4578
  refreshed: false,
4439
4579
  reason: 'prepare'
4440
4580
  };
4441
- _context39.next = 16;
4581
+ _context41.next = 16;
4442
4582
  return this.emitAvailabilityDiagnostic({
4443
4583
  action: 'prepare',
4444
4584
  contextId: contextId,
@@ -4449,15 +4589,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4449
4589
  reason: 'prepare'
4450
4590
  });
4451
4591
  case 16:
4452
- _context39.next = 18;
4592
+ _context41.next = 18;
4453
4593
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
4454
4594
  case 18:
4455
- return _context39.abrupt("return", handle);
4595
+ return _context41.abrupt("return", handle);
4456
4596
  case 19:
4457
4597
  case "end":
4458
- return _context39.stop();
4598
+ return _context41.stop();
4459
4599
  }
4460
- }, _callee39, this);
4600
+ }, _callee41, this);
4461
4601
  }));
4462
4602
  function prepareAvailabilityProjection(_x30) {
4463
4603
  return _prepareAvailabilityProjection.apply(this, arguments);
@@ -4467,9 +4607,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4467
4607
  }, {
4468
4608
  key: "getProductTimeRanges",
4469
4609
  value: (function () {
4470
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
4610
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId) {
4471
4611
  var _this$otherParams$pla,
4472
- _this$otherParams24,
4612
+ _this$otherParams26,
4473
4613
  _this10 = this;
4474
4614
  var request,
4475
4615
  _yield$this$ensureAva,
@@ -4478,27 +4618,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4478
4618
  contextVersion,
4479
4619
  isPosAvailabilityRequest,
4480
4620
  allowOutsideOperatingHoursForRequestedStartTimes,
4481
- _args40 = arguments;
4482
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4483
- while (1) switch (_context40.prev = _context40.next) {
4621
+ _args42 = arguments;
4622
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4623
+ while (1) switch (_context42.prev = _context42.next) {
4484
4624
  case 0:
4485
- request = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
4486
- _context40.next = 3;
4625
+ request = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : {};
4626
+ _context42.next = 3;
4487
4627
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
4488
4628
  case 3:
4489
- _yield$this$ensureAva = _context40.sent;
4629
+ _yield$this$ensureAva = _context42.sent;
4490
4630
  context = _yield$this$ensureAva.context;
4491
4631
  projectionEntry = _yield$this$ensureAva.projectionEntry;
4492
4632
  contextVersion = context.activeVersion;
4493
- isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
4633
+ isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
4494
4634
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
4495
4635
  return Array.isArray(startTimes) && startTimes.length > 0;
4496
4636
  });
4497
- return _context40.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4637
+ return _context42.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4498
4638
  allowOutsideOperatingHoursForRequestedStartTimes: true
4499
4639
  } : {}), {
4500
4640
  evaluatedAt: this.getAvailabilityRuntimeDateTime(),
4501
- allowSessionCustomRanges: isPosAvailabilityRequest
4641
+ useExactDurationCandidateMinute: isPosAvailabilityRequest,
4642
+ allowSessionCustomRanges: isPosAvailabilityRequest,
4643
+ allowExcludedScheduleDateOverride: isPosAvailabilityRequest
4502
4644
  }).map(function (group) {
4503
4645
  return _objectSpread(_objectSpread({}, group), {}, {
4504
4646
  ranges: group.ranges.map(function (candidate) {
@@ -4508,9 +4650,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4508
4650
  }));
4509
4651
  case 10:
4510
4652
  case "end":
4511
- return _context40.stop();
4653
+ return _context42.stop();
4512
4654
  }
4513
- }, _callee40, this);
4655
+ }, _callee42, this);
4514
4656
  }));
4515
4657
  function getProductTimeRanges(_x31) {
4516
4658
  return _getProductTimeRanges.apply(this, arguments);
@@ -4520,20 +4662,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4520
4662
  }, {
4521
4663
  key: "queryBookingAvailability",
4522
4664
  value: (function () {
4523
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(contextId, request) {
4524
- var _yield$this$ensureAva2, context, projectionEntry, refreshed, result, contextVersion, contextualResult;
4525
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4526
- while (1) switch (_context41.prev = _context41.next) {
4665
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId, request) {
4666
+ var _this$otherParams$pla2, _this$otherParams27;
4667
+ var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
4668
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4669
+ while (1) switch (_context43.prev = _context43.next) {
4527
4670
  case 0:
4528
- _context41.next = 2;
4671
+ _context43.next = 2;
4529
4672
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
4530
4673
  case 2:
4531
- _yield$this$ensureAva2 = _context41.sent;
4674
+ _yield$this$ensureAva2 = _context43.sent;
4532
4675
  context = _yield$this$ensureAva2.context;
4533
4676
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
4534
4677
  refreshed = _yield$this$ensureAva2.refreshed;
4535
4678
  this.assertContextualQueryFreshness(context, request);
4536
- result = queryAvailabilityProjection(projectionEntry.projection, request);
4679
+ isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4680
+ result = queryAvailabilityProjection(projectionEntry.projection, request, {
4681
+ useExactDurationCandidateMinute: isPosAvailabilityRequest,
4682
+ allowExcludedScheduleDateOverride: isPosAvailabilityRequest
4683
+ });
4537
4684
  contextVersion = context.activeVersion;
4538
4685
  contextualResult = result.target === 'time' ? _objectSpread(_objectSpread({}, result), {}, {
4539
4686
  data: result.data.map(function (group) {
@@ -4560,16 +4707,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4560
4707
  });
4561
4708
  })
4562
4709
  }) : result;
4563
- return _context41.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4710
+ return _context43.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4564
4711
  contextId: context.contextId,
4565
4712
  contextVersion: contextVersion,
4566
4713
  refreshed: refreshed
4567
4714
  }));
4568
- case 11:
4715
+ case 12:
4569
4716
  case "end":
4570
- return _context41.stop();
4717
+ return _context43.stop();
4571
4718
  }
4572
- }, _callee41, this);
4719
+ }, _callee43, this);
4573
4720
  }));
4574
4721
  function queryBookingAvailability(_x32, _x33) {
4575
4722
  return _queryBookingAvailability.apply(this, arguments);
@@ -4641,27 +4788,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4641
4788
  }, {
4642
4789
  key: "commitAvailabilitySelection",
4643
4790
  value: (function () {
4644
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, params) {
4645
- var normalizedContextId, _params$bookingCount, _ref51, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla2, _this$otherParams25, _ref52, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref53, _ref54, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref55, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4646
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4647
- while (1) switch (_context42.prev = _context42.next) {
4791
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, params) {
4792
+ var normalizedContextId, _params$bookingCount, _ref51, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams28, _ref52, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref53, _ref54, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref55, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4793
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4794
+ while (1) switch (_context44.prev = _context44.next) {
4648
4795
  case 0:
4649
4796
  normalizedContextId = String(contextId || '').trim();
4650
4797
  if (normalizedContextId) {
4651
- _context42.next = 3;
4798
+ _context44.next = 3;
4652
4799
  break;
4653
4800
  }
4654
4801
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
4655
4802
  candidate: params.candidate
4656
4803
  });
4657
4804
  case 3:
4658
- _context42.next = 5;
4805
+ _context44.next = 5;
4659
4806
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
4660
4807
  case 5:
4661
- _context42.prev = 5;
4808
+ _context44.prev = 5;
4662
4809
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
4663
4810
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
4664
- _context42.next = 9;
4811
+ _context44.next = 9;
4665
4812
  break;
4666
4813
  }
4667
4814
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -4669,7 +4816,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4669
4816
  });
4670
4817
  case 9:
4671
4818
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
4672
- _context42.next = 11;
4819
+ _context44.next = 11;
4673
4820
  break;
4674
4821
  }
4675
4822
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
@@ -4678,7 +4825,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4678
4825
  case 11:
4679
4826
  orderProductQuantity = (_ref51 = (_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 && _ref51 !== void 0 ? _ref51 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4680
4827
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
4681
- _context42.next = 14;
4828
+ _context44.next = 14;
4682
4829
  break;
4683
4830
  }
4684
4831
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -4688,22 +4835,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4688
4835
  case 14:
4689
4836
  partySize = Number(params.partySize);
4690
4837
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
4691
- _context42.next = 17;
4838
+ _context44.next = 17;
4692
4839
  break;
4693
4840
  }
4694
4841
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
4695
4842
  partySize: params.partySize
4696
4843
  });
4697
4844
  case 17:
4698
- _context42.next = 19;
4845
+ _context44.next = 19;
4699
4846
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
4700
4847
  case 19:
4701
- _yield$this$ensureAva3 = _context42.sent;
4848
+ _yield$this$ensureAva3 = _context44.sent;
4702
4849
  context = _yield$this$ensureAva3.context;
4703
4850
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
4704
4851
  refreshed = _yield$this$ensureAva3.refreshed;
4705
4852
  if (!refreshed) {
4706
- _context42.next = 25;
4853
+ _context44.next = 25;
4707
4854
  break;
4708
4855
  }
4709
4856
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4714,11 +4861,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4714
4861
  case 25:
4715
4862
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
4716
4863
  if (!(params.mode === 'edit')) {
4717
- _context42.next = 31;
4864
+ _context44.next = 31;
4718
4865
  break;
4719
4866
  }
4720
4867
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
4721
- _context42.next = 29;
4868
+ _context44.next = 29;
4722
4869
  break;
4723
4870
  }
4724
4871
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -4727,11 +4874,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4727
4874
  editingProductLineUids: boundEditingUids
4728
4875
  });
4729
4876
  case 29:
4730
- _context42.next = 33;
4877
+ _context44.next = 33;
4731
4878
  break;
4732
4879
  case 31:
4733
4880
  if (!(boundEditingUids.length > 0)) {
4734
- _context42.next = 33;
4881
+ _context44.next = 33;
4735
4882
  break;
4736
4883
  }
4737
4884
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -4740,7 +4887,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4740
4887
  });
4741
4888
  case 33:
4742
4889
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
4743
- _context42.next = 35;
4890
+ _context44.next = 35;
4744
4891
  break;
4745
4892
  }
4746
4893
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4750,7 +4897,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4750
4897
  });
4751
4898
  case 35:
4752
4899
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4753
- _context42.next = 37;
4900
+ _context44.next = 37;
4754
4901
  break;
4755
4902
  }
4756
4903
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -4761,7 +4908,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4761
4908
  });
4762
4909
  case 37:
4763
4910
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
4764
- _context42.next = 39;
4911
+ _context44.next = 39;
4765
4912
  break;
4766
4913
  }
4767
4914
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -4773,7 +4920,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4773
4920
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
4774
4921
  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;
4775
4922
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
4776
- _context42.next = 43;
4923
+ _context44.next = 43;
4777
4924
  break;
4778
4925
  }
4779
4926
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -4782,14 +4929,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4782
4929
  });
4783
4930
  case 43:
4784
4931
  if (!(params.mode === 'edit' && !params.productLineUid)) {
4785
- _context42.next = 45;
4932
+ _context44.next = 45;
4786
4933
  break;
4787
4934
  }
4788
4935
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
4789
4936
  case 45:
4790
4937
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
4791
4938
  if (!(params.mode === 'edit' && !editingLine)) {
4792
- _context42.next = 48;
4939
+ _context44.next = 48;
4793
4940
  break;
4794
4941
  }
4795
4942
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -4797,7 +4944,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4797
4944
  });
4798
4945
  case 48:
4799
4946
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
4800
- _context42.next = 50;
4947
+ _context44.next = 50;
4801
4948
  break;
4802
4949
  }
4803
4950
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -4807,7 +4954,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4807
4954
  });
4808
4955
  case 50:
4809
4956
  if (Array.isArray(params.requirementSelections)) {
4810
- _context42.next = 52;
4957
+ _context44.next = 52;
4811
4958
  break;
4812
4959
  }
4813
4960
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -4824,7 +4971,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4824
4971
  };
4825
4972
  prepareParams = baseProjection.meta.prepareParams;
4826
4973
  if (prepareParams) {
4827
- _context42.next = 57;
4974
+ _context44.next = 57;
4828
4975
  break;
4829
4976
  }
4830
4977
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -4836,7 +4983,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4836
4983
  })),
4837
4984
  includesInjectedRawOccupancies: true
4838
4985
  };
4839
- _context42.next = 60;
4986
+ _context44.next = 60;
4840
4987
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
4841
4988
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
4842
4989
  }), {
@@ -4845,13 +4992,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4845
4992
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
4846
4993
  });
4847
4994
  case 60:
4848
- commitSnapshot = _context42.sent;
4995
+ commitSnapshot = _context44.sent;
4849
4996
  refreshedProjection = commitSnapshot.projection;
4850
4997
  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 : ''))) {
4851
- _context42.next = 67;
4998
+ _context44.next = 67;
4852
4999
  break;
4853
5000
  }
4854
- _context42.next = 65;
5001
+ _context44.next = 65;
4855
5002
  return this.refreshAvailabilityContextProjection({
4856
5003
  contextId: normalizedContextId,
4857
5004
  reason: 'commit_order_revision_changed',
@@ -4872,7 +5019,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4872
5019
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
4873
5020
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
4874
5021
  candidateStartTime = getCandidateStartTime(params.candidate);
4875
- allowPosAvailabilityOverride = String((_this$otherParams$pla2 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
5022
+ allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
4876
5023
  refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
4877
5024
  productIds: [params.candidate.productId],
4878
5025
  dateRange: {
@@ -4886,7 +5033,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4886
5033
  }, allowPosAvailabilityOverride ? {
4887
5034
  allowOutsideOperatingHoursForRequestedStartTimes: true
4888
5035
  } : {}) : {}) : {}), {
4889
- allowSessionCustomRanges: allowPosAvailabilityOverride
5036
+ useExactDurationCandidateMinute: allowPosAvailabilityOverride,
5037
+ allowSessionCustomRanges: allowPosAvailabilityOverride,
5038
+ allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
4890
5039
  }).flatMap(function (group) {
4891
5040
  return group.ranges;
4892
5041
  });
@@ -4894,7 +5043,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4894
5043
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
4895
5044
  });
4896
5045
  if (refreshedCandidateBase) {
4897
- _context42.next = 75;
5046
+ _context44.next = 75;
4898
5047
  break;
4899
5048
  }
4900
5049
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -4907,7 +5056,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4907
5056
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
4908
5057
  });
4909
5058
  if (product) {
4910
- _context42.next = 78;
5059
+ _context44.next = 78;
4911
5060
  break;
4912
5061
  }
4913
5062
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -4919,6 +5068,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4919
5068
  requirementSelections: params.requirementSelections,
4920
5069
  partySize: partySize,
4921
5070
  bookingCount: bookingCount
5071
+ }, {
5072
+ useExactDurationCandidateMinute: allowPosAvailabilityOverride,
5073
+ allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
4922
5074
  });
4923
5075
  if (allowPosAvailabilityOverride && !validation.ok && validation.conflicts.every(function (conflict) {
4924
5076
  return POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES.has(conflict.code);
@@ -4941,7 +5093,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4941
5093
  });
4942
5094
  }
4943
5095
  if (validation.ok) {
4944
- _context42.next = 83;
5096
+ _context44.next = 83;
4945
5097
  break;
4946
5098
  }
4947
5099
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -4964,7 +5116,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4964
5116
  incrementVersion: true
4965
5117
  });
4966
5118
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
4967
- _context42.next = 87;
5119
+ _context44.next = 87;
4968
5120
  return this.emitAvailabilityDiagnostic({
4969
5121
  action: 'refresh',
4970
5122
  contextId: normalizedContextId,
@@ -4987,7 +5139,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4987
5139
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
4988
5140
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
4989
5141
  if (!(params.mode === 'edit' && !existingBookingUid)) {
4990
- _context42.next = 93;
5142
+ _context44.next = 93;
4991
5143
  break;
4992
5144
  }
4993
5145
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -5009,7 +5161,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5009
5161
  quantity: bookingCount
5010
5162
  }), 'unified_booking_sales', product);
5011
5163
  if (transformed) {
5012
- _context42.next = 98;
5164
+ _context44.next = 98;
5013
5165
  break;
5014
5166
  }
5015
5167
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -5028,7 +5180,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5028
5180
  productLineUids = [];
5029
5181
  bookingUids = [];
5030
5182
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
5031
- _context42.next = 117;
5183
+ _context44.next = 117;
5032
5184
  break;
5033
5185
  }
5034
5186
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -5038,7 +5190,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5038
5190
  unique_identification_number: params.productLineUid,
5039
5191
  booking_uid: existingBookingUid
5040
5192
  });
5041
- _context42.next = 111;
5193
+ _context44.next = 111;
5042
5194
  return this.updateOrderProduct(_objectSpread(_objectSpread({
5043
5195
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
5044
5196
  product_variant_id: (_ref55 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref55 !== void 0 ? _ref55 : 0,
@@ -5055,7 +5207,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5055
5207
  bookingUid = existingBookingUid;
5056
5208
  productLineUids = [productLineUid];
5057
5209
  bookingUids = [bookingUid];
5058
- _context42.next = 129;
5210
+ _context44.next = 129;
5059
5211
  break;
5060
5212
  case 117:
5061
5213
  beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
@@ -5064,12 +5216,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5064
5216
  beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
5065
5217
  return getBookingUid(item);
5066
5218
  }).filter(Boolean));
5067
- _context42.next = 121;
5219
+ _context44.next = 121;
5068
5220
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
5069
5221
  salesNotes: params.salesNotes
5070
5222
  } : undefined);
5071
5223
  case 121:
5072
- products = _context42.sent;
5224
+ products = _context44.sent;
5073
5225
  addedLines = products.filter(function (line) {
5074
5226
  var _line$product_id, _line$metadata;
5075
5227
  return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
@@ -5106,21 +5258,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5106
5258
  productLineUids: productLineUids,
5107
5259
  bookingUids: bookingUids
5108
5260
  };
5109
- _context42.next = 134;
5261
+ _context44.next = 134;
5110
5262
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
5111
5263
  case 134:
5112
- return _context42.abrupt("return", result);
5264
+ return _context44.abrupt("return", result);
5113
5265
  case 135:
5114
- _context42.prev = 135;
5115
- _context42.next = 138;
5266
+ _context44.prev = 135;
5267
+ _context44.next = 138;
5116
5268
  return this.releaseAvailabilityCommitLock(normalizedContextId);
5117
5269
  case 138:
5118
- return _context42.finish(135);
5270
+ return _context44.finish(135);
5119
5271
  case 139:
5120
5272
  case "end":
5121
- return _context42.stop();
5273
+ return _context44.stop();
5122
5274
  }
5123
- }, _callee42, this, [[5,, 135, 139]]);
5275
+ }, _callee44, this, [[5,, 135, 139]]);
5124
5276
  }));
5125
5277
  function commitAvailabilitySelection(_x34, _x35) {
5126
5278
  return _commitAvailabilitySelection.apply(this, arguments);