Fix order of definitions, remove unnecesary vars

[MAILPOET-1829]
This commit is contained in:
Jan Jakeš
2019-02-20 13:15:46 +01:00
committed by M. Shull
parent e95e7d3b4c
commit 61ab593dcb
20 changed files with 63 additions and 69 deletions

View File

@ -1,3 +1,7 @@
import MailPoet from 'mailpoet';
import jQuery from 'jquery';
import _ from 'underscore';
function requestFailed(errorMessage, xhr) {
if (xhr.responseJSON) {
return xhr.responseJSON;
@ -11,12 +15,6 @@ function requestFailed(errorMessage, xhr) {
};
}
import mp from 'mailpoet';
import jQuery from 'jquery';
import _ from 'underscore';
var MailPoet = mp;
MailPoet.Ajax = {
version: 0.5,
options: {},

View File

@ -7,6 +7,8 @@
* even if it has been disabled.
*
*/
import MailPoet from 'mailpoet';
import _ from 'underscore';
/**
* This is to cache events which are triggered before the mixpanel
@ -24,8 +26,7 @@ function track(name, data) {
window.mixpanel.track(name, data);
}
function exportMixpanel(mp) {
var MailPoet = mp;
function exportMixpanel() {
MailPoet.forceTrackEvent = track;
if (window.mailpoet_analytics_enabled) {
@ -51,14 +52,9 @@ function cacheEvent(forced, name, data) {
});
}
import mp from 'mailpoet';
import _ from 'underscore';
var MailPoet = mp;
function initializeMixpanelWhenLoaded() {
if (typeof window.mixpanel === 'object') {
exportMixpanel(MailPoet);
exportMixpanel();
trackCachedEvents();
} else {
setTimeout(initializeMixpanelWhenLoaded, 100);