| @@ -45,22 +45,22 @@ | ||
| 45 | 45 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg> |
| 46 | 46 | </button> |
| 47 | 47 | </div> |
| 48 | 48 | <nav class="mxch-mobile-menu-nav"> |
| 49 | - <!-- Actions umbrella: Dashboard, then AI Tools (recommended), then Trigger Phrases --> | |
| 49 | + <!-- Overview Section --> | |
| 50 | 50 | <div class="mxch-mobile-nav-section"> |
| 51 | - <div class="mxch-mobile-nav-section-title"><?php esc_html_e('Actions', 'mxchat'); ?></div> | |
| 52 | - <button class="mxch-mobile-nav-link <?php echo (isset($active_tab) && $active_tab === 'dashboard') ? 'active' : ''; ?>" data-target="dashboard"> | |
| 51 | + <div class="mxch-mobile-nav-section-title"><?php esc_html_e('Overview', 'mxchat'); ?></div> | |
| 52 | + <button class="mxch-mobile-nav-link active" data-target="dashboard"> | |
| 53 | 53 | <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/></svg> |
| 54 | 54 | <span><?php esc_html_e('Dashboard', 'mxchat'); ?></span> |
| 55 | 55 | </button> |
| 56 | - <button class="mxch-mobile-nav-link <?php echo (isset($active_tab) && $active_tab === 'ai-tools') ? 'active' : ''; ?>" data-target="ai-tools"> | |
| 57 | - <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg> | |
| 58 | - <span><?php esc_html_e('AI Tools', 'mxchat'); ?></span> | |
| 59 | - </button> | |
| 56 | + </div> | |
| 57 | + <!-- Actions Section --> | |
| 58 | + <div class="mxch-mobile-nav-section"> | |
| 59 | + <div class="mxch-mobile-nav-section-title"><?php esc_html_e('Manage', 'mxchat'); ?></div> | |
| 60 | 60 | <button class="mxch-mobile-nav-link" data-target="all-actions"> |
| 61 | 61 | <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> |
| 62 | - <span><?php esc_html_e('Trigger Phrases', 'mxchat'); ?></span> | |
| 62 | + <span><?php esc_html_e('All Actions', 'mxchat'); ?></span> | |
| 63 | 63 | </button> |
| 64 | 64 | </div> |
| 65 | 65 | <?php if (!$is_activated): ?> |
| 66 | 66 | <div class="mxch-mobile-menu-footer"> |
| @@ -85,14 +85,14 @@ | ||
| 85 | 85 | </a> |
| 86 | 86 | </div> |
| 87 | 87 | |
| 88 | 88 | <nav class="mxch-sidebar-nav"> |
| 89 | - <!-- Actions umbrella: Dashboard, then AI Tools (recommended), then Trigger Phrases --> | |
| 89 | + <!-- Overview Section --> | |
| 90 | 90 | <div class="mxch-nav-section"> |
| 91 | - <div class="mxch-nav-section-title"><?php esc_html_e('Actions', 'mxchat'); ?></div> | |
| 91 | + <div class="mxch-nav-section-title"><?php esc_html_e('Overview', 'mxchat'); ?></div> | |
| 92 | 92 | |
| 93 | 93 | <div class="mxch-nav-item" data-section="dashboard"> |
| 94 | - <button class="mxch-nav-link <?php echo (isset($active_tab) && $active_tab === 'dashboard') ? 'active' : ''; ?>" data-target="dashboard"> | |
| 94 | + <button class="mxch-nav-link active" data-target="dashboard"> | |
| 95 | 95 | <span class="mxch-nav-link-icon"> |
| 96 | 96 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/></svg> |
| 97 | 97 | </span> |
| 98 | 98 | <span class="mxch-nav-link-text"><?php esc_html_e('Dashboard', 'mxchat'); ?></span> |
| @@ -97,18 +97,13 @@ | ||
| 97 | 97 | </span> |
| 98 | 98 | <span class="mxch-nav-link-text"><?php esc_html_e('Dashboard', 'mxchat'); ?></span> |
| 99 | 99 | </button> |
| 100 | 100 | </div> |
| 101 | + </div> | |
| 101 | 102 | |
| 102 | - <div class="mxch-nav-item" data-section="ai-tools"> | |
| 103 | - <button class="mxch-nav-link <?php echo (isset($active_tab) && $active_tab === 'ai-tools') ? 'active' : ''; ?>" data-target="ai-tools"> | |
| 104 | - <span class="mxch-nav-link-icon"> | |
| 105 | - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg> | |
| 106 | - </span> | |
| 107 | - <span class="mxch-nav-link-text"><?php esc_html_e('AI Tools', 'mxchat'); ?></span> | |
| 108 | - <span class="mxch-nav-link-badge"><?php echo esc_html($total_tools); ?></span> | |
| 109 | - </button> | |
| 110 | - </div> | |
| 103 | + <!-- Manage Section --> | |
| 104 | + <div class="mxch-nav-section"> | |
| 105 | + <div class="mxch-nav-section-title"><?php esc_html_e('Manage', 'mxchat'); ?></div> | |
| 111 | 106 | |
| 112 | 107 | <div class="mxch-nav-item" data-section="all-actions"> |
| 113 | 108 | <button class="mxch-nav-link" data-target="all-actions"> |
| 114 | 109 | <span class="mxch-nav-link-icon"> |
| @@ -113,9 +108,9 @@ | ||
| 113 | 108 | <button class="mxch-nav-link" data-target="all-actions"> |
| 114 | 109 | <span class="mxch-nav-link-icon"> |
| 115 | 110 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> |
| 116 | 111 | </span> |
| 117 | - <span class="mxch-nav-link-text"><?php esc_html_e('Trigger Phrases', 'mxchat'); ?></span> | |
| 112 | + <span class="mxch-nav-link-text"><?php esc_html_e('All Actions', 'mxchat'); ?></span> | |
| 118 | 113 | <span class="mxch-nav-link-badge"><?php echo esc_html($total_actions); ?></span> |
| 119 | 114 | </button> |
| 120 | 115 | </div> |
| 121 | 116 | </div> |
| @@ -133,66 +128,76 @@ | ||
| 133 | 128 | |
| 134 | 129 | <!-- Main Content Area --> |
| 135 | 130 | <main class="mxch-content"> |
| 136 | 131 | <!-- Dashboard Section --> |
| 137 | - <div id="dashboard" class="mxch-section <?php echo (isset($active_tab) && $active_tab === 'dashboard') ? 'active' : ''; ?>"> | |
| 132 | + <div id="dashboard" class="mxch-section active"> | |
| 138 | 133 | <div class="mxch-content-header"> |
| 139 | - <h1 class="mxch-content-title"><?php esc_html_e('Actions', 'mxchat'); ?></h1> | |
| 140 | - <p class="mxch-content-subtitle"><?php esc_html_e('Give your chatbot the ability to do things — generate images, search the web, hand off to a human, capture an email, and more. There are two ways to set this up. The cards below explain when to use each.', 'mxchat'); ?></p> | |
| 134 | + <h1 class="mxch-content-title"><?php esc_html_e('Actions Dashboard', 'mxchat'); ?></h1> | |
| 135 | + <p class="mxch-content-subtitle"><?php esc_html_e('Create and manage custom actions to enhance your chatbot\'s capabilities.', 'mxchat'); ?></p> | |
| 141 | 136 | </div> |
| 142 | 137 | |
| 143 | - <!-- Two ways to set up actions — landing explainer --> | |
| 138 | + <!-- Quick Actions Card --> | |
| 139 | + <div class="mxch-card"> | |
| 140 | + <div class="mxch-card-header"> | |
| 141 | + <h3 class="mxch-card-title"> | |
| 142 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> | |
| 143 | + <?php esc_html_e('Quick Actions', 'mxchat'); ?> | |
| 144 | + </h3> | |
| 145 | + </div> | |
| 146 | + <div class="mxch-card-body"> | |
| 147 | + <div class="mxch-quick-actions"> | |
| 148 | + <button type="button" class="mxch-quick-action-btn" id="mxch-add-action-dashboard-btn"> | |
| 149 | + <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg> | |
| 150 | + <span><?php esc_html_e('Add New Action', 'mxchat'); ?></span> | |
| 151 | + </button> | |
| 152 | + <button type="button" class="mxch-quick-action-btn" data-action="view-actions"> | |
| 153 | + <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> | |
| 154 | + <span><?php esc_html_e('View All Actions', 'mxchat'); ?></span> | |
| 155 | + </button> | |
| 156 | + </div> | |
| 157 | + </div> | |
| 158 | + </div> | |
| 159 | + | |
| 160 | + <!-- What are Actions - Info Section --> | |
| 144 | 161 | <div class="mxch-info-section"> |
| 145 | 162 | <div class="mxch-info-section-header"> |
| 146 | 163 | <div class="mxch-info-section-icon"> |
| 147 | 164 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg> |
| 148 | 165 | </div> |
| 149 | - <h3 class="mxch-info-section-title"><?php esc_html_e('Two ways to set up actions', 'mxchat'); ?></h3> | |
| 166 | + <h3 class="mxch-info-section-title"><?php esc_html_e('What are Actions?', 'mxchat'); ?></h3> | |
| 150 | 167 | </div> |
| 151 | 168 | <p class="mxch-info-section-desc"> |
| 152 | - <?php esc_html_e('Both let your chatbot take action during a conversation. Pick whichever fits how you want it to behave — or use both together.', 'mxchat'); ?> | |
| 169 | + <?php esc_html_e('Actions let your chatbot do more than just chat. When a visitor\'s message is similar in meaning to your trigger phrase, the bot automatically performs the action - like sending emails, redirecting pages, or displaying content.', 'mxchat'); ?> | |
| 153 | 170 | </p> |
| 154 | - | |
| 155 | - <div class="mxch-approach-grid"> | |
| 156 | - <!-- AI Tools (recommended) --> | |
| 157 | - <div class="mxch-approach-card mxch-approach-card-primary"> | |
| 158 | - <div class="mxch-approach-card-head"> | |
| 159 | - <div class="mxch-approach-icon"> | |
| 160 | - <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg> | |
| 161 | - </div> | |
| 162 | - <div class="mxch-approach-titles"> | |
| 163 | - <h4 class="mxch-approach-title"><?php esc_html_e('AI Tools', 'mxchat'); ?></h4> | |
| 164 | - <span class="mxch-approach-pill"><?php esc_html_e('Recommended', 'mxchat'); ?></span> | |
| 165 | - </div> | |
| 171 | + <div class="mxch-info-features"> | |
| 172 | + <div class="mxch-info-feature"> | |
| 173 | + <div class="mxch-info-feature-icon"> | |
| 174 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg> | |
| 166 | 175 | </div> |
| 167 | - <p class="mxch-approach-desc"><?php esc_html_e('Add the tools your chatbot is allowed to use, and the AI decides when to use each one from the conversation. Easiest to set up — there are no phrases to write. Best for most sites.', 'mxchat'); ?></p> | |
| 168 | - <button type="button" class="mxch-btn mxch-btn-primary mxch-approach-btn" data-approach-target="ai-tools"> | |
| 169 | - <?php esc_html_e('Set up AI Tools', 'mxchat'); ?> | |
| 170 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> | |
| 171 | - </button> | |
| 176 | + <div class="mxch-info-feature-content"> | |
| 177 | + <span class="mxch-info-feature-title"><?php esc_html_e('Meaning-Based Matching', 'mxchat'); ?></span> | |
| 178 | + <span class="mxch-info-feature-desc"><?php esc_html_e('Uses AI to understand intent, not just exact words. "I want to buy" matches "purchase" or "order"', 'mxchat'); ?></span> | |
| 179 | + </div> | |
| 172 | 180 | </div> |
| 173 | - <!-- Trigger Phrases --> | |
| 174 | - <div class="mxch-approach-card"> | |
| 175 | - <div class="mxch-approach-card-head"> | |
| 176 | - <div class="mxch-approach-icon mxch-approach-icon-muted"> | |
| 177 | - <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> | |
| 178 | - </div> | |
| 179 | - <div class="mxch-approach-titles"> | |
| 180 | - <h4 class="mxch-approach-title"><?php esc_html_e('Trigger Phrases', 'mxchat'); ?></h4> | |
| 181 | - </div> | |
| 181 | + <div class="mxch-info-feature"> | |
| 182 | + <div class="mxch-info-feature-icon"> | |
| 183 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/></svg> | |
| 182 | 184 | </div> |
| 183 | - <p class="mxch-approach-desc"><?php esc_html_e('You write the exact phrases that should fire a capability, with a match-strength slider. Precise and predictable — best when you want tight control over exactly when something happens.', 'mxchat'); ?></p> | |
| 184 | - <button type="button" class="mxch-btn mxch-btn-secondary mxch-approach-btn" id="mxch-add-action-dashboard-btn"> | |
| 185 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> | |
| 186 | - <?php esc_html_e('Add Trigger Phrase', 'mxchat'); ?> | |
| 187 | - </button> | |
| 185 | + <div class="mxch-info-feature-content"> | |
| 186 | + <span class="mxch-info-feature-title"><?php esc_html_e('Similarity Threshold', 'mxchat'); ?></span> | |
| 187 | + <span class="mxch-info-feature-desc"><?php esc_html_e('Set how closely a message must match. Higher = more precise, Lower = more flexible', 'mxchat'); ?></span> | |
| 188 | + </div> | |
| 188 | 189 | </div> |
| 190 | + <div class="mxch-info-feature"> | |
| 191 | + <div class="mxch-info-feature-icon"> | |
| 192 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m9 15 2 2 4-4"/></svg> | |
| 193 | + </div> | |
| 194 | + <div class="mxch-info-feature-content"> | |
| 195 | + <span class="mxch-info-feature-title"><?php esc_html_e('Best Practices', 'mxchat'); ?></span> | |
| 196 | + <span class="mxch-info-feature-desc"><?php esc_html_e('Use natural phrases visitors would say. Make triggers distinct from each other to avoid overlap', 'mxchat'); ?></span> | |
| 197 | + </div> | |
| 198 | + </div> | |
| 189 | 199 | </div> |
| 190 | - | |
| 191 | - <div class="mxch-approach-note"> | |
| 192 | - <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> | |
| 193 | - <span><strong><?php esc_html_e('Can I use both?', 'mxchat'); ?></strong> <?php esc_html_e('Yes. When a visitor\'s message matches one of your trigger phrases, that fires first; AI Tools cover everything else. Many sites run both together.', 'mxchat'); ?></span> | |
| 194 | - </div> | |
| 195 | 200 | </div> |
| 196 | 201 | |
| 197 | 202 | </div> |
| 198 | 203 | |
| @@ -216,14 +221,14 @@ | ||
| 216 | 221 | </div> |
| 217 | 222 | <div class="mxch-panel-header"> |
| 218 | 223 | <div class="mxch-search-wrapper"> |
| 219 | 224 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg> |
| 220 | - <input type="text" id="mxch-search-actions" class="mxch-search-input" placeholder="<?php esc_attr_e('Search trigger phrases...', 'mxchat'); ?>"> | |
| 225 | + <input type="text" id="mxch-search-actions" class="mxch-search-input" placeholder="<?php esc_attr_e('Search actions...', 'mxchat'); ?>"> | |
| 221 | 226 | </div> |
| 222 | 227 | <div class="mxch-panel-title-row"> |
| 223 | - <span class="mxch-panel-count" id="mxch-action-count">0 / 0 trigger phrases</span> | |
| 228 | + <span class="mxch-panel-count" id="mxch-action-count">0 / 0 actions</span> | |
| 224 | 229 | <div class="mxch-panel-actions"> |
| 225 | - <button type="button" id="mxch-add-action-btn" class="mxch-btn mxch-btn-primary mxch-btn-sm" title="<?php esc_attr_e('Add Trigger Phrase', 'mxchat'); ?>"> | |
| 230 | + <button type="button" id="mxch-add-action-btn" class="mxch-btn mxch-btn-primary mxch-btn-sm" title="<?php esc_attr_e('Add New Action', 'mxchat'); ?>"> | |
| 226 | 231 | <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> |
| 227 | 232 | <?php esc_html_e('Add', 'mxchat'); ?> |
| 228 | 233 | </button> |
| 229 | 234 | <button type="button" id="mxch-refresh-actions" class="mxch-icon-btn" title="<?php esc_attr_e('Refresh', 'mxchat'); ?>"> |
| @@ -248,13 +253,13 @@ | ||
| 248 | 253 | <div class="mxch-action-empty" id="mxch-action-empty"> |
| 249 | 254 | <div class="mxch-empty-icon"> |
| 250 | 255 | <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> |
| 251 | 256 | </div> |
| 252 | - <h3><?php esc_html_e('Select a trigger phrase', 'mxchat'); ?></h3> | |
| 253 | - <p><?php esc_html_e('Choose a trigger phrase from the list to view details and edit, or create a new one.', 'mxchat'); ?></p> | |
| 257 | + <h3><?php esc_html_e('Select an action', 'mxchat'); ?></h3> | |
| 258 | + <p><?php esc_html_e('Choose an action from the list to view details and edit, or create a new one.', 'mxchat'); ?></p> | |
| 254 | 259 | <button type="button" id="mxch-create-first-action-btn" class="mxch-btn mxch-btn-primary"> |
| 255 | 260 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> |
| 256 | - <?php esc_html_e('Create Trigger Phrase', 'mxchat'); ?> | |
| 261 | + <?php esc_html_e('Create New Action', 'mxchat'); ?> | |
| 257 | 262 | </button> |
| 258 | 263 | </div> |
| 259 | 264 | |
| 260 | 265 | <!-- Action Editor (hidden initially) --> |
| @@ -265,9 +270,9 @@ | ||
| 265 | 270 | <button type="button" class="mxch-mobile-back-btn"> |
| 266 | 271 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg> |
| 267 | 272 | <?php esc_html_e('Back', 'mxchat'); ?> |
| 268 | 273 | </button> |
| 269 | - <h3 class="mxch-editor-title"><?php esc_html_e('Choose what it does', 'mxchat'); ?></h3> | |
| 274 | + <h3 class="mxch-editor-title"><?php esc_html_e('Select Action Type', 'mxchat'); ?></h3> | |
| 270 | 275 | <button type="button" class="mxch-editor-close" id="mxch-close-editor"> |
| 271 | 276 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg> |
| 272 | 277 | </button> |
| 273 | 278 | </div> |
| @@ -273,9 +278,9 @@ | ||
| 273 | 278 | </div> |
| 274 | 279 | |
| 275 | 280 | <div class="mxch-type-search"> |
| 276 | 281 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg> |
| 277 | - <input type="text" id="mxch-type-search-input" placeholder="<?php esc_attr_e('Search types...', 'mxchat'); ?>"> | |
| 282 | + <input type="text" id="mxch-type-search-input" placeholder="<?php esc_attr_e('Search action types...', 'mxchat'); ?>"> | |
| 278 | 283 | </div> |
| 279 | 284 | |
| 280 | 285 | <div class="mxch-type-categories"> |
| 281 | 286 | <button type="button" class="mxch-category-btn active" data-category="all"><?php esc_html_e('All', 'mxchat'); ?></button> |
| @@ -327,9 +332,9 @@ | ||
| 327 | 332 | <button type="button" class="mxch-back-btn" id="mxch-back-to-step-1"> |
| 328 | 333 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg> |
| 329 | 334 | <?php esc_html_e('Back', 'mxchat'); ?> |
| 330 | 335 | </button> |
| 331 | - <h3 class="mxch-editor-title" id="mxch-config-title"><?php esc_html_e('Configure Trigger Phrase', 'mxchat'); ?></h3> | |
| 336 | + <h3 class="mxch-editor-title" id="mxch-config-title"><?php esc_html_e('Configure Action', 'mxchat'); ?></h3> | |
| 332 | 337 | <button type="button" class="mxch-editor-close" id="mxch-close-editor-2"> |
| 333 | 338 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg> |
| 334 | 339 | </button> |
| 335 | 340 | </div> |
| @@ -338,10 +343,10 @@ | ||
| 338 | 343 | <div class="mxch-selected-type-icon" id="mxch-selected-type-icon"> |
| 339 | 344 | <span class="dashicons dashicons-admin-generic"></span> |
| 340 | 345 | </div> |
| 341 | 346 | <div class="mxch-selected-type-info"> |
| 342 | - <h4 id="mxch-selected-type-label"><?php esc_html_e('Selected Type', 'mxchat'); ?></h4> | |
| 343 | - <p id="mxch-selected-type-desc"><?php esc_html_e('Configure this trigger phrase for your chatbot', 'mxchat'); ?></p> | |
| 347 | + <h4 id="mxch-selected-type-label"><?php esc_html_e('Selected Action', 'mxchat'); ?></h4> | |
| 348 | + <p id="mxch-selected-type-desc"><?php esc_html_e('Configure this action for your chatbot', 'mxchat'); ?></p> | |
| 344 | 349 | </div> |
| 345 | 350 | </div> |
| 346 | 351 | |
| 347 | 352 | <form id="mxch-action-form" method="post"> |
| @@ -350,25 +355,17 @@ | ||
| 350 | 355 | <input type="hidden" name="callback_function" id="mxch-callback-function" value=""> |
| 351 | 356 | <input type="hidden" name="form_mode" id="mxch-form-mode" value="add"> |
| 352 | 357 | |
| 353 | 358 | <div class="mxch-form-group"> |
| 354 | - <label for="mxch-action-label"><?php esc_html_e('Label', 'mxchat'); ?></label> | |
| 359 | + <label for="mxch-action-label"><?php esc_html_e('Action Label', 'mxchat'); ?></label> | |
| 355 | 360 | <input type="text" id="mxch-action-label" name="intent_label" required placeholder="<?php esc_attr_e('e.g., Newsletter Signup', 'mxchat'); ?>"> |
| 356 | - <p class="mxch-form-hint"><?php esc_html_e('A descriptive name for this trigger phrase (for your reference only).', 'mxchat'); ?></p> | |
| 361 | + <p class="mxch-form-hint"><?php esc_html_e('A descriptive name for this action (for your reference only).', 'mxchat'); ?></p> | |
| 357 | 362 | </div> |
| 358 | 363 | |
| 359 | 364 | <div class="mxch-form-group"> |
| 360 | - <label><?php esc_html_e('Trigger Phrases', 'mxchat'); ?></label> | |
| 361 | - <div class="mxch-phrase-input-wrapper"> | |
| 362 | - <div class="mxch-phrase-tags" id="mxch-phrase-tags"> | |
| 363 | - <!-- Phrase pills rendered dynamically --> | |
| 364 | - </div> | |
| 365 | - <div class="mxch-phrase-add-row"> | |
| 366 | - <input type="text" id="mxch-phrase-input" placeholder="<?php esc_attr_e('Type a trigger phrase and press Enter', 'mxchat'); ?>"> | |
| 367 | - <button type="button" class="mxch-btn mxch-btn-sm" id="mxch-add-phrase-btn"><?php esc_html_e('Add', 'mxchat'); ?></button> | |
| 368 | - </div> | |
| 369 | - </div> | |
| 370 | - <p class="mxch-form-hint"><?php esc_html_e('Each phrase gets its own embedding vector for more accurate matching.', 'mxchat'); ?></p> | |
| 365 | + <label for="mxch-action-phrases"><?php esc_html_e('Trigger Phrases', 'mxchat'); ?></label> | |
| 366 | + <textarea id="mxch-action-phrases" name="phrases" rows="4" required placeholder="<?php esc_attr_e('sign me up, subscribe me, I want to join, add me to the newsletter', 'mxchat'); ?>"></textarea> | |
| 367 | + <p class="mxch-form-hint"><?php esc_html_e('Comma-separated phrases that will trigger this action.', 'mxchat'); ?></p> | |
| 371 | 368 | </div> |
| 372 | 369 | |
| 373 | 370 | <div class="mxch-form-group"> |
| 374 | 371 | <label for="mxch-action-threshold"> |
| @@ -406,9 +403,9 @@ | ||
| 406 | 403 | <button type="button" class="mxch-btn mxch-btn-secondary" id="mxch-cancel-action"> |
| 407 | 404 | <?php esc_html_e('Cancel', 'mxchat'); ?> |
| 408 | 405 | </button> |
| 409 | 406 | <button type="submit" class="mxch-btn mxch-btn-primary" id="mxch-save-action"> |
| 410 | - <?php esc_html_e('Save Trigger Phrase', 'mxchat'); ?> | |
| 407 | + <?php esc_html_e('Save Action', 'mxchat'); ?> | |
| 411 | 408 | </button> |
| 412 | 409 | </div> |
| 413 | 410 | </form> |
| 414 | 411 | </div> |
| @@ -419,9 +416,9 @@ | ||
| 419 | 416 | <button type="button" class="mxch-mobile-back-btn"> |
| 420 | 417 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg> |
| 421 | 418 | <?php esc_html_e('Back', 'mxchat'); ?> |
| 422 | 419 | </button> |
| 423 | - <h3 class="mxch-editor-title" id="mxch-view-title"><?php esc_html_e('Trigger Phrase Details', 'mxchat'); ?></h3> | |
| 420 | + <h3 class="mxch-editor-title" id="mxch-view-title"><?php esc_html_e('Action Details', 'mxchat'); ?></h3> | |
| 424 | 421 | <div class="mxch-header-actions"> |
| 425 | 422 | <label class="mxch-toggle-switch" title="<?php esc_attr_e('Toggle Enabled', 'mxchat'); ?>"> |
| 426 | 423 | <input type="checkbox" id="mxch-action-enabled-toggle" checked> |
| 427 | 424 | <span class="mxch-toggle-slider"></span> |
| @@ -440,10 +437,10 @@ | ||
| 440 | 437 | <div class="mxch-detail-icon" id="mxch-view-icon"> |
| 441 | 438 | <span class="dashicons dashicons-admin-generic"></span> |
| 442 | 439 | </div> |
| 443 | 440 | <div class="mxch-detail-content"> |
| 444 | - <h4 id="mxch-view-label"><?php esc_html_e('Label', 'mxchat'); ?></h4> | |
| 445 | - <p class="mxch-detail-type" id="mxch-view-type"><?php esc_html_e('Type', 'mxchat'); ?></p> | |
| 441 | + <h4 id="mxch-view-label"><?php esc_html_e('Action Label', 'mxchat'); ?></h4> | |
| 442 | + <p class="mxch-detail-type" id="mxch-view-type"><?php esc_html_e('Action Type', 'mxchat'); ?></p> | |
| 446 | 443 | </div> |
| 447 | 444 | </div> |
| 448 | 445 | |
| 449 | 446 | <div class="mxch-detail-section"> |
| @@ -478,209 +475,8 @@ | ||
| 478 | 475 | </div> |
| 479 | 476 | </div> |
| 480 | 477 | </div> |
| 481 | 478 | </div> |
| 482 | - | |
| 483 | - <!-- AI Tools Section (native function calling) --> | |
| 484 | - <!-- No content-header band here — the section starts directly at the | |
| 485 | - list+detail split panel, exactly like the Trigger Phrases section | |
| 486 | - (#all-actions) above, for pixel parity (plan 5f7409). The per- | |
| 487 | - approach explainer already lives on the Dashboard landing. --> | |
| 488 | - <div id="ai-tools" class="mxch-section <?php echo (isset($active_tab) && $active_tab === 'ai-tools') ? 'active' : ''; ?>"> | |
| 489 | - <div id="mxch-fc-settings" data-fc-nonce="<?php echo esc_attr(wp_create_nonce('mxchat_fc_autosave')); ?>"> | |
| 490 | - | |
| 491 | - <!-- Model-not-capable notice (relocated from the removed master toggle). | |
| 492 | - Tools can still be added; they just won't fire until a tool-capable | |
| 493 | - model is selected — so a user on a non-tool model isn't met with silence. --> | |
| 494 | - <?php if (empty($fc_model_capable)): ?> | |
| 495 | - <div class="mxch-notice mxch-notice-warning" style="margin-bottom: 20px;"> | |
| 496 | - <svg class="mxch-notice-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg> | |
| 497 | - <div><?php printf(esc_html__('Your current chat model (%s) does not support tools. You can still add tools here, but they will not fire until you choose a tool-capable model in Settings.', 'mxchat'), '<strong>' . esc_html($fc_current_model) . '</strong>'); ?></div> | |
| 498 | - </div> | |
| 499 | - <?php endif; ?> | |
| 500 | - | |
| 501 | - <!-- Brave-key-not-set notice (plan 183856). Web Search + Image Search | |
| 502 | - run on the Brave Search API; if either is enabled as a tool with no | |
| 503 | - brave_api_key configured, they silently won't fire — so the admin | |
| 504 | - gets a clear setup cue instead. Mirrors the model-not-capable notice. --> | |
| 505 | - <?php if (!empty($fc_brave_missing)): ?> | |
| 506 | - <div class="mxch-notice mxch-notice-warning" style="margin-bottom: 20px;"> | |
| 507 | - <svg class="mxch-notice-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg> | |
| 508 | - <div><?php printf(esc_html__('Web Search and Image Search are powered by Brave Search and need a Brave Search API key to work. Add your key under %s to enable them.', 'mxchat'), '<strong>' . esc_html__('Settings → Brave Search', 'mxchat') . '</strong>'); ?></div> | |
| 509 | - </div> | |
| 510 | - <?php endif; ?> | |
| 511 | - | |
| 512 | - <?php if (empty($fc_tools)): ?> | |
| 513 | - <div class="mxch-card"> | |
| 514 | - <div class="mxch-card-body"> | |
| 515 | - <p class="mxch-fc-intro"><?php esc_html_e('No tools available yet. Core search and image tools appear here, and activating add-ons like WooCommerce adds more.', 'mxchat'); ?></p> | |
| 516 | - </div> | |
| 517 | - </div> | |
| 518 | - <?php else: ?> | |
| 519 | - <?php | |
| 520 | - // Hidden store — the SINGLE source of truth for autosave. Each | |
| 521 | - // .mxch-fc-tool keeps its hidden marker + checkbox + usage-hint | |
| 522 | - // textarea exactly as the per-tool checklist did, so fcCollectAndSave() | |
| 523 | - // and the mxchat_fc_autosave endpoint are UNCHANGED (HARD: no data-model | |
| 524 | - // change). The master-detail list + detail panel below only toggle these | |
| 525 | - // inputs. A tool whose checkbox is checked = active (plan d450a7) — there | |
| 526 | - // is no global toggle and no per-tool enable checkbox in the UI anymore. | |
| 527 | - $fc_hint_max = (int) (class_exists('MxChat_Tool_Registry') ? MxChat_Tool_Registry::HINT_MAX : 500); | |
| 528 | - ?> | |
| 529 | - <div id="mxch-fc-tool-store" class="mxch-fc-tool-store" hidden aria-hidden="true"> | |
| 530 | - <?php foreach ($fc_tools as $fc_tool): | |
| 531 | - $fc_cb = $fc_tool['callback']; | |
| 532 | - $fc_on = !empty($fc_tool['enabled']); | |
| 533 | - $fc_icon = isset($fc_tool['icon']) ? $fc_tool['icon'] : 'admin-generic'; | |
| 534 | - ?> | |
| 535 | - <div class="mxch-fc-tool" | |
| 536 | - data-fc-callback="<?php echo esc_attr($fc_cb); ?>" | |
| 537 | - data-fc-label="<?php echo esc_attr($fc_tool['label']); ?>" | |
| 538 | - data-fc-desc="<?php echo esc_attr($fc_tool['description']); ?>" | |
| 539 | - data-fc-setup="<?php echo esc_attr(isset($fc_tool['setup_note']) ? $fc_tool['setup_note'] : ''); ?>" | |
| 540 | - data-fc-icon="<?php echo esc_attr($fc_icon); ?>" | |
| 541 | - data-fc-addon="<?php echo !empty($fc_tool['is_addon']) ? '1' : '0'; ?>" | |
| 542 | - data-fc-cautious="<?php echo !empty($fc_tool['cautious']) ? '1' : '0'; ?>"> | |
| 543 | - <input type="hidden" name="mxchat_fc_all_tools[]" value="<?php echo esc_attr($fc_cb); ?>"> | |
| 544 | - <input type="checkbox" name="mxchat_fc_tools[]" value="<?php echo esc_attr($fc_cb); ?>" <?php checked($fc_on); ?>> | |
| 545 | - <textarea class="mxch-fc-hint-input" data-fc-callback="<?php echo esc_attr($fc_cb); ?>" maxlength="<?php echo $fc_hint_max; ?>"><?php echo esc_textarea(isset($fc_tool['usage_hint']) ? $fc_tool['usage_hint'] : ''); ?></textarea> | |
| 546 | - </div> | |
| 547 | - <?php endforeach; ?> | |
| 548 | - </div> | |
| 549 | - | |
| 550 | - <!-- Master-detail split panel — clones the Trigger Phrases list+detail | |
| 551 | - component (same mxch-* classes/CSS) so AI Tools reads as the same surface. | |
| 552 | - FC-specific IDs keep the Trigger Phrases JS off these elements. --> | |
| 553 | - <div class="mxch-split-panel" | |
| 554 | - id="mxch-fc-panel" | |
| 555 | - data-i18n-tools="<?php esc_attr_e('tools', 'mxchat'); ?>" | |
| 556 | - data-i18n-tool="<?php esc_attr_e('tool', 'mxchat'); ?>" | |
| 557 | - data-i18n-active="<?php esc_attr_e('Active', 'mxchat'); ?>" | |
| 558 | - data-i18n-addon="<?php esc_attr_e('Add-on', 'mxchat'); ?>" | |
| 559 | - data-i18n-sensitive="<?php esc_attr_e('Sensitive', 'mxchat'); ?>" | |
| 560 | - data-i18n-nohint="<?php esc_attr_e('No usage note — the AI decides on its own when to use this.', 'mxchat'); ?>"> | |
| 561 | - | |
| 562 | - <!-- Left: tool list --> | |
| 563 | - <div class="mxch-action-list-panel"> | |
| 564 | - <!-- Bulk Actions Toolbar — exact clone of the Trigger Phrases | |
| 565 | - #all-actions toolbar (All select-all + bulk-remove trash), | |
| 566 | - FC-specific IDs so the Trigger Phrases JS stays off it (plan 5f7409). --> | |
| 567 | - <div class="mxch-bulk-toolbar"> | |
| 568 | - <label class="mxch-bulk-select-all"> | |
| 569 | - <input type="checkbox" id="mxch-fc-select-all"> | |
| 570 | - <span><?php esc_html_e('All', 'mxchat'); ?></span> | |
| 571 | - </label> | |
| 572 | - <span class="mxch-selected-count" id="mxch-fc-selected-count">0</span> | |
| 573 | - <div class="mxch-bulk-actions"> | |
| 574 | - <button type="button" class="mxch-bulk-btn mxch-bulk-delete" id="mxch-fc-delete-selected" disabled title="<?php esc_attr_e('Remove Selected', 'mxchat'); ?>"> | |
| 575 | - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> | |
| 576 | - </button> | |
| 577 | - </div> | |
| 578 | - </div> | |
| 579 | - <div class="mxch-panel-header"> | |
| 580 | - <div class="mxch-search-wrapper"> | |
| 581 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg> | |
| 582 | - <input type="text" id="mxch-fc-search" class="mxch-search-input" placeholder="<?php esc_attr_e('Search tools...', 'mxchat'); ?>"> | |
| 583 | - </div> | |
| 584 | - <div class="mxch-panel-title-row"> | |
| 585 | - <span class="mxch-panel-count" id="mxch-fc-count">0 <?php esc_html_e('tools', 'mxchat'); ?></span> | |
| 586 | - <div class="mxch-panel-actions"> | |
| 587 | - <button type="button" id="mxch-fc-add-btn" class="mxch-btn mxch-btn-primary mxch-btn-sm js-mxch-fc-add" title="<?php esc_attr_e('Add Tool', 'mxchat'); ?>"> | |
| 588 | - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> | |
| 589 | - <?php esc_html_e('Add', 'mxchat'); ?> | |
| 590 | - </button> | |
| 591 | - <button type="button" id="mxch-fc-refresh" class="mxch-icon-btn" title="<?php esc_attr_e('Refresh', 'mxchat'); ?>"> | |
| 592 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M16 16h5v5"/></svg> | |
| 593 | - </button> | |
| 594 | - </div> | |
| 595 | - </div> | |
| 596 | - </div> | |
| 597 | - <div class="mxch-action-list" id="mxch-fc-list"> | |
| 598 | - <!-- Tool rows built by JS from the hidden store (enabled tools only) --> | |
| 599 | - </div> | |
| 600 | - <div class="mxch-panel-footer"> | |
| 601 | - <span id="mxch-fc-save-status" class="mxch-fc-save-status" role="status" aria-live="polite"></span> | |
| 602 | - </div> | |
| 603 | - </div> | |
| 604 | - | |
| 605 | - <!-- Right: detail / view panel --> | |
| 606 | - <div class="mxch-action-detail-panel" id="mxch-fc-detail-panel"> | |
| 607 | - <!-- Empty state --> | |
| 608 | - <div class="mxch-action-empty" id="mxch-fc-empty"> | |
| 609 | - <div class="mxch-empty-icon"> | |
| 610 | - <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg> | |
| 611 | - </div> | |
| 612 | - <h3><?php esc_html_e('Select a tool', 'mxchat'); ?></h3> | |
| 613 | - <p><?php esc_html_e('Choose a tool from the list to view details and edit when the AI should use it, or add a new one.', 'mxchat'); ?></p> | |
| 614 | - <button type="button" class="mxch-btn mxch-btn-primary js-mxch-fc-add"> | |
| 615 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> | |
| 616 | - <?php esc_html_e('Add Tool', 'mxchat'); ?> | |
| 617 | - </button> | |
| 618 | - </div> | |
| 619 | - | |
| 620 | - <!-- Tool view (shown when a tool is selected) --> | |
| 621 | - <div class="mxch-action-editor" id="mxch-fc-view" style="display: none;"> | |
| 622 | - <div class="mxch-editor-header"> | |
| 623 | - <button type="button" class="mxch-mobile-back-btn"> | |
| 624 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg> | |
| 625 | - <?php esc_html_e('Back', 'mxchat'); ?> | |
| 626 | - </button> | |
| 627 | - <h3 class="mxch-editor-title"><?php esc_html_e('Tool Details', 'mxchat'); ?></h3> | |
| 628 | - <div class="mxch-header-actions"> | |
| 629 | - <button type="button" class="mxch-icon-btn" id="mxch-fc-edit-btn" title="<?php esc_attr_e('Edit usage note', 'mxchat'); ?>"> | |
| 630 | - <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> | |
| 631 | - </button> | |
| 632 | - <button type="button" class="mxch-icon-btn mxch-btn-danger-icon" id="mxch-fc-remove-btn" title="<?php esc_attr_e('Remove tool', 'mxchat'); ?>"> | |
| 633 | - <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> | |
| 634 | - </button> | |
| 635 | - </div> | |
| 636 | - </div> | |
| 637 | - | |
| 638 | - <div class="mxch-action-details"> | |
| 639 | - <div class="mxch-detail-card"> | |
| 640 | - <div class="mxch-detail-icon" id="mxch-fc-view-icon"> | |
| 641 | - <span class="dashicons dashicons-admin-generic"></span> | |
| 642 | - </div> | |
| 643 | - <div class="mxch-detail-content"> | |
| 644 | - <h4 id="mxch-fc-view-label"><?php esc_html_e('Tool', 'mxchat'); ?></h4> | |
| 645 | - <p class="mxch-detail-type" id="mxch-fc-view-type"></p> | |
| 646 | - </div> | |
| 647 | - </div> | |
| 648 | - | |
| 649 | - <div class="mxch-detail-section"> | |
| 650 | - <h5><?php esc_html_e('What it does', 'mxchat'); ?></h5> | |
| 651 | - <p class="mxch-fc-view-desc" id="mxch-fc-view-desc"></p> | |
| 652 | - </div> | |
| 653 | - | |
| 654 | - <div class="mxch-detail-section"> | |
| 655 | - <h5><?php esc_html_e('When the assistant uses this', 'mxchat'); ?></h5> | |
| 656 | - <p class="mxch-fc-view-hint" id="mxch-fc-view-hint"></p> | |
| 657 | - </div> | |
| 658 | - | |
| 659 | - <!-- Setup requirement (plan 183856) — only shown for tools that | |
| 660 | - declare a setup_note (e.g. Web/Image Search → Brave key). JS | |
| 661 | - toggles this section based on the tool's data-fc-setup. --> | |
| 662 | - <div class="mxch-detail-section" id="mxch-fc-view-setup-wrap" style="display:none;"> | |
| 663 | - <h5><?php esc_html_e('Setup', 'mxchat'); ?></h5> | |
| 664 | - <p class="mxch-fc-view-setup" id="mxch-fc-view-setup"></p> | |
| 665 | - </div> | |
| 666 | - | |
| 667 | - <div class="mxch-detail-section"> | |
| 668 | - <h5><?php esc_html_e('Status', 'mxchat'); ?></h5> | |
| 669 | - <div class="mxch-settings-grid"> | |
| 670 | - <div class="mxch-setting-item"> | |
| 671 | - <span class="mxch-setting-label"><?php esc_html_e('State', 'mxchat'); ?></span> | |
| 672 | - <span class="mxch-setting-value mxch-status-badge"><?php esc_html_e('Active', 'mxchat'); ?></span> | |
| 673 | - </div> | |
| 674 | - </div> | |
| 675 | - </div> | |
| 676 | - </div> | |
| 677 | - </div> | |
| 678 | - </div> | |
| 679 | - </div> | |
| 680 | - <?php endif; ?> | |
| 681 | - </div> | |
| 682 | - </div> | |
| 683 | 479 | </main> |
| 684 | 480 | </div> |
| 685 | 481 | |
| 686 | 482 | <!-- Loading Overlay --> |
| @@ -685,9 +481,9 @@ | ||
| 685 | 481 | |
| 686 | 482 | <!-- Loading Overlay --> |
| 687 | 483 | <div id="mxch-action-loading" class="mxch-loading-overlay" style="display: none;"> |
| 688 | 484 | <div class="mxch-loading-spinner"></div> |
| 689 | - <div class="mxch-loading-text"><?php esc_html_e('Saving, please wait...', 'mxchat'); ?></div> | |
| 485 | + <div class="mxch-loading-text"><?php esc_html_e('Saving action, please wait...', 'mxchat'); ?></div> | |
| 690 | 486 | </div> |
| 691 | 487 | |
| 692 | 488 | <!-- Delete Confirmation Modal --> |
| 693 | 489 | <div id="mxch-delete-modal" class="mxch-modal-overlay" style="display: none;"> |
| @@ -692,70 +488,17 @@ | ||
| 692 | 488 | <!-- Delete Confirmation Modal --> |
| 693 | 489 | <div id="mxch-delete-modal" class="mxch-modal-overlay" style="display: none;"> |
| 694 | 490 | <div class="mxch-modal-content mxch-modal-sm"> |
| 695 | 491 | <div class="mxch-modal-header"> |
| 696 | - <h2><?php esc_html_e('Delete Trigger Phrase', 'mxchat'); ?></h2> | |
| 492 | + <h2><?php esc_html_e('Delete Action', 'mxchat'); ?></h2> | |
| 697 | 493 | <button type="button" class="mxch-modal-close">×</button> |
| 698 | 494 | </div> |
| 699 | 495 | <div class="mxch-modal-body"> |
| 700 | - <p><?php esc_html_e('Are you sure you want to delete this trigger phrase? This cannot be undone.', 'mxchat'); ?></p> | |
| 496 | + <p><?php esc_html_e('Are you sure you want to delete this action? This cannot be undone.', 'mxchat'); ?></p> | |
| 701 | 497 | </div> |
| 702 | 498 | <div class="mxch-modal-footer"> |
| 703 | 499 | <button type="button" class="mxch-btn mxch-btn-secondary" id="mxch-cancel-delete"><?php esc_html_e('Cancel', 'mxchat'); ?></button> |
| 704 | 500 | <button type="button" class="mxch-btn mxch-btn-danger" id="mxch-confirm-delete"><?php esc_html_e('Delete', 'mxchat'); ?></button> |
| 705 | - </div> | |
| 706 | - </div> | |
| 707 | - </div> | |
| 708 | - | |
| 709 | - <!-- Add-Tool modal (AI Tools card flow, plan 8bbf98 part 4) --> | |
| 710 | - <div id="mxch-fc-tool-modal" class="mxch-modal-overlay" style="display: none;"> | |
| 711 | - <div class="mxch-modal-content mxch-modal-lg"> | |
| 712 | - <!-- Step 1: pick a capability --> | |
| 713 | - <div class="mxch-fc-modal-step" data-step="1"> | |
| 714 | - <div class="mxch-modal-header"> | |
| 715 | - <h2><?php esc_html_e('Add a Tool', 'mxchat'); ?></h2> | |
| 716 | - <button type="button" class="mxch-modal-close" data-fc-modal-close>×</button> | |
| 717 | - </div> | |
| 718 | - <div class="mxch-modal-body"> | |
| 719 | - <p class="mxch-fc-intro"><?php esc_html_e('Pick a capability the AI can call from the conversation.', 'mxchat'); ?></p> | |
| 720 | - <div class="mxch-types-grid mxch-fc-modal-grid" id="mxch-fc-modal-grid"></div> | |
| 721 | - <p class="mxch-fc-modal-allset" id="mxch-fc-modal-allset" style="display:none;"><?php esc_html_e('Every available tool is already added. Activate add-ons like WooCommerce to unlock more.', 'mxchat'); ?></p> | |
| 722 | - </div> | |
| 723 | - </div> | |
| 724 | - <!-- Step 2: confirm + when-to-use --> | |
| 725 | - <div class="mxch-fc-modal-step" data-step="2" style="display:none;"> | |
| 726 | - <div class="mxch-modal-header"> | |
| 727 | - <button type="button" class="mxch-back-btn" id="mxch-fc-modal-back"> | |
| 728 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg> | |
| 729 | - <?php esc_html_e('Back', 'mxchat'); ?> | |
| 730 | - </button> | |
| 731 | - <h2 id="mxch-fc-modal-step2-title" data-add-title="<?php esc_attr_e('Add Tool', 'mxchat'); ?>" data-edit-title="<?php esc_attr_e('Edit Tool', 'mxchat'); ?>"><?php esc_html_e('Add Tool', 'mxchat'); ?></h2> | |
| 732 | - <button type="button" class="mxch-modal-close" data-fc-modal-close>×</button> | |
| 733 | - </div> | |
| 734 | - <div class="mxch-modal-body"> | |
| 735 | - <div class="mxch-selected-type"> | |
| 736 | - <div class="mxch-selected-type-icon" id="mxch-fc-modal-selected-icon"> | |
| 737 | - <span class="dashicons dashicons-admin-generic"></span> | |
| 738 | - </div> | |
| 739 | - <div class="mxch-selected-type-info"> | |
| 740 | - <h4 id="mxch-fc-modal-selected-label"><?php esc_html_e('Selected tool', 'mxchat'); ?></h4> | |
| 741 | - <p id="mxch-fc-modal-selected-desc"></p> | |
| 742 | - </div> | |
| 743 | - </div> | |
| 744 | - <div class="mxch-form-group"> | |
| 745 | - <label for="mxch-fc-modal-hint"><?php esc_html_e('When should the assistant use this?', 'mxchat'); ?></label> | |
| 746 | - <textarea id="mxch-fc-modal-hint" class="mxch-fc-modal-hint-input" rows="3" maxlength="<?php echo (int) (class_exists('MxChat_Tool_Registry') ? MxChat_Tool_Registry::HINT_MAX : 500); ?>" placeholder="<?php esc_attr_e('Optional — e.g. “Use only when the visitor asks about pricing or discounts.”', 'mxchat'); ?>"></textarea> | |
| 747 | - <p class="mxch-form-hint"><?php esc_html_e('Leave blank to let the AI decide on its own. Your note is added to what the model knows about this tool.', 'mxchat'); ?></p> | |
| 748 | - </div> | |
| 749 | - <div class="mxch-fc-modal-sensitive-note" id="mxch-fc-modal-sensitive" style="display:none;"> | |
| 750 | - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg> | |
| 751 | - <span><?php esc_html_e('Sensitive tool — it can spend money, expose customer data, or hand off to a human. Only add it if you want the AI to do that.', 'mxchat'); ?></span> | |
| 752 | - </div> | |
| 753 | - </div> | |
| 754 | - <div class="mxch-modal-footer"> | |
| 755 | - <button type="button" class="mxch-btn mxch-btn-secondary" data-fc-modal-close><?php esc_html_e('Cancel', 'mxchat'); ?></button> | |
| 756 | - <button type="button" class="mxch-btn mxch-btn-primary" id="mxch-fc-modal-save" data-add-label="<?php esc_attr_e('Add Tool', 'mxchat'); ?>" data-save-label="<?php esc_attr_e('Save Changes', 'mxchat'); ?>"><?php esc_html_e('Add Tool', 'mxchat'); ?></button> | |
| 757 | - </div> | |
| 758 | 501 | </div> |
| 759 | 502 | </div> |
| 760 | 503 | </div> |
| 761 | 504 | |