fix: use current date for slot availability + SW v56
This commit is contained in:
parent
e93215f837
commit
a74a5242b8
|
|
@ -1,8 +1,8 @@
|
||||||
const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1";
|
const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1";
|
||||||
|
|
||||||
if (!isLocalhost) {
|
if (!isLocalhost) {
|
||||||
const STATIC_CACHE = "construction-delivery-static-v55";
|
const STATIC_CACHE = "construction-delivery-static-v56";
|
||||||
const RUNTIME_CACHE = "construction-delivery-runtime-v55";
|
const RUNTIME_CACHE = "construction-delivery-runtime-v56";
|
||||||
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
|
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
|
||||||
|
|
||||||
self.addEventListener("install", (event) => {
|
self.addEventListener("install", (event) => {
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,8 @@ export const ClientDeliveryPage = () => {
|
||||||
() => (invitation?.smsSentAt ? new Date(invitation.smsSentAt) : new Date()),
|
() => (invitation?.smsSentAt ? new Date(invitation.smsSentAt) : new Date()),
|
||||||
[token, invitation?.smsSentAt],
|
[token, invitation?.smsSentAt],
|
||||||
);
|
);
|
||||||
|
// For slot availability, always use current date — not SMS send date
|
||||||
|
const nowForSlots = React.useMemo(() => new Date(), []);
|
||||||
|
|
||||||
// Fetch business schedule (delivery/pickup days) — no auth required
|
// Fetch business schedule (delivery/pickup days) — no auth required
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|
@ -310,7 +312,7 @@ export const ClientDeliveryPage = () => {
|
||||||
};
|
};
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
||||||
const slots = groupSlotsFromInvitation(invitation, referenceDate);
|
const slots = groupSlotsFromInvitation(invitation, nowForSlots);
|
||||||
|
|
||||||
const invitationState = invitation?.state || "awaiting_choice";
|
const invitationState = invitation?.state || "awaiting_choice";
|
||||||
const isActiveState = ["awaiting_choice", "opened", "reminder_sent"].includes(invitationState);
|
const isActiveState = ["awaiting_choice", "opened", "reminder_sent"].includes(invitationState);
|
||||||
|
|
@ -357,7 +359,7 @@ export const ClientDeliveryPage = () => {
|
||||||
setSelectedSlot(
|
setSelectedSlot(
|
||||||
buildSelectedSlotFromInvitation(
|
buildSelectedSlotFromInvitation(
|
||||||
loadedInvitation,
|
loadedInvitation,
|
||||||
groupSlotsFromInvitation(loadedInvitation, referenceDate),
|
groupSlotsFromInvitation(loadedInvitation, nowForSlots),
|
||||||
) || effectiveSelectedSlot,
|
) || effectiveSelectedSlot,
|
||||||
);
|
);
|
||||||
setChoiceSaved(true);
|
setChoiceSaved(true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue