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
This commit is contained in:
@@ -17,6 +17,7 @@ interface SummaryCardProps {
|
|||||||
href: string
|
href: string
|
||||||
text: string
|
text: string
|
||||||
icon: React.ReactNode
|
icon: React.ReactNode
|
||||||
|
onClick?: () => void
|
||||||
}[]
|
}[]
|
||||||
chip?: React.ReactNode
|
chip?: React.ReactNode
|
||||||
}
|
}
|
||||||
@@ -59,6 +60,7 @@ export default function SummaryCard({
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
color="burgundy"
|
color="burgundy"
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
|
onClick={link.onClick}
|
||||||
>
|
>
|
||||||
{link.icon}
|
{link.icon}
|
||||||
{link.text}
|
{link.text}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|||||||
import { Toast } from "@/components/TempDesignSystem/Toasts"
|
import { Toast } from "@/components/TempDesignSystem/Toasts"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import { formatPrice } from "@/utils/numberFormatting"
|
import { formatPrice } from "@/utils/numberFormatting"
|
||||||
|
import { trackMyStayPageLink } from "@/utils/tracking"
|
||||||
|
|
||||||
import { useMyStayRoomDetailsStore } from "../stores/myStayRoomDetailsStore"
|
import { useMyStayRoomDetailsStore } from "../stores/myStayRoomDetailsStore"
|
||||||
import { useMyStayTotalPriceStore } from "../stores/myStayTotalPrice"
|
import { useMyStayTotalPriceStore } from "../stores/myStayTotalPrice"
|
||||||
@@ -146,16 +147,19 @@ export default function BookingSummary({
|
|||||||
href: directionsUrl,
|
href: directionsUrl,
|
||||||
text: intl.formatMessage({ id: "Directions" }),
|
text: intl.formatMessage({ id: "Directions" }),
|
||||||
icon: <DirectionsIcon width={20} height={20} color="burgundy" />,
|
icon: <DirectionsIcon width={20} height={20} color="burgundy" />,
|
||||||
|
onClick: () => trackMyStayPageLink("see on map"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: `mailto:${hotel.contactInformation.email}`,
|
href: `mailto:${hotel.contactInformation.email}`,
|
||||||
text: intl.formatMessage({ id: "Email" }),
|
text: intl.formatMessage({ id: "Email" }),
|
||||||
icon: <EmailIcon width={20} height={20} color="burgundy" />,
|
icon: <EmailIcon width={20} height={20} color="burgundy" />,
|
||||||
|
onClick: () => trackMyStayPageLink("email us"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: hotel.contactInformation.websiteUrl,
|
href: hotel.contactInformation.websiteUrl,
|
||||||
text: intl.formatMessage({ id: "Homepage" }),
|
text: intl.formatMessage({ id: "Homepage" }),
|
||||||
icon: <LinkIcon width={20} height={20} color="burgundy" />,
|
icon: <LinkIcon width={20} height={20} color="burgundy" />,
|
||||||
|
onClick: () => trackMyStayPageLink("hotel homepage"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useIntl } from "react-intl"
|
|||||||
|
|
||||||
import { CalendarAddIcon } from "@/components/Icons"
|
import { CalendarAddIcon } from "@/components/Icons"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
|
import { trackMyStayPageLink } from "@/utils/tracking"
|
||||||
|
|
||||||
import styles from "../actionPanel.module.css"
|
import styles from "../actionPanel.module.css"
|
||||||
|
|
||||||
@@ -14,13 +15,18 @@ export default function AddToCalendarButton({
|
|||||||
}) {
|
}) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
|
const handleAddToCalendar = () => {
|
||||||
|
trackMyStayPageLink("add to calendar")
|
||||||
|
onPress()
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="icon"
|
variant="icon"
|
||||||
intent="text"
|
intent="text"
|
||||||
theme="base"
|
theme="base"
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
onPress={onPress}
|
onPress={handleAddToCalendar}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: "Add to calendar" })}
|
{intl.formatMessage({ id: "Add to calendar" })}
|
||||||
<CalendarAddIcon width={24} height={24} color="burgundy" />
|
<CalendarAddIcon width={24} height={24} color="burgundy" />
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { trpc } from "@/lib/trpc/client"
|
|||||||
import { useManageStayStore } from "@/components/HotelReservation/MyStay/stores/manageStayStore"
|
import { useManageStayStore } from "@/components/HotelReservation/MyStay/stores/manageStayStore"
|
||||||
import { toast } from "@/components/TempDesignSystem/Toasts"
|
import { toast } from "@/components/TempDesignSystem/Toasts"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
import { trackCancelStay } from "@/utils/tracking"
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
CancelStayFormValues,
|
CancelStayFormValues,
|
||||||
@@ -90,6 +91,7 @@ export default function useCancelStay({
|
|||||||
{ currency: booking.currencyCode }
|
{ currency: booking.currencyCode }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
trackCancelStay(booking.hotelId, booking.confirmationNumber)
|
||||||
} else if (results.length > 0 && errors.length > 0) {
|
} else if (results.length > 0 && errors.length > 0) {
|
||||||
setBookingStatus()
|
setBookingStatus()
|
||||||
toast.warning(
|
toast.warning(
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import Body from "@/components/TempDesignSystem/Text/Body"
|
|||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
import { trackMyStayPageLink } from "@/utils/tracking"
|
||||||
|
|
||||||
import { useManageStayStore } from "../../stores/manageStayStore"
|
import { useManageStayStore } from "../../stores/manageStayStore"
|
||||||
import AddToCalendarButton from "./Actions/AddToCalendarButton"
|
import AddToCalendarButton from "./Actions/AddToCalendarButton"
|
||||||
@@ -75,12 +76,35 @@ export default function ActionPanel({
|
|||||||
url: hotel.contactInformation.websiteUrl,
|
url: hotel.contactInformation.websiteUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleModifyStay = () => {
|
||||||
|
trackMyStayPageLink("modify dates")
|
||||||
|
setActiveView("modifyStay")
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCancelStay = () => {
|
||||||
|
trackMyStayPageLink("cancel booking")
|
||||||
|
setActiveView("cancelStay")
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDownloadInvoice = () => {
|
||||||
|
trackMyStayPageLink("download invoice")
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleGuaranteeLateArrival = () => {
|
||||||
|
trackMyStayPageLink("guarantee late arrival")
|
||||||
|
onGuaranteeClick()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCustomerSupport = () => {
|
||||||
|
trackMyStayPageLink("customer support")
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.actionPanel}>
|
<div className={styles.actionPanel}>
|
||||||
<div className={styles.menu}>
|
<div className={styles.menu}>
|
||||||
<Button
|
<Button
|
||||||
variant="icon"
|
variant="icon"
|
||||||
onClick={() => setActiveView("modifyStay")}
|
onClick={handleModifyStay}
|
||||||
intent="text"
|
intent="text"
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
>
|
>
|
||||||
@@ -90,7 +114,7 @@ export default function ActionPanel({
|
|||||||
{showGuaranteeButton && (
|
{showGuaranteeButton && (
|
||||||
<Button
|
<Button
|
||||||
variant="icon"
|
variant="icon"
|
||||||
onClick={onGuaranteeClick}
|
onClick={handleGuaranteeLateArrival}
|
||||||
intent="text"
|
intent="text"
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
>
|
>
|
||||||
@@ -106,7 +130,7 @@ export default function ActionPanel({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="icon"
|
variant="icon"
|
||||||
onClick={() => {}}
|
onClick={handleDownloadInvoice}
|
||||||
intent="text"
|
intent="text"
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
>
|
>
|
||||||
@@ -116,7 +140,7 @@ export default function ActionPanel({
|
|||||||
{showCancelStayButton && (
|
{showCancelStayButton && (
|
||||||
<Button
|
<Button
|
||||||
variant="icon"
|
variant="icon"
|
||||||
onClick={() => setActiveView("cancelStay")}
|
onClick={handleCancelStay}
|
||||||
intent="text"
|
intent="text"
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
>
|
>
|
||||||
@@ -154,6 +178,7 @@ export default function ActionPanel({
|
|||||||
href={customerService[lang]}
|
href={customerService[lang]}
|
||||||
variant="icon"
|
variant="icon"
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
|
onClick={handleCustomerSupport}
|
||||||
>
|
>
|
||||||
<Caption color="burgundy">
|
<Caption color="burgundy">
|
||||||
{intl.formatMessage({ id: "Customer support" })}
|
{intl.formatMessage({ id: "Customer support" })}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ export { trackClick } from "./base"
|
|||||||
export { trackLowestRoomPrice } from "./booking"
|
export { trackLowestRoomPrice } from "./booking"
|
||||||
export { trackAccordionClick, trackOpenSidePeekEvent } from "./componentEvents"
|
export { trackAccordionClick, trackOpenSidePeekEvent } from "./componentEvents"
|
||||||
export { trackHotelMapClick, trackHotelTabClick } from "./hotelPage"
|
export { trackHotelMapClick, trackHotelTabClick } from "./hotelPage"
|
||||||
|
export { trackCancelStay, trackMyStayPageLink } from "./myStay"
|
||||||
export {
|
export {
|
||||||
trackFooterClick,
|
trackFooterClick,
|
||||||
trackLoginClick,
|
trackLoginClick,
|
||||||
|
|||||||
20
apps/scandic-web/utils/tracking/myStay.ts
Normal file
20
apps/scandic-web/utils/tracking/myStay.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { trackEvent } from "./base"
|
||||||
|
|
||||||
|
export function trackCancelStay(hotelId: string, bnr: string) {
|
||||||
|
trackEvent({
|
||||||
|
event: "BookingCancellations",
|
||||||
|
hotelInfo: {
|
||||||
|
hotelId: hotelId,
|
||||||
|
bnr: bnr,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trackMyStayPageLink(ctaName: string) {
|
||||||
|
trackEvent({
|
||||||
|
event: "confirmationPageLinks",
|
||||||
|
cta: {
|
||||||
|
name: ctaName,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user