Merged in feat/sw-3473-remove-tracking-context (pull request #2843)
feat(SW-3473): Rework booking-flow tracking provider * Remove tracking context and import instead * Remove unused file Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { useCallback, useEffect } from "react"
|
||||
|
||||
import { trackEvent } from "@scandic-hotels/tracking/base"
|
||||
|
||||
import useInitializeFiltersFromUrl from "../../../../hooks/useInitializeFiltersFromUrl"
|
||||
import { useHotelFilterStore } from "../../../../stores/hotel-filters"
|
||||
import { useTrackingContext } from "../../../../trackingContext"
|
||||
import FilterContent from "../FilterContent"
|
||||
|
||||
import type { CategorizedHotelFilters } from "../../../../types"
|
||||
@@ -16,7 +17,6 @@ type HotelFiltersProps = {
|
||||
}
|
||||
|
||||
export default function HotelFilter({ className, filters }: HotelFiltersProps) {
|
||||
const tracking = useTrackingContext()
|
||||
const searchParams = useSearchParams()
|
||||
const pathname = usePathname()
|
||||
useInitializeFiltersFromUrl()
|
||||
@@ -44,18 +44,13 @@ export default function HotelFilter({ className, filters }: HotelFiltersProps) {
|
||||
.map((id) => surroundingsMap.get(id))
|
||||
.join(",")
|
||||
|
||||
tracking.trackGenericEvent({
|
||||
trackEvent({
|
||||
event: "filterUsed",
|
||||
filter: {
|
||||
filtersUsed: `Filters values - hotelfacilities:${hotelFacilitiesFilter}|hotelsurroundings:${hotelSurroundingsFilter}`,
|
||||
},
|
||||
})
|
||||
}, [
|
||||
tracking,
|
||||
activeFilters,
|
||||
filters.facilityFilters,
|
||||
filters.surroundingsFilters,
|
||||
])
|
||||
}, [activeFilters, filters.facilityFilters, filters.surroundingsFilters])
|
||||
|
||||
// Update the URL when the filters changes
|
||||
useEffect(() => {
|
||||
|
||||
@@ -5,8 +5,7 @@ import { useCallback } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import DeprecatedSelect from "@scandic-hotels/design-system/DeprecatedSelect"
|
||||
|
||||
import { useTrackingContext } from "../../../trackingContext"
|
||||
import { trackEvent } from "@scandic-hotels/tracking/base"
|
||||
|
||||
const enum SortOrder {
|
||||
Distance = "distance",
|
||||
@@ -27,7 +26,6 @@ type HotelSorterProps = {
|
||||
}
|
||||
|
||||
export default function HotelSorter({ discreet }: HotelSorterProps) {
|
||||
const tracking = useTrackingContext()
|
||||
const searchParams = useSearchParams()
|
||||
const pathname = usePathname()
|
||||
const intl = useIntl()
|
||||
@@ -41,7 +39,7 @@ export default function HotelSorter({ discreet }: HotelSorterProps) {
|
||||
|
||||
const newSearchParams = new URLSearchParams(searchParams)
|
||||
newSearchParams.set("sort", newSort)
|
||||
tracking.trackGenericEvent({
|
||||
trackEvent({
|
||||
event: "sortOptionClick",
|
||||
filter: {
|
||||
sortOptions: newSort,
|
||||
@@ -53,7 +51,7 @@ export default function HotelSorter({ discreet }: HotelSorterProps) {
|
||||
`${pathname}?${newSearchParams.toString()}`
|
||||
)
|
||||
},
|
||||
[tracking, pathname, searchParams]
|
||||
[pathname, searchParams]
|
||||
)
|
||||
const sortItems: SortItem[] = [
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import Link from "@scandic-hotels/design-system/Link"
|
||||
import { InteractiveMap } from "@scandic-hotels/design-system/Map/InteractiveMap"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { trackEvent } from "@scandic-hotels/tracking/base"
|
||||
|
||||
import { useIsLoggedIn } from "../../../../hooks/useIsLoggedIn"
|
||||
import useLang from "../../../../hooks/useLang"
|
||||
@@ -27,7 +28,6 @@ import {
|
||||
} from "../../../../stores/bookingCode-filter"
|
||||
import { useHotelFilterStore } from "../../../../stores/hotel-filters"
|
||||
import { useHotelsMapStore } from "../../../../stores/hotels-map"
|
||||
import { useTrackingContext } from "../../../../trackingContext"
|
||||
import BookingCodeFilter from "../../../BookingCodeFilter"
|
||||
import { getHotelPins } from "../../../HotelCardDialogListing/utils"
|
||||
import { RoomCardSkeleton } from "../../../RoomCardSkeleton/RoomCardSkeleton"
|
||||
@@ -68,7 +68,6 @@ export function SelectHotelMapContent({
|
||||
const intl = useIntl()
|
||||
const map = useMap()
|
||||
const isUserLoggedIn = useIsLoggedIn()
|
||||
const tracking = useTrackingContext()
|
||||
|
||||
const isAboveMobile = useMediaQuery("(min-width: 900px)")
|
||||
const [visibleHotels, setVisibleHotels] = useState<HotelResponse[]>([])
|
||||
@@ -284,7 +283,7 @@ export function SelectHotelMapContent({
|
||||
return
|
||||
}
|
||||
|
||||
tracking.trackGenericEvent({
|
||||
trackEvent({
|
||||
event: "hotelClickMap",
|
||||
map: {
|
||||
action: "hotel click - map",
|
||||
@@ -297,7 +296,7 @@ export function SelectHotelMapContent({
|
||||
hotelMapStore.activate(args.hotelName)
|
||||
}}
|
||||
onClickHotel={(hotelId) => {
|
||||
tracking.trackGenericEvent({
|
||||
trackEvent({
|
||||
event: "hotelClickMap",
|
||||
map: {
|
||||
action: "hotel click - map",
|
||||
|
||||
Reference in New Issue
Block a user