@pisell/pisellos 2.3.76 → 2.3.78

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.
@@ -987,7 +987,9 @@ function buildBookingFromAvailabilitySelection(params) {
987
987
  product = params.product,
988
988
  _params$resources = params.resources,
989
989
  resources = _params$resources === void 0 ? [] : _params$resources,
990
- bookingUid = params.bookingUid;
990
+ bookingUid = params.bookingUid,
991
+ holder = params.holder,
992
+ holderIds = params.holderIds;
991
993
  var bookingStartAt = candidate.bookingStartAt || candidate.startAt;
992
994
  var bookingEndAt = candidate.bookingEndAt || candidate.endAt;
993
995
  var startScalar = localDateTimeToScalar(parseLocalDateTime(bookingStartAt));
@@ -1005,14 +1007,19 @@ function buildBookingFromAvailabilitySelection(params) {
1005
1007
  scheduleRefs: candidate.scheduleRefs
1006
1008
  });
1007
1009
  }
1008
- return {
1010
+ var normalizedHolder = holder && _typeof(holder) === 'object' ? cloneDeep(holder) : undefined;
1011
+ var normalizedHolderIds = Array.isArray(holderIds) ? cloneDeep(holderIds) : holderIds;
1012
+ return _objectSpread(_objectSpread({
1009
1013
  start_date: bookingStartAt.slice(0, 10),
1010
1014
  start_time: bookingStartAt.slice(11, 16),
1011
1015
  end_date: bookingEndAt.slice(0, 10),
1012
1016
  end_time: bookingEndAt.slice(11, 16),
1013
1017
  duration: Math.max(1, Math.trunc((endScalar - startScalar) / (60 * 1000))),
1014
1018
  like_status: 'common',
1015
- schedule_id: scheduleId !== null && scheduleId !== void 0 ? scheduleId : 0,
1019
+ schedule_id: scheduleId !== null && scheduleId !== void 0 ? scheduleId : 0
1020
+ }, normalizedHolder ? {
1021
+ holder: normalizedHolder
1022
+ } : {}), {}, {
1016
1023
  resources: assignments.map(function (assignment) {
1017
1024
  // requirementSelections 的提交协议只携带资源 ID;购物车展示则需要名称。
1018
1025
  // commit 此时仍持有本次不可变 projection,因此直接按 ID 取回名称并
@@ -1035,7 +1042,7 @@ function buildBookingFromAvailabilitySelection(params) {
1035
1042
  }
1036
1043
  } : {});
1037
1044
  }),
1038
- metadata: _objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
1045
+ metadata: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
1039
1046
  unique_identification_number: bookingUid
1040
1047
  } : {}), {}, {
1041
1048
  unified_booking_sales: true,
@@ -1048,8 +1055,12 @@ function buildBookingFromAvailabilitySelection(params) {
1048
1055
  time_slot_id: timeSlotId
1049
1056
  }), {}, {
1050
1057
  product_kind: product.kind
1051
- })
1052
- };
1058
+ }, normalizedHolderIds === undefined ? {} : {
1059
+ holder_id: normalizedHolderIds
1060
+ }), normalizedHolder ? {
1061
+ holder: cloneDeep(normalizedHolder)
1062
+ } : {})
1063
+ });
1053
1064
  }
1054
1065
  export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1055
1066
  _inherits(UnifiedBookingSalesImpl, _BookingTicket);
@@ -2023,34 +2034,65 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2023
2034
  }
2024
2035
  return getOpenData;
2025
2036
  }()
2037
+ /**
2038
+ * Load a resource policy without depending on the legacy appointmentBooking solution.
2039
+ */
2040
+ }, {
2041
+ key: "getProtocol",
2042
+ value: (function () {
2043
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(policyId) {
2044
+ var normalizedPolicyId;
2045
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2046
+ while (1) switch (_context13.prev = _context13.next) {
2047
+ case 0:
2048
+ normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2049
+ if (normalizedPolicyId) {
2050
+ _context13.next = 3;
2051
+ break;
2052
+ }
2053
+ throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
2054
+ case 3:
2055
+ return _context13.abrupt("return", this.request.get("/shop-policy/".concat(encodeURIComponent(normalizedPolicyId))));
2056
+ case 4:
2057
+ case "end":
2058
+ return _context13.stop();
2059
+ }
2060
+ }, _callee13, this);
2061
+ }));
2062
+ function getProtocol(_x8) {
2063
+ return _getProtocol.apply(this, arguments);
2064
+ }
2065
+ return getProtocol;
2066
+ }()
2026
2067
  /**
2027
2068
  * Loads the product catalog used by both UI and Planner. Schedule data is requested with each
2028
2069
  * product because session products carry their fixed intervals there.
2029
2070
  */
2071
+ )
2030
2072
  }, {
2031
2073
  key: "loadProducts",
2032
2074
  value: (function () {
2033
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2075
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2034
2076
  var params,
2035
2077
  options,
2036
2078
  schedule_date,
2037
2079
  schedule_datetime,
2038
2080
  result,
2039
- _args13 = arguments;
2040
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2041
- while (1) switch (_context13.prev = _context13.next) {
2081
+ _args14 = arguments;
2082
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2083
+ while (1) switch (_context14.prev = _context14.next) {
2042
2084
  case 0:
2043
- params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2044
- options = _args13.length > 1 ? _args13[1] : undefined;
2085
+ params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2086
+ options = _args14.length > 1 ? _args14[1] : undefined;
2045
2087
  if (this.store.products) {
2046
- _context13.next = 4;
2088
+ _context14.next = 4;
2047
2089
  break;
2048
2090
  }
2049
2091
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2050
2092
  case 4:
2051
2093
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2052
2094
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2053
- _context13.next = 8;
2095
+ _context14.next = 8;
2054
2096
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2055
2097
  with_count: ['bundleGroup', 'optionGroup'],
2056
2098
  with_schedule: 1
@@ -2060,17 +2102,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2060
2102
  cacheId: this.cacheId
2061
2103
  }), options);
2062
2104
  case 8:
2063
- result = _context13.sent;
2105
+ result = _context14.sent;
2064
2106
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2065
- _context13.next = 12;
2107
+ _context14.next = 12;
2066
2108
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2067
2109
  case 12:
2068
- return _context13.abrupt("return", result);
2110
+ return _context14.abrupt("return", result);
2069
2111
  case 13:
2070
2112
  case "end":
2071
- return _context13.stop();
2113
+ return _context14.stop();
2072
2114
  }
2073
- }, _callee13, this);
2115
+ }, _callee14, this);
2074
2116
  }));
2075
2117
  function loadProducts() {
2076
2118
  return _loadProducts.apply(this, arguments);
@@ -2080,24 +2122,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2080
2122
  }, {
2081
2123
  key: "loadScheduleAvailableDate",
2082
2124
  value: (function () {
2083
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
2084
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2085
- while (1) switch (_context14.prev = _context14.next) {
2125
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
2126
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2127
+ while (1) switch (_context15.prev = _context15.next) {
2086
2128
  case 0:
2087
2129
  if (this.store.schedule) {
2088
- _context14.next = 2;
2130
+ _context15.next = 2;
2089
2131
  break;
2090
2132
  }
2091
2133
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2092
2134
  case 2:
2093
- return _context14.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2135
+ return _context15.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2094
2136
  case 3:
2095
2137
  case "end":
2096
- return _context14.stop();
2138
+ return _context15.stop();
2097
2139
  }
2098
- }, _callee14, this);
2140
+ }, _callee15, this);
2099
2141
  }));
2100
- function loadScheduleAvailableDate(_x8) {
2142
+ function loadScheduleAvailableDate(_x9) {
2101
2143
  return _loadScheduleAvailableDate.apply(this, arguments);
2102
2144
  }
2103
2145
  return loadScheduleAvailableDate;
@@ -2111,15 +2153,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2111
2153
  }, {
2112
2154
  key: "loadProductsByScheduleDate",
2113
2155
  value: (function () {
2114
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
2156
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
2115
2157
  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;
2116
2158
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
2117
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2118
- while (1) switch (_context15.prev = _context15.next) {
2159
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2160
+ while (1) switch (_context16.prev = _context16.next) {
2119
2161
  case 0:
2120
2162
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
2121
2163
  if (this.store.schedule) {
2122
- _context15.next = 3;
2164
+ _context16.next = 3;
2123
2165
  break;
2124
2166
  }
2125
2167
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -2130,10 +2172,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2130
2172
  });
2131
2173
  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;
2132
2174
  if (!(!hasCachedDate && !hasOtherProducts)) {
2133
- _context15.next = 9;
2175
+ _context16.next = 9;
2134
2176
  break;
2135
2177
  }
2136
- _context15.next = 9;
2178
+ _context16.next = 9;
2137
2179
  return this.loadScheduleAvailableDate({
2138
2180
  startDate: date,
2139
2181
  endDate: date,
@@ -2153,45 +2195,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2153
2195
  return !productIdFilter || productIdFilter.has(String(id));
2154
2196
  });
2155
2197
  if (availableProductIds.length) {
2156
- _context15.next = 17;
2198
+ _context16.next = 17;
2157
2199
  break;
2158
2200
  }
2159
2201
  this.unifiedProductCatalog = [];
2160
- _context15.next = 16;
2202
+ _context16.next = 16;
2161
2203
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
2162
2204
  case 16:
2163
- return _context15.abrupt("return", []);
2205
+ return _context16.abrupt("return", []);
2164
2206
  case 17:
2165
- _context15.next = 19;
2207
+ _context16.next = 19;
2166
2208
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2167
2209
  product_ids: availableProductIds,
2168
2210
  schedule_date: date
2169
2211
  }));
2170
2212
  case 19:
2171
- products = _context15.sent;
2213
+ products = _context16.sent;
2172
2214
  if (!(products.length || availableProductIds.length <= 1)) {
2173
- _context15.next = 22;
2215
+ _context16.next = 22;
2174
2216
  break;
2175
2217
  }
2176
- return _context15.abrupt("return", products);
2218
+ return _context16.abrupt("return", products);
2177
2219
  case 22:
2178
2220
  fallbackProducts = [];
2179
2221
  _iterator = _createForOfIteratorHelper(availableProductIds);
