@@ -119,18 +119,13 @@ type IsWithinCancellationPeriodReservationT = Pick<
119119 ReservationNodeT ,
120120 "begin"
121121> & {
122- reservationUnit ?: Array < {
123- cancellationRule ?: Pick <
124- NonNullable < ReservationUnitNode [ "cancellationRule" ] > ,
125- "canBeCancelledTimeBefore" | "needsHandling"
126- > | null ;
127- } > | null ;
122+ reservationUnits ?: Maybe < Array < CancellationRuleFieldsFragment > > | undefined ;
128123} ;
129124
130125function isTooCloseToCancel (
131126 reservation : IsWithinCancellationPeriodReservationT
132127) : boolean {
133- const reservationUnit = reservation . reservationUnit ?. [ 0 ] ;
128+ const reservationUnit = reservation . reservationUnits ?. [ 0 ] ;
134129 const begin = new Date ( reservation . begin ) ;
135130
136131 const { canBeCancelledTimeBefore } = reservationUnit ?. cancellationRule ?? { } ;
@@ -144,12 +139,12 @@ type CanUserCancelReservationProps = Pick<
144139 NonNullable < ReservationNodeT > ,
145140 "state" | "begin"
146141> & {
147- reservationUnit ?: Maybe < Array < CancellationRuleFieldsFragment > > | undefined ;
142+ reservationUnits ?: Maybe < Array < CancellationRuleFieldsFragment > > | undefined ;
148143} ;
149144export function isReservationCancellable (
150145 reservation : CanUserCancelReservationProps
151146) : boolean {
152- const reservationUnit = reservation . reservationUnit ?. [ 0 ] ;
147+ const reservationUnit = reservation . reservationUnits ?. [ 0 ] ;
153148 const isReservationCancelled =
154149 reservation . state === ReservationStateChoice . Cancelled ;
155150 const isBeingHandled =
@@ -278,7 +273,7 @@ export function getWhyReservationCantBeChanged(
278273 return "RESERVATION_BEGIN_IN_PAST" ;
279274 }
280275
281- const reservationUnit = reservation . reservationUnit ?. [ 0 ] ;
276+ const reservationUnit = reservation . reservationUnits ?. [ 0 ] ;
282277 if (
283278 reservationUnit ?. cancellationRule == null ||
284279 reservationUnit . cancellationRule . needsHandling
0 commit comments