@pisell/pisellos 2.3.217 → 2.3.219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/types.d.ts +3 -0
  3. package/dist/modules/Order/index.js +6 -3
  4. package/dist/modules/Order/types.d.ts +1 -1
  5. package/dist/modules/Order/utils.d.ts +4 -0
  6. package/dist/modules/Order/utils.js +105 -53
  7. package/dist/solution/BookingByStep/index.d.ts +1 -1
  8. package/dist/solution/BookingTicket/index.d.ts +9 -0
  9. package/dist/solution/BookingTicket/index.js +241 -19
  10. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +78 -0
  11. package/dist/solution/BookingTicket/utils/redeemArrival.js +175 -0
  12. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -0
  13. package/dist/solution/UnifiedBookingSales/index.js +42 -46
  14. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +4 -0
  15. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +91 -14
  16. package/lib/modules/OpenData/types.d.ts +3 -0
  17. package/lib/modules/Order/index.js +4 -1
  18. package/lib/modules/Order/types.d.ts +1 -1
  19. package/lib/modules/Order/utils.d.ts +4 -0
  20. package/lib/modules/Order/utils.js +45 -1
  21. package/lib/solution/BookingByStep/index.d.ts +1 -1
  22. package/lib/solution/BookingTicket/index.d.ts +9 -0
  23. package/lib/solution/BookingTicket/index.js +121 -1
  24. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +78 -0
  25. package/lib/solution/BookingTicket/utils/redeemArrival.js +156 -0
  26. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -0
  27. package/lib/solution/UnifiedBookingSales/index.js +6 -8
  28. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +4 -0
  29. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +69 -4
  30. package/package.json +1 -1
@@ -1412,6 +1412,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1412
1412
  _defineProperty(_assertThisInitialized(_this), "availabilityProjectionRefreshInFlight", new Map());
1413
1413
  _defineProperty(_assertThisInitialized(_this), "availabilityRemoteOccupancyCache", new AvailabilityRemoteOccupancyCache(MAX_REMOTE_OCCUPANCY_RESOURCE_DATE_CELLS));
1414
1414
  _defineProperty(_assertThisInitialized(_this), "availabilitySessionResourceCache", new AvailabilitySessionResourceCache());
1415
+ _defineProperty(_assertThisInitialized(_this), "fetchAvailabilitySessionResources", function (query) {
1416
+ return _this.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
1417
+ strictResponse: true
1418
+ }));
1419
+ });
1415
1420
  _defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQueryInFlight", new Map());
1416
1421
  _defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQuerySequence", 0);
1417
1422
  _defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceEpoch", 0);
@@ -6175,11 +6180,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6175
6180
  scopeKey: "".concat(scope, ":").concat(this.buildAvailabilityRemoteResourceScopeKey(timezone)),
6176
6181
  timezoneName: timezone
6177
6182
  }, resourceQuery), {}, {
6178
- fetch: function fetch(query) {
6179
- return _this20.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
6180
- strictResponse: true
6181
- }));
6182
- }
6183
+ fetch: this.fetchAvailabilitySessionResources
6183
6184
  }));
6184
6185
  case 24:
6185
6186
  _context55.t1 = _context55.sent;
@@ -6398,7 +6399,6 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6398
6399
  key: "loadAvailabilityResources",
6399
6400
  value: function () {
6400
6401
  var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
6401
- var _this22 = this;
6402
6402
  var resourceIds, _rawResources, cachedRawResources, remoteQuery, rawResources;
6403
6403
  return _regeneratorRuntime().wrap(function _callee57$(_context58) {
6404
6404
  while (1) switch (_context58.prev = _context58.next) {
@@ -6423,11 +6423,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6423
6423
  timezoneName: params.timezone,
6424
6424
  resourceIds: resourceIds,
6425
6425
  dateRange: params.dateRange,
6426
- fetch: function fetch(query) {
6427
- return _this22.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
6428
- strictResponse: true
6429
- }));
6430
- }
6426
+ fetch: this.fetchAvailabilitySessionResources
6431
6427
  });
6432
6428
  case 6:
6433
6429
  _rawResources = _context58.sent;
