@pisell/pisellos 2.3.205 → 2.3.207

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.
@@ -1281,6 +1281,12 @@ function buildPosForcedAvailabilityAssignments(params) {
1281
1281
  var _group$resourceIds2, _group$formId2, _candidate$primarySch7, _candidate$primarySch8;
1282
1282
  if (sameAvailabilityId(resourceId, POS_NO_RESOURCE_ID)) {
1283
1283
  var _group$formId, _candidate$primarySch5, _candidate$primarySch6;
1284
+ if (params.allowNoResource === false) {
1285
+ addConflict('resource_unavailable', '必须选择当前商品的有效资源', {
1286
+ resourceId: resourceId
1287
+ });
1288
+ return;
1289
+ }
1284
1290
  assignments.push({
1285
1291
  productId: product.id,
1286
1292
  resourceId: POS_NO_RESOURCE_ID,
@@ -1333,6 +1339,41 @@ function buildPosForcedAvailabilityAssignments(params) {
1333
1339
  conflicts: conflicts
1334
1340
  };
1335
1341
  }
1342
+
1343
+ /** Structural conversion only. The customer has already picked a time and resources in the UI. */
1344
+ function acceptCustomerSelectionSnapshot(params) {
1345
+ var _display$maxPartySize;
1346
+ var candidate = params.candidate;
1347
+ try {
1348
+ var start = localDateTimeToScalar(parseLocalDateTime(candidate.startAt));
1349
+ var end = localDateTimeToScalar(parseLocalDateTime(candidate.endAt));
1350
+ var bookingStart = localDateTimeToScalar(parseLocalDateTime(candidate.bookingStartAt));
1351
+ var bookingEnd = localDateTimeToScalar(parseLocalDateTime(candidate.bookingEndAt));
1352
+ if (end <= start || bookingEnd <= bookingStart) throw new Error('invalid interval');
1353
+ } catch (_unused5) {
1354
+ throw new AvailabilityError('INVALID_TARGET_FILTER', '所选时间必须是有效且递增的区间');
1355
+ }
1356
+ var _buildPosForcedAvaila = buildPosForcedAvailabilityAssignments(_objectSpread(_objectSpread({}, params), {}, {
1357
+ allowNoResource: false
1358
+ })),
1359
+ assignments = _buildPosForcedAvaila.assignments,
1360
+ conflicts = _buildPosForcedAvaila.conflicts;
1361
+ // Preserve the original time-card snapshot for callers; do not query current availability here.
1362
+ var display = candidate;
1363
+ var availability = _objectSpread(_objectSpread({}, candidate), {}, {
1364
+ status: display.status || 'available',
1365
+ maxPartySize: (_display$maxPartySize = display.maxPartySize) !== null && _display$maxPartySize !== void 0 ? _display$maxPartySize : params.partySize,
1366
+ reasonCodes: display.reasonCodes || [],
1367
+ requirementGroups: display.requirementGroups || []
1368
+ });
1369
+ return {
1370
+ ok: conflicts.length === 0,
1371
+ status: availability.status,
1372
+ assignments: assignments,
1373
+ conflicts: conflicts,
1374
+ availability: availability
1375
+ };
1376
+ }
1336
1377
  export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1337
1378
  _inherits(UnifiedBookingSalesImpl, _BookingTicket);
1338
1379
  var _super = _createSuper(UnifiedBookingSalesImpl);
@@ -2294,7 +2335,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2294
2335
  startAt: startAt,
2295
2336
  endAt: endAt
2296
2337
  }];
2297
- } catch (_unused5) {
2338
+ } catch (_unused6) {
2298
2339
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间必须包含有效且递增的开始和结束时间');
2299
2340
  }
2300
2341
  }));
@@ -2507,8 +2548,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2507
2548
  key: "ensureLocalOrderNumbersForCheckout",
2508
2549
  value: (function () {
2509
2550
  var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
2510
- var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2511
- var order, tempOrder, biz, idGenerator;
2551
+ var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2, _idGenerator$getConfi;
2552
+ var order, tempOrder, biz, idGenerator, useLongNumber;
2512
2553
  return _regeneratorRuntime().wrap(function _callee9$(_context10) {
2513
2554
  while (1) switch (_context10.prev = _context10.next) {
2514
2555
  case 0:
@@ -2540,56 +2581,67 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2540
2581
  throw new Error('当前订单缺少业务类型,无法生成订单编号');
2541
2582
  case 11:
2542
2583
  idGenerator = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getAp = _this$appPlugin.getApp) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp = _this$appPlugin$getAp.call(_this$appPlugin)) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp2 = _this$appPlugin$getAp.getPlugin) === null || _this$appPlugin$getAp2 === void 0 ? void 0 : _this$appPlugin$getAp2.call(_this$appPlugin$getAp, 'idGenerator');
2543
- if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
2544
- _context10.next = 14;
2584
+ useLongNumber = (idGenerator === null || idGenerator === void 0 || (_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false;
2585
+ if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && !useLongNumber && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
2586
+ _context10.next = 15;
2545
2587
  break;
2546
2588
  }
2547
2589
  throw new Error('订单编号生成器不可用,请重启应用后重试');
2548
- case 14:
2549
- _context10.prev = 14;
2590
+ case 15:
2591
+ _context10.prev = 15;
2550
2592
  if (tempOrder.shop_order_number) {
2551
- _context10.next = 19;
2593
+ _context10.next = 20;
2552
2594
  break;
2553
2595
  }
2554
- _context10.next = 18;
2596
+ _context10.next = 19;
2555
2597
  return idGenerator.generateShopOrderNumber({
2556
2598
  biz: biz
2557
2599
  });
2558
- case 18:
2559
- tempOrder.shop_order_number = _context10.sent;
2560
2600
  case 19:
2601
+ tempOrder.shop_order_number = _context10.sent;
2602
+ case 20:
2561
2603
  if (tempOrder.shop_full_order_number) {
2562
- _context10.next = 23;
2604
+ _context10.next = 29;
2563
2605
  break;
2564
2606
  }
2565
- _context10.next = 22;
2607
+ if (!useLongNumber) {
2608
+ _context10.next = 25;
2609
+ break;
2610
+ }
2611
+ _context10.t0 = tempOrder.shop_order_number;
2612
+ _context10.next = 28;
2613
+ break;
2614
+ case 25:
2615
+ _context10.next = 27;
2566
2616
  return idGenerator.generateReceiptId({
2567
2617
  biz: biz
2568
2618
  });
2569
- case 22:
2570
- tempOrder.shop_full_order_number = _context10.sent;
2571
- case 23:
2619
+ case 27:
2620
+ _context10.t0 = _context10.sent;
2621
+ case 28:
2622
+ tempOrder.shop_full_order_number = _context10.t0;
2623
+ case 29:
2572
2624
  if (!(order.getTempOrder() !== tempOrder)) {
2573
- _context10.next = 25;
2625
+ _context10.next = 31;
2574
2626
  break;
2575
2627
  }
2576
2628
  throw new Error('当前订单已切换,请重新发起支付');
2577
- case 25:
2629
+ case 31:
2578
2630
  if (!(!tempOrder.shop_order_number || !tempOrder.shop_full_order_number)) {
2579
- _context10.next = 27;
2631
+ _context10.next = 33;
2580
2632
  break;
2581
2633
  }
2582
2634
  throw new Error('订单编号生成失败,请重试');
2583
- case 27:
2584
- _context10.prev = 27;
2635
+ case 33:
2636
+ _context10.prev = 33;
2585
2637
  // 部分生成成功时也保留号码,后续只补仍然缺失的字段。
2586
2638
  if (order.getTempOrder() === tempOrder) order.persistTempOrder();
2587
- return _context10.finish(27);
2588
- case 30:
2639
+ return _context10.finish(33);
2640
+ case 36:
2589
2641
  case "end":
2590
2642
  return _context10.stop();
2591
2643
  }
2592
- }, _callee9, this, [[14,, 27, 30]]);
2644
+ }, _callee9, this, [[15,, 33, 36]]);
2593
2645
  }));
