@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
24 lines (23 loc) • 1.27 kB
JavaScript
try {
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "9c2df234-630f-4d32-9f94-f13f23039011", e._sentryDebugIdIdentifier = "sentry-dbid-9c2df234-630f-4d32-9f94-f13f23039011");
} catch (e) {}
import { t as useAnalyticsContext } from "./useAnalyticsContext-BVFDMrVE.js";
import { useRef } from "preact/hooks";
//#region src/hooks/useTaskLandedEvent.ts
/**
* Hook that automatically sends a "Landed on page" analytic event on task mount & initializes event task type.
* Used on dropin level (i.e. Business Details, Individual, Business Financing etc.) to track visits.
* This centralizes the common analytics pattern used across form components.
*/
function useTaskLandedEvent(taskType) {
const userEvents = useAnalyticsContext();
const oldTaskTypeRef = useRef(void 0);
if (taskType && oldTaskTypeRef.current !== taskType) {
userEvents.updateBaseTrackingPayload({ task: taskType });
userEvents.addTaskEvent("Landed on page", { actionType: "start" });
oldTaskTypeRef.current = taskType;
}
}
//#endregion
export { useTaskLandedEvent as t };