UNPKG

trustlabs-sdk

Version:

Easy-to-use SDK for displaying trust verification badges on websites. Supports React, Vue, vanilla JS, and CDN usage.

181 lines (142 loc) 8.04 kB
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [3.1.5] - 2024-01-XX ### 🚀 Fixed - **405 Method Not Allowed**: Automatic fallback from POST to GET when server doesn't support POST - **Server Compatibility**: Enhanced endpoint compatibility with different server configurations - **Smart Request Handling**: SDK now tries POST first, then automatically retries with GET + query parameters - **Debug Logging**: Added helpful logging when fallback occurs ### 🔧 Technical Details - Detects 405 HTTP status and automatically retries with GET method - Converts email array to comma-separated query parameters for GET requests - Maintains backward compatibility with existing POST endpoints - No breaking changes - works transparently with both request methods ## [3.1.4] - 2024-01-XX ### 📚 Documentation Enhanced - **Performance Guide**: Added comprehensive React performance optimization examples - **useCallback Examples**: Detailed guide for memoizing callbacks to prevent re-renders - **React.memo Guide**: Instructions for wrapping components to prevent unnecessary mounting - **Large List Optimization**: Best practices for rendering many TrustBadge components - **TrustBadgeProvider Integration**: Complete examples showing provider usage with optimizations ### 🎯 Developer Experience - Clear distinction between basic and performance-optimized usage patterns - Real-world examples for large user lists and team directories - Step-by-step optimization guides for React applications - Best practices for callback memoization and component wrapping ## [3.1.2] - 2024-01-XX ### 📚 Documentation Enhanced - **Performance Guide**: Added comprehensive React performance optimization examples - **useCallback Examples**: Detailed guide for memoizing callbacks to prevent re-renders - **React.memo Guide**: Instructions for wrapping components to prevent unnecessary mounting - **Large List Optimization**: Best practices for rendering many TrustBadge components - **TrustBadgeProvider Integration**: Complete examples showing provider usage with optimizations ### 🎯 Developer Experience - Clear distinction between basic and performance-optimized usage patterns - Real-world examples for large user lists and team directories - Step-by-step optimization guides for React applications - Best practices for callback memoization and component wrapping ## [3.1.1] - 2024-01-XX ### 🚀 Fixed - **Critical Performance Fix**: Resolved issue where TrustBadge components made individual API calls - **Batch Request Optimization**: Multiple components now batch requests together automatically - **React Context Provider**: Added `TrustBadgeProvider` for optimal batching across components - **Smart Batching Logic**: Improved timing (10ms batch window) for better request grouping - **Debug Logging**: Added helpful logging to monitor batch effectiveness ### ✨ Added - **TrustBadgeProvider**: New React context for application-level request batching - **useTrustBadge**: Hook for accessing batch context - **Enhanced Batch Timing**: Improved from 0ms to 10ms batch window - **Backward Compatibility**: Works with or without provider ### 🔧 Technical Details - Components automatically detect and use provider when available - Fallback to improved individual batching when provider not used - No breaking changes - existing code continues to work - Significant performance improvement: 50 components = 1-2 API requests vs 50 individual requests ## [3.1.0] - 2024-01-XX ### 🚀 Added - **Simplified API**: New `TrustLabsSDK` class with intuitive `init()` method - **Auto-initialization**: Automatic configuration detection from meta tags and data attributes - **Auto-rendering**: `autoRender()` function to automatically detect and render badges for emails - **Enhanced error handling**: Structured `TrustLabsError` class with specific error codes - **CDN auto-configuration**: Zero-config setup using meta tags - **Comprehensive examples**: Added examples for vanilla JS, React, Vue, and server setups - **TypeScript configuration**: Proper tsconfig.json with strict type checking - **CommonJS support**: Added CJS build for Node.js environments - **Bundle optimization**: Improved build process with production optimizations ### ✨ Enhanced - **Package metadata**: Better package.json with comprehensive keywords and metadata - **Error messages**: More helpful error messages with hints and documentation links - **Email validation**: Built-in email format validation with warnings for invalid emails - **Documentation**: Completely rewritten README with step-by-step guides - **Browser support**: Extended support for older React versions (16.8+) - **Performance**: Better batching and caching mechanisms ### 🔧 Improved - **Developer experience**: Simplified initialization process - **Framework integration**: Better support for React, Vue, and other frameworks - **Server setup**: Comprehensive server setup guide for multiple backends - **Style injection**: Automatic CSS style injection with opt-out option - **Bundle sizes**: Optimized bundle sizes for different use cases ### 📚 Documentation - **Migration guide**: Clear migration path from v2.x to v3.x - **Examples directory**: Live examples for different use cases - **Server setup guide**: Step-by-step server configuration for multiple platforms - **Error handling guide**: Comprehensive error handling documentation - **API reference**: Complete API documentation with TypeScript types ### 🛠️ Technical - **Build system**: Enhanced Rollup configuration with multiple output formats - **Type definitions**: Improved TypeScript definitions and exports - **Browser compatibility**: Better polyfill support and compatibility testing - **Security**: Enhanced input validation and sanitization ### 🔄 Backward Compatibility - **Legacy API**: Maintained backward compatibility with v2.x `setProxy` API - **Existing integrations**: All existing v2.x integrations continue to work - **Gradual migration**: Optional migration with clear upgrade path ## [3.0.1] - 2024-01-XX ### 🐛 Fixed - Minor bug fixes and stability improvements - Updated dependencies to latest versions ## [3.0.0] - 2024-01-XX ### 💥 Breaking Changes - **Security improvement**: Removed client-side API key support - **Proxy requirement**: Server proxy now required for all API calls - **Updated API**: New proxy-based architecture for enhanced security ### 🚀 Added - **Server proxy architecture**: Secure API key handling via server proxy - **React 19 support**: Full compatibility with React 19 - **Batch processing**: Improved performance with request batching - **Enhanced caching**: Better caching mechanisms for trust status data ### 🔧 Improved - **Security**: API keys now server-only, never exposed to browsers - **Performance**: Reduced bundle size and faster loading - **Reliability**: Better error handling and retry mechanisms ## [2.1.2] - 2023-12-XX ### 🐛 Fixed - CSS loading issues in some environments - React component prop validation - Minor styling inconsistencies ## [2.1.0] - 2023-11-XX ### 🚀 Added - React component with TypeScript support - Hover tooltips for verification dates - Loading and error states - CSS-only styling system ### 🔧 Improved - Better email detection algorithm - Enhanced badge positioning - Mobile responsiveness ## [2.0.0] - 2023-10-XX ### 💥 Breaking Changes - **New API structure**: Simplified function signatures - **Updated styling**: New CSS class structure ### 🚀 Added - **TypeScript support**: Full TypeScript definitions - **Multiple formats**: UMD, ESM, and CJS builds - **Better integration**: Improved framework compatibility ## [1.0.0] - 2023-09-XX ### 🚀 Added - Initial release - Basic trust badge rendering - Vanilla JavaScript support - Simple API integration