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)

32 lines (31 loc) 1.21 kB
import { useMemo as h, useEffect as u } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js"; import { useFetch as l } from "../../../../hooks/useFetch.js"; import { getThemePayload as c } from "../components/PaymentLinkSettingsContainer/utils/getThemePayload.js"; import { useConfigContext as g } from "../../../../core/ConfigContext/preact/context.js"; import { EMPTY_OBJECT as p } from "../../../../utils/value/constants.js"; const F = (r, s, f, i, a) => { const { getPayByLinkTheme: e } = g().endpoints, { data: o, error: t, isFetching: m } = l( h( () => ({ fetchOptions: { enabled: !!e && s && !!r, onSuccess: () => { f(!1), a(!1); } }, queryFn: async () => e?.(p, { path: { storeId: r } }) }), [e, r, s, f, a] ) ), n = h(() => !o && !m && !t ? {} : { ...o?.brandName ? { brandName: o?.brandName } : {}, ...o?.logoUrl ? { logo: o?.logoUrl } : {}, ...o?.fullWidthLogoUrl ? { fullWidthLogo: o?.fullWidthLogoUrl } : {} }, [o, m, t]); return u(() => { i(c(n)); }, [n, i]), { theme: n, isFetching: m, error: t }; }; export { F as useStoreTheme };