| @@ -86,8 +86,9 @@ | ||
| 86 | 86 | <button class="mxch-mobile-nav-sub-link" data-target="integrations-loops"><?php esc_html_e('Loops', 'mxchat'); ?></button> |
| 87 | 87 | <button class="mxch-mobile-nav-sub-link" data-target="integrations-brave"><?php esc_html_e('Brave Search', 'mxchat'); ?></button> |
| 88 | 88 | <button class="mxch-mobile-nav-sub-link" data-target="integrations-slack"><?php esc_html_e('Slack', 'mxchat'); ?></button> |
| 89 | 89 | <button class="mxch-mobile-nav-sub-link" data-target="integrations-telegram"><?php esc_html_e('Telegram', 'mxchat'); ?></button> |
| 90 | + <button class="mxch-mobile-nav-sub-link" data-target="integrations-webhook"><?php esc_html_e('Webhook', 'mxchat'); ?></button> | |
| 90 | 91 | </div> |
| 91 | 92 | </div> |
| 92 | 93 | <!-- Resources Section --> |
| 93 | 94 | <div class="mxch-mobile-nav-section"> |
| @@ -188,8 +189,9 @@ | ||
| 188 | 189 | <button class="mxch-nav-sub-link" data-target="integrations-loops"><?php esc_html_e('Loops', 'mxchat'); ?></button> |
| 189 | 190 | <button class="mxch-nav-sub-link" data-target="integrations-brave"><?php esc_html_e('Brave Search', 'mxchat'); ?></button> |
| 190 | 191 | <button class="mxch-nav-sub-link" data-target="integrations-slack"><?php esc_html_e('Slack', 'mxchat'); ?></button> |
| 191 | 192 | <button class="mxch-nav-sub-link" data-target="integrations-telegram"><?php esc_html_e('Telegram', 'mxchat'); ?></button> |
| 193 | + <button class="mxch-nav-sub-link" data-target="integrations-webhook"><?php esc_html_e('Webhook', 'mxchat'); ?></button> | |
| 192 | 194 | </div> |
| 193 | 195 | </div> |
| 194 | 196 | </div> |
| 195 | 197 | |
| @@ -336,8 +338,14 @@ | ||
| 336 | 338 | mxchat_render_field_wrapper('citation_links', __('Citation Links', 'mxchat'), function() use ($admin_instance) { |
| 337 | 339 | $admin_instance->mxchat_citation_links_toggle_callback(); |
| 338 | 340 | }, __('Allow the AI to include citation links from your knowledge database in responses. If disabled, ensure your AI Behavior settings do not mention links or the AI may fabricate URLs.', 'mxchat')); |
| 339 | 341 | |
| 342 | + // Strip Unapproved Links (plan 58f8b4) — enforcement is now | |
| 343 | + // its own control instead of riding Citation Links. | |
| 344 | + mxchat_render_field_wrapper('strip_unapproved_links', __('Strip Unapproved Links', 'mxchat'), function() use ($admin_instance) { | |
| 345 | + $admin_instance->mxchat_strip_unapproved_links_toggle_callback(); | |
| 346 | + }, __('Remove links the AI invents from its answers, even when Citation Links is off. Approved citations, real pages on this site, and links returned by your integrations (e.g. WooCommerce products) are always kept. On by default for new installs; existing sites keep their current behavior until enabled.', 'mxchat')); | |
| 347 | + | |
| 340 | 348 | // Satisfaction Rating Prompt |
| 341 | 349 | // The toggle callback inline-renders the 5 customization |
| 342 | 350 | // fields inside a single sub-options wrapper (plan-29caac). |
| 343 | 351 | // No separate customization group needed — the wrapper handles |
| @@ -489,8 +497,33 @@ | ||
| 489 | 497 | // Name Placeholder |
| 490 | 498 | mxchat_render_field_wrapper('name_placeholder', __('Name Field Placeholder', 'mxchat'), function() use ($admin_instance) { |
| 491 | 499 | $admin_instance->name_field_placeholder_callback(); |
| 492 | 500 | }, __('Placeholder text for the name input field.', 'mxchat')); |
| 501 | + | |
| 502 | + // Consent Checkbox (b062c4) | |
| 503 | + mxchat_render_field_wrapper('enable_consent_checkbox', __('Consent Checkbox', 'mxchat'), function() use ($admin_instance) { | |
| 504 | + $admin_instance->enable_consent_checkbox_callback(); | |
| 505 | + }, __('Show a consent checkbox on the email form. The decision, time, and exact label shown are stored with the lead.', 'mxchat')); | |
| 506 | + | |
| 507 | + // Consent Label | |
| 508 | + mxchat_render_field_wrapper('consent_checkbox_label', __('Consent Label', 'mxchat'), function() use ($admin_instance) { | |
| 509 | + $admin_instance->consent_checkbox_label_callback(); | |
| 510 | + }, __('Text shown beside the checkbox. Anchor tags are allowed so you can link your Privacy Policy; other HTML is stripped.', 'mxchat')); | |
| 511 | + | |
| 512 | + // Consent Required | |
| 513 | + mxchat_render_field_wrapper('consent_checkbox_required', __('Require Consent to Submit', 'mxchat'), function() use ($admin_instance) { | |
| 514 | + $admin_instance->consent_checkbox_required_callback(); | |
| 515 | + }, __('Block form submission until the box is ticked. Off means the checkbox is optional (a soft opt-in).', 'mxchat')); | |
| 516 | + | |
| 517 | + // Also show for logged-in users (c0cfaf) | |
| 518 | + mxchat_render_field_wrapper('lead_capture_logged_in_toggle', __('Also Show for Logged-In Users', 'mxchat'), function() use ($admin_instance) { | |
| 519 | + $admin_instance->lead_capture_logged_in_toggle_callback(); | |
| 520 | + }, __('Show the form to signed-in visitors too, pre-filled from their profile. Off means signed-in visitors skip it, as they do today.', 'mxchat')); | |
| 521 | + | |
| 522 | + // Require email (c0cfaf) | |
| 523 | + mxchat_render_field_wrapper('lead_capture_require_email_toggle', __('Require Email Address', 'mxchat'), function() use ($admin_instance) { | |
| 524 | + $admin_instance->lead_capture_require_email_toggle_callback(); | |
| 525 | + }, __('Off means the email field is optional, so you can collect a name (and consent) without an address.', 'mxchat')); | |
| 493 | 526 | ?> |
| 494 | 527 | </div> |
| 495 | 528 | </div> |
| 496 | 529 | |
| @@ -1092,8 +1125,69 @@ | ||
| 1092 | 1125 | <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" style="vertical-align: middle; margin-right: 4px;"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg> |
| 1093 | 1126 | <?php esc_html_e('Enter your Bot Token above and save to generate the registration URL.', 'mxchat'); ?> |
| 1094 | 1127 | </p> |
| 1095 | 1128 | <?php endif; ?> |
| 1129 | + </div> | |
| 1130 | + </div> | |
| 1131 | + </div> | |
| 1132 | + | |
| 1133 | + <!-- ======================================== | |
| 1134 | + INTEGRATIONS - WEBHOOK HANDOFF (plan d88e22) | |
| 1135 | + ======================================== --> | |
| 1136 | + <div id="integrations-webhook" class="mxch-section"> | |
| 1137 | + <div class="mxch-content-header"> | |
| 1138 | + <h1 class="mxch-content-title"><?php esc_html_e('Webhook', 'mxchat'); ?></h1> | |
| 1139 | + <p class="mxch-content-subtitle"><?php esc_html_e('Route live-agent handoffs to any URL you choose — your helpdesk, an automation flow, a CRM.', 'mxchat'); ?></p> | |
| 1140 | + </div> | |
| 1141 | + | |
| 1142 | + <div class="mxch-notice mxch-notice-info" style="margin-bottom: 24px;"> | |
| 1143 | + <svg class="mxch-notice-icon" 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"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> | |
| 1144 | + <div> | |
| 1145 | + <?php esc_html_e('This destination is outbound-only: MxChat delivers the handoff to your URL and the chatbot keeps assisting the visitor. Your team follows up separately — by email, phone, or your own support tool.', 'mxchat'); ?> | |
| 1146 | + </div> | |
| 1147 | + </div> | |
| 1148 | + | |
| 1149 | + <div class="mxch-card"> | |
| 1150 | + <div class="mxch-card-body mxchat-autosave-section"> | |
| 1151 | + <table class="form-table"> | |
| 1152 | + <?php do_settings_fields('mxchat-embed', 'mxchat_webhook_handoff_section'); ?> | |
| 1153 | + </table> | |
| 1154 | + </div> | |
| 1155 | + </div> | |
| 1156 | + | |
| 1157 | + <div class="mxch-card" style="margin-top: 24px;"> | |
| 1158 | + <div class="mxch-card-header"> | |
| 1159 | + <h3 class="mxch-card-title"> | |
| 1160 | + <svg class="mxch-card-title-icon" 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"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg> | |
| 1161 | + <?php esc_html_e('Payload Reference', 'mxchat'); ?> | |
| 1162 | + </h3> | |
| 1163 | + </div> | |
| 1164 | + <div class="mxch-card-body"> | |
| 1165 | + <p class="mxch-field-description" style="margin-bottom: 12px;"> | |
| 1166 | + <?php esc_html_e('Each handoff arrives at your URL as an HTTPS POST with Content-Type application/json:', 'mxchat'); ?> | |
| 1167 | + </p> | |
| 1168 | + <pre style="background: #f8f9fa; padding: 16px; border-radius: 8px; font-size: 12px; overflow-x: auto; margin: 0 0 16px;"><?php echo esc_html('{ | |
| 1169 | + "event": "live_agent_handoff", | |
| 1170 | + "site": { "name": "Your Site", "url": "https://your-site.com" }, | |
| 1171 | + "session_id": "mxchat_chat_…", | |
| 1172 | + "user_id": 0, | |
| 1173 | + "visitor": { "name": "Ada", "email": "[email protected]" }, | |
| 1174 | + "current_message": "I need to talk to a human", | |
| 1175 | + "recent_messages": [ | |
| 1176 | + { "role": "user", "content": "…", "timestamp": 1755900000 }, | |
| 1177 | + { "role": "assistant", "content": "…", "timestamp": 1755900012 } | |
| 1178 | + ], | |
| 1179 | + "requested_at": "2026-08-22T14:30:00+00:00" | |
| 1180 | +}'); ?></pre> | |
| 1181 | + <p class="mxch-field-description" style="margin-bottom: 12px;"> | |
| 1182 | + <?php esc_html_e('When a Signing Secret is set, each request also carries this header so your endpoint can verify the sender — compute the HMAC of the raw request body with your secret and compare:', 'mxchat'); ?> | |
| 1183 | + </p> | |
| 1184 | + <div class="mxch-webhook-url-display" style="margin-bottom: 16px;"> | |
| 1185 | + <code>X-MxChat-Signature: sha256=<hex hmac-sha256 of the raw body></code> | |
| 1186 | + </div> | |
| 1187 | + <p class="mxch-field-description"> | |
| 1188 | + <?php esc_html_e('Answer with any 2xx status. Delivery uses a 5-second timeout with one retry on transport errors and 5xx responses; redirects are not followed. The last failed delivery is shown under the Webhook URL field above.', 'mxchat'); ?> | |
| 1189 | + </p> | |
| 1096 | 1190 | </div> |
| 1097 | 1191 | </div> |
| 1098 | 1192 | </div> |
| 1099 | 1193 | |