-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement multi-builder switch example with dynamic builder swi… #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…tching - Add complete multi-builder-switch-example project structure - Implement dynamic switching between Email, Page, and Popup builders - Add BeefreeMultiService for managing multiple builder types - Create useBuilderManager hook for centralized state management - Support builder-specific credentials and templates - Fix template loading with JSON wrapper extraction logic - Add comprehensive TypeScript types and error handling - Include modern React 18 + TypeScript + Vite architecture - Update secure-auth-example server to support builder-specific auth - Enhance shared/auth.js to handle per-builder credentials - Add detailed README with setup and usage instructions - Update main project README with new example documentation Features: - Seamless switching between Email 📧, Page 📄, and Popup 🎯 builders - Builder-specific authentication with individual client credentials - Template loading with automatic JSON structure detection - Professional UI with loading states and error handling - CORS-compliant architecture using Vite proxy - Production-ready with comprehensive documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive multi-builder switch example that demonstrates dynamic switching between Email, Page, and Popup builders within a single application. The implementation includes a modern React 18 + TypeScript + Vite architecture with centralized state management and builder-specific authentication support.
Key Changes:
- Complete multi-builder-switch-example project with dynamic builder switching capabilities
- Enhanced shared auth service to support builder-specific credentials alongside default server credentials
- Updated secure-auth-example server to include CORS support for the new example on port 8083
Reviewed Changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| shared/auth.js | Enhanced to support optional builder-specific client credentials in auth requests |
| secure-auth-example/server.ts | Added CORS origin for new example (port 8083) |
| multi-builder-switch-example/* | Complete new example project with React+TS architecture, services, components, and configuration |
| README.md | Updated with documentation for the new multi-builder switch example |
Comments suppressed due to low confidence (1)
shared/auth.js:19
- There are duplicate JSDoc comments for the same function. The first comment (lines 6-12) should be removed to eliminate redundancy.
/**
* Authenticates with Beefree SDK and returns a complete IToken
* @param {string} clientId - Beefree client ID
* @param {string} clientSecret - Beefree client secret
* @param {string} uid - User identifier
* @returns {Promise<IToken>} Complete IToken object compatible with Beefree SDK
*/
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
multi-builder-switch-example/src/services/beefreeMultiService.ts
Outdated
Show resolved
Hide resolved
- Unified authentication: All frontend examples now depend on secure-auth-example (port 3000) - template-export-pdf-example: Removed integrated authentication, now uses external auth server - Updated server.js to accept Bearer token in Authorization header for PDF export - Modified vite.config.ts to proxy /auth requests to port 3000 - Updated all READMEs to reflect consistent authentication architecture - Added comprehensive shared/README.md documenting the auth module - Updated main README with clearer dependency tables and architecture diagrams Breaking change: template-export-pdf-example now requires secure-auth-example to be running Benefits: Consistent authentication pattern across all examples, easier to understand and maintain
- Remove arbitrary 100ms timeout for builder initialization - Use useRef to check if container is mounted in the DOM - More reliable and idiomatic React pattern - Improves initialization reliability across different environments
- Keep Beefree SDK instance as internal state only - Remove all window.bee assignments and cleanup - Improve encapsulation and state management - Instance accessible only via service methods (getInstance, isInitialized)
…tching
Features: