From 3a403a8dee2cd6858805cdc81c60db1694e61315 Mon Sep 17 00:00:00 2001 From: Somay Date: Fri, 29 Dec 2023 12:26:17 +0530 Subject: [PATCH 1/2] feat: Meeting confirmation button when payment is enabled says `pay & book` --- apps/web/public/static/locales/en/common.json | 1 + .../components/BookEventForm/BookEventForm.tsx | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 64b0c28f0ae8cd..478a10360ec903 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2192,5 +2192,6 @@ "uprade_to_create_instant_bookings": "Upgrade to Enterprise and let guests join an instant call that attendees can jump straight into. This is only for team event types", "dont_want_to_wait": "Don't want to wait?", "meeting_started": "Meeting Started", + "pay_and_book": "Pay & Book", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx index dc34e661b2185c..7e47834fd614a9 100644 --- a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx +++ b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx @@ -4,7 +4,7 @@ import { useMutation } from "@tanstack/react-query"; import { useSession } from "next-auth/react"; import type { TFunction } from "next-i18next"; import { useRouter, useSearchParams, usePathname } from "next/navigation"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, useMemo } from "react"; import type { FieldError } from "react-hook-form"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -29,6 +29,7 @@ import { Spinner } from "@calcom/features/calendars/weeklyview/components/spinne import { getFullName } from "@calcom/features/form-builder/utils"; import { useBookingSuccessRedirect } from "@calcom/lib/bookingSuccessRedirect"; import { MINUTES_TO_BOOK } from "@calcom/lib/constants"; +import getPaymentAppData from "@calcom/lib/getPaymentAppData"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery"; import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; @@ -175,6 +176,12 @@ export const BookEventFormChild = ({ const username = useBookerStore((state) => state.username); const [expiryTime, setExpiryTime] = useState(); + const isPaidEvent = useMemo(() => { + if (!eventType?.price) return false; + const paymentAppData = getPaymentAppData(eventType); + return eventType?.price > 0 || paymentAppData.price > 0; + }, [eventType]); + type BookingFormValues = { locationType?: EventLocationType["type"]; responses: z.infer["responses"] | null; @@ -431,7 +438,7 @@ export const BookEventFormChild = ({
{isInstantMeeting ? ( ) : ( <> @@ -450,7 +457,9 @@ export const BookEventFormChild = ({ {rescheduleUid && bookingData ? t("reschedule") : renderConfirmNotVerifyEmailButtonCond - ? t("confirm") + ? isPaidEvent + ? t("pay_and_book") + : t("confirm") : t("verify_email_email_button")} From 43dfa28c5e7a5503b6143213f2cb76f7de0bea14 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Mon, 1 Jan 2024 14:05:00 +0000 Subject: [PATCH 2/2] Update apps/web/public/static/locales/en/common.json --- apps/web/public/static/locales/en/common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 478a10360ec903..ec30f34dbf6858 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2192,6 +2192,6 @@ "uprade_to_create_instant_bookings": "Upgrade to Enterprise and let guests join an instant call that attendees can jump straight into. This is only for team event types", "dont_want_to_wait": "Don't want to wait?", "meeting_started": "Meeting Started", - "pay_and_book": "Pay & Book", + "pay_and_book": "Pay to book", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" }