MailPoet Newsletters (New) - Version 3.3.5

Version Description

  • 2018-01-16 =
  • Added: additional tools for our support team to mitigate sending issues;
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.3.5
Comparing to
See all releases

Code changes from version 3.3.4 to 3.3.5

Files changed (45) hide show
  1. assets/js/{admin.895871dd.js → admin.76e45773.js} +27 -26
  2. assets/js/{admin_vendor.fe056ed3.js → admin_vendor.fa88de45.js} +6 -8
  3. assets/js/{form_editor.cc7529b3.js → form_editor.13982476.js} +8 -7
  4. assets/js/lib/mailpoet_shortcodes/plugin.js +18 -16
  5. assets/js/{mailpoet.a5fa72ae.js → mailpoet.a55b11ee.js} +56 -57
  6. assets/js/manifest.json +8 -8
  7. assets/js/{mp2migrator.81060f18.js → mp2migrator.dc0d6e2b.js} +2 -1
  8. assets/js/{newsletter_editor.963cbce1.js → newsletter_editor.1de7c9b5.js} +252 -240
  9. assets/js/{public.3d1d91ad.js → public.d12800d0.js} +28 -28
  10. assets/js/{vendor.367b3f22.js → vendor.ae69bbf6.js} +3 -2
  11. lang/mailpoet-ca.mo +0 -0
  12. lang/mailpoet-da_DK.mo +0 -0
  13. lang/mailpoet-de_DE.mo +0 -0
  14. lang/mailpoet-en_GB.mo +0 -0
  15. lang/mailpoet-es_ES.mo +0 -0
  16. lang/mailpoet-fa_IR.mo +0 -0
  17. lang/mailpoet-fr_CA.mo +0 -0
  18. lang/mailpoet-fr_FR.mo +0 -0
  19. lang/mailpoet-it_IT.mo +0 -0
  20. lang/mailpoet-ja.mo +0 -0
  21. lang/mailpoet-nl_NL.mo +0 -0
  22. lang/mailpoet-pl_PL.mo +0 -0
  23. lang/mailpoet-pt_BR.mo +0 -0
  24. lang/mailpoet-pt_PT.mo +0 -0
  25. lang/mailpoet-ru_RU.mo +0 -0
  26. lang/mailpoet-sq.mo +0 -0
  27. lang/mailpoet-sv_SE.mo +0 -0
  28. lang/mailpoet-tr_TR.mo +0 -0
  29. lang/mailpoet.pot +15 -15
  30. lib/Analytics/Reporter.php +4 -1
  31. lib/Cron/CronHelper.php +4 -3
  32. lib/Cron/Workers/SendingQueue/SendingQueue.php +4 -3
  33. lib/Mailer/Methods/AmazonSES.php +4 -3
  34. lib/Mailer/Methods/SendGrid.php +4 -2
  35. lib/Models/Segment.php +7 -0
  36. lib/Services/Bridge.php +3 -2
  37. lib/Services/Bridge/API.php +19 -14
  38. lib/Services/Release/API.php +6 -3
  39. lib/WP/Functions.php +32 -0
  40. mailpoet.php +2 -2
  41. readme.txt +4 -1
  42. vendor/autoload.php +1 -1
  43. vendor/composer/autoload_classmap.php +1 -0
  44. vendor/composer/autoload_real.php +7 -7
  45. vendor/composer/autoload_static.php +6 -5