2594
2646
  function ensureLocalOrderNumbersForCheckout() {
2595
2647
  return _ensureLocalOrderNumbersForCheckout.apply(this, arguments);
@@ -7001,7 +7053,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7001
7053
  return _refreshAvailabilityContextProjection.apply(this, arguments);
7002
7054
  }
7003
7055
  return refreshAvailabilityContextProjection;
7004
- }()
7056
+ }() /** Read an existing customer selection without refreshing its clock or occupancy snapshot. */
7057
+ }, {
7058
+ key: "getCustomerSelectionProjection",
7059
+ value: function getCustomerSelectionProjection(contextId) {
7060
+ var context = this.getAvailabilityContextEntry(contextId);
7061
+ var projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
7062
+ if (!projectionEntry) throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', '所选商品上下文已关闭,请重新打开商品');
7063
+ return {
7064
+ context: context,
7065
+ projectionEntry: projectionEntry,
7066
+ refreshed: false
7067
+ };
7068
+ }
7005
7069
  }, {
7006
7070
  key: "ensureAvailabilityContextProjection",
7007
7071
  value: function () {
@@ -7286,7 +7350,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7286
7350
  startAt: normalizeEndpoint(range.startAt),
7287
7351
  endAt: normalizeEndpoint(range.endAt)
7288
7352
  }];
7289
- } catch (_unused7) {
7353
+ } catch (_unused8) {
7290
7354
  throw new AvailabilityError('INVALID_TARGET_FILTER', '手工预约范围必须包含完整有效起止日期时间');
7291
7355
  }
7292
7356
  })) : undefined; // This new editing input represents an absolute instant. Normalize it once
@@ -7300,7 +7364,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7300
7364
  var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
7301
7365
  var inputOffset = (_extractFixedOffsetMi5 = extractFixedOffsetMinutes(startAt)) !== null && _extractFixedOffsetMi5 !== void 0 ? _extractFixedOffsetMi5 : editingOffset;
7302
7366
  return [productId, formatLocalDateTime(scalar + (editingOffset - inputOffset) * 60000, editingOffset)];
7303
- } catch (_unused8) {
7367
+ } catch (_unused9) {
7304
7368
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑开始时间必须是完整有效日期时间');
7305
7369
  }
7306
7370
  })) : undefined;
@@ -7362,32 +7426,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7362
7426
  key: "queryBookingAvailability",
