React Components
The SDK includes pre-built React components for common loyalty features. These components handle all the complexity of QR generation, real-time updates, and user interaction.Installation
QRLogin Component
A complete QR-based login component with automatic refresh, status updates, and app download link functionality.Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | API Key |
apiSecret | string | required | API Secret |
environment | 'production' | 'staging' | 'production' | API environment |
locale | string | 'lt' | Language |
shopId | number | - | Optional shop ID |
autoRegenerate | boolean | true | Auto-regenerate expired QR |
showSendLink | boolean | true | Show “Send app link” option |
onAuthenticated | (user, token) => void | - | Called on successful login |
onScanned | () => void | - | Called when QR is scanned |
onError | (error) => void | - | Called on error |
onExpired | () => void | - | Called when session expires |
className | string | - | Additional CSS class |
Custom Styling
QRCardDisplay Component
Displays a customer’s loyalty card QR code for identification at POS.Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | API Key |
apiSecret | string | required | API Secret |
userToken | string | required | User’s JWT token |
environment | 'production' | 'staging' | 'production' | API environment |
locale | string | 'lt' | Language |
showPoints | boolean | true | Display points balance |
showUserInfo | boolean | false | Display user name/info |
autoRefresh | boolean | false | Auto-refresh card data |
refreshInterval | number | 30000 | Refresh interval (ms) |
onCardLoaded | (card) => void | - | Called when card loads |
onError | (error) => void | - | Called on error |
className | string | - | Additional CSS class |
Complete Integration Example
Styling
CSS Variables
The components use CSS variables for easy customization:Dark Mode
Components automatically support dark mode:TypeScript Types
Server-Side Rendering
Both components are client-only and use the'use client' directive. They will only render on the client side.
Next Steps
Examples
See complete code examples
API Reference
Full SDK API documentation