' . esc_html__( 'Token recovered!', 'ai-search' ) . ' ' . esc_html__( 'A fresh API token was issued for this site. Your existing usage limits and quotas were preserved.', 'ai-search' ) . '
'; } elseif ( $recovery_status === 'failed' ) { echo '' . esc_html__( 'Token recovery failed.', 'ai-search' ) . ' ' . esc_html__( 'Could not issue a new token. Please try again in a few minutes or contact support.', 'ai-search' ) . '
' . esc_html__( 'Connection successful!', 'ai-search' ) . ' ' . esc_html__( 'AI Search Service is working correctly.', 'ai-search' ) . '
'; if ( isset( $validation_data['client'] ) ) { $client = $validation_data['client']; $used_total = intval( $client['used_total'] ?? 0 ); $total_limit = intval( $client['total_limit'] ?? 10000 ); $remaining = $total_limit - $used_total; echo '' . sprintf( esc_html__( 'Embeddings used: %1$s / %2$s (%3$s remaining)', 'ai-search' ), '' . esc_html( number_format( $used_total ) ) . '', esc_html( number_format( $total_limit ) ), esc_html( number_format( $remaining ) ) ) . '
'; } echo '' . esc_html__( 'Connection failed!', 'ai-search' ) . '
'; if ( $error_data && isset( $error_data['details'] ) ) { echo '' . esc_html( $error_data['details'] ) . '
'; } // The service returns error: "Invalid token" specifically when the // token isn't found in its DB (vs. "Origin mismatch" which has its // own dedicated reconnect flow). Offer one-click recovery only for // that case so we don't show a misleading button for other errors. $is_invalid_token = $error_data && isset( $error_data['error'] ) && $error_data['error'] === 'Invalid token'; if ( $is_invalid_token ) { $recover_url = wp_nonce_url( admin_url( 'admin-post.php?action=ai_search_recover_token' ), 'ai_search_recover_token' ); echo '' . esc_html__( 'Your token is no longer recognized by the service. You can reconnect by issuing a fresh token — your usage limits and quotas will be preserved.', 'ai-search' ) . '
'; echo '' . esc_html__( 'Reconnect with new token', 'ai-search' ) . '
'; } echo '' . esc_html__( 'Connection failed!', 'ai-search' ) . ' ' . esc_html__( 'Unable to reach AI Search Service. Please try again later.', 'ai-search' ) . '
' . esc_html__( 'Not registered.', 'ai-search' ) . ' ' . esc_html__( 'Please save your settings to register with the AI Search Service.', 'ai-search' ) . '