import type { CheckoutPhoneField } from '../../../types/checkout-rates'; /** * Which phone warning the Live courier rates settings show. Locker and shop services need the * customer's phone (the courier texts the collection code), so warn when one is picked and checkout * does not require a phone. null when no warning is needed. The merchant decides what to do. */ export const pickupPhoneNotice = ( services: Array<{ pickup?: '' | 'locker' | 'shop' }>, phone: CheckoutPhoneField | undefined ): 'optional' | 'hidden' | null => { if (!phone || phone === 'required') return null; return services.some((service) => !!service.pickup) ? phone : null; };