@adyen/adyen-platform-experience-web
Version:

19 lines (18 loc) • 698 B
JavaScript
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
};