2180
- _context15.prev = 24;
2222
+ _context16.prev = 24;
2181
2223
  _iterator.s();
2182
2224
  case 26:
2183
2225
  if ((_step = _iterator.n()).done) {
2184
- _context15.next = 34;
2226
+ _context16.next = 34;
2185
2227
  break;
2186
2228
  }
2187
2229
  productId = _step.value;
2188
- _context15.next = 30;
2230
+ _context16.next = 30;
2189
2231
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2190
2232
  product_ids: [productId],
2191
2233
  schedule_date: date
2192
2234
  }));
2193
2235
  case 30:
2194
- result = _context15.sent;
2236
+ result = _context16.sent;
2195
2237
  result.forEach(function (product) {
2196
2238
  var _id;
2197
2239
  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;
@@ -2203,32 +2245,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2203
2245
  }
2204
2246
  });
2205
2247
  case 32:
2206
- _context15.next = 26;
2248
+ _context16.next = 26;
2207
2249
  break;
2208
2250
  case 34:
2209
- _context15.next = 39;
2251
+ _context16.next = 39;
2210
2252
  break;
2211
2253
  case 36:
2212
- _context15.prev = 36;
2213
- _context15.t0 = _context15["catch"](24);
2214
- _iterator.e(_context15.t0);
2254
+ _context16.prev = 36;
2255
+ _context16.t0 = _context16["catch"](24);
2256
+ _iterator.e(_context16.t0);
2215
2257
  case 39:
2216
- _context15.prev = 39;
2258
+ _context16.prev = 39;
2217
2259
  _iterator.f();
2218
- return _context15.finish(39);
2260
+ return _context16.finish(39);
2219
2261
  case 42:
2220
2262
  this.unifiedProductCatalog = [].concat(fallbackProducts);
2221
- _context15.next = 45;
2263
+ _context16.next = 45;
2222
2264
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
2223
2265
  case 45:
2224
- return _context15.abrupt("return", fallbackProducts);
2266
+ return _context16.abrupt("return", fallbackProducts);
2225
2267
  case 46:
2226
2268
  case "end":
2227
- return _context15.stop();
2269
+ return _context16.stop();
2228
2270
  }
2229
- }, _callee15, this, [[24, 36, 39, 42]]);
2271
+ }, _callee16, this, [[24, 36, 39, 42]]);
2230
2272
  }));
2231
- function loadProductsByScheduleDate(_x9) {
2273
+ function loadProductsByScheduleDate(_x10) {
2232
2274
  return _loadProductsByScheduleDate.apply(this, arguments);
2233
2275
  }
2234
2276
  return loadProductsByScheduleDate;
@@ -2281,7 +2323,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2281
2323
  }, {
2282
2324
  key: "applyPlannerDiscounts",
2283
2325
  value: (function () {
2284
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2326
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2285
2327
  var _params$customerId;
2286
2328
  var params,
2287
2329
  tempOrder,
@@ -2298,24 +2340,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2298
2340
  discount,
2299
2341
  discountId,
2300
2342
  nextTempOrder,
2301
- _args16 = arguments;
2302
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2303
- while (1) switch (_context16.prev = _context16.next) {
2343
+ _args17 = arguments;
2344
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2345
+ while (1) switch (_context17.prev = _context17.next) {
2304
2346
  case 0:
2305
- params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
2347
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
2306
2348
  tempOrder = this.getTempOrder();
2307
2349
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
2308
2350
  parsedCustomerId = Number(requestedCustomerId);
2309
2351
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
2310
- _context16.next = 7;
2352
+ _context17.next = 7;
2311
2353
  return this.getSummary();
2312
2354
  case 7:
2313
- summaryBefore = _context16.sent;
2355
+ summaryBefore = _context17.sent;
2314
2356
  if (customerId) {
2315
- _context16.next = 10;
2357
+ _context17.next = 10;
2316
2358
  break;
2317
2359
  }
2318
- return _context16.abrupt("return", buildPlannerDiscountResult({
2360
+ return _context17.abrupt("return", buildPlannerDiscountResult({
2319
2361
  customerId: null,
2320
2362
  discountList: this.getDiscountList(),
2321
2363
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -2324,7 +2366,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2324
2366
  status: 'no_customer'
2325
2367
  }));
2326
2368
  case 10:
2327
- _context16.next = 12;
2369
+ _context17.next = 12;
2328
2370
  return this.loadDiscountConfig({
2329
2371
  customerId: customerId,
2330
2372
  action: 'create'
@@ -2336,7 +2378,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2336
2378
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
2337
2379
  });
2338
2380
  if (!preferredDiscount) {
2339
- _context16.next = 40;
2381
+ _context17.next = 40;
2340
2382
  break;
2341
2383
  }
2342
2384
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -2348,98 +2390,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2348
2390
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
2349
2391
  });
2350
2392
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
2351
- _context16.prev = 18;
2393
+ _context17.prev = 18;
2352
2394
  _iterator2.s();
2353
2395
  case 20:
2354
2396
  if ((_step2 = _iterator2.n()).done) {
2355
- _context16.next = 28;
2397
+ _context17.next = 28;
2356
2398
  break;
2357
2399
  }
2358
2400
  discount = _step2.value;
2359
2401
  discountId = Number(resolvePlannerDiscountId(discount));
2360
2402
  if (!Number.isFinite(discountId)) {
2361
- _context16.next = 26;
2403
+ _context17.next = 26;
2362
2404
  break;
2363
2405
  }
2364
- _context16.next = 26;
2406
+ _context17.next = 26;
2365
2407
  return this.setDiscountSelected({
2366
2408
  discountId: discountId,
2367
2409
  isSelected: false
2368
2410
  });
2369
2411
  case 26:
2370
- _context16.next = 20;
2412
+ _context17.next = 20;
2371
2413
  break;
2372
2414
  case 28:
2373
- _context16.next = 33;
2415
+ _context17.next = 33;
2374
2416
  break;
2375
2417
  case 30:
2376
- _context16.prev = 30;
2377
- _context16.t0 = _context16["catch"](18);
2378
- _iterator2.e(_context16.t0);
2418
+ _context17.prev = 30;
2419
+ _context17.t0 = _context17["catch"](18);
2420
+ _iterator2.e(_context17.t0);
2379
2421
  case 33:
2380
- _context16.prev = 33;
2422
+ _context17.prev = 33;
2381
2423
  _iterator2.f();
2382
- return _context16.finish(33);
2424
+ return _context17.finish(33);
2383
2425
  case 36:
2384
- _context16.next = 38;
2426
+ _context17.next = 38;
2385
2427
  return this.setDiscountSelected({
2386
2428
  discountId: Number(preferredId),
2387
2429
  isSelected: true
2388
2430
  });
2389
2431
  case 38:
2390
- _context16.next = 49;
2432
+ _context17.next = 49;
2391
2433
  break;
2392
2434
  case 40:
2393
2435
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
2394
- _context16.next = 46;
2436
+ _context17.next = 46;
2395
2437
  break;
2396
2438
  }
2397
2439
  if (!(params.applyBestDiscount !== false)) {
2398
- _context16.next = 44;
2440
+ _context17.next = 44;
2399
2441
  break;
2400
2442
  }
2401
- _context16.next = 44;
2443
+ _context17.next = 44;
2402
2444
  return this.bestDiscount();
2403
2445
  case 44:
2404
- _context16.next = 49;
2446
+ _context17.next = 49;
2405
2447
  break;
2406
2448
  case 46:
2407
2449
  if (!(params.applyBestDiscount !== false)) {
2408
- _context16.next = 49;
2450
+ _context17.next = 49;
2409
2451
  break;
2410
2452
  }
2411
- _context16.next = 49;
2453
+ _context17.next = 49;
2412
2454
  return this.bestDiscount();
2413
2455
  case 49:
2414
2456
  nextTempOrder = this.getTempOrder();
2415
- _context16.t1 = buildPlannerDiscountResult;
2416
- _context16.t2 = customerId;
2417
- _context16.t3 = this.getDiscountList();
2418
- _context16.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
2419
- _context16.t5 = summaryBefore;
2420
- _context16.next = 57;
2457
+ _context17.t1 = buildPlannerDiscountResult;
2458
+ _context17.t2 = customerId;
2459
+ _context17.t3 = this.getDiscountList();
2460
+ _context17.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
2461
+ _context17.t5 = summaryBefore;
2462
+ _context17.next = 57;
2421
2463
  return this.getSummary();
2422
2464
  case 57:
2423
- _context16.t6 = _context16.sent;
2424
- _context16.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
2425
- _context16.t8 = preferredDiscountId;
2426
- _context16.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
2427
- _context16.t10 = {
2428
- customerId: _context16.t2,
2429
- discountList: _context16.t3,
2430
- products: _context16.t4,
2431
- summaryBefore: _context16.t5,
2432
- summaryAfter: _context16.t6,
2433
- status: _context16.t7,
2434
- preferredDiscountId: _context16.t8,
2435
- preferredDiscountFound: _context16.t9
2465
+ _context17.t6 = _context17.sent;
2466
+ _context17.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
2467
+ _context17.t8 = preferredDiscountId;
2468
+ _context17.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
2469
+ _context17.t10 = {
2470
+ customerId: _context17.t2,
2471
+ discountList: _context17.t3,
2472
+ products: _context17.t4,
2473
+ summaryBefore: _context17.t5,
2474
+ summaryAfter: _context17.t6,
2475
+ status: _context17.t7,
2476
+ preferredDiscountId: _context17.t8,
2477
+ preferredDiscountFound: _context17.t9
2436
2478
  };
2437
- return _context16.abrupt("return", (0, _context16.t1)(_context16.t10));
2479
+ return _context17.abrupt("return", (0, _context17.t1)(_context17.t10));
2438
2480
  case 63:
2439
2481
  case "end":
2440
- return _context16.stop();
2482
+ return _context17.stop();
2441
2483
  }
2442
- }, _callee16, this, [[18, 30, 33, 36]]);
2484
+ }, _callee17, this, [[18, 30, 33, 36]]);
2443
2485
  }));
