"""ALwrity integrations setup component.""" import streamlit as st from loguru import logger import os from typing import Dict, Any from ..manager import APIKeyManager from .base import render_navigation_buttons, render_step_indicator, render_tab_style def update_env_file(env_vars: Dict[str, str]) -> None: """Update the .env file with new environment variables, avoiding duplicates. Args: env_vars (Dict[str, str]): Dictionary of environment variables to update """ try: # Read existing .env file content env_content = [] if os.path.exists('.env'): with open('.env', 'r') as f: env_content = f.readlines() # Remove trailing newlines and empty lines env_content = [line.strip() for line in env_content if line.strip()] # Create a dictionary of existing variables env_dict = {} for line in env_content: if '=' in line: key, value = line.split('=', 1) env_dict[key.strip()] = value.strip() # Update with new values env_dict.update(env_vars) # Write back to .env file with open('.env', 'w') as f: for key, value in env_dict.items(): f.write(f"{key}={value}\n") logger.info("[update_env_file] Successfully updated .env file") except Exception as e: logger.error(f"[update_env_file] Error updating .env file: {str(e)}") raise def render_alwrity_integrations(api_key_manager: APIKeyManager) -> Dict[str, Any]: """Render the ALwrity integrations setup step.""" try: # Apply enhanced tab styling render_tab_style() st.markdown("""
Connect your content platforms and tools
Connect your website platforms for seamless content publishing
Connect your WordPress site for direct content publishing.
Connect your Wix site for direct content publishing.
Connect your social media accounts for content distribution
Connect your Facebook account for content sharing.
Connect your Instagram account for content sharing.
Connect your analytics tools for content performance tracking
Connect your Google Search Console for SEO insights.