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)

19 lines (18 loc) 698 B
import { useMemo as a, useState as w, useCallback as V, useEffect as m } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js"; import { TRANSACTIONS_VIEW_TABS as c } from "../constants.js"; import { TransactionsView as u } from "../types.js"; const C = ({ view: o } = {}) => { const e = a(() => c.find(({ id: t }) => t === o), [o]), i = a(() => e?.id ?? u.TRANSACTIONS, [e]), s = a(() => e ? [e] : c, [e]), [f, r] = w(i), T = V( ({ id: t }) => { const n = s.find((d) => d.id === t)?.id; n && r(n); }, [s] ); return m(() => { r(i); }, [i]), { activeView: f, onViewChange: T, viewTabs: s }; }; export { C as default };