Merged in fix/STAY-65-manage-stay (pull request #3089)
Fix/STAY-65 manage stay * fix: Disable manage stay for past bookings * fix: handle past and cancelled stay the same * fix: indentify past booking * fix: refactor to use design system components Approved-by: Erik Tiekstra
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"use client"
|
||||
import { DialogTrigger } from "react-aria-components"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { Button } from "@scandic-hotels/design-system/Button"
|
||||
|
||||
import CustomerSupportModal from "@/components/HotelReservation/MyStay/ReferenceCard/Actions/CustomerSupportModal"
|
||||
|
||||
export default function CustomerSupport() {
|
||||
const intl = useIntl()
|
||||
|
||||
return (
|
||||
<DialogTrigger>
|
||||
<Button
|
||||
variant="Secondary"
|
||||
size="Small"
|
||||
typography="Body/Supporting text (caption)/smBold"
|
||||
>
|
||||
{intl.formatMessage({
|
||||
id: "common.customerSupport",
|
||||
defaultMessage: "Customer support",
|
||||
})}
|
||||
</Button>
|
||||
<CustomerSupportModal />
|
||||
</DialogTrigger>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use client"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { serializeBookingSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
||||
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
||||
|
||||
import { isWebview } from "@/constants/routes/webviews"
|
||||
import { useMyStayStore } from "@/stores/my-stay"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import CustomerSupport from "./CustomerSupport"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||
|
||||
export default function NotUpcoming() {
|
||||
const intl = useIntl()
|
||||
const pathname = usePathname()
|
||||
const { rooms, mainRoom } = useMyStayStore((state) => ({
|
||||
rooms: state.rooms,
|
||||
mainRoom: state.mainRoom,
|
||||
}))
|
||||
const lang = useLang()
|
||||
|
||||
const bookingData: BookingWidgetSearchData = {
|
||||
hotelId: mainRoom.hotelId,
|
||||
rooms: [mainRoom, ...rooms].map((room) => ({
|
||||
adults: room.adults,
|
||||
childrenInRoom: room.childrenInRoom,
|
||||
})),
|
||||
}
|
||||
|
||||
if (mainRoom.bookingCode) {
|
||||
bookingData.bookingCode = mainRoom.bookingCode
|
||||
}
|
||||
if (mainRoom.bookingType === RateTypeEnum.Redemption) {
|
||||
bookingData.searchType = "redemption"
|
||||
}
|
||||
|
||||
const rebookUrl = serializeBookingSearchParams(bookingData)
|
||||
|
||||
const url = `/${lang}?${rebookUrl}`
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isWebview(pathname) && (
|
||||
<ButtonLink
|
||||
variant="Tertiary"
|
||||
size="Medium"
|
||||
href={url}
|
||||
typography="Body/Supporting text (caption)/smBold"
|
||||
>
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "Rebook",
|
||||
id: "myStay.referenceCard.actions.rebook",
|
||||
})}
|
||||
</ButtonLink>
|
||||
)}
|
||||
|
||||
<CustomerSupport />
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user