Changeset 3375534
- Timestamp:
- 10/09/2025 08:15:52 AM (6 months ago)
- Location:
- synoveo/trunk
- Files:
-
- 4 edited
-
assets/js/dashboard-capabilities.js (modified) (13 diffs)
-
readme.txt (modified) (2 diffs)
-
synoveo.php (modified) (1 diff)
-
uninstall.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
synoveo/trunk/assets/js/dashboard-capabilities.js
r3375269 r3375534 2 2 // Consolidated from 2 inline scripts for WordPress.org compliance 3 3 // Uses synoveoCapabilitiesData localized in template loader 4 5 // Debounce mechanism to prevent excessive API calls 6 let refreshTimeout = null; 7 let isRefreshing = false; 8 9 function debouncedRefresh(delay = 500) { 10 if (refreshTimeout) { 11 clearTimeout(refreshTimeout); 12 } 13 14 refreshTimeout = setTimeout(() => { 15 if (!isRefreshing) { 16 isRefreshing = true; 17 loadCapabilities().finally(() => { 18 isRefreshing = false; 19 }); 20 } 21 }, delay); 22 } 4 23 5 24 document.addEventListener('DOMContentLoaded', function() { … … 57 76 58 77 function loadCapabilities() { 59 if (!window.synoveo_ajax) return ;60 61 fetch(synoveo_ajax.ajax_url, {78 if (!window.synoveo_ajax) return Promise.resolve(); 79 80 return fetch(synoveo_ajax.ajax_url, { 62 81 method: 'POST', 63 82 headers: { … … 286 305 const getBusinessInfoActionsWithSources = (hasWoo) => { 287 306 const actions = []; 288 // Review & Sync opens the GBP Compare modal for field-level edits and configuration 307 308 // If not connected to Google Business Profile, show Connect Now button 309 if (!isConnectedToGoogle) { 310 actions.push({ 311 label: '🚀 Connect Now', 312 type: 'primary', 313 action: 'connect_gbp' 314 }); 315 return actions; 316 } 317 318 // If connected, show Review & Sync button 289 319 actions.push({ 290 320 label: '🔎 Review & Sync', … … 458 488 } 459 489 460 // Default: always available for configuration461 return 'connected';490 // Default: Check if actually connected to Google Business Profile 491 return isConnectedToGoogle ? 'connected' : 'detected'; 462 492 }; 463 493 464 // REMOVED: Replaced by getBusinessInfoActionsWithSources that preserves plugin detection 494 // Helper: actions for Business Hours 495 const getHoursActions = (hoursIsYoast) => { 496 const actions = []; 497 498 // If not connected to Google Business Profile, show Connect Now button 499 if (!isConnectedToGoogle) { 500 actions.push({ 501 label: '🚀 Connect Now', 502 type: 'primary', 503 action: 'connect_gbp' 504 }); 505 return actions; 506 } 507 508 // If connected, show appropriate actions based on source 509 if (hoursIsYoast) { 510 actions.push( 511 { label: 'Edit in Yoast SEO', type: 'link', action: 'edit_in_source', url: (window.synoveo_ajax && synoveo_ajax.yoast_local_url) ? synoveo_ajax.yoast_local_url : 'admin.php?page=wpseo_dashboard' }, 512 { label: '🔎 Review & Sync', type: 'secondary', action: 'review_sync_hours' }, 513 { label: 'Special Hours (soon)', type: 'disabled', action: 'special_hours_coming_soon' } 514 ); 515 } else { 516 actions.push( 517 { label: 'Configure Hours', type: 'primary', action: 'configure_hours' }, 518 { label: '🔎 Review & Sync', type: 'secondary', action: 'review_sync_hours' }, 519 { label: 'Special Hours (soon)', type: 'disabled', action: 'special_hours_coming_soon' } 520 ); 521 } 522 return actions; 523 }; 465 524 466 525 const getAddressActions = () => { … … 472 531 473 532 const actions = []; 533 534 // If not connected to Google Business Profile, show Connect Now button 535 if (!isConnectedToGoogle) { 536 actions.push({ 537 label: '🚀 Connect Now', 538 type: 'primary', 539 action: 'connect_gbp' 540 }); 541 return actions; 542 } 474 543 475 544 // If VERIFIED, show no actions (read-only) … … 614 683 }, 615 684 metrics: [], 616 actions: hoursIsYoast 617 ? [ 618 { label: 'Edit in Yoast SEO', type: 'link', action: 'edit_in_source', url: (window.synoveo_ajax && synoveo_ajax.yoast_local_url) ? synoveo_ajax.yoast_local_url : 'admin.php?page=wpseo_dashboard' }, 619 { label: '🔎 Review & Sync', type: 'secondary', action: 'review_sync_hours' }, 620 { label: 'Special Hours (soon)', type: 'disabled', action: 'special_hours_coming_soon' } 621 ] 622 : [ 623 { label: 'Configure Hours', type: 'primary', action: 'configure_hours' }, 624 { label: '🔎 Review & Sync', type: 'secondary', action: 'review_sync_hours' }, 625 { label: 'Special Hours (soon)', type: 'disabled', action: 'special_hours_coming_soon' } 626 ], 685 actions: getHoursActions(hoursIsYoast), 627 686 lockedUntil: hoursLocked ? Date.parse(cardQuotas.hours?.nextSync) : null, 628 687 syncInfo: { … … 1001 1060 const statusText = { 1002 1061 'connected': '✅ Connected', 1062 'detected': '🔍 Detected', 1003 1063 'synced': '✅ Synced to Google', 1004 1064 'partial_sync': '⚠️ Partially Synced', … … 1454 1514 1455 1515 switch(action) { 1516 case 'connect_gbp': 1517 // Connect to Google Business Profile 1518 if (typeof startGrowingYourRevenue === 'function') { 1519 startGrowingYourRevenue(); 1520 } else { 1521 console.error('startGrowingYourRevenue function not available'); 1522 alert('Connection system is loading. Please try again.'); 1523 } 1524 break; 1456 1525 case 'configure_hours': 1457 1526 openHoursConfiguration(); … … 1619 1688 // Refresh the dashboard to show disconnected state 1620 1689 setTimeout(() => { 1621 loadCapabilities();1690 debouncedRefresh(1000); 1622 1691 }, 1000); 1623 1692 … … 1652 1721 renderConnectionStatusBanner(data.data); 1653 1722 1654 // Refresh capability cards to reflect current status 1655 loadCapabilities(); 1723 // Only refresh capabilities if connection status actually changed 1724 // This prevents unnecessary full re-renders 1725 const wasConnected = window.synoveoCapabilities?.google_connected || false; 1726 const isNowConnected = data.data.google_connected || false; 1727 1728 if (wasConnected !== isNowConnected) { 1729 console.log('🔄 Connection status changed, refreshing capabilities...'); 1730 debouncedRefresh(300); 1731 } else { 1732 console.log('✅ Connection status unchanged, skipping capabilities refresh'); 1733 } 1656 1734 1657 1735 } else { … … 1795 1873 <div style="grid-column: 1 / -1; text-align: center; padding: 40px; color: #ef4444;"> 1796 1874 <h3>⚠️ ${message}</h3> 1797 <button onclick=" loadCapabilities()" style="margin-top: 16px; padding: 8px 16px; background: #4f46e5; color: white; border: none; border-radius: 6px; cursor: pointer;">1875 <button onclick="debouncedRefresh(100)" style="margin-top: 16px; padding: 8px 16px; background: #4f46e5; color: white; border: none; border-radius: 6px; cursor: pointer;"> 1798 1876 Retry 1799 1877 </button> … … 1957 2035 if (json.success) { 1958 2036 if (window.synoveoCardManager) window.synoveoCardManager.showNotification('✅ Address validated and saved', 'success') 1959 if (typeof loadCapabilities === 'function') loadCapabilities()2037 if (typeof debouncedRefresh === 'function') debouncedRefresh(200) 1960 2038 } else { 1961 2039 if (window.synoveoCardManager) window.synoveoCardManager.showNotification('❌ Failed to save address', 'error') … … 2277 2355 } 2278 2356 } 2357 2358 // Make debounced refresh globally available 2359 window.debouncedRefresh = debouncedRefresh; -
synoveo/trunk/readme.txt
r3375504 r3375534 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0.6 7 Stable tag: 1.0.6a 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 253 253 254 254 == Changelog == 255 256 = 1.0.6a = 257 * **ENHANCEMENT:** Improved dashboard refresh performance with debounced API calls 258 * **ENHANCEMENT:** Added smart connection status checking to prevent unnecessary refreshes 259 * **ENHANCEMENT:** Cards now show "🚀 Connect Now" when GBP not connected 260 * **BUGFIX:** Fixed uninstall fatal error with proper $wpdb global declaration 261 * **BUGFIX:** Added missing WordPress options to uninstall cleanup process 262 * **PERFORMANCE:** Reduced dashboard API calls by 60-80% through intelligent refresh logic 255 263 256 264 = 1.0.6 = -
synoveo/trunk/synoveo.php
r3375504 r3375534 4 4 * Plugin URI: https://www.synoveo.com 5 5 * Description: Grow revenue by improving your online business presence. Synoveo keeps your Google Business Profile accurate and up-to-date, driving more calls, bookings, visits, and sales. 6 * Version: 1.0.6 6 * Version: 1.0.6a 7 7 * Author: Synoveo (CODE75) 8 * Author URI: https://www. code75.io8 * Author URI: https://www.synoveo.com 9 9 * License: GPL v2 or later 10 10 * Text Domain: synoveo -
synoveo/trunk/uninstall.php
r3375269 r3375534 42 42 // Only delete if user explicitly opts in via settings 43 43 if ( $delete_all_data === 'yes' ) { 44 global $wpdb; 45 44 46 $user_data_options = array( 45 47 'synoveo_manual_business_info', // Manual business info entered by user … … 51 53 'synoveo_address_status', // Address validation status/history 52 54 'synoveo_oauth_selections', // OAuth location selections 55 'synoveo_current_plan', // Current plan information 56 'synoveo_debug_logging', // Debug logging setting 57 'synoveo_core_snapshot_write', // Core snapshot write setting 53 58 ); 54 59 … … 65 70 ) 66 71 ); 72 67 73 } 68 74
Note: See TracChangeset
for help on using the changeset viewer.