import { jsx } from "react/jsx-runtime";
import "react";
import { useApp } from "../../../application/index.mjs";
import { useCurrentUserContext } from "../../../user/index.mjs";
const TrackingLink = (param)=>{
    let { href, trackingKey = 'link', children, target = '_blank', rel = 'noreferrer' } = param;
    var _currentUserContext_data;
    const app = useApp();
    const currentUserContext = useCurrentUserContext();
    const currentUser = null == currentUserContext ? void 0 : null == (_currentUserContext_data = currentUserContext.data) ? void 0 : _currentUserContext_data.data;
    const handleClick = ()=>{
        app.trackingManager.logEvent('click', trackingKey, {
            href,
            userId: null == currentUser ? void 0 : currentUser.id
        });
    };
    return /*#__PURE__*/ jsx("a", {
        href: href,
        target: target,
        rel: rel,
        onClick: handleClick,
        children: children
    });
};
export { TrackingLink };