7363
7427
  value: (function () {
7364
7428
  var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(contextId, request) {
7365
- var _this$otherParams$pla4, _this$otherParams49, _context$prepareParam3;
7366
- var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, rememberedTimeByProductId, queryRequest, result, contextVersion, contextualResult;
7429
+ var _this$otherParams49, _this$otherParams$pla4, _this$otherParams50, _context$prepareParam3;
7430
+ var customerSelectionSnapshot, _ref67, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, rememberedTimeByProductId, queryRequest, result, contextVersion, contextualResult;
7367
7431
  return _regeneratorRuntime().wrap(function _callee67$(_context68) {
7368
7432
  while (1) switch (_context68.prev = _context68.next) {
7369
7433
  case 0:
7370
- _context68.next = 2;
7434
+ customerSelectionSnapshot = request.target === 'resource' && request.customerSelectionSnapshot === true && isCustomerUserPlatform((_this$otherParams49 = this.otherParams) === null || _this$otherParams49 === void 0 ? void 0 : _this$otherParams49.platform);
7435
+ if (!customerSelectionSnapshot) {
7436
+ _context68.next = 5;
7437
+ break;
7438
+ }
7439
+ _context68.t0 = this.getCustomerSelectionProjection(contextId);
7440
+ _context68.next = 8;
7441
+ break;
7442
+ case 5:
7443
+ _context68.next = 7;
7371
7444
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
7372
- case 2:
7373
- _yield$this$ensureAva2 = _context68.sent;
7374
- context = _yield$this$ensureAva2.context;
7375
- projectionEntry = _yield$this$ensureAva2.projectionEntry;
7376
- refreshed = _yield$this$ensureAva2.refreshed;
7445
+ case 7:
7446
+ _context68.t0 = _context68.sent;
7447
+ case 8:
7448
+ _ref67 = _context68.t0;
7449
+ context = _ref67.context;
7450
+ projectionEntry = _ref67.projectionEntry;
7451
+ refreshed = _ref67.refreshed;
7377
7452
  this.assertContextualQueryFreshness(context, request);
7378
7453
  strictAvailability = context.prepareParams.strictAvailability === true;
7379
- isPosAvailabilityRequest = String((_this$otherParams$pla4 = (_this$otherParams49 = this.otherParams) === null || _this$otherParams49 === void 0 ? void 0 : _this$otherParams49.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
7454
+ isPosAvailabilityRequest = String((_this$otherParams$pla4 = (_this$otherParams50 = this.otherParams) === null || _this$otherParams50 === void 0 ? void 0 : _this$otherParams50.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
7380
7455
  rememberedTimeByProductId = request.selectionIntent === 'remembered' ? this.resolveOrderRememberedTimes(context, projectionEntry.projection, request.rememberedTimeByProductId, request.orderSessionId) : undefined;
7381
7456
  queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
7382
7457
  dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
7383
7458
  }) : request;
7384
- result = queryAvailabilityProjection(projectionEntry.projection, queryRequest, {
7459
+ result = queryAvailabilityProjection(projectionEntry.projection, queryRequest, _objectSpread(_objectSpread({}, customerSelectionSnapshot ? {
7460
+ evaluatedAt: projectionEntry.projection.meta.now
7461
+ } : {}), {}, {
7385
7462
  useDurationTimeGrid: this.usesDurationTimeGrid(projectionEntry.projection),
7386
7463
  enforceSaleCutoff: strictAvailability || isPosAvailabilityRequest && !((_context$prepareParam3 = context.prepareParams.editingProductLineUids) !== null && _context$prepareParam3 !== void 0 && _context$prepareParam3.length) && request.selectionIntent === 'remembered',
7387
7464
  rememberedTimeByProductId: rememberedTimeByProductId,
7388
7465
  useExactDurationCandidateMinute: isPosAvailabilityRequest && !strictAvailability,
7389
7466
  allowExcludedScheduleDateOverride: isPosAvailabilityRequest && !strictAvailability
7390
- });
7467
+ }));
7391
7468
  contextVersion = context.activeVersion;
7392
7469
  contextualResult = result.target === 'time' ? _objectSpread(_objectSpread({}, result), {}, {
7393
7470
  data: result.data.map(function (group) {
@@ -7419,7 +7496,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7419
7496
  contextVersion: contextVersion,
7420
7497
  refreshed: refreshed
7421
7498
  }));
7422
- case 15:
7499
+ case 21:
7423
7500
  case "end":
7424
7501
  return _context68.stop();
7425
7502
  }
@@ -7496,9 +7573,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7496
7573
  }, {
7497
7574
  key: "findLinkedBooking",
7498
7575
  value: function findLinkedBooking(product) {
7499
- var _ref67, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
7576
+ var _ref68, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
7500
7577
  var productUid = getProductLineUid(product);
7501
- var bookingUid = String((_ref67 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref67 !== void 0 ? _ref67 : '');
7578
+ var bookingUid = String((_ref68 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref68 !== void 0 ? _ref68 : '');
7502
7579
  return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
7503
7580
  var _booking$product_uid3;
7504
7581
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
@@ -7509,14 +7586,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7509
7586
  value: function () {
7510
7587
  var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(startDate) {
7511
7588
  var _this$getTempOrder5,
7512
- _this$otherParams50,
7589
+ _this$otherParams51,
7513
7590
  _this28 = this;
7514
7591
  var products, targetDate, identities;
7515
7592
  return _regeneratorRuntime().wrap(function _callee68$(_context69) {
7516
7593
  while (1) switch (_context69.prev = _context69.next) {
7517
7594
  case 0:
7518
7595
  products = ((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || [];
7519
- if (!(((_this$otherParams50 = this.otherParams) === null || _this$otherParams50 === void 0 ? void 0 : _this$otherParams50.enforceSingleBookingStartDate) !== true)) {
7596
+ if (!(((_this$otherParams51 = this.otherParams) === null || _this$otherParams51 === void 0 ? void 0 : _this$otherParams51.enforceSingleBookingStartDate) !== true)) {
7520
7597
  _context69.next = 3;
7521
7598
  break;
7522
7599
  }
@@ -7550,7 +7627,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7550
7627
  return _removeBookingProductsOutsideStartDate.apply(this, arguments);
7551
7628
  }
7552
7629
  return removeBookingProductsOutsideStartDate;
7553
- }() /** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
7630
+ }() /** Customer snapshot writes defer availability to checkout; other callers retain cache revalidation. */
7554
7631
  }, {
7555
7632
  key: "commitAvailabilitySelection",
7556
7633
  value: (function () {
@@ -7558,13 +7635,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7558
7635
  var _this$availabilityCon,
7559
7636
  _this29 = this,
7560
7637
  _this$otherParams$pla5,
7561
- _this$otherParams51,
7638
+ _this$otherParams52,
7639
+ _this$otherParams53,
7562
7640
  _this$availabilityCon2,
7563
7641
  _params$availabilityC3,
7564
7642
  _params,
7565
7643
  _this$store$order11,
7566
7644
  _this$store$order11$e;
7567
- var normalizedContextId, calendarOrderSessionId, callerGuard, isEditingSelection, isPartyReplacement, isRememberedSelection, isOrderRememberedSelection, strictAvailability, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref68, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla6, _this$otherParams52, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla7, _this$otherParams53, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref69, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _params$orderProduct9, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, rememberedTimeByProductId, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref70, _transformed$product_4, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref71, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
7645
+ var normalizedContextId, calendarOrderSessionId, callerGuard, isEditingSelection, isPartyReplacement, isRememberedSelection, isOrderRememberedSelection, customerSelectionSnapshot, strictAvailability, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref69, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla6, _this$otherParams54, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla7, _this$otherParams55, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref71, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _params$orderProduct9, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _ref70, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, rememberedTimeByProductId, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref72, _transformed$product_4, editParams, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref73, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
7568
7646
  return _regeneratorRuntime().wrap(function _callee69$(_context70) {
7569
7647
  while (1) switch (_context70.prev = _context70.next) {
7570
7648
  case 0:
@@ -7599,14 +7677,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7599
7677
  case 9:
7600
7678
  isRememberedSelection = params.selectionIntent === 'remembered';
7601
7679
  isOrderRememberedSelection = isRememberedSelection && params.orderSessionId !== undefined;
7602
- if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams51 = this.otherParams) === null || _this$otherParams51 === void 0 ? void 0 : _this$otherParams51.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
7680
+ if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams52 = this.otherParams) === null || _this$otherParams52 === void 0 ? void 0 : _this$otherParams52.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
7603
7681
  _context70.next = 13;
7604
7682
  break;
7605
7683
  }
7606
7684
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
7607
7685
  case 13:
7686
+ customerSelectionSnapshot = params.customerSelectionSnapshot === true && isCustomerUserPlatform((_this$otherParams53 = this.otherParams) === null || _this$otherParams53 === void 0 ? void 0 : _this$otherParams53.platform);
7608
7687
  strictAvailability = ((_this$availabilityCon2 = this.availabilityContextRegistry.get(normalizedContextId)) === null || _this$availabilityCon2 === void 0 ? void 0 : _this$availabilityCon2.prepareParams.strictAvailability) === true;
7609
- hasCommitGuard = strictAvailability || isRememberedSelection || isPartyReplacement || Boolean(params.availabilityCommitGuard);
7688
+ hasCommitGuard = customerSelectionSnapshot || strictAvailability || isRememberedSelection || isPartyReplacement || Boolean(params.availabilityCommitGuard);
7610
7689
  (_params$availabilityC3 = (_params = params).availabilityCommitGuard) === null || _params$availabilityC3 === void 0 || _params$availabilityC3.call(_params);
7611
7690
  // Stabilize the locally generated sale identity before taking the guard snapshot.
7612
7691
  if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
@@ -7630,55 +7709,65 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7630
7709
  return (isOrderRememberedSelection ? _this29.isOrderSessionCurrent(params.orderSessionId) : _this29.getTempOrder() === rememberedOrder) && getRememberedCommitIdentity() === rememberedCommitIdentity;
7631
7710
  };
7632
7711
  guardedCommitPublished = false;
7633
- _context70.next = 25;
7712
+ _context70.next = 26;
7634
7713
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
7635
- case 25:
7636
- _context70.prev = 25;
7714
+ case 26:
7715
+ _context70.prev = 26;
7637
7716
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
7638
7717
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
7639
- _context70.next = 29;
7718
+ _context70.next = 30;
7640
7719
  break;
7641
7720
  }
7642
7721
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
7643
7722
  bookingCount: params.bookingCount
7644
7723
  });
7645
- case 29:
7724
+ case 30:
7646
7725
  if (!(isEditingSelection && bookingCount !== 1)) {
7647
- _context70.next = 31;
7726
+ _context70.next = 32;
7648
7727
  break;
7649
7728
  }
7650
7729
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
7651
7730
  bookingCount: bookingCount
7652
7731
  });
7653
- case 31:
7654
- orderProductQuantity = (_ref68 = (_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 && _ref68 !== void 0 ? _ref68 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
7732
+ case 32:
7733
+ orderProductQuantity = (_ref69 = (_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 && _ref69 !== void 0 ? _ref69 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
7655
7734
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
7656
- _context70.next = 34;
7735
+ _context70.next = 35;
7657
7736
  break;
7658
7737
  }
7659
7738
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
7660
7739
  bookingCount: bookingCount,
7661
7740
  orderProductQuantity: orderProductQuantity
7662
7741
  });
7663
- case 34:
7742
+ case 35:
7664
7743
  partySize = Number(params.partySize);
7665
7744
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
7666
- _context70.next = 37;
7745
+ _context70.next = 38;
7667
7746
  break;
7668
7747
  }
7669
7748
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
7670
7749
  partySize: params.partySize
7671
7750
  });
7672
- case 37:
7673
- _context70.next = 39;
7751
+ case 38:
7752
+ if (!customerSelectionSnapshot) {
7753
+ _context70.next = 42;
7754
+ break;
7755
+ }
7756
+ _context70.t0 = this.getCustomerSelectionProjection(normalizedContextId);
7757
+ _context70.next = 45;
7758
+ break;
7759
+ case 42:
7760
+ _context70.next = 44;
7674
7761
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
7675
- case 39:
7676
- _yield$this$ensureAva3 = _context70.sent;
7677
- context = _yield$this$ensureAva3.context;
7678
- projectionEntry = _yield$this$ensureAva3.projectionEntry;
7679
- refreshed = _yield$this$ensureAva3.refreshed;
7762
+ case 44:
7763
+ _context70.t0 = _context70.sent;
7764
+ case 45:
7765
+ _ref70 = _context70.t0;
7766
+ context = _ref70.context;
7767
+ projectionEntry = _ref70.projectionEntry;
7768
+ refreshed = _ref70.refreshed;
7680
7769
  if (!refreshed) {
7681
- _context70.next = 45;
7770
+ _context70.next = 51;
7682
7771
  break;
7683
7772
  }
7684
7773
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -7686,14 +7775,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7686
7775
  currentContextVersion: context.activeVersion,
7687
7776
  candidateContextVersion: params.candidate.availabilityContextVersion
7688
7777
  });
7689
- case 45:
7778
+ case 51:
7690
7779
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
7691
7780
  if (!isEditingSelection) {
7692
- _context70.next = 51;
7781
+ _context70.next = 57;
7693
7782
  break;
7694
7783
  }
7695
7784
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
7696
- _context70.next = 49;
7785
+ _context70.next = 55;
7697
7786
  break;
7698
7787
  }
7699
7788
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -7701,21 +7790,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7701
7790
  productLineUid: params.productLineUid,
7702
7791
  editingProductLineUids: boundEditingUids
7703
7792
  });
7704
- case 49:
7705
- _context70.next = 53;
7793
+ case 55:
7794
+ _context70.next = 59;
7706
7795
  break;
7707
- case 51:
7796
+ case 57:
7708
7797
  if (!(boundEditingUids.length > 0)) {
7709
- _context70.next = 53;
7798
+ _context70.next = 59;
7710
7799
  break;
7711
7800
  }
7712
7801
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
7713
7802
  contextId: normalizedContextId,
7714
7803
  editingProductLineUids: boundEditingUids
7715
7804
  });
7716
- case 53:
7805
+ case 59:
7717
7806
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
7718
- _context70.next = 55;
7807
+ _context70.next = 61;
7719
7808
  break;
7720
7809
  }
7721
7810
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -7723,9 +7812,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7723
7812
  currentContextVersion: context.activeVersion,
7724
7813
  projectionContextVersion: projectionEntry.contextVersion
7725
7814
  });
7726
- case 55:
7727
- if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
7728
- _context70.next = 57;
7815
+ case 61:
7816
+ if (!(!customerSelectionSnapshot && projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
7817
+ _context70.next = 63;
7729
7818
  break;
7730
7819
  }
7731
7820
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -7734,9 +7823,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7734
7823
  projectionOrderRevision: projectionEntry.orderRevision,
7735
7824
  currentOrderRevision: this.getCurrentOrderRevision()
7736
7825
  });