assets/js/{admin.895871dd.js → admin.76e45773.js} RENAMED
@@ -13852,7 +13852,7 @@ webpackJsonp([0],{
13852
  __webpack_require__(544),
13853
  __webpack_require__(275),
13854
  __webpack_require__(276)
13855
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
13856
  Backbone,
13857
  jQuery,
13858
  mp
@@ -13868,7 +13868,7 @@ webpackJsonp([0],{
13868
  'mta(/:group)': 'sendingMethodGroup',
13869
  '(:tab)': 'tabs'
13870
  },
13871
- sendingMethodGroup: function (group) {
13872
  // display mta tab
13873
  this.tabs('mta');
13874
 
@@ -13899,7 +13899,7 @@ webpackJsonp([0],{
13899
  jQuery('#mailpoet_sending_method_setup').fadeIn();
13900
  }
13901
  },
13902
- tabs: function (tabStr) {
13903
  // set default tab
13904
  var tab = tabStr || 'mta';
13905
 
@@ -13928,9 +13928,9 @@ webpackJsonp([0],{
13928
  }
13929
  );
13930
  }
13931
- }));
13932
 
13933
- jQuery(document).ready(function () {
13934
  if (!Backbone.History.started) Backbone.history.start();
13935
  });
13936
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
@@ -16308,7 +16308,7 @@ webpackJsonp([0],{
16308
 
16309
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
16310
  __webpack_require__(276)
16311
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
16312
  MailPoet
16313
  ) {
16314
  var element;
@@ -16324,14 +16324,14 @@ webpackJsonp([0],{
16324
  api_version: window.mailpoet_api_version,
16325
  endpoint: 'setup',
16326
  action: 'reset'
16327
- }).always(function () {
16328
  MailPoet.Modal.loading(false);
16329
- }).done(function () {
16330
  window.location = 'admin.php?page=mailpoet-newsletters';
16331
- }).fail(function (response) {
16332
  if (response.errors.length > 0) {
16333
  MailPoet.Notice.error(
16334
- response.errors.map(function (error) {
16335
  return error.message;
16336
  }),
16337
  { scroll: true }
@@ -16354,7 +16354,8 @@ webpackJsonp([0],{
16354
  /***/ 552:
16355
  /***/ function(module, exports, __webpack_require__) {
16356
 
16357
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
16358
  __webpack_require__(544),
16359
  __webpack_require__(280),
16360
  __webpack_require__(275),
@@ -16390,7 +16391,7 @@ webpackJsonp([0],{
16390
  home: function () {
16391
  this.navigate('step1', { trigger: true });
16392
  }
16393
- }));
16394
 
16395
  function showCurrentStep() {
16396
  MailPoet.Notice.hide();
@@ -17630,7 +17631,7 @@ webpackJsonp([0],{
17630
  __webpack_require__(275),
17631
  __webpack_require__(276),
17632
  __webpack_require__(553)
17633
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
17634
  _,
17635
  jQuery,
17636
  MailPoet,
@@ -17639,7 +17640,7 @@ webpackJsonp([0],{
17639
  if (!jQuery('#mailpoet_subscribers_export').length) {
17640
  return;
17641
  }
17642
- jQuery(document).ready(function () {
17643
  var segmentsContainerElement;
17644
  var subscriberFieldsContainerElement;
17645
  var exportConfirmedOptionElement;
@@ -17672,7 +17673,7 @@ webpackJsonp([0],{
17672
  exportConfirmedOptionElement = jQuery(':radio[name="option_confirmed"]');
17673
  groupBySegmentOptionElement = jQuery(':checkbox[name="option_group_by_list"]');
17674
  nextStepButton = jQuery('a.mailpoet_export_process');
17675
- renderSegmentsAndFields = function (container, data) {
17676
  if (container.data('select2')) {
17677
  container
17678
  .html('')
@@ -17682,18 +17683,18 @@ webpackJsonp([0],{
17682
  .select2({
17683
  data: data,
17684
  width: '20em',
17685
- templateResult: function (item) {
17686
  return (item.subscriberCount > 0)
17687
  ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
17688
  : item.name;
17689
  },
17690
- templateSelection: function (item) {
17691
  return (item.subscriberCount > 0)
17692
  ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
17693
  : item.name;
17694
  }
17695
  })
17696
- .on('select2:selecting', function (selectEvent) {
17697
  var selectElement = this;
17698
  var selectedOptionId = selectEvent.params.args.data.id;
17699
  var fieldsToExclude = [
@@ -17707,7 +17708,7 @@ webpackJsonp([0],{
17707
  jQuery(selectElement).val('').trigger('change');
17708
  } else {
17709
  allOptions = [];
17710
- _.each(container.find('option'), function (field) {
17711
  if (!_.contains(fieldsToExclude, field.value)) {
17712
  allOptions.push(field.value);
17713
  }
@@ -17717,7 +17718,7 @@ webpackJsonp([0],{
17717
  jQuery(selectElement).select2('close');
17718
  }
17719
  })
17720
- .on('change', function () {
17721
  if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
17722
  ||
17723
  (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
@@ -17750,7 +17751,7 @@ webpackJsonp([0],{
17750
  'status'
17751
  ]).trigger('change');
17752
 
17753
- exportConfirmedOptionElement.change(function () {
17754
  var selectedSegments = segmentsContainerElement.val();
17755
  if (this.value == 1) {
17756
  window.exportData.exportConfirmedOption = true;
@@ -17763,7 +17764,7 @@ webpackJsonp([0],{
17763
  segmentsContainerElement.val(selectedSegments).trigger('change');
17764
  });
17765
 
17766
- nextStepButton.click(function () {
17767
  var exportFormat;
17768
  if (jQuery(this).hasClass('button-disabled')) {
17769
  return;
@@ -17781,9 +17782,9 @@ webpackJsonp([0],{
17781
  segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
17782
  subscriber_fields: subscriberFieldsContainerElement.val()
17783
  })
17784
- }).always(function () {
17785
  MailPoet.Modal.loading(false);
17786
- }).done(function (response) {
17787
  var resultMessage = MailPoet.I18n.t('exportMessage')
17788
  .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
17789
  .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
@@ -17796,10 +17797,10 @@ webpackJsonp([0],{
17796
  'File Format': exportFormat,
17797
  'MailPoet Free version': window.mailpoet_version
17798
  });
17799
- }).fail(function (response) {
17800
  if (response.errors.length > 0) {
17801
  MailPoet.Notice.error(
17802
- response.errors.map(function (error) { return error.message; }),
17803
  { scroll: true }
17804
  );
17805
  }
13852
  __webpack_require__(544),
13853
  __webpack_require__(275),
13854
  __webpack_require__(276)
13855
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
13856
  Backbone,
13857
  jQuery,
13858
  mp
13868
  'mta(/:group)': 'sendingMethodGroup',
13869
  '(:tab)': 'tabs'
13870
  },
13871
+ sendingMethodGroup: function (group) { // eslint-disable-line func-names
13872
  // display mta tab
13873
  this.tabs('mta');
13874
 
13899
  jQuery('#mailpoet_sending_method_setup').fadeIn();
13900
  }
13901
  },
13902
+ tabs: function (tabStr) { // eslint-disable-line func-names
13903
  // set default tab
13904
  var tab = tabStr || 'mta';
13905
 
13928
  }
13929
  );
13930
  }
13931
+ }))();
13932
 
13933
+ jQuery(document).ready(function () { // eslint-disable-line func-names
13934
  if (!Backbone.History.started) Backbone.history.start();
13935
  });
13936
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
16308
 
16309
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
16310
  __webpack_require__(276)
16311
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
16312
  MailPoet
16313
  ) {
16314
  var element;
16324
  api_version: window.mailpoet_api_version,
16325
  endpoint: 'setup',
16326
  action: 'reset'
16327
+ }).always(function () { // eslint-disable-line func-names
16328
  MailPoet.Modal.loading(false);
16329
+ }).done(function () { // eslint-disable-line func-names
16330
  window.location = 'admin.php?page=mailpoet-newsletters';
16331
+ }).fail(function (response) { // eslint-disable-line func-names
16332
  if (response.errors.length > 0) {
16333
  MailPoet.Notice.error(
16334
+ response.errors.map(function (error) { // eslint-disable-line func-names
16335
  return error.message;
16336
  }),
16337
  { scroll: true }
16354
  /***/ 552:
16355
  /***/ function(module, exports, __webpack_require__) {
16356
 
16357
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
16358
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
16359
  __webpack_require__(544),
16360
  __webpack_require__(280),
16361
  __webpack_require__(275),
16391
  home: function () {
16392
  this.navigate('step1', { trigger: true });
16393
  }
16394
+ }))();
16395
 
16396
  function showCurrentStep() {
16397
  MailPoet.Notice.hide();
17631
  __webpack_require__(275),
17632
  __webpack_require__(276),
17633
  __webpack_require__(553)
17634
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (// eslint-disable-line func-names
17635
  _,
17636
  jQuery,
17637
  MailPoet,
17640
  if (!jQuery('#mailpoet_subscribers_export').length) {
17641
  return;
17642
  }
17643
+ jQuery(document).ready(function () { // eslint-disable-line func-names
17644
  var segmentsContainerElement;
17645
  var subscriberFieldsContainerElement;
17646
  var exportConfirmedOptionElement;
17673
  exportConfirmedOptionElement = jQuery(':radio[name="option_confirmed"]');
17674
  groupBySegmentOptionElement = jQuery(':checkbox[name="option_group_by_list"]');
17675
  nextStepButton = jQuery('a.mailpoet_export_process');
17676
+ renderSegmentsAndFields = function (container, data) { // eslint-disable-line func-names
17677
  if (container.data('select2')) {
17678
  container
17679
  .html('')
17683
  .select2({
17684
  data: data,
17685
  width: '20em',
17686
+ templateResult: function (item) { // eslint-disable-line func-names
17687
  return (item.subscriberCount > 0)
17688
  ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
17689
  : item.name;
17690
  },
17691
+ templateSelection: function (item) { // eslint-disable-line func-names
17692
  return (item.subscriberCount > 0)
17693
  ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
17694
  : item.name;
17695
  }
17696
  })
17697
+ .on('select2:selecting', function (selectEvent) { // eslint-disable-line func-names
17698
  var selectElement = this;
17699
  var selectedOptionId = selectEvent.params.args.data.id;
17700
  var fieldsToExclude = [
17708
  jQuery(selectElement).val('').trigger('change');
17709
  } else {
17710
  allOptions = [];
17711
+ _.each(container.find('option'), function (field) { // eslint-disable-line func-names
17712
  if (!_.contains(fieldsToExclude, field.value)) {
17713
  allOptions.push(field.value);
17714
  }
17718
  jQuery(selectElement).select2('close');
17719
  }
17720
  })
17721
+ .on('change', function () { // eslint-disable-line func-names
17722
  if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
17723
  ||
17724
  (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
17751
  'status'
17752
  ]).trigger('change');
17753
 
17754
+ exportConfirmedOptionElement.change(function () { // eslint-disable-line func-names
17755
  var selectedSegments = segmentsContainerElement.val();
17756
  if (this.value == 1) {
17757
  window.exportData.exportConfirmedOption = true;
17764
  segmentsContainerElement.val(selectedSegments).trigger('change');
17765
  });
17766
 
17767
+ nextStepButton.click(function () { // eslint-disable-line func-names
17768
  var exportFormat;
17769
  if (jQuery(this).hasClass('button-disabled')) {
17770
  return;
17782
  segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
17783
  subscriber_fields: subscriberFieldsContainerElement.val()
17784
  })
17785
+ }).always(function () { // eslint-disable-line func-names
17786
  MailPoet.Modal.loading(false);
17787
+ }).done(function (response) { // eslint-disable-line func-names
17788
  var resultMessage = MailPoet.I18n.t('exportMessage')
17789
  .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
17790
  .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
17797
  'File Format': exportFormat,
17798
  'MailPoet Free version': window.mailpoet_version
17799
  });
17800
+ }).fail(function (response) { // eslint-disable-line func-names
17801
  if (response.errors.length > 0) {
17802
  MailPoet.Notice.error(
17803
+ response.errors.map(function (error) { return error.message; }), // eslint-disable-line func-names
17804
  { scroll: true }
17805
  );
17806
  }
assets/js/{admin_vendor.fe056ed3.js → admin_vendor.fa88de45.js} RENAMED
@@ -30615,7 +30615,7 @@ webpackJsonp([1],[
30615
  /* 276 */
30616
  /***/ function(module, exports, __webpack_require__) {
30617
 
30618
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
30619
  // A placeholder for MailPoet object
30620
  var MailPoet = {};
30621
 
@@ -40835,7 +40835,7 @@ webpackJsonp([1],[
40835
  /***/ function(module, exports, __webpack_require__) {
40836
 
40837
  var require;/* WEBPACK VAR INJECTION */(function(module) {//! moment.js
40838
- //! version : 2.19.4
40839
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
40840
  //! license : MIT
40841
  //! momentjs.com
@@ -42865,7 +42865,7 @@ webpackJsonp([1],[
42865
  // note: all values past the year are optional and will default to the lowest possible value.
42866
  // [year, month, day , hour, minute, second, millisecond]
42867
  function configFromArray (config) {
42868
- var i, date, input = [], currentDate, expectedWeekday, yearToUse;
42869
 
42870
  if (config._d) {
42871
  return;
@@ -42915,8 +42915,6 @@ webpackJsonp([1],[
42915
  }
42916
 
42917
  config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
42918
- expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
42919
-
42920
  // Apply timezone offset from input. The actual utcOffset can be changed
42921
  // with parseZone.
42922
  if (config._tzm != null) {
@@ -42928,7 +42926,7 @@ webpackJsonp([1],[
42928
  }
42929
 
42930
  // check for mismatching day of week
42931
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
42932
  getParsingFlags(config).weekdayMismatch = true;
42933
  }
42934
  }
@@ -44504,7 +44502,7 @@ webpackJsonp([1],[
44504
 
44505
  addParseToken(['D', 'DD'], DATE);
44506
  addParseToken('Do', function (input, array) {
44507
- array[DATE] = toInt(input.match(match1to2)[0]);
44508
  });
44509
 
44510
  // MOMENTS
@@ -45316,7 +45314,7 @@ webpackJsonp([1],[
45316
  // Side effect imports
45317
 
45318
 
45319
- hooks.version = '2.19.4';
45320
 
45321
  setHookCallback(createLocal);
45322
 
30615
  /* 276 */
30616
  /***/ function(module, exports, __webpack_require__) {
30617
 
30618
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function mailpoet() {
30619
  // A placeholder for MailPoet object
30620
  var MailPoet = {};
30621
 
40835
  /***/ function(module, exports, __webpack_require__) {
40836
 
40837
  var require;/* WEBPACK VAR INJECTION */(function(module) {//! moment.js
40838
+ //! version : 2.19.3
40839
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
40840
  //! license : MIT
40841
  //! momentjs.com
42865
  // note: all values past the year are optional and will default to the lowest possible value.
42866
  // [year, month, day , hour, minute, second, millisecond]
42867
  function configFromArray (config) {
42868
+ var i, date, input = [], currentDate, yearToUse;
42869
 
42870
  if (config._d) {
42871
  return;
42915
  }
42916
 
42917
  config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
 
 
42918
  // Apply timezone offset from input. The actual utcOffset can be changed
42919
  // with parseZone.
42920
  if (config._tzm != null) {
42926
  }
42927
 
42928
  // check for mismatching day of week
42929
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
42930
  getParsingFlags(config).weekdayMismatch = true;
42931
  }
42932
  }
44502
 
44503
  addParseToken(['D', 'DD'], DATE);
44504
  addParseToken('Do', function (input, array) {
44505
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
44506
  });
44507
 
44508
  // MOMENTS
45314
  // Side effect imports
45315
 
45316
 
45317
+ hooks.version = '2.19.3';
45318
 
45319
  setHookCallback(createLocal);
45320
 
assets/js/{form_editor.cc7529b3.js → form_editor.13982476.js} RENAMED
@@ -21,6 +21,7 @@ webpackJsonp([2],{
21
  /***/ 558:
22
  /***/ function(module, exports) {
23
 
 
24
  /*
25
  * name: MailPoet Form Editor
26
  * author: Jonathan Labreuille
@@ -388,17 +389,17 @@ webpackJsonp([2],{
388
  };
389
  // body
390
  WysijaForm.getBlocks().each(function (b) {
391
- var blockData = (typeof (b.block['save']) === 'function') ? b.block.save() : null;
392
 
393
  if (blockData !== null) {
394
  // set block position
395
- blockData['position'] = position;
396
 
397
  // increment position
398
  position++;
399
 
400
  // add block data to body
401
- data['body'].push(blockData);
402
  }
403
  });
404
 
@@ -503,7 +504,7 @@ webpackJsonp([2],{
503
  WysijaForm.getBlocks().each(function (container) {
504
  container.setPosition(index++);
505
  // remove z-index value to avoid issues when resizing images
506
- if (container['block'] !== undefined) {
507
  container.block.element.setStyle({
508
  zIndex: ''
509
  });
@@ -797,7 +798,7 @@ webpackJsonp([2],{
797
  this.block.makeBlockDroppable();
798
 
799
  // setup events
800
- if (this.block['setup'] !== undefined) {
801
  this.block.setup();
802
  }
803
  return this;
@@ -806,13 +807,13 @@ webpackJsonp([2],{
806
  this.element.writeAttribute('wysija_position', position);
807
  },
808
  hideControls: function () {
809
- if (this['getControls']) {
810
  this.element.removeClassName('hover');
811
  this.getControls().hide();
812
  }
813
  },
814
  showControls: function () {
815
- if (this['getControls']) {
816
  this.element.addClassName('hover');
817
  try {
818
  this.getControls().show();
21
  /***/ 558:
22
  /***/ function(module, exports) {
23
 
24
+ /* eslint-disable func-names */
25
  /*
26
  * name: MailPoet Form Editor
27
  * author: Jonathan Labreuille
389
  };
390
  // body
391
  WysijaForm.getBlocks().each(function (b) {
392
+ var blockData = (typeof (b.block.save) === 'function') ? b.block.save() : null;
393
 
394
  if (blockData !== null) {
395
  // set block position
396
+ blockData.position = position;
397
 
398
  // increment position
399
  position++;
400
 
401
  // add block data to body
402
+ data.body.push(blockData);
403
  }
404
  });
405
 
504
  WysijaForm.getBlocks().each(function (container) {
505
  container.setPosition(index++);
506
  // remove z-index value to avoid issues when resizing images
507
+ if (container.block !== undefined) {
508
  container.block.element.setStyle({
509
  zIndex: ''
510
  });
798
  this.block.makeBlockDroppable();
799
 
800
  // setup events
801
+ if (this.block.setup !== undefined) {
802
  this.block.setup();
803
  }
804
  return this;
807
  this.element.writeAttribute('wysija_position', position);
808
  },
809
  hideControls: function () {
810
+ if (this.getControls) {
811
  this.element.removeClassName('hover');
812
  this.getControls().hide();
813
  }
814
  },
815
  showControls: function () {
816
+ if (this.getControls) {
817
  this.element.addClassName('hover');
818
  try {
819
  this.getControls().show();
assets/js/lib/mailpoet_shortcodes/plugin.js CHANGED
@@ -8,33 +8,35 @@
8
  * its placeholder into editor text.
9
  */
10
 
11
- /*jshint unused:false */
12
- /*global tinymce:true */
13
- tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
14
- var appendLabelAndClose = function(shortcode) {
15
- editor.insertContent(shortcode);
16
- editor.windowManager.close();
17
- },
18
- generateOnClickFunc = function(shortcode) {
19
- return function() {
20
- appendLabelAndClose(shortcode);
21
- };
22
  };
 
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
- onclick: function() {
27
- var shortcodes = [],
28
- configShortcodes = editor.settings.mailpoet_shortcodes;
 
 
29
 
30
- for (var segment in configShortcodes) {
31
  if (configShortcodes.hasOwnProperty(segment)) {
32
  shortcodes.push({
33
  type: 'label',
34
  text: segment
35
  });
36
 
37
- for (var i = 0; i < configShortcodes[segment].length; i += 1) {
38
  shortcodes.push({
39
  type: 'button',
40
  text: configShortcodes[segment][i].text,
8
  * its placeholder into editor text.
9
  */
10
 
11
+ /* jshint unused:false */
12
+ /* global tinymce:true */
13
+ tinymce.PluginManager.add('mailpoet_shortcodes', function (editor) { // eslint-disable-line func-names
14
+ var appendLabelAndClose = function (shortcode) { // eslint-disable-line func-names
15
+ editor.insertContent(shortcode);
16
+ editor.windowManager.close();
17
+ };
18
+ var generateOnClickFunc = function (shortcode) { // eslint-disable-line func-names
19
+ return function () { // eslint-disable-line func-names
20
+ appendLabelAndClose(shortcode);
 
21
  };
22
+ };
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
+ onclick: function () { // eslint-disable-line func-names
27
+ var shortcodes = [];
28
+ var configShortcodes = editor.settings.mailpoet_shortcodes;
29
+ var segment;
30
+ var i;
31
 
32
+ for (segment in configShortcodes) {
33
  if (configShortcodes.hasOwnProperty(segment)) {
34
  shortcodes.push({
35
  type: 'label',
36
  text: segment
37
  });
38
 
39
+ for (i = 0; i < configShortcodes[segment].length; i += 1) {
40
  shortcodes.push({
41
  type: 'button',
42
  text: configShortcodes[segment][i].text,
assets/js/{mailpoet.a5fa72ae.js → mailpoet.a55b11ee.js} RENAMED
@@ -22253,7 +22253,7 @@ webpackJsonp([3],[
22253
  /* 276 */
22254
  /***/ function(module, exports, __webpack_require__) {
22255
 
22256
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
22257
  // A placeholder for MailPoet object
22258
  var MailPoet = {};
22259
 
@@ -23905,7 +23905,7 @@ webpackJsonp([3],[
23905
  /***/ function(module, exports, __webpack_require__) {
23906
 
23907
  var require;/* WEBPACK VAR INJECTION */(function(module) {//! moment.js
23908
- //! version : 2.19.4
23909
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
23910
  //! license : MIT
23911
  //! momentjs.com
@@ -25935,7 +25935,7 @@ webpackJsonp([3],[
25935
  // note: all values past the year are optional and will default to the lowest possible value.
25936
  // [year, month, day , hour, minute, second, millisecond]
25937
  function configFromArray (config) {
25938
- var i, date, input = [], currentDate, expectedWeekday, yearToUse;
25939
 
25940
  if (config._d) {
25941
  return;
@@ -25985,8 +25985,6 @@ webpackJsonp([3],[
25985
  }
25986
 
25987
  config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
25988
- expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
25989
-
25990
  // Apply timezone offset from input. The actual utcOffset can be changed
25991
  // with parseZone.
25992
  if (config._tzm != null) {
@@ -25998,7 +25996,7 @@ webpackJsonp([3],[
25998
  }
25999
 
26000
  // check for mismatching day of week
26001
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
26002
  getParsingFlags(config).weekdayMismatch = true;
26003
  }
26004
  }
@@ -27574,7 +27572,7 @@ webpackJsonp([3],[
27574
 
27575
  addParseToken(['D', 'DD'], DATE);
27576
  addParseToken('Do', function (input, array) {
27577
- array[DATE] = toInt(input.match(match1to2)[0]);
27578
  });
27579
 
27580
  // MOMENTS
@@ -28386,7 +28384,7 @@ webpackJsonp([3],[
28386
  // Side effect imports
28387
 
28388
 
28389
- hooks.version = '2.19.4';
28390
 
28391
  setHookCallback(createLocal);
28392
 
@@ -50278,7 +50276,7 @@ webpackJsonp([3],[
50278
  };
50279
  }
50280
 
50281
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery, _) {
50282
  var MailPoet = mp;
50283
 
50284
  MailPoet.Ajax = {
@@ -50292,10 +50290,10 @@ webpackJsonp([3],[
50292
  token: null,
50293
  data: {}
50294
  },
50295
- post: function (options) {
50296
  return this.request('post', options);
50297
  },
50298
- init: function (options) {
50299
  // merge options
50300
  this.options = jQuery.extend({}, this.defaults, options);
50301
 
@@ -50309,7 +50307,7 @@ webpackJsonp([3],[
50309
  this.options.token = window.mailpoet_token;
50310
  }
50311
  },
50312
- getParams: function () {
50313
  return {
50314
  action: 'mailpoet',
50315
  api_version: this.options.api_version,
@@ -50319,7 +50317,7 @@ webpackJsonp([3],[
50319
  data: this.options.data || {}
50320
  };
50321
  },
50322
- request: function (method, options) {
50323
  var params;
50324
  var deferred;
50325
  // set options
@@ -50330,7 +50328,7 @@ webpackJsonp([3],[
50330
 
50331
  // remove null values from the data object
50332
  if (_.isObject(params.data)) {
50333
- params.data = _.pick(params.data, function (value) {
50334
  return (value !== null);
50335
  });
50336
  }
@@ -50341,7 +50339,7 @@ webpackJsonp([3],[
50341
  params,
50342
  null,
50343
  'json'
50344
- ).then(function (data) {
50345
  return data;
50346
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
50347
 
@@ -50362,7 +50360,7 @@ webpackJsonp([3],[
50362
  __webpack_require__(276),
50363
  __webpack_require__(275),
50364
  __webpack_require__(301)
50365
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
50366
  mp,
50367
  jQuery,
50368
  Moment
@@ -50378,7 +50376,7 @@ webpackJsonp([3],[
50378
  offset: 0,
50379
  format: 'F, d Y H:i:s'
50380
  },
50381
- init: function (opts) {
50382
  var options = opts || {};
50383
 
50384
  // set UTC offset
@@ -50400,7 +50398,7 @@ webpackJsonp([3],[
50400
 
50401
  return this;
50402
  },
50403
- format: function (date, opts) {
50404
  var options = opts || {};
50405
  var momentDate;
50406
  this.init(options);
@@ -50409,28 +50407,28 @@ webpackJsonp([3],[
50409
  if (options.offset === 0) momentDate = momentDate.utc();
50410
  return momentDate.format(this.convertFormat(this.options.format));
50411
  },
50412
- toDate: function (date, opts) {
50413
  var options = opts || {};
50414
  this.init(options);
50415
 
50416
  return Moment(date, this.convertFormat(options.parseFormat)).toDate();
50417
  },
50418
- short: function (date) {
50419
  return this.format(date, {
50420
  format: 'F, j Y'
50421
  });
50422
  },
50423
- full: function (date) {
50424
  return this.format(date, {
50425
  format: 'F, j Y H:i:s'
50426
  });
50427
  },
50428
- time: function (date) {
50429
  return this.format(date, {
50430
  format: 'H:i:s'
50431
  });
50432
  },
50433
- convertFormat: function (format) {
50434
  var replacements;
50435
  var convertedFormat;
50436
  var escapeToken;
@@ -50505,7 +50503,7 @@ webpackJsonp([3],[
50505
 
50506
  if (!format || format.length <= 0) return format;
50507
 
50508
- replacements = formatMappings['date'];
50509
  convertedFormat = [];
50510
  escapeToken = false;
50511
 
@@ -50539,7 +50537,7 @@ webpackJsonp([3],[
50539
 
50540
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
50541
  __webpack_require__(276)
50542
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
50543
  mp
50544
  ) {
50545
  'use strict';
@@ -50549,13 +50547,13 @@ webpackJsonp([3],[
50549
  var translations = {};
50550
 
50551
  MailPoet.I18n = {
50552
- add: function (key, value) {
50553
  translations[key] = value;
50554
  },
50555
- t: function (key) {
50556
  return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
50557
  },
50558
- all: function () {
50559
  return translations;
50560
  }
50561
  };
@@ -50566,7 +50564,8 @@ webpackJsonp([3],[
50566
  /* 565 */
50567
  /***/ function(module, exports, __webpack_require__) {
50568
 
50569
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
 
50570
  'use strict';
50571
 
50572
  var MailPoet = mp;
@@ -50821,7 +50820,7 @@ webpackJsonp([3],[
50821
 
50822
  // add sub panel wrapper
50823
  jQuery('#mailpoet_' + this.options.type)
50824
- .append(this.templates['subpanel']);
50825
 
50826
  // add sub panel content
50827
  jQuery('.mailpoet_' + this.options.type + '_body').last()
@@ -51210,9 +51209,9 @@ webpackJsonp([3],[
51210
  /* 566 */
51211
  /***/ function(module, exports, __webpack_require__) {
51212
 
51213
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
51214
- 'use strict';
51215
 
 
51216
  /*= =================================================================================================
51217
 
51218
  MailPoet Notice:
@@ -51252,13 +51251,13 @@ webpackJsonp([3],[
51252
  onClose: null
51253
  },
51254
  options: {},
51255
- init: function (options) {
51256
  // set options
51257
  this.options = jQuery.extend({}, this.defaults, options);
51258
 
51259
  return this;
51260
  },
51261
- createNotice: function () {
51262
  var onClose;
51263
  var positionAfter;
51264
  // clone element
@@ -51292,8 +51291,8 @@ webpackJsonp([3],[
51292
  }
51293
 
51294
  // listen to remove event
51295
- jQuery(this.element).on('close', function () {
51296
- jQuery(this).fadeOut(200, function () {
51297
  // on close callback
51298
  if (onClose !== null) {
51299
  onClose();
@@ -51304,19 +51303,19 @@ webpackJsonp([3],[
51304
  }.bind(this.element));
51305
 
51306
  // listen to message event
51307
- jQuery(this.element).on('setMessage', function (e, message) {
51308
  MailPoet.Notice.setMessage(message);
51309
  }.bind(this.element));
51310
 
51311
  return this;
51312
  },
51313
- updateNotice: function () {
51314
  // update notice's message
51315
  jQuery('[data-id="' + this.options.id + '"').first().trigger(
51316
  'setMessage', this.options.message
51317
  );
51318
  },
51319
- setMessage: function (message) {
51320
  var formattedMessage = this.formatMessage(message);
51321
 
51322
  // let's sugar coat the message with a fancy <p>
@@ -51324,13 +51323,13 @@ webpackJsonp([3],[
51324
  // set message
51325
  return this.element.html(formattedMessage);
51326
  },
51327
- formatMessage: function (message) {
51328
  if (Array.isArray(message)) {
51329
  return message.join('<br />');
51330
  }
51331
  return message;
51332
  },
51333
- show: function (options) {
51334
  // initialize
51335
  this.init(options);
51336
 
@@ -51345,7 +51344,7 @@ webpackJsonp([3],[
51345
  }
51346
  this.showNotice();
51347
  },
51348
- showNotice: function () {
51349
  // set message
51350
  this.setMessage(this.options.message);
51351
 
@@ -51378,7 +51377,7 @@ webpackJsonp([3],[
51378
  this.element.delay(this.options.timeout).trigger('close');
51379
  } else if (this.options.hideClose === false) {
51380
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
51381
- this.element.find('.mailpoet_notice_close').on('click', function () {
51382
  jQuery(this).trigger('close');
51383
  });
51384
  }
@@ -51388,7 +51387,7 @@ webpackJsonp([3],[
51388
  this.options.onOpen(this.element);
51389
  }
51390
  },
51391
- hide: function (all) {
51392
  var id;
51393
  if (all !== undefined && all === true) {
51394
  // all notices
@@ -51406,19 +51405,19 @@ webpackJsonp([3],[
51406
  .trigger('close');
51407
  }
51408
  },
51409
- error: function (message, options) {
51410
  this.show(jQuery.extend({}, {
51411
  type: 'error',
51412
  message: message
51413
  }, options));
51414
  },
51415
- success: function (message, options) {
51416
  this.show(jQuery.extend({}, {
51417
  type: 'success',
51418
  message: message
51419
  }, options));
51420
  },
51421
- system: function (message, options) {
51422
  this.show(jQuery.extend({}, {
51423
  type: 'system',
51424
  static: true,
@@ -51435,14 +51434,14 @@ webpackJsonp([3],[
51435
 
51436
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
51437
  __webpack_require__(276)
51438
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
51439
  mp
51440
  ) {
51441
  'use strict';
51442
 
51443
  var MailPoet = mp;
51444
  MailPoet.Num = {
51445
- toLocaleFixed: function (num, precisionOpts) {
51446
  var precision = precisionOpts || 0;
51447
  var factor = Math.pow(10, precision);
51448
  return (Math.round(num * factor) / factor)
@@ -51461,7 +51460,7 @@ webpackJsonp([3],[
51461
 
51462
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
51463
  __webpack_require__(275)
51464
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
51465
  jQuery
51466
  ) {
51467
  var $ = jQuery;
@@ -51482,12 +51481,12 @@ webpackJsonp([3],[
51482
  * Dual licensed under the MIT and GPL licenses.
51483
  * http://benalman.com/about/license/
51484
  */
51485
- $.fn.mailpoetSerializeObject = function (coerce) {
51486
  var obj = {};
51487
  var coerceTypes = { true: !0, false: !1, null: null };
51488
 
51489
  // Iterate over all name=value pairs.
51490
- $.each(this.serializeArray(), function (j, v) {
51491
  var key = v.name;
51492
  var val = v.value;
51493
  var cur = obj;
@@ -54100,12 +54099,12 @@ webpackJsonp([3],[
54100
  if (window.mailpoet_analytics_enabled) {
54101
  MailPoet.trackEvent = track;
54102
  } else {
54103
- MailPoet.trackEvent = function () {};
54104
  }
54105
  }
54106
 
54107
  function trackCachedEvents() {
54108
- eventsCache.map(function (event) {
54109
  if (window.mailpoet_analytics_enabled || event.forced) {
54110
  window.mixpanel.track(event.name, event.data);
54111
  }
@@ -54120,7 +54119,7 @@ webpackJsonp([3],[
54120
  });
54121
  }
54122
 
54123
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, _) {
54124
  var MailPoet = mp;
54125
 
54126
  function initializeMixpanelWhenLoaded() {
@@ -54143,13 +54142,13 @@ webpackJsonp([3],[
54143
  /* 571 */
54144
  /***/ function(module, exports, __webpack_require__) {
54145
 
54146
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(2), __webpack_require__(34), __webpack_require__(436)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, React, ReactDOM, TooltipComponent) {
54147
  'use strict';
54148
 
54149
  var MailPoet = mp;
54150
 
54151
  MailPoet.helpTooltip = {
54152
- show: function (domContainerNode, opts) {
54153
  ReactDOM.render(React.createElement(
54154
  TooltipComponent, {
54155
  tooltip: opts.tooltip,
22253
  /* 276 */
22254
  /***/ function(module, exports, __webpack_require__) {
22255
 
22256
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function mailpoet() {
22257
  // A placeholder for MailPoet object
22258
  var MailPoet = {};
22259
 
23905
  /***/ function(module, exports, __webpack_require__) {
23906
 
23907
  var require;/* WEBPACK VAR INJECTION */(function(module) {//! moment.js
23908
+ //! version : 2.19.3
23909
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
23910
  //! license : MIT
23911
  //! momentjs.com
25935
  // note: all values past the year are optional and will default to the lowest possible value.
25936
  // [year, month, day , hour, minute, second, millisecond]
25937
  function configFromArray (config) {
25938
+ var i, date, input = [], currentDate, yearToUse;
25939
 
25940
  if (config._d) {
25941
  return;
25985
  }
25986
 
25987
  config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
 
 
25988
  // Apply timezone offset from input. The actual utcOffset can be changed
25989
  // with parseZone.
25990
  if (config._tzm != null) {
25996
  }
25997
 
25998
  // check for mismatching day of week
25999
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
26000
  getParsingFlags(config).weekdayMismatch = true;
26001
  }
26002
  }
27572
 
27573
  addParseToken(['D', 'DD'], DATE);
27574
  addParseToken('Do', function (input, array) {
27575
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
27576
  });
27577
 
27578
  // MOMENTS
28384
  // Side effect imports
28385
 
28386
 
28387
+ hooks.version = '2.19.3';
28388
 
28389
  setHookCallback(createLocal);
28390
 
50276
  };
50277
  }
50278
 
50279
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function ajax(mp, jQuery, _) {
50280
  var MailPoet = mp;
50281
 
50282
  MailPoet.Ajax = {
50290
  token: null,
50291
  data: {}
50292
  },
50293
+ post: function post(options) {
50294
  return this.request('post', options);
50295
  },
50296
+ init: function init(options) {
50297
  // merge options
50298
  this.options = jQuery.extend({}, this.defaults, options);
50299
 
50307
  this.options.token = window.mailpoet_token;
50308
  }
50309
  },
50310
+ getParams: function getParams() {
50311
  return {
50312
  action: 'mailpoet',
50313
  api_version: this.options.api_version,
50317
  data: this.options.data || {}
50318
  };
50319
  },
50320
+ request: function request(method, options) {
50321
  var params;
50322
  var deferred;
50323
  // set options
50328
 
50329
  // remove null values from the data object
50330
  if (_.isObject(params.data)) {
50331
+ params.data = _.pick(params.data, function isNotNull(value) {
50332
  return (value !== null);
50333
  });
50334
  }
50339
  params,
50340
  null,
50341
  'json'
50342
+ ).then(function resultHandler(data) {
50343
  return data;
50344
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
50345
 
50360
  __webpack_require__(276),
50361
  __webpack_require__(275),
50362
  __webpack_require__(301)
50363
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
50364
  mp,
50365
  jQuery,
50366
  Moment
50376
  offset: 0,
50377
  format: 'F, d Y H:i:s'
50378
  },
50379
+ init: function init(opts) {
50380
  var options = opts || {};
50381
 
50382
  // set UTC offset
50398
 
50399
  return this;
50400
  },
50401
+ format: function format(date, opts) {
50402
  var options = opts || {};
50403
  var momentDate;
50404
  this.init(options);
50407
  if (options.offset === 0) momentDate = momentDate.utc();
50408
  return momentDate.format(this.convertFormat(this.options.format));
50409
  },
50410
+ toDate: function toDate(date, opts) {
50411
  var options = opts || {};
50412
  this.init(options);
50413
 
50414
  return Moment(date, this.convertFormat(options.parseFormat)).toDate();
50415
  },
50416
+ short: function short(date) {
50417
  return this.format(date, {
50418
  format: 'F, j Y'
50419
  });
50420
  },
50421
+ full: function full(date) {
50422
  return this.format(date, {
50423
  format: 'F, j Y H:i:s'
50424
  });
50425
  },
50426
+ time: function time(date) {
50427
  return this.format(date, {
50428
  format: 'H:i:s'
50429
  });
50430
  },
50431
+ convertFormat: function convertFormat(format) {
50432
  var replacements;
50433
  var convertedFormat;
50434
  var escapeToken;
50503
 
50504
  if (!format || format.length <= 0) return format;
50505
 
50506
+ replacements = formatMappings.date;
50507
  convertedFormat = [];
50508
  escapeToken = false;
50509
 
50537
 
50538
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
50539
  __webpack_require__(276)
50540
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function i18n(
50541
  mp
50542
  ) {
50543
  'use strict';
50547
  var translations = {};
50548
 
50549
  MailPoet.I18n = {
50550
+ add: function add(key, value) {
50551
  translations[key] = value;
50552
  },
50553
+ t: function t(key) {
50554
  return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
50555
  },
50556
+ all: function all() {
50557
  return translations;
50558
  }
50559
  };
50564
  /* 565 */
50565
  /***/ function(module, exports, __webpack_require__) {
50566
 
50567
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
50568
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
50569
  'use strict';
50570
 
50571
  var MailPoet = mp;
50820
 
50821
  // add sub panel wrapper
50822
  jQuery('#mailpoet_' + this.options.type)
50823
+ .append(this.templates.subpanel);
50824
 
50825
  // add sub panel content
50826
  jQuery('.mailpoet_' + this.options.type + '_body').last()
51209
  /* 566 */
51210
  /***/ function(module, exports, __webpack_require__) {
51211
 
51212
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
51213
 
51214
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) { // eslint-disable-line func-names
51215
  /*= =================================================================================================
51216
 
51217
  MailPoet Notice:
51251
  onClose: null
51252
  },
51253
  options: {},
51254
+ init: function init(options) {
51255
  // set options
51256
  this.options = jQuery.extend({}, this.defaults, options);
51257
 
51258
  return this;
51259
  },
51260
+ createNotice: function createNotice() {
51261
  var onClose;
51262
  var positionAfter;
51263
  // clone element
51291
  }
51292
 
51293
  // listen to remove event
51294
+ jQuery(this.element).on('close', function () { // eslint-disable-line func-names
51295
+ jQuery(this).fadeOut(200, function () { // eslint-disable-line func-names
51296
  // on close callback
51297
  if (onClose !== null) {
51298
  onClose();
51303
  }.bind(this.element));
51304
 
51305
  // listen to message event
51306
+ jQuery(this.element).on('setMessage', function (e, message) { // eslint-disable-line func-names
51307
  MailPoet.Notice.setMessage(message);
51308
  }.bind(this.element));
51309
 
51310
  return this;
51311
  },
51312
+ updateNotice: function updateNotice() {
51313
  // update notice's message
51314
  jQuery('[data-id="' + this.options.id + '"').first().trigger(
51315
  'setMessage', this.options.message
51316
  );
51317
  },
51318
+ setMessage: function setMessage(message) {
51319
  var formattedMessage = this.formatMessage(message);
51320
 
51321
  // let's sugar coat the message with a fancy <p>
51323
  // set message
51324
  return this.element.html(formattedMessage);
51325
  },
51326
+ formatMessage: function formatMessage(message) {
51327
  if (Array.isArray(message)) {
51328
  return message.join('<br />');
51329
  }
51330
  return message;
51331
  },
51332
+ show: function show(options) {
51333
  // initialize
51334
  this.init(options);
51335
 
51344
  }
51345
  this.showNotice();
51346
  },
51347
+ showNotice: function showNotice() {
51348
  // set message
51349
  this.setMessage(this.options.message);
51350
 
51377
  this.element.delay(this.options.timeout).trigger('close');
51378
  } else if (this.options.hideClose === false) {
51379
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
51380
+ this.element.find('.mailpoet_notice_close').on('click', function () { // eslint-disable-line func-names
51381
  jQuery(this).trigger('close');
51382
  });
51383
  }
51387
  this.options.onOpen(this.element);
51388
  }
51389
  },
51390
+ hide: function hide(all) {
51391
  var id;
51392
  if (all !== undefined && all === true) {
51393
  // all notices
51405
  .trigger('close');
51406
  }
51407
  },
51408
+ error: function error(message, options) {
51409
  this.show(jQuery.extend({}, {
51410
  type: 'error',
51411
  message: message
51412
  }, options));
51413
  },
51414
+ success: function success(message, options) {
51415
  this.show(jQuery.extend({}, {
51416
  type: 'success',
51417
  message: message
51418
  }, options));
51419
  },
51420
+ system: function system(message, options) {
51421
  this.show(jQuery.extend({}, {
51422
  type: 'system',
51423
  static: true,
51434
 
51435
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
51436
  __webpack_require__(276)
51437
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
51438
  mp
51439
  ) {
51440
  'use strict';
51441
 
51442
  var MailPoet = mp;
51443
  MailPoet.Num = {
51444
+ toLocaleFixed: function (num, precisionOpts) { // eslint-disable-line func-names
51445
  var precision = precisionOpts || 0;
51446
  var factor = Math.pow(10, precision);
51447
  return (Math.round(num * factor) / factor)
51460
 
51461
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
51462
  __webpack_require__(275)
51463
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
51464
  jQuery
51465
  ) {
51466
  var $ = jQuery;
51481
  * Dual licensed under the MIT and GPL licenses.
51482
  * http://benalman.com/about/license/
51483
  */
51484
+ $.fn.mailpoetSerializeObject = function (coerce) { // eslint-disable-line func-names
51485
  var obj = {};
51486
  var coerceTypes = { true: !0, false: !1, null: null };
51487
 
51488
  // Iterate over all name=value pairs.
51489
+ $.each(this.serializeArray(), function (j, v) { // eslint-disable-line func-names
51490
  var key = v.name;
51491
  var val = v.value;
51492
  var cur = obj;
54099
  if (window.mailpoet_analytics_enabled) {
54100
  MailPoet.trackEvent = track;
54101
  } else {
54102
+ MailPoet.trackEvent = function emptyFunction() {};
54103
  }
54104
  }
54105
 
54106
  function trackCachedEvents() {
54107
+ eventsCache.map(function trackIfEnabled(event) {
54108
  if (window.mailpoet_analytics_enabled || event.forced) {
54109
  window.mixpanel.track(event.name, event.data);
54110
  }
54119
  });
54120
  }
54121
 
54122
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function analyticsEvent(mp, _) {
54123
  var MailPoet = mp;
54124
 
54125
  function initializeMixpanelWhenLoaded() {
54142
  /* 571 */
54143
  /***/ function(module, exports, __webpack_require__) {
54144
 
54145
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(2), __webpack_require__(34), __webpack_require__(436)], __WEBPACK_AMD_DEFINE_RESULT__ = function helpTooltip(mp, React, ReactDOM, TooltipComponent) {
54146
  'use strict';
54147
 
54148
  var MailPoet = mp;
54149
 
54150
  MailPoet.helpTooltip = {
54151
+ show: function show(domContainerNode, opts) {
54152
  ReactDOM.render(React.createElement(
54153
  TooltipComponent, {
54154
  tooltip: opts.tooltip,
assets/js/manifest.json CHANGED
@@ -1,10 +1,10 @@
1
  {
2
- "mp2migrator.js": "mp2migrator.81060f18.js",
3
- "public.js": "public.3d1d91ad.js",
4
- "admin.js": "admin.895871dd.js",
5
- "admin_vendor.js": "admin_vendor.fe056ed3.js",
6
- "form_editor.js": "form_editor.cc7529b3.js",
7
- "mailpoet.js": "mailpoet.a5fa72ae.js",
8
- "newsletter_editor.js": "newsletter_editor.963cbce1.js",
9
- "vendor.js": "vendor.367b3f22.js"
10
  }
1
  {
2
+ "mp2migrator.js": "mp2migrator.dc0d6e2b.js",
3
+ "public.js": "public.d12800d0.js",
4
+ "admin.js": "admin.76e45773.js",
5
+ "admin_vendor.js": "admin_vendor.fa88de45.js",
6
+ "form_editor.js": "form_editor.13982476.js",
7
+ "mailpoet.js": "mailpoet.a55b11ee.js",
8
+ "newsletter_editor.js": "newsletter_editor.1de7c9b5.js",
9
+ "vendor.js": "vendor.ae69bbf6.js"
10
  }
assets/js/{mp2migrator.81060f18.js → mp2migrator.dc0d6e2b.js} RENAMED
@@ -51,7 +51,8 @@
51
  /* 1 */
52
  /***/ function(module, exports, __webpack_require__) {
53
 
54
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
 
55
  'use strict';
56
 
57
  var MailPoet = mp;
51
  /* 1 */
52
  /***/ function(module, exports, __webpack_require__) {
53
 
54
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
55
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
56
  'use strict';
57
 
58
  var MailPoet = mp;
assets/js/{newsletter_editor.963cbce1.js → newsletter_editor.1de7c9b5.js} RENAMED
@@ -3,7 +3,8 @@ webpackJsonp([4],{
3
  /***/ 588:
4
  /***/ function(module, exports, __webpack_require__) {
5
 
6
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
7
  __webpack_require__(584),
8
  __webpack_require__(280),
9
  __webpack_require__(276),
@@ -166,7 +167,7 @@ webpackJsonp([4],{
166
  /***/ 276:
167
  /***/ function(module, exports, __webpack_require__) {
168
 
169
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
170
  // A placeholder for MailPoet object
171
  var MailPoet = {};
172
 
@@ -9447,7 +9448,7 @@ webpackJsonp([4],{
9447
  };
9448
  }
9449
 
9450
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery, _) {
9451
  var MailPoet = mp;
9452
 
9453
  MailPoet.Ajax = {
@@ -9461,10 +9462,10 @@ webpackJsonp([4],{
9461
  token: null,
9462
  data: {}
9463
  },
9464
- post: function (options) {
9465
  return this.request('post', options);
9466
  },
9467
- init: function (options) {
9468
  // merge options
9469
  this.options = jQuery.extend({}, this.defaults, options);
9470
 
@@ -9478,7 +9479,7 @@ webpackJsonp([4],{
9478
  this.options.token = window.mailpoet_token;
9479
  }
9480
  },
9481
- getParams: function () {
9482
  return {
9483
  action: 'mailpoet',
9484
  api_version: this.options.api_version,
@@ -9488,7 +9489,7 @@ webpackJsonp([4],{
9488
  data: this.options.data || {}
9489
  };
9490
  },
9491
- request: function (method, options) {
9492
  var params;
9493
  var deferred;
9494
  // set options
@@ -9499,7 +9500,7 @@ webpackJsonp([4],{
9499
 
9500
  // remove null values from the data object
9501
  if (_.isObject(params.data)) {
9502
- params.data = _.pick(params.data, function (value) {
9503
  return (value !== null);
9504
  });
9505
  }
@@ -9510,7 +9511,7 @@ webpackJsonp([4],{
9510
  params,
9511
  null,
9512
  'json'
9513
- ).then(function (data) {
9514
  return data;
9515
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
9516
 
@@ -9528,7 +9529,8 @@ webpackJsonp([4],{
9528
  /***/ 565:
9529
  /***/ function(module, exports, __webpack_require__) {
9530
 
9531
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
 
9532
  'use strict';
9533
 
9534
  var MailPoet = mp;
@@ -9783,7 +9785,7 @@ webpackJsonp([4],{
9783
 
9784
  // add sub panel wrapper
9785
  jQuery('#mailpoet_' + this.options.type)
9786
- .append(this.templates['subpanel']);
9787
 
9788
  // add sub panel content
9789
  jQuery('.mailpoet_' + this.options.type + '_body').last()
@@ -10173,9 +10175,9 @@ webpackJsonp([4],{
10173
  /***/ 566:
10174
  /***/ function(module, exports, __webpack_require__) {
10175
 
10176
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
10177
- 'use strict';
10178
 
 
10179
  /*= =================================================================================================
10180
 
10181
  MailPoet Notice:
@@ -10215,13 +10217,13 @@ webpackJsonp([4],{
10215
  onClose: null
10216
  },
10217
  options: {},
10218
- init: function (options) {
10219
  // set options
10220
  this.options = jQuery.extend({}, this.defaults, options);
10221
 
10222
  return this;
10223
  },
10224
- createNotice: function () {
10225
  var onClose;
10226
  var positionAfter;
10227
  // clone element
@@ -10255,8 +10257,8 @@ webpackJsonp([4],{
10255
  }
10256
 
10257
  // listen to remove event
10258
- jQuery(this.element).on('close', function () {
10259
- jQuery(this).fadeOut(200, function () {
10260
  // on close callback
10261
  if (onClose !== null) {
10262
  onClose();
@@ -10267,19 +10269,19 @@ webpackJsonp([4],{
10267
  }.bind(this.element));
10268
 
10269
  // listen to message event
10270
- jQuery(this.element).on('setMessage', function (e, message) {
10271
  MailPoet.Notice.setMessage(message);
10272
  }.bind(this.element));
10273
 
10274
  return this;
10275
  },
10276
- updateNotice: function () {
10277
  // update notice's message
10278
  jQuery('[data-id="' + this.options.id + '"').first().trigger(
10279
  'setMessage', this.options.message
10280
  );
10281
  },
10282
- setMessage: function (message) {
10283
  var formattedMessage = this.formatMessage(message);
10284
 
10285
  // let's sugar coat the message with a fancy <p>
@@ -10287,13 +10289,13 @@ webpackJsonp([4],{
10287
  // set message
10288
  return this.element.html(formattedMessage);
10289
  },
10290
- formatMessage: function (message) {
10291
  if (Array.isArray(message)) {
10292
  return message.join('<br />');
10293
  }
10294
  return message;
10295
  },
10296
- show: function (options) {
10297
  // initialize
10298
  this.init(options);
10299
 
@@ -10308,7 +10310,7 @@ webpackJsonp([4],{
10308
  }
10309
  this.showNotice();
10310
  },
10311
- showNotice: function () {
10312
  // set message
10313
  this.setMessage(this.options.message);
10314
 
@@ -10341,7 +10343,7 @@ webpackJsonp([4],{
10341
  this.element.delay(this.options.timeout).trigger('close');
10342
  } else if (this.options.hideClose === false) {
10343
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
10344
- this.element.find('.mailpoet_notice_close').on('click', function () {
10345
  jQuery(this).trigger('close');
10346
  });
10347
  }
@@ -10351,7 +10353,7 @@ webpackJsonp([4],{
10351
  this.options.onOpen(this.element);
10352
  }
10353
  },
10354
- hide: function (all) {
10355
  var id;
10356
  if (all !== undefined && all === true) {
10357
  // all notices
@@ -10369,19 +10371,19 @@ webpackJsonp([4],{
10369
  .trigger('close');
10370
  }
10371
  },
10372
- error: function (message, options) {
10373
  this.show(jQuery.extend({}, {
10374
  type: 'error',
10375
  message: message
10376
  }, options));
10377
  },
10378
- success: function (message, options) {
10379
  this.show(jQuery.extend({}, {
10380
  type: 'success',
10381
  message: message
10382
  }, options));
10383
  },
10384
- system: function (message, options) {
10385
  this.show(jQuery.extend({}, {
10386
  type: 'system',
10387
  static: true,
@@ -27585,7 +27587,9 @@ webpackJsonp([4],{
27585
  /***/ 583:
27586
  /***/ function(module, exports, __webpack_require__) {
27587
 
27588
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
27589
  * This shim replaces the default Backbone.Marionette communication library
27590
  * Backbone.Wreqr with Backbone.Radio ahead of time,
27591
  * since this libraries will be switched in Marionette 3.x anyway
@@ -27593,12 +27597,12 @@ webpackJsonp([4],{
27593
  * Courtesy of https://gist.github.com/jmeas/7992474cdb1c5672d88b
27594
  */
27595
 
27596
- (function (root, factory) {
27597
  var Marionette = __webpack_require__(572);
27598
  var Radio = __webpack_require__(573);
27599
  var _ = __webpack_require__(280);
27600
  if (true) {
27601
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(572), __webpack_require__(573), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BackboneMarionette, BackboneRadio, underscore) {
27602
  return factory(BackboneMarionette, BackboneRadio, underscore);
27603
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
27604
  }
@@ -27608,11 +27612,9 @@ webpackJsonp([4],{
27608
  else {
27609
  factory(root.Backbone.Marionette, root.Backbone.Radio, root._);
27610
  }
27611
- }(this, function (Marionette, Radio, _) {
27612
- 'use strict';
27613
-
27614
  var MarionetteApplication = Marionette.Application;
27615
- MarionetteApplication.prototype._initChannel = function () {
27616
  this.channelName = _.result(this, 'channelName') || 'global';
27617
  this.channel = _.result(this, 'channel') || Radio.channel(this.channelName);
27618
  };
@@ -27628,7 +27630,7 @@ webpackJsonp([4],{
27628
  __webpack_require__(544),
27629
  __webpack_require__(572),
27630
  __webpack_require__(573)
27631
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Backbone, Marionette, BackboneRadio) {
27632
  var Radio = BackboneRadio;
27633
 
27634
  var AppView = Marionette.View.extend({
@@ -27645,12 +27647,12 @@ webpackJsonp([4],{
27645
  var EditorApplication = Marionette.Application.extend({
27646
  region: '#mailpoet_editor',
27647
 
27648
- onStart: function () {
27649
  this._appView = new AppView();
27650
  this.showView(this._appView);
27651
  },
27652
 
27653
- getChannel: function (channel) {
27654
  if (channel === undefined) {
27655
  return Radio.channel('global');
27656
  }
@@ -27673,7 +27675,7 @@ webpackJsonp([4],{
27673
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27674
  __webpack_require__(584),
27675
  __webpack_require__(574)
27676
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, SuperModel) {
27677
  var Module = {};
27678
 
27679
  Module.ConfigModel = SuperModel.extend({
@@ -27689,13 +27691,13 @@ webpackJsonp([4],{
27689
 
27690
  // Global and available styles for access in blocks and their settings
27691
  Module._config = {};
27692
- Module.getConfig = function () { return Module._config; };
27693
- Module.setConfig = function (options) {
27694
  Module._config = new Module.ConfigModel(options, { parse: true });
27695
  return Module._config;
27696
  };
27697
 
27698
- App.on('before:start', function (BeforeStartApp, options) {
27699
  var Application = BeforeStartApp;
27700
  // Expose config methods globally
27701
  Application.getConfig = Module.getConfig;
@@ -27713,14 +27715,15 @@ webpackJsonp([4],{
27713
  /***/ 586:
27714
  /***/ function(module, exports, __webpack_require__) {
27715
 
27716
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
 
 
27717
  __webpack_require__(584),
27718
  __webpack_require__(572),
27719
  __webpack_require__(574),
27720
  __webpack_require__(280)
27721
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, Marionette, SuperModel, _) {
27722
- 'use strict';
27723
-
27724
  var Module = {};
27725
 
27726
  Module.StylesModel = SuperModel.extend({
@@ -27756,34 +27759,34 @@ webpackJsonp([4],{
27756
  backgroundColor: '#cccccc'
27757
  }
27758
  },
27759
- initialize: function () {
27760
- this.on('change', function () { App.getChannel().trigger('autoSave'); });
27761
  }
27762
  });
27763
 
27764
  Module.StylesView = Marionette.View.extend({
27765
- getTemplate: function () { return window.templates.styles; },
27766
  modelEvents: {
27767
  change: 'render'
27768
  },
27769
- serializeData: function () {
27770
  return this.model.toJSON();
27771
  }
27772
  });
27773
 
27774
  Module._globalStyles = new SuperModel();
27775
- Module.getGlobalStyles = function () {
27776
  return Module._globalStyles;
27777
  };
27778
- Module.setGlobalStyles = function (options) {
27779
  Module._globalStyles = new Module.StylesModel(options);
27780
  return Module._globalStyles;
27781
  };
27782
- Module.getAvailableStyles = function () {
27783
  return App.getConfig().get('availableStyles');
27784
  };
27785
 
27786
- App.on('before:start', function (BeforeStartApp, options) {
27787
  var Application = BeforeStartApp;
27788
  var body;
27789
  var globalStyles;
@@ -27797,7 +27800,7 @@ webpackJsonp([4],{
27797
  this.setGlobalStyles(globalStyles);
27798
  });
27799
 
27800
- App.on('start', function (StartApp) {
27801
  var stylesView = new Module.StylesView({ model: StartApp.getGlobalStyles() });
27802
  StartApp._appView.showChildView('stylesRegion', stylesView);
27803
  });
@@ -27811,7 +27814,8 @@ webpackJsonp([4],{
27811
  /***/ 587:
27812
  /***/ function(module, exports, __webpack_require__) {
27813
 
27814
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
27815
  __webpack_require__(584),
27816
  __webpack_require__(588),
27817
  __webpack_require__(276),
@@ -28213,14 +28217,14 @@ webpackJsonp([4],{
28213
  /***/ 589:
28214
  /***/ function(module, exports, __webpack_require__) {
28215
 
28216
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
 
28217
  __webpack_require__(584),
28218
  __webpack_require__(574),
28219
  __webpack_require__(280),
28220
  __webpack_require__(276)
28221
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, SuperModel, _, MailPoet) {
28222
- 'use strict';
28223
-
28224
  var Module = {};
28225
 
28226
  // Holds newsletter entry fields, such as subject or creation datetime.
@@ -28228,12 +28232,12 @@ webpackJsonp([4],{
28228
  // handled by other components.
28229
  Module.NewsletterModel = SuperModel.extend({
28230
  whitelisted: ['id', 'subject', 'preheader'],
28231
- initialize: function () {
28232
- this.on('change', function () {
28233
  App.getChannel().trigger('autoSave');
28234
  });
28235
  },
28236
- toJSON: function () {
28237
  // Use only whitelisted properties to ensure properties editor
28238
  // doesn't control don't change.
28239
  return _.pick(SuperModel.prototype.toJSON.call(this), this.whitelisted);
@@ -28242,45 +28246,45 @@ webpackJsonp([4],{
28242
 
28243
  // Content block view and model handlers for different content types
28244
  Module._blockTypes = {};
28245
- Module.registerBlockType = function (type, data) {
28246
  Module._blockTypes[type] = data;
28247
  };
28248
- Module.getBlockTypeModel = function (type) {
28249
  if (type in Module._blockTypes) {
28250
  return Module._blockTypes[type].blockModel;
28251
  }
28252
  throw 'Block type not supported: ' + type;
28253
  };
28254
- Module.getBlockTypeView = function (type) {
28255
  if (type in Module._blockTypes) {
28256
  return Module._blockTypes[type].blockView;
28257
  }
28258
  throw 'Block type not supported: ' + type;
28259
  };
28260
 
28261
- Module.getBody = function () {
28262
  return {
28263
  content: App._contentContainer.toJSON(),
28264
  globalStyles: App.getGlobalStyles().toJSON()
28265
  };
28266
  };
28267
 
28268
- Module.toJSON = function () {
28269
  return _.extend({
28270
  body: Module.getBody()
28271
  }, App.getNewsletter().toJSON());
28272
  };
28273
 
28274
- Module.getNewsletter = function () {
28275
  return Module.newsletter;
28276
  };
28277
 
28278
- Module.findModels = function (predicate) {
28279
  var blocks = App._contentContainer.getChildren();
28280
  return _.filter(blocks, predicate);
28281
  };
28282
 
28283
- App.on('before:start', function (Application, options) {
28284
  var BeforeStartApp = Application;
28285
  // Expose block methods globally
28286
  BeforeStartApp.registerBlockType = Module.registerBlockType;
@@ -28294,7 +28298,7 @@ webpackJsonp([4],{
28294
  Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['body']));
28295
  });
28296
 
28297
- App.on('start', function (Application, options) {
28298
  var StartApp = Application;
28299
  var body = options.newsletter.body;
28300
  var content = (_.has(body, 'content')) ? body.content : {};
@@ -28325,37 +28329,37 @@ webpackJsonp([4],{
28325
  /***/ 590:
28326
  /***/ function(module, exports, __webpack_require__) {
28327
 
28328
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
 
28329
  __webpack_require__(584),
28330
  __webpack_require__(544),
28331
  __webpack_require__(572),
28332
  __webpack_require__(280),
28333
  __webpack_require__(275),
28334
  __webpack_require__(276)
28335
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, Backbone, Marionette, _, jQuery, MailPoet) {
28336
- 'use strict';
28337
-
28338
  var Module = {};
28339
 
28340
  Module.HeadingView = Marionette.View.extend({
28341
- getTemplate: function () { return window.templates.heading; },
28342
- templateContext: function () {
28343
  return {
28344
  model: this.model.toJSON()
28345
  };
28346
  },
28347
- events: function () {
28348
  return {
28349
  'keyup .mailpoet_input_title': _.partial(this.changeField, 'subject'),
28350
  'keyup .mailpoet_input_preheader': _.partial(this.changeField, 'preheader')
28351
  };
28352
  },
28353
- changeField: function (field, event) {
28354
  this.model.set(field, jQuery(event.target).val());
28355
  }
28356
  });
28357
 
28358
- App.on('start', function (StartApp) {
28359
  StartApp._appView.showChildView('headingRegion', new Module.HeadingView({ model: StartApp.getNewsletter() }));
28360
  MailPoet.helpTooltip.show(document.getElementById('tooltip-designer-subject-line'), {
28361
  tooltipId: 'tooltip-designer-subject-line-ti',
@@ -28377,7 +28381,8 @@ webpackJsonp([4],{
28377
  /***/ 591:
28378
  /***/ function(module, exports, __webpack_require__) {
28379
 
28380
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
28381
  __webpack_require__(584),
28382
  __webpack_require__(588),
28383
  __webpack_require__(276),
@@ -33310,10 +33315,10 @@ webpackJsonp([4],{
33310
  */
33311
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33312
  __webpack_require__(572)
33313
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (BackboneMarionette) {
33314
  var Marionette = BackboneMarionette;
33315
  var BehaviorsLookup = {};
33316
- Marionette.Behaviors.behaviorsLookup = function () {
33317
  return BehaviorsLookup;
33318
  };
33319
 
@@ -33338,16 +33343,16 @@ webpackJsonp([4],{
33338
  __webpack_require__(594),
33339
  __webpack_require__(276),
33340
  __webpack_require__(576)
33341
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup, MailPoet) {
33342
  var BL = BehaviorsLookup;
33343
 
33344
  BL.ColorPickerBehavior = Marionette.Behavior.extend({
33345
- onRender: function () {
33346
  var that = this;
33347
  var preferredFormat = 'hex6';
33348
- this.view.$('.mailpoet_color').each(function () {
33349
  var $input = that.view.$(this);
33350
- var updateColorInput = function (color) {
33351
  if (color && color.getAlpha() > 0) {
33352
  $input.val(color.toString(preferredFormat));
33353
  } else {
@@ -33382,7 +33387,7 @@ webpackJsonp([4],{
33382
  /***/ 596:
33383
  /***/ function(module, exports, __webpack_require__) {
33384
 
33385
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
33386
  /**
33387
  * ContainerDropZoneBehavior
33388
  *
@@ -33859,7 +33864,7 @@ webpackJsonp([4],{
33859
  __webpack_require__(275),
33860
  __webpack_require__(594),
33861
  __webpack_require__(575)
33862
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, jQuery, BehaviorsLookup, interact) {
33863
  var BL = BehaviorsLookup;
33864
 
33865
  BL.DraggableBehavior = Marionette.Behavior.extend({
@@ -33873,14 +33878,14 @@ webpackJsonp([4],{
33873
  *
33874
  * @return Backbone.Model A model that will be passed to the receiver
33875
  */
33876
- getDropModel: function () {
33877
  throw "Missing 'drop' function for DraggableBehavior";
33878
  },
33879
 
33880
- onDrop: function () {},
33881
- testAttachToInstance: function () { return true; }
33882
  },
33883
- onRender: function () {
33884
  var that = this;
33885
  var interactable;
33886
 
@@ -33896,7 +33901,7 @@ webpackJsonp([4],{
33896
  // Scroll when dragging near edges of a window
33897
  autoScroll: true,
33898
 
33899
- onstart: function (startEvent) {
33900
  var event = startEvent;
33901
  var centerXOffset;
33902
  var centerYOffset;
@@ -33935,7 +33940,7 @@ webpackJsonp([4],{
33935
  }
33936
  },
33937
  // call this function on every dragmove event
33938
- onmove: function (event) {
33939
  var target = event.target;
33940
  // keep the dragged position in the data-x/data-y attributes
33941
  var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
@@ -33949,7 +33954,7 @@ webpackJsonp([4],{
33949
  target.setAttribute('data-x', x);
33950
  target.setAttribute('data-y', y);
33951
  },
33952
- onend: function (event) {
33953
  var target = event.target;
33954
  target.style.transform = '';
33955
  target.style.webkitTransform = target.style.transform;
@@ -33968,7 +33973,7 @@ webpackJsonp([4],{
33968
  })
33969
  .preventDefault('auto')
33970
  .styleCursor(false)
33971
- .actionChecker(function (pointer, event, action) {
33972
  // Disable dragging with right click
33973
  if (event.button !== 0) {
33974
  return null;
@@ -33982,7 +33987,7 @@ webpackJsonp([4],{
33982
  } else {
33983
  interactable.getDropModel = this.view.getDropFunc();
33984
  }
33985
- interactable.onDrop = function (opts) {
33986
  var options = opts;
33987
  if (_.isObject(options)) {
33988
  // Inject Draggable behavior if possible
@@ -34009,7 +34014,7 @@ webpackJsonp([4],{
34009
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34010
  __webpack_require__(572),
34011
  __webpack_require__(594)
34012
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup) {
34013
  var BL = BehaviorsLookup;
34014
 
34015
  BL.HighlightContainerBehavior = Marionette.Behavior.extend({
@@ -34017,10 +34022,10 @@ webpackJsonp([4],{
34017
  'mouseenter @ui.tools': 'enableHighlight',
34018
  'mouseleave @ui.tools': 'disableHighlight'
34019
  },
34020
- enableHighlight: function () {
34021
  this.$el.addClass('mailpoet_highlight');
34022
  },
34023
- disableHighlight: function () {
34024
  if (!this.view._isBeingEdited) {
34025
  this.$el.removeClass('mailpoet_highlight');
34026
  }
@@ -34042,7 +34047,7 @@ webpackJsonp([4],{
34042
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34043
  __webpack_require__(572),
34044
  __webpack_require__(594)
34045
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup) {
34046
  var BL = BehaviorsLookup;
34047
 
34048
  BL.HighlightEditingBehavior = Marionette.Behavior.extend({
@@ -34050,11 +34055,11 @@ webpackJsonp([4],{
34050
  startEditing: 'enableHighlight',
34051
  stopEditing: 'disableHighlight'
34052
  },
34053
- enableHighlight: function () {
34054
  this.view._isBeingEdited = true;
34055
  this.$el.addClass('mailpoet_highlight');
34056
  },
34057
- disableHighlight: function () {
34058
  this.view._isBeingEdited = false;
34059
  this.$el.removeClass('mailpoet_highlight');
34060
  }
@@ -34076,18 +34081,18 @@ webpackJsonp([4],{
34076
  __webpack_require__(572),
34077
  __webpack_require__(594),
34078
  __webpack_require__(575)
34079
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup, interact) {
34080
  var BL = BehaviorsLookup;
34081
 
34082
  BL.ResizableBehavior = Marionette.Behavior.extend({
34083
  defaults: {
34084
  elementSelector: null,
34085
  resizeHandleSelector: true, // true will use edges of the element itself
34086
- transformationFunction: function (y) { return y; }, // for blocks that use the default onResize function
34087
  minLength: 0,
34088
  maxLength: Infinity,
34089
  modelField: 'styles.block.height',
34090
- onResize: function (event) {
34091
  var currentLength = parseFloat(this.view.model.get(this.options.modelField));
34092
  var newLength = currentLength + this.options.transformationFunction(event.dy);
34093
  newLength = Math.min(this.options.maxLength, Math.max(this.options.minLength, newLength));
@@ -34098,14 +34103,14 @@ webpackJsonp([4],{
34098
  mouseenter: 'showResizeHandle',
34099
  mouseleave: 'hideResizeHandle'
34100
  },
34101
- onRender: function () {
34102
  this.attachResize();
34103
 
34104
  if (this.isBeingResized !== true) {
34105
  this.hideResizeHandle();
34106
  }
34107
  },
34108
- attachResize: function () {
34109
  var domElement = (this.options.elementSelector === null) ? this.view.$el.get(0) : this.view.$(this.options.elementSelector).get(0);
34110
  var that = this;
34111
  interact(domElement).resizable({
@@ -34117,24 +34122,24 @@ webpackJsonp([4],{
34117
  bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
34118
  }
34119
  })
34120
- .on('resizestart', function () {
34121
  that.isBeingResized = true;
34122
  that.$el.addClass('mailpoet_resize_active');
34123
- }).on('resizemove', function (event) {
34124
  var onResize = that.options.onResize.bind(that);
34125
  return onResize(event);
34126
  })
34127
- .on('resizeend', function () {
34128
  that.isBeingResized = null;
34129
  that.$el.removeClass('mailpoet_resize_active');
34130
  });
34131
  },
34132
- showResizeHandle: function () {
34133
  if (typeof this.options.resizeHandleSelector === 'string') {
34134
  this.view.$(this.options.resizeHandleSelector).removeClass('mailpoet_hidden');
34135
  }
34136
  },
34137
- hideResizeHandle: function () {
34138
  if (typeof this.options.resizeHandleSelector === 'string') {
34139
  this.view.$(this.options.resizeHandleSelector).addClass('mailpoet_hidden');
34140
  }
@@ -34157,23 +34162,23 @@ webpackJsonp([4],{
34157
  __webpack_require__(572),
34158
  __webpack_require__(280),
34159
  __webpack_require__(594)
34160
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, BehaviorsLookup) {
34161
  var BL = BehaviorsLookup;
34162
 
34163
  BL.SortableBehavior = Marionette.Behavior.extend({
34164
- onRender: function () {
34165
  var collection = this.view.collection;
34166
 
34167
  if (_.isFunction(this.$el.sortable)) {
34168
  this.$el.sortable({
34169
  cursor: 'move',
34170
- start: function (event, ui) {
34171
  ui.item.data('previousIndex', ui.item.index());
34172
  },
34173
- end: function (event, ui) {
34174
  ui.item.removeData('previousIndex');
34175
  },
34176
- update: function (event, ui) {
34177
  var previousIndex = ui.item.data('previousIndex');
34178
  var newIndex = ui.item.index();
34179
  var model = collection.at(previousIndex);
@@ -34205,7 +34210,7 @@ webpackJsonp([4],{
34205
  __webpack_require__(572),
34206
  __webpack_require__(275),
34207
  __webpack_require__(594)
34208
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, jQuery, BehaviorsLookup) {
34209
  var BL = BehaviorsLookup;
34210
 
34211
  BL.ShowSettingsBehavior = Marionette.Behavior.extend({
@@ -34215,12 +34220,12 @@ webpackJsonp([4],{
34215
  events: {
34216
  'click .mailpoet_content': 'showSettings'
34217
  },
34218
- showSettings: function (event) {
34219
  if (!this.isIgnoredElement(event.target)) {
34220
  this.view.triggerMethod('showSettings');
34221
  }
34222
  },
34223
- isIgnoredElement: function (element) {
34224
  return this.options.ignoreFrom
34225
  && this.options.ignoreFrom.length > 0
34226
  && jQuery(element).is(this.options.ignoreFrom);
@@ -34244,7 +34249,7 @@ webpackJsonp([4],{
34244
  __webpack_require__(572),
34245
  __webpack_require__(280),
34246
  __webpack_require__(594)
34247
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, BehaviorsLookup) {
34248
  var BL = BehaviorsLookup;
34249
 
34250
  BL.TextEditorBehavior = Marionette.Behavior.extend({
@@ -34256,9 +34261,9 @@ webpackJsonp([4],{
34256
  invalidElements: 'script',
34257
  blockFormats: 'Paragraph=p',
34258
  plugins: 'link textcolor colorpicker mailpoet_shortcodes',
34259
- configurationFilter: function (originalConfig) { return originalConfig; }
34260
  },
34261
- onDomRefresh: function () {
34262
  var that = this;
34263
  if (this.view.disableTextEditor === true) {
34264
  return;
@@ -34279,7 +34284,7 @@ webpackJsonp([4],{
34279
  relative_urls: false,
34280
  remove_script_host: false,
34281
  convert_urls: true,
34282
- urlconverter_callback: function (url) {
34283
  if (url.match(/\[.+\]/g)) {
34284
  // Do not convert URLs with shortcodes
34285
  return url;
@@ -34293,12 +34298,12 @@ webpackJsonp([4],{
34293
 
34294
  plugins: this.options.plugins,
34295
 
34296
- setup: function (editor) {
34297
- editor.on('change', function () {
34298
  that.view.triggerMethod('text:editor:change', editor.getContent());
34299
  });
34300
 
34301
- editor.on('click', function (e) {
34302
  editor.focus();
34303
  if (that._isActivationClick) {
34304
  editor.selection.setRng(
@@ -34308,12 +34313,12 @@ webpackJsonp([4],{
34308
  }
34309
  });
34310
 
34311
- editor.on('focus', function () {
34312
  that.view.triggerMethod('text:editor:focus');
34313
  that._isActivationClick = true;
34314
  });
34315
 
34316
- editor.on('blur', function () {
34317
  that.view.triggerMethod('text:editor:blur');
34318
  });
34319
  }
@@ -34328,7 +34333,8 @@ webpackJsonp([4],{
34328
  /***/ 604:
34329
  /***/ function(module, exports, __webpack_require__) {
34330
 
34331
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
34332
  * Defines base classes for actual content blocks to extend.
34333
  * Extending content block modules need to at least extend
34334
  * a BlockModel and a BlockView.
@@ -34654,7 +34660,8 @@ webpackJsonp([4],{
34654
  /***/ 605:
34655
  /***/ function(module, exports, __webpack_require__) {
34656
 
34657
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
34658
  * Container content block.
34659
  * This is a special kind of block, as it can contain content blocks, as well
34660
  * as other containers.
@@ -35026,7 +35033,8 @@ webpackJsonp([4],{
35026
  /***/ 606:
35027
  /***/ function(module, exports, __webpack_require__) {
35028
 
35029
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
35030
  * Button content block
35031
  */
35032
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -35181,7 +35189,8 @@ webpackJsonp([4],{
35181
  /***/ 607:
35182
  /***/ function(module, exports, __webpack_require__) {
35183
 
35184
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
35185
  * Image content block
35186
  */
35187
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -35617,7 +35626,9 @@ webpackJsonp([4],{
35617
  /***/ 608:
35618
  /***/ function(module, exports, __webpack_require__) {
35619
 
35620
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
35621
  * Divider content block
35622
  */
35623
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -35625,14 +35636,12 @@ webpackJsonp([4],{
35625
  __webpack_require__(604),
35626
  __webpack_require__(280),
35627
  __webpack_require__(275)
35628
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, jQuery) {
35629
- 'use strict';
35630
-
35631
  var Module = {};
35632
  var base = BaseBlock;
35633
 
35634
  Module.DividerBlockModel = base.BlockModel.extend({
35635
- defaults: function () {
35636
  return this._getDefaults({
35637
  type: 'divider',
35638
  styles: {
@@ -35650,13 +35659,13 @@ webpackJsonp([4],{
35650
 
35651
  Module.DividerBlockView = base.BlockView.extend({
35652
  className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
35653
- getTemplate: function () { return window.templates.dividerBlock; },
35654
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35655
  behaviors: _.defaults({
35656
  ResizableBehavior: {
35657
  elementSelector: '.mailpoet_content',
35658
  resizeHandleSelector: '.mailpoet_resize_handle',
35659
- transformationFunction: function (y) { return y / 2; },
35660
  minLength: 0, // TODO: Move this number to editor configuration
35661
  modelField: 'styles.block.padding'
35662
  },
@@ -35664,32 +35673,32 @@ webpackJsonp([4],{
35664
  ignoreFrom: '.mailpoet_resize_handle'
35665
  }
35666
  }, base.BlockView.prototype.behaviors),
35667
- onDragSubstituteBy: function () { return Module.DividerWidgetView; },
35668
- initialize: function () {
35669
  var that = this;
35670
  base.BlockView.prototype.initialize.apply(this, arguments);
35671
 
35672
  // Listen for attempts to change all dividers in one go
35673
- this._replaceDividerHandler = function (data) { that.model.set(data); that.model.trigger('applyToAll'); };
35674
  App.getChannel().on('replaceAllDividers', this._replaceDividerHandler);
35675
 
35676
  this.listenTo(this.model, 'change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll', this.render);
35677
  this.listenTo(this.model, 'change:styles.block.padding', this.changePadding);
35678
  },
35679
- templateContext: function () {
35680
  return _.extend({
35681
  totalHeight: parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
35682
  }, base.BlockView.prototype.templateContext.apply(this));
35683
  },
35684
- onRender: function () {
35685
  this.toolsView = new Module.DividerBlockToolsView({ model: this.model });
35686
  this.showChildView('toolsRegion', this.toolsView);
35687
  },
35688
- onBeforeDestroy: function () {
35689
  App.getChannel().off('replaceAllDividers', this._replaceDividerHandler);
35690
  this.stopListening(this.model);
35691
  },
35692
- changePadding: function () {
35693
  this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
35694
  this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
35695
  this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
@@ -35697,12 +35706,12 @@ webpackJsonp([4],{
35697
  });
35698
 
35699
  Module.DividerBlockToolsView = base.BlockToolsView.extend({
35700
- getSettingsView: function () { return Module.DividerBlockSettingsView; }
35701
  });
35702
 
35703
  Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
35704
- getTemplate: function () { return window.templates.dividerBlockSettings; },
35705
- events: function () {
35706
  return {
35707
  'click .mailpoet_field_divider_style': 'changeStyle',
35708
 
@@ -35716,47 +35725,47 @@ webpackJsonp([4],{
35716
  'click .mailpoet_done_editing': 'close'
35717
  };
35718
  },
35719
- modelEvents: function () {
35720
  return {
35721
  'change:styles.block.borderColor': 'repaintDividerStyleOptions'
35722
  };
35723
  },
35724
- templateContext: function () {
35725
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
35726
  availableStyles: App.getAvailableStyles().toJSON(),
35727
  renderOptions: this.renderOptions
35728
  });
35729
  },
35730
- changeStyle: function (event) {
35731
  var style = jQuery(event.currentTarget).data('style');
35732
  this.model.set('styles.block.borderStyle', style);
35733
  this.$('.mailpoet_field_divider_style').removeClass('mailpoet_active_divider_style');
35734
  this.$('.mailpoet_field_divider_style[data-style="' + style + '"]').addClass('mailpoet_active_divider_style');
35735
  },
35736
- repaintDividerStyleOptions: function () {
35737
  this.$('.mailpoet_field_divider_style > div').css('border-top-color', this.model.get('styles.block.borderColor'));
35738
  },
35739
- applyToAll: function () {
35740
  App.getChannel().trigger('replaceAllDividers', this.model.toJSON());
35741
  },
35742
- updateValueAndCall: function (fieldToUpdate, callable, event) {
35743
  this.$(fieldToUpdate).val(jQuery(event.target).val());
35744
  callable(event);
35745
  }
35746
  });
35747
 
35748
  Module.DividerWidgetView = base.WidgetView.extend({
35749
- getTemplate: function () { return window.templates.dividerInsertion; },
35750
  behaviors: {
35751
  DraggableBehavior: {
35752
  cloneOriginal: true,
35753
- drop: function () {
35754
  return new Module.DividerBlockModel();
35755
  }
35756
  }
35757
  }
35758
  });
35759
- App.on('before:start', function (BeforeStartApp) {
35760
  BeforeStartApp.registerBlockType('divider', {
35761
  blockModel: Module.DividerBlockModel,
35762
  blockView: Module.DividerBlockView
@@ -35778,7 +35787,9 @@ webpackJsonp([4],{
35778
  /***/ 609:
35779
  /***/ function(module, exports, __webpack_require__) {
35780
 
35781
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
35782
  * Text content block
35783
  */
35784
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -35786,14 +35797,12 @@ webpackJsonp([4],{
35786
  __webpack_require__(604),
35787
  __webpack_require__(280),
35788
  __webpack_require__(276)
35789
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) {
35790
- 'use strict';
35791
-
35792
  var Module = {};
35793
  var base = BaseBlock;
35794
 
35795
  Module.TextBlockModel = base.BlockModel.extend({
35796
- defaults: function () {
35797
  return this._getDefaults({
35798
  type: 'text',
35799
  text: 'Edit this to insert text'
@@ -35803,7 +35812,7 @@ webpackJsonp([4],{
35803
 
35804
  Module.TextBlockView = base.BlockView.extend({
35805
  className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
35806
- getTemplate: function () { return window.templates.textBlock; },
35807
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
35808
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
35809
  TextEditorBehavior: {
@@ -35813,7 +35822,7 @@ webpackJsonp([4],{
35813
  invalidElements: 'script',
35814
  blockFormats: 'Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p',
35815
  plugins: 'link lists code textcolor colorpicker mailpoet_shortcodes paste',
35816
- configurationFilter: function (originalSettings) {
35817
  return _.extend({}, originalSettings, {
35818
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
35819
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -35821,7 +35830,7 @@ webpackJsonp([4],{
35821
  }
35822
  }
35823
  }),
35824
- initialize: function (options) {
35825
  base.BlockView.prototype.initialize.apply(this, arguments);
35826
 
35827
  this.renderOptions = _.defaults(options.renderOptions || {}, {
@@ -35830,8 +35839,8 @@ webpackJsonp([4],{
35830
 
35831
  this.disableTextEditor = this.renderOptions.disableTextEditor;
35832
  },
35833
- onDragSubstituteBy: function () { return Module.TextWidgetView; },
35834
- onRender: function () {
35835
  this.toolsView = new Module.TextBlockToolsView({
35836
  model: this.model,
35837
  tools: {
@@ -35840,40 +35849,40 @@ webpackJsonp([4],{
35840
  });
35841
  this.showChildView('toolsRegion', this.toolsView);
35842
  },
35843
- onTextEditorChange: function (newContent) {
35844
  this.model.set('text', newContent);
35845
  },
35846
- onTextEditorFocus: function () {
35847
  this.disableDragging();
35848
  this.disableShowingTools();
35849
  },
35850
- onTextEditorBlur: function () {
35851
  this.enableDragging();
35852
  this.enableShowingTools();
35853
  }
35854
  });
35855
 
35856
  Module.TextBlockToolsView = base.BlockToolsView.extend({
35857
- getSettingsView: function () { return Module.TextBlockSettingsView; }
35858
  });
35859
 
35860
  Module.TextBlockSettingsView = base.BlockSettingsView.extend({
35861
- getTemplate: function () { return window.templates.textBlockSettings; }
35862
  });
35863
 
35864
  Module.TextWidgetView = base.WidgetView.extend({
35865
- getTemplate: function () { return window.templates.textInsertion; },
35866
  behaviors: {
35867
  DraggableBehavior: {
35868
  cloneOriginal: true,
35869
- drop: function () {
35870
  return new Module.TextBlockModel();
35871
  }
35872
  }
35873
  }
35874
  });
35875
 
35876
- App.on('before:start', function (BeforeStartApp) {
35877
  BeforeStartApp.registerBlockType('text', {
35878
  blockModel: Module.TextBlockModel,
35879
  blockView: Module.TextBlockView
@@ -35896,21 +35905,21 @@ webpackJsonp([4],{
35896
  /***/ 610:
35897
  /***/ function(module, exports, __webpack_require__) {
35898
 
35899
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
35900
  * Spacer content block
35901
  */
35902
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35903
  __webpack_require__(584),
35904
  __webpack_require__(604),
35905
  __webpack_require__(280)
35906
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _) {
35907
- 'use strict';
35908
-
35909
  var Module = {};
35910
  var base = BaseBlock;
35911
 
35912
  Module.SpacerBlockModel = base.BlockModel.extend({
35913
- defaults: function () {
35914
  return this._getDefaults({
35915
  type: 'spacer',
35916
  styles: {
@@ -35925,7 +35934,7 @@ webpackJsonp([4],{
35925
 
35926
  Module.SpacerBlockView = base.BlockView.extend({
35927
  className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
35928
- getTemplate: function () { return window.templates.spacerBlock; },
35929
  behaviors: _.defaults({
35930
  ResizableBehavior: {
35931
  elementSelector: '.mailpoet_spacer',
@@ -35938,33 +35947,33 @@ webpackJsonp([4],{
35938
  }
35939
  }, base.BlockView.prototype.behaviors),
35940
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35941
- onDragSubstituteBy: function () { return Module.SpacerWidgetView; },
35942
- initialize: function () {
35943
  base.BlockView.prototype.initialize.apply(this, arguments);
35944
 
35945
  this.listenTo(this.model, 'change:styles.block.backgroundColor', this.render);
35946
  this.listenTo(this.model, 'change:styles.block.height', this.changeHeight);
35947
  },
35948
- onRender: function () {
35949
  this.toolsView = new Module.SpacerBlockToolsView({ model: this.model });
35950
  this.showChildView('toolsRegion', this.toolsView);
35951
  },
35952
- changeHeight: function () {
35953
  this.$('.mailpoet_spacer').css('height', this.model.get('styles.block.height'));
35954
  this.$('.mailpoet_resize_handle_text').text(this.model.get('styles.block.height'));
35955
  },
35956
- onBeforeDestroy: function () {
35957
  this.stopListening(this.model);
35958
  }
35959
  });
35960
 
35961
  Module.SpacerBlockToolsView = base.BlockToolsView.extend({
35962
- getSettingsView: function () { return Module.SpacerBlockSettingsView; }
35963
  });
35964
 
35965
  Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
35966
- getTemplate: function () { return window.templates.spacerBlockSettings; },
35967
- events: function () {
35968
  return {
35969
  'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
35970
  'click .mailpoet_done_editing': 'close'
@@ -35973,18 +35982,18 @@ webpackJsonp([4],{
35973
  });
35974
 
35975
  Module.SpacerWidgetView = base.WidgetView.extend({
35976
- getTemplate: function () { return window.templates.spacerInsertion; },
35977
  behaviors: {
35978
  DraggableBehavior: {
35979
  cloneOriginal: true,
35980
- drop: function () {
35981
  return new Module.SpacerBlockModel();
35982
  }
35983
  }
35984
  }
35985
  });
35986
 
35987
- App.on('before:start', function (BeforeStartApp) {
35988
  BeforeStartApp.registerBlockType('spacer', {
35989
  blockModel: Module.SpacerBlockModel,
35990
  blockView: Module.SpacerBlockView
@@ -36006,7 +36015,9 @@ webpackJsonp([4],{
36006
  /***/ 611:
36007
  /***/ function(module, exports, __webpack_require__) {
36008
 
36009
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
36010
  * Footer content block
36011
  */
36012
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -36014,14 +36025,12 @@ webpackJsonp([4],{
36014
  __webpack_require__(604),
36015
  __webpack_require__(280),
36016
  __webpack_require__(276)
36017
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) {
36018
- 'use strict';
36019
-
36020
  var Module = {};
36021
  var base = BaseBlock;
36022
 
36023
  Module.FooterBlockModel = base.BlockModel.extend({
36024
- defaults: function () {
36025
  return this._getDefaults({
36026
  type: 'footer',
36027
  text: '<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',
@@ -36046,13 +36055,13 @@ webpackJsonp([4],{
36046
 
36047
  Module.FooterBlockView = base.BlockView.extend({
36048
  className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
36049
- getTemplate: function () { return window.templates.footerBlock; },
36050
  modelEvents: _.extend({
36051
  'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
36052
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36053
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
36054
  TextEditorBehavior: {
36055
- configurationFilter: function (originalSettings) {
36056
  return _.extend({}, originalSettings, {
36057
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
36058
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -36060,37 +36069,37 @@ webpackJsonp([4],{
36060
  }
36061
  }
36062
  }),
36063
- onDragSubstituteBy: function () { return Module.FooterWidgetView; },
36064
- onRender: function () {
36065
  this.toolsView = new Module.FooterBlockToolsView({ model: this.model });
36066
  this.showChildView('toolsRegion', this.toolsView);
36067
  },
36068
- onTextEditorChange: function (newContent) {
36069
  this.model.set('text', newContent);
36070
  },
36071
- onTextEditorFocus: function () {
36072
  this.disableDragging();
36073
  this.disableShowingTools();
36074
  },
36075
- onTextEditorBlur: function () {
36076
  this.enableDragging();
36077
  this.enableShowingTools();
36078
  }
36079
  });
36080
 
36081
  Module.FooterBlockToolsView = base.BlockToolsView.extend({
36082
- getSettingsView: function () { return Module.FooterBlockSettingsView; }
36083
  });
36084
 
36085
  Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
36086
- getTemplate: function () { return window.templates.footerBlockSettings; },
36087
- events: function () {
36088
  return {
36089
  'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36090
  'change .mailpoet_field_footer_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
36091
  'change .mailpoet_field_footer_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
36092
  'change #mailpoet_field_footer_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
36093
- 'change #mailpoet_field_footer_link_underline': function (event) {
36094
  this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
36095
  },
36096
  'change .mailpoet_field_footer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -36098,7 +36107,7 @@ webpackJsonp([4],{
36098
  'click .mailpoet_done_editing': 'close'
36099
  };
36100
  },
36101
- templateContext: function () {
36102
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
36103
  availableStyles: App.getAvailableStyles().toJSON()
36104
  });
@@ -36106,18 +36115,18 @@ webpackJsonp([4],{
36106
  });
36107
 
36108
  Module.FooterWidgetView = base.WidgetView.extend({
36109
- getTemplate: function () { return window.templates.footerInsertion; },
36110
  behaviors: {
36111
  DraggableBehavior: {
36112
  cloneOriginal: true,
36113
- drop: function () {
36114
  return new Module.FooterBlockModel();
36115
  }
36116
  }
36117
  }
36118
  });
36119
 
36120
- App.on('before:start', function (BeforeStartApp) {
36121
  BeforeStartApp.registerBlockType('footer', {
36122
  blockModel: Module.FooterBlockModel,
36123
  blockView: Module.FooterBlockView
@@ -36139,7 +36148,9 @@ webpackJsonp([4],{
36139
  /***/ 612:
36140
  /***/ function(module, exports, __webpack_require__) {
36141
 
36142
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
 
36143
  * Header content block
36144
  */
36145
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
@@ -36147,14 +36158,12 @@ webpackJsonp([4],{
36147
  __webpack_require__(604),
36148
  __webpack_require__(280),
36149
  __webpack_require__(276)
36150
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) {
36151
- 'use strict';
36152
-
36153
  var Module = {};
36154
  var base = BaseBlock;
36155
 
36156
  Module.HeaderBlockModel = base.BlockModel.extend({
36157
- defaults: function () {
36158
  return this._getDefaults({
36159
  type: 'header',
36160
  text: 'Display problems? <a href="[link:newsletter_view_in_browser_url]">View it in your browser</a>',
@@ -36179,13 +36188,13 @@ webpackJsonp([4],{
36179
 
36180
  Module.HeaderBlockView = base.BlockView.extend({
36181
  className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
36182
- getTemplate: function () { return window.templates.headerBlock; },
36183
  modelEvents: _.extend({
36184
  'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
36185
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36186
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
36187
  TextEditorBehavior: {
36188
- configurationFilter: function (originalSettings) {
36189
  return _.extend({}, originalSettings, {
36190
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
36191
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -36193,37 +36202,37 @@ webpackJsonp([4],{
36193
  }
36194
  }
36195
  }),
36196
- onDragSubstituteBy: function () { return Module.HeaderWidgetView; },
36197
- onRender: function () {
36198
  this.toolsView = new Module.HeaderBlockToolsView({ model: this.model });
36199
  this.showChildView('toolsRegion', this.toolsView);
36200
  },
36201
- onTextEditorChange: function (newContent) {
36202
  this.model.set('text', newContent);
36203
  },
36204
- onTextEditorFocus: function () {
36205
  this.disableDragging();
36206
  this.disableShowingTools();
36207
  },
36208
- onTextEditorBlur: function () {
36209
  this.enableDragging();
36210
  this.enableShowingTools();
36211
  }
36212
  });
36213
 
36214
  Module.HeaderBlockToolsView = base.BlockToolsView.extend({
36215
- getSettingsView: function () { return Module.HeaderBlockSettingsView; }
36216
  });
36217
 
36218
  Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
36219
- getTemplate: function () { return window.templates.headerBlockSettings; },
36220
- events: function () {
36221
  return {
36222
  'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36223
  'change .mailpoet_field_header_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
36224
  'change .mailpoet_field_header_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
36225
  'change #mailpoet_field_header_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
36226
- 'change #mailpoet_field_header_link_underline': function (event) {
36227
  this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
36228
  },
36229
  'change .mailpoet_field_header_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -36231,7 +36240,7 @@ webpackJsonp([4],{
36231
  'click .mailpoet_done_editing': 'close'
36232
  };
36233
  },
36234
- templateContext: function () {
36235
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
36236
  availableStyles: App.getAvailableStyles().toJSON()
36237
  });
@@ -36239,18 +36248,18 @@ webpackJsonp([4],{
36239
  });
36240
 
36241
  Module.HeaderWidgetView = base.WidgetView.extend({
36242
- getTemplate: function () { return window.templates.headerInsertion; },
36243
  behaviors: {
36244
  DraggableBehavior: {
36245
  cloneOriginal: true,
36246
- drop: function () {
36247
  return new Module.HeaderBlockModel();
36248
  }
36249
  }
36250
  }
36251
  });
36252
 
36253
- App.on('before:start', function (BeforeStartApp) {
36254
  BeforeStartApp.registerBlockType('header', {
36255
  blockModel: Module.HeaderBlockModel,
36256
  blockView: Module.HeaderBlockView
@@ -36272,7 +36281,8 @@ webpackJsonp([4],{
36272
  /***/ 613:
36273
  /***/ function(module, exports, __webpack_require__) {
36274
 
36275
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
36276
  * Automated latest content block.
36277
  * Only query parameters can be modified by the user. Posts pulled by this
36278
  * block will change as more posts get published.
@@ -36681,7 +36691,8 @@ webpackJsonp([4],{
36681
  /***/ 614:
36682
  /***/ function(module, exports, __webpack_require__) {
36683
 
36684
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
36685
  * Posts block.
36686
  *
36687
  * This block works slightly differently compared to any other block.
@@ -37287,7 +37298,8 @@ webpackJsonp([4],{
37287
  /***/ 615:
37288
  /***/ function(module, exports, __webpack_require__) {
37289
 
37290
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
37291
  * Social icons content block
37292
  */
37293
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
3
  /***/ 588:
4
  /***/ function(module, exports, __webpack_require__) {
5
 
6
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
7
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
8
  __webpack_require__(584),
9
  __webpack_require__(280),
10
  __webpack_require__(276),
167
  /***/ 276:
168
  /***/ function(module, exports, __webpack_require__) {
169
 
170
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function mailpoet() {
171
  // A placeholder for MailPoet object
172
  var MailPoet = {};
173
 
9448
  };
9449
  }
9450
 
9451
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function ajax(mp, jQuery, _) {
9452
  var MailPoet = mp;
9453
 
9454
  MailPoet.Ajax = {
9462
  token: null,
9463
  data: {}
9464
  },
9465
+ post: function post(options) {
9466
  return this.request('post', options);
9467
  },
9468
+ init: function init(options) {
9469
  // merge options
9470
  this.options = jQuery.extend({}, this.defaults, options);
9471
 
9479
  this.options.token = window.mailpoet_token;
9480
  }
9481
  },
9482
+ getParams: function getParams() {
9483
  return {
9484
  action: 'mailpoet',
9485
  api_version: this.options.api_version,
9489
  data: this.options.data || {}
9490
  };
9491
  },
9492
+ request: function request(method, options) {
9493
  var params;
9494
  var deferred;
9495
  // set options
9500
 
9501
  // remove null values from the data object
9502
  if (_.isObject(params.data)) {
9503
+ params.data = _.pick(params.data, function isNotNull(value) {
9504
  return (value !== null);
9505
  });
9506
  }
9511
  params,
9512
  null,
9513
  'json'
9514
+ ).then(function resultHandler(data) {
9515
  return data;
9516
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
9517
 
9529
  /***/ 565:
9530
  /***/ function(module, exports, __webpack_require__) {
9531
 
9532
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
9533
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) {
9534
  'use strict';
9535
 
9536
  var MailPoet = mp;
9785
 
9786
  // add sub panel wrapper
9787
  jQuery('#mailpoet_' + this.options.type)
9788
+ .append(this.templates.subpanel);
9789
 
9790
  // add sub panel content
9791
  jQuery('.mailpoet_' + this.options.type + '_body').last()
10175
  /***/ 566:
10176
  /***/ function(module, exports, __webpack_require__) {
10177
 
10178
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
10179
 
10180
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery) { // eslint-disable-line func-names
10181
  /*= =================================================================================================
10182
 
10183
  MailPoet Notice:
10217
  onClose: null
10218
  },
10219
  options: {},
10220
+ init: function init(options) {
10221
  // set options
10222
  this.options = jQuery.extend({}, this.defaults, options);
10223
 
10224
  return this;
10225
  },
10226
+ createNotice: function createNotice() {
10227
  var onClose;
10228
  var positionAfter;
10229
  // clone element
10257
  }
10258
 
10259
  // listen to remove event
10260
+ jQuery(this.element).on('close', function () { // eslint-disable-line func-names
10261
+ jQuery(this).fadeOut(200, function () { // eslint-disable-line func-names
10262
  // on close callback
10263
  if (onClose !== null) {
10264
  onClose();
10269
  }.bind(this.element));
10270
 
10271
  // listen to message event
10272
+ jQuery(this.element).on('setMessage', function (e, message) { // eslint-disable-line func-names
10273
  MailPoet.Notice.setMessage(message);
10274
  }.bind(this.element));
10275
 
10276
  return this;
10277
  },
10278
+ updateNotice: function updateNotice() {
10279
  // update notice's message
10280
  jQuery('[data-id="' + this.options.id + '"').first().trigger(
10281
  'setMessage', this.options.message
10282
  );
10283
  },
10284
+ setMessage: function setMessage(message) {
10285
  var formattedMessage = this.formatMessage(message);
10286
 
10287
  // let's sugar coat the message with a fancy <p>
10289
  // set message
10290
  return this.element.html(formattedMessage);
10291
  },
10292
+ formatMessage: function formatMessage(message) {
10293
  if (Array.isArray(message)) {
10294
  return message.join('<br />');
10295
  }
10296
  return message;
10297
  },
10298
+ show: function show(options) {
10299
  // initialize
10300
  this.init(options);
10301
 
10310
  }
10311
  this.showNotice();
10312
  },
10313
+ showNotice: function showNotice() {
10314
  // set message
10315
  this.setMessage(this.options.message);
10316
 
10343
  this.element.delay(this.options.timeout).trigger('close');
10344
  } else if (this.options.hideClose === false) {
10345
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
10346
+ this.element.find('.mailpoet_notice_close').on('click', function () { // eslint-disable-line func-names
10347
  jQuery(this).trigger('close');
10348
  });
10349
  }
10353
  this.options.onOpen(this.element);
10354
  }
10355
  },
10356
+ hide: function hide(all) {
10357
  var id;
10358
  if (all !== undefined && all === true) {
10359
  // all notices
10371
  .trigger('close');
10372
  }
10373
  },
10374
+ error: function error(message, options) {
10375
  this.show(jQuery.extend({}, {
10376
  type: 'error',
10377
  message: message
10378
  }, options));
10379
  },
10380
+ success: function success(message, options) {
10381
  this.show(jQuery.extend({}, {
10382
  type: 'success',
10383
  message: message
10384
  }, options));
10385
  },
10386
+ system: function system(message, options) {
10387
  this.show(jQuery.extend({}, {
10388
  type: 'system',
10389
  static: true,
27587
  /***/ 583:
27588
  /***/ function(module, exports, __webpack_require__) {
27589
 
27590
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
27591
+
27592
+ /**
27593
  * This shim replaces the default Backbone.Marionette communication library
27594
  * Backbone.Wreqr with Backbone.Radio ahead of time,
27595
  * since this libraries will be switched in Marionette 3.x anyway
27597
  * Courtesy of https://gist.github.com/jmeas/7992474cdb1c5672d88b
27598
  */
27599
 
27600
+ (function (root, factory) { // eslint-disable-line func-names
27601
  var Marionette = __webpack_require__(572);
27602
  var Radio = __webpack_require__(573);
27603
  var _ = __webpack_require__(280);
27604
  if (true) {
27605
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(572), __webpack_require__(573), __webpack_require__(280)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BackboneMarionette, BackboneRadio, underscore) { // eslint-disable-line func-names
27606
  return factory(BackboneMarionette, BackboneRadio, underscore);
27607
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
27608
  }
27612
  else {
27613
  factory(root.Backbone.Marionette, root.Backbone.Radio, root._);
27614
  }
27615
+ }(this, function (Marionette, Radio, _) { // eslint-disable-line func-names
 
 
27616
  var MarionetteApplication = Marionette.Application;
27617
+ MarionetteApplication.prototype._initChannel = function () { // eslint-disable-line func-names
27618
  this.channelName = _.result(this, 'channelName') || 'global';
27619
  this.channel = _.result(this, 'channel') || Radio.channel(this.channelName);
27620
  };
27630
  __webpack_require__(544),
27631
  __webpack_require__(572),
27632
  __webpack_require__(573)
27633
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Backbone, Marionette, BackboneRadio) { // eslint-disable-line func-names
27634
  var Radio = BackboneRadio;
27635
 
27636
  var AppView = Marionette.View.extend({
27647
  var EditorApplication = Marionette.Application.extend({
27648
  region: '#mailpoet_editor',
27649
 
27650
+ onStart: function () { // eslint-disable-line func-names
27651
  this._appView = new AppView();
27652
  this.showView(this._appView);
27653
  },
27654
 
27655
+ getChannel: function (channel) { // eslint-disable-line func-names
27656
  if (channel === undefined) {
27657
  return Radio.channel('global');
27658
  }
27675
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27676
  __webpack_require__(584),
27677
  __webpack_require__(574)
27678
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, SuperModel) { // eslint-disable-line func-names
27679
  var Module = {};
27680
 
27681
  Module.ConfigModel = SuperModel.extend({
27691
 
27692
  // Global and available styles for access in blocks and their settings
27693
  Module._config = {};
27694
+ Module.getConfig = function () { return Module._config; }; // eslint-disable-line func-names
27695
+ Module.setConfig = function (options) { // eslint-disable-line func-names
27696
  Module._config = new Module.ConfigModel(options, { parse: true });
27697
  return Module._config;
27698
  };
27699
 
27700
+ App.on('before:start', function (BeforeStartApp, options) { // eslint-disable-line func-names
27701
  var Application = BeforeStartApp;
27702
  // Expose config methods globally
27703
  Application.getConfig = Module.getConfig;
27715
  /***/ 586:
27716
  /***/ function(module, exports, __webpack_require__) {
27717
 
27718
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
27719
+ 'use strict';
27720
+
27721
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27722
  __webpack_require__(584),
27723
  __webpack_require__(572),
27724
  __webpack_require__(574),
27725
  __webpack_require__(280)
27726
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, Marionette, SuperModel, _) { // eslint-disable-line func-names
 
 
27727
  var Module = {};
27728
 
27729
  Module.StylesModel = SuperModel.extend({
27759
  backgroundColor: '#cccccc'
27760
  }
27761
  },
27762
+ initialize: function () { // eslint-disable-line func-names
27763
+ this.on('change', function () { App.getChannel().trigger('autoSave'); }); // eslint-disable-line func-names
27764
  }
27765
  });
27766
 
27767
  Module.StylesView = Marionette.View.extend({
27768
+ getTemplate: function () { return window.templates.styles; }, // eslint-disable-line func-names
27769
  modelEvents: {
27770
  change: 'render'
27771
  },
27772
+ serializeData: function () { // eslint-disable-line func-names
27773
  return this.model.toJSON();
27774
  }
27775
  });
27776
 
27777
  Module._globalStyles = new SuperModel();
27778
+ Module.getGlobalStyles = function () { // eslint-disable-line func-names
27779
  return Module._globalStyles;
27780
  };
27781
+ Module.setGlobalStyles = function (options) { // eslint-disable-line func-names
27782
  Module._globalStyles = new Module.StylesModel(options);
27783
  return Module._globalStyles;
27784
  };
27785
+ Module.getAvailableStyles = function () { // eslint-disable-line func-names
27786
  return App.getConfig().get('availableStyles');
27787
  };
27788
 
27789
+ App.on('before:start', function (BeforeStartApp, options) { // eslint-disable-line func-names
27790
  var Application = BeforeStartApp;
27791
  var body;
27792
  var globalStyles;
27800
  this.setGlobalStyles(globalStyles);
27801
  });
27802
 
27803
+ App.on('start', function (StartApp) { // eslint-disable-line func-names
27804
  var stylesView = new Module.StylesView({ model: StartApp.getGlobalStyles() });
27805
  StartApp._appView.showChildView('stylesRegion', stylesView);
27806
  });
27814
  /***/ 587:
27815
  /***/ function(module, exports, __webpack_require__) {
27816
 
27817
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
27818
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27819
  __webpack_require__(584),
27820
  __webpack_require__(588),
27821
  __webpack_require__(276),
28217
  /***/ 589:
28218
  /***/ function(module, exports, __webpack_require__) {
28219
 
28220
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
28221
+
28222
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28223
  __webpack_require__(584),
28224
  __webpack_require__(574),
28225
  __webpack_require__(280),
28226
  __webpack_require__(276)
28227
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, SuperModel, _, MailPoet) { // eslint-disable-line func-names
 
 
28228
  var Module = {};
28229
 
28230
  // Holds newsletter entry fields, such as subject or creation datetime.
28232
  // handled by other components.
28233
  Module.NewsletterModel = SuperModel.extend({
28234
  whitelisted: ['id', 'subject', 'preheader'],
28235
+ initialize: function () { // eslint-disable-line func-names
28236
+ this.on('change', function () { // eslint-disable-line func-names
28237
  App.getChannel().trigger('autoSave');
28238
  });
28239
  },
28240
+ toJSON: function () { // eslint-disable-line func-names
28241
  // Use only whitelisted properties to ensure properties editor
28242
  // doesn't control don't change.
28243
  return _.pick(SuperModel.prototype.toJSON.call(this), this.whitelisted);
28246
 
28247
  // Content block view and model handlers for different content types
28248
  Module._blockTypes = {};
28249
+ Module.registerBlockType = function (type, data) { // eslint-disable-line func-names
28250
  Module._blockTypes[type] = data;
28251
  };
28252
+ Module.getBlockTypeModel = function (type) { // eslint-disable-line func-names
28253
  if (type in Module._blockTypes) {
28254
  return Module._blockTypes[type].blockModel;
28255
  }
28256
  throw 'Block type not supported: ' + type;
28257
  };
28258
+ Module.getBlockTypeView = function (type) { // eslint-disable-line func-names
28259
  if (type in Module._blockTypes) {
28260
  return Module._blockTypes[type].blockView;
28261
  }
28262
  throw 'Block type not supported: ' + type;
28263
  };
28264
 
28265
+ Module.getBody = function () { // eslint-disable-line func-names
28266
  return {
28267
  content: App._contentContainer.toJSON(),
28268
  globalStyles: App.getGlobalStyles().toJSON()
28269
  };
28270
  };
28271
 
28272
+ Module.toJSON = function () { // eslint-disable-line func-names
28273
  return _.extend({
28274
  body: Module.getBody()
28275
  }, App.getNewsletter().toJSON());
28276
  };
28277
 
28278
+ Module.getNewsletter = function () { // eslint-disable-line func-names
28279
  return Module.newsletter;
28280
  };
28281
 
28282
+ Module.findModels = function (predicate) { // eslint-disable-line func-names
28283
  var blocks = App._contentContainer.getChildren();
28284
  return _.filter(blocks, predicate);
28285
  };
28286
 
28287
+ App.on('before:start', function (Application, options) { // eslint-disable-line func-names
28288
  var BeforeStartApp = Application;
28289
  // Expose block methods globally
28290
  BeforeStartApp.registerBlockType = Module.registerBlockType;
28298
  Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['body']));
28299
  });
28300
 
28301
+ App.on('start', function (Application, options) { // eslint-disable-line func-names
28302
  var StartApp = Application;
28303
  var body = options.newsletter.body;
28304
  var content = (_.has(body, 'content')) ? body.content : {};
28329
  /***/ 590:
28330
  /***/ function(module, exports, __webpack_require__) {
28331
 
28332
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
28333
+
28334
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28335
  __webpack_require__(584),
28336
  __webpack_require__(544),
28337
  __webpack_require__(572),
28338
  __webpack_require__(280),
28339
  __webpack_require__(275),
28340
  __webpack_require__(276)
28341
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, Backbone, Marionette, _, jQuery, MailPoet) { // eslint-disable-line func-names
 
 
28342
  var Module = {};
28343
 
28344
  Module.HeadingView = Marionette.View.extend({
28345
+ getTemplate: function () { return window.templates.heading; }, // eslint-disable-line func-names
28346
+ templateContext: function () { // eslint-disable-line func-names
28347
  return {
28348
  model: this.model.toJSON()
28349
  };
28350
  },
28351
+ events: function () { // eslint-disable-line func-names
28352
  return {
28353
  'keyup .mailpoet_input_title': _.partial(this.changeField, 'subject'),
28354
  'keyup .mailpoet_input_preheader': _.partial(this.changeField, 'preheader')
28355
  };
28356
  },
28357
+ changeField: function (field, event) { // eslint-disable-line func-names
28358
  this.model.set(field, jQuery(event.target).val());
28359
  }
28360
  });
28361
 
28362
+ App.on('start', function (StartApp) { // eslint-disable-line func-names
28363
  StartApp._appView.showChildView('headingRegion', new Module.HeadingView({ model: StartApp.getNewsletter() }));
28364
  MailPoet.helpTooltip.show(document.getElementById('tooltip-designer-subject-line'), {
28365
  tooltipId: 'tooltip-designer-subject-line-ti',
28381
  /***/ 591:
28382
  /***/ function(module, exports, __webpack_require__) {
28383
 
28384
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
28385
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28386
  __webpack_require__(584),
28387
  __webpack_require__(588),
28388
  __webpack_require__(276),
33315
  */
33316
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33317
  __webpack_require__(572)
33318
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (BackboneMarionette) { // eslint-disable-line func-names
33319
  var Marionette = BackboneMarionette;
33320
  var BehaviorsLookup = {};
33321
+ Marionette.Behaviors.behaviorsLookup = function () { // eslint-disable-line func-names
33322
  return BehaviorsLookup;
33323
  };
33324
 
33343
  __webpack_require__(594),
33344
  __webpack_require__(276),
33345
  __webpack_require__(576)
33346
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup, MailPoet) { // eslint-disable-line func-names
33347
  var BL = BehaviorsLookup;
33348
 
33349
  BL.ColorPickerBehavior = Marionette.Behavior.extend({
33350
+ onRender: function () { // eslint-disable-line func-names
33351
  var that = this;
33352
  var preferredFormat = 'hex6';
33353
+ this.view.$('.mailpoet_color').each(function () { // eslint-disable-line func-names
33354
  var $input = that.view.$(this);
33355
+ var updateColorInput = function (color) { // eslint-disable-line func-names
33356
  if (color && color.getAlpha() > 0) {
33357
  $input.val(color.toString(preferredFormat));
33358
  } else {
33387
  /***/ 596:
33388
  /***/ function(module, exports, __webpack_require__) {
33389
 
33390
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
33391
  /**
33392
  * ContainerDropZoneBehavior
33393
  *
33864
  __webpack_require__(275),
33865
  __webpack_require__(594),
33866
  __webpack_require__(575)
33867
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, jQuery, BehaviorsLookup, interact) { // eslint-disable-line func-names
33868
  var BL = BehaviorsLookup;
33869
 
33870
  BL.DraggableBehavior = Marionette.Behavior.extend({
33878
  *
33879
  * @return Backbone.Model A model that will be passed to the receiver
33880
  */
33881
+ getDropModel: function () { // eslint-disable-line func-names
33882
  throw "Missing 'drop' function for DraggableBehavior";
33883
  },
33884
 
33885
+ onDrop: function () {}, // eslint-disable-line func-names
33886
+ testAttachToInstance: function () { return true; } // eslint-disable-line func-names
33887
  },
33888
+ onRender: function () { // eslint-disable-line func-names
33889
  var that = this;
33890
  var interactable;
33891
 
33901
  // Scroll when dragging near edges of a window
33902
  autoScroll: true,
33903
 
33904
+ onstart: function (startEvent) { // eslint-disable-line func-names
33905
  var event = startEvent;
33906
  var centerXOffset;
33907
  var centerYOffset;
33940
  }
33941
  },
33942
  // call this function on every dragmove event
33943
+ onmove: function (event) { // eslint-disable-line func-names
33944
  var target = event.target;
33945
  // keep the dragged position in the data-x/data-y attributes
33946
  var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
33954
  target.setAttribute('data-x', x);
33955
  target.setAttribute('data-y', y);
33956
  },
33957
+ onend: function (event) { // eslint-disable-line func-names
33958
  var target = event.target;
33959
  target.style.transform = '';
33960
  target.style.webkitTransform = target.style.transform;
33973
  })
33974
  .preventDefault('auto')
33975
  .styleCursor(false)
33976
+ .actionChecker(function (pointer, event, action) { // eslint-disable-line func-names
33977
  // Disable dragging with right click
33978
  if (event.button !== 0) {
33979
  return null;
33987
  } else {
33988
  interactable.getDropModel = this.view.getDropFunc();
33989
  }
33990
+ interactable.onDrop = function (opts) { // eslint-disable-line func-names
33991
  var options = opts;
33992
  if (_.isObject(options)) {
33993
  // Inject Draggable behavior if possible
34014
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34015
  __webpack_require__(572),
34016
  __webpack_require__(594)
34017
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
34018
  var BL = BehaviorsLookup;
34019
 
34020
  BL.HighlightContainerBehavior = Marionette.Behavior.extend({
34022
  'mouseenter @ui.tools': 'enableHighlight',
34023
  'mouseleave @ui.tools': 'disableHighlight'
34024
  },
34025
+ enableHighlight: function () { // eslint-disable-line func-names
34026
  this.$el.addClass('mailpoet_highlight');
34027
  },
34028
+ disableHighlight: function () { // eslint-disable-line func-names
34029
  if (!this.view._isBeingEdited) {
34030
  this.$el.removeClass('mailpoet_highlight');
34031
  }
34047
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34048
  __webpack_require__(572),
34049
  __webpack_require__(594)
34050
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
34051
  var BL = BehaviorsLookup;
34052
 
34053
  BL.HighlightEditingBehavior = Marionette.Behavior.extend({
34055
  startEditing: 'enableHighlight',
34056
  stopEditing: 'disableHighlight'
34057
  },
34058
+ enableHighlight: function () { // eslint-disable-line func-names
34059
  this.view._isBeingEdited = true;
34060
  this.$el.addClass('mailpoet_highlight');
34061
  },
34062
+ disableHighlight: function () { // eslint-disable-line func-names
34063
  this.view._isBeingEdited = false;
34064
  this.$el.removeClass('mailpoet_highlight');
34065
  }
34081
  __webpack_require__(572),
34082
  __webpack_require__(594),
34083
  __webpack_require__(575)
34084
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, BehaviorsLookup, interact) { // eslint-disable-line func-names
34085
  var BL = BehaviorsLookup;
34086
 
34087
  BL.ResizableBehavior = Marionette.Behavior.extend({
34088
  defaults: {
34089
  elementSelector: null,
34090
  resizeHandleSelector: true, // true will use edges of the element itself
34091
+ transformationFunction: function transformationFunction(y) { return y; }, // for blocks that use the default onResize function
34092
  minLength: 0,
34093
  maxLength: Infinity,
34094
  modelField: 'styles.block.height',
34095
+ onResize: function (event) { // eslint-disable-line func-names
34096
  var currentLength = parseFloat(this.view.model.get(this.options.modelField));
34097
  var newLength = currentLength + this.options.transformationFunction(event.dy);
34098
  newLength = Math.min(this.options.maxLength, Math.max(this.options.minLength, newLength));
34103
  mouseenter: 'showResizeHandle',
34104
  mouseleave: 'hideResizeHandle'
34105
  },
34106
+ onRender: function () { // eslint-disable-line func-names
34107
  this.attachResize();
34108
 
34109
  if (this.isBeingResized !== true) {
34110
  this.hideResizeHandle();
34111
  }
34112
  },
34113
+ attachResize: function () { // eslint-disable-line func-names
34114
  var domElement = (this.options.elementSelector === null) ? this.view.$el.get(0) : this.view.$(this.options.elementSelector).get(0);
34115
  var that = this;
34116
  interact(domElement).resizable({
34122
  bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
34123
  }
34124
  })
34125
+ .on('resizestart', function () { // eslint-disable-line func-names
34126
  that.isBeingResized = true;
34127
  that.$el.addClass('mailpoet_resize_active');
34128
+ }).on('resizemove', function (event) { // eslint-disable-line func-names
34129
  var onResize = that.options.onResize.bind(that);
34130
  return onResize(event);
34131
  })
34132
+ .on('resizeend', function () { // eslint-disable-line func-names
34133
  that.isBeingResized = null;
34134
  that.$el.removeClass('mailpoet_resize_active');
34135
  });
34136
  },
34137
+ showResizeHandle: function () { // eslint-disable-line func-names
34138
  if (typeof this.options.resizeHandleSelector === 'string') {
34139
  this.view.$(this.options.resizeHandleSelector).removeClass('mailpoet_hidden');
34140
  }
34141
  },
34142
+ hideResizeHandle: function () { // eslint-disable-line func-names
34143
  if (typeof this.options.resizeHandleSelector === 'string') {
34144
  this.view.$(this.options.resizeHandleSelector).addClass('mailpoet_hidden');
34145
  }
34162
  __webpack_require__(572),
34163
  __webpack_require__(280),
34164
  __webpack_require__(594)
34165
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, BehaviorsLookup) { // eslint-disable-line func-names
34166
  var BL = BehaviorsLookup;
34167
 
34168
  BL.SortableBehavior = Marionette.Behavior.extend({
34169
+ onRender: function () { // eslint-disable-line func-names
34170
  var collection = this.view.collection;
34171
 
34172
  if (_.isFunction(this.$el.sortable)) {
34173
  this.$el.sortable({
34174
  cursor: 'move',
34175
+ start: function (event, ui) { // eslint-disable-line func-names
34176
  ui.item.data('previousIndex', ui.item.index());
34177
  },
34178
+ end: function (event, ui) { // eslint-disable-line func-names
34179
  ui.item.removeData('previousIndex');
34180
  },
34181
+ update: function (event, ui) { // eslint-disable-line func-names
34182
  var previousIndex = ui.item.data('previousIndex');
34183
  var newIndex = ui.item.index();
34184
  var model = collection.at(previousIndex);
34210
  __webpack_require__(572),
34211
  __webpack_require__(275),
34212
  __webpack_require__(594)
34213
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, jQuery, BehaviorsLookup) { // eslint-disable-line func-names
34214
  var BL = BehaviorsLookup;
34215
 
34216
  BL.ShowSettingsBehavior = Marionette.Behavior.extend({
34220
  events: {
34221
  'click .mailpoet_content': 'showSettings'
34222
  },
34223
+ showSettings: function (event) { // eslint-disable-line func-names
34224
  if (!this.isIgnoredElement(event.target)) {
34225
  this.view.triggerMethod('showSettings');
34226
  }
34227
  },
34228
+ isIgnoredElement: function (element) { // eslint-disable-line func-names
34229
  return this.options.ignoreFrom
34230
  && this.options.ignoreFrom.length > 0
34231
  && jQuery(element).is(this.options.ignoreFrom);
34249
  __webpack_require__(572),
34250
  __webpack_require__(280),
34251
  __webpack_require__(594)
34252
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (Marionette, _, BehaviorsLookup) { // eslint-disable-line func-names
34253
  var BL = BehaviorsLookup;
34254
 
34255
  BL.TextEditorBehavior = Marionette.Behavior.extend({
34261
  invalidElements: 'script',
34262
  blockFormats: 'Paragraph=p',
34263
  plugins: 'link textcolor colorpicker mailpoet_shortcodes',
34264
+ configurationFilter: function (originalConfig) { return originalConfig; } // eslint-disable-line func-names
34265
  },
34266
+ onDomRefresh: function () { // eslint-disable-line func-names
34267
  var that = this;
34268
  if (this.view.disableTextEditor === true) {
34269
  return;
34284
  relative_urls: false,
34285
  remove_script_host: false,
34286
  convert_urls: true,
34287
+ urlconverter_callback: function (url) { // eslint-disable-line func-names
34288
  if (url.match(/\[.+\]/g)) {
34289
  // Do not convert URLs with shortcodes
34290
  return url;
34298
 
34299
  plugins: this.options.plugins,
34300
 
34301
+ setup: function (editor) { // eslint-disable-line func-names
34302
+ editor.on('change', function () { // eslint-disable-line func-names
34303
  that.view.triggerMethod('text:editor:change', editor.getContent());
34304
  });
34305
 
34306
+ editor.on('click', function (e) { // eslint-disable-line func-names
34307
  editor.focus();
34308
  if (that._isActivationClick) {
34309
  editor.selection.setRng(
34313
  }
34314
  });
34315
 
34316
+ editor.on('focus', function () { // eslint-disable-line func-names
34317
  that.view.triggerMethod('text:editor:focus');
34318
  that._isActivationClick = true;
34319
  });
34320
 
34321
+ editor.on('blur', function () { // eslint-disable-line func-names
34322
  that.view.triggerMethod('text:editor:blur');
34323
  });
34324
  }
34333
  /***/ 604:
34334
  /***/ function(module, exports, __webpack_require__) {
34335
 
34336
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
34337
+ /**
34338
  * Defines base classes for actual content blocks to extend.
34339
  * Extending content block modules need to at least extend
34340
  * a BlockModel and a BlockView.
34660
  /***/ 605:
34661
  /***/ function(module, exports, __webpack_require__) {
34662
 
34663
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
34664
+ /**
34665
  * Container content block.
34666
  * This is a special kind of block, as it can contain content blocks, as well
34667
  * as other containers.
35033
  /***/ 606:
35034
  /***/ function(module, exports, __webpack_require__) {
35035
 
35036
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
35037
+ /**
35038
  * Button content block
35039
  */
35040
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35189
  /***/ 607:
35190
  /***/ function(module, exports, __webpack_require__) {
35191
 
35192
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
35193
+ /**
35194
  * Image content block
35195
  */
35196
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35626
  /***/ 608:
35627
  /***/ function(module, exports, __webpack_require__) {
35628
 
35629
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35630
+
35631
+ /**
35632
  * Divider content block
35633
  */
35634
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35636
  __webpack_require__(604),
35637
  __webpack_require__(280),
35638
  __webpack_require__(275)
35639
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, jQuery) { // eslint-disable-line func-names
 
 
35640
  var Module = {};
35641
  var base = BaseBlock;
35642
 
35643
  Module.DividerBlockModel = base.BlockModel.extend({
35644
+ defaults: function () { // eslint-disable-line func-names
35645
  return this._getDefaults({
35646
  type: 'divider',
35647
  styles: {
35659
 
35660
  Module.DividerBlockView = base.BlockView.extend({
35661
  className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
35662
+ getTemplate: function () { return window.templates.dividerBlock; }, // eslint-disable-line func-names
35663
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35664
  behaviors: _.defaults({
35665
  ResizableBehavior: {
35666
  elementSelector: '.mailpoet_content',
35667
  resizeHandleSelector: '.mailpoet_resize_handle',
35668
+ transformationFunction: function (y) { return y / 2; }, // eslint-disable-line func-names
35669
  minLength: 0, // TODO: Move this number to editor configuration
35670
  modelField: 'styles.block.padding'
35671
  },
35673
  ignoreFrom: '.mailpoet_resize_handle'
35674
  }
35675
  }, base.BlockView.prototype.behaviors),
35676
+ onDragSubstituteBy: function () { return Module.DividerWidgetView; }, // eslint-disable-line func-names
35677
+ initialize: function () { // eslint-disable-line func-names
35678
  var that = this;
35679
  base.BlockView.prototype.initialize.apply(this, arguments);
35680
 
35681
  // Listen for attempts to change all dividers in one go
35682
+ this._replaceDividerHandler = function (data) { that.model.set(data); that.model.trigger('applyToAll'); }; // eslint-disable-line func-names
35683
  App.getChannel().on('replaceAllDividers', this._replaceDividerHandler);
35684
 
35685
  this.listenTo(this.model, 'change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll', this.render);
35686
  this.listenTo(this.model, 'change:styles.block.padding', this.changePadding);
35687
  },
35688
+ templateContext: function () { // eslint-disable-line func-names
35689
  return _.extend({
35690
  totalHeight: parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
35691
  }, base.BlockView.prototype.templateContext.apply(this));
35692
  },
35693
+ onRender: function () { // eslint-disable-line func-names
35694
  this.toolsView = new Module.DividerBlockToolsView({ model: this.model });
35695
  this.showChildView('toolsRegion', this.toolsView);
35696
  },
35697
+ onBeforeDestroy: function () { // eslint-disable-line func-names
35698
  App.getChannel().off('replaceAllDividers', this._replaceDividerHandler);
35699
  this.stopListening(this.model);
35700
  },
35701
+ changePadding: function () { // eslint-disable-line func-names
35702
  this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
35703
  this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
35704
  this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
35706
  });
35707
 
35708
  Module.DividerBlockToolsView = base.BlockToolsView.extend({
35709
+ getSettingsView: function () { return Module.DividerBlockSettingsView; } // eslint-disable-line func-names
35710
  });
35711
 
35712
  Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
35713
+ getTemplate: function () { return window.templates.dividerBlockSettings; }, // eslint-disable-line func-names
35714
+ events: function () { // eslint-disable-line func-names
35715
  return {
35716
  'click .mailpoet_field_divider_style': 'changeStyle',
35717
 
35725
  'click .mailpoet_done_editing': 'close'
35726
  };
35727
  },
35728
+ modelEvents: function () { // eslint-disable-line func-names
35729
  return {
35730
  'change:styles.block.borderColor': 'repaintDividerStyleOptions'
35731
  };
35732
  },
35733
+ templateContext: function () { // eslint-disable-line func-names
35734
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
35735
  availableStyles: App.getAvailableStyles().toJSON(),
35736
  renderOptions: this.renderOptions
35737
  });
35738
  },
35739
+ changeStyle: function (event) { // eslint-disable-line func-names
35740
  var style = jQuery(event.currentTarget).data('style');
35741
  this.model.set('styles.block.borderStyle', style);
35742
  this.$('.mailpoet_field_divider_style').removeClass('mailpoet_active_divider_style');
35743
  this.$('.mailpoet_field_divider_style[data-style="' + style + '"]').addClass('mailpoet_active_divider_style');
35744
  },
35745
+ repaintDividerStyleOptions: function () { // eslint-disable-line func-names
35746
  this.$('.mailpoet_field_divider_style > div').css('border-top-color', this.model.get('styles.block.borderColor'));
35747
  },
35748
+ applyToAll: function () { // eslint-disable-line func-names
35749
  App.getChannel().trigger('replaceAllDividers', this.model.toJSON());
35750
  },
35751
+ updateValueAndCall: function (fieldToUpdate, callable, event) { // eslint-disable-line func-names
35752
  this.$(fieldToUpdate).val(jQuery(event.target).val());
35753
  callable(event);
35754
  }
35755
  });
35756
 
35757
  Module.DividerWidgetView = base.WidgetView.extend({
35758
+ getTemplate: function () { return window.templates.dividerInsertion; }, // eslint-disable-line func-names
35759
  behaviors: {
35760
  DraggableBehavior: {
35761
  cloneOriginal: true,
35762
+ drop: function () { // eslint-disable-line func-names
35763
  return new Module.DividerBlockModel();
35764
  }
35765
  }
35766
  }
35767
  });
35768
+ App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
35769
  BeforeStartApp.registerBlockType('divider', {
35770
  blockModel: Module.DividerBlockModel,
35771
  blockView: Module.DividerBlockView
35787
  /***/ 609:
35788
  /***/ function(module, exports, __webpack_require__) {
35789
 
35790
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35791
+
35792
+ /**
35793
  * Text content block
35794
  */
35795
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35797
  __webpack_require__(604),
35798
  __webpack_require__(280),
35799
  __webpack_require__(276)
35800
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
 
 
35801
  var Module = {};
35802
  var base = BaseBlock;
35803
 
35804
  Module.TextBlockModel = base.BlockModel.extend({
35805
+ defaults: function () { // eslint-disable-line func-names
35806
  return this._getDefaults({
35807
  type: 'text',
35808
  text: 'Edit this to insert text'
35812
 
35813
  Module.TextBlockView = base.BlockView.extend({
35814
  className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
35815
+ getTemplate: function () { return window.templates.textBlock; }, // eslint-disable-line func-names
35816
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
35817
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
35818
  TextEditorBehavior: {
35822
  invalidElements: 'script',
35823
  blockFormats: 'Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p',
35824
  plugins: 'link lists code textcolor colorpicker mailpoet_shortcodes paste',
35825
+ configurationFilter: function (originalSettings) { // eslint-disable-line func-names
35826
  return _.extend({}, originalSettings, {
35827
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
35828
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
35830
  }
35831
  }
35832
  }),
35833
+ initialize: function (options) { // eslint-disable-line func-names
35834
  base.BlockView.prototype.initialize.apply(this, arguments);
35835
 
35836
  this.renderOptions = _.defaults(options.renderOptions || {}, {
35839
 
35840
  this.disableTextEditor = this.renderOptions.disableTextEditor;
35841
  },
35842
+ onDragSubstituteBy: function () { return Module.TextWidgetView; }, // eslint-disable-line func-names
35843
+ onRender: function () { // eslint-disable-line func-names
35844
  this.toolsView = new Module.TextBlockToolsView({
35845
  model: this.model,
35846
  tools: {
35849
  });
35850
  this.showChildView('toolsRegion', this.toolsView);
35851
  },
35852
+ onTextEditorChange: function (newContent) { // eslint-disable-line func-names
35853
  this.model.set('text', newContent);
35854
  },
35855
+ onTextEditorFocus: function () { // eslint-disable-line func-names
35856
  this.disableDragging();
35857
  this.disableShowingTools();
35858
  },
35859
+ onTextEditorBlur: function () { // eslint-disable-line func-names
35860
  this.enableDragging();
35861
  this.enableShowingTools();
35862
  }
35863
  });
35864
 
35865
  Module.TextBlockToolsView = base.BlockToolsView.extend({
35866
+ getSettingsView: function () { return Module.TextBlockSettingsView; } // eslint-disable-line func-names
35867
  });
35868
 
35869
  Module.TextBlockSettingsView = base.BlockSettingsView.extend({
35870
+ getTemplate: function () { return window.templates.textBlockSettings; } // eslint-disable-line func-names
35871
  });
35872
 
35873
  Module.TextWidgetView = base.WidgetView.extend({
35874
+ getTemplate: function () { return window.templates.textInsertion; }, // eslint-disable-line func-names
35875
  behaviors: {
35876
  DraggableBehavior: {
35877
  cloneOriginal: true,
35878
+ drop: function () { // eslint-disable-line func-names
35879
  return new Module.TextBlockModel();
35880
  }
35881
  }
35882
  }
35883
  });
35884
 
35885
+ App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
35886
  BeforeStartApp.registerBlockType('text', {
35887
  blockModel: Module.TextBlockModel,
35888
  blockView: Module.TextBlockView
35905
  /***/ 610:
35906
  /***/ function(module, exports, __webpack_require__) {
35907
 
35908
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35909
+
35910
+ /**
35911
  * Spacer content block
35912
  */
35913
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35914
  __webpack_require__(584),
35915
  __webpack_require__(604),
35916
  __webpack_require__(280)
35917
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _) { // eslint-disable-line func-names
 
 
35918
  var Module = {};
35919
  var base = BaseBlock;
35920
 
35921
  Module.SpacerBlockModel = base.BlockModel.extend({
35922
+ defaults: function () { // eslint-disable-line func-names
35923
  return this._getDefaults({
35924
  type: 'spacer',
35925
  styles: {
35934
 
35935
  Module.SpacerBlockView = base.BlockView.extend({
35936
  className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
35937
+ getTemplate: function () { return window.templates.spacerBlock; }, // eslint-disable-line func-names
35938
  behaviors: _.defaults({
35939
  ResizableBehavior: {
35940
  elementSelector: '.mailpoet_spacer',
35947
  }
35948
  }, base.BlockView.prototype.behaviors),
35949
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35950
+ onDragSubstituteBy: function () { return Module.SpacerWidgetView; }, // eslint-disable-line func-names
35951
+ initialize: function () { // eslint-disable-line func-names
35952
  base.BlockView.prototype.initialize.apply(this, arguments);
35953
 
35954
  this.listenTo(this.model, 'change:styles.block.backgroundColor', this.render);
35955
  this.listenTo(this.model, 'change:styles.block.height', this.changeHeight);
35956
  },
35957
+ onRender: function () { // eslint-disable-line func-names
35958
  this.toolsView = new Module.SpacerBlockToolsView({ model: this.model });
35959
  this.showChildView('toolsRegion', this.toolsView);
35960
  },
35961
+ changeHeight: function () { // eslint-disable-line func-names
35962
  this.$('.mailpoet_spacer').css('height', this.model.get('styles.block.height'));
35963
  this.$('.mailpoet_resize_handle_text').text(this.model.get('styles.block.height'));
35964
  },
35965
+ onBeforeDestroy: function () { // eslint-disable-line func-names
35966
  this.stopListening(this.model);
35967
  }
35968
  });
35969
 
35970
  Module.SpacerBlockToolsView = base.BlockToolsView.extend({
35971
+ getSettingsView: function () { return Module.SpacerBlockSettingsView; } // eslint-disable-line func-names
35972
  });
35973
 
35974
  Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
35975
+ getTemplate: function () { return window.templates.spacerBlockSettings; }, // eslint-disable-line func-names
35976
+ events: function () { // eslint-disable-line func-names
35977
  return {
35978
  'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
35979
  'click .mailpoet_done_editing': 'close'
35982
  });
35983
 
35984
  Module.SpacerWidgetView = base.WidgetView.extend({
35985
+ getTemplate: function () { return window.templates.spacerInsertion; }, // eslint-disable-line func-names
35986
  behaviors: {
35987
  DraggableBehavior: {
35988
  cloneOriginal: true,
35989
+ drop: function () { // eslint-disable-line func-names
35990
  return new Module.SpacerBlockModel();
35991
  }
35992
  }
35993
  }
35994
  });
35995
 
35996
+ App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
35997
  BeforeStartApp.registerBlockType('spacer', {
35998
  blockModel: Module.SpacerBlockModel,
35999
  blockView: Module.SpacerBlockView
36015
  /***/ 611:
36016
  /***/ function(module, exports, __webpack_require__) {
36017
 
36018
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
36019
+
36020
+ /**
36021
  * Footer content block
36022
  */
36023
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36025
  __webpack_require__(604),
36026
  __webpack_require__(280),
36027
  __webpack_require__(276)
36028
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
 
 
36029
  var Module = {};
36030
  var base = BaseBlock;
36031
 
36032
  Module.FooterBlockModel = base.BlockModel.extend({
36033
+ defaults: function () { // eslint-disable-line func-names
36034
  return this._getDefaults({
36035
  type: 'footer',
36036
  text: '<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',
36055
 
36056
  Module.FooterBlockView = base.BlockView.extend({
36057
  className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
36058
+ getTemplate: function () { return window.templates.footerBlock; }, // eslint-disable-line func-names
36059
  modelEvents: _.extend({
36060
  'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
36061
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36062
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
36063
  TextEditorBehavior: {
36064
+ configurationFilter: function (originalSettings) { // eslint-disable-line func-names
36065
  return _.extend({}, originalSettings, {
36066
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
36067
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
36069
  }
36070
  }
36071
  }),
36072
+ onDragSubstituteBy: function () { return Module.FooterWidgetView; }, // eslint-disable-line func-names
36073
+ onRender: function () { // eslint-disable-line func-names
36074
  this.toolsView = new Module.FooterBlockToolsView({ model: this.model });
36075
  this.showChildView('toolsRegion', this.toolsView);
36076
  },
36077
+ onTextEditorChange: function (newContent) { // eslint-disable-line func-names
36078
  this.model.set('text', newContent);
36079
  },
36080
+ onTextEditorFocus: function () { // eslint-disable-line func-names
36081
  this.disableDragging();
36082
  this.disableShowingTools();
36083
  },
36084
+ onTextEditorBlur: function () { // eslint-disable-line func-names
36085
  this.enableDragging();
36086
  this.enableShowingTools();
36087
  }
36088
  });
36089
 
36090
  Module.FooterBlockToolsView = base.BlockToolsView.extend({
36091
+ getSettingsView: function () { return Module.FooterBlockSettingsView; } // eslint-disable-line func-names
36092
  });
36093
 
36094
  Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
36095
+ getTemplate: function () { return window.templates.footerBlockSettings; }, // eslint-disable-line func-names
36096
+ events: function () { // eslint-disable-line func-names
36097
  return {
36098
  'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36099
  'change .mailpoet_field_footer_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
36100
  'change .mailpoet_field_footer_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
36101
  'change #mailpoet_field_footer_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
36102
+ 'change #mailpoet_field_footer_link_underline': function (event) { // eslint-disable-line func-names
36103
  this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
36104
  },
36105
  'change .mailpoet_field_footer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
36107
  'click .mailpoet_done_editing': 'close'
36108
  };
36109
  },
36110
+ templateContext: function () { // eslint-disable-line func-names
36111
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
36112
  availableStyles: App.getAvailableStyles().toJSON()
36113
  });
36115
  });
36116
 
36117
  Module.FooterWidgetView = base.WidgetView.extend({
36118
+ getTemplate: function () { return window.templates.footerInsertion; }, // eslint-disable-line func-names
36119
  behaviors: {
36120
  DraggableBehavior: {
36121
  cloneOriginal: true,
36122
+ drop: function () { // eslint-disable-line func-names
36123
  return new Module.FooterBlockModel();
36124
  }
36125
  }
36126
  }
36127
  });
36128
 
36129
+ App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
36130
  BeforeStartApp.registerBlockType('footer', {
36131
  blockModel: Module.FooterBlockModel,
36132
  blockView: Module.FooterBlockView
36148
  /***/ 612:
36149
  /***/ function(module, exports, __webpack_require__) {
36150
 
36151
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
36152
+
36153
+ /**
36154
  * Header content block
36155
  */
36156
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36158
  __webpack_require__(604),
36159
  __webpack_require__(280),
36160
  __webpack_require__(276)
36161
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
 
 
36162
  var Module = {};
36163
  var base = BaseBlock;
36164
 
36165
  Module.HeaderBlockModel = base.BlockModel.extend({
36166
+ defaults: function () { // eslint-disable-line func-names
36167
  return this._getDefaults({
36168
  type: 'header',
36169
  text: 'Display problems? <a href="[link:newsletter_view_in_browser_url]">View it in your browser</a>',
36188
 
36189
  Module.HeaderBlockView = base.BlockView.extend({
36190
  className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
36191
+ getTemplate: function () { return window.templates.headerBlock; }, // eslint-disable-line func-names
36192
  modelEvents: _.extend({
36193
  'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
36194
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36195
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
36196
  TextEditorBehavior: {
36197
+ configurationFilter: function (originalSettings) { // eslint-disable-line func-names
36198
  return _.extend({}, originalSettings, {
36199
  mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
36200
  mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
36202
  }
36203
  }
36204
  }),
36205
+ onDragSubstituteBy: function () { return Module.HeaderWidgetView; }, // eslint-disable-line func-names
36206
+ onRender: function () { // eslint-disable-line func-names
36207
  this.toolsView = new Module.HeaderBlockToolsView({ model: this.model });
36208
  this.showChildView('toolsRegion', this.toolsView);
36209
  },
36210
+ onTextEditorChange: function (newContent) { // eslint-disable-line func-names
36211
  this.model.set('text', newContent);
36212
  },
36213
+ onTextEditorFocus: function () { // eslint-disable-line func-names
36214
  this.disableDragging();
36215
  this.disableShowingTools();
36216
  },
36217
+ onTextEditorBlur: function () { // eslint-disable-line func-names
36218
  this.enableDragging();
36219
  this.enableShowingTools();
36220
  }
36221
  });
36222
 
36223
  Module.HeaderBlockToolsView = base.BlockToolsView.extend({
36224
+ getSettingsView: function () { return Module.HeaderBlockSettingsView; } // eslint-disable-line func-names
36225
  });
36226
 
36227
  Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
36228
+ getTemplate: function () { return window.templates.headerBlockSettings; }, // eslint-disable-line func-names
36229
+ events: function () { // eslint-disable-line func-names
36230
  return {
36231
  'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36232
  'change .mailpoet_field_header_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
36233
  'change .mailpoet_field_header_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
36234
  'change #mailpoet_field_header_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
36235
+ 'change #mailpoet_field_header_link_underline': function (event) { // eslint-disable-line func-names
36236
  this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
36237
  },
36238
  'change .mailpoet_field_header_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
36240
  'click .mailpoet_done_editing': 'close'
36241
  };
36242
  },
36243
+ templateContext: function () { // eslint-disable-line func-names
36244
  return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
36245
  availableStyles: App.getAvailableStyles().toJSON()
36246
  });
36248
  });
36249
 
36250
  Module.HeaderWidgetView = base.WidgetView.extend({
36251
+ getTemplate: function () { return window.templates.headerInsertion; }, // eslint-disable-line func-names
36252
  behaviors: {
36253
  DraggableBehavior: {
36254
  cloneOriginal: true,
36255
+ drop: function () { // eslint-disable-line func-names
36256
  return new Module.HeaderBlockModel();
36257
  }
36258
  }
36259
  }
36260
  });
36261
 
36262
+ App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
36263
  BeforeStartApp.registerBlockType('header', {
36264
  blockModel: Module.HeaderBlockModel,
36265
  blockView: Module.HeaderBlockView
36281
  /***/ 613:
36282
  /***/ function(module, exports, __webpack_require__) {
36283
 
36284
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
36285
+ /**
36286
  * Automated latest content block.
36287
  * Only query parameters can be modified by the user. Posts pulled by this
36288
  * block will change as more posts get published.
36691
  /***/ 614:
36692
  /***/ function(module, exports, __webpack_require__) {
36693
 
36694
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
36695
+ /**
36696
  * Posts block.
36697
  *
36698
  * This block works slightly differently compared to any other block.
37298
  /***/ 615:
37299
  /***/ function(module, exports, __webpack_require__) {
37300
 
37301
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
37302
+ /**
37303
  * Social icons content block
37304
  */
37305
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
assets/js/{public.3d1d91ad.js → public.d12800d0.js} RENAMED
@@ -56,7 +56,7 @@
56
  /* 1 */
57
  /***/ function(module, exports, __webpack_require__) {
58
 
59
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
60
  // A placeholder for MailPoet object
61
  var MailPoet = {};
62
 
@@ -73,7 +73,7 @@
73
 
74
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
75
  __webpack_require__(1)
76
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
77
  mp
78
  ) {
79
  'use strict';
@@ -83,13 +83,13 @@
83
  var translations = {};
84
 
85
  MailPoet.I18n = {
86
- add: function (key, value) {
87
  translations[key] = value;
88
  },
89
- t: function (key) {
90
  return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
91
  },
92
- all: function () {
93
  return translations;
94
  }
95
  };
@@ -113,7 +113,7 @@
113
  };
114
  }
115
 
116
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp, jQuery, _) {
117
  var MailPoet = mp;
118
 
119
  MailPoet.Ajax = {
@@ -127,10 +127,10 @@
127
  token: null,
128
  data: {}
129
  },
130
- post: function (options) {
131
  return this.request('post', options);
132
  },
133
- init: function (options) {
134
  // merge options
135
  this.options = jQuery.extend({}, this.defaults, options);
136
 
@@ -144,7 +144,7 @@
144
  this.options.token = window.mailpoet_token;
145
  }
146
  },
147
- getParams: function () {
148
  return {
149
  action: 'mailpoet',
150
  api_version: this.options.api_version,
@@ -154,7 +154,7 @@
154
  data: this.options.data || {}
155
  };
156
  },
157
- request: function (method, options) {
158
  var params;
159
  var deferred;
160
  // set options
@@ -165,7 +165,7 @@
165
 
166
  // remove null values from the data object
167
  if (_.isObject(params.data)) {
168
- params.data = _.pick(params.data, function (value) {
169
  return (value !== null);
170
  });
171
  }
@@ -176,7 +176,7 @@
176
  params,
177
  null,
178
  'json'
179
- ).then(function (data) {
180
  return data;
181
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
182
 
@@ -1760,13 +1760,13 @@
1760
  /* 7 */
1761
  /***/ function(module, exports, __webpack_require__) {
1762
 
1763
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function (mp) {
1764
  'use strict';
1765
 
1766
  var MailPoet = mp;
1767
  MailPoet.Iframe = {
1768
  marginY: 20,
1769
- autoSize: function (iframe) {
1770
  if (!iframe) return;
1771
 
1772
  this.setSize(
@@ -1774,7 +1774,7 @@
1774
  iframe.contentWindow.document.body.scrollHeight
1775
  );
1776
  },
1777
- setSize: function (sizeIframe, i) {
1778
  var iframe = sizeIframe;
1779
  if (!iframe) return;
1780
 
@@ -1794,7 +1794,7 @@
1794
 
1795
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
1796
  __webpack_require__(4)
1797
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
1798
  jQuery
1799
  ) {
1800
  var $ = jQuery;
@@ -1815,12 +1815,12 @@
1815
  * Dual licensed under the MIT and GPL licenses.
1816
  * http://benalman.com/about/license/
1817
  */
1818
- $.fn.mailpoetSerializeObject = function (coerce) {
1819
  var obj = {};
1820
  var coerceTypes = { true: !0, false: !1, null: null };
1821
 
1822
  // Iterate over all name=value pairs.
1823
- $.each(this.serializeArray(), function (j, v) {
1824
  var key = v.name;
1825
  var val = v.value;
1826
  var cur = obj;
@@ -1905,23 +1905,23 @@
1905
  __webpack_require__(1),
1906
  __webpack_require__(4),
1907
  __webpack_require__(10)
1908
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
1909
  MailPoet,
1910
  jQuery
1911
  ) {
1912
- jQuery(function ($) {
1913
  function isSameDomain(url) {
1914
  var link = document.createElement('a');
1915
  link.href = url;
1916
  return (window.location.hostname === link.hostname);
1917
  }
1918
 
1919
- $(function () {
1920
  // setup form validation
1921
- $('form.mailpoet_form').each(function () {
1922
  var form = $(this);
1923
 
1924
- form.parsley().on('form:validated', function () {
1925
  // clear messages
1926
  form.find('.mailpoet_message > p').hide();
1927
 
@@ -1931,7 +1931,7 @@
1931
  }
1932
  });
1933
 
1934
- form.parsley().on('form:submit', function (parsley) {
1935
  var formData = form.mailpoetSerializeObject() || {};
1936
  // check if we're on the same domain
1937
  if (isSameDomain(window.MailPoetForm.ajax_url) === false) {
@@ -1946,13 +1946,13 @@
1946
  endpoint: 'subscribers',
1947
  action: 'subscribe',
1948
  data: formData.data
1949
- }).fail(function (response) {
1950
  form.find('.mailpoet_validate_error').html(
1951
- response.errors.map(function (error) {
1952
  return error.message;
1953
  }).join('<br />')
1954
  ).show();
1955
- }).done(function (response) {
1956
  // successfully subscribed
1957
  if (
1958
  response.meta !== undefined
@@ -1974,7 +1974,7 @@
1974
  if (
1975
  window.frameElement !== null
1976
  && MailPoet !== undefined
1977
- && MailPoet['Iframe']
1978
  ) {
1979
  MailPoet.Iframe.autoSize(window.frameElement);
1980
  }
56
  /* 1 */
57
  /***/ function(module, exports, __webpack_require__) {
58
 
59
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function mailpoet() {
60
  // A placeholder for MailPoet object
61
  var MailPoet = {};
62
 
73
 
74
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
75
  __webpack_require__(1)
76
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function i18n(
77
  mp
78
  ) {
79
  'use strict';
83
  var translations = {};
84
 
85
  MailPoet.I18n = {
86
+ add: function add(key, value) {
87
  translations[key] = value;
88
  },
89
+ t: function t(key) {
90
  return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
91
  },
92
+ all: function all() {
93
  return translations;
94
  }
95
  };
113
  };
114
  }
115
 
116
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_RESULT__ = function ajax(mp, jQuery, _) {
117
  var MailPoet = mp;
118
 
119
  MailPoet.Ajax = {
127
  token: null,
128
  data: {}
129
  },
130
+ post: function post(options) {
131
  return this.request('post', options);
132
  },
133
+ init: function init(options) {
134
  // merge options
135
  this.options = jQuery.extend({}, this.defaults, options);
136
 
144
  this.options.token = window.mailpoet_token;
145
  }
146
  },
147
+ getParams: function getParams() {
148
  return {
149
  action: 'mailpoet',
150
  api_version: this.options.api_version,
154
  data: this.options.data || {}
155
  };
156
  },
157
+ request: function request(method, options) {
158
  var params;
159
  var deferred;
160
  // set options
165
 
166
  // remove null values from the data object
167
  if (_.isObject(params.data)) {
168
+ params.data = _.pick(params.data, function isNotNull(value) {
169
  return (value !== null);
170
  });
171
  }
176
  params,
177
  null,
178
  'json'
179
+ ).then(function resultHandler(data) {
180
  return data;
181
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
182
 
1760
  /* 7 */
1761
  /***/ function(module, exports, __webpack_require__) {
1762
 
1763
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function iframeModule(mp) {
1764
  'use strict';
1765
 
1766
  var MailPoet = mp;
1767
  MailPoet.Iframe = {
1768
  marginY: 20,
1769
+ autoSize: function autoSize(iframe) {
1770
  if (!iframe) return;
1771
 
1772
  this.setSize(
1774
  iframe.contentWindow.document.body.scrollHeight
1775
  );
1776
  },
1777
+ setSize: function setSize(sizeIframe, i) {
1778
  var iframe = sizeIframe;
1779
  if (!iframe) return;
1780
 
1794
 
1795
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
1796
  __webpack_require__(4)
1797
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
1798
  jQuery
1799
  ) {
1800
  var $ = jQuery;
1815
  * Dual licensed under the MIT and GPL licenses.
1816
  * http://benalman.com/about/license/
1817
  */
1818
+ $.fn.mailpoetSerializeObject = function (coerce) { // eslint-disable-line func-names
1819
  var obj = {};
1820
  var coerceTypes = { true: !0, false: !1, null: null };
1821
 
1822
  // Iterate over all name=value pairs.
1823
+ $.each(this.serializeArray(), function (j, v) { // eslint-disable-line func-names
1824
  var key = v.name;
1825
  var val = v.value;
1826
  var cur = obj;
1905
  __webpack_require__(1),
1906
  __webpack_require__(4),
1907
  __webpack_require__(10)
1908
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
1909
  MailPoet,
1910
  jQuery
1911
  ) {
1912
+ jQuery(function ($) { // eslint-disable-line func-names
1913
  function isSameDomain(url) {
1914
  var link = document.createElement('a');
1915
  link.href = url;
1916
  return (window.location.hostname === link.hostname);
1917
  }
1918
 
1919
+ $(function () { // eslint-disable-line func-names
1920
  // setup form validation
1921
+ $('form.mailpoet_form').each(function () { // eslint-disable-line func-names
1922
  var form = $(this);
1923
 
1924
+ form.parsley().on('form:validated', function () { // eslint-disable-line func-names
1925
  // clear messages
1926
  form.find('.mailpoet_message > p').hide();
1927
 
1931
  }
1932
  });
1933
 
1934
+ form.parsley().on('form:submit', function (parsley) { // eslint-disable-line func-names
1935
  var formData = form.mailpoetSerializeObject() || {};
1936
  // check if we're on the same domain
1937
  if (isSameDomain(window.MailPoetForm.ajax_url) === false) {
1946
  endpoint: 'subscribers',
1947
  action: 'subscribe',
1948
  data: formData.data
1949
+ }).fail(function (response) { // eslint-disable-line func-names
1950
  form.find('.mailpoet_validate_error').html(
1951
+ response.errors.map(function (error) { // eslint-disable-line func-names
1952
  return error.message;
1953
  }).join('<br />')
1954
  ).show();
1955
+ }).done(function (response) { // eslint-disable-line func-names
1956
  // successfully subscribed
1957
  if (
1958
  response.meta !== undefined
1974
  if (
1975
  window.frameElement !== null
1976
  && MailPoet !== undefined
1977
+ && MailPoet.Iframe
1978
  ) {
1979
  MailPoet.Iframe.autoSize(window.frameElement);
1980
  }
assets/js/{vendor.367b3f22.js → vendor.ae69bbf6.js} RENAMED
@@ -76,7 +76,7 @@
76
  /******/ script.charset = 'utf-8';
77
  /******/ script.async = true;
78
 
79
- /******/ script.src = __webpack_require__.p + "" + ({"0":"admin","1":"admin_vendor","2":"form_editor","3":"mailpoet","4":"newsletter_editor"}[chunkId]||chunkId) + "." + {"0":"895871dd","1":"fe056ed3","2":"cc7529b3","3":"a5fa72ae","4":"963cbce1"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
@@ -109,7 +109,8 @@
109
  /***/ 616:
110
  /***/ function(module, exports, __webpack_require__) {
111
 
112
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(553)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Handlebars) {
 
113
  // Handlebars helpers
114
  Handlebars.registerHelper('concat', function () {
115
  var size = (arguments.length - 1);
76
  /******/ script.charset = 'utf-8';
77
  /******/ script.async = true;
78
 
79
+ /******/ script.src = __webpack_require__.p + "" + ({"0":"admin","1":"admin_vendor","2":"form_editor","3":"mailpoet","4":"newsletter_editor"}[chunkId]||chunkId) + "." + {"0":"76e45773","1":"fa88de45","2":"13982476","3":"a55b11ee","4":"1de7c9b5"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
109
  /***/ 616:
110
  /***/ function(module, exports, __webpack_require__) {
111
 
112
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
113
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(553)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Handlebars) {
114
  // Handlebars helpers
115
  Handlebars.registerHelper('concat', function () {
116
  var size = (arguments.length - 1);
lang/mailpoet-ca.mo CHANGED
Binary file
lang/mailpoet-da_DK.mo CHANGED
Binary file
lang/mailpoet-de_DE.mo CHANGED
Binary file
lang/mailpoet-en_GB.mo CHANGED
Binary file
lang/mailpoet-es_ES.mo CHANGED
Binary file
lang/mailpoet-fa_IR.mo CHANGED
Binary file
lang/mailpoet-fr_CA.mo CHANGED
Binary file
lang/mailpoet-fr_FR.mo CHANGED
Binary file
lang/mailpoet-it_IT.mo CHANGED
Binary file
lang/mailpoet-ja.mo CHANGED
Binary file
lang/mailpoet-nl_NL.mo CHANGED
Binary file
lang/mailpoet-pl_PL.mo CHANGED
Binary file
lang/mailpoet-pt_BR.mo CHANGED
Binary file
lang/mailpoet-pt_PT.mo CHANGED
Binary file
lang/mailpoet-ru_RU.mo CHANGED
Binary file
lang/mailpoet-sq.mo CHANGED
Binary file
lang/mailpoet-sv_SE.mo CHANGED
Binary file
lang/mailpoet-tr_TR.mo CHANGED
Binary file
lang/mailpoet.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
- "POT-Creation-Date: 2018-01-09 18:32:46+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -26,13 +26,6 @@ msgstr ""
26
  "X-Poedit-Bookmarks: \n"
27
  "X-Textdomain-Support: yes\n"
28
 
29
- #: Initializer.php:63 lib/Config/Initializer.php:46
30
- msgid ""
31
- "Unable to connect to the database (the database is unable to open a file or "
32
- "folder), the connection is likely not configured correctly. Please read our "
33
- "[link] Knowledge Base article [/link] for steps how to resolve it."
34
- msgstr ""
35
-
36
  #: lib/API/API.php:19
37
  msgid "Invalid API version."
38
  msgstr ""
@@ -306,6 +299,13 @@ msgstr ""
306
  msgid "MailPoet Newsletter"
307
  msgstr ""
308
 
 
 
 
 
 
 
 
309
  #: lib/Config/MP2Migrator.php:151
310
  msgid "Start import"
311
  msgstr ""
@@ -1073,11 +1073,11 @@ msgstr ""
1073
  msgid "Preview in a new tab"
1074
  msgstr ""
1075
 
1076
- #: lib/Cron/CronHelper.php:118
1077
  msgid "Site URL is unreachable."
1078
  msgstr ""
1079
 
1080
- #: lib/Cron/CronHelper.php:124
1081
  msgid "Maximum execution time has been reached."
1082
  msgstr ""
1083
 
@@ -1280,17 +1280,17 @@ msgstr ""
1280
  msgid "Sending frequency limit has been reached."
1281
  msgstr ""
1282
 
1283
- #: lib/Mailer/Methods/AmazonSES.php:35
1284
  msgid "Unsupported Amazon SES region"
1285
  msgstr ""
1286
 
1287
- #: lib/Mailer/Methods/AmazonSES.php:68 lib/Mailer/Methods/PHPMail.php:36
1288
- #: lib/Mailer/Methods/SMTP.php:120 lib/Mailer/Methods/SendGrid.php:32
1289
  msgid "%s has returned an unknown error."
1290
  msgstr ""
1291
 
1292
- #: lib/Mailer/Methods/AmazonSES.php:70 lib/Mailer/Methods/PHPMail.php:38
1293
- #: lib/Mailer/Methods/SMTP.php:123 lib/Mailer/Methods/SendGrid.php:34
1294
  msgid "Unprocessed subscriber"
1295
  msgstr ""
1296
 
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2018-01-16 14:15:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
26
  "X-Poedit-Bookmarks: \n"
27
  "X-Textdomain-Support: yes\n"
28
 
 
 
 
 
 
 
 
29
  #: lib/API/API.php:19
30
  msgid "Invalid API version."
31
  msgstr ""
299
  msgid "MailPoet Newsletter"
300
  msgstr ""
301
 
302
+ #: lib/Config/Initializer.php:46
303
+ msgid ""
304
+ "Unable to connect to the database (the database is unable to open a file or "
305
+ "folder), the connection is likely not configured correctly. Please read our "
306
+ "[link] Knowledge Base article [/link] for steps how to resolve it."
307
+ msgstr ""
308
+
309
  #: lib/Config/MP2Migrator.php:151
310
  msgid "Start import"
311
  msgstr ""
1073
  msgid "Preview in a new tab"
1074
  msgstr ""
1075
 
1076
+ #: lib/Cron/CronHelper.php:119
1077
  msgid "Site URL is unreachable."
1078
  msgstr ""
1079
 
1080
+ #: lib/Cron/CronHelper.php:125
1081
  msgid "Maximum execution time has been reached."
1082
  msgstr ""
1083
 
1280
  msgid "Sending frequency limit has been reached."
1281
  msgstr ""
1282
 
1283
+ #: lib/Mailer/Methods/AmazonSES.php:36
1284
  msgid "Unsupported Amazon SES region"
1285
  msgstr ""
1286
 
1287
+ #: lib/Mailer/Methods/AmazonSES.php:69 lib/Mailer/Methods/PHPMail.php:36
1288
+ #: lib/Mailer/Methods/SMTP.php:120 lib/Mailer/Methods/SendGrid.php:34
1289
  msgid "%s has returned an unknown error."
1290
  msgstr ""
1291
 
1292
+ #: lib/Mailer/Methods/AmazonSES.php:71 lib/Mailer/Methods/PHPMail.php:38
1293
+ #: lib/Mailer/Methods/SMTP.php:123 lib/Mailer/Methods/SendGrid.php:36
1294
  msgid "Unprocessed subscriber"
1295
  msgstr ""
1296
 
lib/Analytics/Reporter.php CHANGED
@@ -5,6 +5,7 @@ use MailPoet\Config\Installer;
5
  use MailPoet\Config\ServicesChecker;
6
  use MailPoet\Cron\CronTrigger;
7
  use MailPoet\Models\Newsletter;
 
8
  use MailPoet\Models\Setting;
9
  use MailPoet\Models\Subscriber;
10
  use MailPoet\Settings\Pages;
@@ -18,7 +19,7 @@ class Reporter {
18
  $isCronTriggerMethodWP = Setting::getValue('cron_trigger.method') === CronTrigger::$available_methods['wordpress'];
19
  $checker = new ServicesChecker();
20
  $bounceAddress = Setting::getValue('bounce.address');
21
-
22
 
23
  return array(
24
  'PHP version' => PHP_VERSION,
@@ -49,6 +50,8 @@ class Reporter {
49
  'Number of standard newsletters sent in last 3 months' => $newsletters['sent_newsletters'],
50
  'Number of active post notifications' => $newsletters['notifications_count'],
51
  'Number of active welcome emails' => $newsletters['welcome_newsletters_count'],
 
 
52
  'Plugin > MailPoet Premium' => is_plugin_active('mailpoet-premium/mailpoet-premium.php'),
53
  'Plugin > bounce add-on' => is_plugin_active('mailpoet-bounce-handler/mailpoet-bounce-handler.php'),
54
  'Plugin > Bloom' => is_plugin_active('bloom-for-publishers/bloom.php'),
5
  use MailPoet\Config\ServicesChecker;
6
  use MailPoet\Cron\CronTrigger;
7
  use MailPoet\Models\Newsletter;
8
+ use MailPoet\Models\Segment;
9
  use MailPoet\Models\Setting;
10
  use MailPoet\Models\Subscriber;
11
  use MailPoet\Settings\Pages;
19
  $isCronTriggerMethodWP = Setting::getValue('cron_trigger.method') === CronTrigger::$available_methods['wordpress'];
20
  $checker = new ServicesChecker();
21
  $bounceAddress = Setting::getValue('bounce.address');
22
+ $segmets = Segment::getAnalytics();
23
 
24
  return array(
25
  'PHP version' => PHP_VERSION,
50
  'Number of standard newsletters sent in last 3 months' => $newsletters['sent_newsletters'],
51
  'Number of active post notifications' => $newsletters['notifications_count'],
52
  'Number of active welcome emails' => $newsletters['welcome_newsletters_count'],
53
+ 'Number of segments' => $segmets['dynamic'],
54
+ 'Number of lists' => $segmets['default'],
55
  'Plugin > MailPoet Premium' => is_plugin_active('mailpoet-premium/mailpoet-premium.php'),
56
  'Plugin > bounce add-on' => is_plugin_active('mailpoet-bounce-handler/mailpoet-bounce-handler.php'),
57
  'Plugin > Bloom' => is_plugin_active('bloom-for-publishers/bloom.php'),
lib/Cron/CronHelper.php CHANGED
@@ -7,6 +7,7 @@ use MailPoet\Router\Endpoints\CronDaemon as CronDaemonEndpoint;
7
  use MailPoet\Router\Router;
8
  use MailPoet\Util\Security;
9
  use MailPoet\WP\Hooks as WPHooks;
 
10
 
11
  if(!defined('ABSPATH')) exit;
12
 
@@ -54,7 +55,7 @@ class CronHelper {
54
  );
55
  $result = self::queryCronUrl($url);
56
  if (is_wp_error($result)) return $result->get_error_message();
57
- $response = wp_remote_retrieve_body($result);
58
  return (!$validate_response) ?
59
  $response :
60
  $response === Daemon::PING_SUCCESS_RESPONSE;
@@ -67,7 +68,7 @@ class CronHelper {
67
  $data
68
  );
69
  $result = self::queryCronUrl($url);
70
- return wp_remote_retrieve_body($result);
71
  }
72
 
73
  static function queryCronUrl($url) {
@@ -80,7 +81,7 @@ class CronHelper {
80
  'user-agent' => 'MailPoet Cron'
81
  )
82
  );
83
- return wp_remote_get($url, $args);
84
  }
85
 
86
  static function getCronUrl($action, $data = false) {
7
  use MailPoet\Router\Router;
8
  use MailPoet\Util\Security;
9
  use MailPoet\WP\Hooks as WPHooks;
10
+ use MailPoet\WP\Functions as WPFunctions;
11
 
12
  if(!defined('ABSPATH')) exit;
13
 
55
  );
56
  $result = self::queryCronUrl($url);
57
  if (is_wp_error($result)) return $result->get_error_message();
58
+ $response = WPFunctions::wpRemoteRetrieveBody($result);
59
  return (!$validate_response) ?
60
  $response :
61
  $response === Daemon::PING_SUCCESS_RESPONSE;
68
  $data
69
  );
70
  $result = self::queryCronUrl($url);
71
+ return WPFunctions::wpRemoteRetrieveBody($result);
72
  }
73
 
74
  static function queryCronUrl($url) {
81
  'user-agent' => 'MailPoet Cron'
82
  )
83
  );
84
+ return WPFunctions::wpRemoteGet($url, $args);
85
  }
86
 
87
  static function getCronUrl($action, $data = false) {
lib/Cron/Workers/SendingQueue/SendingQueue.php CHANGED
@@ -6,11 +6,11 @@ use MailPoet\Cron\Workers\SendingQueue\Tasks\Links;
6
  use MailPoet\Cron\Workers\SendingQueue\Tasks\Mailer as MailerTask;
7
  use MailPoet\Cron\Workers\SendingQueue\Tasks\Newsletter as NewsletterTask;
8
  use MailPoet\Mailer\MailerLog;
9
- use MailPoet\Models\Newsletter as NewsletterModel;
10
  use MailPoet\Models\SendingQueue as SendingQueueModel;
11
  use MailPoet\Models\StatisticsNewsletters as StatisticsNewslettersModel;
12
  use MailPoet\Models\Subscriber as SubscriberModel;
13
  use MailPoet\Segments\SubscribersFinder;
 
14
 
15
  if(!defined('ABSPATH')) exit;
16
 
@@ -24,6 +24,7 @@ class SendingQueue {
24
  $this->mailer_task = ($mailer_task) ? $mailer_task : new MailerTask();
25
  $this->newsletter_task = ($newsletter_task) ? $newsletter_task : new NewsletterTask();
26
  $this->timer = ($timer) ? $timer : microtime(true);
 
27
  }
28
 
29
  function process() {
@@ -47,7 +48,7 @@ class SendingQueue {
47
  $queue->subscribers = $queue->getSubscribers();
48
  $subscriber_batches = array_chunk(
49
  $queue->subscribers['to_process'],
50
- self::BATCH_SIZE
51
  );
52
  foreach($subscriber_batches as $subscribers_to_process_ids) {
53
  if(!empty($newsletter_segments_ids[0])) {
@@ -199,4 +200,4 @@ class SendingQueue {
199
  ->whereNull('type')
200
  ->findMany();
201
  }
202
- }
6
  use MailPoet\Cron\Workers\SendingQueue\Tasks\Mailer as MailerTask;
7
  use MailPoet\Cron\Workers\SendingQueue\Tasks\Newsletter as NewsletterTask;
8
  use MailPoet\Mailer\MailerLog;
 
9
  use MailPoet\Models\SendingQueue as SendingQueueModel;
10
  use MailPoet\Models\StatisticsNewsletters as StatisticsNewslettersModel;
11
  use MailPoet\Models\Subscriber as SubscriberModel;
12
  use MailPoet\Segments\SubscribersFinder;
13
+ use MailPoet\WP\Hooks as WPHooks;
14
 
15
  if(!defined('ABSPATH')) exit;
16
 
24
  $this->mailer_task = ($mailer_task) ? $mailer_task : new MailerTask();
25
  $this->newsletter_task = ($newsletter_task) ? $newsletter_task : new NewsletterTask();
26
  $this->timer = ($timer) ? $timer : microtime(true);
27
+ $this->batch_size = WPHooks::applyFilters('mailpoet_cron_worker_sending_queue_batch_size', self::BATCH_SIZE);
28
  }
29
 
30
  function process() {
48
  $queue->subscribers = $queue->getSubscribers();
49
  $subscriber_batches = array_chunk(
50
  $queue->subscribers['to_process'],
51
+ $this->batch_size
52
  );
53
  foreach($subscriber_batches as $subscribers_to_process_ids) {
54
  if(!empty($newsletter_segments_ids[0])) {
200
  ->whereNull('type')
201
  ->findMany();
202
  }
203
+ }
lib/Mailer/Methods/AmazonSES.php CHANGED
@@ -2,6 +2,7 @@
2
  namespace MailPoet\Mailer\Methods;
3
 
4
  use MailPoet\Mailer\Mailer;
 
5
 
6
  if(!defined('ABSPATH')) exit;
7
 
@@ -51,7 +52,7 @@ class AmazonSES {
51
 
52
  function send($newsletter, $subscriber, $extra_params = array()) {
53
  try {
54
- $result = wp_remote_post(
55
  $this->url,
56
  $this->request($newsletter, $subscriber, $extra_params)
57
  );
@@ -61,8 +62,8 @@ class AmazonSES {
61
  if(is_wp_error($result)) {
62
  return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
63
  }
64
- if(wp_remote_retrieve_response_code($result) !== 200) {
65
- $response = simplexml_load_string(wp_remote_retrieve_body($result));
66
  $response = ($response) ?
67
  $response->Error->Message->__toString() :
68
  sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
2
  namespace MailPoet\Mailer\Methods;
3
 
4
  use MailPoet\Mailer\Mailer;
5
+ use MailPoet\WP\Functions as WPFunctions;
6
 
7
  if(!defined('ABSPATH')) exit;
8
 
52
 
53
  function send($newsletter, $subscriber, $extra_params = array()) {
54
  try {
55
+ $result = WPFunctions::wpRemotePost(
56
  $this->url,
57
  $this->request($newsletter, $subscriber, $extra_params)
58
  );
62
  if(is_wp_error($result)) {
63
  return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
64
  }
65
+ if(WPFunctions::wpRemoteRetrieveResponseCode($result) !== 200) {
66
+ $response = simplexml_load_string(WPFunctions::wpRemoteRetrieveBody($result));
67
  $response = ($response) ?
68
  $response->Error->Message->__toString() :
69
  sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
lib/Mailer/Methods/SendGrid.php CHANGED
@@ -1,7 +1,9 @@
1
  <?php
 
2
  namespace MailPoet\Mailer\Methods;
3
 
4
  use MailPoet\Mailer\Mailer;
 
5
 
6
  if(!defined('ABSPATH')) exit;
7
 
@@ -18,14 +20,14 @@ class SendGrid {
18
  }
19
 
20
  function send($newsletter, $subscriber, $extra_params = array()) {
21
- $result = wp_remote_post(
22
  $this->url,
23
  $this->request($newsletter, $subscriber, $extra_params)
24
  );
25
  if(is_wp_error($result)) {
26
  return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
27
  }
28
- if(wp_remote_retrieve_response_code($result) !== 200) {
29
  $response = json_decode($result['body'], true);
30
  $response = (!empty($response['errors'][0])) ?
31
  $response['errors'][0] :
1
  <?php
2
+
3
  namespace MailPoet\Mailer\Methods;
4
 
5
  use MailPoet\Mailer\Mailer;
6
+ use MailPoet\WP\Functions as WPFunctions;
7
 
8
  if(!defined('ABSPATH')) exit;
9
 
20
  }
21
 
22
  function send($newsletter, $subscriber, $extra_params = array()) {
23
+ $result = WPFunctions::wpRemotePost(
24
  $this->url,
25
  $this->request($newsletter, $subscriber, $extra_params)
26
  );
27
  if(is_wp_error($result)) {
28
  return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
29
  }
30
+ if(WPFunctions::wpRemoteRetrieveResponseCode($result) !== 200) {
31
  $response = json_decode($result['body'], true);
32
  $response = (!empty($response['errors'][0])) ?
33
  $response['errors'][0] :
lib/Models/Segment.php CHANGED
@@ -265,4 +265,11 @@ class Segment extends Model {
265
 
266
  return array('count' => $count);
267
  }
 
 
 
 
 
 
 
268
  }
265
 
266
  return array('count' => $count);
267
  }
268
+
269
+ static function getAnalytics() {
270
+ return Segment::select_expr('type, count(*) as count')
271
+ ->whereNull('deleted_at')
272
+ ->groupBy('type')
273
+ ->findArray();
274
+ }
275
  }
lib/Services/Bridge.php CHANGED
@@ -5,6 +5,7 @@ namespace MailPoet\Services;
5
  use MailPoet\Mailer\Mailer;
6
  use MailPoet\Models\Setting;
7
  use MailPoet\Models\Subscriber;
 
8
 
9
  if(!defined('ABSPATH')) exit;
10
 
@@ -55,8 +56,8 @@ class Bridge {
55
  'blocking' => true,
56
  'timeout' => 10
57
  );
58
- $result = wp_remote_get(self::BRIDGE_URL, $params);
59
- return wp_remote_retrieve_response_code($result) === 200;
60
  }
61
 
62
  function initApi($api_key) {
5
  use MailPoet\Mailer\Mailer;
6
  use MailPoet\Models\Setting;
7
  use MailPoet\Models\Subscriber;
8
+ use MailPoet\WP\Functions as WPFunctions;
9
 
10
  if(!defined('ABSPATH')) exit;
11
 
56
  'blocking' => true,
57
  'timeout' => 10
58
  );
59
+ $result = WPFunctions::wpRemoteGet(self::BRIDGE_URL, $params);
60
+ return WPFunctions::wpRemoteRetrieveResponseCode($result) === 200;
61
  }
62
 
63
  function initApi($api_key) {
lib/Services/Bridge/API.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace MailPoet\Services\Bridge;
4
 
 
 
 
5
  if(!defined('ABSPATH')) exit;
6
 
7
  class API {
@@ -9,6 +12,8 @@ class API {
9
  const SENDING_STATUS_CONNECTION_ERROR = 'connection_error';
10
  const SENDING_STATUS_SEND_ERROR = 'send_error';
11
 
 
 
12
  const RESPONSE_CODE_KEY_INVALID = 401;
13
  const RESPONSE_CODE_STATS_SAVED = 204;
14
 
@@ -30,10 +35,10 @@ class API {
30
  array('site' => home_url())
31
  );
32
 
33
- $code = wp_remote_retrieve_response_code($result);
34
  switch($code) {
35
  case 200:
36
- $body = json_decode(wp_remote_retrieve_body($result), true);
37
  break;
38
  default:
39
  $body = null;
@@ -49,10 +54,10 @@ class API {
49
  array('site' => home_url())
50
  );
51
 
52
- $code = wp_remote_retrieve_response_code($result);
53
  switch($code) {
54
  case 200:
55
- if($body = wp_remote_retrieve_body($result)) {
56
  $body = json_decode($body, true);
57
  }
58
  break;
@@ -76,11 +81,11 @@ class API {
76
  'message' => $result->get_error_message()
77
  );
78
  }
79
- $response_code = wp_remote_retrieve_response_code($result);
80
  if($response_code !== 201) {
81
- $response = (wp_remote_retrieve_body($result)) ?
82
- wp_remote_retrieve_body($result) :
83
- wp_remote_retrieve_response_message($result);
84
  return array(
85
  'status' => self::SENDING_STATUS_SEND_ERROR,
86
  'message' => $response,
@@ -95,8 +100,8 @@ class API {
95
  $this->url_bounces,
96
  $emails
97
  );
98
- if(wp_remote_retrieve_response_code($result) === 200) {
99
- return json_decode(wp_remote_retrieve_body($result), true);
100
  }
101
  return false;
102
  }
@@ -107,7 +112,7 @@ class API {
107
  array('subscriber_count' => (int)$count),
108
  'PUT'
109
  );
110
- return wp_remote_retrieve_response_code($result) === self::RESPONSE_CODE_STATS_SAVED;
111
  }
112
 
113
  function setKey($api_key) {
@@ -124,7 +129,7 @@ class API {
124
 
125
  private function request($url, $body, $method = 'POST') {
126
  $params = array(
127
- 'timeout' => 10,
128
  'httpversion' => '1.0',
129
  'method' => $method,
130
  'headers' => array(
@@ -133,6 +138,6 @@ class API {
133
  ),
134
  'body' => json_encode($body)
135
  );
136
- return wp_remote_post($url, $params);
137
  }
138
- }
2
 
3
  namespace MailPoet\Services\Bridge;
4
 
5
+ use MailPoet\WP\Hooks as WPHooks;
6
+ use MailPoet\WP\Functions as WPFunctions;
7
+
8
  if(!defined('ABSPATH')) exit;
9
 
10
  class API {
12
  const SENDING_STATUS_CONNECTION_ERROR = 'connection_error';
13
  const SENDING_STATUS_SEND_ERROR = 'send_error';
14
 
15
+ const REQUEST_TIMEOUT = 10; // seconds
16
+
17
  const RESPONSE_CODE_KEY_INVALID = 401;
18
  const RESPONSE_CODE_STATS_SAVED = 204;
19
 
35
  array('site' => home_url())
36
  );
37
 
38
+ $code = WPFunctions::wpRemoteRetrieveResponseCode($result);
39
  switch($code) {
40
  case 200:
41
+ $body = json_decode(WPFunctions::wpRemoteRetrieveBody($result), true);
42
  break;
43
  default:
44
  $body = null;
54
  array('site' => home_url())
55
  );
56
 
57
+ $code = WPFunctions::wpRemoteRetrieveResponseCode($result);
58
  switch($code) {
59
  case 200:
60
+ if($body = WPFunctions::wpRemoteRetrieveBody($result)) {
61
  $body = json_decode($body, true);
62
  }
63
  break;
81
  'message' => $result->get_error_message()
82
  );
83
  }
84
+ $response_code = WPFunctions::wpRemoteRetrieveResponseCode($result);
85
  if($response_code !== 201) {
86
+ $response = (WPFunctions::wpRemoteRetrieveBody($result)) ?
87
+ WPFunctions::wpRemoteRetrieveBody($result) :
88
+ WPFunctions::wpRemoteRetrieveResponseMessage($result);
89
  return array(
90
  'status' => self::SENDING_STATUS_SEND_ERROR,
91
  'message' => $response,
100
  $this->url_bounces,
101
  $emails
102
  );
103
+ if(WPFunctions::wpRemoteRetrieveResponseCode($result) === 200) {
104
+ return json_decode(WPFunctions::wpRemoteRetrieveBody($result), true);
105
  }
106
  return false;
107
  }
112
  array('subscriber_count' => (int)$count),
113
  'PUT'
114
  );
115
+ return WPFunctions::wpRemoteRetrieveResponseCode($result) === self::RESPONSE_CODE_STATS_SAVED;
116
  }
117
 
118
  function setKey($api_key) {
129
 
130
  private function request($url, $body, $method = 'POST') {
131
  $params = array(
132
+ 'timeout' => WPHooks::applyFilters('mailpoet_bridge_api_request_timeout', self::REQUEST_TIMEOUT),
133
  'httpversion' => '1.0',
134
  'method' => $method,
135
  'headers' => array(
138
  ),
139
  'body' => json_encode($body)
140
  );
141
+ return WPFunctions::wpRemotePost($url, $params);
142
  }
143
+ }
lib/Services/Release/API.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
 
2
  namespace MailPoet\Services\Release;
3
 
 
 
4
  if(!defined('ABSPATH')) exit;
5
 
6
  class API {
@@ -17,10 +20,10 @@ class API {
17
  $this->url_products . $plugin_name
18
  );
19
 
20
- $code = wp_remote_retrieve_response_code($result);
21
  switch($code) {
22
  case 200:
23
- if($body = wp_remote_retrieve_body($result)) {
24
  $body = json_decode($body);
25
  }
26
  break;
@@ -47,6 +50,6 @@ class API {
47
  'timeout' => 10,
48
  'httpversion' => '1.0'
49
  );
50
- return wp_remote_get($url, $args);
51
  }
52
  }
1
  <?php
2
+
3
  namespace MailPoet\Services\Release;
4
 
5
+ use MailPoet\WP\Functions as WPFunctions;
6
+
7
  if(!defined('ABSPATH')) exit;
8
 
9
  class API {
20
  $this->url_products . $plugin_name
21
  );
22
 
23
+ $code = WPFunctions::wpRemoteRetrieveResponseCode($result);
24
  switch($code) {
25
  case 200:
26
+ if($body = WPFunctions::wpRemoteRetrieveBody($result)) {
27
  $body = json_decode($body);
28
  }
29
  break;
50
  'timeout' => 10,
51
  'httpversion' => '1.0'
52
  );
53
+ return WPFunctions::wpRemoteGet($url, $args);
54
  }
55
  }
lib/WP/Functions.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\WP;
3
+
4
+ class Functions {
5
+ static function wpRemotePost() {
6
+ return self::callWithFallback('wp_remote_post', func_get_args());
7
+ }
8
+
9
+ static function wpRemoteGet() {
10
+ return self::callWithFallback('wp_remote_get', func_get_args());
11
+ }
12
+
13
+ static function wpRemoteRetrieveBody() {
14
+ return self::callWithFallback('wp_remote_retrieve_body', func_get_args());
15
+ }
16
+
17
+ static function wpRemoteRetrieveResponseCode() {
18
+ return self::callWithFallback('wp_remote_retrieve_response_code', func_get_args());
19
+ }
20
+
21
+ static function wpRemoteRetrieveResponseMessage() {
22
+ return self::callWithFallback('wp_remote_retrieve_response_message', func_get_args());
23
+ }
24
+
25
+ private static function callWithFallback($func, $args) {
26
+ $local_func = __NAMESPACE__ . '\\' . $func;
27
+ if(function_exists($local_func)) {
28
+ return call_user_func_array($local_func, $args);
29
+ }
30
+ return call_user_func_array($func, $args);
31
+ }
32
+ }
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
- * Version: 3.3.4
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
@@ -20,7 +20,7 @@ if(!defined('ABSPATH')) exit;
20
  */
21
 
22
  $mailpoet_plugin = array(
23
- 'version' => '3.3.4',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
+ * Version: 3.3.5
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
20
  */
21
 
22
  $mailpoet_plugin = array(
23
+ 'version' => '3.3.5',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: newsletter, email, welcome email, post notification, autoresponder, signup
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
- Stable tag: 3.3.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -116,6 +116,9 @@ Stop by our [support site](https://www.mailpoet.com/support).
116
 
117
  == Changelog ==
118
 
 
 
 
119
  = 3.3.4 - 2018-01-09 =
120
  * Fixed: the plugin no longer spams the same post notification email to subscribers. Thank you Mark, Bruno, Peter, Aaron, PJ, Silowe, Eytan, Beverly and others for your help!
121
  * Fixed: public assets are loaded for shortcode/PHP form placement methods. Thanks Ehsan!
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
+ Stable tag: 3.3.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 3.3.5 - 2018-01-16 =
120
+ * Added: additional tools for our support team to mitigate sending issues;
121
+
122
  = 3.3.4 - 2018-01-09 =
123
  * Fixed: the plugin no longer spams the same post notification email to subscribers. Thank you Mark, Bruno, Peter, Aaron, PJ, Silowe, Eytan, Beverly and others for your help!
124
  * Fixed: public assets are loaded for shortcode/PHP form placement methods. Thanks Ehsan!
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit41e65186cd8b74e61cdec872a50c0dfd::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -252,6 +252,7 @@ return array(
252
  'MailPoet\\Util\\pQuery\\pQuery' => $baseDir . '/lib/Util/pQuery/pQuery.php',
253
  'MailPoet\\WP\\DateTime' => $baseDir . '/lib/WP/DateTime.php',
254
  'MailPoet\\WP\\Emoji' => $baseDir . '/lib/WP/Emoji.php',
 
255
  'MailPoet\\WP\\Hooks' => $baseDir . '/lib/WP/Hooks.php',
256
  'MailPoet\\WP\\Notice' => $baseDir . '/lib/WP/Notice.php',
257
  'MailPoet\\WP\\Posts' => $baseDir . '/lib/WP/Posts.php',
252
  'MailPoet\\Util\\pQuery\\pQuery' => $baseDir . '/lib/Util/pQuery/pQuery.php',
253
  'MailPoet\\WP\\DateTime' => $baseDir . '/lib/WP/DateTime.php',
254
  'MailPoet\\WP\\Emoji' => $baseDir . '/lib/WP/Emoji.php',
255
+ 'MailPoet\\WP\\Functions' => $baseDir . '/lib/WP/Functions.php',
256
  'MailPoet\\WP\\Hooks' => $baseDir . '/lib/WP/Hooks.php',
257
  'MailPoet\\WP\\Notice' => $baseDir . '/lib/WP/Notice.php',
258
  'MailPoet\\WP\\Posts' => $baseDir . '/lib/WP/Posts.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit8ac245097030e7d5d3c594abdb1eae69
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire8ac245097030e7d5d3c594abdb1eae69($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire8ac245097030e7d5d3c594abdb1eae69($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit41e65186cd8b74e61cdec872a50c0dfd
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit41e65186cd8b74e61cdec872a50c0dfd', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit41e65186cd8b74e61cdec872a50c0dfd', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire41e65186cd8b74e61cdec872a50c0dfd($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire41e65186cd8b74e61cdec872a50c0dfd($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -369,6 +369,7 @@ class ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69
369
  'MailPoet\\Util\\pQuery\\pQuery' => __DIR__ . '/../..' . '/lib/Util/pQuery/pQuery.php',
370
  'MailPoet\\WP\\DateTime' => __DIR__ . '/../..' . '/lib/WP/DateTime.php',
371
  'MailPoet\\WP\\Emoji' => __DIR__ . '/../..' . '/lib/WP/Emoji.php',
 
372
  'MailPoet\\WP\\Hooks' => __DIR__ . '/../..' . '/lib/WP/Hooks.php',
373
  'MailPoet\\WP\\Notice' => __DIR__ . '/../..' . '/lib/WP/Notice.php',
374
  'MailPoet\\WP\\Posts' => __DIR__ . '/../..' . '/lib/WP/Posts.php',
@@ -984,10 +985,10 @@ class ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69
984
  public static function getInitializer(ClassLoader $loader)
985
  {
986
  return \Closure::bind(function () use ($loader) {
987
- $loader->prefixLengthsPsr4 = ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::$prefixLengthsPsr4;
988
- $loader->prefixDirsPsr4 = ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::$prefixDirsPsr4;
989
- $loader->prefixesPsr0 = ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::$prefixesPsr0;
990
- $loader->classMap = ComposerStaticInit8ac245097030e7d5d3c594abdb1eae69::$classMap;
991
 
992
  }, null, ClassLoader::class);
993
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
369
  'MailPoet\\Util\\pQuery\\pQuery' => __DIR__ . '/../..' . '/lib/Util/pQuery/pQuery.php',
370
  'MailPoet\\WP\\DateTime' => __DIR__ . '/../..' . '/lib/WP/DateTime.php',
371
  'MailPoet\\WP\\Emoji' => __DIR__ . '/../..' . '/lib/WP/Emoji.php',
372
+ 'MailPoet\\WP\\Functions' => __DIR__ . '/../..' . '/lib/WP/Functions.php',
373
  'MailPoet\\WP\\Hooks' => __DIR__ . '/../..' . '/lib/WP/Hooks.php',
374
  'MailPoet\\WP\\Notice' => __DIR__ . '/../..' . '/lib/WP/Notice.php',
375
  'MailPoet\\WP\\Posts' => __DIR__ . '/../..' . '/lib/WP/Posts.php',
985
  public static function getInitializer(ClassLoader $loader)
986
  {
987
  return \Closure::bind(function () use ($loader) {
988
+ $loader->prefixLengthsPsr4 = ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::$prefixLengthsPsr4;
989
+ $loader->prefixDirsPsr4 = ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::$prefixDirsPsr4;
990
+ $loader->prefixesPsr0 = ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::$prefixesPsr0;
991
+ $loader->classMap = ComposerStaticInit41e65186cd8b74e61cdec872a50c0dfd::$classMap;
992
 
993
  }, null, ClassLoader::class);
994
  }