Changes for eveai_chat_client:
- Modal display of privacy statement & Terms & Conditions - Consent-flag ==> check of privacy and Terms & Conditions - customisation option added to show or hide DynamicForm titles
This commit is contained in:
@@ -3,7 +3,7 @@ import uuid
|
||||
from flask import Blueprint, render_template, request, session, current_app, jsonify, Response, stream_with_context
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from common.extensions import db
|
||||
from common.extensions import db, content_manager
|
||||
from common.models.user import Tenant, SpecialistMagicLinkTenant, TenantMake
|
||||
from common.models.interaction import SpecialistMagicLink, Specialist, ChatSession, Interaction
|
||||
from common.services.interaction.specialist_services import SpecialistServices
|
||||
@@ -377,4 +377,71 @@ def translate():
|
||||
'success': False,
|
||||
'error': f"Error translating: {str(e)}"
|
||||
}), 500
|
||||
|
||||
|
||||
|
||||
@chat_bp.route('/privacy', methods=['GET'])
|
||||
def privacy_statement():
|
||||
"""
|
||||
Public AJAX endpoint for privacy statement content
|
||||
Returns JSON response suitable for modal display
|
||||
"""
|
||||
try:
|
||||
# Use content_manager to get the latest privacy content
|
||||
content_data = content_manager.read_content('privacy')
|
||||
|
||||
if not content_data:
|
||||
current_app.logger.error("Privacy statement content not found")
|
||||
return jsonify({
|
||||
'error': 'Privacy statement not available',
|
||||
'message': 'The privacy statement could not be loaded at this time.'
|
||||
}), 404
|
||||
|
||||
current_app.logger.debug(f"Content data: {content_data}")
|
||||
|
||||
# Return JSON response for AJAX consumption
|
||||
return jsonify({
|
||||
'title': 'Privacy Statement',
|
||||
'content': content_data['content'],
|
||||
'version': content_data['version'],
|
||||
'content_type': content_data['content_type']
|
||||
}), 200
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error loading privacy statement: {str(e)}")
|
||||
return jsonify({
|
||||
'error': 'Server error',
|
||||
'message': 'An error occurred while loading the privacy statement.'
|
||||
}), 500
|
||||
|
||||
|
||||
@chat_bp.route('/terms', methods=['GET'])
|
||||
def terms_conditions():
|
||||
"""
|
||||
Public AJAX endpoint for terms & conditions content
|
||||
Returns JSON response suitable for modal display
|
||||
"""
|
||||
try:
|
||||
# Use content_manager to get the latest terms content
|
||||
content_data = content_manager.read_content('terms')
|
||||
|
||||
if not content_data:
|
||||
current_app.logger.error("Terms & conditions content not found")
|
||||
return jsonify({
|
||||
'error': 'Terms & conditions not available',
|
||||
'message': 'The terms & conditions could not be loaded at this time.'
|
||||
}), 404
|
||||
|
||||
# Return JSON response for AJAX consumption
|
||||
return jsonify({
|
||||
'title': 'Terms & Conditions',
|
||||
'content': content_data['content'],
|
||||
'version': content_data['version'],
|
||||
'content_type': content_data['content_type']
|
||||
}), 200
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error loading terms & conditions: {str(e)}")
|
||||
return jsonify({
|
||||
'error': 'Server error',
|
||||
'message': 'An error occurred while loading the terms & conditions.'
|
||||
}), 500
|
||||
Reference in New Issue
Block a user