UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

28 lines (27 loc) 1.27 kB
try { let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack; n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "fbe6879a-aef0-4eb0-bad9-86510a31cabe", e._sentryDebugIdIdentifier = "sentry-dbid-fbe6879a-aef0-4eb0-bad9-86510a31cabe"); } catch (e) {} import { n as httpGet, s as useApiContext } from "./http-D1NDkBxF.js"; import { useQuery } from "@tanstack/preact-query"; //#region src/api/businessLines/useBusinessLines.ts var getBusinessLines = async (legalEntityId, baseUrl) => { return httpGet({ baseUrl, path: `legalEntities/${legalEntityId}/businessLines` }); }; /** * @param options additional options passed to Tanstack Query, eg; refetchInterval for polling */ var useBusinessLines = (businessLineType, options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useQuery({ queryKey: ["businessLines"], queryFn: () => getBusinessLines(rootLegalEntityId.value, baseUrl.value), select: (businessLines) => businessLines.filter((businessLine) => businessLineType.includes(businessLine.service)), ...options }); }; //#endregion export { useBusinessLines as t };