Scheduling infrastructure for absolutely everyone.
chore: improve text for booker active booking limit (#24526)
Dhairyashil Shinde1fd64c5d7b98
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 85639b8533f..8a142faa815 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1893,7 +1893,7 @@"only_show_first_available_slot_description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time.","limit_total_booking_duration": "Limit total booking duration","limit_total_booking_duration_description": "Limit total amount of time that this event can be booked",- "booker_booking_limit": "Booker active booking limit",+ "booker_upcoming_limit": "Limit number of upcoming bookings per booker","booker_booking_limit_description": "Limit the number of active bookings a booker can make for this event type","recurring_event_doesnt_support_booker_booking_limit": "Recurring events don't support booker booking limit","add_limit": "Add Limit",@@ -3636,8 +3636,8 @@"error_downloading_expense_log": "Error downloading expense log","require_booker_email_verification": "Prevent Impersonation on Bookings","require_booker_email_verification_description": "When enabled, anyone trying to book events using your email address must verify they own it via a one time code or be logged in to prevent impersonation",- "offer_to_reschedule_last_booking": "Offer to reschedule last active booking to chosen time slot",- "booker_limit_exceeded_error": "Booker maximum active booking limit exceeded",+ "reschedule_last_booking_offer": "Offer to reschedule the last booking to the new time slot",+ "booker_upcoming_limit_reached": "You've reached the limit of {{count}} upcoming bookings for this event type","booker_limit_exceeded_error_reschedule": "You already have a booking for this event on {{date}}. Would you like to reschedule to the new selected time?","duration_min_error": "Duration must be at least {{min}} minute(s)","duration_max_error": "Duration cannot exceed {{max}} minutes (24 hours)",diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsxindex 137c4abaa18..a9abddc0cb7 100644--- a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx+++ b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx@@ -301,6 +301,7 @@ const getError = ({const error = dataError;let date = "";+ let count = 0;if (error.message === ErrorCode.BookerLimitExceededReschedule) {const formattedDate = formatEventFromTime({@@ -312,9 +313,16 @@ const getError = ({date = `${formattedDate.date} ${formattedDate.time}`;}+ if (error.message === ErrorCode.BookerLimitExceeded && error.data?.count) {+ count = error.data.count;+ }++ const messageKey =+ error.message === ErrorCode.BookerLimitExceeded ? "booker_upcoming_limit_reached" : error.message;+return error?.message ? (<>- {responseVercelIdHeader ?? ""} {t(error.message, { date })}+ {responseVercelIdHeader ?? ""} {t(messageKey, { date, count })}</>) : (<>{t("can_you_try_again")}</>diff --git a/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts b/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.tsindex 6b565ae4af9..0dec8cf173a 100644--- a/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts+++ b/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts@@ -61,7 +61,9 @@ const checkActiveBookingsLimit = async ({if (bookingsCount >= maxActiveBookingsPerBooker) {log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);- throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded);+ throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded, {+ count: maxActiveBookingsPerBooker,+ });}};diff --git a/packages/features/eventtypes/components/tabs/limits/MaxActiveBookingsPerBookerController.tsx b/packages/features/eventtypes/components/tabs/limits/MaxActiveBookingsPerBookerController.tsxindex 03caeb927af..6912585ba3c 100644--- a/packages/features/eventtypes/components/tabs/limits/MaxActiveBookingsPerBookerController.tsx+++ b/packages/features/eventtypes/components/tabs/limits/MaxActiveBookingsPerBookerController.tsx@@ -47,7 +47,7 @@ export default function MaxActiveBookingsPerBookerController({isChecked && "rounded-b-none")}childrenClassName={classNames("lg:ml-0")}- title={t("booker_booking_limit")}+ title={t("booker_upcoming_limit")}description={t("booker_booking_limit_description")}checked={isChecked}onCheckedChange={(active) => {@@ -76,7 +76,7 @@ export default function MaxActiveBookingsPerBookerController({<CheckboxFieldchecked={!!maxActiveBookingPerBookerOfferReschedule}descriptionAsLabel- description={t("offer_to_reschedule_last_booking")}+ description={t("reschedule_last_booking_offer")}disabled={maxActiveBookingsPerBookerLocked.disabled}onChange={(e) => {formMethods.setValue("maxActiveBookingPerBookerOfferReschedule", e.target.checked, {