Fix SDK timeout and improve text contrast

SDK Loading Improvements:
- Increased timeout from 5 to 15 seconds for slower connections
- Added progressive status messages during SDK loading
- Enhanced console logging for debugging
- Added fallback SDK loading mechanism with inline script
- Better error diagnostics showing Twilio object status

Text Contrast Fixes:
- Updated all #333 colors to #212529 for better readability
- Fixed browser phone title, dial buttons, timer, queue headings
- Enhanced dark mode support for all text elements
- Improved readability on both light and dark backgrounds

Technical Changes:
- waitForTwilioSDK() now waits 150 attempts (15 seconds)
- Progressive status updates at 3s, 6s, 10s intervals
- Backup SDK loading via document.createElement
- Comprehensive dark mode color coverage
- Better error messaging for network issues

Accessibility Improvements:
- Higher contrast ratios for WCAG compliance
- Consistent text color hierarchy
- Better visibility in all lighting conditions
- Enhanced mobile readability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-13 14:22:37 -07:00
parent 24e3a3fcc2
commit e3fab38d01
3 changed files with 49 additions and 10 deletions

View File

@@ -32,18 +32,32 @@
*/
function waitForTwilioSDK(callback) {
let attempts = 0;
const maxAttempts = 50; // 5 seconds max
const maxAttempts = 150; // 15 seconds max (100ms * 150)
function checkTwilio() {
console.log('Checking Twilio SDK availability, attempt:', attempts + 1);
if (typeof Twilio !== 'undefined' && Twilio.Device) {
console.log('Twilio SDK loaded successfully');
callback();
return;
}
attempts++;
// Update status message periodically
if (attempts === 30) { // 3 seconds
updateStatus('connecting', 'Loading Twilio SDK...');
} else if (attempts === 60) { // 6 seconds
updateStatus('connecting', 'Still loading SDK...');
} else if (attempts === 100) { // 10 seconds
updateStatus('connecting', 'SDK taking longer than expected...');
}
if (attempts >= maxAttempts) {
console.error('Twilio SDK failed to load. Window.Twilio:', typeof Twilio);
updateStatus('offline', 'SDK load timeout');
showMessage('Twilio SDK failed to load within 5 seconds. Please check your internet connection and refresh the page.', 'error');
showMessage('Twilio SDK failed to load within 15 seconds. This may be due to a slow connection or network restrictions. Please refresh the page and try again.', 'error');
return;
}