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

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