7737
- case 57:
7826
+ case 63:
7738
7827
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
7739
- _context70.next = 59;
7828
+ _context70.next = 65;
7740
7829
  break;
7741
7830
  }
7742
7831
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -7744,35 +7833,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7744
7833
  candidateContextVersion: params.candidate.availabilityContextVersion,
7745
7834
  currentContextVersion: context.activeVersion
7746
7835
  });
7747
- case 59:
7836
+ case 65:
7748
7837
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
7749
7838
  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;
7750
7839
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
7751
- _context70.next = 63;
7840
+ _context70.next = 69;
7752
7841
  break;
7753
7842
  }
7754
7843
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
7755
7844
  orderProductId: orderProductId,
7756
7845
  candidateProductId: params.candidate.productId
7757
7846
  });
7758
- case 63:
7847
+ case 69:
7759
7848
  if (!(isEditingSelection && !params.productLineUid)) {
7760
- _context70.next = 65;
7849
+ _context70.next = 71;
7761
7850
  break;
7762
7851
  }
7763
7852
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
7764
- case 65:
7853
+ case 71:
7765
7854
  editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
7766
7855
  if (!(isEditingSelection && !editingLine)) {
7767
- _context70.next = 68;
7856
+ _context70.next = 74;
7768
7857
  break;
7769
7858
  }