2444
2486
  function applyPlannerDiscounts() {
2445
2487
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -2474,29 +2516,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2474
2516
  }, {
2475
2517
  key: "removeExistingStagedLines",
2476
2518
  value: (function () {
2477
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(ownershipKey) {
2519
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ownershipKey) {
2478
2520
  var _this$getTempOrder;
2479
2521
  var existingLines;
2480
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2481
- while (1) switch (_context17.prev = _context17.next) {
2522
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2523
+ while (1) switch (_context18.prev = _context18.next) {
2482
2524
  case 0:
2483
2525
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
2484
2526
  var _product$metadata4;
2485
2527
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
2486
2528
  });
2487
2529
  if (!(existingLines.length > 0)) {
2488
- _context17.next = 4;
2530
+ _context18.next = 4;
2489
2531
  break;
2490
2532
  }
2491
- _context17.next = 4;
2533
+ _context18.next = 4;
2492
2534
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
2493
2535
  case 4:
2494
2536
  case "end":
2495
- return _context17.stop();
2537
+ return _context18.stop();
2496
2538
  }
2497
- }, _callee17, this);
2539
+ }, _callee18, this);
2498
2540
  }));
2499
- function removeExistingStagedLines(_x10) {
2541
+ function removeExistingStagedLines(_x11) {
2500
2542
  return _removeExistingStagedLines.apply(this, arguments);
2501
2543
  }
2502
2544
  return removeExistingStagedLines;
@@ -2504,25 +2546,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2504
2546
  }, {
2505
2547
  key: "stageProducts",
2506
2548
  value: function () {
2507
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, ownershipKey) {
2549
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, ownershipKey) {
2508
2550
  var _params$rawProducts;
2509
2551
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
2510
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2511
- while (1) switch (_context18.prev = _context18.next) {
2552
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2553
+ while (1) switch (_context19.prev = _context19.next) {
2512
2554
  case 0:
2513
2555
  productIds = params.productIds || [];
2514
2556
  if (productIds.length) {
2515
- _context18.next = 3;
2557
+ _context19.next = 3;
2516
2558
  break;
2517
2559
  }
2518
- return _context18.abrupt("return", this.getTempOrder());
2560
+ return _context19.abrupt("return", this.getTempOrder());
2519
2561
  case 3:
2520
2562
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
2521
- _context18.next = 7;
2563
+ _context19.next = 7;
2522
2564
  break;
2523
2565
  }
2524
2566
  this.unifiedProductCatalog = params.rawProducts;
2525
- _context18.next = 12;
2567
+ _context19.next = 12;
2526
2568
  break;
2527
2569
  case 7:
2528
2570
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -2533,15 +2575,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2533
2575
  return !existingIds.has(String(id));
2534
2576
  });
2535
2577
  if (!(missingIds.length || params.productLoadParams)) {
2536
- _context18.next = 12;
2578
+ _context19.next = 12;
2537
2579
  break;
2538
2580
  }
2539
- _context18.next = 12;
2581
+ _context19.next = 12;
2540
2582
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
2541
2583
  product_ids: productIds.map(Number).filter(Number.isFinite)
2542
2584
  }));
2543
2585
  case 12:
2544
- _context18.next = 14;
2586
+ _context19.next = 14;
2545
2587
  return this.removeExistingStagedLines(ownershipKey);
2546
2588
  case 14:
2547
2589
  productIdSet = new Set(productIds.map(function (id) {
@@ -2554,30 +2596,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2554
2596
  _i = 0, _arr = selectedProducts;
2555
2597
  case 17:
2556
2598
  if (!(_i < _arr.length)) {
2557
- _context18.next = 26;
2599
+ _context19.next = 26;
2558
2600
  break;
2559
2601
  }
2560
2602
  sourceProduct = _arr[_i];
2561
2603
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
2562
2604
  if (!productInput) {
2563
- _context18.next = 23;
2605
+ _context19.next = 23;
2564
2606
  break;
2565
2607
  }
2566
- _context18.next = 23;
2608
+ _context19.next = 23;
2567
2609
  return this.addProductToOrder(productInput);
2568
2610
  case 23:
2569
2611
  _i++;
2570
- _context18.next = 17;
2612
+ _context19.next = 17;
2571
2613
  break;
2572
2614
  case 26:
2573
- return _context18.abrupt("return", this.getTempOrder());
2615
+ return _context19.abrupt("return", this.getTempOrder());
2574
2616
  case 27:
2575
2617
  case "end":
2576
- return _context18.stop();
2618
+ return _context19.stop();
2577
2619
  }
2578
- }, _callee18, this);
2620
+ }, _callee19, this);
2579
2621
  }));
2580
- function stageProducts(_x11, _x12) {
2622
+ function stageProducts(_x12, _x13) {
2581
2623
  return _stageProducts.apply(this, arguments);
2582
2624
  }
2583
2625
  return stageProducts;
@@ -2589,18 +2631,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2589
2631
  }, {
2590
2632
  key: "stageRetailProducts",
2591
2633
  value: (function () {
2592
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
2593
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2594
- while (1) switch (_context19.prev = _context19.next) {
2634
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2635
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2636
+ while (1) switch (_context20.prev = _context20.next) {
2595
2637
  case 0:
2596
- return _context19.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
2638
+ return _context20.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
2597
2639
  case 1:
2598
2640
  case "end":
2599
- return _context19.stop();
2641
+ return _context20.stop();
2600
2642
  }
2601
- }, _callee19, this);
2643
+ }, _callee20, this);
2602
2644
  }));
2603
- function stageRetailProducts(_x13) {
2645
+ function stageRetailProducts(_x14) {
2604
2646
  return _stageRetailProducts.apply(this, arguments);
2605
2647
  }
2606
2648
  return stageRetailProducts;
@@ -2614,15 +2656,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2614
2656
  }, {
2615
2657
  key: "addRetailProduct",
2616
2658
  value: (function () {
2617
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2659
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2618
2660
  var _params$quantity, _ref38, _params$productId, _params$product, _params$product2;
2619
2661
  var quantity, productId, sourceProduct, products, orderProduct;
2620
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2621
- while (1) switch (_context20.prev = _context20.next) {
2662
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2663
+ while (1) switch (_context21.prev = _context21.next) {
2622
2664
  case 0:
2623
2665
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
2624
2666
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
2625
- _context20.next = 3;
2667
+ _context21.next = 3;
2626
2668
  break;
2627
2669
  }
2628
2670
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
@@ -2636,22 +2678,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2636
2678
  });
2637
2679
  }
2638
2680
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
2639
- _context20.next = 11;
2681
+ _context21.next = 11;
2640
2682
  break;
2641
2683
  }
2642
- _context20.next = 9;
2684
+ _context21.next = 9;
2643
2685
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
2644
2686
  product_ids: [Number(productId)].filter(Number.isFinite)
2645
2687
  }));
2646
2688
  case 9:
2647
- products = _context20.sent;
2689
+ products = _context21.sent;
2648
2690
  sourceProduct = products.find(function (product) {
2649
2691
  var _product$id4;
2650
2692
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
2651
2693
  });
2652
2694
  case 11:
2653
2695
  if (sourceProduct) {
2654
- _context20.next = 13;
2696
+ _context21.next = 13;
2655
2697
  break;
2656
2698
  }
2657
2699
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -2660,19 +2702,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2660
2702
  quantity: quantity
2661
2703
  }), 'unified_booking_sales_retail');
2662
2704
  if (orderProduct) {
2663
- _context20.next = 16;
2705
+ _context21.next = 16;
2664
2706
  break;
2665
2707
  }
2666
2708
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
2667
2709
  case 16:
2668
- return _context20.abrupt("return", this.addProductToOrder(orderProduct));
2710
+ return _context21.abrupt("return", this.addProductToOrder(orderProduct));
2669
2711
  case 17:
2670
2712
  case "end":
2671
- return _context20.stop();
2713
+ return _context21.stop();
2672
2714
  }
2673
- }, _callee20, this);
2715
+ }, _callee21, this);
2674
2716
  }));
2675
- function addRetailProduct(_x14) {
2717
+ function addRetailProduct(_x15) {
2676
2718
  return _addRetailProduct.apply(this, arguments);
2677
2719
  }
2678
2720
  return addRetailProduct;
@@ -2837,46 +2879,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2837
2879
  }, {
2838
2880
  key: "loadAvailabilityProducts",
2839
2881
  value: function () {
2840
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2882
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2841
2883
  var _prepare$catalogScope,
2842
2884
  _prepare$catalogScope2,
2843
2885
  _this4 = this,
2844
2886
  _prepare$resourceIds;
2845
2887
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
2846
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2847
- while (1) switch (_context21.prev = _context21.next) {
2888
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2889
+ while (1) switch (_context22.prev = _context22.next) {
2848
2890
  case 0:
2849
2891
  prepare = params.prepare, dateRange = params.dateRange;
2850
2892
  explicitProductIds = prepare.productIds || [];
2851
2893
  rawProducts = [];
2852
2894
  if (!Array.isArray(prepare.rawProducts)) {
2853
- _context21.next = 8;
2895
+ _context22.next = 8;
2854
2896
  break;
2855
2897
  }
2856
2898
  rawProducts = prepare.rawProducts;
2857
2899
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
2858
- _context21.next = 34;
2900
+ _context22.next = 34;
2859
2901
  break;
2860
2902
  case 8:
2861
2903
  if (!(explicitProductIds.length > 0)) {
2862
- _context21.next = 14;
2904
+ _context22.next = 14;
2863
2905
  break;
2864
2906
  }
2865
- _context21.next = 11;
2907
+ _context22.next = 11;
2866
2908
  return this.loadProducts({
2867
2909
  product_ids: explicitProductIds,
2868
2910
  schedule_date: dateRange.startDate
2869
2911
  });
2870
2912
  case 11:
2871
- rawProducts = _context21.sent;
2872
- _context21.next = 34;
2913
+ rawProducts = _context22.sent;
2914
+ _context22.next = 34;
2873
2915
  break;
2874
2916
  case 14:
2875
2917
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
2876
- _context21.next = 30;
2918
+ _context22.next = 30;
2877
2919
  break;
2878
2920
  }
2879
- _context21.next = 17;
2921
+ _context22.next = 17;
2880
2922
  return this.loadScheduleAvailableDate({
2881
2923
  startDate: dateRange.startDate,
2882
2924
  endDate: dateRange.endDate,
@@ -2892,44 +2934,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2892
2934
  });
2893
2935
  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)) || [])));
