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)

23 lines (22 loc) 826 B
import { useMemo as g } from "../../../../external/preact/hooks/dist/hooks.module.js"; import m from "./usePagination.js"; import { isString as i, isUndefined as a } from "../../../../utils/value/is.js"; const C = (o) => i(o.next), h = (o) => i(o.prev), S = (o, u) => { const c = g(() => { const e = [], P = () => e.length, d = () => { e.length = 0; }, f = (t) => ({ cursor: e[t - 1] }), s = (t, r) => { const n = e[r - 1]; (r === 1 || r === (e.length || 1) + 1) && a(n) && (e[r - 1] = t ? decodeURIComponent(t) : void 0); }; return { getPageCount: P, getPageParams: f, resetPageCount: d, updatePagination: (t, r, n) => { C(n) && s(n.next, t + 1), h(n) && s(n.prev, t - 1); } }; }, []); return m(c, o, u); }; export { S as default, C as hasNextPage, h as hasPrevPage };