@@ -6585,7 +6581,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6585
6581
  }, {
6586
6582
  key: "collectCartResourceOccupancies",
6587
6583
  value: function collectCartResourceOccupancies(tempOrder, exclusions) {
6588
- var _this23 = this;
6584
+ var _this22 = this;
6589
6585
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
6590
6586
  return bookings.flatMap(function (booking) {
6591
6587
  var _ref59, _booking$product_uid2, _booking$metadata2;
@@ -6602,7 +6598,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6602
6598
  var range = normalizeAvailabilityLocalDateTimeRange({
6603
6599
  startAt: startAt,
6604
6600
  endAt: endAt,
6605
- fixedOffsetMinutes: _this23.getAvailabilityRuntimeOffsetMinutes(),
6601
+ fixedOffsetMinutes: _this22.getAvailabilityRuntimeOffsetMinutes(),
6606
6602
  rollOverEnd: false
6607
6603
  });
6608
6604
  if (!range) return [];
@@ -6620,7 +6616,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6620
6616
  resource: resource
6621
6617
  }
6622
6618
  };
6623
- return _this23.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
6619
+ return _this22.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
6624
6620
  });
6625
6621
  });
6626
6622
  }
@@ -6687,16 +6683,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6687
6683
  }, {
6688
6684
  key: "assertContextualQueryFreshness",
6689
6685
  value: function assertContextualQueryFreshness(context, request) {
6690
- var _this24 = this;
6686
+ var _this23 = this;
6691
6687
  if (request.target === 'time') {
6692
6688
  request.candidates.forEach(function (candidate) {
6693
- _this24.assertAvailabilityCandidateFreshness(context, candidate);
6689
+ _this23.assertAvailabilityCandidateFreshness(context, candidate);
6694
6690
  });
6695
6691
  return;
6696
6692
  }
6697
6693
  if (request.target === 'resource') {
6698
6694
  request.selectedRanges.forEach(function (candidate) {
6699
- _this24.assertAvailabilityCandidateFreshness(context, candidate);
6695
+ _this23.assertAvailabilityCandidateFreshness(context, candidate);
6700
6696
  });
6701
6697
  }
6702
6698
  }
@@ -6745,7 +6741,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6745
6741
  key: "buildAvailabilityProjectionSnapshot",
6746
6742
  value: function () {
6747
6743
  var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
6748
- var _this25 = this;
6744
+ var _this24 = this;
6749
6745
  var options,
6750
6746
  normalizedPrepareParams,
6751
6747
  timezoneLabel,
@@ -6827,7 +6823,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6827
6823
  var range = normalizeAvailabilityLocalDateTimeRange({
6828
6824
  startAt: occupancy.startAt,
6829
6825
  endAt: occupancy.endAt,
6830
- fixedOffsetMinutes: _this25.getAvailabilityRuntimeOffsetMinutes(),
6826
+ fixedOffsetMinutes: _this24.getAvailabilityRuntimeOffsetMinutes(),
6831
6827
  rollOverEnd: false
6832
6828
  });
6833
6829
  if (!range) return [];
@@ -6837,7 +6833,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6837
6833
  })];
6838
6834
  });
6839
6835
  remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
6840
- return !_this25.occupancyIsExcluded(occupancy, exclusions);
6836
+ return !_this24.occupancyIsExcluded(occupancy, exclusions);
6841
6837
  });
6842
6838
  cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
6843
6839
  preparedAt = this.getAvailabilityRuntimeDateTime();
@@ -6979,7 +6975,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6979
6975
  key: "refreshAvailabilityContextProjection",