7770
7859
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
7771
7860
  productLineUid: params.productLineUid
7772
7861
  });
7773
- case 68:
7862
+ case 74:
7774
7863
  if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
7775
- _context70.next = 70;
7864
+ _context70.next = 76;
7776
7865
  break;
7777
7866
  }
7778
7867
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -7780,47 +7869,59 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7780
7869
  productLineProductId: (_editingLine$product_2 = editingLine.product_id) !== null && _editingLine$product_2 !== void 0 ? _editingLine$product_2 : editingLine.id,
7781
7870
  candidateProductId: params.candidate.productId
7782
7871
  });
7783
- case 70:
7872
+ case 76:
7784
7873
  if (Array.isArray(params.requirementSelections)) {
7785
- _context70.next = 72;
7874
+ _context70.next = 78;
7786
7875
  break;
7787
7876
  }
7788
7877
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
7789
7878
  requirementSelections: params.requirementSelections
7790
7879
  });
7791
- case 72:
7880
+ case 78:
7792
7881
  baseProjection = projectionEntry.projection;
7793
7882
  selectedProduct = baseProjection.products.find(function (item) {
7794
7883
  return sameAvailabilityId(item.id, params.candidate.productId);
7795
7884
  });
7796
- if (!(isRememberedSelection && (String((_this$otherParams$pla6 = (_this$otherParams52 = this.otherParams) === null || _this$otherParams52 === void 0 ? void 0 : _this$otherParams52.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
7797
- _context70.next = 76;
7885
+ if (!(isRememberedSelection && (String((_this$otherParams$pla6 = (_this$otherParams54 = this.otherParams) === null || _this$otherParams54 === void 0 ? void 0 : _this$otherParams54.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
7886
+ _context70.next = 82;
7798
7887
  break;
7799
7888
  }
7800
7889
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
7801
- case 76:
7890
+ case 82:
7802
7891
  commitWriteGuard = {
7803
7892
  contextId: normalizedContextId,
7804
7893
  expectedVersion: context.activeVersion,
7805
7894
  expectedRefreshNonce: context.refreshNonce,
7806
7895
  expectedLifecycleGeneration: this.availabilityLifecycleGeneration,
7807
- expectedOrderRevision: String((_baseProjection$meta$ = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$ !== void 0 ? _baseProjection$meta$ : '')
7896
+ expectedOrderRevision: customerSelectionSnapshot ? this.getCurrentOrderRevision() : String((_baseProjection$meta$ = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$ !== void 0 ? _baseProjection$meta$ : '')
7808
7897
  };
7809
7898
  prepareParams = baseProjection.meta.prepareParams;
7810
7899
  if (prepareParams) {
7811
- _context70.next = 80;
7900
+ _context70.next = 86;
7812
7901
  break;
7813
7902
  }
7814
7903
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
7815
- case 80:
7816
- fallbackResources = {
7904
+ case 86:
7905
+ fallbackResources = customerSelectionSnapshot ? undefined : {
7817
7906
  resources: cloneDeep(_toConsumableArray(baseProjection.resources || [])),
7818
7907
  resourceOccupancies: cloneDeep(_toConsumableArray(baseProjection.resourceOccupancies || []).filter(function (occupancy) {
7819
7908
  return occupancy.source !== 'cart';
7820
7909
  })),
7821
7910
  includesInjectedRawOccupancies: true
7822
7911
  };
7823
- _context70.next = 83;
7912
+ if (!customerSelectionSnapshot) {
7913
+ _context70.next = 91;
7914
+ break;
7915
+ }
7916
+ _context70.t1 = {
7917
+ projection: baseProjection,
7918
+ prepareParams: prepareParams,
7919
+ orderRevision: commitWriteGuard.expectedOrderRevision
7920
+ };
7921
+ _context70.next = 94;
7922
+ break;
7923
+ case 91:
7924
+ _context70.next = 93;
7824
7925
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
7825
7926
  editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
7826
7927
  }), {
@@ -7828,20 +7929,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7828
7929
  fallbackResources: fallbackResources,
7829
7930
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
7830
7931
  });
7831
- case 83:
7832
- commitSnapshot = _context70.sent;
7932
+ case 93:
7933
+ _context70.t1 = _context70.sent;
7934
+ case 94:
7935
+ commitSnapshot = _context70.t1;
7833
7936
  refreshedProjection = commitSnapshot.projection;
7834
- 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 : ''))) {
7835
- _context70.next = 90;
7937
+ if (!(!customerSelectionSnapshot && 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 : ''))) {
7938
+ _context70.next = 101;
7836
7939
  break;
7837
7940
  }
7838
- _context70.next = 88;
7941
+ _context70.next = 99;
7839
7942
  return this.refreshAvailabilityContextProjection({
7840
7943
  contextId: normalizedContextId,
7841
7944
  reason: 'commit_order_revision_changed',
7842
7945
  previousOrderRevision: String((_baseProjection$meta$3 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$3 !== void 0 ? _baseProjection$meta$3 : '')
7843
7946
  });
7844
- case 88:
7947
+ case 99:
7845
7948
  latestContext = this.getAvailabilityContextEntry(normalizedContextId);
7846
7949
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '最终缓存重校验期间购物车已变化,请重新获取候选', {
7847
7950
  contextId: normalizedContextId,
@@ -7852,17 +7955,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7852
7955
  snapshotId: baseProjection.meta.snapshotId,
7853
7956
  refreshedSnapshotId: refreshedProjection.meta.snapshotId
7854
7957
  });
7855
- case 90:
7958
+ case 101:
7856
7959
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
7857
7960
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
7858
7961
  candidateStartTime = getCandidateStartTime(params.candidate);
7859
- allowPosAvailabilityOverride = String((_this$otherParams$pla7 = (_this$otherParams53 = this.otherParams) === null || _this$otherParams53 === void 0 ? void 0 : _this$otherParams53.platform) !== null && _this$otherParams$pla7 !== void 0 ? _this$otherParams$pla7 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection && !strictAvailability;
7962
+ allowPosAvailabilityOverride = String((_this$otherParams$pla7 = (_this$otherParams55 = this.otherParams) === null || _this$otherParams55 === void 0 ? void 0 : _this$otherParams55.platform) !== null && _this$otherParams$pla7 !== void 0 ? _this$otherParams$pla7 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection && !strictAvailability;
7860
7963
  candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
7861
7964
  rememberedTimeByProductId = isOrderRememberedSelection ? this.resolveOrderRememberedTimes(context, refreshedProjection, _defineProperty({}, String(params.candidate.productId), {
7862
7965
  startAt: params.candidate.bookingStartAt,
7863
7966
  endAt: params.candidate.bookingEndAt
7864
7967
  }), params.orderSessionId) : undefined;
7865
- refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread(_objectSpread({
7968
+ refreshedRanges = customerSelectionSnapshot ? [params.candidate] : getProjectionProductTimeRanges(refreshedProjection, _objectSpread(_objectSpread({
7866
7969
  productIds: [params.candidate.productId],
7867
7970
  dateRange: {
7868
7971
  startDate: candidateBusinessDate,
@@ -7903,7 +8006,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7903
8006
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
7904
8007
  });
7905
8008
  if (refreshedCandidateBase) {
7906
- _context70.next = 100;
8009
+ _context70.next = 111;
7907
8010
  break;
7908
8011
  }
7909
8012
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -7911,19 +8014,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7911
8014
  candidate: params.candidate,
7912
8015
  refreshedSnapshotId: refreshedProjection.meta.snapshotId
7913
8016
  });
7914
- case 100:
8017
+ case 111:
7915
8018
  product = refreshedProjection.products.find(function (item) {
7916
8019
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
7917
8020
  });
7918
8021
  if (product) {
7919
- _context70.next = 103;
8022
+ _context70.next = 114;
7920
8023
  break;
7921
8024
  }
7922
8025
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
7923
8026
  productId: refreshedCandidateBase.productId
7924
8027
  });
7925
- case 103:
7926
- validation = validateAvailabilitySelection(refreshedProjection, {
8028
+ case 114:
8029
+ validation = customerSelectionSnapshot ? acceptCustomerSelectionSnapshot({
8030
+ candidate: params.candidate,
8031
+ product: product,
8032
+ resources: baseProjection.resources,
8033
+ requirementSelections: params.requirementSelections,
8034
+ partySize: partySize
8035
+ }) : validateAvailabilitySelection(refreshedProjection, {
7927
8036
  candidate: refreshedCandidateBase,
7928
8037
  requirementSelections: params.requirementSelections,
7929
8038
  partySize: partySize,
@@ -7956,7 +8065,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7956
8065
  });
7957
8066
  }
7958
8067
  if (validation.ok) {
7959
- _context70.next = 108;
8068
+ _context70.next = 119;
7960
8069
  break;
7961
8070
  }
7962
8071
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -7966,11 +8075,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7966
8075
  validation: validation,
7967
8076
  refreshedSnapshotId: refreshedProjection.meta.snapshotId
7968
8077
  });
7969
- case 108:
8078
+ case 119:
7970
8079
  // Revalidation failure must leave the caller's candidate reusable. Only publish the
7971
8080
  // refreshed projection/version after candidate and resource validation has passed;
7972
8081
  // otherwise a second Confirm from the still-open modal would incorrectly become stale.
7973
- revalidationEntry = this.storeAvailabilityProjectionEntry({
8082
+ revalidationEntry = customerSelectionSnapshot ? projectionEntry : this.storeAvailabilityProjectionEntry({
7974
8083
  contextId: normalizedContextId,
7975
8084
  prepareParams: commitSnapshot.prepareParams,
7976
8085
  prepareKey: context.prepareKey,
@@ -7979,7 +8088,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7979
8088
  incrementVersion: true
7980
8089
  });
7981
8090
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
7982
- _context70.next = 112;
8091
+ if (customerSelectionSnapshot) {
8092
+ _context70.next = 124;
8093
+ break;
8094
+ }
8095
+ _context70.next = 124;
7983
8096
  return this.emitAvailabilityDiagnostic({
7984
8097
  action: 'refresh',
7985
8098
  contextId: normalizedContextId,
@@ -7990,13 +8103,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7990
8103
  previousOrderRevision: baseProjection.meta.orderRevision,
7991
8104
  reason: 'commit_cached_occupancy_revalidation'
7992
8105
  });
7993
- case 112:
8106
+ case 124:
7994
8107
  commitWriteGuard = {
7995
8108
  contextId: normalizedContextId,
7996
8109
  expectedVersion: revalidatedContext.activeVersion,
7997
8110
  expectedRefreshNonce: revalidatedContext.refreshNonce,
7998
8111
  expectedLifecycleGeneration: this.availabilityLifecycleGeneration,
7999
- expectedOrderRevision: revalidationEntry.orderRevision
8112
+ expectedOrderRevision: customerSelectionSnapshot ? commitWriteGuard.expectedOrderRevision : revalidationEntry.orderRevision
8000
8113
  };
8001
8114
  refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase); // Order may await line/runtime setup. Its guarded transaction invokes this
8002
8115
  // again immediately before publishing, while the live cart is unchanged.
@@ -8010,7 +8123,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8010
8123
  // Same-order immutable snapshots and generated sale IDs preserve the session.
8011
8124
  // Capture the actual object Order is about to publish, not an earlier snapshot.
8012
8125
  if (isOrderRememberedSelection) rememberedOrder = _this29.getTempOrder();
8013
- if (!isRememberedSelection && !strictAvailability) return;
8126
+ if (customerSelectionSnapshot || !isRememberedSelection && !strictAvailability) return;
8014
8127
  var currentValidation = validateAvailabilitySelection(refreshedProjection, {
8015
8128
  candidate: refreshedCandidateBase,
8016
8129
  requirementSelections: params.requirementSelections,
@@ -8030,13 +8143,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8030
8143
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
8031
8144
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
8032
8145
  if (!(isEditingSelection && !existingBookingUid)) {
8033
- _context70.next = 119;
8146
+ _context70.next = 131;
8034
8147
  break;
8035
8148
  }
8036
8149
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
8037
8150
  productLineUid: params.productLineUid
8038
8151
  });
8039
- case 119:
8152
+ case 131:
8040
8153
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
8041
8154
  booking = buildBookingFromAvailabilitySelection({
8042
8155
  assignments: validation.assignments,
@@ -8045,7 +8158,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8045
8158
  resources: refreshedProjection.resources,
8046
8159
  bookingUid: existingBookingUid || undefined,
8047
8160
  holder: (_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 : params.mode === 'replace' ? undefined : (_existingBooking$hold = existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _existingBooking$hold !== void 0 ? _existingBooking$hold : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
8048
- holderIds: (_ref69 = (_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 && _ref69 !== void 0 ? _ref69 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
8161
+ holderIds: (_ref71 = (_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 && _ref71 !== void 0 ? _ref71 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
8049
8162
  });
8050
8163
  if (params.mode === 'replace') {
8051
8164
  // A different product must not inherit the previous product/resource's completed forms.
@@ -8053,7 +8166,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8053
8166
  booking.relation_forms = [];
8054
8167
  }
8055
8168
  if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
8056
- _context70.next = 130;
8169
+ _context70.next = 142;
8057
8170
  break;
8058
8171
  }
8059
8172
  // AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
@@ -8073,30 +8186,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8073
8186
  return sameAvailabilityId(selected.form_id, resource.form_id);
8074
8187
  });
8075
8188
  }))) {
8076
- _context70.next = 129;
8189
+ _context70.next = 141;
8077
8190
  break;
8078
8191
  }
8079
8192
  throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
8080
- case 129:
8193
+ case 141:
8081
8194
  Object.assign(booking, {
8082
8195
  relation_id: legacyBooking.relation_id,
8083
8196
  form_id: legacyBooking.form_id,
8084
8197
  relation_type: legacyBooking.relation_type,
8085
8198
  resources: cloneDeep(legacyResources)
8086
8199
  });
8087
- case 130:
8200
+ case 142:
8088
8201
  transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
8089
8202
  num: bookingCount,
8090
8203
  quantity: bookingCount
8091
8204
  }), 'unified_booking_sales', product);
8092
8205
  if (transformed) {
8093
- _context70.next = 133;
8206
+ _context70.next = 145;
8094
8207
  break;
8095
8208
  }
8096
8209
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
8097
8210
  orderProduct: params.orderProduct
8098
8211
  });
8099
- case 133:
8212
+ case 145:
8100
8213
  transformed.num = bookingCount;
8101
8214
  transformed.metadata = _objectSpread(_objectSpread({}, transformed.metadata || {}), {}, {
8102
8215
  unified_booking_sales: true,
@@ -8111,7 +8224,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8111
8224
  productLineUids = [];
8112
8225
  bookingUids = [];
8113
8226
  if (!(isPartyReplacement && editingLine && params.productLineUid)) {
8114
- _context70.next = 150;
8227
+ _context70.next = 162;
8115
8228
  break;
8116
8229
  }
8117
8230
  relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
@@ -8126,7 +8239,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8126
8239
  }
8127
8240
  return line;
8128
8241
  });
8129
- _context70.next = 143;
8242
+ _context70.next = 155;
8130
8243
  return this.store.order.replaceBookingProductWithRelatedRetail({
8131
8244
  productLineUid: params.productLineUid,
8132
8245
  product: transformed,
@@ -8135,17 +8248,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8135
8248
  availabilityCommitGuard: availabilityCommitGuard,
8136
8249
  availabilityCommitTargetGuard: availabilityCommitTargetGuard
8137
8250
  });
8138
- case 143:
8251
+ case 155:
8139
8252
  guardedCommitPublished = true;
8140
8253
  productLineUid = params.productLineUid;
8141
8254
  bookingUid = existingBookingUid;
8142
8255
  productLineUids = [productLineUid];
8143
8256
  bookingUids = [bookingUid];
8144
- _context70.next = 183;
8257
+ _context70.next = 202;
8145
8258
  break;
8146
- case 150:
8259
+ case 162:
8147
8260
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
8148
- _context70.next = 165;
8261
+ _context70.next = 184;
8149
8262
  break;
8150
8263
  }
8151
8264
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -8155,10 +8268,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8155
8268
  unique_identification_number: params.productLineUid,
8156
8269
  booking_uid: existingBookingUid
8157
8270
  });
