State Management
The Fanfare SDK uses a reactive state system built on nanostores to manage participation state, sessions, and experience journeys. This page explains how state is managed internally and how you can interact with it.State Architecture
Participation State
Each experience type tracks participation state:Queue Participation
Draw Participation
Auction Participation
Waitlist Participation
Timed Release Participation
Accessing State
Active Participation Queries
Each module provides methods to query active participations:Specific State Queries
State Persistence
State is automatically persisted to browser storage.Configuration
Storage Keys
The SDK uses the following localStorage keys (prefixed with organization ID):| Key | Contents |
|---|---|
fanfare:{orgId}:session | Current session |
fanfare:{orgId}:refresh_token | Refresh token |
fanfare:{orgId}:state | Participation state |
fanfare:{orgId}:journeys | Journey snapshots |
Tab Synchronization
State is synchronized across browser tabs usingBroadcastChannel.
How It Works
- When state changes in one tab, it broadcasts the change
- Other tabs receive the broadcast and update their local state
- This ensures consumers don’t lose their place when switching tabs