@final-commerce/common 2.12.0-staging.2 → 2.12.0-staging.3

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.
package/dist/index.mjs CHANGED
@@ -3464,6 +3464,11 @@ function occupancyIn(occupied, productId, startAt, bufferEndAt, shared) {
3464
3464
  foreignProductId: foreign?.productId
3465
3465
  };
3466
3466
  }
3467
+ var inEveryOutletPool = (entry) => !entry.outletId;
3468
+ function occupiedAtOutlet(occupied, rule, outletId) {
3469
+ if (bookingMethodOf(rule) !== "sessions" || !outletId) return occupied;
3470
+ return occupied.filter((entry) => inEveryOutletPool(entry) || entry.outletId === outletId);
3471
+ }
3467
3472
  var stateFor = (hasShift, offerable, free) => {
3468
3473
  if (offerable === 0) {
3469
3474
  return hasShift() ? "fullyBooked" /* FULLY_BOOKED */ : "noHoursInRange" /* NO_HOURS_IN_RANGE */;
@@ -3495,12 +3500,14 @@ function buildAvailability({
3495
3500
  bookingRulesId,
3496
3501
  rule,
3497
3502
  resources,
3498
- occupied,
3503
+ occupied: everyOutlet,
3504
+ outletId,
3499
3505
  from,
3500
3506
  to,
3501
3507
  now,
3502
3508
  timeZone
3503
3509
  }) {
3510
+ const occupied = occupiedAtOutlet(everyOutlet, rule, outletId);
3504
3511
  const shared = rule.slot.sharedAcrossProducts ?? false;
3505
3512
  const bookableUntil = windowEndsAtInZone(rule, now, timeZone ?? null);
3506
3513
  const parts = bookingRuleParts(rule);
@@ -5091,6 +5098,7 @@ export {
5091
5098
  normalizePostCode,
5092
5099
  normalizeProvince,
5093
5100
  occupancyIn,
5101
+ occupiedAtOutlet,
5094
5102
  oldMaxAdvanceOf,
5095
5103
  orderAssignments,
5096
5104
  parseAmountToMinorUnits,