8158
- _context70.next = 157;
8159
- return this.updateOrderProduct(_objectSpread(_objectSpread({
8271
+ editParams = _objectSpread(_objectSpread({
8160
8272
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
8161
- product_variant_id: (_ref70 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref70 !== void 0 ? _ref70 : 0,
8273
+ product_variant_id: (_ref72 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref72 !== void 0 ? _ref72 : 0,
8162
8274
  unique_identification_number: params.productLineUid,
8163
8275
  updates: transformed,
8164
8276
  booking: booking
@@ -8166,18 +8278,34 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8166
8278
  allow_booking_reprice: params.allowBookingReprice
8167
8279
  } : {}), params.allowBookingDiscountReapply !== undefined ? {
8168
8280
  allow_booking_discount_reapply: params.allowBookingDiscountReapply
8169
- } : {}));
8170
- case 157:
8171
- _context70.next = 159;
8281
+ } : {});
8282
+ if (!customerSelectionSnapshot) {
8283
+ _context70.next = 174;
8284
+ break;
8285
+ }
8286
+ _context70.next = 171;
8287
+ return this.updateOrderProducts([editParams], {
8288
+ beforeApply: availabilityCommitGuard,
8289
+ isCurrentOrder: availabilityCommitTargetGuard
8290
+ });
8291
+ case 171:
8292
+ guardedCommitPublished = true;
8293
+ _context70.next = 176;
8294
+ break;
8295
+ case 174:
8296
+ _context70.next = 176;
8297
+ return this.updateOrderProduct(editParams);
8298
+ case 176:
8299
+ _context70.next = 178;
8172
8300
  return this.removeBookingProductsOutsideStartDate(booking.start_date);
8173
- case 159:
8301
+ case 178:
8174
8302
  productLineUid = params.productLineUid;
8175
8303
  bookingUid = existingBookingUid;
8176
8304
  productLineUids = [productLineUid];
8177
8305
  bookingUids = [bookingUid];
8178
- _context70.next = 183;
8306
+ _context70.next = 202;
8179
8307
  break;
8180
- case 165:
8308
+ case 184:
8181
8309
  beforeProductLineUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.products) || []).map(function (line) {
8182
8310
  return getProductLineUid(line);
8183
8311
  }).filter(Boolean));
