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