From 9375efffe3ce5a01fcbda2efbb26ef24bfeb7750 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Tue, 1 Oct 2024 03:24:55 +0530 Subject: [PATCH] feat: prevent sending multiple instant meeting request (#16881) --- apps/web/public/static/locales/en/common.json | 2 +- .../RedirectToInstantMeetingModal.tsx | 2 +- .../Booker/components/hooks/useBookings.ts | 52 ++++++++++++++++++- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index bfe7464c1f..398e85ee7d 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2168,7 +2168,7 @@ "select_time": "Select Time", "select_date": "Select Date", "connecting_you_to_someone": "We are connecting you to someone.", - "please_do_not_close_this_tab": "Please do not close this tab", + "please_do_not_close_this_tab": "Please do not close or refresh this page", "see_all_available_times": "See all available times", "org_team_names_example_1": "e.g. Marketing Team", "org_team_names_example_2": "e.g. Sales Team", diff --git a/packages/features/bookings/Booker/components/RedirectToInstantMeetingModal.tsx b/packages/features/bookings/Booker/components/RedirectToInstantMeetingModal.tsx index 6311a039b5..33ce5a1ded 100644 --- a/packages/features/bookings/Booker/components/RedirectToInstantMeetingModal.tsx +++ b/packages/features/bookings/Booker/components/RedirectToInstantMeetingModal.tsx @@ -94,7 +94,7 @@ export const RedirectToInstantMeetingModal = ({ ) : (
{t("connecting_you_to_someone")}
-{t("please_do_not_close_this_tab")}
+{t("please_do_not_close_this_tab")}
{t("please_schedule_future_call", {
seconds: formatTime(timeRemaining),
diff --git a/packages/features/bookings/Booker/components/hooks/useBookings.ts b/packages/features/bookings/Booker/components/hooks/useBookings.ts
index e21cedb301..e0653cc50b 100644
--- a/packages/features/bookings/Booker/components/hooks/useBookings.ts
+++ b/packages/features/bookings/Booker/components/hooks/useBookings.ts
@@ -13,6 +13,7 @@ import type { BookerEvent } from "@calcom/features/bookings/types";
import { getFullName } from "@calcom/features/form-builder/utils";
import { useBookingSuccessRedirect } from "@calcom/lib/bookingSuccessRedirect";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { localStorage } from "@calcom/lib/webstorage";
import { BookingStatus } from "@calcom/prisma/enums";
import { bookingMetadataSchema } from "@calcom/prisma/zod-utils";
import { trpc } from "@calcom/trpc";
@@ -85,22 +86,63 @@ export interface IUseBookingErrors {
}
export type UseBookingsReturnType = ReturnType