@@ -8185,27 +8313,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8185
8313
  return getBookingUid(item);
8186
8314
  }).filter(Boolean));
8187
8315
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
8188
- _context70.next = 170;
8316
+ _context70.next = 189;
8189
8317
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
8190
8318
  salesNotes: params.salesNotes
8191
8319
  } : {}), availabilityCommitGuard ? {
8192
8320
  availabilityCommitGuard: availabilityCommitGuard,
8193
8321
  availabilityCommitTargetGuard: availabilityCommitTargetGuard
8194
8322
  } : {}) : undefined);
8195
- case 170:
8323
+ case 189:
8196
8324
  products = _context70.sent;
8197
8325
  guardedCommitPublished = hasCommitGuard;
8198
8326
  // A completed add can publish before a different order becomes current.
8199
8327
  // Keep its returned lines and never clean up products on that next order.
8200
8328
  if (!(!hasCommitGuard || availabilityCommitTargetGuard())) {
8201
- _context70.next = 176;
8329
+ _context70.next = 195;
8202
8330
  break;
8203
8331
  }
8204
- _context70.next = 175;
8332
+ _context70.next = 194;
8205
8333
  return this.removeBookingProductsOutsideStartDate(booking.start_date);
8206
- case 175:
8334
+ case 194:
8207
8335
  products = _context70.sent;
