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)

47 lines (46 loc) 1.11 kB
import b from "./session/utils/sessionAwareComponentAvailability/sessionAwareComponentAvailability.js"; import { isWatchlistUnsubscribeToken as f } from "../../primitives/reactive/watchlist/main.js"; import { noop as l } from "../../utils/common.js"; function a(e) { const { context: n, http: t, refresh: r } = e; return { ...n, http: t, refresh: r }; } function m(e, n) { return b(e, n); } function g(e, n, t = m) { let r; return { connect(u) { let o = !0, i = l; const c = () => { i(), o && (i = p(e, { onContextChange: u, onUnsubscribe: c })); }; return c(), t(n, e).then((s) => { !o || r === s || (r = s, u()); }), () => { o = !1, i(); }; }, getSnapshot() { return { contextValue: a(e), hasPermission: r }; } }; } function p(e, n) { return e.subscribe((t) => { f(t) ? n.onUnsubscribe() : n.onContextChange(); }); } export { m as checkComponentPermission, a as createConfigContextValue, g as createConfigController, p as subscribeToSession };