Skip to content

API Reference ​

Package Exports ​

@snap-fill/core provides two entry points:

Main Entry (@snap-fill/core) ​

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

  • Form Detection — scanForFields, classifyByAutocomplete, classifyByRegex
  • Form Filling — fillForm, fillElement
  • Cart Detection — detectCart, extractFromJsonLd, etc.
  • Types — AutofillFieldType, AutofillMappings, AutofillMessage, etc.
  • Constants — AUTOCOMPLETE_MAP, REGEX_PATTERNS, TYPE_MAP

Injectable Entry (@snap-fill/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 '@snap-fill/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 '@snap-fill/core';

Released under the MIT License.