PHP Rebuild
CI / ci (push) Canceled after 0s

Initial PHP rebuild of the app
This commit is contained in:
Stefan Lazic committed 2026-09-05 08:21:33 +01:00
1 parent 8a2b211069
commit 2ef3654841
690 files changed
+33944 -12046

No files matched your search

-46
View File
@@ -1,46 +0,0 @@
import type { BookingValidationErrorCode, ValidationResult } from "@/services/scheduling/types";
/**
* Maps the typed error codes the Phase 3 services already return into
* customer-friendly copy. The only place raw codes get translated —
* every booking-flow page imports from here rather than inlining its own
* message strings, so the wording only needs to change in one place.
*/
const FRIENDLY_MESSAGES: Record<BookingValidationErrorCode, string> = {
INVALID_INPUT: "Something about that wasn't quite right. Please try again.",
NO_SERVICES_SELECTED: "Please select at least one service.",
SERVICES_SPAN_MULTIPLE_BUSINESSES: "One or more selected services aren't available here.",
STAFF_CANNOT_PERFORM_SERVICE: "This barber doesn't offer one of the selected services.",
BUSINESS_CLOSED: "The business is closed at this time — please choose another slot.",
STAFF_NOT_WORKING: "This barber isn't working at that time — please choose another slot or barber.",
STAFF_ON_BREAK: "This barber is on a break at that time — please choose another slot.",
STAFF_ON_LEAVE: "This barber is away on that date — please choose another barber or date.",
SLOT_UNAVAILABLE: "That time was just booked by someone else — please choose another.",
INSUFFICIENT_DURATION:
"There isn't enough time left that day for the selected services — try an earlier time or fewer services.",
BELOW_MIN_NOTICE: "This time is too soon — please choose a later time.",
BEYOND_MAX_ADVANCE: "This date is too far ahead to book yet — please choose a nearer date.",
BUSINESS_DAILY_LIMIT_REACHED: "This business is fully booked that day — please choose another date.",
STAFF_DAILY_LIMIT_REACHED: "This barber is fully booked that day — please choose another barber or date.",
APPOINTMENT_NOT_FOUND: "We couldn't find that appointment.",
INVALID_STATUS_TRANSITION: "This appointment can no longer be changed.",
STAFF_NOT_FOUND: "We couldn't find that barber.",
CUSTOMER_NOT_FOUND: "We couldn't find your customer details.",
BUSINESS_NOT_FOUND: "We couldn't find this business.",
};
const FALLBACK_MESSAGE = "Something went wrong with this booking. Please try again.";
export function getFriendlyMessage(code: BookingValidationErrorCode): string {
return FRIENDLY_MESSAGES[code] ?? FALLBACK_MESSAGE;
}
export function getFriendlyValidationMessages(validation: ValidationResult): string[] {
if (validation.issues.length === 0) return [];
return validation.issues.map((issue) => getFriendlyMessage(issue.code));
}
export function getFirstFriendlyMessage(validation: ValidationResult): string {
const [first] = validation.issues;
return first ? getFriendlyMessage(first.code) : FALLBACK_MESSAGE;
}