2894
2936
  if (!(productIds.length > 0)) {
2895
- _context21.next = 27;
2937
+ _context22.next = 27;
2896
2938
  break;
2897
2939
  }
2898
2940
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
2899
- _context21.next = 24;
2941
+ _context22.next = 24;
2900
2942
  return this.loadProducts({
2901
2943
  product_ids: productIds,
2902
2944
  schedule_date: dateRange.startDate
2903
2945
  });
2904
2946
  case 24:
2905
- rawProducts = _context21.sent;
2906
- _context21.next = 28;
2947
+ rawProducts = _context22.sent;
2948
+ _context22.next = 28;
2907
2949
  break;
2908
2950
  case 27:
2909
2951
  this.unifiedProductCatalog = [];
2910
2952
  case 28:
2911
- _context21.next = 34;
2953
+ _context22.next = 34;
2912
2954
  break;
2913
2955
  case 30:
2914
2956
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
2915
- _context21.next = 34;
2957
+ _context22.next = 34;
2916
2958
  break;
2917
2959
  }
2918
- _context21.next = 33;
2960
+ _context22.next = 33;
2919
2961
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
2920
2962
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
2921
2963
  }));
2922
2964
  case 33:
2923
- rawProducts = _context21.sent;
2965
+ rawProducts = _context22.sent;
2924
2966
  case 34:
2925
2967
  normalized = rawProducts.map(function (product) {
2926
2968
  return normalizeProductForAvailability(product, params.scheduleList, _this4.getAvailabilityRuntimeOffsetMinutes());
2927
2969
  });
2928
2970
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
2929
- _context21.next = 37;
2971
+ _context22.next = 37;
2930
2972
  break;
2931
2973
  }
2932
- return _context21.abrupt("return", normalized.filter(function (product) {
2974
+ return _context22.abrupt("return", normalized.filter(function (product) {
2933
2975
  var _product$requirementG2;
2934
2976
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
2935
2977
  var _group$resourceIds2;
@@ -2942,16 +2984,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2942
2984
  }));
2943
2985
  case 37:
2944
2986
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
2945
- return _context21.abrupt("return", productIdSet ? normalized.filter(function (product) {
2987
+ return _context22.abrupt("return", productIdSet ? normalized.filter(function (product) {
2946
2988
  return productIdSet.has(String(product.id));
2947
2989
  }) : normalized);
2948
2990
  case 39:
2949
2991
  case "end":
2950
- return _context21.stop();
2992
+ return _context22.stop();
2951
2993
  }
2952
- }, _callee21, this);
2994
+ }, _callee22, this);
2953
2995
  }));
2954
- function loadAvailabilityProducts(_x15) {
2996
+ function loadAvailabilityProducts(_x16) {
2955
2997
  return _loadAvailabilityProducts.apply(this, arguments);
2956
2998
  }
2957
2999
  return loadAvailabilityProducts;
@@ -2964,12 +3006,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2964
3006
  }, {
2965
3007
  key: "fetchAvailabilityResourcesV2",
2966
3008
  value: (function () {
2967
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
3009
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2968
3010
  var response, data;
2969
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2970
- while (1) switch (_context22.prev = _context22.next) {
3011
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3012
+ while (1) switch (_context23.prev = _context23.next) {
2971
3013
  case 0:
2972
- _context22.next = 2;
3014
+ _context23.next = 2;
2973
3015
  return this.request.get('/schedule/resource/list/v2', {
2974
3016
  start_date: params.dateRange.startDate,
2975
3017
  end_date: params.dateRange.endDate,
@@ -2979,28 +3021,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2979
3021
  useCache: false
2980
3022
  });
2981
3023
  case 2:
2982
- response = _context22.sent;
3024
+ response = _context23.sent;
2983
3025
  data = response === null || response === void 0 ? void 0 : response.data;
2984
3026
  if (!Array.isArray(data)) {
2985
- _context22.next = 6;
3027
+ _context23.next = 6;
2986
3028
  break;
2987
3029
  }
2988
- return _context22.abrupt("return", data);
3030
+ return _context23.abrupt("return", data);
2989
3031
  case 6:
2990
3032
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
2991
- _context22.next = 8;
3033
+ _context23.next = 8;
2992
3034
  break;
2993
3035
  }
2994
- return _context22.abrupt("return", data.list);
3036
+ return _context23.abrupt("return", data.list);
2995
3037
  case 8:
2996
- return _context22.abrupt("return", []);
3038
+ return _context23.abrupt("return", []);
2997
3039
  case 9:
2998
3040
  case "end":
2999
- return _context22.stop();
3041
+ return _context23.stop();
3000
3042
  }
3001
- }, _callee22, this);
3043
+ }, _callee23, this);
3002
3044
  }));
3003
- function fetchAvailabilityResourcesV2(_x16) {
3045
+ function fetchAvailabilityResourcesV2(_x17) {
3004
3046
  return _fetchAvailabilityResourcesV.apply(this, arguments);
3005
3047
  }
3006
3048
  return fetchAvailabilityResourcesV2;
@@ -3008,17 +3050,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3008
3050
  }, {
3009
3051
  key: "fetchAndPublishAvailabilityResourcesV2",
3010
3052
  value: function () {
3011
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
3053
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
3012
3054
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3013
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3014
- while (1) switch (_context23.prev = _context23.next) {
3055
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3056
+ while (1) switch (_context24.prev = _context24.next) {
3015
3057
  case 0:
3016
3058
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3017
3059
  if (!(normalizedResourceIds.length === 0)) {
3018
- _context23.next = 3;
3060
+ _context24.next = 3;
3019
3061
  break;
3020
3062
  }
3021
- return _context23.abrupt("return", []);
3063
+ return _context24.abrupt("return", []);
3022
3064
  case 3:
3023
3065
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3024
3066
  cacheParams = {
@@ -3028,7 +3070,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3028
3070
  };
3029
3071
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3030
3072
  if (!cachedRawResources) {
3031
- _context23.next = 9;
3073
+ _context24.next = 9;
3032
3074
  break;
3033
3075
  }
3034
3076
  if (params.useCacheOnHit) {
@@ -3040,23 +3082,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3040
3082
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3041
3083
  });
3042
3084
  }
3043
- return _context23.abrupt("return", cachedRawResources);
3085
+ return _context24.abrupt("return", cachedRawResources);
3044
3086
  case 9:
3045
- _context23.next = 11;
3087
+ _context24.next = 11;
3046
3088
  return this.refreshAvailabilityRemoteResourceQuery({
3047
3089
  timezone: params.timezone,
3048
3090
  dateRange: params.dateRange,
3049
3091
  resourceIds: normalizedResourceIds
3050
3092
  });
3051
3093
  case 11:
3052
- return _context23.abrupt("return", _context23.sent);
3094
+ return _context24.abrupt("return", _context24.sent);
3053
3095
  case 12:
3054
3096
  case "end":
3055
- return _context23.stop();
3097
+ return _context24.stop();
3056
3098
  }
3057
- }, _callee23, this);
3099
+ }, _callee24, this);
3058
3100
  }));
3059
- function fetchAndPublishAvailabilityResourcesV2(_x17) {
3101
+ function fetchAndPublishAvailabilityResourcesV2(_x18) {
3060
3102
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
3061
3103
  }
3062
3104
  return fetchAndPublishAvailabilityResourcesV2;
@@ -3064,17 +3106,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3064
3106
  }, {
3065
3107
  key: "refreshAvailabilityRemoteResourceQuery",
3066
3108
  value: function () {
3067
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
3109
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3068
3110
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3069
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3070
- while (1) switch (_context24.prev = _context24.next) {
3111
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3112
+ while (1) switch (_context25.prev = _context25.next) {
3071
3113
  case 0:
3072
3114
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3073
3115
  if (!(normalizedResourceIds.length === 0)) {
3074
- _context24.next = 3;
3116
+ _context25.next = 3;
3075
3117
  break;
3076
3118
  }
3077
- return _context24.abrupt("return", []);
3119
+ return _context25.abrupt("return", []);
3078
3120
  case 3:
3079
3121
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
3080
3122
  timezone: params.timezone,
@@ -3084,13 +3126,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3084
3126
  epoch = this.availabilityRemoteResourceEpoch;
3085
3127
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3086
3128
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
3087
- _context24.next = 10;
3129
+ _context25.next = 10;
3088
3130
  break;
3089
3131
  }
3090
- _context24.next = 9;
3132
+ _context25.next = 9;
3091
3133
  return existing.promise;
3092
3134
  case 9:
3093
- return _context24.abrupt("return", _context24.sent);
3135
+ return _context25.abrupt("return", _context25.sent);
3094
3136
  case 10:
3095
3137
  this.availabilityRemoteResourceQuerySequence += 1;
3096
3138
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -3102,11 +3144,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3102
3144
  epoch: epoch,
3103
3145
  promise: promise
3104
3146
  });
3105
- _context24.prev = 14;
3106
- _context24.next = 17;
3147
+ _context25.prev = 14;
3148
+ _context25.next = 17;
3107
3149
  return promise;
3108
3150
  case 17:
3109
- rawResources = _context24.sent;
3151
+ rawResources = _context25.sent;
3110
3152
  if (epoch === this.availabilityRemoteResourceEpoch) {
3111
3153
  this.availabilityRemoteOccupancyCache.publish({
3112
3154
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -3117,21 +3159,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3117
3159
  version: writeVersion
3118
3160
  });
3119
3161
  }
3120
- return _context24.abrupt("return", rawResources);
3162
+ return _context25.abrupt("return", rawResources);
3121
3163
  case 20:
3122
- _context24.prev = 20;
3164
+ _context25.prev = 20;
3123
3165
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3124
3166
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3125
3167
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
3126
3168
  }
3127
- return _context24.finish(20);
3169
+ return _context25.finish(20);
3128
3170
  case 24:
3129
3171
  case "end":
3130
- return _context24.stop();
3172
+ return _context25.stop();
3131
3173
  }
3132
- }, _callee24, this, [[14,, 20, 24]]);
3174
+ }, _callee25, this, [[14,, 20, 24]]);
3133
3175
  }));
