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.

29 lines (28 loc) 1.16 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] = "9ada7f40-5820-4255-a593-c3c275ea186f", e._sentryDebugIdIdentifier = "sentry-dbid-9ada7f40-5820-4255-a593-c3c275ea186f"); } catch (e) {} import { useState } from "preact/hooks"; //#region src/utils/uuid.ts function uuidv4() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { let r = Math.random() * 16 | 0; return (c == "x" ? r : r & 3 | 8).toString(16); }); } //#endregion //#region src/utils/useId.ts /** * We can't use {@link import('preact/hooks').useId} because it doesn't guarantee uniqueness across * different render trees. So multiple components mounted on the same page could have collisions. * * Therefore, we instead calculate a uuid and prepend a prefix. * * @param prefix a prefix to identify this usage */ var useId = (prefix) => { const [uuid] = useState(uuidv4()); return `${prefix}_${uuid}`; }; //#endregion export { useId as t };