8208
- case 176:
8336
+ case 195:
8209
8337
  addedLines = products.filter(function (line) {
8210
8338
  var _line$product_id, _line$metadata3;
8211
8339
  return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
@@ -8213,7 +8341,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8213
8341
  productLineUids = addedLines.map(function (line) {
8214
8342
  return getProductLineUid(line);
8215
8343
  }).filter(Boolean);
8216
- addedBookings = (((_ref71 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref71 === void 0 ? void 0 : _ref71.bookings) || []).filter(function (item) {
8344
+ addedBookings = (((_ref73 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref73 === void 0 ? void 0 : _ref73.bookings) || []).filter(function (item) {
8217
8345
  var _item$metadata;
8218
8346
  return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
8219
8347
  });
@@ -8222,13 +8350,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8222
8350
  }).filter(Boolean);
8223
8351
  if (bookingUids.length === 0) {
8224
8352
  bookingUids = addedLines.map(function (line) {
8225
- var _ref72, _line$booking_uid, _line$metadata4;
8226
- return String((_ref72 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid) !== null && _ref72 !== void 0 ? _ref72 : '');
8353
+ var _ref74, _line$booking_uid, _line$metadata4;
8354
+ return String((_ref74 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid) !== null && _ref74 !== void 0 ? _ref74 : '');
8227
8355
  }).filter(Boolean);
8228
8356
  }
8229
8357
  productLineUid = productLineUids[productLineUids.length - 1] || '';
8230
8358
  bookingUid = bookingUids[bookingUids.length - 1] || '';
8231
- case 183:
8359
+ case 202:
8232
8360
  targetStillCurrent = !hasCommitGuard || availabilityCommitTargetGuard();
8233
8361
  if (targetStillCurrent) this.invalidateAvailabilityContextsAfterCommit();else this.removeAvailabilityContext(normalizedContextId);
8234
8362
  nextContext = hasCommitGuard ? this.availabilityContextRegistry.get(normalizedContextId) : this.getAvailabilityContextEntry(normalizedContextId);
@@ -8244,7 +8372,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8244
8372
  bookingUids: bookingUids
8245
8373
  };
8246
8374
  if (!targetStillCurrent) {
8247
- _context70.next = 201;
8375
+ _context70.next = 220;
8248
8376
  break;
8249
8377
  }
8250
8378
  // A notification failure after publication must not invite a duplicate add.
@@ -8252,50 +8380,50 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8252
8380
  return _this29.core.effects.emit("".concat(_this29.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
8253
8381
  };
8254
8382
  if (!guardedCommitPublished) {
8255
- _context70.next = 199;
8383
+ _context70.next = 218;
8256
8384
  break;
8257
8385
  }
8258
- _context70.prev = 190;
8259
- _context70.next = 193;
8386
+ _context70.prev = 209;
8387
+ _context70.next = 212;
8260
8388
  return emit();
8261
- case 193:
8262
- _context70.next = 197;
8389
+ case 212:
8390
+ _context70.next = 216;
8263
8391
  break;
8264
- case 195:
8265
- _context70.prev = 195;
8266
- _context70.t0 = _context70["catch"](190);
8267
- case 197:
8268
- _context70.next = 201;
8392
+ case 214:
8393
+ _context70.prev = 214;
8394
+ _context70.t2 = _context70["catch"](209);
8395
+ case 216:
8396
+ _context70.next = 220;
8269
8397
  break;
8270
- case 199:
8271
- _context70.next = 201;
8398
+ case 218:
8399
+ _context70.next = 220;
8272
8400
  return emit();
8273
- case 201:
8401
+ case 220:
8274
8402
  return _context70.abrupt("return", result);
8275
- case 202:
8276
- _context70.prev = 202;
8403
+ case 221:
8404
+ _context70.prev = 221;
8277
8405
  release = this.releaseAvailabilityCommitLock(normalizedContextId);
8278
8406
  if (!guardedCommitPublished) {
8279
- _context70.next = 209;
8407
+ _context70.next = 228;
8280
8408
  break;
8281
8409
  }
8282
- _context70.next = 207;
8410
+ _context70.next = 226;
8283
8411
  return release.catch(function () {
8284
8412
  return undefined;
8285
8413
  });
8286
- case 207:
8287
- _context70.next = 211;
8414
+ case 226:
8415
+ _context70.next = 230;
8288
8416
  break;
8289
- case 209:
8290
- _context70.next = 211;
8417
+ case 228:
8418
+ _context70.next = 230;
8291
8419
  return release;
8292
- case 211:
8293
- return _context70.finish(202);
8294
- case 212:
8420
+ case 230:
8421
+ return _context70.finish(221);
8422
+ case 231:
8295
8423
  case "end":
8296
8424
  return _context70.stop();
8297
8425
  }
8298
- }, _callee69, this, [[25,, 202, 212], [190, 195]]);
8426
+ }, _callee69, this, [[26,, 221, 231], [209, 214]]);
8299
8427
  }));
8300
8428
  function commitAvailabilitySelection(_x56, _x57) {
8301
8429
  return _commitAvailabilitySelection.apply(this, arguments);