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} />