Package Exports
- @encorekit/web-sdk
Readme
Encore Web SDK
A JavaScript/TypeScript SDK that enables web applications to display targeted offers to users, granting them provisional access to premium features when they complete advertiser offers.
Features
- 🎯 Targeted Offer Presentation - Display offers at critical moments (cancellation flows, paywalls, onboarding)
- 🔐 Entitlement Management - Two-tier system (provisional + verified) for instant UX and reliable billing
- 📱 Framework Agnostic - Works with React, Vue, Angular, Svelte, vanilla JavaScript, or any web framework
- 🎨 Responsive UI - Beautiful, accessible modal interface that works on desktop and mobile
- 📦 Lightweight - < 50KB gzipped bundle size
- 🔌 Offline Support - Queues signals and syncs when connectivity restored
- ♿ Accessible - WCAG 2.1 Level AA compliant
Installation
npm install @encore/webOr via CDN:
<script src="https://encorekit.com/encore.min.js"></script>Quick Start
import Encore from '@encore/web';
// Configure the SDK
Encore.configure({
apiKey: 'your-api-key-here'
});
// Identify the user (optional)
Encore.identify('user-123', {
email: 'user@example.com',
subscriptionTier: 'free'
});
// Present an offer
const result = await Encore.presentOffer();
if (result.granted) {
console.log('User granted entitlement:', result.entitlement);
// Unlock premium feature
} else {
console.log('User declined:', result.reason);
}
// Check if user has active entitlement
if (Encore.isActive({ type: 'freeTrial' })) {
// Show premium content
}Browser Support
- Chrome/Edge (last 2 versions)
- Firefox (last 2 versions)
- Safari (last 2 versions)
- iOS Safari 15+