Payment method update
This commit is contained in:
@@ -107,7 +107,7 @@ export default function EnterDetailsTracking(props: Props) {
|
|||||||
rateCodeType: rate?.rateType,
|
rateCodeType: rate?.rateType,
|
||||||
rateCodeName: rate?.rateCode,
|
rateCodeName: rate?.rateCode,
|
||||||
rateCodeCancellationRule: cancellationRule,
|
rateCodeCancellationRule: cancellationRule,
|
||||||
revenueCurrencyCode: rate?.requestedPrice?.currency,
|
revenueCurrencyCode: totalPrice.local?.currency,
|
||||||
breakfastOption: breakfast ? "breakfast buffet" : "no breakfast",
|
breakfastOption: breakfast ? "breakfast buffet" : "no breakfast",
|
||||||
totalPrice: totalPrice.local?.price,
|
totalPrice: totalPrice.local?.price,
|
||||||
specialRoomType: getSpecialRoomType(packages),
|
specialRoomType: getSpecialRoomType(packages),
|
||||||
@@ -123,8 +123,9 @@ export default function EnterDetailsTracking(props: Props) {
|
|||||||
roomRate.publicRate,
|
roomRate.publicRate,
|
||||||
initialHotelsTrackingData,
|
initialHotelsTrackingData,
|
||||||
cancellationRule,
|
cancellationRule,
|
||||||
breakfast,
|
totalPrice.local?.currency,
|
||||||
totalPrice.local?.price,
|
totalPrice.local?.price,
|
||||||
|
breakfast,
|
||||||
packages,
|
packages,
|
||||||
selectedRoom.roomType,
|
selectedRoom.roomType,
|
||||||
bedType?.description,
|
bedType?.description,
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ export default function PaymentClient({
|
|||||||
newPrice: number
|
newPrice: number
|
||||||
} | null>()
|
} | null>()
|
||||||
|
|
||||||
|
const { toDate, fromDate, rooms, hotel } = booking
|
||||||
|
|
||||||
usePaymentFailedToast()
|
usePaymentFailedToast()
|
||||||
|
|
||||||
const methods = useForm<PaymentFormData>({
|
const methods = useForm<PaymentFormData>({
|
||||||
@@ -192,7 +194,6 @@ export default function PaymentClient({
|
|||||||
dateOfBirth,
|
dateOfBirth,
|
||||||
zipCode,
|
zipCode,
|
||||||
} = userData
|
} = userData
|
||||||
const { toDate, fromDate, rooms, hotel } = booking
|
|
||||||
|
|
||||||
// set payment method to card if saved card is submitted
|
// set payment method to card if saved card is submitted
|
||||||
const paymentMethod = isPaymentMethodEnum(data.paymentMethod)
|
const paymentMethod = isPaymentMethodEnum(data.paymentMethod)
|
||||||
@@ -260,15 +261,18 @@ export default function PaymentClient({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
breakfast,
|
|
||||||
bedType,
|
|
||||||
userData,
|
userData,
|
||||||
booking,
|
|
||||||
roomPrice,
|
|
||||||
savedCreditCards,
|
savedCreditCards,
|
||||||
lang,
|
lang,
|
||||||
user,
|
|
||||||
initiateBooking,
|
initiateBooking,
|
||||||
|
hotel,
|
||||||
|
fromDate,
|
||||||
|
toDate,
|
||||||
|
rooms,
|
||||||
|
user,
|
||||||
|
bedType,
|
||||||
|
breakfast,
|
||||||
|
roomPrice,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -318,6 +322,7 @@ export default function PaymentClient({
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
cardNumber={savedCreditCard.truncatedNumber}
|
cardNumber={savedCreditCard.truncatedNumber}
|
||||||
|
hotelId={hotel}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -334,6 +339,7 @@ export default function PaymentClient({
|
|||||||
name="paymentMethod"
|
name="paymentMethod"
|
||||||
value={PaymentMethodEnum.card}
|
value={PaymentMethodEnum.card}
|
||||||
label={intl.formatMessage({ id: "Credit card" })}
|
label={intl.formatMessage({ id: "Credit card" })}
|
||||||
|
hotelId={hotel}
|
||||||
/>
|
/>
|
||||||
{availablePaymentOptions.map((paymentMethod) => (
|
{availablePaymentOptions.map((paymentMethod) => (
|
||||||
<PaymentOption
|
<PaymentOption
|
||||||
@@ -343,6 +349,7 @@ export default function PaymentClient({
|
|||||||
label={
|
label={
|
||||||
PAYMENT_METHOD_TITLES[paymentMethod as PaymentMethodEnum]
|
PAYMENT_METHOD_TITLES[paymentMethod as PaymentMethodEnum]
|
||||||
}
|
}
|
||||||
|
hotelId={hotel}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { PAYMENT_METHOD_ICONS, PaymentMethodEnum } from "@/constants/booking"
|
|||||||
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
import { trackUpdatePaymentMethod } from "@/utils/tracking"
|
||||||
|
|
||||||
import { PaymentOptionProps } from "./paymentOption"
|
import { PaymentOptionProps } from "./paymentOption"
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ export default function PaymentOption({
|
|||||||
type="radio"
|
type="radio"
|
||||||
id={value}
|
id={value}
|
||||||
value={value}
|
value={value}
|
||||||
|
onClick={() => trackUpdatePaymentMethod("", value)}
|
||||||
{...register(name, registerOptions)}
|
{...register(name, registerOptions)}
|
||||||
/>
|
/>
|
||||||
<span className={styles.radio} />
|
<span className={styles.radio} />
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ export interface PaymentOptionProps {
|
|||||||
cardNumber?: string
|
cardNumber?: string
|
||||||
registerOptions?: RegisterOptions
|
registerOptions?: RegisterOptions
|
||||||
onChange?: () => void
|
onChange?: () => void
|
||||||
|
hotelId: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,49 @@
|
|||||||
import { TrackingPosition, TrackingSDKData } from "@/types/components/tracking"
|
import { TrackingPosition, TrackingSDKData } from "@/types/components/tracking"
|
||||||
|
|
||||||
export function trackClick(name: string) {
|
export function trackClick(name: string) {
|
||||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
pushToDataLayer({
|
||||||
window.adobeDataLayer.push({
|
event: "linkClick",
|
||||||
event: "linkClick",
|
cta: {
|
||||||
cta: {
|
name,
|
||||||
name,
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function trackPageViewStart() {
|
export function trackPageViewStart() {
|
||||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
pushToDataLayer({
|
||||||
window.adobeDataLayer.push({
|
event: "pageViewStart",
|
||||||
event: "pageViewStart",
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function trackLoginClick(position: TrackingPosition) {
|
export function trackLoginClick(position: TrackingPosition) {
|
||||||
|
const loginEvent = {
|
||||||
|
event: "loginStart",
|
||||||
|
login: {
|
||||||
|
position,
|
||||||
|
action: "login start",
|
||||||
|
ctaName: "login",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
pushToDataLayer(loginEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trackUpdatePaymentMethod(hotelId: string, method: string) {
|
||||||
|
const paymentSelectionEvent = {
|
||||||
|
event: "paymentSelection",
|
||||||
|
hotelInfo: {
|
||||||
|
hotelId: hotelId,
|
||||||
|
},
|
||||||
|
cta: {
|
||||||
|
name: method,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
pushToDataLayer(paymentSelectionEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushToDataLayer(data: any) {
|
||||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||||
const loginEvent = {
|
console.log("TRACKING: Pushing to datalayer", data)
|
||||||
event: "loginStart",
|
window.adobeDataLayer.push(data)
|
||||||
login: {
|
|
||||||
position,
|
|
||||||
action: "login start",
|
|
||||||
ctaName: "login",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
window.adobeDataLayer.push(loginEvent)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user