From 2bc14a6eebe8dde4a9deee980ce6eb6a8a9b8734 Mon Sep 17 00:00:00 2001 From: Pontus Dreij Date: Fri, 21 Mar 2025 07:24:01 +0000 Subject: [PATCH] Merged in feat(SW-1993)-tracking-mystay-cancellation (pull request #1588) Feat(SW-1993) tracking mystay * feat(SW-1993) added trackEvent for cancelStay and mypagelink * feat(SW-1993) implement trackCancelStay and trackMyStayPageLink Approved-by: Linus Flood --- .../BookingSummary/SummaryCard/index.tsx | 2 ++ .../MyStay/BookingSummary/index.tsx | 4 +++ .../Actions/AddToCalendarButton.tsx | 8 ++++- .../Actions/CancelStay/hooks/useCancelStay.ts | 2 ++ .../MyStay/ManageStay/ActionPanel/index.tsx | 33 ++++++++++++++++--- apps/scandic-web/utils/tracking/index.ts | 1 + apps/scandic-web/utils/tracking/myStay.ts | 20 +++++++++++ 7 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 apps/scandic-web/utils/tracking/myStay.ts diff --git a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/SummaryCard/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/SummaryCard/index.tsx index 3314861b1..4c8e77203 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/SummaryCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/SummaryCard/index.tsx @@ -17,6 +17,7 @@ interface SummaryCardProps { href: string text: string icon: React.ReactNode + onClick?: () => void }[] chip?: React.ReactNode } @@ -59,6 +60,7 @@ export default function SummaryCard({ target="_blank" color="burgundy" className={styles.link} + onClick={link.onClick} > {link.icon} {link.text} diff --git a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx index 174458ccc..bbeae8dbf 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx @@ -19,6 +19,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { Toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import { formatPrice } from "@/utils/numberFormatting" +import { trackMyStayPageLink } from "@/utils/tracking" import { useMyStayRoomDetailsStore } from "../stores/myStayRoomDetailsStore" import { useMyStayTotalPriceStore } from "../stores/myStayTotalPrice" @@ -146,16 +147,19 @@ export default function BookingSummary({ href: directionsUrl, text: intl.formatMessage({ id: "Directions" }), icon: , + onClick: () => trackMyStayPageLink("see on map"), }, { href: `mailto:${hotel.contactInformation.email}`, text: intl.formatMessage({ id: "Email" }), icon: , + onClick: () => trackMyStayPageLink("email us"), }, { href: hotel.contactInformation.websiteUrl, text: intl.formatMessage({ id: "Homepage" }), icon: , + onClick: () => trackMyStayPageLink("hotel homepage"), }, ]} /> diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/AddToCalendarButton.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/AddToCalendarButton.tsx index 5bb3066b8..315d7502a 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/AddToCalendarButton.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/AddToCalendarButton.tsx @@ -4,6 +4,7 @@ import { useIntl } from "react-intl" import { CalendarAddIcon } from "@/components/Icons" import Button from "@/components/TempDesignSystem/Button" +import { trackMyStayPageLink } from "@/utils/tracking" import styles from "../actionPanel.module.css" @@ -14,13 +15,18 @@ export default function AddToCalendarButton({ }) { const intl = useIntl() + const handleAddToCalendar = () => { + trackMyStayPageLink("add to calendar") + onPress() + } + return (