tab label, title, intro and feature list.
*/
function avca_get_pro_teasers() {
if ( avca_pro_active() ) {
return array();
}
return array(
'pro-ai' => array(
'tab' => __( 'AI Answers', 'avi-support-assistant' ),
'title' => __( 'Let AI answer what your FAQs cannot', 'avi-support-assistant' ),
'intro' => __( 'When no FAQ matches, the assistant answers with AI using your own API key, so visitors get a helpful reply instead of "I don\'t know".', 'avi-support-assistant' ),
'features' => array(
__( 'Works with OpenAI (ChatGPT), Google Gemini, Anthropic Claude, OpenRouter and DeepSeek', 'avi-support-assistant' ),
__( 'Uses your questions and answers and matching pages from your site', 'avi-support-assistant' ),
__( 'Remembers the conversation for follow-up questions', 'avi-support-assistant' ),
__( 'Replies in the visitor\'s language', 'avi-support-assistant' ),
__( 'Monthly and per-visitor limits to control API costs', 'avi-support-assistant' ),
),
),
'pro-voice' => array(
'tab' => __( 'Voice Chat', 'avi-support-assistant' ),
'title' => __( 'Visitors can talk to your assistant', 'avi-support-assistant' ),
'intro' => __( 'A microphone button lets visitors speak their question, and the assistant can read its answer aloud.', 'avi-support-assistant' ),
'features' => array(
__( 'Speak instead of typing, great on mobile', 'avi-support-assistant' ),
__( 'Spoken replies, always or only after a voice question', 'avi-support-assistant' ),
__( 'Mute button for visitors', 'avi-support-assistant' ),
__( 'Follows your site language', 'avi-support-assistant' ),
),
),
'pro-crm' => array(
'tab' => __( 'Zoho CRM', 'avi-support-assistant' ),
'title' => __( 'Send every lead to your CRM automatically', 'avi-support-assistant' ),
'intro' => __( 'Chat leads and callback requests are created in Zoho CRM the moment a visitor submits them.', 'avi-support-assistant' ),
'features' => array(
__( 'Zoho CRM Leads, all data centres (India, US, EU and more)', 'avi-support-assistant' ),
__( 'Webhook for Zapier, Make, n8n, HubSpot and other CRMs', 'avi-support-assistant' ),
__( 'Sync status shown in your Leads list', 'avi-support-assistant' ),
),
),
'pro-analytics' => array(
'tab' => __( 'History & Analytics', 'avi-support-assistant' ),
'title' => __( 'See every conversation and what visitors ask', 'avi-support-assistant' ),
'intro' => __( 'Read full chat transcripts and find out how well your assistant is answering.', 'avi-support-assistant' ),
'features' => array(
__( 'Conversation history with full transcripts', 'avi-support-assistant' ),
__( 'How questions were answered: FAQ, AI, products, site search or no answer', 'avi-support-assistant' ),
__( 'Top visitor questions and conversations per day', 'avi-support-assistant' ),
__( 'CSV export and automatic clean-up of old chats', 'avi-support-assistant' ),
),
),
'pro-woo' => array(
'tab' => __( 'WooCommerce', 'avi-support-assistant' ),
'title' => __( 'Sell and support customers inside the chat', 'avi-support-assistant' ),
'intro' => __( 'Visitors can find products and check their orders without leaving the chat.', 'avi-support-assistant' ),
'features' => array(
__( '"Find a product" search with prices, images and Add to cart', 'avi-support-assistant' ),
__( '"Track my order" with order number and billing email', 'avi-support-assistant' ),
__( 'Optional product suggestions when no FAQ matches', 'avi-support-assistant' ),
),
),
'pro-hours' => array(
'tab' => __( 'Office Hours & Languages', 'avi-support-assistant' ),
'title' => __( 'Right message, right time, right language', 'avi-support-assistant' ),
'intro' => __( 'Tell visitors when you are closed and serve every language on your site.', 'avi-support-assistant' ),
'features' => array(
__( 'Opening hours for each day, with a closed message', 'avi-support-assistant' ),
__( 'Hide Call and WhatsApp buttons while closed', 'avi-support-assistant' ),
__( 'Translate bot texts and FAQs with WPML or Polylang', 'avi-support-assistant' ),
),
),
);
}
/**
* Render one locked Pro tab.
*
* @param array $teaser Teaser data.
*/
function avca_render_pro_teaser( $teaser ) {
?>
__( 'Starter', 'avi-support-assistant' ),
'sites' => __( '1 website', 'avi-support-assistant' ),
'yearly' => '₹2,499',
'monthly' => '₹299',
'lifetime' => '₹7,999',
),
array(
'name' => __( 'Pro', 'avi-support-assistant' ),
'sites' => __( '3 websites', 'avi-support-assistant' ),
'yearly' => '₹4,999',
'monthly' => '₹549',
'lifetime' => '₹14,999',
'popular' => true,
),
array(
'name' => __( 'Agency', 'avi-support-assistant' ),
'sites' => __( '25 websites', 'avi-support-assistant' ),
'yearly' => '₹11,999',
'monthly' => '',
'lifetime' => '₹29,999',
),
);
}
/**
* Render the Upgrade to Pro page.
*/
function avca_render_upgrade_page() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$features = array(
__( 'AI answers with your own API key: OpenAI (ChatGPT), Google Gemini, Anthropic Claude, OpenRouter or DeepSeek', 'avi-support-assistant' ),
__( 'AI uses your FAQs and site content, and replies in the visitor\'s language', 'avi-support-assistant' ),
__( 'Voice chat: visitors speak their question and hear the answer', 'avi-support-assistant' ),
__( 'Zoho CRM lead sync, plus a webhook for any other CRM', 'avi-support-assistant' ),
__( 'Chat history, analytics dashboard and CSV export', 'avi-support-assistant' ),
__( 'WooCommerce product search and order tracking in the chat', 'avi-support-assistant' ),
__( 'Office hours with a different message when you are closed', 'avi-support-assistant' ),
__( 'Multi-language with WPML and Polylang', 'avi-support-assistant' ),
__( 'Priority email support and all updates while your licence is active', 'avi-support-assistant' ),
);
?>
'avca-unanswered',
'avca_notice' => '' === $key ? 'cleared' : 'deleted',
),
admin_url( 'admin.php' )
)
);
exit;
}
add_action( 'admin_post_avca_delete_unanswered', 'avca_handle_delete_unanswered' );
/**
* Admin assets for the plugin screens.
*
* @param string $hook_suffix Current admin page hook.
*/
function avca_admin_assets( $hook_suffix ) {
if ( 'toplevel_page_' . AVCA_MENU_SLUG !== $hook_suffix ) {
return;
}
wp_enqueue_media();
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style( 'avca-admin', AVCA_URL . 'assets/css/admin.css', array(), AVCA_VERSION );
wp_enqueue_script( 'avca-admin', AVCA_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker' ), AVCA_VERSION, true );
wp_localize_script(
'avca-admin',
'avcaAdmin',
array(
'mediaTitle' => __( 'Choose bot icon', 'avi-support-assistant' ),
'mediaButton' => __( 'Use this image', 'avi-support-assistant' ),
)
);
wp_localize_script(
'avca-admin',
'avcaFaqConfig',
array(
'isPro' => avca_pro_active(),
'maxFree' => 3,
'templates' => function_exists( 'avca_get_faq_templates' ) ? avca_get_faq_templates() : array(),
'upgradeUrl' => admin_url( 'admin.php?page=avca-upgrade' ),
'i18n' => array(
'confirmReplace' => __( 'Do you want to replace your existing FAQs with this template? Click OK to replace existing questions, or Cancel to append up to the allowed limit.', 'avi-support-assistant' ),
'limitReached' => __( 'Free Plan Limit: You can have at most 3 FAQs on the Free plan. Upgrade to Pro for unlimited questions.', 'avi-support-assistant' ),
),
)
);
}
add_action( 'admin_enqueue_scripts', 'avca_admin_assets' );
/**
* Small style for the unanswered page's inline forms.
*/
function avca_admin_unanswered_style() {
$screen = get_current_screen();
if ( $screen && ( false !== strpos( $screen->id, 'avca-unanswered' ) || false !== strpos( $screen->id, 'avca-upgrade' ) || false !== strpos( $screen->id, 'avinya_lic_' ) ) ) {
wp_enqueue_style( 'avca-admin', AVCA_URL . 'assets/css/admin.css', array(), AVCA_VERSION );
}
}
add_action( 'admin_enqueue_scripts', 'avca_admin_unanswered_style', 20 );
/**
* Add a "Settings" link on the Plugins screen.
*
* @param array $links Existing links.
* @return array
*/
function avca_action_links( $links ) {
$settings_link = '' . esc_html__( 'Settings', 'avi-support-assistant' ) . '';
array_unshift( $links, $settings_link );
if ( ! avca_pro_active() ) {
$links[] = '' . esc_html__( 'Go Pro', 'avi-support-assistant' ) . '';
}
return $links;
}
add_filter( 'plugin_action_links_' . plugin_basename( AVCA_FILE ), 'avca_action_links' );