PR Fixes
This commit is contained in:
+9
-2
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
PaymentEvent,
|
||||
PaymentFailEvent,
|
||||
TrackingPosition,
|
||||
TrackingSDKData,
|
||||
} from "@/types/components/tracking"
|
||||
@@ -75,13 +76,15 @@ export function trackPaymentEvent(paymentEvent: PaymentEvent) {
|
||||
status: "attempt",
|
||||
type: paymentEvent.method,
|
||||
smsEnable: paymentEvent.smsEnable,
|
||||
errorMessage: paymentEvent.errorMessage,
|
||||
errorMessage: isPaymentFailEvent(paymentEvent)
|
||||
? paymentEvent.errorMessage
|
||||
: undefined,
|
||||
},
|
||||
}
|
||||
pushToDataLayer(paymentAttempt)
|
||||
}
|
||||
|
||||
function pushToDataLayer(data: any) {
|
||||
export function pushToDataLayer(data: any) {
|
||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||
window.adobeDataLayer.push(data)
|
||||
}
|
||||
@@ -110,3 +113,7 @@ function convertSlashToPipe(url: string) {
|
||||
const formattedUrl = url.startsWith("/") ? url.slice(1) : url
|
||||
return formattedUrl.replaceAll("/", "|")
|
||||
}
|
||||
|
||||
function isPaymentFailEvent(event: PaymentEvent): event is PaymentFailEvent {
|
||||
return "errorMessage" in event
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user