filecheck-js replaces the manual <script> tag and polling loop with one typed call. It injects the CDN script once (concurrent calls share a single tag), resolves when the Element is ready, and exports the full Element type surface so elements.create('intake', …) and every event payload are typed end to end.
Quickstart
canProceed and send the jobId to your server with the form — then verify it server-side before fulfilling.
loadFilecheck(publishableKey, options?)
Returns Promise<FilecheckInstance | null>.
Behavior worth knowing:
- Idempotent. Repeated and concurrent calls inject exactly one
<script>tag and share one promise. A tag you added yourself is reused. - SSR-safe. In a non-browser environment it resolves
nullinstead of touchingwindow, so you can call it unconditionally in isomorphic code. - Recoverable. A load failure or timeout rejects with a descriptive error; calling
loadFilecheckagain retries the load.
TypeScript
Every shared type is exported from the package root:FilecheckInstance, IntakeElementOptions, ReportElementOptions, IntakeUi, IntakeStatusPayload, IntakeFacts, ElementEventMap, ProofPayload, ConnectorConfig, and more. window.Filecheck is also typed globally, including the static Filecheck.mount helper the CDN bundle provides.
From here the API is the standard Element surface — see Create and mount for options and methods, and Events for every payload.
Using React or Vue?
filecheck-react and filecheck-vue build on this package and manage the element lifecycle for you.