@tellandshow/discovery-core
v0.0.2
Published
Progressive uncovering engine — wraps @tellandshow/profile-core to track which unlocks the kid has seen vs which are newly available, and surfaces celebratory toasts + gating helpers. Implements the doctrine: kids never see locked content; features appear
Maintainers
Readme
@tellandshow/discovery-core
Progressive uncovering — wraps @tellandshow/profile-core to track which unlocks the kid has seen vs which are newly available, plus React bindings for celebrating + gating.
The doctrine
- Kids never see locked content. UI hides anything not yet unlocked.
- When a feature becomes unlocked, the first appearance is celebratory (a small toast), then the feature lives in the UI normally.
Three states per feature
| state | UI hidden? | toast? | | -------------- | ---------- | ------------ | | locked | yes | no | | just-unlocked | no | yes | | seen | no | no |
just-unlocked flips to seen once the kid clicks the toast (or it auto-dismisses after 6s).
Usage
import { ProfileCore } from '@tellandshow/profile-core';
import { DiscoveryEngine } from '@tellandshow/discovery-core';
import { DiscoveryGate, DiscoveryToast } from '@tellandshow/discovery-core/client';
const profile = new ProfileCore({ storage: localStorage });
const discovery = new DiscoveryEngine({ profile, storage: localStorage });
function App() {
return (
<>
<DiscoveryGate engine={discovery} featureId="side-quests-panel">
<SideQuestsPanel />
</DiscoveryGate>
<DiscoveryToast
engine={discovery}
featureId="side-quests-panel"
label="Side quests"
reason="You leveled up!"
/>
</>
);
}License
MIT.
