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)

18 lines (17 loc) 948 B
import { useMemo as e } from "../../../external/preact/hooks/dist/hooks.module.js"; import d from "../../../core/Context/useCoreContext.js"; import M from "../../../hooks/useTimezoneAwareDateFormatting.js"; import { getPaymentMethodType as h, getDisplayablePaymentMethod as l } from "./utils.js"; import { DATE_FORMAT_TRANSACTION_DETAILS as C } from "../../../constants/dateFormats.js"; const P = ({ timezone: a, paymentMethodData: n, bankAccount: m, amountData: o, createdAt: r }) => { const t = e(() => ({ paymentMethod: n, bankAccount: m }), [n, m]), { i18n: s } = d(), { dateFormat: u } = M(a), i = e(() => { if (o) { const { currency: p, value: f } = o; return `${s.amount(f, p, { hideCurrency: !0 })} ${p}`; } }, [o, s]), y = e(() => h(t), [t]), T = e(() => l(t), [t]), c = e(() => r && u(new Date(r), C), [r, u]); return { amount: i, date: c, paymentMethod: T, paymentMethodType: y }; }; export { P as default };