@e-volv/openfeature-web
v0.1.1
Published
OpenFeature web provider for e-volv Launch — evaluates feature flags in the browser through @e-volv/logs: evaluated values for the identified context, cached in localStorage, refreshed on focus, with exposures.
Maintainers
Readme
@e-volv/openfeature-web
The OpenFeature web provider for
e-volv Launch. Bring your Launch flags to an OpenFeature
web stack: OpenFeature.setContext(...) maps to the Launch identify, and
every resolution reads the evaluated values @e-volv/logs already holds —
synchronous, never throwing, with the native e-volv reason always available
on flagMetadata.evolveReason.
import { OpenFeature } from '@openfeature/web-sdk';
import { init } from '@e-volv/logs/browser';
import { browserFlags } from '@e-volv/logs/browser/flags';
import { EvolveWebProvider } from '@e-volv/openfeature-web';
const evolve = init({
key: 'evk_pub_…',
flags: browserFlags(),
});
await OpenFeature.setProviderAndWait(new EvolveWebProvider(evolve.flags));
await OpenFeature.setContext({ targetingKey: user.id, plan: user.plan });
const flags = OpenFeature.getClient();
const checkout = await flags.getBooleanDetails('checkout.new', false);
// checkout.value / checkout.variant / checkout.reason, and
// checkout.flagMetadata.evolveReason names the native e-volv reason.Reason mapping: RULE:* and TARGET_MATCH become TARGETING_MATCH,
ROLLOUT becomes SPLIT, OFF/KILLED become DISABLED, and error
reasons carry the matching OpenFeature error code (FLAG_NOT_FOUND,
TYPE_MISMATCH, GENERAL). When the underlying values change (poll,
refresh on focus, re-identification), the provider emits
ProviderEvents.ConfigurationChanged with flagsChanged set to the keys
that moved.
Requires @e-volv/logs 0.3.0+ (the browser entry) and
@openfeature/web-sdk 1.x as peer dependencies.
The behaviour is pinned by docs/LAUNCH-SDK.md; the browser SDK's delivery
conformance runs in CI.