3134
- function refreshAvailabilityRemoteResourceQuery(_x18) {
3176
+ function refreshAvailabilityRemoteResourceQuery(_x19) {
3135
3177
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
3136
3178
  }
3137
3179
  return refreshAvailabilityRemoteResourceQuery;
@@ -3139,26 +3181,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3139
3181
  }, {
3140
3182
  key: "loadAvailabilityResources",
3141
3183
  value: function () {
3142
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3184
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3143
3185
  var resourceIds, cachedRawResources, rawResources;
3144
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3145
- while (1) switch (_context25.prev = _context25.next) {
3186
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3187
+ while (1) switch (_context26.prev = _context26.next) {
3146
3188
  case 0:
3147
3189
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
3148
3190
  if (!(resourceIds.length === 0)) {
3149
- _context25.next = 3;
3191
+ _context26.next = 3;
3150
3192
  break;
3151
3193
  }
3152
- return _context25.abrupt("return", {
3194
+ return _context26.abrupt("return", {
3153
3195
  resources: [],
3154
3196
  resourceOccupancies: []
3155
3197
  });
3156
3198
  case 3:
3157
3199
  if (!Array.isArray(params.rawResources)) {
3158
- _context25.next = 5;
3200
+ _context26.next = 5;
3159
3201
  break;
3160
3202
  }
3161
- return _context25.abrupt("return", buildAvailabilityResourcesFromV2({
3203
+ return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3162
3204
  rawResources: params.rawResources,
3163
3205
  scheduleList: params.scheduleList,
3164
3206
  dateRange: params.dateRange,
@@ -3166,7 +3208,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3166
3208
  }));
3167
3209
  case 5:
3168
3210
  if (!(params.fetchPolicy === 'cache_only')) {
3169
- _context25.next = 10;
3211
+ _context26.next = 10;
3170
3212
  break;
3171
3213
  }
3172
3214
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -3175,22 +3217,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3175
3217
  dateRange: params.dateRange
3176
3218
  });
3177
3219
  if (!cachedRawResources) {
3178
- _context25.next = 9;
3220
+ _context26.next = 9;
3179
3221
  break;
3180
3222
  }
3181
- return _context25.abrupt("return", buildAvailabilityResourcesFromV2({
3223
+ return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3182
3224
  rawResources: cachedRawResources,
3183
3225
  scheduleList: params.scheduleList,
3184
3226
  dateRange: params.dateRange,
3185
3227
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
3186
3228
  }));
3187
3229
  case 9:
3188
- return _context25.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3230
+ return _context26.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3189
3231
  resources: [],
3190
3232
  resourceOccupancies: []
3191
3233
  });
3192
3234
  case 10:
3193
- _context25.next = 12;
3235
+ _context26.next = 12;
3194
3236
  return this.fetchAndPublishAvailabilityResourcesV2({
3195
3237
  timezone: params.timezone,
3196
3238
  dateRange: params.dateRange,
@@ -3198,8 +3240,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3198
3240
  useCacheOnHit: true
3199
3241
  });
3200
3242
  case 12:
3201
- rawResources = _context25.sent;
3202
- return _context25.abrupt("return", buildAvailabilityResourcesFromV2({
3243
+ rawResources = _context26.sent;
3244
+ return _context26.abrupt("return", buildAvailabilityResourcesFromV2({
3203
3245
  rawResources: rawResources,
3204
3246
  scheduleList: params.scheduleList,
3205
3247
  dateRange: params.dateRange,
@@ -3207,11 +3249,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3207
3249
  }));
3208
3250
  case 14:
3209
3251
  case "end":
3210
- return _context25.stop();
3252
+ return _context26.stop();
3211
3253
  }
3212
- }, _callee25, this);
3254
+ }, _callee26, this);
3213
3255
  }));
3214
- function loadAvailabilityResources(_x19) {
3256
+ function loadAvailabilityResources(_x20) {
3215
3257
  return _loadAvailabilityResources.apply(this, arguments);
3216
3258
  }
3217
3259
  return loadAvailabilityResources;
@@ -3442,7 +3484,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3442
3484
  }, {
3443
3485
  key: "buildAvailabilityProjectionSnapshot",
3444
3486
  value: function () {
3445
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3487
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3446
3488
  var _this7 = this;
3447
3489
  var options,
3448
3490
  normalizedPrepareParams,
@@ -3464,11 +3506,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3464
3506
  durationCandidateAnchorAt,
3465
3507
  orderRevision,
3466
3508
  projection,
3467
- _args26 = arguments;
3468
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3469
- while (1) switch (_context26.prev = _context26.next) {
3509
+ _args27 = arguments;
3510
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3511
+ while (1) switch (_context27.prev = _context27.next) {
3470
3512
  case 0:
3471
- options = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : {};
3513
+ options = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {};
3472
3514
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
3473
3515
  timezoneLabel = String(normalizedPrepareParams.timezone);
3474
3516
  dateRange = normalizedPrepareParams.dateRange;
@@ -3482,15 +3524,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3482
3524
  scheduleList: scheduleList,
3483
3525
  businessHours: businessHours
3484
3526
  });
3485
- _context26.next = 11;
3527
+ _context27.next = 11;
3486
3528
  return this.loadAvailabilityProducts({
3487
3529
  prepare: normalizedPrepareParams,
3488
3530
  dateRange: dateRange,
3489
3531
  scheduleList: scheduleList
3490
3532
  });
3491
3533
  case 11:
3492
- products = _context26.sent;
3493
- _context26.next = 14;
3534
+ products = _context27.sent;
3535
+ _context27.next = 14;
3494
3536
  return this.loadAvailabilityResources({
3495
3537
  timezone: timezoneLabel,
3496
3538
  dateRange: dateRange,
@@ -3502,7 +3544,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3502
3544
  fallbackResources: options.fallbackResources
3503
3545
  });
3504
3546
  case 14:
3505
- loadedResources = _context26.sent;
3547
+ loadedResources = _context27.sent;
3506
3548
  tempOrder = this.getTempOrder();
3507
3549
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
3508
3550
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
@@ -3548,18 +3590,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3548
3590
  prepareParams: normalizedPrepareParams,
3549
3591
  durationCandidateAnchorAt: durationCandidateAnchorAt
3550
3592
  });
3551
- return _context26.abrupt("return", {
3593
+ return _context27.abrupt("return", {
3552
3594
  projection: projection,
3553
3595
  prepareParams: normalizedPrepareParams,
3554
3596
  orderRevision: orderRevision
3555
3597
  });
3556
3598
  case 26:
3557
3599
  case "end":
3558
- return _context26.stop();
3600
+ return _context27.stop();
3559
3601
  }
3560
- }, _callee26, this);
3602
+ }, _callee27, this);
3561
3603
  }));
3562
- function buildAvailabilityProjectionSnapshot(_x20) {
3604
+ function buildAvailabilityProjectionSnapshot(_x21) {
3563
3605
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
3564
3606
  }
3565
3607
  return buildAvailabilityProjectionSnapshot;
@@ -3567,10 +3609,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3567
3609
  }, {
3568
3610
  key: "getSharedPreparedAvailabilitySnapshot",
3569
3611
  value: function () {
3570
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3612
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3571
3613
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
3572
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3573
- while (1) switch (_context27.prev = _context27.next) {
3614
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3615
+ while (1) switch (_context28.prev = _context28.next) {
3574
3616
  case 0:
3575
3617
  lifecycleGeneration = this.availabilityLifecycleGeneration;
3576
3618
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -3589,15 +3631,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3589
3631
  }
3590
3632
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
3591
3633
  if (!hasRawInputs) {
3592
- _context27.next = 11;
3634
+ _context28.next = 11;
3593
3635
  break;
3594
3636
  }
3595
- _context27.next = 7;
3637
+ _context28.next = 7;
3596
3638
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
3597
3639
  case 7:
3598
- snapshot = _context27.sent;
3640
+ snapshot = _context28.sent;
3599
3641
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
3600
- _context27.next = 10;
3642
+ _context28.next = 10;
3601
3643
  break;
3602
3644
  }
3603
3645
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -3606,7 +3648,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3606
3648
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
3607
3649
  });
3608
3650
  case 10:
3609
- return _context27.abrupt("return", {
3651
+ return _context28.abrupt("return", {
3610
3652
  prepareKey: prepareKey,
3611
3653
  snapshot: snapshot
3612
3654
  });
@@ -3620,13 +3662,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3620
3662
  promise: promise
3621
3663
  });
3622
3664
  }
3623
- _context27.prev = 14;
3624
- _context27.next = 17;
3665
+ _context28.prev = 14;
3666
+ _context28.next = 17;
3625
3667
  return promise;
3626
3668
  case 17:
3627
- _snapshot = _context27.sent;
3669
+ _snapshot = _context28.sent;
3628
3670
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
3629
- _context27.next = 20;
3671
+ _context28.next = 20;
3630
3672
  break;
3631
3673
  }
3632
3674
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -3635,24 +3677,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3635
3677
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
3636
3678
  });
3637
3679
  case 20:
3638
- return _context27.abrupt("return", {
3680
+ return _context28.abrupt("return", {
3639
3681
  prepareKey: prepareKey,
3640
3682
  snapshot: _snapshot
3641
3683
  });
3642
3684
  case 21:
3643
- _context27.prev = 21;
3685
+ _context28.prev = 21;
3644
3686
  current = this.availabilityPrepareInFlight.get(prepareKey);
3645
3687
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3646
3688
  this.availabilityPrepareInFlight.delete(prepareKey);
3647
3689
  }
3648
- return _context27.finish(21);
3690
+ return _context28.finish(21);
3649
3691
  case 25:
3650
3692
  case "end":
3651
- return _context27.stop();
3693
+ return _context28.stop();
3652
3694
  }
3653
- }, _callee27, this, [[14,, 21, 25]]);
3695
+ }, _callee28, this, [[14,, 21, 25]]);
3654
3696
  }));
