Feat/SW-1996 tracking gla my stay * feat(SW-1996): tracking gla my stay * feat(SW-1996): update gla tracking * feat(SW-1996): update gla tracking * feat(SW-1996): fix comment * feat(SW-1996): fix camelCase Approved-by: Niclas Edenvin Approved-by: Erik Tiekstra
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { PaymentMethodEnum } from "@/constants/booking"
|
|
|
|
import { trackEvent } from "./base"
|
|
|
|
import type { CreditCard } from "@/types/user"
|
|
|
|
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,
|
|
},
|
|
})
|
|
}
|
|
|
|
type LateArrivalGuarantee = "mandatory" | "yes" | "no" | "na"
|
|
|
|
export function trackGlaSaveCardAttempt(
|
|
hotelId: string,
|
|
paymentMethod: string | null,
|
|
savedCreditCard: CreditCard | undefined,
|
|
lateArrivalGuarantee: LateArrivalGuarantee
|
|
) {
|
|
trackEvent({
|
|
event: "glaCardSaveAttempt",
|
|
hotelInfo: {
|
|
hotelId,
|
|
lateArrivalGuarantee,
|
|
guaranteedProduct: "room",
|
|
},
|
|
paymentInfo: {
|
|
isCreditCard: paymentMethod === PaymentMethodEnum.card,
|
|
isSavedCreditCard: !!savedCreditCard,
|
|
status: "glacardsaveattempt",
|
|
type: savedCreditCard?.cardType,
|
|
},
|
|
})
|
|
}
|