Merged in fix/SW-1415-my-stay-tracking-hotelId (pull request #1880)
fix(SW-1415): add hotelId in tracking for my stay * fix(SW-1415): add hotelId in tracking for my stay * fix: remove toast if cancel guarantee * fix(SW-1415): rebase master * fix(SW-1415): fix comment shorthand hotelId Approved-by: Christian Andolf
This commit is contained in:
@@ -68,7 +68,7 @@ export default function HandleErrorCallback({
|
|||||||
event: "glaCardSaveFailed",
|
event: "glaCardSaveFailed",
|
||||||
hotelInfo: {
|
hotelInfo: {
|
||||||
hotelId: glaSessionData.hotelId,
|
hotelId: glaSessionData.hotelId,
|
||||||
lateArrivalGuarantee: glaSessionData,
|
lateArrivalGuarantee: glaSessionData.lateArrivalGuarantee,
|
||||||
guaranteedProduct: "room",
|
guaranteedProduct: "room",
|
||||||
},
|
},
|
||||||
paymentInfo: {
|
paymentInfo: {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export default function AddAncillaryFlowModal({
|
|||||||
const addAncillary = trpc.booking.packages.useMutation()
|
const addAncillary = trpc.booking.packages.useMutation()
|
||||||
|
|
||||||
const { guaranteeBooking, isLoading, handleGuaranteeError } =
|
const { guaranteeBooking, isLoading, handleGuaranteeError } =
|
||||||
useGuaranteeBooking(booking.confirmationNumber, true)
|
useGuaranteeBooking(booking.confirmationNumber, true, booking.hotelId)
|
||||||
|
|
||||||
function validateTermsAndConditions(data: AncillaryFormData): boolean {
|
function validateTermsAndConditions(data: AncillaryFormData): boolean {
|
||||||
if (!data.termsAndConditions) {
|
if (!data.termsAndConditions) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { guaranteeCallback } from "@/constants/routes/hotelReservation"
|
|||||||
import { env } from "@/env/client"
|
import { env } from "@/env/client"
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
|
import { writeGlaToSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/helpers"
|
||||||
import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Payment/PaymentOptionsGroup"
|
import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Payment/PaymentOptionsGroup"
|
||||||
import MySavedCards from "@/components/HotelReservation/MySavedCards"
|
import MySavedCards from "@/components/HotelReservation/MySavedCards"
|
||||||
import PaymentOption from "@/components/HotelReservation/PaymentOption"
|
import PaymentOption from "@/components/HotelReservation/PaymentOption"
|
||||||
@@ -59,7 +60,7 @@ export default function Form() {
|
|||||||
const guaranteeRedirectUrl = `${env.NEXT_PUBLIC_NODE_ENV === "development" ? `http://localhost:${env.NEXT_PUBLIC_PORT}` : ""}${guaranteeCallback(lang)}`
|
const guaranteeRedirectUrl = `${env.NEXT_PUBLIC_NODE_ENV === "development" ? `http://localhost:${env.NEXT_PUBLIC_PORT}` : ""}${guaranteeCallback(lang)}`
|
||||||
|
|
||||||
const { guaranteeBooking, isLoading, handleGuaranteeError } =
|
const { guaranteeBooking, isLoading, handleGuaranteeError } =
|
||||||
useGuaranteeBooking(confirmationNumber)
|
useGuaranteeBooking(confirmationNumber, false, hotelId)
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
@@ -82,6 +83,7 @@ export default function Form() {
|
|||||||
cardType: savedCreditCard.cardType,
|
cardType: savedCreditCard.cardType,
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
|
writeGlaToSessionStorage("yes", hotelId)
|
||||||
guaranteeBooking.mutate({
|
guaranteeBooking.mutate({
|
||||||
confirmationNumber,
|
confirmationNumber,
|
||||||
language: lang,
|
language: lang,
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ const retryInterval = 2000
|
|||||||
|
|
||||||
export function useGuaranteeBooking(
|
export function useGuaranteeBooking(
|
||||||
confirmationNumber: string,
|
confirmationNumber: string,
|
||||||
isAncillaryFlow = false
|
isAncillaryFlow = false,
|
||||||
|
hotelId: string
|
||||||
) {
|
) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -26,6 +27,7 @@ export function useGuaranteeBooking(
|
|||||||
trackEvent({
|
trackEvent({
|
||||||
event: "glaCardSaveFailed",
|
event: "glaCardSaveFailed",
|
||||||
hotelInfo: {
|
hotelInfo: {
|
||||||
|
hotelId,
|
||||||
lateArrivalGuarantee: "yes",
|
lateArrivalGuarantee: "yes",
|
||||||
guaranteedProduct: isAncillaryFlow ? "room + ancillary" : "room",
|
guaranteedProduct: isAncillaryFlow ? "room + ancillary" : "room",
|
||||||
},
|
},
|
||||||
@@ -41,7 +43,7 @@ export function useGuaranteeBooking(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[intl, isAncillaryFlow]
|
[intl, isAncillaryFlow, hotelId]
|
||||||
)
|
)
|
||||||
|
|
||||||
const utils = trpc.useUtils()
|
const utils = trpc.useUtils()
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ export function useGuaranteePaymentFailedToast() {
|
|||||||
const getErrorMessage = useCallback(
|
const getErrorMessage = useCallback(
|
||||||
(errorCode: string | null) => {
|
(errorCode: string | null) => {
|
||||||
switch (errorCode) {
|
switch (errorCode) {
|
||||||
case BookingErrorCodeEnum.TransactionCancelled:
|
|
||||||
return intl.formatMessage({
|
|
||||||
defaultMessage:
|
|
||||||
"You have cancelled to process to guarantee your booking.",
|
|
||||||
})
|
|
||||||
case "AncillaryFailed":
|
case "AncillaryFailed":
|
||||||
return intl.formatMessage({
|
return intl.formatMessage({
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
@@ -40,7 +35,8 @@ export function useGuaranteePaymentFailedToast() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const errorCode = searchParams.get("errorCode")
|
const errorCode = searchParams.get("errorCode")
|
||||||
const errorMessage = getErrorMessage(errorCode)
|
const errorMessage = getErrorMessage(errorCode)
|
||||||
if (!errorCode) return
|
if (!errorCode || errorCode === BookingErrorCodeEnum.TransactionCancelled)
|
||||||
|
return
|
||||||
|
|
||||||
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
|
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user