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.

45 lines (44 loc) 2.32 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] = "91724fef-8128-4972-8691-1d22b3e19060", e._sentryDebugIdIdentifier = "sentry-dbid-91724fef-8128-4972-8691-1d22b3e19060"); } catch (e) {} import { n as httpGet, s as useApiContext } from "./http-D1NDkBxF.js"; import { b as crossBorderMapping, x as payoutComponentKeyMapping } from "./processCapabilities-DlZY9-Jc.js"; import { a as mapWith } from "./utils-oc3EdK6K.js"; import { skipToken, useQuery } from "@tanstack/preact-query"; //#region src/api/transferInstruments/useTransferInstrument.ts var getTransferInstrument = async (legalEntityId, baseUrl, transferInstrumentId) => { return httpGet({ baseUrl, path: `legalEntities/${legalEntityId}/transferInstruments/${transferInstrumentId}` }); }; /** * Gets a single transfer instrument associated with a legal entity * @param transferInstrumentId ID of transfer instrument * @param options additional options passed to Tanstack Query, eg; refetchInterval for polling */ var useTransferInstrument = (transferInstrumentId, options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); return useQuery({ queryKey: transferInstrumentId === skipToken ? [] : ["transferInstrument", transferInstrumentId], queryFn: transferInstrumentId === skipToken ? skipToken : () => getTransferInstrument(rootLegalEntityId.value, baseUrl.value, transferInstrumentId), ...options }); }; //#endregion //#region src/components/BankAccount/mapping/mapTransferInstrumentToPayoutAccount.ts /** * Easy to use function for mapping transferInstrument response to payout account details component data * @param transferInstrument - a transferInstrument the same as found in API response * @returns a Payout Details person data */ var mapTransferInstrumentToPayoutAccount = (transferInstrument, enabledCrossBorderPayouts) => { const mappingOverride = enabledCrossBorderPayouts ? crossBorderMapping : {}; return mapWith(transferInstrument, { ...payoutComponentKeyMapping, ...mappingOverride }); }; //#endregion export { useTransferInstrument as n, mapTransferInstrumentToPayoutAccount as t };