Plugin Directory

Changeset 3375534


Ignore:
Timestamp:
10/09/2025 08:15:52 AM (6 months ago)
Author:
synoveo
Message:

Deploy synoveo v1.0.6a

Location:
synoveo/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • synoveo/trunk/assets/js/dashboard-capabilities.js

    r3375269 r3375534  
    22// Consolidated from 2 inline scripts for WordPress.org compliance
    33// Uses synoveoCapabilitiesData localized in template loader
     4
     5// Debounce mechanism to prevent excessive API calls
     6let refreshTimeout = null;
     7let isRefreshing = false;
     8
     9function 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}
    423
    524document.addEventListener('DOMContentLoaded', function() {
     
    5776
    5877function 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, {
    6281        method: 'POST',
    6382        headers: {
     
    286305    const getBusinessInfoActionsWithSources = (hasWoo) => {
    287306        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
    289319        actions.push({
    290320            label: '🔎 Review & Sync',
     
    458488        }
    459489       
    460         // Default: always available for configuration
    461         return 'connected';
     490        // Default: Check if actually connected to Google Business Profile
     491        return isConnectedToGoogle ? 'connected' : 'detected';
    462492    };
    463493   
    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    };
    465524   
    466525    const getAddressActions = () => {
     
    472531       
    473532        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        }
    474543       
    475544        // If VERIFIED, show no actions (read-only)
     
    614683            },
    615684            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),
    627686            lockedUntil: hoursLocked ? Date.parse(cardQuotas.hours?.nextSync) : null,
    628687            syncInfo: {
     
    10011060    const statusText = {
    10021061        'connected': '✅ Connected',
     1062        'detected': '🔍 Detected',
    10031063        'synced': '✅ Synced to Google',
    10041064        'partial_sync': '⚠️ Partially Synced',
     
    14541514   
    14551515    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;
    14561525        case 'configure_hours':
    14571526            openHoursConfiguration();
     
    16191688            // Refresh the dashboard to show disconnected state
    16201689            setTimeout(() => {
    1621                 loadCapabilities();
     1690                debouncedRefresh(1000);
    16221691            }, 1000);
    16231692           
     
    16521721            renderConnectionStatusBanner(data.data);
    16531722           
    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            }
    16561734           
    16571735        } else {
     
    17951873        <div style="grid-column: 1 / -1; text-align: center; padding: 40px; color: #ef4444;">
    17961874            <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;">
    17981876                Retry
    17991877            </button>
     
    19572035            if (json.success) {
    19582036            if (window.synoveoCardManager) window.synoveoCardManager.showNotification('✅ Address validated and saved', 'success')
    1959             if (typeof loadCapabilities === 'function') loadCapabilities()
     2037            if (typeof debouncedRefresh === 'function') debouncedRefresh(200)
    19602038            } else {
    19612039            if (window.synoveoCardManager) window.synoveoCardManager.showNotification('❌ Failed to save address', 'error')
     
    22772355    }
    22782356}
     2357
     2358// Make debounced refresh globally available
     2359window.debouncedRefresh = debouncedRefresh;
  • synoveo/trunk/readme.txt

    r3375504 r3375534  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.6
     7Stable tag: 1.0.6a
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    253253
    254254== 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
    255263
    256264= 1.0.6 =
  • synoveo/trunk/synoveo.php

    r3375504 r3375534  
    44 * Plugin URI: https://www.synoveo.com
    55 * 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
    77 * Author: Synoveo (CODE75)
    8  * Author URI: https://www.code75.io
     8 * Author URI: https://www.synoveo.com
    99 * License: GPL v2 or later
    1010 * Text Domain: synoveo
  • synoveo/trunk/uninstall.php

    r3375269 r3375534  
    4242// Only delete if user explicitly opts in via settings
    4343if ( $delete_all_data === 'yes' ) {
     44    global $wpdb;
     45   
    4446    $user_data_options = array(
    4547        'synoveo_manual_business_info',        // Manual business info entered by user
     
    5153        'synoveo_address_status',              // Address validation status/history
    5254        '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
    5358    );
    5459
     
    6570        )
    6671    );
     72
    6773}
    6874
Note: See TracChangeset for help on using the changeset viewer.