6980
6976
  value: function () {
6981
6977
  var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
6982
- var _this26 = this;
6978
+ var _this25 = this;
6983
6979
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
6984
6980
  return _regeneratorRuntime().wrap(function _callee61$(_context62) {
6985
6981
  while (1) switch (_context62.prev = _context62.next) {
@@ -7004,25 +7000,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7004
7000
  while (1) switch (_context61.prev = _context61.next) {
7005
7001
  case 0:
7006
7002
  _context61.next = 2;
7007
- return _this26.buildAvailabilityProjectionSnapshot(_this26.cloneAvailabilityPrepareParams(context.prepareParams), {
7003
+ return _this25.buildAvailabilityProjectionSnapshot(_this25.cloneAvailabilityPrepareParams(context.prepareParams), {
7008
7004
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
7009
7005
  });
7010
7006
  case 2:
7011
7007
  snapshot = _context61.sent;
7012
- currentContext = _this26.availabilityContextRegistry.get(params.contextId);
7008
+ currentContext = _this25.availabilityContextRegistry.get(params.contextId);
7013
7009
  if (currentContext) {
7014
7010
  _context61.next = 6;
7015
7011
  break;
7016
7012
  }
7017
7013
  return _context61.abrupt("return", null);
7018
7014
  case 6:
7019
- if (!(expectedLifecycleGeneration !== _this26.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
7015
+ if (!(expectedLifecycleGeneration !== _this25.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
7020
7016
  _context61.next = 8;
7021
7017
  break;
7022
7018
  }
7023
7019
  return _context61.abrupt("return", null);
7024
7020
  case 8:
7025
- projectionEntry = _this26.storeAvailabilityProjectionEntry({
7021
+ projectionEntry = _this25.storeAvailabilityProjectionEntry({
7026
7022
  contextId: currentContext.contextId,
7027
7023
  prepareParams: snapshot.prepareParams,
7028
7024
  prepareKey: currentContext.prepareKey,
@@ -7031,7 +7027,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7031
7027
  incrementVersion: true
7032
7028
  });
7033
7029
  _context61.next = 11;
7034
- return _this26.emitAvailabilityDiagnostic({
7030
+ return _this25.emitAvailabilityDiagnostic({
7035
7031
  action: 'refresh',
7036
7032
  contextId: currentContext.contextId,
7037
7033
  contextVersion: projectionEntry.contextVersion,
@@ -7310,7 +7306,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7310
7306
  _this$otherParams48,
7311
7307
  _context$prepareParam2,
7312
7308
  _extractFixedOffsetMi3,
7313
- _this27 = this;
7309
+ _this26 = this;
7314
7310
  var request,
7315
7311
  _yield$this$ensureAva,
7316
7312
  context,
@@ -7426,7 +7422,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7426
7422
  }).map(function (group) {
7427
7423
  return _objectSpread(_objectSpread({}, group), {}, {
7428
7424
  ranges: group.ranges.map(function (candidate) {
7429
- return _this27.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
7425
+ return _this26.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
7430
7426
  })
7431
7427
  });
7432
7428
  }));
@@ -7606,7 +7602,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7606
7602
  var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(startDate) {
7607
7603
  var _this$getTempOrder5,
7608
7604
  _this$otherParams50,
7609
- _this28 = this;
7605
+ _this27 = this;
7610
7606
  var products, targetDate, identities;
7611
7607
  return _regeneratorRuntime().wrap(function _callee68$(_context69) {
7612
7608
  while (1) switch (_context69.prev = _context69.next) {
@@ -7630,7 +7626,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7630
7626
  if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.product_add_schedule_time) != null) {
7631
7627
  return [];
7632
7628
  }
7633
- var booking = _this28.findLinkedBooking(product);
7629
+ var booking = _this27.findLinkedBooking(product);
7634
7630
  if (!booking || isFulfillmentTimingBooking(booking)) return [];
7635
7631
  var bookingDate = getVisibleCalendarDate(booking.start_date);
7636
7632
  return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
@@ -7652,7 +7648,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7652
7648
  value: (function () {
7653
7649
  var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(contextId, params) {
7654
7650
  var _this$availabilityCon,
7655
- _this29 = this,
7651
+ _this28 = this,
7656
7652
  _this$otherParams$pla5,
7657
7653
  _this$otherParams51,
7658
7654
  _this$availabilityCon2,
@@ -7679,7 +7675,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7679
7675
  params = _objectSpread(_objectSpread({}, params), {}, {
7680
7676
  availabilityCommitGuard: function availabilityCommitGuard() {
7681
7677
  callerGuard === null || callerGuard === void 0 || callerGuard();
7682
- if (!_this29.isOrderSessionCurrent(calendarOrderSessionId)) {
7678
+ if (!_this28.isOrderSessionCurrent(calendarOrderSessionId)) {
7683
7679
  throw new AvailabilityError('AVAILABILITY_SELECTION_STALE', 'Calendar booking order session changed.');
7684
7680
  }
7685
7681
  }
@@ -7710,21 +7706,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
7710
7706
  if (isOrderRememberedSelection) this.assertRememberedOrderSession(params.orderSessionId);
7711
7707
  rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
7712
7708
  getRememberedCommitIdentity = function getRememberedCommitIdentity() {
7713
- var _this29$otherParams$s, _this29$otherParams, _this29$otherParams2, _this29$core, _this29$getTempOrder, _this29$getTempOrder2;
7709
+ var _this28$otherParams$s, _this28$otherParams, _this28$otherParams2, _this28$core, _this28$getTempOrder, _this28$getTempOrder2;
7714
7710
  return JSON.stringify(stableValue(_objectSpread({
7715
- scope: _this29.getAvailabilityScopeDescriptor(),
7716
- shopId: (_this29$otherParams$s = (_this29$otherParams = _this29.otherParams) === null || _this29$otherParams === void 0 ? void 0 : _this29$otherParams.shop_id) !== null && _this29$otherParams$s !== void 0 ? _this29$otherParams$s : (_this29$otherParams2 = _this29.otherParams) === null || _this29$otherParams2 === void 0 ? void 0 : _this29$otherParams2.shopId,
7717
- contextShopId: (_this29$core = _this29.core) === null || _this29$core === void 0 || (_this29$core = _this29$core.context) === null || _this29$core === void 0 ? void 0 : _this29$core.shop_id
7711
+ scope: _this28.getAvailabilityScopeDescriptor(),
7712
+ shopId: (_this28$otherParams$s = (_this28$otherParams = _this28.otherParams) === null || _this28$otherParams === void 0 ? void 0 : _this28$otherParams.shop_id) !== null && _this28$otherParams$s !== void 0 ? _this28$otherParams$s : (_this28$otherParams2 = _this28.otherParams) === null || _this28$otherParams2 === void 0 ? void 0 : _this28$otherParams2.shopId,
7713
+ contextShopId: (_this28$core = _this28.core) === null || _this28$core === void 0 || (_this28$core = _this28$core.context) === null || _this28$core === void 0 ? void 0 : _this28$core.shop_id
7718
7714
  }, isOrderRememberedSelection ? {
7719
- orderSessionId: _this29.getOrderSessionId()
7715
+ orderSessionId: _this28.getOrderSessionId()
7720
7716
  } : {
7721
- orderId: (_this29$getTempOrder = _this29.getTempOrder()) === null || _this29$getTempOrder === void 0 ? void 0 : _this29$getTempOrder.order_id,
7722
- externalSaleNumber: (_this29$getTempOrder2 = _this29.getTempOrder()) === null || _this29$getTempOrder2 === void 0 ? void 0 : _this29$getTempOrder2.external_sale_number
7717
+ orderId: (_this28$getTempOrder = _this28.getTempOrder()) === null || _this28$getTempOrder === void 0 ? void 0 : _this28$getTempOrder.order_id,
7718
+ externalSaleNumber: (_this28$getTempOrder2 = _this28.getTempOrder()) === null || _this28$getTempOrder2 === void 0 ? void 0 : _this28$getTempOrder2.external_sale_number
7723
7719
  })));
7724
7720
  };
7725
7721
  rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
7726
7722
  availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
7727
- return (isOrderRememberedSelection ? _this29.isOrderSessionCurrent(params.orderSessionId) : _this29.getTempOrder() === rememberedOrder) && getRememberedCommitIdentity() === rememberedCommitIdentity;
7723
+ return (isOrderRememberedSelection ? _this28.isOrderSessionCurrent(params.orderSessionId) : _this28.getTempOrder() === rememberedOrder) && getRememberedCommitIdentity() === rememberedCommitIdentity;
7728
7724
  };
7729
7725
  guardedCommitPublished = false;
7730
7726
  _context70.next = 26;
@@ -8134,13 +8130,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8134
8130
  availabilityCommitGuard = hasCommitGuard ? function () {
8135
8131
  var _params$availabilityC4, _params2;
8136
8132
  (_params$availabilityC4 = (_params2 = params).availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(_params2);
8137
- _this29.assertAvailabilityCommitWriteCAS(commitWriteGuard);
8133
+ _this28.assertAvailabilityCommitWriteCAS(commitWriteGuard);
8138
8134
  if (!availabilityCommitTargetGuard()) {
8139
- throw _this29.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
8135
+ throw _this28.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
8140
8136
  }
8141
8137
  // Same-order immutable snapshots and generated sale IDs preserve the session.
8142
8138
  // Capture the actual object Order is about to publish, not an earlier snapshot.
8143
- if (isOrderRememberedSelection) rememberedOrder = _this29.getTempOrder();
8139
+ if (isOrderRememberedSelection) rememberedOrder = _this28.getTempOrder();
8144
8140
  if (customerSelectionSnapshot || !isRememberedSelection && !strictAvailability) return;
8145
8141
  var currentValidation = validateAvailabilitySelection(refreshedProjection, {
8146
8142
  candidate: refreshedCandidateBase,
@@ -8148,7 +8144,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8148
8144
  partySize: partySize,
8149
8145
  bookingCount: bookingCount
8150
8146
  }, {
8151
- useDurationTimeGrid: _this29.usesDurationTimeGrid(refreshedProjection),
8147
+ useDurationTimeGrid: _this28.usesDurationTimeGrid(refreshedProjection),
8152
8148
  enforceSaleCutoff: true,
8153
8149
  rememberedTimeByProductId: rememberedTimeByProductId
8154
8150
  });
@@ -8246,7 +8242,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8246
8242
  break;
8247
8243
  }
8248
8244
  relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
8249
- var line = _this29.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
8245
+ var line = _this28.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
8250
8246
  if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
8251
8247
  // This is the only replacement-specific UID restore. Order checks ownership/collisions.
8252
8248
  var sourceUid = getProductLineUid(source);
@@ -8395,7 +8391,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
8395
8391
  }
8396
8392
  // A notification failure after publication must not invite a duplicate add.
8397
8393
  emit = function emit() {
8398
- return _this29.core.effects.emit("".concat(_this29.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
8394
+ return _this28.core.effects.emit("".concat(_this28.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
8399
8395
  };
8400
8396
  if (!guardedCommitPublished) {
8401
8397
  _context70.next = 218;
@@ -21,7 +21,11 @@ export declare class AvailabilitySessionResourceCache {
21
21
  private readonly cells;
22
22
  private readonly pending;
23
23
  private generation;
24
+ private queuedBatches;
25
+ private batchFlushScheduled;
24
26
  clear(): void;
27
+ private enqueueFetch;
28
+ private flushFetchBatches;
25
29
  load(params: AvailabilitySessionResourceLoadParams): Promise<RawResource[]>;
26
30
  }
27
31
  export {};
@@ -1,11 +1,11 @@
1
1
  var _excluded = ["event_list"];
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
8
6
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
11
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -15,6 +15,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
16
  import { cloneDeep } from 'lodash-es';
17
17
  import { dateOrdinalFromLocalDate, formatLocalDate, localDateTimeToScalar, localDateToScalarStart, nextDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
18
+ function sessionChangedError() {
19
+ return Object.assign(new Error('Resource session changed while loading. Please prepare again.'), {
20
+ code: 'AVAILABILITY_CONTEXT_NOT_FOUND'
21
+ });
22
+ }
18
23
  function datesInRange(range) {
19
24
  var count = dateOrdinalFromLocalDate(range.endDate) - dateOrdinalFromLocalDate(range.startDate) + 1;
20
25
  // A legal 90-business-day projection may include its preceding opening and overnight tail.
@@ -81,6 +86,8 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
81
86
  _defineProperty(this, "cells", new Map());
82
87
  _defineProperty(this, "pending", new Map());
83
88
  _defineProperty(this, "generation", 0);
89
+ _defineProperty(this, "queuedBatches", []);
90
+ _defineProperty(this, "batchFlushScheduled", false);
84
91
  }
85
92
  _createClass(AvailabilitySessionResourceCache, [{
86
93
  key: "clear",
@@ -88,22 +95,92 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
88
95
  this.generation += 1;
89
96
  this.cells.clear();
90
97
  this.pending.clear();
98
+ // A queued request has not reached the transport yet. Settle its waiters
99
+ // now, rather than leaving them pending or dispatching it in the new scope.
100
+ var queued = this.queuedBatches;
101
+ this.queuedBatches = [];
102
+ queued.forEach(function (batch) {
103
+ return batch.reject(sessionChangedError());
104
+ });
105
+ }
106
+ }, {
107
+ key: "enqueueFetch",
108
+ value: function enqueueFetch(params, query, generation) {
109
+ var _this = this;
110
+ var batch = this.queuedBatches.find(function (entry) {
111
+ return entry.generation === generation && entry.scopeKey === params.scopeKey && entry.timezoneName === params.timezoneName && entry.fetch === params.fetch && entry.dateRange.startDate === query.dateRange.startDate && entry.dateRange.endDate === query.dateRange.endDate;
112
+ });
113
+ if (!batch) {
114
+ var resolve;
115
+ var reject;
116
+ var promise = new Promise(function (resolvePromise, rejectPromise) {
117
+ resolve = resolvePromise;
118
+ reject = rejectPromise;
119
+ });
120
+ batch = {
121
+ generation: generation,
122
+ scopeKey: params.scopeKey,
123
+ timezoneName: params.timezoneName,
124
+ dateRange: _objectSpread({}, query.dateRange),
125
+ fetch: params.fetch,
126
+ resourceIds: new Map(),
127
+ promise: promise,
128
+ resolve: resolve,
129
+ reject: reject
130
+ };
131
+ this.queuedBatches.push(batch);
132
+ }
133
+ query.resourceIds.forEach(function (id) {
134
+ return batch.resourceIds.set(String(id), id);
135
+ });
136
+ if (!this.batchFlushScheduled) {
137
+ this.batchFlushScheduled = true;
138
+ // Fetching was already asynchronous. Collect requests from this turn only;
139
+ // do not add a timer or broaden their physical date coverage.
140
+ void Promise.resolve().then(function () {
141
+ return _this.flushFetchBatches();
142
+ });
143
+ }
144
+ return batch.promise;
145
+ }
146
+ }, {
147
+ key: "flushFetchBatches",
148
+ value: function flushFetchBatches() {
149
+ var _this2 = this;
150
+ this.batchFlushScheduled = false;
151
+ var queued = this.queuedBatches;
152
+ this.queuedBatches = [];
153
+ queued.forEach(function (batch) {
154
+ if (batch.generation !== _this2.generation) {
155
+ batch.reject(sessionChangedError());
156
+ return;
157
+ }
158
+ var query = {
159
+ resourceIds: Array.from(batch.resourceIds.values()).sort(function (left, right) {
160
+ return String(left).localeCompare(String(right));
161
+ }),
162
+ dateRange: _objectSpread({}, batch.dateRange)
163
+ };
164
+ try {
165
+ Promise.resolve(batch.fetch(cloneDeep(query))).then(batch.resolve, batch.reject);
166
+ } catch (error) {
167
+ batch.reject(error);
168
+ }
169
+ });
91
170
  }
92
171
  }, {
93
172
  key: "load",
94
173
  value: function () {
95
174
  var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
96
- var _this = this;
175
+ var _this3 = this;
97
176
  var generation, assertCurrent, resources, dates, key, waits, gaps, previousIds, result;
98
177
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
99
178
  while (1) switch (_context2.prev = _context2.next) {
100
179
  case 0:
101
180
  generation = this.generation;
102
181
  assertCurrent = function assertCurrent() {
103
- if (generation !== _this.generation) {
104
- throw Object.assign(new Error('Resource session changed while loading. Please prepare again.'), {
105
- code: 'AVAILABILITY_CONTEXT_NOT_FOUND'
106
- });
182
+ if (generation !== _this3.generation) {
183
+ throw sessionChangedError();
107
184
  }
108
185
  };
109
186
  resources = Array.from(new Map(params.resourceIds.filter(function (id) {
@@ -121,8 +198,8 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
121
198
  dates.forEach(function (date) {
122
199
  var missing = resources.filter(function (resourceId) {
123
200
  var cellKey = key(resourceId, date);
124
- if (_this.cells.has(cellKey)) return false;
125
- var pending = _this.pending.get(cellKey);
201
+ if (_this3.cells.has(cellKey)) return false;
202
+ var pending = _this3.pending.get(cellKey);
126
203
  if (pending) {
127
204
  waits.add(pending);
128
205
  return false;
@@ -163,7 +240,7 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
163
240
  case 0:
164
241
  assertCurrent();
165
242
  _context.next = 3;
166
- return params.fetch(cloneDeep(query));
243
+ return _this3.enqueueFetch(params, query, generation);
167
244
  case 3:
168
245
  response = _context.sent;
169
246
  assertCurrent();
@@ -204,7 +281,7 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
204
281
  });
205
282
  assertCurrent();
206
283
  updates.forEach(function (cell, cellKey) {
207
- if (!_this.cells.has(cellKey)) _this.cells.set(cellKey, cell);
284
+ if (!_this3.cells.has(cellKey)) _this3.cells.set(cellKey, cell);
208
285
  });
209
286
  case 13:
210
287
  case "end":
@@ -213,11 +290,11 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
213
290
  }, _callee);
214
291
  }))).finally(function () {
215
292
  cellKeys.forEach(function (cellKey) {
216
- if (_this.pending.get(cellKey) === promise) _this.pending.delete(cellKey);
293
+ if (_this3.pending.get(cellKey) === promise) _this3.pending.delete(cellKey);
217
294
  });
218
295
  });
219
296
  cellKeys.forEach(function (cellKey) {
220
- return _this.pending.set(cellKey, promise);
297
+ return _this3.pending.set(cellKey, promise);
221
298
  });
222
299
  waits.add(promise);
223
300
  });
@@ -230,7 +307,7 @@ export var AvailabilitySessionResourceCache = /*#__PURE__*/function () {
230
307
  var metadata = null;
231
308
  var events = new Map();
232
309
  dates.forEach(function (date) {
233
- var cell = _this.cells.get(key(id, date));
310
+ var cell = _this3.cells.get(key(id, date));
234
311
  if (!cell) throw new Error('Resource session coverage was lost. Please prepare again.');
235
312
  if (!metadata && cell.resource) metadata = cell.resource;
236
313
  var occurrences = new Map();
@@ -106,6 +106,9 @@ export interface OpenDataConfig {
106
106
  'sale.short_number_prefix'?: string | null;
107
107
  'sale.sale_number_prefix'?: string | null;
108
108
  'sale.enabled_item_rules'?: number[];
109
+ 'fulfillment.enable_adjust_session_on_arrival'?: boolean | 0 | 1;
110
+ 'fulfillment.max_earlier_shift_minutes'?: number | string;
111
+ 'fulfillment.max_later_shift_minutes'?: number | string;
109
112
  'fulfillment.enable_pickup'?: boolean;
110
113
  'fulfillment.handover_mode'?: string[];
111
114
  'fulfillment.takeaway_fees_rules'?: number[];
@@ -5001,6 +5001,9 @@ class OrderModule extends _BaseModule.BaseModule {
5001
5001
  metadata: {
5002
5002
  ...(targetBooking.metadata || {}),
5003
5003
  ...(updates.metadata || {}),
5004
+ ...(Number(targetBooking.metadata?.is_change_by_redeem) === 1 ? {
5005
+ is_change_by_redeem: 1
5006
+ } : {}),
5004
5007
  unique_identification_number: bookingUid
5005
5008
  }
5006
5009
  };
@@ -6217,7 +6220,7 @@ class OrderModule extends _BaseModule.BaseModule {
6217
6220
  if (options?.ensureIdentity !== false) {
6218
6221
  this.ensureExternalSaleNumber(nextTempOrder);
6219
6222
  }
6220
- nextTempOrder.vouchers = raw.vouchers || [];
6223
+ nextTempOrder.vouchers = (0, _utils.restoreRedeemVoucherTimes)(nextTempOrder, raw.vouchers || []);
6221
6224
  return nextTempOrder;
6222
6225
  }
6223
6226
  isSyntheticDraftOrderIdForRuntime(record, options) {
@@ -668,7 +668,7 @@ export interface SubmitSalesOrderParams {
668
668
  holder_relations?: OrderHolderRelation[];
669
669
  bookings: OrderSubmitBooking[];
670
670
  payments: any[];
671
- vouchers: any[];
671
+ vouchers?: any[];
672
672
  surcharges?: any[];
673
673
  relation_forms: any[];
674
674
  form_record_ids?: OrderSubmitFormRecord[];
@@ -210,6 +210,10 @@ export declare const getAllDiscountList: (cartItem: CartItem) => any;
210
210
  export { createUuidV4 };
211
211
  export declare function isTempOrder(data: any): data is OrderTempOrder;
212
212
  export declare function formatDateTime(date: Date): string;
213
+ /** 旧票券可能没有事件 ID;缺失或占位值不能用于关联预约。 */
214
+ export declare function redeemEventKey(value: unknown): string | undefined;
215
+ /** checkout 提交子预约的标记;重新加载订单时,从已调时的子预约恢复关联票券的票面时段。 */
216
+ export declare function restoreRedeemVoucherTimes(order: Pick<OrderTempOrder, 'bookings'>, vouchers: any[]): any[];
213
217
  export declare function normalizeBookingIsAll(booking: Record<string, any>): 0 | 1;
214
218
  export declare function normalizeBookingSubType(booking: Record<string, any>): string;
215
219
  export declare function normalizeSubmitBooking<T extends {
@@ -79,6 +79,7 @@ exports.normalizeSubmitBooking = normalizeSubmitBooking;
79
79
  exports.normalizeSubmitCollectPaxValue = normalizeSubmitCollectPaxValue;
80
80
  exports.normalizeVirtualCurrencySnapshotItem = normalizeVirtualCurrencySnapshotItem;
81
81
  exports.productRequiresFormSubject = productRequiresFormSubject;
82
+ exports.redeemEventKey = redeemEventKey;
82
83
  exports.resolveEffectivePerUnitDiscount = resolveEffectivePerUnitDiscount;
83
84
  exports.resolveIsFormSubject = resolveIsFormSubject;
84
85
  Object.defineProperty(exports, "resolveManualDiscountMessage", {
@@ -110,6 +111,7 @@ Object.defineProperty(exports, "resolveSafeProductNum", {
110
111
  exports.resolveSubmitCollectPax = resolveSubmitCollectPax;
111
112
  exports.resolveSubmitOrderType = resolveSubmitOrderType;
112
113
  exports.resolveTableOccupancyDuration = resolveTableOccupancyDuration;
114
+ exports.restoreRedeemVoucherTimes = restoreRedeemVoucherTimes;
113
115
  Object.defineProperty(exports, "shouldBuildManualProductDiscount", {
114
116
  enumerable: true,
115
117
  get: function () {
@@ -1372,7 +1374,49 @@ function normalizeSubmitProduct(product, formatOptions = {}) {
1372
1374
  payment_price: formatOptions.virtualSettlementMode ? virtualPrice : submitProduct.payment_price ?? submitProduct.selling_price
1373
1375
  };
1374
1376
  }
1375
- const SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
1377
+
1378
+ /** 旧票券可能没有事件 ID;缺失或占位值不能用于关联预约。 */
1379
+ function redeemEventKey(value) {
1380
+ if (typeof value !== 'number' && typeof value !== 'string') return;
1381
+ const key = String(value).trim();
1382
+ return /^[1-9]\d*$/.test(key) ? key : undefined;
1383
+ }
1384
+
1385
+ /** checkout 提交子预约的标记;重新加载订单时,从已调时的子预约恢复关联票券的票面时段。 */
1386
+ function restoreRedeemVoucherTimes(order, vouchers) {
1387
+ if (!Array.isArray(vouchers) || !vouchers.length) return vouchers;
1388
+ const markedBookings = new Map();
1389
+ for (const booking of order.bookings || []) {
1390
+ const event = redeemEventKey(booking?.schedule_event_id);
1391
+ if (event && Number(booking.metadata?.is_change_by_redeem) === 1) markedBookings.set(event, booking);
1392
+ }
1393
+ if (!markedBookings.size) return vouchers;
1394
+ let restored = vouchers;
1395
+ vouchers.forEach((voucher, index) => {
1396
+ const event = redeemEventKey(voucher?.schedule_event_id);
1397
+ const booking = event && markedBookings.get(event);
1398
+ if (!booking || !booking.start_time || !booking.end_time) return;
1399
+ const times = {
1400
+ start_time: booking.start_time,
1401
+ end_time: booking.end_time,
1402
+ ...(booking.start_date && {
1403
+ start_date: booking.start_date
1404
+ }),
1405
+ ...(booking.end_date && {
1406
+ expire_date: booking.end_date
1407
+ })
1408
+ };
1409
+ const timeChanged = Object.entries(times).some(([key, value]) => voucher[key] !== value);
1410
+ if (!timeChanged) return;
1411
+ if (restored === vouchers) restored = vouchers.slice();
1412
+ restored[index] = {
1413
+ ...voucher,
1414
+ ...times
1415
+ };
1416
+ });
1417
+ return restored;
1418
+ }
1419
+ const SUBMIT_BOOKING_METADATA_WHITELIST = ['is_change_by_redeem', 'unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
1376
1420
  function normalizeBookingIsAll(booking) {
1377
1421
  return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
1378
1422
  }
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
345
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;