UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

37 lines (36 loc) 945 B
import { useCallback as c } from "../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js"; import a from "../useMutation/useMutation.js"; import { encodeAnalyticsEvent as i } from "../../core/Analytics/analytics/utils.js"; import { useConfigContext as m } from "../../core/ConfigContext/preact/context.js"; import { EMPTY_OBJECT as p } from "../../utils/value/constants.js"; const E = () => { const { sendTrackEvent: s } = m().endpoints, { mutate: o } = a({ queryFn: s }), n = c( (t, e) => o?.( { body: t.toString(), contentType: "application/x-www-form-urlencoded", keepalive: !0 }, { ...e ? { query: { component: e } } : p } ), [o] ); return c( (t) => { const e = t.properties.componentName, r = i(t); r && n(r, e); }, [n] ); }; export { E as usePushAnalyticEvent };