@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.
27 lines (26 loc) • 1.33 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] = "df0a4caa-c002-4731-9404-07ec9eb2bec5", e._sentryDebugIdIdentifier = "sentry-dbid-df0a4caa-c002-4731-9404-07ec9eb2bec5");
} catch (e) {}
import { i as useAnalyticsContext } from "./Modal-BLP2aF-u.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, additionalData) {
const userEvents = useAnalyticsContext();
const oldTaskTypeRef = useRef(void 0);
if (taskType && oldTaskTypeRef.current !== taskType) {
userEvents.updateBaseTrackingPayload({ task: taskType });
userEvents.addTaskEvent("Landed on page", {
actionType: "start",
...additionalData && { additionalData }
});
oldTaskTypeRef.current = taskType;
}
}
//#endregion
export { useTaskLandedEvent as t };