Skip to content

API Reference

Package Exports

@snapfill/core provides two entry points:

Main Entry (@snapfill/core)

Functions for direct use in a web page — tree-shakeable, no side effects:

  • Form DetectionscanForFields, classifyByAutocomplete, classifyByRegex
  • Form FillingfillForm, fillElement
  • Cart DetectiondetectCart, extractFromJsonLd, etc.
  • TypesAutofillFieldType, AutofillMappings, AutofillMessage, etc.
  • ConstantsAUTOCOMPLETE_MAP, REGEX_PATTERNS, TYPE_MAP

Injectable Entry (@snapfill/core/injectable)

Pre-built script strings for WebView injection:

Usage Patterns

Pattern 1: WebView Injection

Use the injectable entry to inject scripts into a WebView and communicate via messages. Best for native apps (React Native, Android, iOS).

ts
import { snapfillScript, buildFillScript } from '@snapfill/core/injectable';

Pattern 2: Direct Web Use

Use the main entry for direct DOM access in a web page or browser extension. Functions are tree-shakeable.

ts
import { scanForFields, fillForm } from '@snapfill/core';

Released under the MIT License.