3655
- function getSharedPreparedAvailabilitySnapshot(_x21) {
3697
+ function getSharedPreparedAvailabilitySnapshot(_x22) {
3656
3698
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
3657
3699
  }
3658
3700
  return getSharedPreparedAvailabilitySnapshot;
@@ -3660,49 +3702,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3660
3702
  }, {
3661
3703
  key: "refreshAvailabilityContextProjection",
3662
3704
  value: function () {
3663
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3705
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3664
3706
  var _this8 = this;
3665
3707
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
3666
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3667
- while (1) switch (_context29.prev = _context29.next) {
3708
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3709
+ while (1) switch (_context30.prev = _context30.next) {
3668
3710
  case 0:
3669
3711
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
3670
3712
  if (!existingInFlight) {
3671
- _context29.next = 5;
3713
+ _context30.next = 5;
3672
3714
  break;
3673
3715
  }
3674
- _context29.next = 4;
3716
+ _context30.next = 4;
3675
3717
  return existingInFlight;
3676
3718
  case 4:
3677
- return _context29.abrupt("return", _context29.sent);
3719
+ return _context30.abrupt("return", _context30.sent);
3678
3720
  case 5:
3679
3721
  context = this.getAvailabilityContextEntry(params.contextId);
3680
3722
  expectedVersion = context.activeVersion;
3681
3723
  expectedRefreshNonce = context.refreshNonce;
3682
3724
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
3683
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3725
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3684
3726
  var snapshot, currentContext, projectionEntry;
3685
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3686
- while (1) switch (_context28.prev = _context28.next) {
3727
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3728
+ while (1) switch (_context29.prev = _context29.next) {
3687
3729
  case 0:
3688
- _context28.next = 2;
3730
+ _context29.next = 2;
3689
3731
  return _this8.buildAvailabilityProjectionSnapshot(_this8.cloneAvailabilityPrepareParams(context.prepareParams), {
3690
3732
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
3691
3733
  });
3692
3734
  case 2:
3693
- snapshot = _context28.sent;
3735
+ snapshot = _context29.sent;
3694
3736
  currentContext = _this8.availabilityContextRegistry.get(params.contextId);
3695
3737
  if (currentContext) {
3696
- _context28.next = 6;
3738
+ _context29.next = 6;
3697
3739
  break;
3698
3740
  }
3699
- return _context28.abrupt("return", null);
3741
+ return _context29.abrupt("return", null);
3700
3742
  case 6:
3701
3743
  if (!(expectedLifecycleGeneration !== _this8.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
3702
- _context28.next = 8;
3744
+ _context29.next = 8;
3703
3745
  break;
3704
3746
  }
3705
- return _context28.abrupt("return", null);
3747
+ return _context29.abrupt("return", null);
3706
3748
  case 8:
3707
3749
  projectionEntry = _this8.storeAvailabilityProjectionEntry({
3708
3750
  contextId: currentContext.contextId,
@@ -3712,7 +3754,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3712
3754
  orderRevision: snapshot.orderRevision,
3713
3755
  incrementVersion: true
3714
3756
  });
3715
- _context28.next = 11;
3757
+ _context29.next = 11;
3716
3758
  return _this8.emitAvailabilityDiagnostic({
3717
3759
  action: 'refresh',
3718
3760
  contextId: currentContext.contextId,
@@ -3724,33 +3766,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3724
3766
  reason: params.reason
3725
3767
  });
3726
3768
  case 11:
3727
- return _context28.abrupt("return", projectionEntry);
3769
+ return _context29.abrupt("return", projectionEntry);
3728
3770
  case 12:
3729
3771
  case "end":
3730
- return _context28.stop();
3772
+ return _context29.stop();
3731
3773
  }
3732
- }, _callee28);
3774
+ }, _callee29);
3733
3775
  }))();
3734
3776
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
3735
- _context29.prev = 11;
3736
- _context29.next = 14;
3777
+ _context30.prev = 11;
3778
+ _context30.next = 14;
3737
3779
  return refreshPromise;
3738
3780
  case 14:
3739
- return _context29.abrupt("return", _context29.sent);
3781
+ return _context30.abrupt("return", _context30.sent);
3740
3782
  case 15:
3741
- _context29.prev = 15;
3783
+ _context30.prev = 15;
3742
3784
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
3743
3785
  if (current === refreshPromise) {
3744
3786
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
3745
3787
  }
3746
- return _context29.finish(15);
3788
+ return _context30.finish(15);
3747
3789
  case 19:
3748
3790
  case "end":
3749
- return _context29.stop();
3791
+ return _context30.stop();
3750
3792
  }
3751
- }, _callee29, this, [[11,, 15, 19]]);
3793
+ }, _callee30, this, [[11,, 15, 19]]);
3752
3794
  }));
3753
- function refreshAvailabilityContextProjection(_x22) {
3795
+ function refreshAvailabilityContextProjection(_x23) {
3754
3796
  return _refreshAvailabilityContextProjection.apply(this, arguments);
3755
3797
  }
3756
3798
  return refreshAvailabilityContextProjection;
@@ -3758,53 +3800,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3758
3800
  }, {
3759
3801
  key: "ensureAvailabilityContextProjection",
3760
3802
  value: function () {
3761
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(contextId, reason) {
3803
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(contextId, reason) {
3762
3804
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
3763
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3764
- while (1) switch (_context30.prev = _context30.next) {
3805
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3806
+ while (1) switch (_context31.prev = _context31.next) {
3765
3807
  case 0:
3766
3808
  retries = 0;
3767
3809
  case 1:
3768
3810
  if (!(retries < 3)) {
3769
- _context30.next = 19;
3811
+ _context31.next = 19;
3770
3812
  break;
3771
3813
  }
3772
3814
  context = this.getAvailabilityContextEntry(contextId);
3773
3815
  currentOrderRevision = this.getCurrentOrderRevision();
3774
3816
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
3775
3817
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
3776
- _context30.next = 7;
3818
+ _context31.next = 7;
3777
3819
  break;
3778
3820
  }
3779
- return _context30.abrupt("return", {
3821
+ return _context31.abrupt("return", {
3780
3822
  context: context,
3781
3823
  projectionEntry: projectionEntry,
3782
3824
  refreshed: false
3783
3825
  });
3784
3826
  case 7:
3785
- _context30.next = 9;
3827
+ _context31.next = 9;
3786
3828
  return this.refreshAvailabilityContextProjection({
3787
3829
  contextId: contextId,
3788
3830
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
3789
3831
  previousOrderRevision: context.lastKnownOrderRevision
3790
3832
  });
3791
3833
  case 9:
3792
- refreshedProjectionEntry = _context30.sent;
3834
+ refreshedProjectionEntry = _context31.sent;
3793
3835
  if (refreshedProjectionEntry) {
3794
- _context30.next = 13;
3836
+ _context31.next = 13;
3795
3837
  break;
3796
3838
  }
3797
3839
  retries += 1;
3798
- return _context30.abrupt("continue", 1);
3840
+ return _context31.abrupt("continue", 1);
3799
3841
  case 13:
3800
3842
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
3801
- _context30.next = 16;
3843
+ _context31.next = 16;
3802
3844
  break;
3803
3845
  }
3804
3846
  retries += 1;
3805
- return _context30.abrupt("continue", 1);
3847
+ return _context31.abrupt("continue", 1);
3806
3848
  case 16:
3807
- return _context30.abrupt("return", {
3849
+ return _context31.abrupt("return", {
3808
3850
  context: this.getAvailabilityContextEntry(contextId),
3809
3851
  projectionEntry: refreshedProjectionEntry,
3810
3852
  refreshed: true
@@ -3816,11 +3858,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3816
3858
  });
3817
3859
  case 20:
3818
3860
  case "end":
3819
- return _context30.stop();
3861
+ return _context31.stop();
3820
3862
  }
3821
- }, _callee30, this);
3863
+ }, _callee31, this);
3822
3864
  }));
3823
- function ensureAvailabilityContextProjection(_x23, _x24) {
3865
+ function ensureAvailabilityContextProjection(_x24, _x25) {
3824
3866
  return _ensureAvailabilityContextProjection.apply(this, arguments);
3825
3867
  }
3826
3868
  return ensureAvailabilityContextProjection;
@@ -3828,18 +3870,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3828
3870
  }, {
3829
3871
  key: "tryAcquireAvailabilityCommitLock",
3830
3872
  value: function () {
3831
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(contextId) {
3873
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(contextId) {
3832
3874
  var _currentContext$activ;
3833
3875
  var _waitingContext$activ, waitingContext, currentContext;
3834
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3835
- while (1) switch (_context31.prev = _context31.next) {
3876
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3877
+ while (1) switch (_context32.prev = _context32.next) {
3836
3878
  case 0:
3837
3879
  if (!this.availabilityCommitLocks.has(contextId)) {
3838
- _context31.next = 5;
3880
+ _context32.next = 5;
3839
3881
  break;
3840
3882
  }
3841
3883
  waitingContext = this.availabilityContextRegistry.get(contextId);
3842
- _context31.next = 4;
3884
+ _context32.next = 4;
3843
3885
  return this.emitAvailabilityDiagnostic({
3844
3886
  action: 'commit_lock_wait',
3845
3887
  contextId: contextId,
@@ -3856,7 +3898,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3856
3898
  case 5:
3857
3899
  this.availabilityCommitLocks.add(contextId);
3858
3900
  currentContext = this.availabilityContextRegistry.get(contextId);
3859
- _context31.next = 9;
3901
+ _context32.next = 9;
3860
3902
  return this.emitAvailabilityDiagnostic({
3861
3903
  action: 'commit_lock_acquired',
3862
3904
  contextId: contextId,
@@ -3868,11 +3910,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3868
3910
  });
3869
3911
  case 9:
3870
3912
  case "end":
3871
- return _context31.stop();
3913
+ return _context32.stop();
3872
3914
  }
3873
- }, _callee31, this);
3915
+ }, _callee32, this);
3874
3916
  }));
