untrailingslashit(esc_url_raw($post['api_url'] ?? '')) ?: AIINA_DEFAULT_API_URL, 'firm_name' => sanitize_text_field($post['firm_name'] ?? ''), 'practice_areas' => sanitize_text_field($post['practice_areas'] ?? ''), 'faq_text' => sanitize_textarea_field($post['faq_text'] ?? ''), 'notify_email' => sanitize_email($post['notify_email'] ?? ''), 'accent' => sanitize_hex_color($post['accent'] ?? '') ?: '#1e3a8a', ); update_option('aiina_settings', $opt); // Register this firm's config with the backend. $resp = wp_remote_post($opt['api_url'] . '/register-site', array( 'headers' => array('Content-Type' => 'application/json'), 'timeout' => 15, 'body' => wp_json_encode(array( 'site_id' => $site_id, 'firm_name' => $opt['firm_name'], 'practice_areas' => $opt['practice_areas'], 'faq_text' => $opt['faq_text'], 'notify_email' => $opt['notify_email'], )), )); if (is_wp_error($resp)) { echo '

Saved locally, but could not reach the backend: ' . esc_html($resp->get_error_message()) . '

'; } else { echo '

Settings saved and synced to the assistant.

'; } } $v = function ($k) use ($opt) { return isset($opt[$k]) ? $opt[$k] : ''; }; ?>

AI Intake Assistant

Configure your assistant. Your Site ID is (keep this).

!empty($opt['api_url']) ? $opt['api_url'] : AIINA_DEFAULT_API_URL, 'siteId' => get_option('aiina_site_id'), 'firmName' => isset($opt['firm_name']) ? $opt['firm_name'] : 'Our Firm', 'accent' => isset($opt['accent']) ? $opt['accent'] : '#1e3a8a', 'greeting' => 'Hi! I can answer questions about the firm or help you book a free consultation. How can I help?', ); wp_add_inline_script('aiina-widget', 'window.AIINA_CONFIG=' . wp_json_encode($cfg) . ';', 'before'); });