diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/confirmationStep.module.css b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/confirmationStep.module.css
index 53f4a83d5..8d66a8e9c 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/confirmationStep.module.css
+++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/confirmationStep.module.css
@@ -4,12 +4,6 @@
gap: var(--Space-x2);
}
-.termsAndConditions {
- display: grid;
- gap: var(--Space-x2);
- color: var(--Text-Secondary);
-}
-
.totalPointsContainer {
display: flex;
justify-content: space-between;
@@ -17,9 +11,27 @@
padding: var(--Space-x1) var(--Space-x15);
border-radius: var(--Corner-radius-md);
}
+.guarantee {
+ display: flex;
+ flex-direction: column;
+ gap: var(--Space-x2);
+ background-color: var(--Surface-Secondary-Default);
+ border-radius: var(--Corner-radius-lg);
+ padding: var(--Space-x2);
+}
+
+.paymentInfo {
+ display: flex;
+ gap: var(--Space-x1);
+ align-items: flex-start;
+}
.totalPoints {
display: flex;
gap: var(--Space-x15);
align-items: center;
}
+
+.accordionItem {
+ border-radius: var(--Corner-radius-md);
+}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx
index 6c6da2638..1c04bcc2d 100755
--- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx
@@ -1,27 +1,23 @@
import { useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
-import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
-import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes"
-import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes"
import { dt } from "@scandic-hotels/common/dt"
+import AccordionItem from "@scandic-hotels/design-system/Accordion/AccordionItem"
import { Alert } from "@scandic-hotels/design-system/Alert"
-import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
+import { Divider } from "@scandic-hotels/design-system/Divider"
import { PaymentOption } from "@scandic-hotels/design-system/Form/PaymentOption"
import { PaymentOptionsGroup } from "@scandic-hotels/design-system/Form/PaymentOptionsGroup"
import { SelectPaymentMethod } from "@scandic-hotels/design-system/Form/SelectPaymentMethod"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
-import { TextLink } from "@scandic-hotels/design-system/TextLink"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow"
+import TermsAndConditions from "@/components/HotelReservation/MyStay/TermsAndConditions"
import useLang from "@/hooks/useLang"
import { trackUpdatePaymentMethod } from "@/utils/tracking"
-import { ancillaryError } from "../../../schema"
-
import styles from "./confirmationStep.module.css"
import type { ConfirmationStepProps } from "@/types/components/myPages/myStay/ancillaries"
@@ -33,17 +29,20 @@ export default function ConfirmationStep({
}: ConfirmationStepProps) {
const intl = useIntl()
const lang = useLang()
- const { checkInDate, guaranteeInfo, selectedAncillary } =
+
+ const { checkInDate, guaranteeInfo, selectedAncillary, booking } =
useAddAncillaryStore((state) => ({
checkInDate: state.booking.checkInDate,
guaranteeInfo: state.booking.guaranteeInfo,
selectedAncillary: state.selectedAncillary,
+ booking: state.booking,
}))
const refundableDate = dt(checkInDate)
.subtract(1, "day")
.locale(lang)
.format("23:59, dddd, D MMMM YYYY")
+ const mustBeGuaranteed = !guaranteeInfo && booking.isGuaranteeable
const quantityWithCard = useWatch({ name: "quantityWithCard" })
const quantityWithPoints = useWatch({ name: "quantityWithPoints" })
const currentPoints = user?.membership?.currentPoints ?? 0
@@ -51,20 +50,22 @@ export default function ConfirmationStep({
quantityWithPoints && selectedAncillary?.points
? selectedAncillary.points * quantityWithPoints
: null
+
+ const accordionTitle = intl.formatMessage({
+ id: "myStay.guarantee.guaranteeInformation",
+ defaultMessage:
+ "By adding your card, you also guarantee your room booking for late arrival ",
+ })
+
+ const accordionContent = intl.formatMessage({
+ id: "myStay.guarantee.guaranteeInformation.content",
+ defaultMessage:
+ "The hotel will hold your booking, even if you arrive after 18:00. Your card will only be charged in the event of a no-show.",
+ })
+
return (
-
-
- {intl.formatMessage(
- {
- id: "addAncillary.confirmationStep.refundPolicy",
- defaultMessage:
- "All ancillaries are fully refundable until {date}. Time selection and special requests are also modifiable.",
- },
- { date: refundableDate }
- )}
-
{intl.formatMessage({
- id: "addAncillary.confirmationStep.paymentAtCheckInInfo",
- defaultMessage:
- "Payment will be made on check-in. The card will be only used to guarantee the ancillary in case of no-show.",
+ id: "addAncillary.confirmationStep.reserveWithCard",
+ defaultMessage: "Reserve with Card",
})}
+
+
+
+
+ {intl.formatMessage(
+ {
+ id: "addAncillary.confirmationStep.refundPolicy",
+ defaultMessage:
+ "All ancillaries are fully refundable until {date}. Time selection and special requests are also modifiable.",
+ },
+ { date: refundableDate }
+ )}
+ {intl.formatMessage({
+ id: "myStay.ancillary.guarantee.headingText",
+ defaultMessage: "Payment will be made on check-in",
+ })}
+
+
+
+
+ {intl.formatMessage({
+ id: "myStay.ancillary.guarantee.infoText",
+ defaultMessage:
+ "The card is used to reserve your extras. You will be charged in case of no-show.",
+ })}
+
+ {intl.formatMessage({
+ id: "myStay.ancillary.guarantee.confirmationText",
+ defaultMessage:
+ "Confirm and provide your payment card details in the next step",
+ })}
+
- {intl.formatMessage(
- {
- id: "addAncillary.confirmationStep.termsAndConditionsNotice",
- defaultMessage:
- "Yes, I accept the general Booking & Cancellation Terms, and understand that Scandic will process my personal data in accordance with Scandic's Privacy policy. There you can learn more about what data we process, your rights and where to turn if you have questions.",
- },
- {
- termsAndConditionsLink: (str) => (
-
- {str}
-
- ),
- privacyPolicyLink: (str) => (
-
- {str}
-
- ),
- }
- )}
-
-
-
-
-
- {intl.formatMessage({
- id: "booking.acceptBookingTerms",
- defaultMessage: "I accept the booking and cancellation terms",
- })}
-
-
-
-
+
)
}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Modal/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Modal/index.tsx
index 82be1e27c..53584dc21 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/Modal/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/Modal/index.tsx
@@ -5,9 +5,21 @@ import ModalContent from "./ModalContent"
import styles from "./modal.module.css"
-export default function Modal({ children }: React.PropsWithChildren) {
+export default function Modal({
+ children,
+ isOpen,
+ onOpenChange,
+}: React.PropsWithChildren<{
+ isOpen?: boolean
+ onOpenChange?: (value: boolean) => void
+}>) {
return (
-
+ {children}
)
diff --git a/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/GuaranteePaymentFailed/index.tsx
similarity index 58%
rename from apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts
rename to apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/GuaranteePaymentFailed/index.tsx
index 45e4c3978..2f5fe3f63 100644
--- a/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/GuaranteePaymentFailed/index.tsx
@@ -1,21 +1,26 @@
-"use client"
-
import { usePathname, useRouter, useSearchParams } from "next/navigation"
-import { useCallback, useEffect, useRef } from "react"
+import { useCallback, useEffect, useState } from "react"
import { useIntl } from "react-intl"
-import { toast } from "@scandic-hotels/design-system/Toast"
+import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
+import Modal from "@/components/HotelReservation/MyStay/Modal"
import { isAncillaryError } from "@/components/HotelReservation/MyStay/utils"
-export function useGuaranteePaymentFailedToast() {
- const hasRunOnce = useRef(false)
+import GuaranteeDialog from "../ManageStay/Actions/GuaranteeLateArrival/GuaranteeDialog"
+
+export default function GuaranteePaymentFailed() {
const intl = useIntl()
const searchParams = useSearchParams()
const pathname = usePathname()
const router = useRouter()
+ const [alert, setAlert] = useState<{
+ type: AlertTypeEnum
+ message: string
+ } | null>(null)
+
const getErrorMessage = useCallback(
(errorCode: string | null) => {
switch (errorCode) {
@@ -37,33 +42,36 @@ export function useGuaranteePaymentFailedToast() {
)
useEffect(() => {
- // To prevent multiple toasts in strict mode
- if (hasRunOnce.current) {
- return
- }
const errorCode = searchParams.get("errorCode")
if (!errorCode) {
return
}
- // Ancillary errors are handled in AddAncillaryFlowModal
if (isAncillaryError(searchParams)) {
- hasRunOnce.current = true
return
}
- const errorMessage = getErrorMessage(errorCode)
- const toastType =
+ const message = getErrorMessage(errorCode)
+ const type =
errorCode === BookingErrorCodeEnum.TransactionCancelled
- ? "warning"
- : "error"
+ ? AlertTypeEnum.Warning
+ : AlertTypeEnum.Alarm
- toast[toastType](errorMessage)
+ setAlert({ type, message })
- const queryParams = new URLSearchParams(searchParams.toString())
- queryParams.delete("errorCode")
+ const newParams = new URLSearchParams(searchParams.toString())
+ newParams.delete("errorCode")
- router.push(`${pathname}?${queryParams.toString()}`)
- hasRunOnce.current = true
+ router.replace(`${pathname}?${newParams.toString()}`)
}, [searchParams, pathname, router, getErrorMessage])
+
+ if (!alert) {
+ return null
+ }
+
+ return (
+ setAlert(null)}>
+
+
+ )
}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/form.module.css b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/form.module.css
index f1009d584..c07653c6b 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/form.module.css
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/form.module.css
@@ -13,13 +13,18 @@
gap: var(--Space-x3);
}
-.termsAndConditions {
- color: var(--Text-Secondary);
- display: grid;
+.guarantee {
+ display: flex;
+ flex-direction: column;
gap: var(--Space-x2);
+ background-color: var(--Surface-Secondary-Default);
+ border-radius: var(--Corner-radius-lg);
+ padding: var(--Space-x2);
}
-.termsAndConditions .checkbox span {
+.paymentInfo {
+ display: flex;
+ gap: var(--Space-x1);
align-items: flex-start;
}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx
index 4416362ba..634c20b48 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx
@@ -6,15 +6,13 @@ import { useIntl } from "react-intl"
import { writeGlaToSessionStorage } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/helpers"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
-import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes"
import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation"
-import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
+import { Alert } from "@scandic-hotels/design-system/Alert"
import { Divider } from "@scandic-hotels/design-system/Divider"
-import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { SelectPaymentMethod } from "@scandic-hotels/design-system/Form/SelectPaymentMethod"
+import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
-import Link from "@scandic-hotels/design-system/OldDSLink"
import { toast } from "@scandic-hotels/design-system/Toast"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { trackGlaSaveCardAttempt } from "@scandic-hotels/tracking/payment"
@@ -23,6 +21,7 @@ import { isWebview } from "@/constants/routes/webviews"
import { env } from "@/env/client"
import { useMyStayStore } from "@/stores/my-stay"
+import TermsAndConditions from "@/components/HotelReservation/MyStay/TermsAndConditions"
import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking"
import useLang from "@/hooks/useLang"
import { trackUpdatePaymentMethod } from "@/utils/tracking"
@@ -31,7 +30,12 @@ import { type GuaranteeFormData, paymentSchema } from "./schema"
import styles from "./form.module.css"
-export default function Form() {
+import type { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
+
+interface FormProps {
+ error?: { type: AlertTypeEnum; message: string }
+}
+export default function Form({ error }: FormProps) {
const intl = useIntl()
const lang = useLang()
const pathname = usePathname()
@@ -114,38 +118,6 @@ export default function Form() {
}
}
- const guaranteeMsg = intl.formatMessage(
- {
- id: "myStay.gla.termsAndConditionsMessage",
- defaultMessage:
- "I accept the terms for this stay and the general Booking & Cancellation Terms, and understand Scandic will process my personal data for this stay in accordance with Scandic's Privacy Policy.",
- },
- {
- termsAndConditionsLink: (str) => (
- e.stopPropagation()}
- >
- {str}
-
- ),
- privacyPolicyLink: (str) => (
- e.stopPropagation()}
- >
- {str}
-
- ),
- }
- )
-
return (