3875
- function tryAcquireAvailabilityCommitLock(_x25) {
3917
+ function tryAcquireAvailabilityCommitLock(_x26) {
3876
3918
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
3877
3919
  }
3878
3920
  return tryAcquireAvailabilityCommitLock;
@@ -3880,15 +3922,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3880
3922
  }, {
3881
3923
  key: "releaseAvailabilityCommitLock",
3882
3924
  value: function () {
3883
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(contextId) {
3925
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(contextId) {
3884
3926
  var _releasedContext$acti;
3885
3927
  var releasedContext;
3886
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3887
- while (1) switch (_context32.prev = _context32.next) {
3928
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3929
+ while (1) switch (_context33.prev = _context33.next) {
3888
3930
  case 0:
3889
3931
  this.availabilityCommitLocks.delete(contextId);
3890
3932
  releasedContext = this.availabilityContextRegistry.get(contextId);
3891
- _context32.next = 4;
3933
+ _context33.next = 4;
3892
3934
  return this.emitAvailabilityDiagnostic({
3893
3935
  action: 'commit_lock_released',
3894
3936
  contextId: contextId,
@@ -3900,11 +3942,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3900
3942
  });
3901
3943
  case 4:
3902
3944
  case "end":
3903
- return _context32.stop();
3945
+ return _context33.stop();
3904
3946
  }
3905
- }, _callee32, this);
3947
+ }, _callee33, this);
3906
3948
  }));
3907
- function releaseAvailabilityCommitLock(_x26) {
3949
+ function releaseAvailabilityCommitLock(_x27) {
3908
3950
  return _releaseAvailabilityCommitLock.apply(this, arguments);
3909
3951
  }
3910
3952
  return releaseAvailabilityCommitLock;
@@ -3912,20 +3954,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3912
3954
  }, {
3913
3955
  key: "prepareAvailabilityProjection",
3914
3956
  value: (function () {
3915
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3957
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3916
3958
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
3917
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3918
- while (1) switch (_context33.prev = _context33.next) {
3959
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3960
+ while (1) switch (_context34.prev = _context34.next) {
3919
3961
  case 0:
3920
3962
  this.assertAvailabilityPrepareParams(params);
3921
- _context33.next = 3;
3963
+ _context34.next = 3;
3922
3964
  return this.resolveAvailabilityPrepareDefaults(params);
3923
3965
  case 3:
3924
- paramsWithDefaults = _context33.sent;
3925
- _context33.next = 6;
3966
+ paramsWithDefaults = _context34.sent;
3967
+ _context34.next = 6;
3926
3968
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
3927
3969
  case 6:
3928
- _yield$this$getShared = _context33.sent;
3970
+ _yield$this$getShared = _context34.sent;
3929
3971
  prepareKey = _yield$this$getShared.prepareKey;
3930
3972
  snapshot = _yield$this$getShared.snapshot;
3931
3973
  contextId = this.createAvailabilityContextId();
@@ -3946,7 +3988,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3946
3988
  refreshed: false,
3947
3989
  reason: 'prepare'
3948
3990
  };
3949
- _context33.next = 16;
3991
+ _context34.next = 16;
3950
3992
  return this.emitAvailabilityDiagnostic({
3951
3993
  action: 'prepare',
3952
3994
  contextId: contextId,
@@ -3957,17 +3999,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3957
3999
  reason: 'prepare'
3958
4000
  });
3959
4001
  case 16:
3960
- _context33.next = 18;
4002
+ _context34.next = 18;
3961
4003
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
3962
4004
  case 18:
3963
- return _context33.abrupt("return", handle);
4005
+ return _context34.abrupt("return", handle);
3964
4006
  case 19:
3965
4007
  case "end":
3966
- return _context33.stop();
4008
+ return _context34.stop();
3967
4009
  }
3968
- }, _callee33, this);
4010
+ }, _callee34, this);
3969
4011
  }));
3970
- function prepareAvailabilityProjection(_x27) {
4012
+ function prepareAvailabilityProjection(_x28) {
3971
4013
  return _prepareAvailabilityProjection.apply(this, arguments);
3972
4014
  }
3973
4015
  return prepareAvailabilityProjection;
@@ -3975,26 +4017,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3975
4017
  }, {
3976
4018
  key: "getProductTimeRanges",
3977
4019
  value: (function () {
3978
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(contextId) {
4020
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(contextId) {
3979
4021
  var _this9 = this;
3980
4022
  var request,
3981
4023
  _yield$this$ensureAva,
3982
4024
  context,
3983
4025
  projectionEntry,
3984
4026
  contextVersion,
3985
- _args34 = arguments;
3986
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3987
- while (1) switch (_context34.prev = _context34.next) {
4027
+ _args35 = arguments;
4028
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4029
+ while (1) switch (_context35.prev = _context35.next) {
3988
4030
  case 0:
3989
- request = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {};
3990
- _context34.next = 3;
4031
+ request = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
4032
+ _context35.next = 3;
3991
4033
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
3992
4034
  case 3:
3993
- _yield$this$ensureAva = _context34.sent;
4035
+ _yield$this$ensureAva = _context35.sent;
3994
4036
  context = _yield$this$ensureAva.context;
3995
4037
  projectionEntry = _yield$this$ensureAva.projectionEntry;
3996
4038
  contextVersion = context.activeVersion;
3997
- return _context34.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, request).map(function (group) {
4039
+ return _context35.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, request).map(function (group) {
3998
4040
  return _objectSpread(_objectSpread({}, group), {}, {
3999
4041
  ranges: group.ranges.map(function (candidate) {
4000
4042
  return _this9.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
@@ -4003,11 +4045,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4003
4045
  }));
4004
4046
  case 8:
4005
4047
  case "end":
4006
- return _context34.stop();
4048
+ return _context35.stop();
4007
4049
  }
4008
- }, _callee34, this);
4050
+ }, _callee35, this);
4009
4051
  }));
4010
- function getProductTimeRanges(_x28) {
4052
+ function getProductTimeRanges(_x29) {
4011
4053
  return _getProductTimeRanges.apply(this, arguments);
4012
4054
  }
4013
4055
  return getProductTimeRanges;
@@ -4015,15 +4057,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4015
4057
  }, {
4016
4058
  key: "queryBookingAvailability",
4017
4059
  value: (function () {
4018
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(contextId, request) {
4060
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, request) {
4019
4061
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, result, contextVersion, contextualResult;
4020
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4021
- while (1) switch (_context35.prev = _context35.next) {
4062
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4063
+ while (1) switch (_context36.prev = _context36.next) {
4022
4064
  case 0:
4023
- _context35.next = 2;
4065
+ _context36.next = 2;
4024
4066
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
4025
4067
  case 2:
4026
- _yield$this$ensureAva2 = _context35.sent;
4068
+ _yield$this$ensureAva2 = _context36.sent;
4027
4069
  context = _yield$this$ensureAva2.context;
4028
4070
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
4029
4071
  refreshed = _yield$this$ensureAva2.refreshed;
@@ -4055,18 +4097,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4055
4097
  });
4056
4098
  })
4057
4099
  }) : result;
4058
- return _context35.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4100
+ return _context36.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4059
4101
  contextId: context.contextId,
4060
4102
  contextVersion: contextVersion,
4061
4103
  refreshed: refreshed
4062
4104
  }));
4063
4105
  case 11:
4064
4106
  case "end":
4065
- return _context35.stop();
4107
+ return _context36.stop();
4066
4108
  }
4067
- }, _callee35, this);
4109
+ }, _callee36, this);
4068
4110
  }));
4069
- function queryBookingAvailability(_x29, _x30) {
4111
+ function queryBookingAvailability(_x30, _x31) {
4070
4112
  return _queryBookingAvailability.apply(this, arguments);
4071
4113
  }
4072
4114
  return queryBookingAvailability;
@@ -4136,27 +4178,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4136
4178
  }, {
4137
4179
  key: "commitAvailabilitySelection",
4138
4180
  value: (function () {
4139
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, params) {
4140
- var normalizedContextId, _params$bookingCount, _ref45, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, refreshedRanges, refreshedCandidateBase, validation, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, product, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref46, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4141
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4142
- while (1) switch (_context36.prev = _context36.next) {
4181
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId, params) {
4182
+ var normalizedContextId, _params$bookingCount, _ref45, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _ref46, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref47, _ref48, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, refreshedRanges, refreshedCandidateBase, validation, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, product, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref49, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4183
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4184
+ while (1) switch (_context37.prev = _context37.next) {
4143
4185
  case 0:
4144
4186
  normalizedContextId = String(contextId || '').trim();
4145
4187
  if (normalizedContextId) {
4146
- _context36.next = 3;
4188
+ _context37.next = 3;
4147
4189
  break;
4148
4190
  }
4149
4191
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
4150
4192
  candidate: params.candidate
4151
4193
  });
4152
4194
  case 3:
4153
- _context36.next = 5;
4195
+ _context37.next = 5;
4154
4196
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
4155
4197
  case 5:
4156
- _context36.prev = 5;
4198
+ _context37.prev = 5;
4157
4199
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
4158
4200
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
4159
- _context36.next = 9;
4201
+ _context37.next = 9;
4160
4202
  break;
4161
4203
  }
4162
4204
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -4164,7 +4206,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4164
4206
  });
4165
4207
  case 9:
4166
4208
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
4167
- _context36.next = 11;
4209
+ _context37.next = 11;
4168
4210
  break;
4169
4211
  }
4170
4212
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
@@ -4173,7 +4215,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4173
4215
  case 11:
4174
4216
  orderProductQuantity = (_ref45 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref45 !== void 0 ? _ref45 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4175
4217
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
4176
- _context36.next = 14;
4218
+ _context37.next = 14;
4177
4219
  break;
4178
4220
  }
4179
4221
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -4183,22 +4225,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4183
4225
  case 14:
4184
4226
  partySize = Number(params.partySize);
4185
4227
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
4186
- _context36.next = 17;
4228
+ _context37.next = 17;
4187
4229
  break;
4188
4230
  }
4189
4231
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
4190
4232
  partySize: params.partySize
4191
4233
  });
4192
4234
  case 17:
4193
- _context36.next = 19;
4235
+ _context37.next = 19;
4194
4236
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
4195
4237
  case 19:
4196
- _yield$this$ensureAva3 = _context36.sent;
4238
+ _yield$this$ensureAva3 = _context37.sent;
4197
4239
  context = _yield$this$ensureAva3.context;
4198
4240
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
4199
4241
  refreshed = _yield$this$ensureAva3.refreshed;
4200
4242
  if (!refreshed) {
4201
- _context36.next = 25;
4243
+ _context37.next = 25;
4202
4244
  break;
4203
4245
  }
