/** * WHAT THE REVIEW STEP AND THE RECEIPT CALL THE VISIT. * * MEASURED 2026-09-15, booking as a patient at a practice that requires a new patient consultation * first. Two steps earlier the flow had locked the care type itself and said why - "New patient * consultation, required for your first visit with this practice" - and then the review step, and the * receipt after it, both read **"Service : Not specified"**. The patient's home card and the * appointment's own detail screen named it correctly, so the value was never missing: the review step * asked two sources and the answer was in a third. * * WHY IT MATTERS MORE THAN THE WORDING. The review step is the last thing a patient sees before the * write, and its whole job is letting them check what they are about to book. Telling them the service * is unspecified, on a flow that had just told them a specific one was required, is two answers to one * question on the screen asking them to confirm - and the receipt is the artifact they keep. * * THE ORDER IS MOST SPECIFIC FIRST: the block the booking is actually filed against, then what the * patient chose, then what the flow chose for them. The third is the one that was missing. */ export const SERVICE_NOT_STATED = 'Not specified'; export const reviewServiceLabel = ( onTheBlock: string | undefined, chosenByThePatient: string | undefined, pinnedByTheFlow: string | undefined, ): string => { const named = [onTheBlock, chosenByThePatient, pinnedByTheFlow] .map((candidate) => candidate?.trim()) .find((candidate) => Boolean(candidate)); // Still a last resort rather than an empty gap: a blank where the service goes reads as a service // with no name, and this at least says the screen does not know. return named ?? SERVICE_NOT_STATED; };