All files / src/sections/PayBuilder/Checkout/hooks useEventParticipantDetails.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                        49x 1801x   1801x    
import useCheckFormType from "@sections/PayBuilder/components/hooks/useCheckFormType";
 
/**
 * useEventParticipantDetails resolves whether this checkout collects participant
 * details per ticket.
 *
 * Kept as a named hook because four surfaces depend on this answer — the builder
 * section, the customer-facing section, the validation rule and the checkout
 * payload — and a disagreement between any two of them is a silent bug:
 *
 *   section without the rule     -> blank participants submit and the BE falls
 *                                   back to the buyer's name on every ticket,
 *                                   while the UI claims details were collected
 *   rule without the section     -> required errors on invisible fields, and the
 *                                   customer can never complete checkout
 *   payload without the section  -> participants sent for units the buyer was
 *                                   never shown
 *
 * Events only: no other form type issues tickets, so nothing else changes.
 */
export const useEventParticipantDetails = (): boolean => {
  const { isEvent } = useCheckFormType();
 
  return isEvent;
};