@blackcode_sa/metaestetics-api 1.12.58 → 1.12.59
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/admin/index.js
CHANGED
|
@@ -6979,6 +6979,12 @@ var BookingAvailabilityCalculator = class {
|
|
|
6979
6979
|
console.log(
|
|
6980
6980
|
`Generating slots with ${intervalMinutes}min intervals for ${durationMinutes}min procedure in timezone ${tz}`
|
|
6981
6981
|
);
|
|
6982
|
+
const nowInClinicTz = import_luxon2.DateTime.now().setZone(tz);
|
|
6983
|
+
const MINIMUM_BOOKING_WINDOW_MINUTES = 15;
|
|
6984
|
+
const earliestBookableTime = nowInClinicTz.plus({ minutes: MINIMUM_BOOKING_WINDOW_MINUTES });
|
|
6985
|
+
console.log(
|
|
6986
|
+
`Current time in ${tz}: ${nowInClinicTz.toISO()}, earliest bookable: ${earliestBookableTime.toISO()}`
|
|
6987
|
+
);
|
|
6982
6988
|
const durationMs = durationMinutes * 60 * 1e3;
|
|
6983
6989
|
const intervalMs = intervalMinutes * 60 * 1e3;
|
|
6984
6990
|
for (const interval of intervals) {
|
|
@@ -6994,7 +7000,8 @@ var BookingAvailabilityCalculator = class {
|
|
|
6994
7000
|
}
|
|
6995
7001
|
while (slotStart.toMillis() + durationMs <= intervalEnd.getTime()) {
|
|
6996
7002
|
const slotEnd = slotStart.plus({ minutes: durationMinutes });
|
|
6997
|
-
|
|
7003
|
+
const isInFuture = slotStart >= earliestBookableTime;
|
|
7004
|
+
if (isInFuture && this.isSlotFullyAvailable(slotStart, slotEnd, intervals, tz)) {
|
|
6998
7005
|
slots.push({
|
|
6999
7006
|
start: import_firestore2.Timestamp.fromMillis(slotStart.toMillis())
|
|
7000
7007
|
});
|
|
@@ -7002,7 +7009,7 @@ var BookingAvailabilityCalculator = class {
|
|
|
7002
7009
|
slotStart = slotStart.plus({ minutes: intervalMinutes });
|
|
7003
7010
|
}
|
|
7004
7011
|
}
|
|
7005
|
-
console.log(`Generated ${slots.length} available slots`);
|
|
7012
|
+
console.log(`Generated ${slots.length} available slots (filtered for future times with ${MINIMUM_BOOKING_WINDOW_MINUTES}min minimum window)`);
|
|
7006
7013
|
return slots;
|
|
7007
7014
|
}
|
|
7008
7015
|
/**
|
package/dist/admin/index.mjs
CHANGED
|
@@ -6917,6 +6917,12 @@ var BookingAvailabilityCalculator = class {
|
|
|
6917
6917
|
console.log(
|
|
6918
6918
|
`Generating slots with ${intervalMinutes}min intervals for ${durationMinutes}min procedure in timezone ${tz}`
|
|
6919
6919
|
);
|
|
6920
|
+
const nowInClinicTz = DateTime2.now().setZone(tz);
|
|
6921
|
+
const MINIMUM_BOOKING_WINDOW_MINUTES = 15;
|
|
6922
|
+
const earliestBookableTime = nowInClinicTz.plus({ minutes: MINIMUM_BOOKING_WINDOW_MINUTES });
|
|
6923
|
+
console.log(
|
|
6924
|
+
`Current time in ${tz}: ${nowInClinicTz.toISO()}, earliest bookable: ${earliestBookableTime.toISO()}`
|
|
6925
|
+
);
|
|
6920
6926
|
const durationMs = durationMinutes * 60 * 1e3;
|
|
6921
6927
|
const intervalMs = intervalMinutes * 60 * 1e3;
|
|
6922
6928
|
for (const interval of intervals) {
|
|
@@ -6932,7 +6938,8 @@ var BookingAvailabilityCalculator = class {
|
|
|
6932
6938
|
}
|
|
6933
6939
|
while (slotStart.toMillis() + durationMs <= intervalEnd.getTime()) {
|
|
6934
6940
|
const slotEnd = slotStart.plus({ minutes: durationMinutes });
|
|
6935
|
-
|
|
6941
|
+
const isInFuture = slotStart >= earliestBookableTime;
|
|
6942
|
+
if (isInFuture && this.isSlotFullyAvailable(slotStart, slotEnd, intervals, tz)) {
|
|
6936
6943
|
slots.push({
|
|
6937
6944
|
start: Timestamp.fromMillis(slotStart.toMillis())
|
|
6938
6945
|
});
|
|
@@ -6940,7 +6947,7 @@ var BookingAvailabilityCalculator = class {
|
|
|
6940
6947
|
slotStart = slotStart.plus({ minutes: intervalMinutes });
|
|
6941
6948
|
}
|
|
6942
6949
|
}
|
|
6943
|
-
console.log(`Generated ${slots.length} available slots`);
|
|
6950
|
+
console.log(`Generated ${slots.length} available slots (filtered for future times with ${MINIMUM_BOOKING_WINDOW_MINUTES}min minimum window)`);
|
|
6944
6951
|
return slots;
|
|
6945
6952
|
}
|
|
6946
6953
|
/**
|
package/package.json
CHANGED
|
@@ -484,6 +484,16 @@ export class BookingAvailabilityCalculator {
|
|
|
484
484
|
`Generating slots with ${intervalMinutes}min intervals for ${durationMinutes}min procedure in timezone ${tz}`
|
|
485
485
|
);
|
|
486
486
|
|
|
487
|
+
// Get current time in clinic timezone
|
|
488
|
+
const nowInClinicTz = DateTime.now().setZone(tz);
|
|
489
|
+
// Add minimum booking window (15 minutes from now)
|
|
490
|
+
const MINIMUM_BOOKING_WINDOW_MINUTES = 15;
|
|
491
|
+
const earliestBookableTime = nowInClinicTz.plus({ minutes: MINIMUM_BOOKING_WINDOW_MINUTES });
|
|
492
|
+
|
|
493
|
+
console.log(
|
|
494
|
+
`Current time in ${tz}: ${nowInClinicTz.toISO()}, earliest bookable: ${earliestBookableTime.toISO()}`
|
|
495
|
+
);
|
|
496
|
+
|
|
487
497
|
// Convert duration to milliseconds
|
|
488
498
|
const durationMs = durationMinutes * 60 * 1000;
|
|
489
499
|
// Convert interval to milliseconds
|
|
@@ -513,8 +523,11 @@ export class BookingAvailabilityCalculator {
|
|
|
513
523
|
// Calculate potential end time
|
|
514
524
|
const slotEnd = slotStart.plus({ minutes: durationMinutes });
|
|
515
525
|
|
|
516
|
-
//
|
|
517
|
-
|
|
526
|
+
// ✅ CRITICAL FIX: Filter out past slots and slots too close to now
|
|
527
|
+
const isInFuture = slotStart >= earliestBookableTime;
|
|
528
|
+
|
|
529
|
+
// Check if this slot fits entirely within one of our available intervals AND is in the future
|
|
530
|
+
if (isInFuture && this.isSlotFullyAvailable(slotStart, slotEnd, intervals, tz)) {
|
|
518
531
|
slots.push({
|
|
519
532
|
start: Timestamp.fromMillis(slotStart.toMillis()),
|
|
520
533
|
});
|
|
@@ -525,7 +538,7 @@ export class BookingAvailabilityCalculator {
|
|
|
525
538
|
}
|
|
526
539
|
}
|
|
527
540
|
|
|
528
|
-
console.log(`Generated ${slots.length} available slots`);
|
|
541
|
+
console.log(`Generated ${slots.length} available slots (filtered for future times with ${MINIMUM_BOOKING_WINDOW_MINUTES}min minimum window)`);
|
|
529
542
|
return slots;
|
|
530
543
|
}
|
|
531
544
|
|