4204
4246
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4209,11 +4251,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4209
4251
  case 25:
4210
4252
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
4211
4253
  if (!(params.mode === 'edit')) {
4212
- _context36.next = 31;
4254
+ _context37.next = 31;
4213
4255
  break;
4214
4256
  }
4215
4257
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
4216
- _context36.next = 29;
4258
+ _context37.next = 29;
4217
4259
  break;
4218
4260
  }
4219
4261
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -4222,11 +4264,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4222
4264
  editingProductLineUids: boundEditingUids
4223
4265
  });
4224
4266
  case 29:
4225
- _context36.next = 33;
4267
+ _context37.next = 33;
4226
4268
  break;
4227
4269
  case 31:
4228
4270
  if (!(boundEditingUids.length > 0)) {
4229
- _context36.next = 33;
4271
+ _context37.next = 33;
4230
4272
  break;
4231
4273
  }
4232
4274
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -4235,7 +4277,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4235
4277
  });
4236
4278
  case 33:
4237
4279
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
4238
- _context36.next = 35;
4280
+ _context37.next = 35;
4239
4281
  break;
4240
4282
  }
4241
4283
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4245,7 +4287,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4245
4287
  });
4246
4288
  case 35:
4247
4289
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4248
- _context36.next = 37;
4290
+ _context37.next = 37;
4249
4291
  break;
4250
4292
  }
4251
4293
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -4256,7 +4298,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4256
4298
  });
4257
4299
  case 37:
4258
4300
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
4259
- _context36.next = 39;
4301
+ _context37.next = 39;
4260
4302
  break;
4261
4303
  }
4262
4304
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -4268,7 +4310,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4268
4310
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
4269
4311
  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;
4270
4312
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
4271
- _context36.next = 43;
4313
+ _context37.next = 43;
4272
4314
  break;
4273
4315
  }
4274
4316
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -4277,14 +4319,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4277
4319
  });
4278
4320
  case 43:
4279
4321
  if (!(params.mode === 'edit' && !params.productLineUid)) {
4280
- _context36.next = 45;
4322
+ _context37.next = 45;
4281
4323
  break;
4282
4324
  }
4283
4325
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
4284
4326
  case 45:
4285
4327
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
4286
4328
  if (!(params.mode === 'edit' && !editingLine)) {
4287
- _context36.next = 48;
4329
+ _context37.next = 48;
4288
4330
  break;
4289
4331
  }
4290
4332
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -4292,7 +4334,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4292
4334
  });
4293
4335
  case 48:
4294
4336
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
4295
- _context36.next = 50;
4337
+ _context37.next = 50;
4296
4338
  break;
4297
4339
  }
4298
4340
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -4302,7 +4344,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4302
4344
  });
4303
4345
  case 50:
4304
4346
  if (Array.isArray(params.requirementSelections)) {
4305
- _context36.next = 52;
4347
+ _context37.next = 52;
4306
4348
  break;
4307
4349
  }
4308
4350
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -4319,7 +4361,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4319
4361
  };
4320
4362
  prepareParams = baseProjection.meta.prepareParams;
4321
4363
  if (prepareParams) {
4322
- _context36.next = 57;
4364
+ _context37.next = 57;
4323
4365
  break;
4324
4366
  }
4325
4367
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -4331,7 +4373,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4331
4373
  })),
4332
4374
  includesInjectedRawOccupancies: true
4333
4375
  };
4334
- _context36.next = 60;
4376
+ _context37.next = 60;
4335
4377
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
4336
4378
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
4337
4379
  }), {
@@ -4340,13 +4382,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4340
4382
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
4341
4383
  });
4342
4384
  case 60:
4343
- commitSnapshot = _context36.sent;
4385
+ commitSnapshot = _context37.sent;
4344
4386
  refreshedProjection = commitSnapshot.projection;
4345
4387
  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 : ''))) {
4346
- _context36.next = 67;
4388
+ _context37.next = 67;
4347
4389
  break;
4348
4390
  }
4349
- _context36.next = 65;
4391
+ _context37.next = 65;
4350
4392
  return this.refreshAvailabilityContextProjection({
4351
4393
  contextId: normalizedContextId,
4352
4394
  reason: 'commit_order_revision_changed',
@@ -4378,7 +4420,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4378
4420
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
4379
4421
  });
4380
4422
  if (refreshedCandidateBase) {
4381
- _context36.next = 72;
4423
+ _context37.next = 72;
4382
4424
  break;
4383
4425
  }
4384
4426
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -4394,7 +4436,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4394
4436
  bookingCount: bookingCount
4395
4437
  });
4396
4438
  if (validation.ok) {
4397
- _context36.next = 76;
4439
+ _context37.next = 76;
4398
4440
  break;
4399
4441
  }
4400
4442
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -4417,7 +4459,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4417
4459
  incrementVersion: true
4418
4460
  });
4419
4461
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
4420
- _context36.next = 80;
4462
+ _context37.next = 80;
4421
4463
  return this.emitAvailabilityDiagnostic({
4422
4464
  action: 'refresh',
4423
4465
  contextId: normalizedContextId,
@@ -4441,7 +4483,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4441
4483
  return sameAvailabilityId(item.id, refreshedCandidate.productId);
4442
4484
  });
4443
4485
  if (product) {
4444
- _context36.next = 85;
4486
+ _context37.next = 85;
4445
4487
  break;
4446
4488
  }
4447
4489
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -4451,7 +4493,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4451
4493
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
4452
4494
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
4453
4495
  if (!(params.mode === 'edit' && !existingBookingUid)) {
4454
- _context36.next = 89;
4496
+ _context37.next = 89;
4455
4497
  break;
4456
4498
  }
4457
4499
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -4464,14 +4506,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4464
4506
  candidate: refreshedCandidate,
4465
4507
  product: product,
4466
4508
  resources: refreshedProjection.resources,
4467
- bookingUid: existingBookingUid || undefined
4509
+ bookingUid: existingBookingUid || undefined,
4510
+ holder: (_ref46 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref46 !== void 0 ? _ref46 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
4511
+ holderIds: (_ref47 = (_ref48 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref48 !== void 0 ? _ref48 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref47 !== void 0 ? _ref47 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
4468
4512
  });
4469
4513
  transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
4470
4514
  num: bookingCount,
4471
4515
  quantity: bookingCount
4472
4516
  }), 'unified_booking_sales', product);
4473
4517
  if (transformed) {
4474
- _context36.next = 94;
4518
+ _context37.next = 94;
4475
4519
  break;
4476
4520
  }
4477
4521
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -4490,7 +4534,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4490
4534
  productLineUids = [];
4491
4535
  bookingUids = [];
4492
4536
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
4493
- _context36.next = 113;
4537
+ _context37.next = 113;
4494
4538
  break;
4495
4539
  }
4496
4540
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -4500,10 +4544,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4500
4544
  unique_identification_number: params.productLineUid,
4501
4545
  booking_uid: existingBookingUid
4502
4546
  });
4503
- _context36.next = 107;
4547
+ _context37.next = 107;
4504
4548
  return this.updateOrderProduct({
4505
4549
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
4506
- product_variant_id: (_ref46 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref46 !== void 0 ? _ref46 : 0,
4550
+ product_variant_id: (_ref49 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref49 !== void 0 ? _ref49 : 0,
4507
4551
  unique_identification_number: params.productLineUid,
4508
4552
  updates: transformed,
4509
4553
  booking: booking
@@ -4513,7 +4557,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4513
4557
  bookingUid = existingBookingUid;
4514
4558
  productLineUids = [productLineUid];
4515
4559
  bookingUids = [bookingUid];
4516
- _context36.next = 125;
4560
+ _context37.next = 125;
4517
4561
  break;
4518
4562
  case 113:
4519
4563
  beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
@@ -4522,10 +4566,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4522
4566
  beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
4523
4567
  return getBookingUid(item);
4524
4568
  }).filter(Boolean));
4525
- _context36.next = 117;
4569
+ _context37.next = 117;
4526
4570
  return this.addProductToOrder(transformed, booking);
4527
4571
  case 117:
4528
- products = _context36.sent;
4572
+ products = _context37.sent;
4529
4573
  addedLines = products.filter(function (line) {
4530
4574
  var _line$product_id, _line$metadata;
4531
4575
  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));
@@ -4542,8 +4586,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4542
4586
  }).filter(Boolean);
4543
4587
  if (bookingUids.length === 0) {
4544
4588
  bookingUids = addedLines.map(function (line) {
4545
- var _ref47, _line$booking_uid, _line$metadata2;
4546
- return String((_ref47 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
4589
+ var _ref50, _line$booking_uid, _line$metadata2;
4590
+ return String((_ref50 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref50 !== void 0 ? _ref50 : '');
4547
4591
  }).filter(Boolean);
4548
4592
  }
4549
4593
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -4562,23 +4606,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4562
4606
  productLineUids: productLineUids,
4563
4607
  bookingUids: bookingUids
4564
4608
  };
4565
- _context36.next = 130;
4609
+ _context37.next = 130;
4566
4610
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
4567
4611
  case 130:
4568
- return _context36.abrupt("return", result);
4612
+ return _context37.abrupt("return", result);
4569
4613
  case 131:
4570
- _context36.prev = 131;
4571
- _context36.next = 134;
4614
+ _context37.prev = 131;
4615
+ _context37.next = 134;
4572
4616
  return this.releaseAvailabilityCommitLock(normalizedContextId);
4573
4617
  case 134:
4574
- return _context36.finish(131);
4618
+ return _context37.finish(131);
4575
4619
  case 135:
4576
4620
  case "end":
4577
- return _context36.stop();
4621
+ return _context37.stop();
4578
4622
  }
4579
- }, _callee36, this, [[5,, 131, 135]]);
4623
+ }, _callee37, this, [[5,, 131, 135]]);
4580
4624
  }));
4581
- function commitAvailabilitySelection(_x31, _x32) {
4625
+ function commitAvailabilitySelection(_x32, _x33) {
4582
4626
  return _commitAvailabilitySelection.apply(this, arguments);
4583
4627
  }
4584
4628
  return commitAvailabilitySelection;