Skip to content

Commit

Permalink
Added trigger for MailerLite Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-pranav committed Nov 7, 2023
1 parent 962db55 commit 7a84fb9
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1494,27 +1494,6 @@ var QSMContact;
});
emails.push(email);
});
/*-------------- MailerLite Settings Start ------------*/
let ml_settings = {};
if( $('#mailerlite-automation-email-tab').is(':visible') ) {
var groupId = $('#mailerlite-automation-email-tab .ml-group').val();
var quiz_id = $('#mailerlite-automation-email-tab .ml-quiz-id').val();
var tagMappings = [];

$('#mailerlite-automation-email-tab .ml-tag-conditions').each(function () {
tagMappings.push({
'min': $(this).find('span:eq(0) .tag-mappings-min').val(),
'max': $(this).find('span:eq(0) .tag-mappings-max').val(),
'tag': $(this).find('span:eq(1) .tag-mappings-tag').val(),
})
});
ml_settings = {
'quiz_id': quiz_id,
'group_id': groupId,
'tag_mappings': tagMappings
}
}
/*-------------- MailerLite Settings End ------------*/
let _X_validation = false;
_.each(emails, function( email ) {
if( email.content.indexOf('_X%') != -1 || email.subject.indexOf('_X%') != -1 ) {
Expand All @@ -1537,7 +1516,7 @@ var QSMContact;
})
.done(function (results) {
if (results.status) {
jQuery(document).trigger('qsm_after_save_email', [ml_settings]);
jQuery(document).trigger('qsm_after_save_email');
QSMAdmin.displayAlert(qsm_admin_messages.emails_saved, 'success');
} else {
QSMAdmin.displayAlert(qsm_admin_messages.emails_save_error + ' ' + qsm_admin_messages.try_again, 'error');
Expand Down

0 comments on commit 7a84fb9

Please sign in to comment.