Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
/**
* For the full copyright and license information, please view the
* docs/licenses/LICENSE.txt file that was distributed with this source code.
*/
export default {
dkimEnableRadio: '.js-dkim-enable',
dkimConfigurationBlock: '.js-dkim-configuration',
};

View File

@@ -0,0 +1,22 @@
/**
* For the full copyright and license information, please view the
* docs/licenses/LICENSE.txt file that was distributed with this source code.
*/
import EmailPageMap from '@pages/email/EmailPageMap';
const {$} = window;
/**
* Class DkimConfigurationToggler is responsible for showing/hiding DKIM configuration form
*/
class DkimConfigurationToggler {
constructor() {
$(EmailPageMap.dkimEnableRadio).on('change', (event) => {
const dkimEnable = Number($(event.currentTarget).val());
$(EmailPageMap.dkimConfigurationBlock).toggleClass('d-none', dkimEnable === 0);
});
}
}
export default DkimConfigurationToggler;

View File

@@ -0,0 +1,183 @@
/**
* For the full copyright and license information, please view the
* docs/licenses/LICENSE.txt file that was distributed with this source code.
*/
const {$} = window;
/**
* Class is responsible for managing test email sending
*/
class EmailSendingTest {
$successAlert: JQuery;
$errorAlert: JQuery;
$loader: JQuery;
$sendEmailBtn: JQuery;
constructor() {
this.$successAlert = $('.js-test-email-success');
this.$errorAlert = $('.js-test-email-errors');
this.$loader = $('.js-test-email-loader');
this.$sendEmailBtn = $('.js-send-test-email-btn');
this.$sendEmailBtn.on('click', (event: JQueryEventObject) => {
this.handle(event);
});
}
/**
* Handle test email sending
*
* @param {Event} event
*
* @private
*/
private handle(event: JQueryEventObject): void {
// fill test email sending form with configured values
$('#test_email_sending_mail_method').val(
<string>$('input[name="form[mail_method]"]:checked').val(),
);
$('#test_email_sending_smtp_server').val(
<string>$('#form_smtp_config_server').val(),
);
$('#test_email_sending_smtp_username').val(
<string>$('#form_smtp_config_username').val(),
);
$('#test_email_sending_smtp_password').val(
<string>$('#form_smtp_config_password').val(),
);
$('#test_email_sending_smtp_port').val(
<string>$('#form_smtp_config_port').val(),
);
$('#test_email_sending_smtp_encryption').val(
<string>$('#form_smtp_config_encryption').val(),
);
$('#test_email_sending_dkim_enable').val(
<string>$('input[name="form[dkim_enable]"]:checked').val(),
);
$('#test_email_sending_dkim_key').val(
<string>$('#form_dkim_config_key').val(),
);
$('#test_email_sending_dkim_selector').val(
<string>$('#form_dkim_config_selector').val(),
);
$('#test_email_sending_dkim_domain').val(
<string>$('#form_dkim_config_domain').val(),
);
const $testEmailSendingForm = $(event.currentTarget).closest('form');
this.resetMessages();
this.hideSendEmailButton();
this.showLoader();
$.post({
url: <string>$testEmailSendingForm.attr('action'),
data: $testEmailSendingForm.serialize(),
}).then((response) => {
this.hideLoader();
this.showSendEmailButton();
if (response.errors.length !== 0) {
this.showErrors(response.errors);
return;
}
this.showSuccess();
});
}
/**
* Make sure that additional content (alerts, loader) is not visible
*
* @private
*/
private resetMessages(): void {
this.hideSuccess();
this.hideErrors();
}
/**
* Show success message
*
* @private
*/
private showSuccess(): void {
this.$successAlert.removeClass('d-none');
}
/**
* Hide success message
*
* @private
*/
private hideSuccess(): void {
this.$successAlert.addClass('d-none');
}
/**
* Show loader during AJAX call
*
* @private
*/
private showLoader(): void {
this.$loader.removeClass('d-none');
}
/**
* Hide loader
*
* @private
*/
private hideLoader(): void {
this.$loader.addClass('d-none');
}
/**
* Show errors
*
* @param {Array} errors
*
* @private
*/
private showErrors(errors: Array<string>): void {
errors.forEach((error) => {
this.$errorAlert.append(`<p>${error}</p>`);
});
this.$errorAlert.removeClass('d-none');
}
/**
* Hide errors
*
* @private
*/
private hideErrors(): void {
this.$errorAlert.addClass('d-none').empty();
}
/**
* Show send email button
*
* @private
*/
private showSendEmailButton(): void {
this.$sendEmailBtn.removeClass('d-none');
}
/**
* Hide send email button
*
* @private
*/
private hideSendEmailButton(): void {
this.$sendEmailBtn.addClass('d-none');
}
}
export default EmailSendingTest;

View File

@@ -0,0 +1,29 @@
/**
* For the full copyright and license information, please view the
* docs/licenses/LICENSE.txt file that was distributed with this source code.
*/
import EmailSendingTest from '@pages/email/email-sending-test';
import SmtpConfigurationToggler from '@pages/email/smtp-configuration-toggler';
import DkimConfigurationToggler from '@pages/email/dkim-configuration-toggler';
const {$} = window;
$(() => {
const emailLogsGrid = new window.prestashop.component.Grid('email_logs');
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.ReloadListExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkActionExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitGridActionExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension());
emailLogsGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension());
new EmailSendingTest();
new SmtpConfigurationToggler();
new DkimConfigurationToggler();
});

View File

@@ -0,0 +1,35 @@
/**
* For the full copyright and license information, please view the
* docs/licenses/LICENSE.txt file that was distributed with this source code.
*/
const {$} = window;
/**
* Class SmtpConfigurationToggler is responsible for showing/hiding SMTP configuration form
*/
class SmtpConfigurationToggler {
constructor() {
$('.js-email-method').on('change', 'input[type="radio"]', (event) => {
const mailMethod = Number($(event.currentTarget).val());
$('.js-smtp-configuration').toggleClass(
'd-none',
this.getSmtpMailMethodOption() !== mailMethod,
);
});
}
/**
* Get SMTP mail option value
*
* @private
*
* @returns {Number}
*/
private getSmtpMailMethodOption(): number {
return $('.js-email-method').data('smtp-mail-method');
}
}
export default SmtpConfigurationToggler;