From fac0b0fa32269a6855e3cb602219041252ef99b3 Mon Sep 17 00:00:00 2001 From: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Date: Wed, 16 Nov 2022 20:48:17 +0100 Subject: [PATCH] Improving cancellation flow (#5447) * Booking succes query refactor The query is now using the uid as its main identifier for the success page * Minor changes to the succes.tsx and tests * Convert eventtype dates to string, and only select eventtype slug from db to have a smaller query (we don't need more data, and this way we don't need to convert the dates in here to smaller strings either.) * In the payment component get the bookingUid from props instead of the query * design fixes * fix UI for recurring bookings * fix success page for recurring events * fix cancelling recurring events * fix design of successful cancellation page * fix email redirect + design fixes * remove old cancel page * fix v2 design for text area * Changed the recurringMutation to use the uid for the success booking page * redirect form old to new cancel page * fix success page for recurring events * rename to allRemainingbookings * fix old cancel redirect * fix recurring cancel link in email * fix redirect when cancelling one recurring booking * remove reschedule for recurring events in email * create queryschema for cancel success page * scroll down to bottom if cancel * add cancellation reason * fix tests * fix old /cancel component * code clean up * Uses URL query as cancellation state Also fixes string to boolean inference Co-authored-by: Mischa Rouleaux Co-authored-by: alannnc Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jeroen Reumkens Co-authored-by: Hariom Balhara Co-authored-by: CarinaWolli Co-authored-by: zomars --- .../components/booking/BookingListItem.tsx | 5 +- apps/web/components/booking/CancelBooking.tsx | 35 +- .../components/booking/pages/BookingPage.tsx | 1 + apps/web/pages/cancel/[uid].tsx | 305 +----------------- apps/web/pages/cancel/success.tsx | 18 +- apps/web/pages/success.tsx | 99 ++++-- apps/web/playwright/booking-pages.e2e.ts | 2 +- .../playwright/dynamic-booking-pages.e2e.ts | 2 +- apps/web/public/static/locales/en/common.json | 6 +- packages/emails/src/components/ManageLink.tsx | 13 +- packages/lib/CalEventParser.ts | 5 +- 11 files changed, 129 insertions(+), 362 deletions(-) diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index dac6a6d7a1..2023df30bf 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -112,7 +112,9 @@ function BookingListItem(booking: BookingItemProps) { label: isTabRecurring && isRecurring ? t("cancel_all_remaining") : t("cancel"), /* When cancelling we need to let the UI and the API know if the intention is to cancel all remaining bookings or just that booking instance. */ - href: `/cancel/${booking.uid}${isTabRecurring && isRecurring ? "?allRemainingBookings=true" : ""}`, + href: `/success?uid=${booking.uid}&cancel=true${ + isTabRecurring && isRecurring ? "&allRemainingBookings=true" : "" + }`, icon: Icon.FiX, }, { @@ -190,6 +192,7 @@ function BookingListItem(booking: BookingItemProps) { pathname: "/success", query: { uid: booking.uid, + allRemainingBookings: isTabRecurring, listingStatus: booking.listingStatus, email: booking.attendees[0] ? booking.attendees[0].email : undefined, }, diff --git a/apps/web/components/booking/CancelBooking.tsx b/apps/web/components/booking/CancelBooking.tsx index 0dbc58ae4e..e6da1c4e6a 100644 --- a/apps/web/components/booking/CancelBooking.tsx +++ b/apps/web/components/booking/CancelBooking.tsx @@ -5,8 +5,8 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; import useTheme from "@calcom/lib/hooks/useTheme"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; import type { RecurringEvent } from "@calcom/types/Calendar"; -import { Button } from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; +import { Button, TextArea } from "@calcom/ui/components"; type Props = { booking: { @@ -22,13 +22,14 @@ type Props = { team?: string | null; setIsCancellationMode: (value: boolean) => void; theme: string | null; + allRemainingBookings: boolean; }; export default function CancelBooking(props: Props) { const [cancellationReason, setCancellationReason] = useState(""); const { t } = useLocale(); const router = useRouter(); - const { booking, profile, team } = props; + const { booking, profile, team, allRemainingBookings } = props; const [loading, setLoading] = useState(false); const telemetry = useTelemetry(); const [error, setError] = useState(booking ? null : t("booking_already_cancelled")); @@ -51,30 +52,23 @@ export default function CancelBooking(props: Props) { {!error && (
-