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)

22 lines (21 loc) 972 B
import { jsx as m } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"; import { useCallback as a, useMemo as v, useEffect as f } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js"; import { AnalyticsContext as l } from "./AnalyticsContext.js"; import { setupAnalytics as y } from "../setupAnalytics.js"; import { usePushAnalyticEvent as A } from "../../../../hooks/useAnalytics/usePushAnalyticEvent.js"; const C = ({ children: i, componentName: s, analyticsEnabled: t }) => { const e = A(), r = a( (u) => { const { name: p, properties: c } = u; e({ event: p, properties: c || {} }); }, [e] ), { userEvents: n, subscribe: o } = v(() => y({ analyticsEnabled: t, componentName: s }), [t, s]); return f(() => o(r), [o, r]), /* @__PURE__ */ m(l.Provider, { value: n, children: i }); }; export { C as AnalyticsProvider };