Merged in fix/SW-2853-tracking-breakfast-ancillaries (pull request #2188)

fix(SW-2853): tracking for breakfast ancillaries

* fix(SW-2853): tracking for breakfast ancillaries

* fix(SW-2853): viewAncillary event fix for breakfast

* fix(SW-2853): pr comment spread room facilities


Approved-by: Tobias Johansson
This commit is contained in:
Bianca Widstam
2025-05-22 10:05:54 +00:00
parent 818c1a3bcf
commit c4229c2dd2
10 changed files with 183 additions and 48 deletions

View File

@@ -32,6 +32,7 @@ export default function ActionButtons({
selectDeliveryTime,
selectQuantityAndDeliveryTime,
selectedAncillary,
breakfastData,
} = useAddAncillaryStore((state) => ({
currentStep: state.currentStep,
isBreakfast: state.isBreakfast,
@@ -41,6 +42,7 @@ export default function ActionButtons({
selectDeliveryTime: state.selectDeliveryTime,
selectQuantityAndDeliveryTime: state.selectQuantityAndDeliveryTime,
selectedAncillary: state.selectedAncillary,
breakfastData: state.breakfastData,
}))
const isMobile = useMediaQuery("(max-width: 767px)")
const { setError } = useFormContext()
@@ -69,7 +71,8 @@ export default function ActionButtons({
trackAddAncillary(
selectedAncillary,
quantityWithCard,
quantityWithPoints
quantityWithPoints,
breakfastData
)
if (isMobile) {
selectQuantityAndDeliveryTime()

View File

@@ -162,6 +162,7 @@ export default function AddAncillaryFlowModal({
data.deliveryTime,
"ancillary",
selectedAncillary,
breakfastData,
booking.guaranteeInfo?.cardType,
booking.roomTypeCode
)
@@ -180,12 +181,22 @@ export default function AddAncillaryFlowModal({
})
router.refresh()
} else {
trackAncillaryFailed(packages, data.deliveryTime, selectedAncillary)
trackAncillaryFailed(
packages,
data.deliveryTime,
selectedAncillary,
breakfastData
)
toast.error(ancillaryErrorMessage)
}
},
onError: () => {
trackAncillaryFailed(packages, data.deliveryTime, selectedAncillary)
trackAncillaryFailed(
packages,
data.deliveryTime,
selectedAncillary,
breakfastData
)
toast.error(ancillaryErrorMessage)
},
}
@@ -200,7 +211,8 @@ export default function AddAncillaryFlowModal({
savedCreditCard,
packages,
selectedAncillary,
data.deliveryTime
data.deliveryTime,
breakfastData
)
if (booking.refId) {
const card = savedCreditCard
@@ -270,6 +282,7 @@ export default function AddAncillaryFlowModal({
selectedAncillary,
packages: packagesToAdd,
isBreakfast,
breakfastData,
})
const shouldSkipGuarantee =
booking.guaranteeInfo || (data.quantityWithCard ?? 0) <= 0

View File

@@ -13,14 +13,17 @@ export default function WrappedAncillaryCard({
ancillary,
}: WrappedAncillaryProps) {
const { description, ...ancillaryWithoutDescription } = ancillary
const selectAncillary = useAddAncillaryStore((state) => state.selectAncillary)
const { selectAncillary, booking } = useAddAncillaryStore((state) => ({
selectAncillary: state.selectAncillary,
booking: state.booking,
}))
return (
<div
role="button"
onClick={() => {
selectAncillary(ancillary)
trackViewAncillary(ancillary)
trackViewAncillary(ancillary, booking)
}}
>
<AncillaryCard ancillary={ancillaryWithoutDescription} />

View File

@@ -20,12 +20,14 @@ export default function RemoveButton({
title,
booking,
ancillary,
addedBreakfastPackages,
}: {
refId: string
codes: string[]
title?: string
booking: Room
ancillary: PackageSchema
addedBreakfastPackages: PackageSchema[] | undefined
}) {
const lang = useLang()
const intl = useIntl()
@@ -75,7 +77,8 @@ export default function RemoveButton({
trackRemoveAncillary(
ancillary,
booking.hotelId,
booking.ancillary?.deliveryTime
booking.ancillary?.deliveryTime,
addedBreakfastPackages
)
router.refresh()

View File

@@ -137,6 +137,7 @@ export function AddedAncillaries({
title={ancillaryTitle}
booking={booking}
ancillary={ancillary}
addedBreakfastPackages={addedBreakfastPackages}
/>
</div>
) : null}
@@ -205,6 +206,7 @@ export function AddedAncillaries({
title={ancillaryTitle}
booking={booking}
ancillary={ancillary}
addedBreakfastPackages={addedBreakfastPackages}
/>
</div>
) : null}

View File

@@ -47,7 +47,7 @@ export default function GuaranteeAncillaryHandler({
return
}
const { formData, selectedAncillary, packages } = sessionData
const { formData, selectedAncillary, packages, breakfastData } = sessionData
addAncillary.mutate(
{
@@ -67,7 +67,8 @@ export default function GuaranteeAncillaryHandler({
packages,
formData.deliveryTime,
"room + ancillary",
selectedAncillary
selectedAncillary,
breakfastData
)
clearAncillarySessionData()
router.replace(returnUrl)
@@ -75,7 +76,8 @@ export default function GuaranteeAncillaryHandler({
trackAncillaryFailed(
packages,
formData.deliveryTime,
selectedAncillary
selectedAncillary,
breakfastData
)
router.replace(`${returnUrl}&errorCode=AncillaryFailed`)
}
@@ -84,7 +86,8 @@ export default function GuaranteeAncillaryHandler({
trackAncillaryFailed(
packages,
formData.deliveryTime,
selectedAncillary
selectedAncillary,
breakfastData
)
router.replace(`${returnUrl}&errorCode=AncillaryFailed`)
},