@klyfa/core
v0.5.0
Published
Platform-agnostic Klyfa analytics core (transport, queue, consent, flags, exposures) shared by @klyfa/react-native and @klyfa/web.
Readme
@klyfa/core
Platform-agnostic analytics core shared by
@klyfa/web and
@klyfa/react-native.
You probably don't want to install this directly. Reach for @klyfa/web
(browsers) or @klyfa/react-native (React Native) — each depends on this
package and adds its own platform layer (storage, transport lifecycle, page/app
navigation). This package is the shared engine underneath.
What's in here
Pure TypeScript, no react-native / DOM / Node dependencies:
KlyfaAnalytics— the queue + consent + delivery engine: batching, GDPR consent gating, and classified retry (transient failures re-queue for free and honorRetry-After; only server errors count against a bounded poison-event budget; the queue is drained with bounded concurrency).Api— the/trackHTTP client with the failure classification the engine relies on.ScreenTimer— time-on-screen arithmetic: accumulates only while the screen is in front of the user, so the platform layer just has to drive it from its own lifecycle (tab visibility on web, app state on native).ExposureTracker— feature-flag exposure dedup.compareSemver/isComparableVersion— version helpers (kill-switch).- Shared types (
AnalyticsOptions,ConsentState,TrackProperties, …).
A platform package subclasses KlyfaAnalytics and provides an environment
layer via onQueueChanged() (persistence) and lifecycle hooks.
Lineage
Forked from OpenPanel's MIT-licensed SDK core and rebranded to the Klyfa wire
protocol (klyfa-* headers; the server also reads openpanel-* for
already-shipped app versions). See the platform packages' THIRD-PARTY-LICENSES.
License
MIT — see LICENSE. Derived in part from the MIT-licensed OpenPanel SDK;
see THIRD-PARTY-LICENSES.
