rl-warmup-plugin/js/generate-timeline.js
ruben de40085318 Implement AI-powered conversation generation and improved campaign timeline management
- Add OpenAI integration for realistic email conversation generation
- Enhance campaign timeline algorithm with natural distribution patterns
- Improve message handling with Symfony Mailer components
- Add conversation blueprint system for structured email threads
- Implement visual timeline with heatmap for campaign tracking

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-07 01:49:49 -06:00

37 lines
1.4 KiB
JavaScript

jQuery(document).ready(function ($) {
$('#generate-timeline-button').on('click', function (e) {
e.preventDefault();
const postId = $('#post_ID').val();
$('#generate-timeline-result').html('<p>Generating timeline...</p>');
$.ajax({
url: rlMailWarmerGenerateTimeline.ajax_url,
method: 'POST',
data: {
action: 'rl_mailwarmer_generate_timeline',
post_id: postId,
security: rlMailWarmerGenerateTimeline.nonce,
},
success: function (response) {
console.log(response);
if (response.success) {
console.log(response.data);
// const timeline = response.data;
// let output = '<p>Timeline Generated:</p><ul>';
// $.each(timeline, function (date, volume) {
// output += `<li><strong>${date}:</strong> ${volume} emails</li>`;
// });
// output += '</ul>';
$('#generate-timeline-result').html(response.data);
} else {
$('#generate-timeline-result').html('<p>Error: ' + response.data + '</p>');
}
},
error: function (xhr, status, error) {
$('#generate-timeline-result').html('<p>AJAX Error: ' + error + '</p>');
},
});
});
});