feat: tracking - added discount property and some basics for paymentInfo
This commit is contained in:
@@ -115,7 +115,10 @@ export default function EnterDetailsTracking(props: Props) {
|
|||||||
bedType: bedType?.description,
|
bedType: bedType?.description,
|
||||||
roomTypeCode: bedType?.roomTypeCode,
|
roomTypeCode: bedType?.roomTypeCode,
|
||||||
roomPrice: roomPrice.perStay.local.price,
|
roomPrice: roomPrice.perStay.local.price,
|
||||||
//discount: public - member rates?.
|
discount: roomRate.memberRate
|
||||||
|
? roomRate.publicRate.localPrice.pricePerStay -
|
||||||
|
roomRate.memberRate.localPrice.pricePerStay
|
||||||
|
: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
TrackingChannelEnum,
|
TrackingChannelEnum,
|
||||||
type TrackingSDKHotelInfo,
|
type TrackingSDKHotelInfo,
|
||||||
type TrackingSDKPageData,
|
type TrackingSDKPageData,
|
||||||
|
type TrackingSDKPaymentInfo,
|
||||||
} from "@/types/components/tracking"
|
} from "@/types/components/tracking"
|
||||||
import { CurrencyEnum } from "@/types/enums/currency"
|
import { CurrencyEnum } from "@/types/enums/currency"
|
||||||
|
|
||||||
@@ -69,6 +70,10 @@ export default async function BookingConfirmation({
|
|||||||
bnr: booking.confirmationNumber ?? undefined,
|
bnr: booking.confirmationNumber ?? undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const paymentInfo: TrackingSDKPaymentInfo = {
|
||||||
|
paymentStatus: "confirmed",
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Confirmation booking={booking} hotel={hotel} room={room} />
|
<Confirmation booking={booking} hotel={hotel} room={room} />
|
||||||
@@ -76,6 +81,7 @@ export default async function BookingConfirmation({
|
|||||||
<TrackingSDK
|
<TrackingSDK
|
||||||
pageData={initialPageTrackingData}
|
pageData={initialPageTrackingData}
|
||||||
hotelInfo={initialHotelsTrackingData}
|
hotelInfo={initialHotelsTrackingData}
|
||||||
|
// paymentInfo={null}
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export default function RouterTransition({
|
|||||||
pageData,
|
pageData,
|
||||||
userData,
|
userData,
|
||||||
hotelInfo,
|
hotelInfo,
|
||||||
|
paymentInfo,
|
||||||
}: TrackingSDKProps) {
|
}: TrackingSDKProps) {
|
||||||
const [loading, setLoading] = useOptimistic(false)
|
const [loading, setLoading] = useOptimistic(false)
|
||||||
const [status, setStatus] = useState<TransitionStatus>(
|
const [status, setStatus] = useState<TransitionStatus>(
|
||||||
@@ -64,6 +65,7 @@ export default function RouterTransition({
|
|||||||
pageInfo: pageObject,
|
pageInfo: pageObject,
|
||||||
userInfo: userData,
|
userInfo: userData,
|
||||||
hotelInfo: hotelInfo,
|
hotelInfo: hotelInfo,
|
||||||
|
paymentInfo,
|
||||||
})
|
})
|
||||||
|
|
||||||
perfObserver.disconnect()
|
perfObserver.disconnect()
|
||||||
@@ -76,7 +78,16 @@ export default function RouterTransition({
|
|||||||
hasRunInitial.current = true
|
hasRunInitial.current = true
|
||||||
setHasRun()
|
setHasRun()
|
||||||
}
|
}
|
||||||
}, [pathName, hasRun, setHasRun, hotelInfo, userData, pageData, sessionId])
|
}, [
|
||||||
|
pathName,
|
||||||
|
hasRun,
|
||||||
|
setHasRun,
|
||||||
|
hotelInfo,
|
||||||
|
userData,
|
||||||
|
pageData,
|
||||||
|
sessionId,
|
||||||
|
paymentInfo,
|
||||||
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isTransitioning && status === TransitionStatusEnum.NotRun) {
|
if (isTransitioning && status === TransitionStatusEnum.NotRun) {
|
||||||
@@ -115,6 +126,7 @@ export default function RouterTransition({
|
|||||||
pageInfo: pageObject,
|
pageInfo: pageObject,
|
||||||
userInfo: userData,
|
userInfo: userData,
|
||||||
hotelInfo: hotelInfo,
|
hotelInfo: hotelInfo,
|
||||||
|
paymentInfo,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,6 +143,7 @@ export default function RouterTransition({
|
|||||||
getPageLoadTime,
|
getPageLoadTime,
|
||||||
hasRun,
|
hasRun,
|
||||||
sessionId,
|
sessionId,
|
||||||
|
paymentInfo,
|
||||||
])
|
])
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import RouterTransition from "@/components/TrackingSDK/RouterTransition"
|
|||||||
import type {
|
import type {
|
||||||
TrackingSDKHotelInfo,
|
TrackingSDKHotelInfo,
|
||||||
TrackingSDKPageData,
|
TrackingSDKPageData,
|
||||||
|
TrackingSDKPaymentInfo,
|
||||||
} from "@/types/components/tracking"
|
} from "@/types/components/tracking"
|
||||||
|
|
||||||
export const preloadUserTracking = () => {
|
export const preloadUserTracking = () => {
|
||||||
@@ -14,9 +15,11 @@ export const preloadUserTracking = () => {
|
|||||||
export default async function TrackingSDK({
|
export default async function TrackingSDK({
|
||||||
pageData,
|
pageData,
|
||||||
hotelInfo,
|
hotelInfo,
|
||||||
|
paymentInfo,
|
||||||
}: {
|
}: {
|
||||||
pageData: TrackingSDKPageData
|
pageData: TrackingSDKPageData
|
||||||
hotelInfo?: TrackingSDKHotelInfo
|
hotelInfo?: TrackingSDKHotelInfo
|
||||||
|
paymentInfo?: TrackingSDKPaymentInfo
|
||||||
}) {
|
}) {
|
||||||
const userTrackingData = await getUserTracking()
|
const userTrackingData = await getUserTracking()
|
||||||
|
|
||||||
@@ -25,6 +28,7 @@ export default async function TrackingSDK({
|
|||||||
pageData={pageData}
|
pageData={pageData}
|
||||||
userData={userTrackingData}
|
userData={userTrackingData}
|
||||||
hotelInfo={hotelInfo}
|
hotelInfo={hotelInfo}
|
||||||
|
paymentInfo={paymentInfo}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
4
env/server.ts
vendored
4
env/server.ts
vendored
@@ -93,7 +93,7 @@ export const env = createEnv({
|
|||||||
.refine((s) => s === "true" || s === "false")
|
.refine((s) => s === "true" || s === "false")
|
||||||
// transform to boolean
|
// transform to boolean
|
||||||
.transform((s) => s === "true")
|
.transform((s) => s === "true")
|
||||||
.default("false"),
|
.default("true"),
|
||||||
ENABLE_BOOKING_WIDGET: z
|
ENABLE_BOOKING_WIDGET: z
|
||||||
.string()
|
.string()
|
||||||
// only allow "true" or "false"
|
// only allow "true" or "false"
|
||||||
@@ -107,7 +107,7 @@ export const env = createEnv({
|
|||||||
.refine((s) => s === "true" || s === "false")
|
.refine((s) => s === "true" || s === "false")
|
||||||
// transform to boolean
|
// transform to boolean
|
||||||
.transform((s) => s === "true")
|
.transform((s) => s === "true")
|
||||||
.default("false"),
|
.default("true"),
|
||||||
SHOW_SITE_WIDE_ALERT: z
|
SHOW_SITE_WIDE_ALERT: z
|
||||||
.string()
|
.string()
|
||||||
// only allow "true" or "false"
|
// only allow "true" or "false"
|
||||||
|
|||||||
@@ -84,10 +84,21 @@ export type TrackingSDKHotelInfo = {
|
|||||||
searchType?: "destination" | "hotel"
|
searchType?: "destination" | "hotel"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TrackingSDKPaymentInfo = {
|
||||||
|
edccCurrencyFrom?: string
|
||||||
|
edccCurrencyTo?: string
|
||||||
|
isedcc?: string
|
||||||
|
isSavedCard?: boolean
|
||||||
|
isCreditCard?: boolean
|
||||||
|
paymentStatus?: "confirmed"
|
||||||
|
paymentType?: string
|
||||||
|
}
|
||||||
|
|
||||||
export type TrackingSDKProps = {
|
export type TrackingSDKProps = {
|
||||||
pageData: TrackingSDKPageData
|
pageData: TrackingSDKPageData
|
||||||
userData: TrackingSDKUserData
|
userData: TrackingSDKUserData
|
||||||
hotelInfo?: TrackingSDKHotelInfo
|
hotelInfo?: TrackingSDKHotelInfo
|
||||||
|
paymentInfo?: TrackingSDKPaymentInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TrackingSDKData = TrackingSDKPageData & {
|
export type TrackingSDKData = TrackingSDKPageData & {
|
||||||
|
|||||||
Reference in New Issue
Block a user