@tiun/types
v0.4.0
Published
TypeScript type definitions for tiun SDK (for script tag users)
Maintainers
Readme
@tiun/types
TypeScript type definitions for the tiun SDK.
Types are included in @tiun/sdk; you do not need this package when using the SDK. This package is an optional standalone reference (e.g. for custom setups).
Installation
npm install @tiun/types --save-devSetup
Add to tsconfig.json:
{
"compilerOptions": {
"types": ["@tiun/types"]
}
}Or in any .d.ts file:
/// <reference types="@tiun/types" />Usage
The global tiun object is typed:
tiun.init({ snippetId: 'your-snippet-id' });
// Authentication
tiun.login();
tiun.logout();
const { isAuthenticated, user } = tiun.getUser();
// Events
tiun.on('userChange', (event) => {
console.log(event.isAuthenticated, event.user);
});
tiun.on('login', (event) => console.log(event.user.email));
tiun.on('logout', () => {});
// Paywall
tiun.on('paywallShow', ({ isConnected }) => {});
tiun.checkout({ productId: 'prod_123' });Auto-generated
This package is auto-generated from src/sdk/types.ts.
License
MIT
