"use client" import { useIntl } from "react-intl" import { BookingStatusEnum } from "@/constants/booking" import { customerService } from "@/constants/currentWebHrefs" import AddToCalendar from "@/components/HotelReservation/AddToCalendar" import { generateDateTime } from "@/components/HotelReservation/BookingConfirmation/Header/Actions/helpers" import { CalendarIcon, ChevronRightIcon, CreditCard, CrossCircleOutlineIcon, DownloadIcon, } from "@/components/Icons" import Button from "@/components/TempDesignSystem/Button" import Link from "@/components/TempDesignSystem/Link" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import useLang from "@/hooks/useLang" import { trackMyStayPageLink } from "@/utils/tracking" import { useManageStayStore } from "../../stores/manageStayStore" import AddToCalendarButton from "./Actions/AddToCalendarButton" import styles from "./actionPanel.module.css" import type { EventAttributes } from "ics" import type { Hotel } from "@/types/hotel" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" interface ActionPanelProps { booking: BookingConfirmation["booking"] hotel: Hotel bookingStatus: string | null showGuaranteeButton: boolean onCancelClick: () => void onGuaranteeClick: () => void } export default function ActionPanel({ booking, hotel, bookingStatus, showGuaranteeButton, onGuaranteeClick, }: ActionPanelProps) { const intl = useIntl() const lang = useLang() const { actions: { setActiveView }, } = useManageStayStore() const showCancelStayButton = bookingStatus !== BookingStatusEnum.Cancelled && booking.isCancelable const event: EventAttributes = { busyStatus: "FREE", categories: ["booking", "hotel", "stay"], created: generateDateTime(booking.createDateTime), description: hotel.hotelContent.texts.descriptions?.medium, end: generateDateTime(booking.checkOutDate), endInputType: "utc", geo: { lat: hotel.location.latitude, lon: hotel.location.longitude, }, location: `${hotel.address.streetAddress}, ${hotel.address.zipCode} ${hotel.address.city} ${hotel.address.country}`, start: generateDateTime(booking.checkInDate), startInputType: "utc", status: "CONFIRMED", title: hotel.name, url: hotel.contactInformation.websiteUrl, } const handleModifyStay = () => { trackMyStayPageLink("modify dates") setActiveView("modifyStay") } const handleCancelStay = () => { trackMyStayPageLink("cancel booking") setActiveView("cancelStay") } const handleDownloadInvoice = () => { trackMyStayPageLink("download invoice") } const handleGuaranteeLateArrival = () => { trackMyStayPageLink("guarantee late arrival") onGuaranteeClick() } const handleCustomerSupport = () => { trackMyStayPageLink("customer support") } return (