MailPoet Newsletters (New) - Version 3.0.0-rc.2.0.3

Version Description

  • 2017-09-12 =
  • Added: hook to override default cron URL. Thanks Fred;
  • Improved: WordPress user sync optimized for large membership sites; Thanks Nagui and @deltafactory!
  • Improved: column blocks are highlighted when hovering over their tools in the newsletter editor. Now column blocks are easier to visualize;
  • Improved: color picker in the the email designer got instant color previews and history of recent picks to help you design newsletter elements more rapidly;
  • Fixed: Twig does not throw a deprecated notice. Thanks Pascal;
  • Fixed: newsletter editor now longer hangs on Internet Explorer. Thanks Danielle;
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.0.0-rc.2.0.3
Comparing to
See all releases

Code changes from version 3.0.0-rc.2.0.2 to 3.0.0-rc.2.0.3

Files changed (52) hide show
  1. assets/css/manifest.json +1 -1
  2. assets/css/{newsletter_editor.effbdd78.css → newsletter_editor.55f2b9dc.css} +4 -2
  3. assets/js/{admin.6527ae62.js → admin.d091b681.js} +452 -450
  4. assets/js/{admin_vendor.77fc9795.js → admin_vendor.ee9853ec.js} +3 -3
  5. assets/js/{form_editor.8b0c5294.js → form_editor.c0e36e82.js} +105 -99
  6. assets/js/{mailpoet.e52dab6e.js → mailpoet.81b583ba.js} +480 -481
  7. assets/js/manifest.json +8 -8
  8. assets/js/{mp2migrator.4acba493.js → mp2migrator.923dd5b2.js} +2 -2
  9. assets/js/{newsletter_editor.d11e861e.js → newsletter_editor.cc3c87be.js} +747 -681
  10. assets/js/{public.17607eba.js → public.02e5f1af.js} +64 -64
  11. assets/js/{vendor.f8675e02.js → vendor.f4549608.js} +74 -74
  12. lang/mailpoet-da_DK.mo +0 -0
  13. lang/mailpoet-de_DE.mo +0 -0
  14. lang/mailpoet-es_ES.mo +0 -0
  15. lang/mailpoet-fr_CA.mo +0 -0
  16. lang/mailpoet-fr_FR.mo +0 -0
  17. lang/mailpoet-nl_NL.mo +0 -0
  18. lang/mailpoet-pt_BR.mo +0 -0
  19. lang/mailpoet-ru_RU.mo +0 -0
  20. lang/mailpoet.pot +39 -31
  21. lib/Config/Activator.php +3 -2
  22. lib/Config/Initializer.php +48 -27
  23. lib/Config/Localizer.php +6 -21
  24. lib/Config/MP2Migrator.php +6 -6
  25. lib/Config/Migrator.php +2 -1
  26. lib/Config/PluginActivatedHook.php +1 -4
  27. lib/Config/Populator.php +3 -3
  28. lib/Config/PopulatorData/Templates/NewsDay.php +2 -2
  29. lib/Config/PopulatorData/Templates/NewsletterBlank12Column.php +1 -1
  30. lib/Config/PopulatorData/Templates/NewsletterBlank13Column.php +1 -1
  31. lib/Config/PopulatorData/Templates/NewsletterBlank1Column.php +1 -1
  32. lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php +1 -1
  33. lib/Config/PopulatorData/Templates/SimpleText.php +1 -1
  34. lib/Config/PopulatorData/Templates/WelcomeBlank12Column.php +1 -1
  35. lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php +1 -1
  36. lib/Config/PopulatorData/Templates/WorldCup.php +2 -2
  37. lib/Config/Renderer.php +0 -5
  38. lib/Config/ServicesChecker.php +2 -2
  39. lib/Cron/CronHelper.php +6 -1
  40. lib/Segments/WP.php +95 -14
  41. lib/Twig/Functions.php +11 -0
  42. mailpoet.php +2 -2
  43. readme.txt +9 -1
  44. vendor/autoload.php +1 -1
  45. vendor/composer/autoload_real.php +7 -7
  46. vendor/composer/autoload_static.php +5 -5
  47. views/index.html +1 -1
  48. views/layout.html +1 -1
  49. views/newsletter/editor.html +2 -2
  50. views/settings/mta.html +1 -1
  51. views/update.html +2 -2
  52. views/welcome.html +2 -2
assets/css/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "admin.css": "admin.0df54f3d.css",
3
  "importExport.css": "importExport.b3745466.css",
4
- "newsletter_editor.css": "newsletter_editor.effbdd78.css",
5
  "public.css": "public.cae357df.css",
6
  "rtl.css": "rtl.d41d8cd9.css"
7
  }
1
  {
2
  "admin.css": "admin.0df54f3d.css",
3
  "importExport.css": "importExport.b3745466.css",
4
+ "newsletter_editor.css": "newsletter_editor.55f2b9dc.css",
5
  "public.css": "public.cae357df.css",
6
  "rtl.css": "rtl.d41d8cd9.css"
7
  }
assets/css/{newsletter_editor.effbdd78.css → newsletter_editor.55f2b9dc.css} RENAMED
@@ -1948,10 +1948,12 @@ input.mailpoet_option_offset_left_small {
1948
  pointer-events: none;
1949
  border: 1px solid rgba(255,255,255,0);
1950
  }
1951
- .mailpoet_block:hover > .mailpoet_block_highlight,
1952
- .mailpoet_block.mailpoet_highlight > .mailpoet_block_highlight {
1953
  border: 1px dashed #0074a2;
1954
  }
 
 
 
1955
  .mailpoet_content {
1956
  position: relative;
1957
  line-height: 1.6em;
1948
  pointer-events: none;
1949
  border: 1px solid rgba(255,255,255,0);
1950
  }
1951
+ .mailpoet_block:hover > .mailpoet_block_highlight {
 
1952
  border: 1px dashed #0074a2;
1953
  }
1954
+ .mailpoet_block.mailpoet_highlight > .mailpoet_block_highlight {
1955
+ border: 1px dashed #0074a2 !important;
1956
+ }
1957
  .mailpoet_content {
1958
  position: relative;
1959
  line-height: 1.6em;
assets/js/{admin.6527ae62.js → admin.d091b681.js} RENAMED
@@ -2901,7 +2901,7 @@ webpackJsonp([0],[
2901
  _mailpoet2['default'].Notice.success(message);
2902
  },
2903
  onNoItemsFound: function onNoItemsFound(group) {
2904
- if (group === 'bounced' && !mailpoet_premium_active) {
2905
  return _react2['default'].createElement(
2906
  'div',
2907
  null,
@@ -3035,7 +3035,7 @@ webpackJsonp([0],[
3035
 
3036
  getSegmentFromId: function getSegmentFromId(segment_id) {
3037
  var result = false;
3038
- mailpoet_segments.map(function (segment) {
3039
  if (segment.id === segment_id) {
3040
  result = segment;
3041
  }
@@ -3183,7 +3183,7 @@ webpackJsonp([0],[
3183
  )
3184
  ),
3185
  _react2['default'].createElement(_listingListingJsx2['default'], {
3186
- limit: mailpoet_listing_per_page,
3187
  location: this.props.location,
3188
  params: this.props.params,
3189
  endpoint: 'subscribers',
@@ -3326,6 +3326,7 @@ webpackJsonp([0],[
3326
  }
3327
  },
3328
  handleChange: function handleChange(e) {
 
3329
  if (this.props.onValueChange !== undefined) {
3330
  if (this.props.field.multiple) {
3331
  value = jQuery('#' + this.refs.select.id).val();
@@ -9341,7 +9342,7 @@ webpackJsonp([0],[
9341
 
9342
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
9343
 
9344
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(274), __webpack_require__(275), __webpack_require__(180), __webpack_require__(290)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, MailPoet, classNames, Router, FormField) {
9345
 
9346
  var Form = React.createClass({
9347
  displayName: 'Form',
@@ -9580,7 +9581,7 @@ webpackJsonp([0],[
9580
 
9581
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
9582
 
9583
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(291), __webpack_require__(292), __webpack_require__(293), __webpack_require__(294), __webpack_require__(295), __webpack_require__(286), __webpack_require__(296)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, FormFieldText, FormFieldTextarea, FormFieldSelect, FormFieldRadio, FormFieldCheckbox, FormFieldSelection, FormFieldDate) {
9584
  var FormField = React.createClass({
9585
  displayName: 'FormField',
9586
 
@@ -10129,7 +10130,6 @@ webpackJsonp([0],[
10129
  year: _this2.state.year,
10130
  placeholder: _this2.props.field.year_placeholder
10131
  });
10132
- break;
10133
 
10134
  case 'MM':
10135
  return React.createElement(FormFieldDateMonth, {
@@ -10141,7 +10141,6 @@ webpackJsonp([0],[
10141
  monthNames: monthNames,
10142
  placeholder: _this2.props.field.month_placeholder
10143
  });
10144
- break;
10145
 
10146
  case 'DD':
10147
  return React.createElement(FormFieldDateDay, {
@@ -10152,7 +10151,6 @@ webpackJsonp([0],[
10152
  day: _this2.state.day,
10153
  placeholder: _this2.props.field.day_placeholder
10154
  });
10155
- break;
10156
  }
10157
  });
10158
 
@@ -35259,7 +35257,7 @@ webpackJsonp([0],[
35259
 
35260
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
35261
 
35262
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(180), __webpack_require__(278), __webpack_require__(274), __webpack_require__(289), __webpack_require__(511), __webpack_require__(512), __webpack_require__(515), __webpack_require__(425), __webpack_require__(428)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, _, MailPoet, Form, StandardNewsletterFields, NotificationNewsletterFields, WelcomeNewsletterFields, Breadcrumb, HelpTooltip) {
35263
 
35264
  var NewsletterSend = React.createClass({
35265
  displayName: 'NewsletterSend',
@@ -35574,6 +35572,240 @@ webpackJsonp([0],[
35574
 
35575
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35577
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
35578
 
35579
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@@ -35958,240 +36190,6 @@ webpackJsonp([0],[
35958
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
35959
 
35960
  /***/ },
35961
- /* 512 */
35962
- /***/ function(module, exports, __webpack_require__) {
35963
-
35964
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35965
-
35966
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(274), __webpack_require__(422), __webpack_require__(513), __webpack_require__(278)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MailPoet, Hooks, Scheduling, _) {
35967
-
35968
- var fields = [{
35969
- name: 'subject',
35970
- label: MailPoet.I18n.t('subjectLine'),
35971
- tip: MailPoet.I18n.t('postNotificationSubjectLineTip'),
35972
- type: 'text',
35973
- validation: {
35974
- 'data-parsley-required': true,
35975
- 'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
35976
- }
35977
- }, {
35978
- name: 'options',
35979
- label: MailPoet.I18n.t('selectFrequency'),
35980
- type: 'reactComponent',
35981
- component: Scheduling
35982
- }, {
35983
- name: 'segments',
35984
- label: MailPoet.I18n.t('segments'),
35985
- tip: MailPoet.I18n.t('segmentsTip'),
35986
- type: 'selection',
35987
- placeholder: MailPoet.I18n.t('selectSegmentPlaceholder'),
35988
- id: 'mailpoet_segments',
35989
- api_version: window.mailpoet_api_version,
35990
- endpoint: 'segments',
35991
- multiple: true,
35992
- filter: function filter(segment) {
35993
- return !!!segment.deleted_at;
35994
- },
35995
- getLabel: function getLabel(segment) {
35996
- return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
35997
- },
35998
- transformChangedValue: function transformChangedValue(segment_ids) {
35999
- var all_segments = this.state.items;
36000
- return _.map(segment_ids, function (id) {
36001
- return _.find(all_segments, function (segment) {
36002
- return segment.id === id;
36003
- });
36004
- });
36005
- },
36006
- validation: {
36007
- 'data-parsley-required': true,
36008
- 'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
36009
- }
36010
- }, {
36011
- name: 'sender',
36012
- label: MailPoet.I18n.t('sender'),
36013
- tip: MailPoet.I18n.t('senderTip'),
36014
- fields: [{
36015
- name: 'sender_name',
36016
- type: 'text',
36017
- placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
36018
- validation: {
36019
- 'data-parsley-required': true
36020
- }
36021
- }, {
36022
- name: 'sender_address',
36023
- type: 'text',
36024
- placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
36025
- validation: {
36026
- 'data-parsley-required': true,
36027
- 'data-parsley-type': 'email'
36028
- }
36029
- }]
36030
- }, {
36031
- name: 'reply-to',
36032
- label: MailPoet.I18n.t('replyTo'),
36033
- tip: MailPoet.I18n.t('replyToTip'),
36034
- inline: true,
36035
- fields: [{
36036
- name: 'reply_to_name',
36037
- type: 'text',
36038
- placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
36039
- }, {
36040
- name: 'reply_to_address',
36041
- type: 'text',
36042
- placeholder: MailPoet.I18n.t('replyToAddressPlaceholder')
36043
- }]
36044
- }];
36045
-
36046
- fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
36047
-
36048
- return {
36049
- getFields: function getFields() {
36050
- return fields;
36051
- },
36052
- getSendButtonOptions: function getSendButtonOptions() {
36053
- return {
36054
- value: MailPoet.I18n.t('activate')
36055
- };
36056
- }
36057
- };
36058
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
36059
-
36060
- /***/ },
36061
- /* 513 */
36062
- /***/ function(module, exports, __webpack_require__) {
36063
-
36064
- 'use strict';
36065
-
36066
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
36067
-
36068
- var _underscore = __webpack_require__(278);
36069
-
36070
- var _underscore2 = _interopRequireDefault(_underscore);
36071
-
36072
- var _react = __webpack_require__(2);
36073
-
36074
- var _react2 = _interopRequireDefault(_react);
36075
-
36076
- var _formFieldsSelectJsx = __webpack_require__(293);
36077
-
36078
- var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
36079
-
36080
- var _newslettersSchedulingCommonJsx = __webpack_require__(514);
36081
-
36082
- var intervalField = {
36083
- name: 'intervalType',
36084
- values: _newslettersSchedulingCommonJsx.intervalValues
36085
- };
36086
-
36087
- var timeOfDayField = {
36088
- name: 'timeOfDay',
36089
- values: _newslettersSchedulingCommonJsx.timeOfDayValues
36090
- };
36091
-
36092
- var weekDayField = {
36093
- name: 'weekDay',
36094
- values: _newslettersSchedulingCommonJsx.weekDayValues
36095
- };
36096
-
36097
- var monthDayField = {
36098
- name: 'monthDay',
36099
- values: _newslettersSchedulingCommonJsx.monthDayValues
36100
- };
36101
-
36102
- var nthWeekDayField = {
36103
- name: 'nthWeekDay',
36104
- values: _newslettersSchedulingCommonJsx.nthWeekDayValues
36105
- };
36106
-
36107
- var NotificationScheduling = _react2['default'].createClass({
36108
- displayName: 'NotificationScheduling',
36109
-
36110
- _getCurrentValue: function _getCurrentValue() {
36111
- return this.props.item[this.props.field.name] || {};
36112
- },
36113
- handleValueChange: function handleValueChange(name, value) {
36114
- var oldValue = this._getCurrentValue();
36115
- var newValue = {};
36116
-
36117
- newValue[name] = value;
36118
-
36119
- return this.props.onValueChange({
36120
- target: {
36121
- name: this.props.field.name,
36122
- value: _underscore2['default'].extend({}, oldValue, newValue)
36123
- }
36124
- });
36125
- },
36126
- handleIntervalChange: function handleIntervalChange(event) {
36127
- return this.handleValueChange('intervalType', event.target.value);
36128
- },
36129
- handleTimeOfDayChange: function handleTimeOfDayChange(event) {
36130
- return this.handleValueChange('timeOfDay', event.target.value);
36131
- },
36132
- handleWeekDayChange: function handleWeekDayChange(event) {
36133
- return this.handleValueChange('weekDay', event.target.value);
36134
- },
36135
- handleMonthDayChange: function handleMonthDayChange(event) {
36136
- return this.handleValueChange('monthDay', event.target.value);
36137
- },
36138
- handleNthWeekDayChange: function handleNthWeekDayChange(event) {
36139
- return this.handleValueChange('nthWeekDay', event.target.value);
36140
- },
36141
- render: function render() {
36142
- var value = this._getCurrentValue();
36143
- var timeOfDaySelection = undefined;
36144
- var weekDaySelection = undefined;
36145
- var monthDaySelection = undefined;
36146
- var nthWeekDaySelection = undefined;
36147
-
36148
- if (value.intervalType !== 'immediately') {
36149
- timeOfDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
36150
- field: timeOfDayField,
36151
- item: this._getCurrentValue(),
36152
- onValueChange: this.handleTimeOfDayChange });
36153
- }
36154
-
36155
- if (value.intervalType === 'weekly' || value.intervalType === 'nthWeekDay') {
36156
- weekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
36157
- field: weekDayField,
36158
- item: this._getCurrentValue(),
36159
- onValueChange: this.handleWeekDayChange });
36160
- }
36161
-
36162
- if (value.intervalType === 'monthly') {
36163
- monthDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
36164
- field: monthDayField,
36165
- item: this._getCurrentValue(),
36166
- onValueChange: this.handleMonthDayChange });
36167
- }
36168
-
36169
- if (value.intervalType === 'nthWeekDay') {
36170
- nthWeekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
36171
- field: nthWeekDayField,
36172
- item: this._getCurrentValue(),
36173
- onValueChange: this.handleNthWeekDayChange });
36174
- }
36175
-
36176
- return _react2['default'].createElement(
36177
- 'div',
36178
- null,
36179
- _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
36180
- field: intervalField,
36181
- item: this._getCurrentValue(),
36182
- onValueChange: this.handleIntervalChange }),
36183
- nthWeekDaySelection,
36184
- monthDaySelection,
36185
- weekDaySelection,
36186
- timeOfDaySelection
36187
- );
36188
- }
36189
- });
36190
-
36191
- module.exports = NotificationScheduling;
36192
-
36193
- /***/ },
36194
- /* 514 */,
36195
  /* 515 */
36196
  /***/ function(module, exports, __webpack_require__) {
36197
 
@@ -36326,7 +36324,7 @@ webpackJsonp([0],[
36326
 
36327
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
36328
 
36329
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(278), __webpack_require__(2), __webpack_require__(180), __webpack_require__(274), __webpack_require__(513), __webpack_require__(425)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, React, Router, MailPoet, Scheduling, Breadcrumb) {
36330
 
36331
  var field = {
36332
  name: 'options',
@@ -36642,7 +36640,7 @@ webpackJsonp([0],[
36642
  ),
36643
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'standard' }),
36644
  _react2['default'].createElement(_listingListingJsx2['default'], {
36645
- limit: mailpoet_listing_per_page,
36646
  location: this.props.location,
36647
  params: this.props.params,
36648
  endpoint: 'newsletters',
@@ -37519,7 +37517,7 @@ webpackJsonp([0],[
37519
  ),
37520
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'welcome' }),
37521
  _react2['default'].createElement(_listingListingJsx2['default'], {
37522
- limit: mailpoet_listing_per_page,
37523
  location: this.props.location,
37524
  params: this.props.params,
37525
  endpoint: 'newsletters',
@@ -37573,7 +37571,7 @@ webpackJsonp([0],[
37573
 
37574
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
37575
 
37576
- var _newslettersSchedulingCommonJsx = __webpack_require__(514);
37577
 
37578
  var messages = {
37579
  onTrash: function onTrash(response) {
@@ -37865,7 +37863,7 @@ webpackJsonp([0],[
37865
  ),
37866
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'notification' }),
37867
  _react2['default'].createElement(_listingListingJsx2['default'], {
37868
- limit: mailpoet_listing_per_page,
37869
  location: this.props.location,
37870
  params: this.props.params,
37871
  endpoint: 'newsletters',
@@ -38034,7 +38032,7 @@ webpackJsonp([0],[
38034
  _mailpoet2['default'].I18n.t('backToPostNotifications')
38035
  ),
38036
  _react2['default'].createElement(_listingListingJsx2['default'], {
38037
- limit: mailpoet_listing_per_page,
38038
  location: this.props.location,
38039
  params: this.props.params,
38040
  endpoint: 'newsletters',
@@ -38409,7 +38407,7 @@ webpackJsonp([0],[
38409
  )
38410
  ),
38411
  _react2['default'].createElement(_listingListingJsx2['default'], {
38412
- limit: mailpoet_listing_per_page,
38413
  location: this.props.location,
38414
  params: this.props.params,
38415
  messages: messages,
@@ -38511,9 +38509,9 @@ webpackJsonp([0],[
38511
 
38512
  var _history = __webpack_require__(243);
38513
 
38514
- var _formsListJsx = __webpack_require__(533);
38515
 
38516
- var _formsListJsx2 = _interopRequireDefault(_formsListJsx);
38517
 
38518
  var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
38519
 
@@ -38534,8 +38532,8 @@ webpackJsonp([0],[
38534
  _react2['default'].createElement(
38535
  _reactRouter.Route,
38536
  { path: '/', component: App },
38537
- _react2['default'].createElement(_reactRouter.IndexRoute, { component: _formsListJsx2['default'] }),
38538
- _react2['default'].createElement(_reactRouter.Route, { path: '*', component: _formsListJsx2['default'] })
38539
  )
38540
  ), container);
38541
  }
@@ -38552,10 +38550,6 @@ webpackJsonp([0],[
38552
 
38553
  var _react2 = _interopRequireDefault(_react);
38554
 
38555
- var _listingListingJsx = __webpack_require__(276);
38556
-
38557
- var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
38558
-
38559
  var _classnames = __webpack_require__(275);
38560
 
38561
  var _classnames2 = _interopRequireDefault(_classnames);
@@ -38564,6 +38558,14 @@ webpackJsonp([0],[
38564
 
38565
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
38566
 
 
 
 
 
 
 
 
 
38567
  var columns = [{
38568
  name: 'name',
38569
  label: _mailpoet2['default'].I18n.t('formName'),
@@ -38667,7 +38669,7 @@ webpackJsonp([0],[
38667
  endpoint: 'forms',
38668
  action: 'create'
38669
  }).done(function (response) {
38670
- window.location = mailpoet_form_edit_url + response.data.id;
38671
  }).fail(function (response) {
38672
  if (response.errors.length > 0) {
38673
  _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
@@ -38679,8 +38681,8 @@ webpackJsonp([0],[
38679
  renderItem: function renderItem(form, actions) {
38680
  var row_classes = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
38681
 
38682
- var segments = mailpoet_segments.filter(function (segment) {
38683
- return jQuery.inArray(segment.id, form.segments) !== -1;
38684
  }).map(function (segment) {
38685
  return segment.name;
38686
  }).join(', ');
@@ -38750,7 +38752,7 @@ webpackJsonp([0],[
38750
  )
38751
  ),
38752
  _react2['default'].createElement(_listingListingJsx2['default'], {
38753
- limit: mailpoet_listing_per_page,
38754
  location: this.props.location,
38755
  params: this.props.params,
38756
  messages: messages,
@@ -41149,16 +41151,16 @@ webpackJsonp([0],[
41149
  /***/ function(module, exports, __webpack_require__) {
41150
 
41151
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
41152
- __webpack_require__(535),
41153
- __webpack_require__(278),
41154
- __webpack_require__(273),
41155
- __webpack_require__(274),
41156
- __webpack_require__(543),
41157
- __webpack_require__(544),
41158
- __webpack_require__(545),
41159
- __webpack_require__(297),
41160
- __webpack_require__(287)
41161
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
41162
  Backbone,
41163
  _,
41164
  jQuery,
@@ -41175,7 +41177,7 @@ webpackJsonp([0],[
41175
  jQuery(document).ready(function () {
41176
  jQuery('input[name="select_method"]').attr('checked', false);
41177
  // configure router
41178
- router = new (Backbone.Router.extend({
41179
  routes: {
41180
  '': 'home',
41181
  step1: 'step1',
@@ -41199,13 +41201,13 @@ webpackJsonp([0],[
41199
  */
41200
  router.on('route:step1', function () {
41201
  // set or reset temporary validation rule on all columns
41202
- mailpoetColumns = jQuery.map(mailpoetColumns, function (column, columnIndex) {
41203
  var col = column;
41204
  col.validation_rule = false;
41205
  return col;
41206
  });
41207
 
41208
- if (typeof (importData.step1) !== 'undefined') {
41209
  showCurrentStep();
41210
  return;
41211
  }
@@ -41217,21 +41219,21 @@ webpackJsonp([0],[
41217
 
41218
  // define reusable variables
41219
  var currentStepE = jQuery(location.hash),
41220
- methodSelectionElement = jQuery('#select_method'),
41221
- pasteInputElement = jQuery('#paste_input'),
41222
- pasteInputPlaceholderElement =
41223
  pasteInputElement.data('placeholder').replace(/\\n/g, '\n'),
41224
- pasteProcessButtonElement =
41225
  jQuery('#method_paste > div.mailpoet_method_process')
41226
  .find('a.mailpoet_process'),
41227
- mailChimpKeyInputElement = jQuery('#mailchimp_key'),
41228
- mailChimpKeyVerifyButtonElement = jQuery('#mailchimp_key_verify'),
41229
- mailChimpListsContainerElement = jQuery('#mailchimp_lists'),
41230
- mailChimpProcessButtonElement =
41231
  jQuery('#method_mailchimp > div.mailpoet_method_process')
41232
  .find('a.mailpoet_process'),
41233
- uploadElement = jQuery('#file_local'),
41234
- uploadProcessButtonElement =
41235
  jQuery('#method_file > div.mailpoet_method_process')
41236
  .find('a.mailpoet_process');
41237
 
@@ -41239,7 +41241,7 @@ webpackJsonp([0],[
41239
  methodSelectionElement.change(function () {
41240
  MailPoet.Notice.hide();
41241
  var available_methods = jQuery(':radio[name="select_method"]'),
41242
- selected_method =
41243
  available_methods.index(available_methods.filter(':checked'));
41244
  // hide all methods
41245
  currentStepE.find('.inside')
@@ -41282,7 +41284,7 @@ webpackJsonp([0],[
41282
  MailPoet.Notice.hide();
41283
  // get an approximate size of textarea paste in bytes
41284
  var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1;
41285
- if (pasteSize > maxPostSizeBytes) {
41286
  MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice'));
41287
  return;
41288
  }
@@ -41298,11 +41300,11 @@ webpackJsonp([0],[
41298
  */
41299
  uploadElement.change(function () {
41300
  MailPoet.Notice.hide();
41301
- var ext = this.value.match(/\.(.+)$/);
41302
- if (ext === null || ext[1].toLowerCase() !== 'csv') {
41303
- this.value = '';
41304
- MailPoet.Notice.error(MailPoet.I18n.t('wrongFileFormat'));
41305
- }
41306
 
41307
  toggleNextStepButton(
41308
  uploadProcessButtonElement,
@@ -41385,7 +41387,7 @@ webpackJsonp([0],[
41385
  }).always(function(response) {
41386
  MailPoet.Modal.loading(false);
41387
  }).done(function(response) {
41388
- importData.step1 = response.data;
41389
  MailPoet.trackEvent('Subscribers import started', {
41390
  source: 'MailChimp',
41391
  'MailPoet Free version': window.mailpoet_version
@@ -41443,23 +41445,23 @@ webpackJsonp([0],[
41443
 
41444
  function parseCSV(isFile) {
41445
  var processedSubscribers = [],
41446
- parsedEmails = [],
41447
- duplicateEmails = [],
41448
- invalidEmails = [],
41449
- emailColumnPosition = null,
41450
- columnCount = null,
41451
- isHeaderFound = false,
41452
- advancedOptionHeader = true,
41453
- advancedOptionDelimiter = '',
41454
- advancedOptionNewline = '',
41455
- advancedOptionComments = false,
41456
  // trim spaces, commas, periods,
41457
  // single/double quotes and convert to lowercase
41458
- detectAndCleanupEmail = function (emailString) {
41459
- var test;
41460
  // decode HTML entities
41461
- var email = jQuery('<div />').html(emailString).text();
41462
- email = email
41463
  .toLowerCase()
41464
  // left/right trim spaces, punctuation (e.g., " 'email@email.com'; ")
41465
  // right trim non-printable characters (e.g., "email@email.com�")
@@ -41468,22 +41470,22 @@ webpackJsonp([0],[
41468
  // remove urlencoded characters
41469
  .replace(/\s+|%\d+|,+/g, '');
41470
  // detect e-mails that will be otherwise rejected by email regex
41471
- test = /<(.*?)>/.exec(email);
41472
- if (test) {
41473
  // is the email inside angle brackets (e.g., 'some@email.com <some@email.com>')?
41474
- email = test[1].trim();
41475
- }
41476
- test = /mailto:(?:\s+)?(.*)/.exec(email);
41477
- if (test) {
41478
  // is the email in 'mailto:email' format?
41479
- email = test[1].trim();
41480
- }
41481
  // test for valid characters using WP's rule (https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/formatting.php#L2902)
41482
- if (!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\-@]+$/.test(email) ) {
41483
- return false;
41484
- }
41485
- return email;
41486
- };
41487
 
41488
  return {
41489
  skipEmptyLines: true,
@@ -41516,7 +41518,7 @@ webpackJsonp([0],[
41516
  for (var column in rowData) {
41517
  var email = detectAndCleanupEmail(rowData[column]);
41518
  if (emailColumnPosition === null
41519
- && emailRegex.test(email)) {
41520
  emailColumnPosition = column;
41521
  parsedEmails[email] = true; // add current e-mail to an object index
41522
  rowData[column] = email;
@@ -41535,7 +41537,7 @@ webpackJsonp([0],[
41535
  if (_.has(parsedEmails, email)) {
41536
  duplicateEmails.push(email);
41537
  }
41538
- else if (!emailRegex.test(email)) {
41539
  invalidEmails.push(rowData[emailColumnPosition]);
41540
  }
41541
  // if we haven't yet processed this e-mail and it passed
@@ -41558,8 +41560,8 @@ webpackJsonp([0],[
41558
  ) {
41559
  // since we assume that the header line is always present, we need
41560
  // to detect the header by checking if it contains a valid e-mail address
41561
- importData.step1 = {
41562
- header: (!emailRegex.test(
41563
  processedSubscribers[0][emailColumnPosition])
41564
  ) ? processedSubscribers.shift() : null,
41565
  subscribers: processedSubscribers,
@@ -41586,37 +41588,37 @@ webpackJsonp([0],[
41586
  });
41587
 
41588
  router.on('route:step2', function () {
41589
- if (typeof (importData.step1) === 'undefined') {
41590
  router.navigate('step1', {trigger: true});
41591
  return;
41592
  }
41593
  // define reusable variables
41594
  var nextStepButton = jQuery('#step2_process'),
41595
- previousStepButton = jQuery('#return_to_step1'),
41596
  // create a copy of subscribers object for further manipulation
41597
- subscribers = jQuery.extend(true, {}, importData.step1),
41598
- subscribersDataTemplate =
41599
  Handlebars
41600
  .compile(jQuery('#subscribers_data_template')
41601
  .html()),
41602
- subscribersDataTemplatePartial =
41603
  Handlebars
41604
  .compile(jQuery('#subscribers_data_template_partial')
41605
  .html()),
41606
- subscribersDataParseResultsTemplate =
41607
  Handlebars
41608
  .compile(jQuery('#subscribers_data_parse_results_template')
41609
  .html()),
41610
- segmentSelectElement = jQuery('#mailpoet_segments_select'),
41611
- maxRowsToShow = 10,
41612
- filler = '. . .',
41613
  // create an array of filler data with the same number of
41614
  // elements as in the subscribers' data row
41615
- fillerArray = Array.apply(
41616
  null,
41617
  new Array(subscribers.subscribers[0].length)
41618
  ).map(String.prototype.valueOf, filler),
41619
- fillerPosition;
41620
 
41621
  showCurrentStep();
41622
 
@@ -41674,7 +41676,7 @@ webpackJsonp([0],[
41674
  });
41675
 
41676
  // show available segments
41677
- if (mailpoetSegments.length) {
41678
  jQuery('.mailpoet_segments').show();
41679
  }
41680
  else {
@@ -41747,7 +41749,7 @@ webpackJsonp([0],[
41747
  description: segmentDescription
41748
  }
41749
  }).done(function(response) {
41750
- mailpoetSegments.push({
41751
  id: response.data.id,
41752
  name: response.data.name,
41753
  subscriberCount: 0
@@ -41760,7 +41762,7 @@ webpackJsonp([0],[
41760
  selected_values.push(response.data.id);
41761
  }
41762
 
41763
- enableSegmentSelection(mailpoetSegments);
41764
  segmentSelectElement.val(selected_values).trigger('change');
41765
  jQuery('.mailpoet_segments:hidden').show();
41766
  jQuery('.mailpoet_no_segments:visible').hide();
@@ -41791,22 +41793,22 @@ webpackJsonp([0],[
41791
  'show_and_match_columns',
41792
  function (subscribers, options) {
41793
  var displayedColumns = [],
41794
- displayedColumnsIds = [];
41795
  // go through all elements of the first row in subscribers data
41796
  for (var i in subscribers.subscribers[0]) {
41797
  var columnData = subscribers.subscribers[0][i],
41798
- columnId = 'ignore'; // set default column type
41799
  // if the column is not undefined and has a valid e-mail, set type as email
41800
- if (columnData % 1 !== 0 && emailRegex.test(columnData)) {
41801
  columnId = 'email';
41802
  } else if (subscribers.header) {
41803
  var headerName = subscribers.header[i],
41804
- headerNameMatch = mailpoetColumns.map(function (el) {
41805
- return el.name;
41806
- }).indexOf(headerName);
41807
  // set column type using header
41808
  if (headerNameMatch !== -1) {
41809
- columnId = mailpoetColumns[headerNameMatch].id;
41810
  }// set column type using header name
41811
  else if (headerName) {
41812
  if (/first|first name|given name/i.test(headerName)) {
@@ -41871,7 +41873,7 @@ webpackJsonp([0],[
41871
  // filter displayed data
41872
  jQuery('select.mailpoet_subscribers_column_data_match')
41873
  .select2({
41874
- data: mailpoetColumnsSelect2,
41875
  width: '15em',
41876
  templateResult: function (item) {
41877
  return item.name;
@@ -41882,7 +41884,7 @@ webpackJsonp([0],[
41882
  })
41883
  .on('select2:selecting', function (selectEvent) {
41884
  var selectElement = this,
41885
- selectedOptionId = selectEvent.params.args.data.id;
41886
  // CREATE CUSTOM FIELD
41887
  if (selectedOptionId === 'create') {
41888
  selectEvent.preventDefault();
@@ -41910,21 +41912,21 @@ webpackJsonp([0],[
41910
  custom: true
41911
  };
41912
  // if this is the first custom column, create an "optgroup"
41913
- if (mailpoetColumnsSelect2.length === 2) {
41914
- mailpoetColumnsSelect2.push({
41915
  name: MailPoet.I18n.t('userColumns'),
41916
  children: []
41917
  });
41918
  }
41919
- mailpoetColumnsSelect2[2].children.push(new_column_data);
41920
- mailpoetColumns.push(new_column_data);
41921
  jQuery('select.mailpoet_subscribers_column_data_match')
41922
  .each(function () {
41923
  jQuery(this)
41924
  .html('')
41925
  .select2('destroy')
41926
  .select2({
41927
- data: mailpoetColumnsSelect2,
41928
  width: '15em',
41929
  templateResult: function (item) {
41930
  return item.name;
@@ -41956,7 +41958,7 @@ webpackJsonp([0],[
41956
  jQuery('select.mailpoet_subscribers_column_data_match')
41957
  .each(function () {
41958
  var element = this,
41959
- elementId = jQuery(element).val();
41960
  // if another column has the same value and it's not an 'ignore', prompt user
41961
  if (elementId === selectedOptionId
41962
  && elementId !== 'ignore') {
@@ -41973,7 +41975,7 @@ webpackJsonp([0],[
41973
  })
41974
  .on('select2:select', function (selectEvent) {
41975
  var selectElement = this,
41976
- selectedOptionId = selectEvent.params.data.id;
41977
  jQuery(selectElement).data('column-id', selectedOptionId);
41978
  filterSubscribers();
41979
  });
@@ -41984,8 +41986,8 @@ webpackJsonp([0],[
41984
  '[data-id="notice_invalidEmail"], [data-id="notice_invalidDate"]')
41985
  .remove();
41986
  var subscribersClone = jQuery.extend(true, {}, subscribers),
41987
- preventNextStep = false,
41988
- displayedColumns = jQuery.map(
41989
  jQuery('.mailpoet_subscribers_column_data_match'), function (element, elementIndex) {
41990
  var columnId = jQuery(element).data('column-id');
41991
  var validationRule = jQuery(element).data('validation-rule');
@@ -41993,14 +41995,14 @@ webpackJsonp([0],[
41993
  return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
41994
  });
41995
  // iterate through the object of mailpoet columns
41996
- jQuery.map(mailpoetColumns, function (column, columnIndex) {
41997
  // check if the column id matches the selected id of one of the
41998
  // subscriber's data columns
41999
  var matchedColumn = _.find(displayedColumns, function(data) { return data.id === column.id; });
42000
  // EMAIL filter: if the first value in the column doesn't have a valid
42001
  // email, hide the next button
42002
  if (column.id === 'email') {
42003
- if (!emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) {
42004
  preventNextStep = true;
42005
  if (!jQuery('[data-id="notice_invalidEmail"]').length) {
42006
  MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), {
@@ -42144,7 +42146,7 @@ webpackJsonp([0],[
42144
  return res;
42145
  }, []);
42146
  },
42147
- subscribers = splitSubscribers(importData.step1.subscribers, batchSize);
42148
 
42149
  _.each(jQuery('select.mailpoet_subscribers_column_data_match'),
42150
  function (column, columnIndex) {
@@ -42168,7 +42170,7 @@ webpackJsonp([0],[
42168
  subscribers: subscribers[batchNumber],
42169
  timestamp: timestamp,
42170
  segments: segmentSelectElement.val(),
42171
- updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes') ? true : false
42172
  })
42173
  }).done(function(response) {
42174
  importResults.created += response.data.created;
@@ -42198,37 +42200,37 @@ webpackJsonp([0],[
42198
  );
42199
  }
42200
  else {
42201
- mailpoetSegments = importResults.segments;
42202
  importResults.segments = _.map(segmentSelectElement.select2('data'),
42203
  function (data) {
42204
  return data.name;
42205
  });
42206
- importData.step2 = importResults;
42207
- enableSegmentSelection(mailpoetSegments);
42208
  router.navigate('step3', {trigger: true});
42209
  }
42210
  });
42211
  });
42212
 
42213
  filterSubscribers();
42214
- enableSegmentSelection(mailpoetSegments);
42215
  });
42216
 
42217
  router.on('route:step3', function () {
42218
- if (typeof (importData.step2) === 'undefined') {
42219
  router.navigate('step2', {trigger: true});
42220
  return;
42221
  }
42222
 
42223
  showCurrentStep();
42224
 
42225
- if (importData.step2.errors.length > 0) {
42226
- MailPoet.Notice.error(_.flatten(importData.step2.errors));
42227
  }
42228
 
42229
  MailPoet.trackEvent('Subscribers import finished', {
42230
- 'Subscribers created': importData.step2.created,
42231
- 'Subscribers updated': importData.step2.updated,
42232
  'MailPoet Free version': window.mailpoet_version
42233
  });
42234
 
@@ -42237,21 +42239,21 @@ webpackJsonp([0],[
42237
  Handlebars
42238
  .compile(jQuery('#subscribers_data_import_results_template')
42239
  .html()),
42240
- exportMenuElement = jQuery('span.mailpoet_export'),
42241
- importResults = {
42242
- created: (importData.step2.created)
42243
  ? MailPoet.I18n.t('subscribersCreated')
42244
- .replace('%1$s', '<strong>' + importData.step2.created.toLocaleString() + '</strong>')
42245
- .replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
42246
  : false,
42247
- updated: (importData.step2.updated)
42248
  ? MailPoet.I18n.t('subscribersUpdated')
42249
- .replace('%1$s', '<strong>' + importData.step2.updated.toLocaleString() + '</strong>')
42250
- .replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
42251
  : false,
42252
- no_action: (!importData.step2.created && !importData.step2.updated),
42253
- added_to_segment_with_welcome_notification: importData.step2.added_to_segment_with_welcome_notification
42254
- };
42255
 
42256
  jQuery('#subscribers_data_import_results')
42257
  .html(subscribersDataImportResultsTemplate(importResults))
@@ -42273,7 +42275,7 @@ webpackJsonp([0],[
42273
  }
42274
 
42275
  // reset previous step's data so that coming back to this step is prevented
42276
- importData.step2 = undefined;
42277
  });
42278
 
42279
  if (!Backbone.History.started) {
@@ -42385,44 +42387,44 @@ webpackJsonp([0],[
42385
  /***/ function(module, exports, __webpack_require__) {
42386
 
42387
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
42388
- __webpack_require__(278),
42389
- __webpack_require__(273),
42390
- __webpack_require__(274),
42391
- __webpack_require__(543),
42392
- __webpack_require__(287)
42393
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
42394
- _,
42395
- jQuery,
42396
- MailPoet,
42397
- Handlebars,
42398
- select2
42399
  ) {
42400
  if (!jQuery('#mailpoet_subscribers_export').length) {
42401
  return;
42402
  }
42403
  jQuery(document).ready(function () {
42404
- if (!exportData.segments) {
42405
  return;
42406
  }
42407
  var subscribers_export_template =
42408
  Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
42409
 
42410
  //render template
42411
- jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(exportData));
42412
 
42413
  // define reusable variables
42414
  var segmentsContainerElement = jQuery('#export_lists'),
42415
- subscriberFieldsContainerElement = jQuery('#export_columns'),
42416
- exportConfirmedOptionElement = jQuery(':radio[name="option_confirmed"]'),
42417
- groupBySegmentOptionElement = jQuery(':checkbox[name="option_group_by_list"]'),
42418
- nextStepButton = jQuery('a.mailpoet_export_process'),
42419
- renderSegmentsAndFields = function (container, data) {
42420
- if (container.data('select2')) {
42421
- container
42422
  .html('')
42423
  .select2('destroy');
42424
- }
42425
- container
42426
  .select2({
42427
  data: data,
42428
  width: '20em',
@@ -42439,11 +42441,11 @@ webpackJsonp([0],[
42439
  })
42440
  .on('select2:selecting', function (selectEvent) {
42441
  var selectElement = this,
42442
- selectedOptionId = selectEvent.params.args.data.id,
42443
- fieldsToExclude = [
42444
- 'select',
42445
- 'deselect'
42446
- ];
42447
  if (_.contains(fieldsToExclude, selectedOptionId)) {
42448
  selectEvent.preventDefault();
42449
  if (selectedOptionId === 'deselect') {
@@ -42461,9 +42463,9 @@ webpackJsonp([0],[
42461
  }
42462
  })
42463
  .on('change', function () {
42464
- if ((exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
42465
  ||
42466
- (!exportData.segments && subscriberFieldsContainerElement.select2('data').length)
42467
  ) {
42468
  toggleNextStepButton('on');
42469
  }
@@ -42471,20 +42473,20 @@ webpackJsonp([0],[
42471
  toggleNextStepButton('off');
42472
  }
42473
 
42474
- if (segmentsContainerElement.select2('data').length > 1 && exportData.groupBySegmentOption) {
42475
  jQuery('.mailpoet_group_by_list').show();
42476
  }
42477
- else if (exportData.groupBySegmentOption) {
42478
  jQuery('.mailpoet_group_by_list').hide();
42479
  }
42480
  });
42481
- };
42482
 
42483
  // set confirmed subscribers export option to false
42484
- exportData.exportConfirmedOption = false;
42485
 
42486
- renderSegmentsAndFields(subscriberFieldsContainerElement, subscriberFieldsSelect2);
42487
- renderSegmentsAndFields(segmentsContainerElement, segments);
42488
 
42489
  subscriberFieldsContainerElement.val([
42490
  'email',
@@ -42496,12 +42498,12 @@ webpackJsonp([0],[
42496
  exportConfirmedOptionElement.change(function () {
42497
  var selectedSegments = segmentsContainerElement.val();
42498
  if (this.value == 1) {
42499
- exportData.exportConfirmedOption = true;
42500
- renderSegmentsAndFields(segmentsContainerElement, segmentsWithConfirmedSubscribers);
42501
  }
42502
  else {
42503
- exportData.exportConfirmedOption = false;
42504
- renderSegmentsAndFields(segmentsContainerElement, segments);
42505
  }
42506
  segmentsContainerElement.val(selectedSegments).trigger('change');
42507
  });
@@ -42523,39 +42525,39 @@ webpackJsonp([0],[
42523
  MailPoet.Modal.loading(true);
42524
  var exportFormat = jQuery(':radio[name="option_format"]:checked').val();
42525
  MailPoet.Ajax.post({
42526
- api_version: window.mailpoet_api_version,
42527
- endpoint: 'ImportExport',
42528
- action: 'processExport',
42529
- data: JSON.stringify({
42530
- export_confirmed_option: exportData.exportConfirmedOption,
42531
- export_format_option: exportFormat,
42532
- group_by_segment_option: (groupBySegmentOptionElement.is(':visible')) ? groupBySegmentOptionElement.prop('checked') : false,
42533
- segments: (exportData.segments) ? segmentsContainerElement.val() : false,
42534
- subscriber_fields: subscriberFieldsContainerElement.val()
42535
- })
42536
- }).always(function(response) {
42537
- MailPoet.Modal.loading(false);
42538
- }).done(function(response) {
42539
- resultMessage = MailPoet.I18n.t('exportMessage')
42540
- .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
42541
- .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
42542
- .replace('[/link]', '</a>');
42543
- jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
42544
- window.location.href = response.data.exportFileURL;
42545
- MailPoet.trackEvent('Subscribers export completed', {
42546
- 'Total exported': response.data.totalExported,
42547
- 'Only confirmed?': exportData.exportConfirmedOption,
42548
- 'File Format': exportFormat,
42549
- 'MailPoet Free version': window.mailpoet_version
42550
- });
42551
- }).fail(function(response) {
42552
- if (response.errors.length > 0) {
42553
- MailPoet.Notice.error(
42554
  response.errors.map(function(error) { return error.message; }),
42555
  { scroll: true }
42556
  );
42557
- }
42558
- });
42559
  });
42560
  });
42561
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2901
  _mailpoet2['default'].Notice.success(message);
2902
  },
2903
  onNoItemsFound: function onNoItemsFound(group) {
2904
+ if (group === 'bounced' && !window.mailpoet_premium_active) {
2905
  return _react2['default'].createElement(
2906
  'div',
2907
  null,
3035
 
3036
  getSegmentFromId: function getSegmentFromId(segment_id) {
3037
  var result = false;
3038
+ window.mailpoet_segments.map(function (segment) {
3039
  if (segment.id === segment_id) {
3040
  result = segment;
3041
  }
3183
  )
3184
  ),
3185
  _react2['default'].createElement(_listingListingJsx2['default'], {
3186
+ limit: window.mailpoet_listing_per_page,
3187
  location: this.props.location,
3188
  params: this.props.params,
3189
  endpoint: 'subscribers',
3326
  }
3327
  },
3328
  handleChange: function handleChange(e) {
3329
+ var value = undefined;
3330
  if (this.props.onValueChange !== undefined) {
3331
  if (this.props.field.multiple) {
3332
  value = jQuery('#' + this.refs.select.id).val();
9342
 
9343
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
9344
 
9345
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(274), __webpack_require__(275), __webpack_require__(180), __webpack_require__(290), __webpack_require__(273)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, MailPoet, classNames, Router, FormField, jQuery) {
9346
 
9347
  var Form = React.createClass({
9348
  displayName: 'Form',
9581
 
9582
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
9583
 
9584
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(291), __webpack_require__(292), __webpack_require__(293), __webpack_require__(294), __webpack_require__(295), __webpack_require__(286), __webpack_require__(296), __webpack_require__(273)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, FormFieldText, FormFieldTextarea, FormFieldSelect, FormFieldRadio, FormFieldCheckbox, FormFieldSelection, FormFieldDate, jQuery) {
9585
  var FormField = React.createClass({
9586
  displayName: 'FormField',
9587
 
10130
  year: _this2.state.year,
10131
  placeholder: _this2.props.field.year_placeholder
10132
  });
 
10133
 
10134
  case 'MM':
10135
  return React.createElement(FormFieldDateMonth, {
10141
  monthNames: monthNames,
10142
  placeholder: _this2.props.field.month_placeholder
10143
  });
 
10144
 
10145
  case 'DD':
10146
  return React.createElement(FormFieldDateDay, {
10151
  day: _this2.state.day,
10152
  placeholder: _this2.props.field.day_placeholder
10153
  });
 
10154
  }
10155
  });
10156
 
35257
 
35258
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
35259
 
35260
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(180), __webpack_require__(278), __webpack_require__(274), __webpack_require__(289), __webpack_require__(514), __webpack_require__(511), __webpack_require__(515), __webpack_require__(425), __webpack_require__(428), __webpack_require__(273)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, _, MailPoet, Form, StandardNewsletterFields, NotificationNewsletterFields, WelcomeNewsletterFields, Breadcrumb, HelpTooltip, jQuery) {
35261
 
35262
  var NewsletterSend = React.createClass({
35263
  displayName: 'NewsletterSend',
35572
 
35573
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35574
 
35575
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(274), __webpack_require__(422), __webpack_require__(512), __webpack_require__(278)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MailPoet, Hooks, Scheduling, _) {
35576
+
35577
+ var fields = [{
35578
+ name: 'subject',
35579
+ label: MailPoet.I18n.t('subjectLine'),
35580
+ tip: MailPoet.I18n.t('postNotificationSubjectLineTip'),
35581
+ type: 'text',
35582
+ validation: {
35583
+ 'data-parsley-required': true,
35584
+ 'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
35585
+ }
35586
+ }, {
35587
+ name: 'options',
35588
+ label: MailPoet.I18n.t('selectFrequency'),
35589
+ type: 'reactComponent',
35590
+ component: Scheduling
35591
+ }, {
35592
+ name: 'segments',
35593
+ label: MailPoet.I18n.t('segments'),
35594
+ tip: MailPoet.I18n.t('segmentsTip'),
35595
+ type: 'selection',
35596
+ placeholder: MailPoet.I18n.t('selectSegmentPlaceholder'),
35597
+ id: 'mailpoet_segments',
35598
+ api_version: window.mailpoet_api_version,
35599
+ endpoint: 'segments',
35600
+ multiple: true,
35601
+ filter: function filter(segment) {
35602
+ return !!!segment.deleted_at;
35603
+ },
35604
+ getLabel: function getLabel(segment) {
35605
+ return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
35606
+ },
35607
+ transformChangedValue: function transformChangedValue(segment_ids) {
35608
+ var all_segments = this.state.items;
35609
+ return _.map(segment_ids, function (id) {
35610
+ return _.find(all_segments, function (segment) {
35611
+ return segment.id === id;
35612
+ });
35613
+ });
35614
+ },
35615
+ validation: {
35616
+ 'data-parsley-required': true,
35617
+ 'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
35618
+ }
35619
+ }, {
35620
+ name: 'sender',
35621
+ label: MailPoet.I18n.t('sender'),
35622
+ tip: MailPoet.I18n.t('senderTip'),
35623
+ fields: [{
35624
+ name: 'sender_name',
35625
+ type: 'text',
35626
+ placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
35627
+ validation: {
35628
+ 'data-parsley-required': true
35629
+ }
35630
+ }, {
35631
+ name: 'sender_address',
35632
+ type: 'text',
35633
+ placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
35634
+ validation: {
35635
+ 'data-parsley-required': true,
35636
+ 'data-parsley-type': 'email'
35637
+ }
35638
+ }]
35639
+ }, {
35640
+ name: 'reply-to',
35641
+ label: MailPoet.I18n.t('replyTo'),
35642
+ tip: MailPoet.I18n.t('replyToTip'),
35643
+ inline: true,
35644
+ fields: [{
35645
+ name: 'reply_to_name',
35646
+ type: 'text',
35647
+ placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
35648
+ }, {
35649
+ name: 'reply_to_address',
35650
+ type: 'text',
35651
+ placeholder: MailPoet.I18n.t('replyToAddressPlaceholder')
35652
+ }]
35653
+ }];
35654
+
35655
+ fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
35656
+
35657
+ return {
35658
+ getFields: function getFields() {
35659
+ return fields;
35660
+ },
35661
+ getSendButtonOptions: function getSendButtonOptions() {
35662
+ return {
35663
+ value: MailPoet.I18n.t('activate')
35664
+ };
35665
+ }
35666
+ };
35667
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
35668
+
35669
+ /***/ },
35670
+ /* 512 */
35671
+ /***/ function(module, exports, __webpack_require__) {
35672
+
35673
+ 'use strict';
35674
+
35675
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
35676
+
35677
+ var _underscore = __webpack_require__(278);
35678
+
35679
+ var _underscore2 = _interopRequireDefault(_underscore);
35680
+
35681
+ var _react = __webpack_require__(2);
35682
+
35683
+ var _react2 = _interopRequireDefault(_react);
35684
+
35685
+ var _formFieldsSelectJsx = __webpack_require__(293);
35686
+
35687
+ var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
35688
+
35689
+ var _newslettersSchedulingCommonJsx = __webpack_require__(513);
35690
+
35691
+ var intervalField = {
35692
+ name: 'intervalType',
35693
+ values: _newslettersSchedulingCommonJsx.intervalValues
35694
+ };
35695
+
35696
+ var timeOfDayField = {
35697
+ name: 'timeOfDay',
35698
+ values: _newslettersSchedulingCommonJsx.timeOfDayValues
35699
+ };
35700
+
35701
+ var weekDayField = {
35702
+ name: 'weekDay',
35703
+ values: _newslettersSchedulingCommonJsx.weekDayValues
35704
+ };
35705
+
35706
+ var monthDayField = {
35707
+ name: 'monthDay',
35708
+ values: _newslettersSchedulingCommonJsx.monthDayValues
35709
+ };
35710
+
35711
+ var nthWeekDayField = {
35712
+ name: 'nthWeekDay',
35713
+ values: _newslettersSchedulingCommonJsx.nthWeekDayValues
35714
+ };
35715
+
35716
+ var NotificationScheduling = _react2['default'].createClass({
35717
+ displayName: 'NotificationScheduling',
35718
+
35719
+ _getCurrentValue: function _getCurrentValue() {
35720
+ return this.props.item[this.props.field.name] || {};
35721
+ },
35722
+ handleValueChange: function handleValueChange(name, value) {
35723
+ var oldValue = this._getCurrentValue();
35724
+ var newValue = {};
35725
+
35726
+ newValue[name] = value;
35727
+
35728
+ return this.props.onValueChange({
35729
+ target: {
35730
+ name: this.props.field.name,
35731
+ value: _underscore2['default'].extend({}, oldValue, newValue)
35732
+ }
35733
+ });
35734
+ },
35735
+ handleIntervalChange: function handleIntervalChange(event) {
35736
+ return this.handleValueChange('intervalType', event.target.value);
35737
+ },
35738
+ handleTimeOfDayChange: function handleTimeOfDayChange(event) {
35739
+ return this.handleValueChange('timeOfDay', event.target.value);
35740
+ },
35741
+ handleWeekDayChange: function handleWeekDayChange(event) {
35742
+ return this.handleValueChange('weekDay', event.target.value);
35743
+ },
35744
+ handleMonthDayChange: function handleMonthDayChange(event) {
35745
+ return this.handleValueChange('monthDay', event.target.value);
35746
+ },
35747
+ handleNthWeekDayChange: function handleNthWeekDayChange(event) {
35748
+ return this.handleValueChange('nthWeekDay', event.target.value);
35749
+ },
35750
+ render: function render() {
35751
+ var value = this._getCurrentValue();
35752
+ var timeOfDaySelection = undefined;
35753
+ var weekDaySelection = undefined;
35754
+ var monthDaySelection = undefined;
35755
+ var nthWeekDaySelection = undefined;
35756
+
35757
+ if (value.intervalType !== 'immediately') {
35758
+ timeOfDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
35759
+ field: timeOfDayField,
35760
+ item: this._getCurrentValue(),
35761
+ onValueChange: this.handleTimeOfDayChange });
35762
+ }
35763
+
35764
+ if (value.intervalType === 'weekly' || value.intervalType === 'nthWeekDay') {
35765
+ weekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
35766
+ field: weekDayField,
35767
+ item: this._getCurrentValue(),
35768
+ onValueChange: this.handleWeekDayChange });
35769
+ }
35770
+
35771
+ if (value.intervalType === 'monthly') {
35772
+ monthDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
35773
+ field: monthDayField,
35774
+ item: this._getCurrentValue(),
35775
+ onValueChange: this.handleMonthDayChange });
35776
+ }
35777
+
35778
+ if (value.intervalType === 'nthWeekDay') {
35779
+ nthWeekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
35780
+ field: nthWeekDayField,
35781
+ item: this._getCurrentValue(),
35782
+ onValueChange: this.handleNthWeekDayChange });
35783
+ }
35784
+
35785
+ return _react2['default'].createElement(
35786
+ 'div',
35787
+ null,
35788
+ _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
35789
+ field: intervalField,
35790
+ item: this._getCurrentValue(),
35791
+ onValueChange: this.handleIntervalChange }),
35792
+ nthWeekDaySelection,
35793
+ monthDaySelection,
35794
+ weekDaySelection,
35795
+ timeOfDaySelection
35796
+ );
35797
+ }
35798
+ });
35799
+
35800
+ module.exports = NotificationScheduling;
35801
+
35802
+ /***/ },
35803
+ /* 513 */,
35804
+ /* 514 */
35805
+ /***/ function(module, exports, __webpack_require__) {
35806
+
35807
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
35808
+
35809
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
35810
 
35811
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
36190
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
36191
 
36192
  /***/ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36193
  /* 515 */
36194
  /***/ function(module, exports, __webpack_require__) {
36195
 
36324
 
36325
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
36326
 
36327
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(278), __webpack_require__(2), __webpack_require__(180), __webpack_require__(274), __webpack_require__(512), __webpack_require__(425)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, React, Router, MailPoet, Scheduling, Breadcrumb) {
36328
 
36329
  var field = {
36330
  name: 'options',
36640
  ),
36641
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'standard' }),
36642
  _react2['default'].createElement(_listingListingJsx2['default'], {
36643
+ limit: window.mailpoet_listing_per_page,
36644
  location: this.props.location,
36645
  params: this.props.params,
36646
  endpoint: 'newsletters',
37517
  ),
37518
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'welcome' }),
37519
  _react2['default'].createElement(_listingListingJsx2['default'], {
37520
+ limit: window.mailpoet_listing_per_page,
37521
  location: this.props.location,
37522
  params: this.props.params,
37523
  endpoint: 'newsletters',
37571
 
37572
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
37573
 
37574
+ var _newslettersSchedulingCommonJsx = __webpack_require__(513);
37575
 
37576
  var messages = {
37577
  onTrash: function onTrash(response) {
37863
  ),
37864
  _react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'notification' }),
37865
  _react2['default'].createElement(_listingListingJsx2['default'], {
37866
+ limit: window.mailpoet_listing_per_page,
37867
  location: this.props.location,
37868
  params: this.props.params,
37869
  endpoint: 'newsletters',
38032
  _mailpoet2['default'].I18n.t('backToPostNotifications')
38033
  ),
38034
  _react2['default'].createElement(_listingListingJsx2['default'], {
38035
+ limit: window.mailpoet_listing_per_page,
38036
  location: this.props.location,
38037
  params: this.props.params,
38038
  endpoint: 'newsletters',
38407
  )
38408
  ),
38409
  _react2['default'].createElement(_listingListingJsx2['default'], {
38410
+ limit: window.mailpoet_listing_per_page,
38411
  location: this.props.location,
38412
  params: this.props.params,
38413
  messages: messages,
38509
 
38510
  var _history = __webpack_require__(243);
38511
 
38512
+ var _listJsx = __webpack_require__(533);
38513
 
38514
+ var _listJsx2 = _interopRequireDefault(_listJsx);
38515
 
38516
  var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
38517
 
38532
  _react2['default'].createElement(
38533
  _reactRouter.Route,
38534
  { path: '/', component: App },
38535
+ _react2['default'].createElement(_reactRouter.IndexRoute, { component: _listJsx2['default'] }),
38536
+ _react2['default'].createElement(_reactRouter.Route, { path: '*', component: _listJsx2['default'] })
38537
  )
38538
  ), container);
38539
  }
38550
 
38551
  var _react2 = _interopRequireDefault(_react);
38552
 
 
 
 
 
38553
  var _classnames = __webpack_require__(275);
38554
 
38555
  var _classnames2 = _interopRequireDefault(_classnames);
38558
 
38559
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
38560
 
38561
+ var _jquery = __webpack_require__(273);
38562
+
38563
+ var _jquery2 = _interopRequireDefault(_jquery);
38564
+
38565
+ var _listingListingJsx = __webpack_require__(276);
38566
+
38567
+ var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
38568
+
38569
  var columns = [{
38570
  name: 'name',
38571
  label: _mailpoet2['default'].I18n.t('formName'),
38669
  endpoint: 'forms',
38670
  action: 'create'
38671
  }).done(function (response) {
38672
+ window.location = window.mailpoet_form_edit_url + response.data.id;
38673
  }).fail(function (response) {
38674
  if (response.errors.length > 0) {
38675
  _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
38681
  renderItem: function renderItem(form, actions) {
38682
  var row_classes = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
38683
 
38684
+ var segments = window.mailpoet_segments.filter(function (segment) {
38685
+ return _jquery2['default'].inArray(segment.id, form.segments) !== -1;
38686
  }).map(function (segment) {
38687
  return segment.name;
38688
  }).join(', ');
38752
  )
38753
  ),
38754
  _react2['default'].createElement(_listingListingJsx2['default'], {
38755
+ limit: window.mailpoet_listing_per_page,
38756
  location: this.props.location,
38757
  params: this.props.params,
38758
  messages: messages,
41151
  /***/ function(module, exports, __webpack_require__) {
41152
 
41153
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
41154
+ __webpack_require__(535),
41155
+ __webpack_require__(278),
41156
+ __webpack_require__(273),
41157
+ __webpack_require__(274),
41158
+ __webpack_require__(543),
41159
+ __webpack_require__(544),
41160
+ __webpack_require__(545),
41161
+ __webpack_require__(297),
41162
+ __webpack_require__(287)
41163
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
41164
  Backbone,
41165
  _,
41166
  jQuery,
41177
  jQuery(document).ready(function () {
41178
  jQuery('input[name="select_method"]').attr('checked', false);
41179
  // configure router
41180
+ var router = new (Backbone.Router.extend({
41181
  routes: {
41182
  '': 'home',
41183
  step1: 'step1',
41201
  */
41202
  router.on('route:step1', function () {
41203
  // set or reset temporary validation rule on all columns
41204
+ window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
41205
  var col = column;
41206
  col.validation_rule = false;
41207
  return col;
41208
  });
41209
 
41210
+ if (typeof (window.importData.step1) !== 'undefined') {
41211
  showCurrentStep();
41212
  return;
41213
  }
41219
 
41220
  // define reusable variables
41221
  var currentStepE = jQuery(location.hash),
41222
+ methodSelectionElement = jQuery('#select_method'),
41223
+ pasteInputElement = jQuery('#paste_input'),
41224
+ pasteInputPlaceholderElement =
41225
  pasteInputElement.data('placeholder').replace(/\\n/g, '\n'),
41226
+ pasteProcessButtonElement =
41227
  jQuery('#method_paste > div.mailpoet_method_process')
41228
  .find('a.mailpoet_process'),
41229
+ mailChimpKeyInputElement = jQuery('#mailchimp_key'),
41230
+ mailChimpKeyVerifyButtonElement = jQuery('#mailchimp_key_verify'),
41231
+ mailChimpListsContainerElement = jQuery('#mailchimp_lists'),
41232
+ mailChimpProcessButtonElement =
41233
  jQuery('#method_mailchimp > div.mailpoet_method_process')
41234
  .find('a.mailpoet_process'),
41235
+ uploadElement = jQuery('#file_local'),
41236
+ uploadProcessButtonElement =
41237
  jQuery('#method_file > div.mailpoet_method_process')
41238
  .find('a.mailpoet_process');
41239
 
41241
  methodSelectionElement.change(function () {
41242
  MailPoet.Notice.hide();
41243
  var available_methods = jQuery(':radio[name="select_method"]'),
41244
+ selected_method =
41245
  available_methods.index(available_methods.filter(':checked'));
41246
  // hide all methods
41247
  currentStepE.find('.inside')
41284
  MailPoet.Notice.hide();
41285
  // get an approximate size of textarea paste in bytes
41286
  var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1;
41287
+ if (pasteSize > window.maxPostSizeBytes) {
41288
  MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice'));
41289
  return;
41290
  }
41300
  */
41301
  uploadElement.change(function () {
41302
  MailPoet.Notice.hide();
41303
+ var ext = this.value.match(/\.(.+)$/);
41304
+ if (ext === null || ext[1].toLowerCase() !== 'csv') {
41305
+ this.value = '';
41306
+ MailPoet.Notice.error(MailPoet.I18n.t('wrongFileFormat'));
41307
+ }
41308
 
41309
  toggleNextStepButton(
41310
  uploadProcessButtonElement,
41387
  }).always(function(response) {
41388
  MailPoet.Modal.loading(false);
41389
  }).done(function(response) {
41390
+ window.importData.step1 = response.data;
41391
  MailPoet.trackEvent('Subscribers import started', {
41392
  source: 'MailChimp',
41393
  'MailPoet Free version': window.mailpoet_version
41445
 
41446
  function parseCSV(isFile) {
41447
  var processedSubscribers = [],
41448
+ parsedEmails = [],
41449
+ duplicateEmails = [],
41450
+ invalidEmails = [],
41451
+ emailColumnPosition = null,
41452
+ columnCount = null,
41453
+ isHeaderFound = false,
41454
+ advancedOptionHeader = true,
41455
+ advancedOptionDelimiter = '',
41456
+ advancedOptionNewline = '',
41457
+ advancedOptionComments = false,
41458
  // trim spaces, commas, periods,
41459
  // single/double quotes and convert to lowercase
41460
+ detectAndCleanupEmail = function (emailString) {
41461
+ var test;
41462
  // decode HTML entities
41463
+ var email = jQuery('<div />').html(emailString).text();
41464
+ email = email
41465
  .toLowerCase()
41466
  // left/right trim spaces, punctuation (e.g., " 'email@email.com'; ")
41467
  // right trim non-printable characters (e.g., "email@email.com�")
41470
  // remove urlencoded characters
41471
  .replace(/\s+|%\d+|,+/g, '');
41472
  // detect e-mails that will be otherwise rejected by email regex
41473
+ test = /<(.*?)>/.exec(email);
41474
+ if (test) {
41475
  // is the email inside angle brackets (e.g., 'some@email.com <some@email.com>')?
41476
+ email = test[1].trim();
41477
+ }
41478
+ test = /mailto:(?:\s+)?(.*)/.exec(email);
41479
+ if (test) {
41480
  // is the email in 'mailto:email' format?
41481
+ email = test[1].trim();
41482
+ }
41483
  // test for valid characters using WP's rule (https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/formatting.php#L2902)
41484
+ if (!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\-@]+$/.test(email) ) {
41485
+ return false;
41486
+ }
41487
+ return email;
41488
+ };
41489
 
41490
  return {
41491
  skipEmptyLines: true,
41518
  for (var column in rowData) {
41519
  var email = detectAndCleanupEmail(rowData[column]);
41520
  if (emailColumnPosition === null
41521
+ && window.emailRegex.test(email)) {
41522
  emailColumnPosition = column;
41523
  parsedEmails[email] = true; // add current e-mail to an object index
41524
  rowData[column] = email;
41537
  if (_.has(parsedEmails, email)) {
41538
  duplicateEmails.push(email);
41539
  }
41540
+ else if (!window.emailRegex.test(email)) {
41541
  invalidEmails.push(rowData[emailColumnPosition]);
41542
  }
41543
  // if we haven't yet processed this e-mail and it passed
41560
  ) {
41561
  // since we assume that the header line is always present, we need
41562
  // to detect the header by checking if it contains a valid e-mail address
41563
+ window.importData.step1 = {
41564
+ header: (!window.emailRegex.test(
41565
  processedSubscribers[0][emailColumnPosition])
41566
  ) ? processedSubscribers.shift() : null,
41567
  subscribers: processedSubscribers,
41588
  });
41589
 
41590
  router.on('route:step2', function () {
41591
+ if (typeof (window.importData.step1) === 'undefined') {
41592
  router.navigate('step1', {trigger: true});
41593
  return;
41594
  }
41595
  // define reusable variables
41596
  var nextStepButton = jQuery('#step2_process'),
41597
+ previousStepButton = jQuery('#return_to_step1'),
41598
  // create a copy of subscribers object for further manipulation
41599
+ subscribers = jQuery.extend(true, {}, window.importData.step1),
41600
+ subscribersDataTemplate =
41601
  Handlebars
41602
  .compile(jQuery('#subscribers_data_template')
41603
  .html()),
41604
+ subscribersDataTemplatePartial =
41605
  Handlebars
41606
  .compile(jQuery('#subscribers_data_template_partial')
41607
  .html()),
41608
+ subscribersDataParseResultsTemplate =
41609
  Handlebars
41610
  .compile(jQuery('#subscribers_data_parse_results_template')
41611
  .html()),
41612
+ segmentSelectElement = jQuery('#mailpoet_segments_select'),
41613
+ maxRowsToShow = 10,
41614
+ filler = '. . .',
41615
  // create an array of filler data with the same number of
41616
  // elements as in the subscribers' data row
41617
+ fillerArray = Array.apply(
41618
  null,
41619
  new Array(subscribers.subscribers[0].length)
41620
  ).map(String.prototype.valueOf, filler),
41621
+ fillerPosition;
41622
 
41623
  showCurrentStep();
41624
 
41676
  });
41677
 
41678
  // show available segments
41679
+ if (window.mailpoetSegments.length) {
41680
  jQuery('.mailpoet_segments').show();
41681
  }
41682
  else {
41749
  description: segmentDescription
41750
  }
41751
  }).done(function(response) {
41752
+ window.mailpoetSegments.push({
41753
  id: response.data.id,
41754
  name: response.data.name,
41755
  subscriberCount: 0
41762
  selected_values.push(response.data.id);
41763
  }
41764
 
41765
+ enableSegmentSelection(window.mailpoetSegments);
41766
  segmentSelectElement.val(selected_values).trigger('change');
41767
  jQuery('.mailpoet_segments:hidden').show();
41768
  jQuery('.mailpoet_no_segments:visible').hide();
41793
  'show_and_match_columns',
41794
  function (subscribers, options) {
41795
  var displayedColumns = [],
41796
+ displayedColumnsIds = [];
41797
  // go through all elements of the first row in subscribers data
41798
  for (var i in subscribers.subscribers[0]) {
41799
  var columnData = subscribers.subscribers[0][i],
41800
+ columnId = 'ignore'; // set default column type
41801
  // if the column is not undefined and has a valid e-mail, set type as email
41802
+ if (columnData % 1 !== 0 && window.emailRegex.test(columnData)) {
41803
  columnId = 'email';
41804
  } else if (subscribers.header) {
41805
  var headerName = subscribers.header[i],
41806
+ headerNameMatch = window.mailpoetColumns.map(function (el) {
41807
+ return el.name;
41808
+ }).indexOf(headerName);
41809
  // set column type using header
41810
  if (headerNameMatch !== -1) {
41811
+ columnId = window.mailpoetColumns[headerNameMatch].id;
41812
  }// set column type using header name
41813
  else if (headerName) {
41814
  if (/first|first name|given name/i.test(headerName)) {
41873
  // filter displayed data
41874
  jQuery('select.mailpoet_subscribers_column_data_match')
41875
  .select2({
41876
+ data: window.mailpoetColumnsSelect2,
41877
  width: '15em',
41878
  templateResult: function (item) {
41879
  return item.name;
41884
  })
41885
  .on('select2:selecting', function (selectEvent) {
41886
  var selectElement = this,
41887
+ selectedOptionId = selectEvent.params.args.data.id;
41888
  // CREATE CUSTOM FIELD
41889
  if (selectedOptionId === 'create') {
41890
  selectEvent.preventDefault();
41912
  custom: true
41913
  };
41914
  // if this is the first custom column, create an "optgroup"
41915
+ if (window.mailpoetColumnsSelect2.length === 2) {
41916
+ window.mailpoetColumnsSelect2.push({
41917
  name: MailPoet.I18n.t('userColumns'),
41918
  children: []
41919
  });
41920
  }
41921
+ window.mailpoetColumnsSelect2[2].children.push(new_column_data);
41922
+ window.mailpoetColumns.push(new_column_data);
41923
  jQuery('select.mailpoet_subscribers_column_data_match')
41924
  .each(function () {
41925
  jQuery(this)
41926
  .html('')
41927
  .select2('destroy')
41928
  .select2({
41929
+ data: window.mailpoetColumnsSelect2,
41930
  width: '15em',
41931
  templateResult: function (item) {
41932
  return item.name;
41958
  jQuery('select.mailpoet_subscribers_column_data_match')
41959
  .each(function () {
41960
  var element = this,
41961
+ elementId = jQuery(element).val();
41962
  // if another column has the same value and it's not an 'ignore', prompt user
41963
  if (elementId === selectedOptionId
41964
  && elementId !== 'ignore') {
41975
  })
41976
  .on('select2:select', function (selectEvent) {
41977
  var selectElement = this,
41978
+ selectedOptionId = selectEvent.params.data.id;
41979
  jQuery(selectElement).data('column-id', selectedOptionId);
41980
  filterSubscribers();
41981
  });
41986
  '[data-id="notice_invalidEmail"], [data-id="notice_invalidDate"]')
41987
  .remove();
41988
  var subscribersClone = jQuery.extend(true, {}, subscribers),
41989
+ preventNextStep = false,
41990
+ displayedColumns = jQuery.map(
41991
  jQuery('.mailpoet_subscribers_column_data_match'), function (element, elementIndex) {
41992
  var columnId = jQuery(element).data('column-id');
41993
  var validationRule = jQuery(element).data('validation-rule');
41995
  return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
41996
  });
41997
  // iterate through the object of mailpoet columns
41998
+ jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
41999
  // check if the column id matches the selected id of one of the
42000
  // subscriber's data columns
42001
  var matchedColumn = _.find(displayedColumns, function(data) { return data.id === column.id; });
42002
  // EMAIL filter: if the first value in the column doesn't have a valid
42003
  // email, hide the next button
42004
  if (column.id === 'email') {
42005
+ if (!window.emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) {
42006
  preventNextStep = true;
42007
  if (!jQuery('[data-id="notice_invalidEmail"]').length) {
42008
  MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), {
42146
  return res;
42147
  }, []);
42148
  },
42149
+ subscribers = splitSubscribers(window.importData.step1.subscribers, batchSize);
42150
 
42151
  _.each(jQuery('select.mailpoet_subscribers_column_data_match'),
42152
  function (column, columnIndex) {
42170
  subscribers: subscribers[batchNumber],
42171
  timestamp: timestamp,
42172
  segments: segmentSelectElement.val(),
42173
+ updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes')
42174
  })
42175
  }).done(function(response) {
42176
  importResults.created += response.data.created;
42200
  );
42201
  }
42202
  else {
42203
+ window.mailpoetSegments = importResults.segments;
42204
  importResults.segments = _.map(segmentSelectElement.select2('data'),
42205
  function (data) {
42206
  return data.name;
42207
  });
42208
+ window.importData.step2 = importResults;
42209
+ enableSegmentSelection(window.mailpoetSegments);
42210
  router.navigate('step3', {trigger: true});
42211
  }
42212
  });
42213
  });
42214
 
42215
  filterSubscribers();
42216
+ enableSegmentSelection(window.mailpoetSegments);
42217
  });
42218
 
42219
  router.on('route:step3', function () {
42220
+ if (typeof (window.importData.step2) === 'undefined') {
42221
  router.navigate('step2', {trigger: true});
42222
  return;
42223
  }
42224
 
42225
  showCurrentStep();
42226
 
42227
+ if (window.importData.step2.errors.length > 0) {
42228
+ MailPoet.Notice.error(_.flatten(window.importData.step2.errors));
42229
  }
42230
 
42231
  MailPoet.trackEvent('Subscribers import finished', {
42232
+ 'Subscribers created': window.importData.step2.created,
42233
+ 'Subscribers updated': window.importData.step2.updated,
42234
  'MailPoet Free version': window.mailpoet_version
42235
  });
42236
 
42239
  Handlebars
42240
  .compile(jQuery('#subscribers_data_import_results_template')
42241
  .html()),
42242
+ exportMenuElement = jQuery('span.mailpoet_export'),
42243
+ importResults = {
42244
+ created: (window.importData.step2.created)
42245
  ? MailPoet.I18n.t('subscribersCreated')
42246
+ .replace('%1$s', '<strong>' + window.importData.step2.created.toLocaleString() + '</strong>')
42247
+ .replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
42248
  : false,
42249
+ updated: (window.importData.step2.updated)
42250
  ? MailPoet.I18n.t('subscribersUpdated')
42251
+ .replace('%1$s', '<strong>' + window.importData.step2.updated.toLocaleString() + '</strong>')
42252
+ .replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
42253
  : false,
42254
+ no_action: (!window.importData.step2.created && !window.importData.step2.updated),
42255
+ added_to_segment_with_welcome_notification: window.importData.step2.added_to_segment_with_welcome_notification
42256
+ };
42257
 
42258
  jQuery('#subscribers_data_import_results')
42259
  .html(subscribersDataImportResultsTemplate(importResults))
42275
  }
42276
 
42277
  // reset previous step's data so that coming back to this step is prevented
42278
+ window.importData.step2 = undefined;
42279
  });
42280
 
42281
  if (!Backbone.History.started) {
42387
  /***/ function(module, exports, __webpack_require__) {
42388
 
42389
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
42390
+ __webpack_require__(278),
42391
+ __webpack_require__(273),
42392
+ __webpack_require__(274),
42393
+ __webpack_require__(543),
42394
+ __webpack_require__(287)
42395
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
42396
+ _,
42397
+ jQuery,
42398
+ MailPoet,
42399
+ Handlebars,
42400
+ select2
42401
  ) {
42402
  if (!jQuery('#mailpoet_subscribers_export').length) {
42403
  return;
42404
  }
42405
  jQuery(document).ready(function () {
42406
+ if (!window.exportData.segments) {
42407
  return;
42408
  }
42409
  var subscribers_export_template =
42410
  Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
42411
 
42412
  //render template
42413
+ jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(window.exportData));
42414
 
42415
  // define reusable variables
42416
  var segmentsContainerElement = jQuery('#export_lists'),
42417
+ subscriberFieldsContainerElement = jQuery('#export_columns'),
42418
+ exportConfirmedOptionElement = jQuery(':radio[name="option_confirmed"]'),
42419
+ groupBySegmentOptionElement = jQuery(':checkbox[name="option_group_by_list"]'),
42420
+ nextStepButton = jQuery('a.mailpoet_export_process'),
42421
+ renderSegmentsAndFields = function (container, data) {
42422
+ if (container.data('select2')) {
42423
+ container
42424
  .html('')
42425
  .select2('destroy');
42426
+ }
42427
+ container
42428
  .select2({
42429
  data: data,
42430
  width: '20em',
42441
  })
42442
  .on('select2:selecting', function (selectEvent) {
42443
  var selectElement = this,
42444
+ selectedOptionId = selectEvent.params.args.data.id,
42445
+ fieldsToExclude = [
42446
+ 'select',
42447
+ 'deselect'
42448
+ ];
42449
  if (_.contains(fieldsToExclude, selectedOptionId)) {
42450
  selectEvent.preventDefault();
42451
  if (selectedOptionId === 'deselect') {
42463
  }
42464
  })
42465
  .on('change', function () {
42466
+ if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
42467
  ||
42468
+ (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
42469
  ) {
42470
  toggleNextStepButton('on');
42471
  }
42473
  toggleNextStepButton('off');
42474
  }
42475
 
42476
+ if (segmentsContainerElement.select2('data').length > 1 && window.exportData.groupBySegmentOption) {
42477
  jQuery('.mailpoet_group_by_list').show();
42478
  }
42479
+ else if (window.exportData.groupBySegmentOption) {
42480
  jQuery('.mailpoet_group_by_list').hide();
42481
  }
42482
  });
42483
+ };
42484
 
42485
  // set confirmed subscribers export option to false
42486
+ window.exportData.exportConfirmedOption = false;
42487
 
42488
+ renderSegmentsAndFields(subscriberFieldsContainerElement, window.subscriberFieldsSelect2);
42489
+ renderSegmentsAndFields(segmentsContainerElement, window.segments);
42490
 
42491
  subscriberFieldsContainerElement.val([
42492
  'email',
42498
  exportConfirmedOptionElement.change(function () {
42499
  var selectedSegments = segmentsContainerElement.val();
42500
  if (this.value == 1) {
42501
+ window.exportData.exportConfirmedOption = true;
42502
+ renderSegmentsAndFields(segmentsContainerElement, window.segmentsWithConfirmedSubscribers);
42503
  }
42504
  else {
42505
+ window.exportData.exportConfirmedOption = false;
42506
+ renderSegmentsAndFields(segmentsContainerElement, window.segments);
42507
  }
42508
  segmentsContainerElement.val(selectedSegments).trigger('change');
42509
  });
42525
  MailPoet.Modal.loading(true);
42526
  var exportFormat = jQuery(':radio[name="option_format"]:checked').val();
42527
  MailPoet.Ajax.post({
42528
+ api_version: window.mailpoet_api_version,
42529
+ endpoint: 'ImportExport',
42530
+ action: 'processExport',
42531
+ data: JSON.stringify({
42532
+ export_confirmed_option: window.exportData.exportConfirmedOption,
42533
+ export_format_option: exportFormat,
42534
+ group_by_segment_option: (groupBySegmentOptionElement.is(':visible')) ? groupBySegmentOptionElement.prop('checked') : false,
42535
+ segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
42536
+ subscriber_fields: subscriberFieldsContainerElement.val()
42537
+ })
42538
+ }).always(function(response) {
42539
+ MailPoet.Modal.loading(false);
42540
+ }).done(function(response) {
42541
+ var resultMessage = MailPoet.I18n.t('exportMessage')
42542
+ .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
42543
+ .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
42544
+ .replace('[/link]', '</a>');
42545
+ jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
42546
+ window.location.href = response.data.exportFileURL;
42547
+ MailPoet.trackEvent('Subscribers export completed', {
42548
+ 'Total exported': response.data.totalExported,
42549
+ 'Only confirmed?': window.exportData.exportConfirmedOption,
42550
+ 'File Format': exportFormat,
42551
+ 'MailPoet Free version': window.mailpoet_version
42552
+ });
42553
+ }).fail(function(response) {
42554
+ if (response.errors.length > 0) {
42555
+ MailPoet.Notice.error(
42556
  response.errors.map(function(error) { return error.message; }),
42557
  { scroll: true }
42558
  );
42559
+ }
42560
+ });
42561
  });
42562
  });
42563
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
assets/js/{admin_vendor.77fc9795.js → admin_vendor.ee9853ec.js} RENAMED
@@ -34082,8 +34082,7 @@ webpackJsonp([1],[
34082
  /* 510 */,
34083
  /* 511 */,
34084
  /* 512 */,
34085
- /* 513 */,
34086
- /* 514 */
34087
  /***/ function(module, exports, __webpack_require__) {
34088
 
34089
  'use strict';
@@ -34177,6 +34176,7 @@ webpackJsonp([1],[
34177
  exports.nthWeekDayValues = _nthWeekDayValues;
34178
 
34179
  /***/ },
 
34180
  /* 515 */,
34181
  /* 516 */
34182
  /***/ function(module, exports, __webpack_require__) {
@@ -34215,7 +34215,7 @@ webpackJsonp([1],[
34215
 
34216
  var _formFieldsTextJsx2 = _interopRequireDefault(_formFieldsTextJsx);
34217
 
34218
- var _newslettersSchedulingCommonJsx = __webpack_require__(514);
34219
 
34220
  var availableRoles = window.mailpoet_roles || {};
34221
  var availableSegments = _underscore2['default'].filter(window.mailpoet_segments || [], function (segment) {
34082
  /* 510 */,
34083
  /* 511 */,
34084
  /* 512 */,
34085
+ /* 513 */
 
34086
  /***/ function(module, exports, __webpack_require__) {
34087
 
34088
  'use strict';
34176
  exports.nthWeekDayValues = _nthWeekDayValues;
34177
 
34178
  /***/ },
34179
+ /* 514 */,
34180
  /* 515 */,
34181
  /* 516 */
34182
  /***/ function(module, exports, __webpack_require__) {
34215
 
34216
  var _formFieldsTextJsx2 = _interopRequireDefault(_formFieldsTextJsx);
34217
 
34218
+ var _newslettersSchedulingCommonJsx = __webpack_require__(513);
34219
 
34220
  var availableRoles = window.mailpoet_roles || {};
34221
  var availableSegments = _underscore2['default'].filter(window.mailpoet_segments || [], function (segment) {
assets/js/{form_editor.8b0c5294.js → form_editor.c0e36e82.js} RENAMED
@@ -114,7 +114,7 @@ webpackJsonp([2],{
114
  function getHandlers(klass) {
115
  var proto = klass.prototype,
116
  namespace = proto.namespace;
117
- return Object.keys(proto).grep(/^on/).inject($H(), function(handlers, name) {
118
  if(name === 'onDomLoaded') return handlers;
119
  handlers.set(getEventName(name, namespace), getWrapper(proto[name], klass));
120
  return handlers;
@@ -128,7 +128,7 @@ webpackJsonp([2],{
128
  }
129
 
130
  function onDomLoad(selector, klass) {
131
- $$(selector).each(function(element) {
132
  new klass(element).onDomLoaded();
133
  });
134
  }
@@ -137,7 +137,13 @@ webpackJsonp([2],{
137
  if(!this.handlers) this.handlers = {};
138
  if(this.handlers[selector]) return;
139
  var klass = this;
140
- if(this.prototype.onDomLoaded) document.loaded ? onDomLoad(selector, klass) : document.observe('dom:loaded', onDomLoad.curry(selector, klass));
 
 
 
 
 
 
141
  this.handlers[selector] = getHandlers(klass).each(function(handler) {
142
  document.delegate(selector, handler.key, handler.value);
143
  });
@@ -153,12 +159,12 @@ webpackJsonp([2],{
153
  })();
154
 
155
  // override droppables
156
- Object.extend(Droppables, {
157
- deactivate: Droppables.deactivate.wrap(function(proceed, drop, draggable) {
158
  if(drop.onLeave) drop.onLeave(draggable, drop.element);
159
  return proceed(drop);
160
  }),
161
- activate: Droppables.activate.wrap(function(proceed, drop, draggable) {
162
  if(drop.onEnter) drop.onEnter(draggable, drop.element);
163
  return proceed(drop);
164
  }),
@@ -166,14 +172,14 @@ webpackJsonp([2],{
166
  if(!this.drops.length) return;
167
  var drop, affected = [];
168
  this.drops.each(function(drop) {
169
- if(Droppables.isAffected(point, element, drop)) affected.push(drop);
170
  });
171
- if(affected.length > 0) drop = Droppables.findDeepestChild(affected);
172
  if(this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element);
173
  if(drop) {
174
- Position.within(drop.element, point[0], point[1]);
175
- if(drop.onHover) drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
176
- if(drop !== this.last_active) Droppables.activate(drop, element);
177
  }
178
  },
179
  displayArea: function(draggable) {
@@ -222,36 +228,36 @@ webpackJsonp([2],{
222
  // check if the field is unique
223
  if(parseInt(clone.readAttribute('wysija_unique'), 10) === 1) {
224
  // check if the field is already in the queue
225
- $(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove');
226
  }
227
 
228
  // check history size
229
- if($(WysijaHistory.container).select('> div').length >= WysijaHistory.size) {
230
  // remove oldest element (last in the list)
231
- $(WysijaHistory.container).select('> div').last().remove();
232
  }
233
 
234
  // store block in history
235
- $(WysijaHistory.container).insert({
236
  top: clone
237
  });
238
  },
239
  dequeue: function() {
240
  // pop last block off the history
241
- var block = $(WysijaHistory.container).select('div').first();
242
 
243
  if(block !== undefined) {
244
  // insert block back into the editor
245
- $(WysijaForm.options.body).insert({
246
  top: block
247
  });
248
  }
249
  },
250
  clear: function() {
251
- $(WysijaHistory.container).innerHTML = '';
252
  },
253
  remove: function(field) {
254
- $(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove');
255
  }
256
  };
257
 
@@ -295,17 +301,17 @@ webpackJsonp([2],{
295
  },
296
  loading: function(is_loading) {
297
  if(is_loading) {
298
- $(WysijaForm.options.editor).addClassName('loading');
299
- $(WysijaForm.options.toolbar).addClassName('loading');
300
  } else {
301
- $(WysijaForm.options.editor).removeClassName('loading');
302
- $(WysijaForm.options.toolbar).removeClassName('loading');
303
  }
304
  },
305
  loadStatic: function(blocks) {
306
- $A(blocks).each(function(block) {
307
  // create block
308
- WysijaForm.Block.create(block, $('block_placeholder'));
309
  });
310
  },
311
  load: function(data) {
@@ -313,13 +319,13 @@ webpackJsonp([2],{
313
 
314
  // load body
315
  if(data.body !== undefined) {
316
- $A(data.body).each(function(block) {
317
  // create block
318
- WysijaForm.Block.create(block, $('block_placeholder'));
319
  });
320
 
321
  // load settings
322
- var settings_elements = $('mailpoet_form_settings').getElements();
323
  settings_elements.each(function(setting) {
324
  // skip lists
325
  if(setting.name === 'segments') {
@@ -328,7 +334,7 @@ webpackJsonp([2],{
328
  // if the input value is equal to the one stored in the settings
329
  if(setting.value === data.settings[setting.name]) {
330
  // check selected value
331
- $(setting).checked = true;
332
  }
333
  } else if(data.settings[setting.name] !== undefined) {
334
  if(typeof data.settings[setting.name] === 'string') {
@@ -343,10 +349,10 @@ webpackJsonp([2],{
343
  save: function() {
344
  var position = 1,
345
  data = {
346
- name: $F('mailpoet_form_name'),
347
- settings: $('mailpoet_form_settings').serialize(true),
348
  body: [],
349
- styles: (MailPoet.CodeEditor !== undefined) ? MailPoet.CodeEditor.getValue() : null
350
  };
351
  // body
352
  WysijaForm.getBlocks().each(function(b) {
@@ -418,11 +424,11 @@ webpackJsonp([2],{
418
  return data;
419
  },
420
  toggleWidgets: function() {
421
- $$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
422
 
423
  // loop through each unique field already inserted in the editor and disable its toolbar equivalent
424
- $$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function(element) {
425
- var field = $$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
426
  if(field.length > 0) {
427
  field.first().addClassName('disabled');
428
  }
@@ -431,18 +437,18 @@ webpackJsonp([2],{
431
  var hasSegmentSelection = WysijaForm.hasSegmentSelection();
432
 
433
  if(hasSegmentSelection) {
434
- $('mailpoet_form_segments').writeAttribute('required', false).disable();
435
- $('mailpoet_settings_segment_selection').hide();
436
  } else {
437
- $('mailpoet_form_segments').writeAttribute('required', true).enable();
438
- $('mailpoet_settings_segment_selection').show();
439
  }
440
  },
441
  hasSegmentSelection: function() {
442
- return ($$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0);
443
  },
444
  isSegmentSelectionValid: function() {
445
- var segment_selection = $$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0];
446
  if(segment_selection !== undefined) {
447
  var block = WysijaForm.get(segment_selection).block.getData();
448
  return (
@@ -470,7 +476,7 @@ webpackJsonp([2],{
470
 
471
  if(target !== undefined) {
472
  // get placeholders (previous placeholder matches the placeholder linked to the next block)
473
- var block_placeholder = $(target.element.readAttribute('wysija_placeholder')),
474
  previous_placeholder = target.element.previous('.block_placeholder');
475
 
476
  if(block_placeholder !== null) {
@@ -492,18 +498,18 @@ webpackJsonp([2],{
492
  WysijaForm.scroll = document.viewport.getScrollOffsets();
493
  },
494
  hideSettings: function() {
495
- $(WysijaForm.options.container).select('.wysija_settings').invoke('hide');
496
  },
497
  setSettingsPosition: function() {
498
  // get viewport offsets and dimensions
499
  var viewportHeight = document.viewport.getHeight(),
500
  blockPadding = 5;
501
 
502
- $(WysijaForm.options.container).select('.wysija_settings').each(function(element) {
503
  // get parent dimensions and position
504
  var parentDim = element.up('.mailpoet_form_block').getDimensions(),
505
  parentPos = element.up('.mailpoet_form_block').cumulativeOffset(),
506
- is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)) ? true : false,
507
  buttonMargin = 5,
508
  relativeTop = buttonMargin;
509
 
@@ -517,22 +523,22 @@ webpackJsonp([2],{
517
  relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10);
518
  }
519
  // set position for button
520
- $(element).setStyle({
521
  left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px',
522
  top: relativeTop + 'px'
523
  });
524
  });
525
  },
526
  initToolbarPosition: function() {
527
- if(WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt($(WysijaForm.options.container).positionedOffset().top);
528
  if(WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
529
 
530
- if(isRtl) {
531
  if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
532
  } else {
533
- if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt($(WysijaForm.options.container).positionedOffset().left);
534
  }
535
- if(WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + $(WysijaForm.options.container).getDimensions().width + 15);
536
 
537
  },
538
  setToolbarPosition: function() {
@@ -543,13 +549,13 @@ webpackJsonp([2],{
543
  visibility: 'visible'
544
  };
545
 
546
- if(isRtl) {
547
  position.right = WysijaForm.toolbar.x + 'px';
548
  } else {
549
  position.left = WysijaForm.toolbar.x + 'px';
550
  }
551
 
552
- $(WysijaForm.options.toolbar).setStyle(position);
553
  },
554
  updateToolbarPosition: function() {
555
  // init toolbar position (updates scroll and toolbar y)
@@ -561,31 +567,31 @@ webpackJsonp([2],{
561
  if(WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
562
  WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top);
563
  // start effect
564
- WysijaForm.toolbar.effect = new Effect.Move(WysijaForm.options.toolbar, {
565
  x: WysijaForm.toolbar.x,
566
  y: WysijaForm.toolbar.y,
567
  mode: 'absolute',
568
  duration: 0.2
569
  });
570
  } else {
571
- $(WysijaForm.options.toolbar).setStyle({
572
  left: WysijaForm.toolbar.x + 'px',
573
  top: WysijaForm.toolbar.top + 'px'
574
  });
575
  }
576
  },
577
  blockDropOptions: {
578
- accept: $w('mailpoet_form_field'), // acceptable items (classes array)
579
  onEnter: function(draggable, droppable) {
580
- $(droppable).addClassName('hover');
581
  },
582
  onLeave: function(draggable, droppable) {
583
- $(droppable).removeClassName('hover');
584
  },
585
  onDrop: function(draggable, droppable) {
586
  // custom data for images
587
  droppable.fire('wjfe:item:drop', WysijaForm.getFieldData(draggable));
588
- $(droppable).removeClassName('hover');
589
  }
590
  },
591
  hideControls: function() {
@@ -596,7 +602,7 @@ webpackJsonp([2],{
596
  }
597
  },
598
  hideTools: function() {
599
- $$('.wysija_tools').invoke('hide');
600
  WysijaForm.locks.showingTools = false;
601
  },
602
  instances: {},
@@ -611,11 +617,11 @@ webpackJsonp([2],{
611
  return instance;
612
  },
613
  makeDroppable: function() {
614
- Droppables.add('block_placeholder', WysijaForm.blockDropOptions);
615
  },
616
  makeSortable: function() {
617
- var body = $(WysijaForm.options.body);
618
- Sortable.create(body, {
619
  tag: 'div',
620
  only: 'mailpoet_form_block',
621
  scroll: window,
@@ -623,15 +629,15 @@ webpackJsonp([2],{
623
  constraint: 'vertical'
624
 
625
  });
626
- Draggables.removeObserver(body);
627
- Draggables.addObserver({
628
  element: body,
629
  onStart: WysijaForm.startBlockPositions,
630
  onEnd: WysijaForm.setBlockPositions
631
  });
632
  },
633
  hideBlockControls: function() {
634
- $$('.wysija_controls').invoke('hide');
635
  this.getBlockElements().invoke('removeClassName', 'hover');
636
  },
637
  getBlocks: function() {
@@ -640,7 +646,7 @@ webpackJsonp([2],{
640
  });
641
  },
642
  getBlockElements: function() {
643
- return $(WysijaForm.options.container).select('.mailpoet_form_block');
644
  },
645
  startBlockPositions: function(event, target) {
646
  if(target.element.hasClassName('mailpoet_form_block')) {
@@ -688,14 +694,14 @@ webpackJsonp([2],{
688
  }
689
  };
690
 
691
- WysijaForm.DraggableItem = Class.create({
692
  initialize: function(element) {
693
- this.elementType = $(element).readAttribute('wysija_type');
694
- this.element = $(element).down() || $(element);
695
  this.clone = this.cloneElement();
696
  this.insert();
697
  },
698
- STYLES: new Template('position: absolute; top: #{top}px; left: #{left}px;'),
699
  cloneElement: function() {
700
  var clone = this.element.clone(),
701
  offset = this.element.cumulativeOffset(),
@@ -718,27 +724,27 @@ webpackJsonp([2],{
718
  return this.element.up('ul');
719
  },
720
  insert: function() {
721
- $$('body')[0].insert(this.clone);
722
  },
723
  onMousedown: function(event) {
724
- var draggable = new Draggable(this.clone, {
725
  scroll: window,
726
  onStart: function() {
727
- Droppables.displayArea(draggable);
728
  },
729
  onEnd: function(drag) {
730
  drag.destroy();
731
  drag.element.remove();
732
- Droppables.hideArea();
733
  },
734
  starteffect: function(element) {
735
- new Effect.Opacity(element, {
736
  duration: 0.2,
737
  from: element.getOpacity(),
738
  to: 0.7
739
  });
740
  },
741
- endeffect: Prototype.emptyFunction
742
  });
743
  draggable.initDrag(event);
744
  draggable.startDrag(event);
@@ -748,12 +754,12 @@ webpackJsonp([2],{
748
  Object.extend(WysijaForm.DraggableItem, Observable).observe('a[class="mailpoet_form_field"]');
749
 
750
 
751
- WysijaForm.Block = Class.create({
752
  /* Invoked on load */
753
  initialize: function(element) {
754
  info('block -> init');
755
 
756
- this.element = $(element);
757
  this.block = new WysijaForm.Widget(this.element);
758
 
759
  // enable block placeholder
@@ -786,14 +792,14 @@ webpackJsonp([2],{
786
  makeBlockDroppable: function() {
787
  if(this.isBlockDroppableEnabled() === false) {
788
  var block_placeholder = this.getBlockDroppable();
789
- Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions);
790
  block_placeholder.addClassName('enabled');
791
  }
792
  },
793
  removeBlockDroppable: function() {
794
  if(this.isBlockDroppableEnabled()) {
795
  var block_placeholder = this.getBlockDroppable();
796
- Droppables.remove(block_placeholder.identify());
797
  block_placeholder.removeClassName('enabled');
798
  }
799
  },
@@ -809,7 +815,7 @@ webpackJsonp([2],{
809
  createBlockDroppable: function() {
810
  info('block -> createBlockDroppable');
811
  this.element.insert({
812
- before: '<div class=\"block_placeholder\">' + $('block_placeholder').innerHTML + '</div>'
813
  });
814
  return this.element.previous('.block_placeholder');
815
  },
@@ -874,7 +880,7 @@ webpackJsonp([2],{
874
  if(this.settingsButton !== null) {
875
  this.settingsButton.observe('click', function(event) {
876
  // TODO: refactor
877
- var block = $(event.target).up('.mailpoet_form_block') || null;
878
  if(block !== null) {
879
  var field = WysijaForm.getFieldData(block);
880
  this.editSettings();
@@ -890,7 +896,7 @@ webpackJsonp([2],{
890
  // save block in history
891
  WysijaHistory.enqueue(this.element);
892
 
893
- Effect.Fade(this.element.identify(), {
894
  duration: 0.2,
895
  afterFinish: function(effect) {
896
  // remove placeholder
@@ -922,20 +928,20 @@ webpackJsonp([2],{
922
  /* Invoked on item dropped */
923
  WysijaForm.Block.create = function(createBlock, target) {
924
  var block = createBlock;
925
- if($('form_template_' + block.type) === null) {
926
  return false;
927
  }
928
 
929
- var body = $(WysijaForm.options.body),
930
- block_template = Handlebars.compile($('form_template_block').innerHTML),
931
- template = Handlebars.compile($('form_template_' + block.type).innerHTML),
932
  output = '';
933
 
934
  if(block.type === 'segment') {
935
  if(block.params.values === undefined) {
936
- var settings_segments = jQuery('#mailpoet_form_segments').val();
937
  if(settings_segments !== null && settings_segments.length > 0){
938
- block.params.values = mailpoet_segments.filter(function(segment) {
939
  return (settings_segments.indexOf(segment.id) !== -1);
940
  });
941
  }
@@ -990,10 +996,10 @@ webpackJsonp([2],{
990
  });
991
 
992
  /* Form Widget */
993
- WysijaForm.Widget = Class.create(WysijaForm.Block, {
994
  initialize: function(element) {
995
  info('widget -> init');
996
- this.element = $(element);
997
  return this;
998
  },
999
  setup: function() {
@@ -1012,7 +1018,7 @@ webpackJsonp([2],{
1012
  },
1013
  setData: function(data) {
1014
  var current_data = this.getData(),
1015
- params = $H(current_data.params).merge(data.params).toObject();
1016
 
1017
  // update type if it changed
1018
  if(data.type !== undefined && data.type !== current_data.type) {
@@ -1041,9 +1047,9 @@ webpackJsonp([2],{
1041
  this.setData(data);
1042
  var options = this.getData();
1043
  // redraw block
1044
- var block_template = Handlebars.compile($('form_template_block').innerHTML),
1045
- template = Handlebars.compile($('form_template_' + options.type).innerHTML),
1046
- data = $H(options).merge({
1047
  template: template(options)
1048
  }).toObject();
1049
  this.element.replace(block_template(data));
@@ -1051,12 +1057,12 @@ webpackJsonp([2],{
1051
  WysijaForm.init();
1052
  },
1053
  editSettings: function() {
1054
- MailPoet.Modal.popup({
1055
- title: MailPoet.I18n.t('editFieldSettings'),
1056
- template: jQuery('#form_template_field_settings').html(),
1057
  data: this.getData(),
1058
  onSuccess: function() {
1059
- var data = jQuery('#form_field_settings').serializeObject();
1060
  this.redraw(data);
1061
  }.bind(this)
1062
  });
114
  function getHandlers(klass) {
115
  var proto = klass.prototype,
116
  namespace = proto.namespace;
117
+ return Object.keys(proto).grep(/^on/).inject(window.$H(), function(handlers, name) {
118
  if(name === 'onDomLoaded') return handlers;
119
  handlers.set(getEventName(name, namespace), getWrapper(proto[name], klass));
120
  return handlers;
128
  }
129
 
130
  function onDomLoad(selector, klass) {
131
+ window.$$(selector).each(function(element) {
132
  new klass(element).onDomLoaded();
133
  });
134
  }
137
  if(!this.handlers) this.handlers = {};
138
  if(this.handlers[selector]) return;
139
  var klass = this;
140
+ if(this.prototype.onDomLoaded) {
141
+ if(document.loaded) {
142
+ onDomLoad(selector, klass);
143
+ } else {
144
+ document.observe('dom:loaded', onDomLoad.curry(selector, klass));
145
+ }
146
+ }
147
  this.handlers[selector] = getHandlers(klass).each(function(handler) {
148
  document.delegate(selector, handler.key, handler.value);
149
  });
159
  })();
160
 
161
  // override droppables
162
+ Object.extend(window.Droppables, {
163
+ deactivate: window.Droppables.deactivate.wrap(function(proceed, drop, draggable) {
164
  if(drop.onLeave) drop.onLeave(draggable, drop.element);
165
  return proceed(drop);
166
  }),
167
+ activate: window.Droppables.activate.wrap(function(proceed, drop, draggable) {
168
  if(drop.onEnter) drop.onEnter(draggable, drop.element);
169
  return proceed(drop);
170
  }),
172
  if(!this.drops.length) return;
173
  var drop, affected = [];
174
  this.drops.each(function(drop) {
175
+ if(window.Droppables.isAffected(point, element, drop)) affected.push(drop);
176
  });
177
+ if(affected.length > 0) drop = window.Droppables.findDeepestChild(affected);
178
  if(this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element);
179
  if(drop) {
180
+ window.Position.within(drop.element, point[0], point[1]);
181
+ if(drop.onHover) drop.onHover(element, drop.element, window.Position.overlap(drop.overlap, drop.element));
182
+ if(drop !== this.last_active) window.Droppables.activate(drop, element);
183
  }
184
  },
185
  displayArea: function(draggable) {
228
  // check if the field is unique
229
  if(parseInt(clone.readAttribute('wysija_unique'), 10) === 1) {
230
  // check if the field is already in the queue
231
+ window.$(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove');
232
  }
233
 
234
  // check history size
235
+ if(window.$(WysijaHistory.container).select('> div').length >= WysijaHistory.size) {
236
  // remove oldest element (last in the list)
237
+ window.$(WysijaHistory.container).select('> div').last().remove();
238
  }
239
 
240
  // store block in history
241
+ window.$(WysijaHistory.container).insert({
242
  top: clone
243
  });
244
  },
245
  dequeue: function() {
246
  // pop last block off the history
247
+ var block = window.$(WysijaHistory.container).select('div').first();
248
 
249
  if(block !== undefined) {
250
  // insert block back into the editor
251
+ window.$(WysijaForm.options.body).insert({
252
  top: block
253
  });
254
  }
255
  },
256
  clear: function() {
257
+ window.$(WysijaHistory.container).innerHTML = '';
258
  },
259
  remove: function(field) {
260
+ window.$(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove');
261
  }
262
  };
263
 
301
  },
302
  loading: function(is_loading) {
303
  if(is_loading) {
304
+ window.$(WysijaForm.options.editor).addClassName('loading');
305
+ window.$(WysijaForm.options.toolbar).addClassName('loading');
306
  } else {
307
+ window.$(WysijaForm.options.editor).removeClassName('loading');
308
+ window.$(WysijaForm.options.toolbar).removeClassName('loading');
309
  }
310
  },
311
  loadStatic: function(blocks) {
312
+ window.$A(blocks).each(function(block) {
313
  // create block
314
+ WysijaForm.Block.create(block, window.$('block_placeholder'));
315
  });
316
  },
317
  load: function(data) {
319
 
320
  // load body
321
  if(data.body !== undefined) {
322
+ window.$A(data.body).each(function(block) {
323
  // create block
324
+ WysijaForm.Block.create(block, window.$('block_placeholder'));
325
  });
326
 
327
  // load settings
328
+ var settings_elements = window.$('mailpoet_form_settings').getElements();
329
  settings_elements.each(function(setting) {
330
  // skip lists
331
  if(setting.name === 'segments') {
334
  // if the input value is equal to the one stored in the settings
335
  if(setting.value === data.settings[setting.name]) {
336
  // check selected value
337
+ window.$(setting).checked = true;
338
  }
339
  } else if(data.settings[setting.name] !== undefined) {
340
  if(typeof data.settings[setting.name] === 'string') {
349
  save: function() {
350
  var position = 1,
351
  data = {
352
+ name: window.$F('mailpoet_form_name'),
353
+ settings: window.$('mailpoet_form_settings').serialize(true),
354
  body: [],
355
+ styles: (window.MailPoet.CodeEditor !== undefined) ? window.MailPoet.CodeEditor.getValue() : null
356
  };
357
  // body
358
  WysijaForm.getBlocks().each(function(b) {
424
  return data;
425
  },
426
  toggleWidgets: function() {
427
+ window.$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
428
 
429
  // loop through each unique field already inserted in the editor and disable its toolbar equivalent
430
+ window.$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function(element) {
431
+ var field = window.$$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
432
  if(field.length > 0) {
433
  field.first().addClassName('disabled');
434
  }
437
  var hasSegmentSelection = WysijaForm.hasSegmentSelection();
438
 
439
  if(hasSegmentSelection) {
440
+ window.$('mailpoet_form_segments').writeAttribute('required', false).disable();
441
+ window.$('mailpoet_settings_segment_selection').hide();
442
  } else {
443
+ window.$('mailpoet_form_segments').writeAttribute('required', true).enable();
444
+ window.$('mailpoet_settings_segment_selection').show();
445
  }
446
  },
447
  hasSegmentSelection: function() {
448
+ return (window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0);
449
  },
450
  isSegmentSelectionValid: function() {
451
+ var segment_selection = window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0];
452
  if(segment_selection !== undefined) {
453
  var block = WysijaForm.get(segment_selection).block.getData();
454
  return (
476
 
477
  if(target !== undefined) {
478
  // get placeholders (previous placeholder matches the placeholder linked to the next block)
479
+ var block_placeholder = window.$(target.element.readAttribute('wysija_placeholder')),
480
  previous_placeholder = target.element.previous('.block_placeholder');
481
 
482
  if(block_placeholder !== null) {
498
  WysijaForm.scroll = document.viewport.getScrollOffsets();
499
  },
500
  hideSettings: function() {
501
+ window.$(WysijaForm.options.container).select('.wysija_settings').invoke('hide');
502
  },
503
  setSettingsPosition: function() {
504
  // get viewport offsets and dimensions
505
  var viewportHeight = document.viewport.getHeight(),
506
  blockPadding = 5;
507
 
508
+ window.$(WysijaForm.options.container).select('.wysija_settings').each(function(element) {
509
  // get parent dimensions and position
510
  var parentDim = element.up('.mailpoet_form_block').getDimensions(),
511
  parentPos = element.up('.mailpoet_form_block').cumulativeOffset(),
512
+ is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)),
513
  buttonMargin = 5,
514
  relativeTop = buttonMargin;
515
 
523
  relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10);
524
  }
525
  // set position for button
526
+ window.$(element).setStyle({
527
  left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px',
528
  top: relativeTop + 'px'
529
  });
530
  });
531
  },
532
  initToolbarPosition: function() {
533
+ if(WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
534
  if(WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
535
 
536
+ if(window.isRtl) {
537
  if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
538
  } else {
539
+ if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
540
  }
541
+ if(WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + window.$(WysijaForm.options.container).getDimensions().width + 15);
542
 
543
  },
544
  setToolbarPosition: function() {
549
  visibility: 'visible'
550
  };
551
 
552
+ if(window.isRtl) {
553
  position.right = WysijaForm.toolbar.x + 'px';
554
  } else {
555
  position.left = WysijaForm.toolbar.x + 'px';
556
  }
557
 
558
+ window.$(WysijaForm.options.toolbar).setStyle(position);
559
  },
560
  updateToolbarPosition: function() {
561
  // init toolbar position (updates scroll and toolbar y)
567
  if(WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
568
  WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top);
569
  // start effect
570
+ WysijaForm.toolbar.effect = new window.Effect.Move(WysijaForm.options.toolbar, {
571
  x: WysijaForm.toolbar.x,
572
  y: WysijaForm.toolbar.y,
573
  mode: 'absolute',
574
  duration: 0.2
575
  });
576
  } else {
577
+ window.$(WysijaForm.options.toolbar).setStyle({
578
  left: WysijaForm.toolbar.x + 'px',
579
  top: WysijaForm.toolbar.top + 'px'
580
  });
581
  }
582
  },
583
  blockDropOptions: {
584
+ accept: window.$w('mailpoet_form_field'), // acceptable items (classes array)
585
  onEnter: function(draggable, droppable) {
586
+ window.$(droppable).addClassName('hover');
587
  },
588
  onLeave: function(draggable, droppable) {
589
+ window.$(droppable).removeClassName('hover');
590
  },
591
  onDrop: function(draggable, droppable) {
592
  // custom data for images
593
  droppable.fire('wjfe:item:drop', WysijaForm.getFieldData(draggable));
594
+ window.$(droppable).removeClassName('hover');
595
  }
596
  },
597
  hideControls: function() {
602
  }
603
  },
604
  hideTools: function() {
605
+ window.$$('.wysija_tools').invoke('hide');
606
  WysijaForm.locks.showingTools = false;
607
  },
608
  instances: {},
617
  return instance;
618
  },
619
  makeDroppable: function() {
620
+ window.Droppables.add('block_placeholder', WysijaForm.blockDropOptions);
621
  },
622
  makeSortable: function() {
623
+ var body = window.$(WysijaForm.options.body);
624
+ window.Sortable.create(body, {
625
  tag: 'div',
626
  only: 'mailpoet_form_block',
627
  scroll: window,
629
  constraint: 'vertical'
630
 
631
  });
632
+ window.Draggables.removeObserver(body);
633
+ window.Draggables.addObserver({
634
  element: body,
635
  onStart: WysijaForm.startBlockPositions,
636
  onEnd: WysijaForm.setBlockPositions
637
  });
638
  },
639
  hideBlockControls: function() {
640
+ window.$$('.wysija_controls').invoke('hide');
641
  this.getBlockElements().invoke('removeClassName', 'hover');
642
  },
643
  getBlocks: function() {
646
  });
647
  },
648
  getBlockElements: function() {
649
+ return window.$(WysijaForm.options.container).select('.mailpoet_form_block');
650
  },
651
  startBlockPositions: function(event, target) {
652
  if(target.element.hasClassName('mailpoet_form_block')) {
694
  }
695
  };
696
 
697
+ WysijaForm.DraggableItem = window.Class.create({
698
  initialize: function(element) {
699
+ this.elementType = window.$(element).readAttribute('wysija_type');
700
+ this.element = window.$(element).down() || window.$(element);
701
  this.clone = this.cloneElement();
702
  this.insert();
703
  },
704
+ STYLES: new window.Template('position: absolute; top: #{top}px; left: #{left}px;'),
705
  cloneElement: function() {
706
  var clone = this.element.clone(),
707
  offset = this.element.cumulativeOffset(),
724
  return this.element.up('ul');
725
  },
726
  insert: function() {
727
+ window.$$('body')[0].insert(this.clone);
728
  },
729
  onMousedown: function(event) {
730
+ var draggable = new window.Draggable(this.clone, {
731
  scroll: window,
732
  onStart: function() {
733
+ window.Droppables.displayArea(draggable);
734
  },
735
  onEnd: function(drag) {
736
  drag.destroy();
737
  drag.element.remove();
738
+ window.Droppables.hideArea();
739
  },
740
  starteffect: function(element) {
741
+ new window.Effect.Opacity(element, {
742
  duration: 0.2,
743
  from: element.getOpacity(),
744
  to: 0.7
745
  });
746
  },
747
+ endeffect: window.Prototype.emptyFunction
748
  });
749
  draggable.initDrag(event);
750
  draggable.startDrag(event);
754
  Object.extend(WysijaForm.DraggableItem, Observable).observe('a[class="mailpoet_form_field"]');
755
 
756
 
757
+ WysijaForm.Block = window.Class.create({
758
  /* Invoked on load */
759
  initialize: function(element) {
760
  info('block -> init');
761
 
762
+ this.element = window.$(element);
763
  this.block = new WysijaForm.Widget(this.element);
764
 
765
  // enable block placeholder
792
  makeBlockDroppable: function() {
793
  if(this.isBlockDroppableEnabled() === false) {
794
  var block_placeholder = this.getBlockDroppable();
795
+ window.Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions);
796
  block_placeholder.addClassName('enabled');
797
  }
798
  },
799
  removeBlockDroppable: function() {
800
  if(this.isBlockDroppableEnabled()) {
801
  var block_placeholder = this.getBlockDroppable();
802
+ window.Droppables.remove(block_placeholder.identify());
803
  block_placeholder.removeClassName('enabled');
804
  }
805
  },
815
  createBlockDroppable: function() {
816
  info('block -> createBlockDroppable');
817
  this.element.insert({
818
+ before: '<div class=\"block_placeholder\">' + window.$('block_placeholder').innerHTML + '</div>'
819
  });
820
  return this.element.previous('.block_placeholder');
821
  },
880
  if(this.settingsButton !== null) {
881
  this.settingsButton.observe('click', function(event) {
882
  // TODO: refactor
883
+ var block = window.$(event.target).up('.mailpoet_form_block') || null;
884
  if(block !== null) {
885
  var field = WysijaForm.getFieldData(block);
886
  this.editSettings();
896
  // save block in history
897
  WysijaHistory.enqueue(this.element);
898
 
899
+ window.Effect.Fade(this.element.identify(), {
900
  duration: 0.2,
901
  afterFinish: function(effect) {
902
  // remove placeholder
928
  /* Invoked on item dropped */
929
  WysijaForm.Block.create = function(createBlock, target) {
930
  var block = createBlock;
931
+ if(window.$('form_template_' + block.type) === null) {
932
  return false;
933
  }
934
 
935
+ var body = window.$(WysijaForm.options.body),
936
+ block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
937
+ template = window.Handlebars.compile(window.$('form_template_' + block.type).innerHTML),
938
  output = '';
939
 
940
  if(block.type === 'segment') {
941
  if(block.params.values === undefined) {
942
+ var settings_segments = window.jQuery('#mailpoet_form_segments').val();
943
  if(settings_segments !== null && settings_segments.length > 0){
944
+ block.params.values = window.mailpoet_segments.filter(function(segment) {
945
  return (settings_segments.indexOf(segment.id) !== -1);
946
  });
947
  }
996
  });
997
 
998
  /* Form Widget */
999
+ WysijaForm.Widget = window.Class.create(WysijaForm.Block, {
1000
  initialize: function(element) {
1001
  info('widget -> init');
1002
+ this.element = window.$(element);
1003
  return this;
1004
  },
1005
  setup: function() {
1018
  },
1019
  setData: function(data) {
1020
  var current_data = this.getData(),
1021
+ params = window.$H(current_data.params).merge(data.params).toObject();
1022
 
1023
  // update type if it changed
1024
  if(data.type !== undefined && data.type !== current_data.type) {
1047
  this.setData(data);
1048
  var options = this.getData();
1049
  // redraw block
1050
+ var block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
1051
+ template = window.Handlebars.compile(window.$('form_template_' + options.type).innerHTML),
1052
+ data = window.$H(options).merge({
1053
  template: template(options)
1054
  }).toObject();
1055
  this.element.replace(block_template(data));
1057
  WysijaForm.init();
1058
  },
1059
  editSettings: function() {
1060
+ window.MailPoet.Modal.popup({
1061
+ title: window.MailPoet.I18n.t('editFieldSettings'),
1062
+ template: window.jQuery('#form_template_field_settings').html(),
1063
  data: this.getData(),
1064
  onSuccess: function() {
1065
+ var data = window.jQuery('#form_field_settings').serializeObject();
1066
  this.redraw(data);
1067
  }.bind(this)
1068
  });
assets/js/{mailpoet.e52dab6e.js → mailpoet.81b583ba.js} RENAMED
@@ -49902,59 +49902,59 @@ webpackJsonp([3],[
49902
  var MailPoet = mp;
49903
 
49904
  MailPoet.Ajax = {
49905
- version: 0.5,
49906
- options: {},
49907
- defaults: {
49908
- url: null,
49909
- api_version: null,
49910
- endpoint: null,
49911
- action: null,
49912
- token: null,
49913
- data: {}
49914
- },
49915
- post: function(options) {
49916
- return this.request('post', options);
49917
- },
49918
- init: function(options) {
49919
- // merge options
49920
- this.options = jQuery.extend({}, this.defaults, options);
49921
 
49922
- // set default url
49923
- if(this.options.url === null) {
49924
- this.options.url = ajaxurl;
49925
- }
49926
 
49927
- // set default token
49928
- if(this.options.token === null) {
49929
- this.options.token = window.mailpoet_token;
49930
- }
49931
- },
49932
- getParams: function() {
49933
- return {
49934
- action: 'mailpoet',
49935
- api_version: this.options.api_version,
49936
- token: this.options.token,
49937
- endpoint: this.options.endpoint,
49938
- method: this.options.action,
49939
- data: this.options.data || {}
49940
- };
49941
- },
49942
- request: function(method, options) {
49943
  // set options
49944
- this.init(options);
49945
 
49946
  // set request params
49947
- var params = this.getParams();
49948
 
49949
  // remove null values from the data object
49950
- if (_.isObject(params.data)) {
49951
- params.data = _.pick(params.data, function(value) {
49952
- return (value !== null);
49953
- });
49954
- }
49955
 
49956
  // ajax request
49957
- var deferred = jQuery.post(
49958
  this.options.url,
49959
  params,
49960
  null,
@@ -49964,10 +49964,10 @@ webpackJsonp([3],[
49964
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
49965
 
49966
  // clear options
49967
- this.options = {};
49968
 
49969
- return deferred;
49970
- }
49971
  };
49972
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
49973
 
@@ -49985,165 +49985,165 @@ webpackJsonp([3],[
49985
  jQuery,
49986
  Moment
49987
  ) {
49988
- 'use strict';
49989
 
49990
- var MailPoet = mp;
49991
 
49992
- MailPoet.Date = {
49993
- version: 0.1,
49994
- options: {},
49995
- defaults: {
49996
- offset: 0,
49997
- format: 'F, d Y H:i:s'
49998
- },
49999
- init: function (opts) {
50000
- var options = opts || {};
50001
 
50002
  // set UTC offset
50003
- if (
50004
  options.offset === undefined
50005
  && window.mailpoet_date_offset !== undefined
50006
  ) {
50007
- options.offset = window.mailpoet_date_offset;
50008
- }
50009
  // set date format
50010
- if (
50011
  options.format === undefined
50012
  && window.mailpoet_date_format !== undefined
50013
  ) {
50014
- options.format = window.mailpoet_date_format;
50015
- }
50016
  // merge options
50017
- this.options = jQuery.extend({}, this.defaults, options);
50018
 
50019
- return this;
50020
- },
50021
- format: function(date, opts) {
50022
- var options = opts || {};
50023
- this.init(options);
50024
 
50025
- var momentDate = Moment(date, this.convertFormat(options.parseFormat));
50026
- if (options.offset === 0) momentDate = momentDate.utc();
50027
- return momentDate.format(this.convertFormat(this.options.format));
50028
- },
50029
- toDate: function(date, opts) {
50030
- var options = opts || {};
50031
- this.init(options);
50032
 
50033
- return Moment(date, this.convertFormat(options.parseFormat)).toDate();
50034
- },
50035
- short: function(date) {
50036
- return this.format(date, {
50037
- format: 'F, j Y'
50038
- });
50039
- },
50040
- full: function(date) {
50041
- return this.format(date, {
50042
- format: 'F, j Y H:i:s'
50043
- });
50044
- },
50045
- time: function(date) {
50046
- return this.format(date, {
50047
- format: 'H:i:s'
50048
- });
50049
- },
50050
- convertFormat: function(format) {
50051
- var format_mappings = {
50052
- date: {
50053
- d: 'DD',
50054
- D: 'ddd',
50055
- j: 'D',
50056
- l: 'dddd',
50057
- N: 'E',
50058
- S: 'o',
50059
- w: 'e',
50060
- z: 'DDD',
50061
- W: 'W',
50062
- F: 'MMMM',
50063
- m: 'MM',
50064
- M: 'MMM',
50065
- n: 'M',
50066
- t: '', // no equivalent
50067
- L: '', // no equivalent
50068
- o: 'YYYY',
50069
- Y: 'YYYY',
50070
- y: 'YY',
50071
- a: 'a',
50072
- A: 'A',
50073
- B: '', // no equivalent
50074
- g: 'h',
50075
- G: 'H',
50076
- h: 'hh',
50077
- H: 'HH',
50078
- i: 'mm',
50079
- s: 'ss',
50080
- u: 'SSS',
50081
- e: 'zz', // deprecated since version 1.6.0 of moment.js
50082
- I: '', // no equivalent
50083
- O: '', // no equivalent
50084
- P: '', // no equivalent
50085
- T: '', // no equivalent
50086
- Z: '', // no equivalent
50087
- c: '', // no equivalent
50088
- r: '', // no equivalent
50089
- U: 'X'
50090
- },
50091
- strftime: {
50092
- a: 'ddd',
50093
- A: 'dddd',
50094
- b: 'MMM',
50095
- B: 'MMMM',
50096
- d: 'DD',
50097
- e: 'D',
50098
- F: 'YYYY-MM-DD',
50099
- H: 'HH',
50100
- I: 'hh',
50101
- j: 'DDDD',
50102
- k: 'H',
50103
- l: 'h',
50104
- m: 'MM',
50105
- M: 'mm',
50106
- p: 'A',
50107
- S: 'ss',
50108
- u: 'E',
50109
- w: 'd',
50110
- W: 'WW',
50111
- y: 'YY',
50112
- Y: 'YYYY',
50113
- z: 'ZZ',
50114
- Z: 'z'
50115
- }
50116
- };
50117
 
50118
- if (!format || format.length <= 0) return format;
50119
 
50120
- var replacements = format_mappings['date'];
50121
 
50122
- var convertedFormat = [];
50123
- var escapeToken = false;
50124
 
50125
- for(var index = 0, token = ''; format.charAt(index); index += 1){
50126
- token = format.charAt(index);
50127
- if (escapeToken === true) {
50128
- convertedFormat.push('['+token+']');
50129
- escapeToken = false;
50130
- } else {
50131
- if (token === '\\') {
50132
- // Slash escapes the next symbol to be treated as literal
50133
- escapeToken = true;
50134
- continue;
50135
- } else if (replacements[token] !== undefined) {
50136
- convertedFormat.push(replacements[token]);
50137
- } else {
50138
  convertedFormat.push('['+token+']');
 
 
 
 
 
 
 
 
 
 
 
50139
  }
50140
  }
50141
- }
50142
 
50143
- return convertedFormat.join('');
50144
- }
50145
- };
50146
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50147
 
50148
 
50149
  /***/ },
@@ -50155,25 +50155,25 @@ webpackJsonp([3],[
50155
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
50156
  mp
50157
  ) {
50158
- 'use strict';
50159
 
50160
- var MailPoet = mp;
50161
 
50162
- var translations = {};
50163
 
50164
- MailPoet.I18n = {
50165
- add: function(key, value) {
50166
- translations[key] = value;
50167
- },
50168
- t: function(key) {
50169
- return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
50170
- },
50171
- all: function() {
50172
- return translations;
50173
- }
50174
- };
50175
 
50176
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50177
 
50178
 
50179
  /***/ },
@@ -50293,9 +50293,8 @@ webpackJsonp([3],[
50293
  if(this.renderer === 'html') {
50294
  return function() { return template; };
50295
  } else {
50296
- return Handlebars.compile(template);
50297
  }
50298
- return false;
50299
  },
50300
  init: function(options) {
50301
  if(this.initialized === true) {
@@ -50363,24 +50362,24 @@ webpackJsonp([3],[
50363
  initOverlay: function(toggle) {
50364
  if(jQuery('#mailpoet_modal_overlay').length === 0) {
50365
  // insert overlay into the DOM
50366
- jQuery('body').append(this.templates.overlay);
50367
  // insert loading indicator into overlay
50368
- jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
50369
- }
50370
- return this;
50371
- },
50372
- toggleOverlay: function(toggle) {
50373
- if(toggle === true) {
50374
- jQuery('#mailpoet_modal_overlay')
50375
  .removeClass('mailpoet_overlay_hidden');
50376
- } else {
50377
- jQuery('#mailpoet_modal_overlay')
50378
  .addClass('mailpoet_overlay_hidden');
50379
- }
50380
 
50381
- return this;
50382
- },
50383
- setupEvents: function() {
50384
  // close popup when user clicks on close button
50385
  jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
50386
 
@@ -50431,39 +50430,39 @@ webpackJsonp([3],[
50431
  loadTemplate: function() {
50432
  if(this.subpanels.length > 0) {
50433
  // hide panel
50434
- jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
50435
 
50436
  // add sub panel wrapper
50437
- jQuery('#mailpoet_'+this.options.type)
50438
  .append(this.templates['subpanel']);
50439
 
50440
  // add sub panel content
50441
- jQuery('.mailpoet_'+this.options.type+'_body').last()
50442
  .html(this.subpanels[(this.subpanels.length - 1)].element);
50443
 
50444
  // focus on sub panel
50445
- if(this.options.focus) {
50446
- this.focus();
50447
- }
50448
- } else if (this.options.element) {
50449
- jQuery('.mailpoet_'+this.options.type+'_body').empty();
50450
- jQuery('.mailpoet_'+this.options.type+'_body')
50451
  .append(this.options.element);
50452
- } else {
50453
- jQuery('.mailpoet_'+this.options.type+'_body')
50454
  .html(
50455
  this.options.body_template(
50456
  this.options.data
50457
  )
50458
  );
50459
- }
50460
 
50461
- return this;
50462
- },
50463
- loadUrl: function() {
50464
- if(this.options.method === 'get') {
50465
  // make ajax request
50466
- jQuery.getJSON(this.options.url,
50467
  function(data) {
50468
  this.options.data = jQuery.extend({}, this.options.data, data);
50469
  // load template using fetched data
@@ -50472,9 +50471,9 @@ webpackJsonp([3],[
50472
  this.showModal();
50473
  }.bind(this)
50474
  );
50475
- } else if(this.options.method === 'post') {
50476
  // make ajax request
50477
- jQuery.post(this.options.url, JSON.stringify(this.options.params),
50478
  function(data) {
50479
  this.options.data = jQuery.extend({}, this.options.data, data);
50480
  // load template using fetched data
@@ -50484,342 +50483,342 @@ webpackJsonp([3],[
50484
  }.bind(this),
50485
  'json'
50486
  );
50487
- }
50488
 
50489
- return this;
50490
- },
50491
- setDimensions: function() {
50492
- switch(this.options.type) {
50493
- case 'popup':
50494
  // set popup dimensions
50495
- jQuery('#mailpoet_popup').css({
50496
- width: this.options.width,
50497
- height: this.options.height
50498
- });
50499
  // set popup wrapper height
50500
- jQuery('#mailpoet_popup_wrapper').css({
50501
- height: this.options.height
50502
- });
50503
  break;
50504
- case 'panel':
50505
  // set dimensions
50506
- if(this.options.position === 'right') {
50507
- jQuery('#mailpoet_panel').css({
50508
- width: this.options.width,
50509
- right: 0,
50510
- marginRight: '-' + this.options.width,
50511
- left: 'auto'
50512
- });
50513
- } else if(this.options.position === 'left') {
50514
- jQuery('#mailpoet_panel').css({
50515
- width: this.options.width,
50516
- left: 0,
50517
- marginLeft: '-' + this.options.width,
50518
- right: 'auto'
50519
- });
50520
- }
50521
- jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
50522
  break;
50523
- }
50524
 
50525
- return this;
50526
- },
50527
- setPosition: function() {
50528
- switch(this.options.type) {
50529
- case 'popup':
50530
- var screenWidth = jQuery(window).width(),
50531
  screenHeight = jQuery(window).height(),
50532
  modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
50533
  modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
50534
 
50535
- var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
50536
  left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
50537
 
50538
  // set position of popup depending on screen dimensions.
50539
- jQuery('#mailpoet_popup').css({
50540
- top: top,
50541
- left: left
50542
- });
50543
  break;
50544
- case 'panel':
50545
- setTimeout(function() {
50546
  // set position of popup depending on screen dimensions.
50547
- if(this.options.position === 'right') {
50548
- jQuery('#mailpoet_panel').css({
50549
- marginRight: 0
50550
- });
50551
- } else if(this.options.position === 'left') {
50552
- jQuery('#mailpoet_panel').css({
50553
- marginLeft: 0
50554
- });
50555
- }
50556
- }.bind(this), 0);
50557
  break;
50558
- }
50559
 
50560
- return this;
50561
- },
50562
- showModal: function() {
50563
  // set modal dimensions
50564
- this.setDimensions();
50565
 
50566
  // remember the previously focused element
50567
- this.prevFocus = jQuery(':focus');
50568
 
50569
  // add a flag on the body so that we can prevent scrolling
50570
- jQuery('body').addClass('mailpoet_modal_opened');
50571
 
50572
  // show popup
50573
- jQuery('#mailpoet_'+this.options.type).show();
50574
 
50575
  // display overlay
50576
- this.showOverlay();
50577
 
50578
  // set modal position
50579
- this.setPosition();
50580
 
50581
  // add class on highlighted elements
50582
- if(this.options.highlight !== null) {
50583
- if(this.options.highlight.length > 0) {
50584
- this.highlightOn(this.options.highlight);
50585
- }
50586
  }
 
50587
 
50588
- if(this.options.focus) {
50589
- this.focus();
50590
- }
50591
 
50592
  // set popup as opened
50593
- this.opened = true;
50594
 
50595
  // trigger init event if specified
50596
- if(this.options.onInit !== null) {
50597
- this.options.onInit(this);
50598
- }
50599
 
50600
- return this;
50601
- },
50602
- focus: function() {
50603
- if(this.options.type == 'popup') {
50604
- jQuery('#mailpoet_'+this.options.type).focus();
50605
- } else {
50606
  // panel and subpanel
50607
- jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
50608
  .filter(':visible').focus();
50609
- }
50610
- return this;
50611
- },
50612
- highlightOn: function(element) {
50613
- jQuery(element).addClass('mailpoet_modal_highlight');
50614
- return this;
50615
- },
50616
- highlightOff: function() {
50617
- jQuery('.mailpoet_modal_highlight')
50618
  .removeClass('mailpoet_modal_highlight');
50619
- return this;
50620
- },
50621
- hideModal: function(callback) {
50622
  // set modal as closed
50623
- this.opened = false;
50624
 
50625
  // hide modal
50626
- jQuery('#mailpoet_'+this.options.type).hide();
50627
 
50628
  // remove class on highlighted elements
50629
- this.highlightOff();
50630
 
50631
  // remove class from body to let it be scrollable
50632
- jQuery('body').removeClass('mailpoet_modal_opened');
50633
 
50634
- return this;
50635
- },
50636
- showOverlay: function(force) {
50637
- jQuery('#mailpoet_modal_overlay').show();
50638
- return this;
50639
- },
50640
- hideOverlay: function() {
50641
- jQuery('#mailpoet_modal_overlay').hide();
50642
- return this;
50643
- },
50644
- popup: function(opts) {
50645
  // get options
50646
- var options = opts || {};
50647
  // set modal type
50648
- options.type = 'popup';
50649
  // set overlay state
50650
- options.overlay = options.overlay || true;
50651
  // initialize modal
50652
- this.init(options);
50653
  // open modal
50654
- this.open();
50655
 
50656
- return this;
50657
- },
50658
- panel: function(opts) {
50659
  // get options
50660
- var options = opts || {};
50661
  // reset subpanels
50662
- this.subpanels = [];
50663
  // set modal type
50664
- options.type = 'panel';
50665
  // set overlay state
50666
- options.overlay = options.overlay || false;
50667
  // set highlighted element
50668
- options.highlight = options.highlight || null;
50669
  // set modal dimensions
50670
- options.width = options.width || '40%';
50671
- options.height = options.height || 'auto';
50672
  // initialize modal
50673
- this.init(options);
50674
  // open modal
50675
- this.open();
50676
 
50677
- return this;
50678
- },
50679
- subpanel: function(options) {
50680
- if(this.opened === false) {
50681
  // if no panel is already opened, let's create one instead
50682
- this.panel(options);
50683
- } else {
50684
  // if a panel is already opened, add a sub panel to it
50685
- this.subpanels.push(options);
50686
- this.loadTemplate();
50687
- }
50688
 
50689
- return this;
50690
- },
50691
- loading: function(toggle) {
50692
  // make sure the overlay is initialized and that it's visible
50693
- this.initOverlay(true);
50694
 
50695
- if(toggle === true) {
50696
- this.showLoading();
50697
- } else {
50698
- this.hideLoading();
50699
- }
50700
 
50701
- return this;
50702
- },
50703
- showLoading: function() {
50704
- jQuery('#mailpoet_loading').show();
50705
 
50706
  // add loading class to overlay
50707
- jQuery('#mailpoet_modal_overlay')
50708
  .addClass('mailpoet_overlay_loading');
50709
 
50710
- return this;
50711
- },
50712
- hideLoading: function() {
50713
- jQuery('#mailpoet_loading').hide();
50714
 
50715
  // remove loading class from overlay
50716
- jQuery('#mailpoet_modal_overlay')
50717
  .removeClass('mailpoet_overlay_loading');
50718
 
50719
- return this;
50720
- },
50721
- open: function() {
50722
  // load template if specified
50723
- if(this.options.template !== null) {
50724
  // check if a url was specified to get extra data
50725
- if(this.options.url !== null) {
50726
- this.loadUrl();
50727
- } else {
50728
  // load template
50729
- this.loadTemplate();
50730
 
50731
  // show modal window
50732
- this.showModal();
50733
- }
50734
- } else {
50735
- this.cancel();
50736
  }
 
 
 
50737
 
50738
- return this;
50739
- },
50740
- success: function() {
50741
- if(this.subpanels.length > 0) {
50742
- if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
50743
- this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
50744
- }
50745
- } else {
50746
- if(this.options.onSuccess !== null) {
50747
- this.options.onSuccess(this.options.data);
50748
- }
50749
  }
50750
- this.close();
 
 
 
 
 
50751
 
50752
- return this;
50753
- },
50754
- cancel: function() {
50755
- if(this.subpanels.length > 0) {
50756
- if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
50757
- this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
50758
- }
50759
- } else {
50760
- if(this.options.onCancel !== null) {
50761
- this.options.onCancel(this.options.data);
50762
- }
50763
  }
50764
- this.close();
 
 
 
 
 
50765
 
50766
- return this;
50767
- },
50768
- destroy: function() {
50769
- this.hideOverlay();
50770
 
50771
  // remove extra modal
50772
- if(jQuery('#mailpoet_'+this.options.type).length > 0) {
50773
- jQuery('#mailpoet_'+this.options.type).remove();
50774
- }
50775
 
50776
- this.initialized = false;
50777
 
50778
- return this;
50779
- },
50780
- close: function() {
50781
- if(this.isLocked() === true) { return this; }
50782
 
50783
- if(this.subpanels.length > 0) {
50784
  // close subpanel
50785
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
50786
 
50787
  // show previous panel
50788
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
50789
 
50790
  // remove last subpanels
50791
- this.subpanels.pop();
50792
 
50793
  // focus on previous panel
50794
- if(this.options.focus) {
50795
- this.focus();
50796
- }
50797
-
50798
- return this;
50799
  }
50800
 
 
 
 
50801
  // remove event handlers
50802
- this.removeEvents();
50803
 
50804
  // hide modal window
50805
- this.hideModal();
50806
 
50807
  // destroy modal element
50808
- this.destroy();
50809
 
50810
  // restore the previously focused element
50811
- if(this.prevFocus !== undefined){
50812
- this.prevFocus.focus();
50813
- }
50814
 
50815
  // reset options
50816
- this.options = {
50817
- onSuccess: null,
50818
- onCancel: null
50819
- };
50820
 
50821
- return this;
50822
- }
50823
  };
50824
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50825
 
@@ -50906,7 +50905,7 @@ webpackJsonp([3],[
50906
  // setup onClose callback
50907
  var onClose = null;
50908
  if (this.options.onClose !== null) {
50909
- onClose = this.options.onClose;
50910
  }
50911
 
50912
  // listen to remove event
@@ -50914,7 +50913,7 @@ webpackJsonp([3],[
50914
  jQuery(this).fadeOut(200, function() {
50915
  // on close callback
50916
  if (onClose !== null) {
50917
- onClose();
50918
  }
50919
  // remove notice
50920
  jQuery(this).remove();
@@ -50975,13 +50974,13 @@ webpackJsonp([3],[
50975
  switch (this.options.type) {
50976
  case 'success':
50977
  this.element.addClass('notice notice-success');
50978
- break;
50979
  case 'system':
50980
  this.element.addClass('notice notice-warning');
50981
- break;
50982
  case 'error':
50983
  this.element.addClass('notice notice-error');
50984
- break;
50985
  }
50986
 
50987
  // make the notice appear
@@ -50998,7 +50997,7 @@ webpackJsonp([3],[
50998
  } else if (this.options.hideClose === false) {
50999
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
51000
  this.element.find('.mailpoet_notice_close').on('click', function() {
51001
- jQuery(this).trigger('close');
51002
  });
51003
  }
51004
 
@@ -51056,22 +51055,22 @@ webpackJsonp([3],[
51056
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
51057
  mp
51058
  ) {
51059
- 'use strict';
51060
 
51061
- var MailPoet = mp;
51062
- MailPoet.Num = {
51063
- toLocaleFixed: function (num, precisionOpts) {
51064
- var precision = precisionOpts || 0;
51065
- var factor = Math.pow(10, precision);
51066
- return (Math.round(num * factor) / factor)
51067
  .toLocaleString(
51068
  undefined,
51069
  {minimumFractionDigits: precision, maximumFractionDigits: precision}
51070
  );
51071
- }
51072
- };
51073
 
51074
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
51075
 
51076
 
51077
  /***/ },
@@ -53703,15 +53702,6 @@ webpackJsonp([3],[
53703
  });
53704
  }
53705
 
53706
- function initializeMixpanelWhenLoaded() {
53707
- if (typeof window.mixpanel === 'object') {
53708
- exportMixpanel(MailPoet);
53709
- trackCachedEvents();
53710
- } else {
53711
- setTimeout(initializeMixpanelWhenLoaded, 100);
53712
- }
53713
- }
53714
-
53715
  function cacheEvent(forced, name, data) {
53716
  eventsCache.push({
53717
  name: name,
@@ -53723,6 +53713,15 @@ webpackJsonp([3],[
53723
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(274), __webpack_require__(278)], __WEBPACK_AMD_DEFINE_RESULT__ = function(mp, _) {
53724
  var MailPoet = mp;
53725
 
 
 
 
 
 
 
 
 
 
53726
  MailPoet.trackEvent = _.partial(cacheEvent, false);
53727
  MailPoet.forceTrackEvent = _.partial(cacheEvent, true);
53728
 
49902
  var MailPoet = mp;
49903
 
49904
  MailPoet.Ajax = {
49905
+ version: 0.5,
49906
+ options: {},
49907
+ defaults: {
49908
+ url: null,
49909
+ api_version: null,
49910
+ endpoint: null,
49911
+ action: null,
49912
+ token: null,
49913
+ data: {}
49914
+ },
49915
+ post: function(options) {
49916
+ return this.request('post', options);
49917
+ },
49918
+ init: function(options) {
49919
+ // merge options
49920
+ this.options = jQuery.extend({}, this.defaults, options);
49921
 
49922
+ // set default url
49923
+ if(this.options.url === null) {
49924
+ this.options.url = window.ajaxurl;
49925
+ }
49926
 
49927
+ // set default token
49928
+ if(this.options.token === null) {
49929
+ this.options.token = window.mailpoet_token;
49930
+ }
49931
+ },
49932
+ getParams: function() {
49933
+ return {
49934
+ action: 'mailpoet',
49935
+ api_version: this.options.api_version,
49936
+ token: this.options.token,
49937
+ endpoint: this.options.endpoint,
49938
+ method: this.options.action,
49939
+ data: this.options.data || {}
49940
+ };
49941
+ },
49942
+ request: function(method, options) {
49943
  // set options
49944
+ this.init(options);
49945
 
49946
  // set request params
49947
+ var params = this.getParams();
49948
 
49949
  // remove null values from the data object
49950
+ if (_.isObject(params.data)) {
49951
+ params.data = _.pick(params.data, function(value) {
49952
+ return (value !== null);
49953
+ });
49954
+ }
49955
 
49956
  // ajax request
49957
+ var deferred = jQuery.post(
49958
  this.options.url,
49959
  params,
49960
  null,
49964
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
49965
 
49966
  // clear options
49967
+ this.options = {};
49968
 
49969
+ return deferred;
49970
+ }
49971
  };
49972
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
49973
 
49985
  jQuery,
49986
  Moment
49987
  ) {
49988
+ 'use strict';
49989
 
49990
+ var MailPoet = mp;
49991
 
49992
+ MailPoet.Date = {
49993
+ version: 0.1,
49994
+ options: {},
49995
+ defaults: {
49996
+ offset: 0,
49997
+ format: 'F, d Y H:i:s'
49998
+ },
49999
+ init: function (opts) {
50000
+ var options = opts || {};
50001
 
50002
  // set UTC offset
50003
+ if (
50004
  options.offset === undefined
50005
  && window.mailpoet_date_offset !== undefined
50006
  ) {
50007
+ options.offset = window.mailpoet_date_offset;
50008
+ }
50009
  // set date format
50010
+ if (
50011
  options.format === undefined
50012
  && window.mailpoet_date_format !== undefined
50013
  ) {
50014
+ options.format = window.mailpoet_date_format;
50015
+ }
50016
  // merge options
50017
+ this.options = jQuery.extend({}, this.defaults, options);
50018
 
50019
+ return this;
50020
+ },
50021
+ format: function(date, opts) {
50022
+ var options = opts || {};
50023
+ this.init(options);
50024
 
50025
+ var momentDate = Moment(date, this.convertFormat(options.parseFormat));
50026
+ if (options.offset === 0) momentDate = momentDate.utc();
50027
+ return momentDate.format(this.convertFormat(this.options.format));
50028
+ },
50029
+ toDate: function(date, opts) {
50030
+ var options = opts || {};
50031
+ this.init(options);
50032
 
50033
+ return Moment(date, this.convertFormat(options.parseFormat)).toDate();
50034
+ },
50035
+ short: function(date) {
50036
+ return this.format(date, {
50037
+ format: 'F, j Y'
50038
+ });
50039
+ },
50040
+ full: function(date) {
50041
+ return this.format(date, {
50042
+ format: 'F, j Y H:i:s'
50043
+ });
50044
+ },
50045
+ time: function(date) {
50046
+ return this.format(date, {
50047
+ format: 'H:i:s'
50048
+ });
50049
+ },
50050
+ convertFormat: function(format) {
50051
+ var format_mappings = {
50052
+ date: {
50053
+ d: 'DD',
50054
+ D: 'ddd',
50055
+ j: 'D',
50056
+ l: 'dddd',
50057
+ N: 'E',
50058
+ S: 'o',
50059
+ w: 'e',
50060
+ z: 'DDD',
50061
+ W: 'W',
50062
+ F: 'MMMM',
50063
+ m: 'MM',
50064
+ M: 'MMM',
50065
+ n: 'M',
50066
+ t: '', // no equivalent
50067
+ L: '', // no equivalent
50068
+ o: 'YYYY',
50069
+ Y: 'YYYY',
50070
+ y: 'YY',
50071
+ a: 'a',
50072
+ A: 'A',
50073
+ B: '', // no equivalent
50074
+ g: 'h',
50075
+ G: 'H',
50076
+ h: 'hh',
50077
+ H: 'HH',
50078
+ i: 'mm',
50079
+ s: 'ss',
50080
+ u: 'SSS',
50081
+ e: 'zz', // deprecated since version 1.6.0 of moment.js
50082
+ I: '', // no equivalent
50083
+ O: '', // no equivalent
50084
+ P: '', // no equivalent
50085
+ T: '', // no equivalent
50086
+ Z: '', // no equivalent
50087
+ c: '', // no equivalent
50088
+ r: '', // no equivalent
50089
+ U: 'X'
50090
+ },
50091
+ strftime: {
50092
+ a: 'ddd',
50093
+ A: 'dddd',
50094
+ b: 'MMM',
50095
+ B: 'MMMM',
50096
+ d: 'DD',
50097
+ e: 'D',
50098
+ F: 'YYYY-MM-DD',
50099
+ H: 'HH',
50100
+ I: 'hh',
50101
+ j: 'DDDD',
50102
+ k: 'H',
50103
+ l: 'h',
50104
+ m: 'MM',
50105
+ M: 'mm',
50106
+ p: 'A',
50107
+ S: 'ss',
50108
+ u: 'E',
50109
+ w: 'd',
50110
+ W: 'WW',
50111
+ y: 'YY',
50112
+ Y: 'YYYY',
50113
+ z: 'ZZ',
50114
+ Z: 'z'
50115
+ }
50116
+ };
50117
 
50118
+ if (!format || format.length <= 0) return format;
50119
 
50120
+ var replacements = format_mappings['date'];
50121
 
50122
+ var convertedFormat = [];
50123
+ var escapeToken = false;
50124
 
50125
+ for(var index = 0, token = ''; format.charAt(index); index += 1){
50126
+ token = format.charAt(index);
50127
+ if (escapeToken === true) {
 
 
 
 
 
 
 
 
 
 
50128
  convertedFormat.push('['+token+']');
50129
+ escapeToken = false;
50130
+ } else {
50131
+ if (token === '\\') {
50132
+ // Slash escapes the next symbol to be treated as literal
50133
+ escapeToken = true;
50134
+ continue;
50135
+ } else if (replacements[token] !== undefined) {
50136
+ convertedFormat.push(replacements[token]);
50137
+ } else {
50138
+ convertedFormat.push('['+token+']');
50139
+ }
50140
  }
50141
  }
 
50142
 
50143
+ return convertedFormat.join('');
50144
+ }
50145
+ };
50146
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50147
 
50148
 
50149
  /***/ },
50155
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
50156
  mp
50157
  ) {
50158
+ 'use strict';
50159
 
50160
+ var MailPoet = mp;
50161
 
50162
+ var translations = {};
50163
 
50164
+ MailPoet.I18n = {
50165
+ add: function(key, value) {
50166
+ translations[key] = value;
50167
+ },
50168
+ t: function(key) {
50169
+ return translations[key] || 'TRANSLATION "%$1s" NOT FOUND'.replace('%$1s', key);
50170
+ },
50171
+ all: function() {
50172
+ return translations;
50173
+ }
50174
+ };
50175
 
50176
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50177
 
50178
 
50179
  /***/ },
50293
  if(this.renderer === 'html') {
50294
  return function() { return template; };
50295
  } else {
50296
+ return window.Handlebars.compile(template);
50297
  }
 
50298
  },
50299
  init: function(options) {
50300
  if(this.initialized === true) {
50362
  initOverlay: function(toggle) {
50363
  if(jQuery('#mailpoet_modal_overlay').length === 0) {
50364
  // insert overlay into the DOM
50365
+ jQuery('body').append(this.templates.overlay);
50366
  // insert loading indicator into overlay
50367
+ jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
50368
+ }
50369
+ return this;
50370
+ },
50371
+ toggleOverlay: function(toggle) {
50372
+ if(toggle === true) {
50373
+ jQuery('#mailpoet_modal_overlay')
50374
  .removeClass('mailpoet_overlay_hidden');
50375
+ } else {
50376
+ jQuery('#mailpoet_modal_overlay')
50377
  .addClass('mailpoet_overlay_hidden');
50378
+ }
50379
 
50380
+ return this;
50381
+ },
50382
+ setupEvents: function() {
50383
  // close popup when user clicks on close button
50384
  jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
50385
 
50430
  loadTemplate: function() {
50431
  if(this.subpanels.length > 0) {
50432
  // hide panel
50433
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
50434
 
50435
  // add sub panel wrapper
50436
+ jQuery('#mailpoet_'+this.options.type)
50437
  .append(this.templates['subpanel']);
50438
 
50439
  // add sub panel content
50440
+ jQuery('.mailpoet_'+this.options.type+'_body').last()
50441
  .html(this.subpanels[(this.subpanels.length - 1)].element);
50442
 
50443
  // focus on sub panel
50444
+ if(this.options.focus) {
50445
+ this.focus();
50446
+ }
50447
+ } else if (this.options.element) {
50448
+ jQuery('.mailpoet_'+this.options.type+'_body').empty();
50449
+ jQuery('.mailpoet_'+this.options.type+'_body')
50450
  .append(this.options.element);
50451
+ } else {
50452
+ jQuery('.mailpoet_'+this.options.type+'_body')
50453
  .html(
50454
  this.options.body_template(
50455
  this.options.data
50456
  )
50457
  );
50458
+ }
50459
 
50460
+ return this;
50461
+ },
50462
+ loadUrl: function() {
50463
+ if(this.options.method === 'get') {
50464
  // make ajax request
50465
+ jQuery.getJSON(this.options.url,
50466
  function(data) {
50467
  this.options.data = jQuery.extend({}, this.options.data, data);
50468
  // load template using fetched data
50471
  this.showModal();
50472
  }.bind(this)
50473
  );
50474
+ } else if(this.options.method === 'post') {
50475
  // make ajax request
50476
+ jQuery.post(this.options.url, JSON.stringify(this.options.params),
50477
  function(data) {
50478
  this.options.data = jQuery.extend({}, this.options.data, data);
50479
  // load template using fetched data
50483
  }.bind(this),
50484
  'json'
50485
  );
50486
+ }
50487
 
50488
+ return this;
50489
+ },
50490
+ setDimensions: function() {
50491
+ switch(this.options.type) {
50492
+ case 'popup':
50493
  // set popup dimensions
50494
+ jQuery('#mailpoet_popup').css({
50495
+ width: this.options.width,
50496
+ height: this.options.height
50497
+ });
50498
  // set popup wrapper height
50499
+ jQuery('#mailpoet_popup_wrapper').css({
50500
+ height: this.options.height
50501
+ });
50502
  break;
50503
+ case 'panel':
50504
  // set dimensions
50505
+ if(this.options.position === 'right') {
50506
+ jQuery('#mailpoet_panel').css({
50507
+ width: this.options.width,
50508
+ right: 0,
50509
+ marginRight: '-' + this.options.width,
50510
+ left: 'auto'
50511
+ });
50512
+ } else if(this.options.position === 'left') {
50513
+ jQuery('#mailpoet_panel').css({
50514
+ width: this.options.width,
50515
+ left: 0,
50516
+ marginLeft: '-' + this.options.width,
50517
+ right: 'auto'
50518
+ });
50519
+ }
50520
+ jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
50521
  break;
50522
+ }
50523
 
50524
+ return this;
50525
+ },
50526
+ setPosition: function() {
50527
+ switch(this.options.type) {
50528
+ case 'popup':
50529
+ var screenWidth = jQuery(window).width(),
50530
  screenHeight = jQuery(window).height(),
50531
  modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
50532
  modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
50533
 
50534
+ var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
50535
  left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
50536
 
50537
  // set position of popup depending on screen dimensions.
50538
+ jQuery('#mailpoet_popup').css({
50539
+ top: top,
50540
+ left: left
50541
+ });
50542
  break;
50543
+ case 'panel':
50544
+ setTimeout(function() {
50545
  // set position of popup depending on screen dimensions.
50546
+ if(this.options.position === 'right') {
50547
+ jQuery('#mailpoet_panel').css({
50548
+ marginRight: 0
50549
+ });
50550
+ } else if(this.options.position === 'left') {
50551
+ jQuery('#mailpoet_panel').css({
50552
+ marginLeft: 0
50553
+ });
50554
+ }
50555
+ }.bind(this), 0);
50556
  break;
50557
+ }
50558
 
50559
+ return this;
50560
+ },
50561
+ showModal: function() {
50562
  // set modal dimensions
50563
+ this.setDimensions();
50564
 
50565
  // remember the previously focused element
50566
+ this.prevFocus = jQuery(':focus');
50567
 
50568
  // add a flag on the body so that we can prevent scrolling
50569
+ jQuery('body').addClass('mailpoet_modal_opened');
50570
 
50571
  // show popup
50572
+ jQuery('#mailpoet_'+this.options.type).show();
50573
 
50574
  // display overlay
50575
+ this.showOverlay();
50576
 
50577
  // set modal position
50578
+ this.setPosition();
50579
 
50580
  // add class on highlighted elements
50581
+ if(this.options.highlight !== null) {
50582
+ if(this.options.highlight.length > 0) {
50583
+ this.highlightOn(this.options.highlight);
 
50584
  }
50585
+ }
50586
 
50587
+ if(this.options.focus) {
50588
+ this.focus();
50589
+ }
50590
 
50591
  // set popup as opened
50592
+ this.opened = true;
50593
 
50594
  // trigger init event if specified
50595
+ if(this.options.onInit !== null) {
50596
+ this.options.onInit(this);
50597
+ }
50598
 
50599
+ return this;
50600
+ },
50601
+ focus: function() {
50602
+ if(this.options.type == 'popup') {
50603
+ jQuery('#mailpoet_'+this.options.type).focus();
50604
+ } else {
50605
  // panel and subpanel
50606
+ jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
50607
  .filter(':visible').focus();
50608
+ }
50609
+ return this;
50610
+ },
50611
+ highlightOn: function(element) {
50612
+ jQuery(element).addClass('mailpoet_modal_highlight');
50613
+ return this;
50614
+ },
50615
+ highlightOff: function() {
50616
+ jQuery('.mailpoet_modal_highlight')
50617
  .removeClass('mailpoet_modal_highlight');
50618
+ return this;
50619
+ },
50620
+ hideModal: function(callback) {
50621
  // set modal as closed
50622
+ this.opened = false;
50623
 
50624
  // hide modal
50625
+ jQuery('#mailpoet_'+this.options.type).hide();
50626
 
50627
  // remove class on highlighted elements
50628
+ this.highlightOff();
50629
 
50630
  // remove class from body to let it be scrollable
50631
+ jQuery('body').removeClass('mailpoet_modal_opened');
50632
 
50633
+ return this;
50634
+ },
50635
+ showOverlay: function(force) {
50636
+ jQuery('#mailpoet_modal_overlay').show();
50637
+ return this;
50638
+ },
50639
+ hideOverlay: function() {
50640
+ jQuery('#mailpoet_modal_overlay').hide();
50641
+ return this;
50642
+ },
50643
+ popup: function(opts) {
50644
  // get options
50645
+ var options = opts || {};
50646
  // set modal type
50647
+ options.type = 'popup';
50648
  // set overlay state
50649
+ options.overlay = options.overlay || true;
50650
  // initialize modal
50651
+ this.init(options);
50652
  // open modal
50653
+ this.open();
50654
 
50655
+ return this;
50656
+ },
50657
+ panel: function(opts) {
50658
  // get options
50659
+ var options = opts || {};
50660
  // reset subpanels
50661
+ this.subpanels = [];
50662
  // set modal type
50663
+ options.type = 'panel';
50664
  // set overlay state
50665
+ options.overlay = options.overlay || false;
50666
  // set highlighted element
50667
+ options.highlight = options.highlight || null;
50668
  // set modal dimensions
50669
+ options.width = options.width || '40%';
50670
+ options.height = options.height || 'auto';
50671
  // initialize modal
50672
+ this.init(options);
50673
  // open modal
50674
+ this.open();
50675
 
50676
+ return this;
50677
+ },
50678
+ subpanel: function(options) {
50679
+ if(this.opened === false) {
50680
  // if no panel is already opened, let's create one instead
50681
+ this.panel(options);
50682
+ } else {
50683
  // if a panel is already opened, add a sub panel to it
50684
+ this.subpanels.push(options);
50685
+ this.loadTemplate();
50686
+ }
50687
 
50688
+ return this;
50689
+ },
50690
+ loading: function(toggle) {
50691
  // make sure the overlay is initialized and that it's visible
50692
+ this.initOverlay(true);
50693
 
50694
+ if(toggle === true) {
50695
+ this.showLoading();
50696
+ } else {
50697
+ this.hideLoading();
50698
+ }
50699
 
50700
+ return this;
50701
+ },
50702
+ showLoading: function() {
50703
+ jQuery('#mailpoet_loading').show();
50704
 
50705
  // add loading class to overlay
50706
+ jQuery('#mailpoet_modal_overlay')
50707
  .addClass('mailpoet_overlay_loading');
50708
 
50709
+ return this;
50710
+ },
50711
+ hideLoading: function() {
50712
+ jQuery('#mailpoet_loading').hide();
50713
 
50714
  // remove loading class from overlay
50715
+ jQuery('#mailpoet_modal_overlay')
50716
  .removeClass('mailpoet_overlay_loading');
50717
 
50718
+ return this;
50719
+ },
50720
+ open: function() {
50721
  // load template if specified
50722
+ if(this.options.template !== null) {
50723
  // check if a url was specified to get extra data
50724
+ if(this.options.url !== null) {
50725
+ this.loadUrl();
50726
+ } else {
50727
  // load template
50728
+ this.loadTemplate();
50729
 
50730
  // show modal window
50731
+ this.showModal();
 
 
 
50732
  }
50733
+ } else {
50734
+ this.cancel();
50735
+ }
50736
 
50737
+ return this;
50738
+ },
50739
+ success: function() {
50740
+ if(this.subpanels.length > 0) {
50741
+ if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
50742
+ this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
 
 
 
 
 
50743
  }
50744
+ } else {
50745
+ if(this.options.onSuccess !== null) {
50746
+ this.options.onSuccess(this.options.data);
50747
+ }
50748
+ }
50749
+ this.close();
50750
 
50751
+ return this;
50752
+ },
50753
+ cancel: function() {
50754
+ if(this.subpanels.length > 0) {
50755
+ if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
50756
+ this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
 
 
 
 
 
50757
  }
50758
+ } else {
50759
+ if(this.options.onCancel !== null) {
50760
+ this.options.onCancel(this.options.data);
50761
+ }
50762
+ }
50763
+ this.close();
50764
 
50765
+ return this;
50766
+ },
50767
+ destroy: function() {
50768
+ this.hideOverlay();
50769
 
50770
  // remove extra modal
50771
+ if(jQuery('#mailpoet_'+this.options.type).length > 0) {
50772
+ jQuery('#mailpoet_'+this.options.type).remove();
50773
+ }
50774
 
50775
+ this.initialized = false;
50776
 
50777
+ return this;
50778
+ },
50779
+ close: function() {
50780
+ if(this.isLocked() === true) { return this; }
50781
 
50782
+ if(this.subpanels.length > 0) {
50783
  // close subpanel
50784
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
50785
 
50786
  // show previous panel
50787
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
50788
 
50789
  // remove last subpanels
50790
+ this.subpanels.pop();
50791
 
50792
  // focus on previous panel
50793
+ if(this.options.focus) {
50794
+ this.focus();
 
 
 
50795
  }
50796
 
50797
+ return this;
50798
+ }
50799
+
50800
  // remove event handlers
50801
+ this.removeEvents();
50802
 
50803
  // hide modal window
50804
+ this.hideModal();
50805
 
50806
  // destroy modal element
50807
+ this.destroy();
50808
 
50809
  // restore the previously focused element
50810
+ if(this.prevFocus !== undefined){
50811
+ this.prevFocus.focus();
50812
+ }
50813
 
50814
  // reset options
50815
+ this.options = {
50816
+ onSuccess: null,
50817
+ onCancel: null
50818
+ };
50819
 
50820
+ return this;
50821
+ }
50822
  };
50823
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
50824
 
50905
  // setup onClose callback
50906
  var onClose = null;
50907
  if (this.options.onClose !== null) {
50908
+ onClose = this.options.onClose;
50909
  }
50910
 
50911
  // listen to remove event
50913
  jQuery(this).fadeOut(200, function() {
50914
  // on close callback
50915
  if (onClose !== null) {
50916
+ onClose();
50917
  }
50918
  // remove notice
50919
  jQuery(this).remove();
50974
  switch (this.options.type) {
50975
  case 'success':
50976
  this.element.addClass('notice notice-success');
50977
+ break;
50978
  case 'system':
50979
  this.element.addClass('notice notice-warning');
50980
+ break;
50981
  case 'error':
50982
  this.element.addClass('notice notice-error');
50983
+ break;
50984
  }
50985
 
50986
  // make the notice appear
50997
  } else if (this.options.hideClose === false) {
50998
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
50999
  this.element.find('.mailpoet_notice_close').on('click', function() {
51000
+ jQuery(this).trigger('close');
51001
  });
51002
  }
51003
 
51055
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
51056
  mp
51057
  ) {
51058
+ 'use strict';
51059
 
51060
+ var MailPoet = mp;
51061
+ MailPoet.Num = {
51062
+ toLocaleFixed: function (num, precisionOpts) {
51063
+ var precision = precisionOpts || 0;
51064
+ var factor = Math.pow(10, precision);
51065
+ return (Math.round(num * factor) / factor)
51066
  .toLocaleString(
51067
  undefined,
51068
  {minimumFractionDigits: precision, maximumFractionDigits: precision}
51069
  );
51070
+ }
51071
+ };
51072
 
51073
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
51074
 
51075
 
51076
  /***/ },
53702
  });
53703
  }
53704
 
 
 
 
 
 
 
 
 
 
53705
  function cacheEvent(forced, name, data) {
53706
  eventsCache.push({
53707
  name: name,
53713
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(274), __webpack_require__(278)], __WEBPACK_AMD_DEFINE_RESULT__ = function(mp, _) {
53714
  var MailPoet = mp;
53715
 
53716
+ function initializeMixpanelWhenLoaded() {
53717
+ if (typeof window.mixpanel === 'object') {
53718
+ exportMixpanel(MailPoet);
53719
+ trackCachedEvents();
53720
+ } else {
53721
+ setTimeout(initializeMixpanelWhenLoaded, 100);
53722
+ }
53723
+ }
53724
+
53725
  MailPoet.trackEvent = _.partial(cacheEvent, false);
53726
  MailPoet.forceTrackEvent = _.partial(cacheEvent, true);
53727
 
assets/js/manifest.json CHANGED
@@ -1,10 +1,10 @@
1
  {
2
- "mp2migrator.js": "mp2migrator.4acba493.js",
3
- "public.js": "public.17607eba.js",
4
- "admin.js": "admin.6527ae62.js",
5
- "admin_vendor.js": "admin_vendor.77fc9795.js",
6
- "form_editor.js": "form_editor.8b0c5294.js",
7
- "mailpoet.js": "mailpoet.e52dab6e.js",
8
- "newsletter_editor.js": "newsletter_editor.d11e861e.js",
9
- "vendor.js": "vendor.f8675e02.js"
10
  }
1
  {
2
+ "mp2migrator.js": "mp2migrator.923dd5b2.js",
3
+ "public.js": "public.02e5f1af.js",
4
+ "admin.js": "admin.d091b681.js",
5
+ "admin_vendor.js": "admin_vendor.ee9853ec.js",
6
+ "form_editor.js": "form_editor.c0e36e82.js",
7
+ "mailpoet.js": "mailpoet.81b583ba.js",
8
+ "newsletter_editor.js": "newsletter_editor.cc3c87be.js",
9
+ "vendor.js": "vendor.f4549608.js"
10
  }
assets/js/{mp2migrator.4acba493.js → mp2migrator.923dd5b2.js} RENAMED
@@ -79,7 +79,7 @@
79
 
80
  displayLogs: function () {
81
  jQuery.ajax({
82
- url: mailpoet_mp2_migrator.log_file_url,
83
  cache: false
84
  }).done(function (result) {
85
  jQuery('#logger').html('');
@@ -106,7 +106,7 @@
106
 
107
  updateProgressbar: function () {
108
  jQuery.ajax({
109
- url: mailpoet_mp2_migrator.progress_url,
110
  cache: false,
111
  dataType: 'json'
112
  }).always(function (result) {
79
 
80
  displayLogs: function () {
81
  jQuery.ajax({
82
+ url: window.mailpoet_mp2_migrator.log_file_url,
83
  cache: false
84
  }).done(function (result) {
85
  jQuery('#logger').html('');
106
 
107
  updateProgressbar: function () {
108
  jQuery.ajax({
109
+ url: window.mailpoet_mp2_migrator.progress_url,
110
  cache: false,
111
  dataType: 'json'
112
  }).always(function (result) {
assets/js/{newsletter_editor.d11e861e.js → newsletter_editor.cc3c87be.js} RENAMED
@@ -4,11 +4,11 @@ webpackJsonp([4],{
4
  /***/ function(module, exports, __webpack_require__) {
5
 
6
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
7
- __webpack_require__(574),
8
- __webpack_require__(278),
9
- __webpack_require__(274),
10
- __webpack_require__(552)
11
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, _, MailPoet) {
12
 
13
  var Module = {};
14
 
@@ -34,7 +34,6 @@ webpackJsonp([4],{
34
  action: 'getPostTypes',
35
  options: {}
36
  }).then(function(response) {
37
- console.log(_.values(response.data));
38
  return _.values(response.data);
39
  });
40
  };
@@ -159,7 +158,8 @@ webpackJsonp([4],{
159
  __webpack_require__(602);
160
  __webpack_require__(603);
161
  __webpack_require__(604);
162
- module.exports = __webpack_require__(605);
 
163
 
164
 
165
  /***/ },
@@ -9432,59 +9432,59 @@ webpackJsonp([4],{
9432
  var MailPoet = mp;
9433
 
9434
  MailPoet.Ajax = {
9435
- version: 0.5,
9436
- options: {},
9437
- defaults: {
9438
- url: null,
9439
- api_version: null,
9440
- endpoint: null,
9441
- action: null,
9442
- token: null,
9443
- data: {}
9444
- },
9445
- post: function(options) {
9446
- return this.request('post', options);
9447
- },
9448
- init: function(options) {
9449
- // merge options
9450
- this.options = jQuery.extend({}, this.defaults, options);
9451
 
9452
- // set default url
9453
- if(this.options.url === null) {
9454
- this.options.url = ajaxurl;
9455
- }
9456
 
9457
- // set default token
9458
- if(this.options.token === null) {
9459
- this.options.token = window.mailpoet_token;
9460
- }
9461
- },
9462
- getParams: function() {
9463
- return {
9464
- action: 'mailpoet',
9465
- api_version: this.options.api_version,
9466
- token: this.options.token,
9467
- endpoint: this.options.endpoint,
9468
- method: this.options.action,
9469
- data: this.options.data || {}
9470
- };
9471
- },
9472
- request: function(method, options) {
9473
  // set options
9474
- this.init(options);
9475
 
9476
  // set request params
9477
- var params = this.getParams();
9478
 
9479
  // remove null values from the data object
9480
- if (_.isObject(params.data)) {
9481
- params.data = _.pick(params.data, function(value) {
9482
- return (value !== null);
9483
- });
9484
- }
9485
 
9486
  // ajax request
9487
- var deferred = jQuery.post(
9488
  this.options.url,
9489
  params,
9490
  null,
@@ -9494,10 +9494,10 @@ webpackJsonp([4],{
9494
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
9495
 
9496
  // clear options
9497
- this.options = {};
9498
 
9499
- return deferred;
9500
- }
9501
  };
9502
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
9503
 
@@ -9620,9 +9620,8 @@ webpackJsonp([4],{
9620
  if(this.renderer === 'html') {
9621
  return function() { return template; };
9622
  } else {
9623
- return Handlebars.compile(template);
9624
  }
9625
- return false;
9626
  },
9627
  init: function(options) {
9628
  if(this.initialized === true) {
@@ -9690,24 +9689,24 @@ webpackJsonp([4],{
9690
  initOverlay: function(toggle) {
9691
  if(jQuery('#mailpoet_modal_overlay').length === 0) {
9692
  // insert overlay into the DOM
9693
- jQuery('body').append(this.templates.overlay);
9694
  // insert loading indicator into overlay
9695
- jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
9696
- }
9697
- return this;
9698
- },
9699
- toggleOverlay: function(toggle) {
9700
- if(toggle === true) {
9701
- jQuery('#mailpoet_modal_overlay')
9702
  .removeClass('mailpoet_overlay_hidden');
9703
- } else {
9704
- jQuery('#mailpoet_modal_overlay')
9705
  .addClass('mailpoet_overlay_hidden');
9706
- }
9707
 
9708
- return this;
9709
- },
9710
- setupEvents: function() {
9711
  // close popup when user clicks on close button
9712
  jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
9713
 
@@ -9758,39 +9757,39 @@ webpackJsonp([4],{
9758
  loadTemplate: function() {
9759
  if(this.subpanels.length > 0) {
9760
  // hide panel
9761
- jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
9762
 
9763
  // add sub panel wrapper
9764
- jQuery('#mailpoet_'+this.options.type)
9765
  .append(this.templates['subpanel']);
9766
 
9767
  // add sub panel content
9768
- jQuery('.mailpoet_'+this.options.type+'_body').last()
9769
  .html(this.subpanels[(this.subpanels.length - 1)].element);
9770
 
9771
  // focus on sub panel
9772
- if(this.options.focus) {
9773
- this.focus();
9774
- }
9775
- } else if (this.options.element) {
9776
- jQuery('.mailpoet_'+this.options.type+'_body').empty();
9777
- jQuery('.mailpoet_'+this.options.type+'_body')
9778
  .append(this.options.element);
9779
- } else {
9780
- jQuery('.mailpoet_'+this.options.type+'_body')
9781
  .html(
9782
  this.options.body_template(
9783
  this.options.data
9784
  )
9785
  );
9786
- }
9787
 
9788
- return this;
9789
- },
9790
- loadUrl: function() {
9791
- if(this.options.method === 'get') {
9792
  // make ajax request
9793
- jQuery.getJSON(this.options.url,
9794
  function(data) {
9795
  this.options.data = jQuery.extend({}, this.options.data, data);
9796
  // load template using fetched data
@@ -9799,9 +9798,9 @@ webpackJsonp([4],{
9799
  this.showModal();
9800
  }.bind(this)
9801
  );
9802
- } else if(this.options.method === 'post') {
9803
  // make ajax request
9804
- jQuery.post(this.options.url, JSON.stringify(this.options.params),
9805
  function(data) {
9806
  this.options.data = jQuery.extend({}, this.options.data, data);
9807
  // load template using fetched data
@@ -9811,342 +9810,342 @@ webpackJsonp([4],{
9811
  }.bind(this),
9812
  'json'
9813
  );
9814
- }
9815
 
9816
- return this;
9817
- },
9818
- setDimensions: function() {
9819
- switch(this.options.type) {
9820
- case 'popup':
9821
  // set popup dimensions
9822
- jQuery('#mailpoet_popup').css({
9823
- width: this.options.width,
9824
- height: this.options.height
9825
- });
9826
  // set popup wrapper height
9827
- jQuery('#mailpoet_popup_wrapper').css({
9828
- height: this.options.height
9829
- });
9830
  break;
9831
- case 'panel':
9832
  // set dimensions
9833
- if(this.options.position === 'right') {
9834
- jQuery('#mailpoet_panel').css({
9835
- width: this.options.width,
9836
- right: 0,
9837
- marginRight: '-' + this.options.width,
9838
- left: 'auto'
9839
- });
9840
- } else if(this.options.position === 'left') {
9841
- jQuery('#mailpoet_panel').css({
9842
- width: this.options.width,
9843
- left: 0,
9844
- marginLeft: '-' + this.options.width,
9845
- right: 'auto'
9846
- });
9847
- }
9848
- jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
9849
  break;
9850
- }
9851
 
9852
- return this;
9853
- },
9854
- setPosition: function() {
9855
- switch(this.options.type) {
9856
- case 'popup':
9857
- var screenWidth = jQuery(window).width(),
9858
  screenHeight = jQuery(window).height(),
9859
  modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
9860
  modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
9861
 
9862
- var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
9863
  left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
9864
 
9865
  // set position of popup depending on screen dimensions.
9866
- jQuery('#mailpoet_popup').css({
9867
- top: top,
9868
- left: left
9869
- });
9870
  break;
9871
- case 'panel':
9872
- setTimeout(function() {
9873
  // set position of popup depending on screen dimensions.
9874
- if(this.options.position === 'right') {
9875
- jQuery('#mailpoet_panel').css({
9876
- marginRight: 0
9877
- });
9878
- } else if(this.options.position === 'left') {
9879
- jQuery('#mailpoet_panel').css({
9880
- marginLeft: 0
9881
- });
9882
- }
9883
- }.bind(this), 0);
9884
  break;
9885
- }
9886
 
9887
- return this;
9888
- },
9889
- showModal: function() {
9890
  // set modal dimensions
9891
- this.setDimensions();
9892
 
9893
  // remember the previously focused element
9894
- this.prevFocus = jQuery(':focus');
9895
 
9896
  // add a flag on the body so that we can prevent scrolling
9897
- jQuery('body').addClass('mailpoet_modal_opened');
9898
 
9899
  // show popup
9900
- jQuery('#mailpoet_'+this.options.type).show();
9901
 
9902
  // display overlay
9903
- this.showOverlay();
9904
 
9905
  // set modal position
9906
- this.setPosition();
9907
 
9908
  // add class on highlighted elements
9909
- if(this.options.highlight !== null) {
9910
- if(this.options.highlight.length > 0) {
9911
- this.highlightOn(this.options.highlight);
9912
- }
9913
  }
 
9914
 
9915
- if(this.options.focus) {
9916
- this.focus();
9917
- }
9918
 
9919
  // set popup as opened
9920
- this.opened = true;
9921
 
9922
  // trigger init event if specified
9923
- if(this.options.onInit !== null) {
9924
- this.options.onInit(this);
9925
- }
9926
 
9927
- return this;
9928
- },
9929
- focus: function() {
9930
- if(this.options.type == 'popup') {
9931
- jQuery('#mailpoet_'+this.options.type).focus();
9932
- } else {
9933
  // panel and subpanel
9934
- jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
9935
  .filter(':visible').focus();
9936
- }
9937
- return this;
9938
- },
9939
- highlightOn: function(element) {
9940
- jQuery(element).addClass('mailpoet_modal_highlight');
9941
- return this;
9942
- },
9943
- highlightOff: function() {
9944
- jQuery('.mailpoet_modal_highlight')
9945
  .removeClass('mailpoet_modal_highlight');
9946
- return this;
9947
- },
9948
- hideModal: function(callback) {
9949
  // set modal as closed
9950
- this.opened = false;
9951
 
9952
  // hide modal
9953
- jQuery('#mailpoet_'+this.options.type).hide();
9954
 
9955
  // remove class on highlighted elements
9956
- this.highlightOff();
9957
 
9958
  // remove class from body to let it be scrollable
9959
- jQuery('body').removeClass('mailpoet_modal_opened');
9960
 
9961
- return this;
9962
- },
9963
- showOverlay: function(force) {
9964
- jQuery('#mailpoet_modal_overlay').show();
9965
- return this;
9966
- },
9967
- hideOverlay: function() {
9968
- jQuery('#mailpoet_modal_overlay').hide();
9969
- return this;
9970
- },
9971
- popup: function(opts) {
9972
  // get options
9973
- var options = opts || {};
9974
  // set modal type
9975
- options.type = 'popup';
9976
  // set overlay state
9977
- options.overlay = options.overlay || true;
9978
  // initialize modal
9979
- this.init(options);
9980
  // open modal
9981
- this.open();
9982
 
9983
- return this;
9984
- },
9985
- panel: function(opts) {
9986
  // get options
9987
- var options = opts || {};
9988
  // reset subpanels
9989
- this.subpanels = [];
9990
  // set modal type
9991
- options.type = 'panel';
9992
  // set overlay state
9993
- options.overlay = options.overlay || false;
9994
  // set highlighted element
9995
- options.highlight = options.highlight || null;
9996
  // set modal dimensions
9997
- options.width = options.width || '40%';
9998
- options.height = options.height || 'auto';
9999
  // initialize modal
10000
- this.init(options);
10001
  // open modal
10002
- this.open();
10003
 
10004
- return this;
10005
- },
10006
- subpanel: function(options) {
10007
- if(this.opened === false) {
10008
  // if no panel is already opened, let's create one instead
10009
- this.panel(options);
10010
- } else {
10011
  // if a panel is already opened, add a sub panel to it
10012
- this.subpanels.push(options);
10013
- this.loadTemplate();
10014
- }
10015
 
10016
- return this;
10017
- },
10018
- loading: function(toggle) {
10019
  // make sure the overlay is initialized and that it's visible
10020
- this.initOverlay(true);
10021
 
10022
- if(toggle === true) {
10023
- this.showLoading();
10024
- } else {
10025
- this.hideLoading();
10026
- }
10027
 
10028
- return this;
10029
- },
10030
- showLoading: function() {
10031
- jQuery('#mailpoet_loading').show();
10032
 
10033
  // add loading class to overlay
10034
- jQuery('#mailpoet_modal_overlay')
10035
  .addClass('mailpoet_overlay_loading');
10036
 
10037
- return this;
10038
- },
10039
- hideLoading: function() {
10040
- jQuery('#mailpoet_loading').hide();
10041
 
10042
  // remove loading class from overlay
10043
- jQuery('#mailpoet_modal_overlay')
10044
  .removeClass('mailpoet_overlay_loading');
10045
 
10046
- return this;
10047
- },
10048
- open: function() {
10049
  // load template if specified
10050
- if(this.options.template !== null) {
10051
  // check if a url was specified to get extra data
10052
- if(this.options.url !== null) {
10053
- this.loadUrl();
10054
- } else {
10055
  // load template
10056
- this.loadTemplate();
10057
 
10058
  // show modal window
10059
- this.showModal();
10060
- }
10061
- } else {
10062
- this.cancel();
10063
  }
 
 
 
10064
 
10065
- return this;
10066
- },
10067
- success: function() {
10068
- if(this.subpanels.length > 0) {
10069
- if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
10070
- this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
10071
- }
10072
- } else {
10073
- if(this.options.onSuccess !== null) {
10074
- this.options.onSuccess(this.options.data);
10075
- }
10076
  }
10077
- this.close();
 
 
 
 
 
10078
 
10079
- return this;
10080
- },
10081
- cancel: function() {
10082
- if(this.subpanels.length > 0) {
10083
- if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
10084
- this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
10085
- }
10086
- } else {
10087
- if(this.options.onCancel !== null) {
10088
- this.options.onCancel(this.options.data);
10089
- }
10090
  }
10091
- this.close();
 
 
 
 
 
10092
 
10093
- return this;
10094
- },
10095
- destroy: function() {
10096
- this.hideOverlay();
10097
 
10098
  // remove extra modal
10099
- if(jQuery('#mailpoet_'+this.options.type).length > 0) {
10100
- jQuery('#mailpoet_'+this.options.type).remove();
10101
- }
10102
 
10103
- this.initialized = false;
10104
 
10105
- return this;
10106
- },
10107
- close: function() {
10108
- if(this.isLocked() === true) { return this; }
10109
 
10110
- if(this.subpanels.length > 0) {
10111
  // close subpanel
10112
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
10113
 
10114
  // show previous panel
10115
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
10116
 
10117
  // remove last subpanels
10118
- this.subpanels.pop();
10119
 
10120
  // focus on previous panel
10121
- if(this.options.focus) {
10122
- this.focus();
10123
- }
10124
-
10125
- return this;
10126
  }
10127
 
 
 
 
10128
  // remove event handlers
10129
- this.removeEvents();
10130
 
10131
  // hide modal window
10132
- this.hideModal();
10133
 
10134
  // destroy modal element
10135
- this.destroy();
10136
 
10137
  // restore the previously focused element
10138
- if(this.prevFocus !== undefined){
10139
- this.prevFocus.focus();
10140
- }
10141
 
10142
  // reset options
10143
- this.options = {
10144
- onSuccess: null,
10145
- onCancel: null
10146
- };
10147
 
10148
- return this;
10149
- }
10150
  };
10151
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
10152
 
@@ -10234,7 +10233,7 @@ webpackJsonp([4],{
10234
  // setup onClose callback
10235
  var onClose = null;
10236
  if (this.options.onClose !== null) {
10237
- onClose = this.options.onClose;
10238
  }
10239
 
10240
  // listen to remove event
@@ -10242,7 +10241,7 @@ webpackJsonp([4],{
10242
  jQuery(this).fadeOut(200, function() {
10243
  // on close callback
10244
  if (onClose !== null) {
10245
- onClose();
10246
  }
10247
  // remove notice
10248
  jQuery(this).remove();
@@ -10303,13 +10302,13 @@ webpackJsonp([4],{
10303
  switch (this.options.type) {
10304
  case 'success':
10305
  this.element.addClass('notice notice-success');
10306
- break;
10307
  case 'system':
10308
  this.element.addClass('notice notice-warning');
10309
- break;
10310
  case 'error':
10311
  this.element.addClass('notice notice-error');
10312
- break;
10313
  }
10314
 
10315
  // make the notice appear
@@ -10326,7 +10325,7 @@ webpackJsonp([4],{
10326
  } else if (this.options.hideClose === false) {
10327
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
10328
  this.element.find('.mailpoet_notice_close').on('click', function() {
10329
- jQuery(this).trigger('close');
10330
  });
10331
  }
10332
 
@@ -27608,14 +27607,14 @@ webpackJsonp([4],{
27608
  /***/ function(module, exports, __webpack_require__) {
27609
 
27610
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27611
- __webpack_require__(535),
27612
- __webpack_require__(562),
27613
- __webpack_require__(563),
27614
- __webpack_require__(273),
27615
- __webpack_require__(278),
27616
- __webpack_require__(543),
27617
- __webpack_require__(575)
27618
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Backbone, Marionette, BackboneRadio, jQuery, _, Handlebars) {
27619
  var Radio = BackboneRadio;
27620
 
27621
  var AppView = Marionette.View.extend({
@@ -27659,9 +27658,9 @@ webpackJsonp([4],{
27659
  /***/ function(module, exports, __webpack_require__) {
27660
 
27661
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27662
- __webpack_require__(574),
27663
- __webpack_require__(564)
27664
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, SuperModel) {
27665
 
27666
  var Module = {};
27667
 
@@ -27703,10 +27702,11 @@ webpackJsonp([4],{
27703
  /***/ function(module, exports, __webpack_require__) {
27704
 
27705
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27706
- __webpack_require__(574),
27707
- __webpack_require__(562),
27708
- __webpack_require__(564)
27709
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Marionette, SuperModel) {
 
27710
 
27711
  'use strict';
27712
 
@@ -27751,7 +27751,7 @@ webpackJsonp([4],{
27751
  });
27752
 
27753
  Module.StylesView = Marionette.View.extend({
27754
- getTemplate: function() { return templates.styles; },
27755
  modelEvents: {
27756
  change: 'render'
27757
  },
@@ -27799,25 +27799,25 @@ webpackJsonp([4],{
27799
  /***/ function(module, exports, __webpack_require__) {
27800
 
27801
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27802
- __webpack_require__(574),
27803
- __webpack_require__(579),
27804
- __webpack_require__(274),
27805
- __webpack_require__(535),
27806
- __webpack_require__(562),
27807
- __webpack_require__(564),
27808
- __webpack_require__(278),
27809
- __webpack_require__(273),
27810
- __webpack_require__(567)
27811
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
27812
- App,
27813
- CommunicationComponent,
27814
- MailPoet,
27815
- Backbone,
27816
- Marionette,
27817
- SuperModel,
27818
- _,
27819
- jQuery,
27820
- StickyKit
27821
  ) {
27822
 
27823
  'use strict';
@@ -27853,7 +27853,7 @@ webpackJsonp([4],{
27853
  Module.getLayoutWidgets = function() { return Module._layoutWidgets; };
27854
 
27855
  var SidebarView = Marionette.View.extend({
27856
- getTemplate: function() { return templates.sidebar; },
27857
  regions: {
27858
  contentRegion: '.mailpoet_content_region',
27859
  layoutRegion: '.mailpoet_layout_region',
@@ -27947,7 +27947,7 @@ webpackJsonp([4],{
27947
  * Responsible for rendering draggable content widgets
27948
  */
27949
  Module.SidebarWidgetsView = Marionette.View.extend({
27950
- getTemplate: function() { return templates.sidebarContent; },
27951
  regions: {
27952
  widgets: '.mailpoet_region_content'
27953
  },
@@ -27967,14 +27967,14 @@ webpackJsonp([4],{
27967
  * Responsible for rendering draggable layout widgets
27968
  */
27969
  Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({
27970
- getTemplate: function() { return templates.sidebarLayout; }
27971
  });
27972
 
27973
  /**
27974
  * Responsible for managing global styles
27975
  */
27976
  Module.SidebarStylesView = Marionette.View.extend({
27977
- getTemplate: function() { return templates.sidebarStyles; },
27978
  behaviors: {
27979
  ColorPickerBehavior: {}
27980
  },
@@ -28038,7 +28038,7 @@ webpackJsonp([4],{
28038
  });
28039
 
28040
  Module.SidebarPreviewView = Marionette.View.extend({
28041
- getTemplate: function() { return templates.sidebarPreview; },
28042
  events: {
28043
  'click .mailpoet_show_preview': 'showPreview',
28044
  'click #mailpoet_send_preview': 'sendPreview'
@@ -28146,7 +28146,7 @@ webpackJsonp([4],{
28146
  });
28147
 
28148
  Module.NewsletterPreviewView = Marionette.View.extend({
28149
- getTemplate: function() { return templates.newsletterPreview; },
28150
  initialize: function(options) {
28151
  this.previewUrl = options.previewUrl;
28152
  this.width = '100%';
@@ -28205,11 +28205,11 @@ webpackJsonp([4],{
28205
  /***/ function(module, exports, __webpack_require__) {
28206
 
28207
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28208
- __webpack_require__(574),
28209
- __webpack_require__(564),
28210
- __webpack_require__(278),
28211
- __webpack_require__(274)
28212
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, SuperModel, _, MailPoet) {
28213
  'use strict';
28214
 
28215
  var Module = {};
@@ -28221,7 +28221,7 @@ webpackJsonp([4],{
28221
  whitelisted: ['id', 'subject', 'preheader'],
28222
  initialize: function(options) {
28223
  this.on('change', function() {
28224
- App.getChannel().trigger('autoSave');
28225
  });
28226
  },
28227
  toJSON: function() {
@@ -28265,7 +28265,7 @@ webpackJsonp([4],{
28265
  };
28266
 
28267
  Module.getNewsletter = function() {
28268
- return Module.newsletter;
28269
  };
28270
 
28271
  Module.findModels = function(predicate) {
@@ -28319,19 +28319,20 @@ webpackJsonp([4],{
28319
  /***/ function(module, exports, __webpack_require__) {
28320
 
28321
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28322
- __webpack_require__(574),
28323
- __webpack_require__(535),
28324
- __webpack_require__(562),
28325
- __webpack_require__(278),
28326
- __webpack_require__(273)
28327
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Backbone, Marionette, _, jQuery) {
 
28328
 
28329
  'use strict';
28330
 
28331
  var Module = {};
28332
 
28333
  Module.HeadingView = Marionette.View.extend({
28334
- getTemplate: function() { return templates.heading; },
28335
  templateContext: function() {
28336
  return {
28337
  model: this.model.toJSON()
@@ -28371,33 +28372,37 @@ webpackJsonp([4],{
28371
  /***/ function(module, exports, __webpack_require__) {
28372
 
28373
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28374
- __webpack_require__(574),
28375
- __webpack_require__(579),
28376
- __webpack_require__(274),
28377
- __webpack_require__(556),
28378
- __webpack_require__(535),
28379
- __webpack_require__(562),
28380
- __webpack_require__(273),
28381
- __webpack_require__(568),
28382
- __webpack_require__(569),
28383
- __webpack_require__(583)
28384
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
28385
- App,
28386
- CommunicationComponent,
28387
- MailPoet,
28388
- Notice,
28389
- Backbone,
28390
- Marionette,
28391
- jQuery,
28392
- Blob,
28393
- FileSaver,
28394
- html2canvas
28395
- ) {
 
 
 
 
28396
 
28397
  'use strict';
28398
 
28399
  var Module = {},
28400
- saveTimeout;
28401
 
28402
  // Save editor contents to server
28403
  Module.save = function() {
@@ -28445,9 +28450,9 @@ webpackJsonp([4],{
28445
  // Removes 1px left transparent border from resulting canvas.
28446
 
28447
  var oldContext = oldCanvas.getContext('2d'),
28448
- newCanvas = document.createElement('canvas'),
28449
- newContext = newCanvas.getContext('2d'),
28450
- leftBorderWidth = 1;
28451
 
28452
  newCanvas.width = oldCanvas.width;
28453
  newCanvas.height = oldCanvas.height;
@@ -28464,7 +28469,7 @@ webpackJsonp([4],{
28464
 
28465
  Module.saveTemplate = function(options) {
28466
  var that = this,
28467
- promise = jQuery.Deferred();
28468
 
28469
  promise.then(function(thumbnail) {
28470
  var data = _.extend(options || {}, {
@@ -28511,7 +28516,7 @@ webpackJsonp([4],{
28511
  };
28512
 
28513
  Module.SaveView = Marionette.View.extend({
28514
- getTemplate: function() { return templates.save; },
28515
  events: {
28516
  'click .mailpoet_save_button': 'save',
28517
  'click .mailpoet_save_show_options': 'toggleSaveOptions',
@@ -28561,8 +28566,8 @@ webpackJsonp([4],{
28561
  },
28562
  saveAsTemplate: function() {
28563
  var templateName = this.$('.mailpoet_save_as_template_name').val(),
28564
- templateDescription = this.$('.mailpoet_save_as_template_description').val(),
28565
- that = this;
28566
 
28567
  if (templateName === '') {
28568
  MailPoet.Notice.error(
@@ -28617,8 +28622,8 @@ webpackJsonp([4],{
28617
  },
28618
  exportTemplate: function() {
28619
  var templateName = this.$('.mailpoet_export_template_name').val(),
28620
- templateDescription = this.$('.mailpoet_export_template_description').val(),
28621
- that = this;
28622
 
28623
  if (templateName === '') {
28624
  MailPoet.Notice.error(
@@ -33300,8 +33305,8 @@ webpackJsonp([4],{
33300
  * For more check: http://marionettejs.com/docs/marionette.behaviors.html#behaviorslookup
33301
  */
33302
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33303
- __webpack_require__(562)
33304
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(BackboneMarionette) {
33305
  var Marionette = BackboneMarionette;
33306
  var BehaviorsLookup = {};
33307
  Marionette.Behaviors.behaviorsLookup = function() {
@@ -33325,24 +33330,44 @@ webpackJsonp([4],{
33325
  * Adds a color picker integration with the view
33326
  */
33327
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33328
- __webpack_require__(562),
33329
- __webpack_require__(585),
33330
- __webpack_require__(274),
33331
- __webpack_require__(566)
33332
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup, MailPoet, Spectrum) {
33333
  var BL = BehaviorsLookup;
33334
 
33335
  BL.ColorPickerBehavior = Marionette.Behavior.extend({
33336
  onRender: function() {
33337
- this.view.$('.mailpoet_color').spectrum({
33338
- clickoutFiresChange: true,
33339
- showInput: true,
33340
- showInitial: true,
33341
- preferredFormat: 'hex6',
33342
- allowEmpty: true,
33343
- chooseText: MailPoet.I18n.t('selectColor'),
33344
- cancelText: MailPoet.I18n.t('cancelColorSelection')
33345
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33346
  }
33347
  });
33348
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
@@ -33353,7 +33378,8 @@ webpackJsonp([4],{
33353
  /***/ 587:
33354
  /***/ function(module, exports, __webpack_require__) {
33355
 
33356
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
 
33357
  * ContainerDropZoneBehavior
33358
  *
33359
  * A receiving behavior for drag&drop.
@@ -33361,12 +33387,12 @@ webpackJsonp([4],{
33361
  * accept droppables
33362
  */
33363
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33364
- __webpack_require__(562),
33365
- __webpack_require__(278),
33366
- __webpack_require__(273),
33367
- __webpack_require__(585),
33368
- __webpack_require__(565)
33369
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, jQuery, BL, interact) {
33370
  var BehaviorsLookup = BL;
33371
 
33372
  BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
@@ -33376,7 +33402,7 @@ webpackJsonp([4],{
33376
  onRender: function() {
33377
  var dragAndDropDisabled = _.isObject(this.view.options.renderOptions) && this.view.options.renderOptions.disableDragAndDrop === true;
33378
  if (!dragAndDropDisabled) {
33379
- this.addDropZone();
33380
  }
33381
  },
33382
  addDropZone: function(_event) {
@@ -33550,8 +33576,9 @@ webpackJsonp([4],{
33550
 
33551
  if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') {
33552
  // Regular blocks always need to be inserted into columns - vertical containers
33553
- tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
33554
- orientation: 'vertical'
 
33555
  });
33556
  tempCollection.get('blocks').add(droppableModel);
33557
  viewCollection.add(tempCollection, {at: index});
@@ -33565,27 +33592,27 @@ webpackJsonp([4],{
33565
  // and inserting dropModel into that
33566
  var tempModel = viewCollection.at(dropPosition.index);
33567
 
33568
- tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
33569
- orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical'
33570
  });
33571
 
33572
  viewCollection.remove(tempModel);
33573
 
33574
  if (tempCollection.get('orientation') === 'horizontal') {
33575
  if (dropPosition.position === 'before') {
33576
- tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
33577
  orientation: 'vertical'
33578
  });
33579
  tempCollection2.get('blocks').add(droppableModel);
33580
  tempCollection.get('blocks').add(tempCollection2);
33581
  }
33582
- tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
33583
  orientation: 'vertical'
33584
  });
33585
  tempCollection2.get('blocks').add(tempModel);
33586
  tempCollection.get('blocks').add(tempCollection2);
33587
  if (dropPosition.position === 'after') {
33588
- tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
33589
  orientation: 'vertical'
33590
  });
33591
  tempCollection2.get('blocks').add(droppableModel);
@@ -33646,7 +33673,7 @@ webpackJsonp([4],{
33646
 
33647
  insertionType, index, position, indexAndPosition;
33648
 
33649
- unsafe = !!is_unsafe;
33650
 
33651
  if (this.getCollection().length === 0) {
33652
  return {
@@ -33732,14 +33759,14 @@ webpackJsonp([4],{
33732
  if (eventOffset <= closeOffset + elementDimension / 2) {
33733
  // First half of the element
33734
  return {
33735
- index: index,
33736
- position: 'before'
33737
  };
33738
  } else {
33739
  // Second half of the element
33740
  return {
33741
- index: index,
33742
- position: 'after'
33743
  };
33744
  }
33745
  },
@@ -33807,12 +33834,12 @@ webpackJsonp([4],{
33807
  * Part of the drag&drop behavior.
33808
  */
33809
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33810
- __webpack_require__(562),
33811
- __webpack_require__(278),
33812
- __webpack_require__(273),
33813
- __webpack_require__(585),
33814
- __webpack_require__(565)
33815
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, jQuery, BehaviorsLookup, interact) {
33816
  var BL = BehaviorsLookup;
33817
 
33818
  BL.DraggableBehavior = Marionette.Behavior.extend({
@@ -33835,13 +33862,13 @@ webpackJsonp([4],{
33835
  },
33836
  onRender: function() {
33837
  var that = this,
33838
- interactable;
33839
 
33840
  // Give instances more control over whether Draggable should be applied
33841
  if (!this.options.testAttachToInstance(this.view.model, this.view)) return;
33842
 
33843
  interactable = interact(this.$el.get(0), {
33844
- ignoreFrom: this.options.ignoreSelector
33845
  }).draggable({
33846
  // allow dragging of multple elements at the same time
33847
  max: Infinity,
@@ -33856,7 +33883,7 @@ webpackJsonp([4],{
33856
  // Use substitution instead of a clone
33857
  var tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined,
33858
  // Or use a clone
33859
- clone = tempClone ? tempClone : event.target.cloneNode(true),
33860
 
33861
  $original = jQuery(event.target),
33862
  $clone = jQuery(clone),
@@ -33950,6 +33977,39 @@ webpackJsonp([4],{
33950
  /***/ },
33951
 
33952
  /***/ 589:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33953
  /***/ function(module, exports, __webpack_require__) {
33954
 
33955
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -33958,9 +34018,9 @@ webpackJsonp([4],{
33958
  * Highlights a block that is being edited
33959
  */
33960
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33961
- __webpack_require__(562),
33962
- __webpack_require__(585)
33963
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup) {
33964
  var BL = BehaviorsLookup;
33965
 
33966
  BL.HighlightEditingBehavior = Marionette.Behavior.extend({
@@ -33969,9 +34029,11 @@ webpackJsonp([4],{
33969
  stopEditing: 'disableHighlight'
33970
  },
33971
  enableHighlight: function() {
 
33972
  this.$el.addClass('mailpoet_highlight');
33973
  },
33974
  disableHighlight: function() {
 
33975
  this.$el.removeClass('mailpoet_highlight');
33976
  }
33977
  });
@@ -33980,7 +34042,7 @@ webpackJsonp([4],{
33980
 
33981
  /***/ },
33982
 
33983
- /***/ 590:
33984
  /***/ function(module, exports, __webpack_require__) {
33985
 
33986
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -33989,10 +34051,10 @@ webpackJsonp([4],{
33989
  * Allows resizing elements within a block
33990
  */
33991
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33992
- __webpack_require__(562),
33993
- __webpack_require__(585),
33994
- __webpack_require__(565)
33995
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup, interact) {
33996
  var BL = BehaviorsLookup;
33997
 
33998
  BL.ResizableBehavior = Marionette.Behavior.extend({
@@ -34016,7 +34078,7 @@ webpackJsonp([4],{
34016
  },
34017
  attachResize: function() {
34018
  var domElement = (this.options.elementSelector === null) ? this.view.$el.get(0) : this.view.$(this.options.elementSelector).get(0),
34019
- that = this;
34020
  interact(domElement).resizable({
34021
  //axis: 'y',
34022
  edges: {
@@ -34057,7 +34119,7 @@ webpackJsonp([4],{
34057
 
34058
  /***/ },
34059
 
34060
- /***/ 591:
34061
  /***/ function(module, exports, __webpack_require__) {
34062
 
34063
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -34066,10 +34128,10 @@ webpackJsonp([4],{
34066
  * Allows sorting elements within a collection
34067
  */
34068
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34069
- __webpack_require__(562),
34070
- __webpack_require__(278),
34071
- __webpack_require__(585)
34072
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, BehaviorsLookup) {
34073
  var BL = BehaviorsLookup;
34074
 
34075
  BL.SortableBehavior = Marionette.Behavior.extend({
@@ -34105,7 +34167,7 @@ webpackJsonp([4],{
34105
 
34106
  /***/ },
34107
 
34108
- /***/ 592:
34109
  /***/ function(module, exports, __webpack_require__) {
34110
 
34111
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -34114,10 +34176,10 @@ webpackJsonp([4],{
34114
  * Opens up settings of a BlockView if contents are clicked upon
34115
  */
34116
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34117
- __webpack_require__(562),
34118
- __webpack_require__(273),
34119
- __webpack_require__(585)
34120
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, jQuery, BehaviorsLookup) {
34121
  var BL = BehaviorsLookup;
34122
 
34123
  BL.ShowSettingsBehavior = Marionette.Behavior.extend({
@@ -34144,7 +34206,7 @@ webpackJsonp([4],{
34144
 
34145
  /***/ },
34146
 
34147
- /***/ 593:
34148
  /***/ function(module, exports, __webpack_require__) {
34149
 
34150
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -34153,10 +34215,10 @@ webpackJsonp([4],{
34153
  * Adds TinyMCE text editing capabilities to a view
34154
  */
34155
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34156
- __webpack_require__(562),
34157
- __webpack_require__(278),
34158
- __webpack_require__(585)
34159
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, BehaviorsLookup) {
34160
  var BL = BehaviorsLookup;
34161
 
34162
  BL.TextEditorBehavior = Marionette.Behavior.extend({
@@ -34214,7 +34276,7 @@ webpackJsonp([4],{
34214
  editor.focus();
34215
  if (that._isActivationClick) {
34216
  editor.selection.setRng(
34217
- tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
34218
  );
34219
  that._isActivationClick = false;
34220
  }
@@ -34222,7 +34284,7 @@ webpackJsonp([4],{
34222
 
34223
  editor.on('focus', function(e) {
34224
  that.view.triggerMethod('text:editor:focus');
34225
- that._isActivationClick = true;
34226
  });
34227
 
34228
  editor.on('blur', function(e) {
@@ -34237,7 +34299,7 @@ webpackJsonp([4],{
34237
 
34238
  /***/ },
34239
 
34240
- /***/ 594:
34241
  /***/ function(module, exports, __webpack_require__) {
34242
 
34243
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -34247,19 +34309,19 @@ webpackJsonp([4],{
34247
  * BlockToolsView, BlockSettingsView and BlockWidgetView are optional.
34248
  */
34249
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34250
- __webpack_require__(574),
34251
- __webpack_require__(562),
34252
- __webpack_require__(564),
34253
- __webpack_require__(278),
34254
- __webpack_require__(273),
34255
- __webpack_require__(274),
34256
- __webpack_require__(555)
34257
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Marionette, SuperModel, _, jQuery, MailPoet, Modal) {
34258
 
34259
  'use strict';
34260
 
34261
  var Module = {},
34262
- AugmentedView = Marionette.View.extend({});
34263
 
34264
  Module.BlockModel = SuperModel.extend({
34265
  stale: [], // Attributes to be removed upon saving
@@ -34420,7 +34482,7 @@ webpackJsonp([4],{
34420
  });
34421
 
34422
  Module.BlockToolsView = AugmentedView.extend({
34423
- getTemplate: function() { return templates.genericBlockTools; },
34424
  events: {
34425
  'click .mailpoet_edit_block': 'changeSettings',
34426
  'click .mailpoet_delete_block_activate': 'showDeletionConfirmation',
@@ -34517,7 +34579,7 @@ webpackJsonp([4],{
34517
  this.model.set(field, jQuery(event.target).val() + suffix);
34518
  },
34519
  changeBoolField: function(field, event) {
34520
- this.model.set(field, (jQuery(event.target).val() === 'true') ? true : false);
34521
  },
34522
  changeBoolCheckboxField: function(field, event) {
34523
  this.model.set(field, (!!jQuery(event.target).prop('checked')));
@@ -34552,7 +34614,7 @@ webpackJsonp([4],{
34552
 
34553
  /***/ },
34554
 
34555
- /***/ 595:
34556
  /***/ function(module, exports, __webpack_require__) {
34557
 
34558
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -34561,19 +34623,19 @@ webpackJsonp([4],{
34561
  * as other containers.
34562
  */
34563
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34564
- __webpack_require__(535),
34565
- __webpack_require__(562),
34566
- __webpack_require__(278),
34567
- __webpack_require__(273),
34568
- __webpack_require__(574),
34569
- __webpack_require__(594)
34570
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Backbone, Marionette, _, jQuery, App, BaseBlock) {
34571
 
34572
  'use strict';
34573
 
34574
  var Module = {},
34575
- base = BaseBlock,
34576
- BlockCollection;
34577
 
34578
  BlockCollection = Backbone.Collection.extend({
34579
  model: base.BlockModel,
@@ -34660,7 +34722,7 @@ webpackJsonp([4],{
34660
  }
34661
  }),
34662
  className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
34663
- getTemplate: function() { return templates.containerBlock; },
34664
  events: _.extend({}, base.BlockView.prototype.events, {
34665
  'click .mailpoet_newsletter_layer_selector': 'toggleEditingLayer'
34666
  }),
@@ -34695,7 +34757,8 @@ webpackJsonp([4],{
34695
  // for root and column containers.
34696
  return view.renderOptions.depth === 1;
34697
  }
34698
- }
 
34699
  }),
34700
  onDragSubstituteBy: function() {
34701
  // For two and three column layouts display their respective widgets,
@@ -34774,7 +34837,7 @@ webpackJsonp([4],{
34774
  });
34775
 
34776
  Module.ContainerBlockEmptyView = Marionette.View.extend({
34777
- getTemplate: function() { return templates.containerEmpty; },
34778
  initialize: function(options) {
34779
  this.renderOptions = _.defaults(options.renderOptions || {}, {});
34780
  },
@@ -34791,7 +34854,7 @@ webpackJsonp([4],{
34791
  });
34792
 
34793
  Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
34794
- getTemplate: function() { return templates.containerBlockSettings; },
34795
  events: function() {
34796
  return {
34797
  'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -34823,7 +34886,7 @@ webpackJsonp([4],{
34823
  });
34824
 
34825
  Module.ContainerBlockColumnSettingsView = Marionette.View.extend({
34826
- getTemplate: function() { return templates.containerBlockColumnSettings; },
34827
  initialize: function(options) {
34828
  this.columnNumber = (options.columnIndex || 0) + 1;
34829
  },
@@ -34837,7 +34900,7 @@ webpackJsonp([4],{
34837
 
34838
  Module.OneColumnContainerWidgetView = base.WidgetView.extend({
34839
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34840
- getTemplate: function() { return templates.oneColumnLayoutInsertion; },
34841
  behaviors: {
34842
  DraggableBehavior: {
34843
  cloneOriginal: true,
@@ -34855,7 +34918,7 @@ webpackJsonp([4],{
34855
 
34856
  Module.TwoColumnContainerWidgetView = base.WidgetView.extend({
34857
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34858
- getTemplate: function() { return templates.twoColumnLayoutInsertion; },
34859
  behaviors: {
34860
  DraggableBehavior: {
34861
  cloneOriginal: true,
@@ -34874,7 +34937,7 @@ webpackJsonp([4],{
34874
 
34875
  Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({
34876
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34877
- getTemplate: function() { return templates.threeColumnLayoutInsertion; },
34878
  behaviors: {
34879
  DraggableBehavior: {
34880
  cloneOriginal: true,
@@ -34923,24 +34986,24 @@ webpackJsonp([4],{
34923
 
34924
  /***/ },
34925
 
34926
- /***/ 596:
34927
  /***/ function(module, exports, __webpack_require__) {
34928
 
34929
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34930
  * Button content block
34931
  */
34932
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34933
- __webpack_require__(574),
34934
- __webpack_require__(594),
34935
- __webpack_require__(274),
34936
- __webpack_require__(278),
34937
- __webpack_require__(273)
34938
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, MailPoet, _, jQuery) {
34939
 
34940
  'use strict';
34941
 
34942
  var Module = {},
34943
- base = BaseBlock;
34944
 
34945
  Module.ButtonBlockModel = base.BlockModel.extend({
34946
  defaults: function() {
@@ -34970,7 +35033,7 @@ webpackJsonp([4],{
34970
 
34971
  Module.ButtonBlockView = base.BlockView.extend({
34972
  className: 'mailpoet_block mailpoet_button_block mailpoet_droppable_block',
34973
- getTemplate: function() { return templates.buttonBlock; },
34974
  onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
34975
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
34976
  ShowSettingsBehavior: {}
@@ -34993,7 +35056,7 @@ webpackJsonp([4],{
34993
  });
34994
 
34995
  Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
34996
- getTemplate: function() { return templates.buttonBlockSettings; },
34997
  events: function() {
34998
  return {
34999
  'input .mailpoet_field_button_text': _.partial(this.changeField, 'text'),
@@ -35049,7 +35112,7 @@ webpackJsonp([4],{
35049
  });
35050
 
35051
  Module.ButtonWidgetView = base.WidgetView.extend({
35052
- getTemplate: function() { return templates.buttonInsertion; },
35053
  behaviors: {
35054
  DraggableBehavior: {
35055
  cloneOriginal: true,
@@ -35079,24 +35142,25 @@ webpackJsonp([4],{
35079
 
35080
  /***/ },
35081
 
35082
- /***/ 597:
35083
  /***/ function(module, exports, __webpack_require__) {
35084
 
35085
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35086
  * Image content block
35087
  */
35088
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35089
- __webpack_require__(574),
35090
- __webpack_require__(594),
35091
- __webpack_require__(278),
35092
- __webpack_require__(274)
35093
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, MailPoet) {
 
35094
 
35095
  'use strict';
35096
 
35097
  var Module = {},
35098
- base = BaseBlock,
35099
- ImageWidgetView;
35100
 
35101
  Module.ImageBlockModel = base.BlockModel.extend({
35102
  defaults: function() {
@@ -35119,7 +35183,7 @@ webpackJsonp([4],{
35119
 
35120
  Module.ImageBlockView = base.BlockView.extend({
35121
  className: 'mailpoet_block mailpoet_image_block mailpoet_droppable_block',
35122
- getTemplate: function() { return templates.imageBlock; },
35123
  onDragSubstituteBy: function() { return Module.ImageWidgetView; },
35124
  templateContext: function() {
35125
  return _.extend({
@@ -35156,7 +35220,7 @@ webpackJsonp([4],{
35156
  tooltip: MailPoet.I18n.t('helpTooltipDesignerIdealWidth')
35157
  });
35158
  },
35159
- getTemplate: function() { return templates.imageBlockSettings; },
35160
  events: function() {
35161
  return {
35162
  'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
@@ -35182,10 +35246,10 @@ webpackJsonp([4],{
35182
  return;
35183
  }
35184
 
35185
- var MediaManager = wp.media.view.MediaFrame.Select.extend({
35186
 
35187
  initialize: function() {
35188
- wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
35189
 
35190
  _.defaults(this.options, {
35191
  multiple: true,
@@ -35207,7 +35271,7 @@ webpackJsonp([4],{
35207
  },
35208
 
35209
  createQuery: function(options) {
35210
- var query = wp.media.query(options);
35211
  return query;
35212
  },
35213
 
@@ -35217,7 +35281,7 @@ webpackJsonp([4],{
35217
  // Add the default states.
35218
  this.states.add([
35219
  // Main states.
35220
- new wp.media.controller.Library({
35221
  id: 'insert',
35222
  title: 'Add images',
35223
  priority: 20,
@@ -35239,8 +35303,8 @@ webpackJsonp([4],{
35239
  })
35240
  ]);
35241
 
35242
- if(wp.media.view.settings.post.featuredImageId) {
35243
- this.states.add(new wp.media.controller.FeaturedImage());
35244
  }
35245
  },
35246
 
@@ -35260,14 +35324,14 @@ webpackJsonp([4],{
35260
  this.on('updateExcluded', this.browseContent, this);
35261
 
35262
  var handlers = {
35263
- content: {
35264
- embed: 'embedContent',
35265
- 'edit-selection': 'editSelectionContent'
35266
- },
35267
- toolbar: {
35268
- 'main-insert': 'mainInsertToolbar'
35269
- }
35270
- };
35271
 
35272
  _.each(handlers, function(regionHandlers, region) {
35273
  _.each(regionHandlers, function(callback, handler) {
@@ -35277,13 +35341,13 @@ webpackJsonp([4],{
35277
  },
35278
 
35279
  uploadContent: function() {
35280
- wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
35281
  this.$el.addClass('hide-toolbar');
35282
  },
35283
 
35284
  // Content
35285
  embedContent: function() {
35286
- var view = new wp.media.view.Embed({
35287
  controller: this,
35288
  model: this.state()
35289
  }).render();
@@ -35297,7 +35361,7 @@ webpackJsonp([4],{
35297
  selection = state.get('selection'),
35298
  view;
35299
 
35300
- view = new wp.media.view.AttachmentsBrowser({
35301
  controller: this,
35302
  collection: selection,
35303
  selection: selection,
@@ -35306,7 +35370,7 @@ webpackJsonp([4],{
35306
  search: false,
35307
  dragInfo: true,
35308
 
35309
- AttachmentView: wp.media.view.Attachment.EditSelection
35310
  }).render();
35311
 
35312
  view.toolbar.set('backToLibrary', {
@@ -35326,7 +35390,7 @@ webpackJsonp([4],{
35326
  selectionStatusToolbar: function(view) {
35327
  var editable = this.state().get('editable');
35328
 
35329
- view.set('selection', new wp.media.view.Selection({
35330
  controller: this,
35331
  collection: this.state().get('selection'),
35332
  priority: -40,
@@ -35362,7 +35426,7 @@ webpackJsonp([4],{
35362
 
35363
  mainEmbedToolbar: function(toolbar) {
35364
  var tbar = toolbar;
35365
- tbar.view = new wp.media.view.Toolbar.Embed({
35366
  controller: this,
35367
  text: 'Add images'
35368
  });
@@ -35385,9 +35449,9 @@ webpackJsonp([4],{
35385
  }
35386
  }),
35387
  that = this;
35388
- this._mediaManager = theFrame;
35389
 
35390
- this._mediaManager.on('insert', function() {
35391
  // Append media manager image selections to Images tab
35392
  var selection = theFrame.state().get('selection');
35393
  selection.each(function(attachment) {
@@ -35447,7 +35511,7 @@ webpackJsonp([4],{
35447
  });
35448
 
35449
  ImageWidgetView = base.WidgetView.extend({
35450
- getTemplate: function() { return templates.imageInsertion; },
35451
  behaviors: {
35452
  DraggableBehavior: {
35453
  cloneOriginal: true,
@@ -35481,24 +35545,24 @@ webpackJsonp([4],{
35481
 
35482
  /***/ },
35483
 
35484
- /***/ 598:
35485
  /***/ function(module, exports, __webpack_require__) {
35486
 
35487
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35488
  * Divider content block
35489
  */
35490
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35491
- __webpack_require__(574),
35492
- __webpack_require__(594),
35493
- __webpack_require__(278),
35494
- __webpack_require__(273),
35495
- __webpack_require__(274)
35496
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, jQuery, MailPoet) {
35497
 
35498
  'use strict';
35499
 
35500
  var Module = {},
35501
- base = BaseBlock;
35502
 
35503
  Module.DividerBlockModel = base.BlockModel.extend({
35504
  defaults: function() {
@@ -35519,7 +35583,7 @@ webpackJsonp([4],{
35519
 
35520
  Module.DividerBlockView = base.BlockView.extend({
35521
  className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
35522
- getTemplate: function() { return templates.dividerBlock; },
35523
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35524
  behaviors: _.defaults({
35525
  ResizableBehavior: {
@@ -35570,7 +35634,7 @@ webpackJsonp([4],{
35570
  });
35571
 
35572
  Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
35573
- getTemplate: function() { return templates.dividerBlockSettings; },
35574
  events: function() {
35575
  return {
35576
  'click .mailpoet_field_divider_style': 'changeStyle',
@@ -35615,7 +35679,7 @@ webpackJsonp([4],{
35615
  });
35616
 
35617
  Module.DividerWidgetView = base.WidgetView.extend({
35618
- getTemplate: function() { return templates.dividerInsertion; },
35619
  behaviors: {
35620
  DraggableBehavior: {
35621
  cloneOriginal: true,
@@ -35644,22 +35708,23 @@ webpackJsonp([4],{
35644
 
35645
  /***/ },
35646
 
35647
- /***/ 599:
35648
  /***/ function(module, exports, __webpack_require__) {
35649
 
35650
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35651
  * Text content block
35652
  */
35653
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35654
- __webpack_require__(574),
35655
- __webpack_require__(594),
35656
- __webpack_require__(278)
35657
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _) {
 
35658
 
35659
  'use strict';
35660
 
35661
  var Module = {},
35662
- base = BaseBlock;
35663
 
35664
  Module.TextBlockModel = base.BlockModel.extend({
35665
  defaults: function() {
@@ -35672,7 +35737,7 @@ webpackJsonp([4],{
35672
 
35673
  Module.TextBlockView = base.BlockView.extend({
35674
  className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
35675
- getTemplate: function() { return templates.textBlock; },
35676
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
35677
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
35678
  TextEditorBehavior: {
@@ -35727,11 +35792,11 @@ webpackJsonp([4],{
35727
  });
35728
 
35729
  Module.TextBlockSettingsView = base.BlockSettingsView.extend({
35730
- getTemplate: function() { return templates.textBlockSettings; }
35731
  });
35732
 
35733
  Module.TextWidgetView = base.WidgetView.extend({
35734
- getTemplate: function() { return templates.textInsertion; },
35735
  behaviors: {
35736
  DraggableBehavior: {
35737
  cloneOriginal: true,
@@ -35762,22 +35827,22 @@ webpackJsonp([4],{
35762
 
35763
  /***/ },
35764
 
35765
- /***/ 600:
35766
  /***/ function(module, exports, __webpack_require__) {
35767
 
35768
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35769
  * Spacer content block
35770
  */
35771
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35772
- __webpack_require__(574),
35773
- __webpack_require__(594),
35774
- __webpack_require__(278)
35775
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _) {
35776
 
35777
  'use strict';
35778
 
35779
  var Module = {},
35780
- base = BaseBlock;
35781
 
35782
  Module.SpacerBlockModel = base.BlockModel.extend({
35783
  defaults: function() {
@@ -35795,7 +35860,7 @@ webpackJsonp([4],{
35795
 
35796
  Module.SpacerBlockView = base.BlockView.extend({
35797
  className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
35798
- getTemplate: function() { return templates.spacerBlock; },
35799
  behaviors: _.defaults({
35800
  ResizableBehavior: {
35801
  elementSelector: '.mailpoet_spacer',
@@ -35833,7 +35898,7 @@ webpackJsonp([4],{
35833
  });
35834
 
35835
  Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
35836
- getTemplate: function() { return templates.spacerBlockSettings; },
35837
  events: function() {
35838
  return {
35839
  'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -35843,7 +35908,7 @@ webpackJsonp([4],{
35843
  });
35844
 
35845
  Module.SpacerWidgetView = base.WidgetView.extend({
35846
- getTemplate: function() { return templates.spacerInsertion; },
35847
  behaviors: {
35848
  DraggableBehavior: {
35849
  cloneOriginal: true,
@@ -35873,22 +35938,23 @@ webpackJsonp([4],{
35873
 
35874
  /***/ },
35875
 
35876
- /***/ 601:
35877
  /***/ function(module, exports, __webpack_require__) {
35878
 
35879
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35880
  * Footer content block
35881
  */
35882
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35883
- __webpack_require__(574),
35884
- __webpack_require__(594),
35885
- __webpack_require__(278)
35886
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _) {
 
35887
 
35888
  'use strict';
35889
 
35890
  var Module = {},
35891
- base = BaseBlock;
35892
 
35893
  Module.FooterBlockModel = base.BlockModel.extend({
35894
  defaults: function() {
@@ -35916,7 +35982,7 @@ webpackJsonp([4],{
35916
 
35917
  Module.FooterBlockView = base.BlockView.extend({
35918
  className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
35919
- getTemplate: function() { return templates.footerBlock; },
35920
  modelEvents: _.extend({
35921
  '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'
35922
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
@@ -35953,7 +36019,7 @@ webpackJsonp([4],{
35953
  });
35954
 
35955
  Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
35956
- getTemplate: function() { return templates.footerBlockSettings; },
35957
  events: function() {
35958
  return {
35959
  'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
@@ -35961,8 +36027,8 @@ webpackJsonp([4],{
35961
  'change .mailpoet_field_footer_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
35962
  'change #mailpoet_field_footer_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
35963
  'change #mailpoet_field_footer_link_underline': function(event) {
35964
- this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
35965
- },
35966
  'change .mailpoet_field_footer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
35967
  'change .mailpoet_field_footer_alignment': _.partial(this.changeField, 'styles.text.textAlign'),
35968
  'click .mailpoet_done_editing': 'close'
@@ -35976,7 +36042,7 @@ webpackJsonp([4],{
35976
  });
35977
 
35978
  Module.FooterWidgetView = base.WidgetView.extend({
35979
- getTemplate: function() { return templates.footerInsertion; },
35980
  behaviors: {
35981
  DraggableBehavior: {
35982
  cloneOriginal: true,
@@ -36006,22 +36072,23 @@ webpackJsonp([4],{
36006
 
36007
  /***/ },
36008
 
36009
- /***/ 602:
36010
  /***/ function(module, exports, __webpack_require__) {
36011
 
36012
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
36013
  * Header content block
36014
  */
36015
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36016
- __webpack_require__(574),
36017
- __webpack_require__(594),
36018
- __webpack_require__(278)
36019
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _) {
 
36020
 
36021
  'use strict';
36022
 
36023
  var Module = {},
36024
- base = BaseBlock;
36025
 
36026
  Module.HeaderBlockModel = base.BlockModel.extend({
36027
  defaults: function() {
@@ -36049,7 +36116,7 @@ webpackJsonp([4],{
36049
 
36050
  Module.HeaderBlockView = base.BlockView.extend({
36051
  className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
36052
- getTemplate: function() { return templates.headerBlock; },
36053
  modelEvents: _.extend({
36054
  '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'
36055
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
@@ -36086,7 +36153,7 @@ webpackJsonp([4],{
36086
  });
36087
 
36088
  Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
36089
- getTemplate: function() { return templates.headerBlockSettings; },
36090
  events: function() {
36091
  return {
36092
  'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
@@ -36109,7 +36176,7 @@ webpackJsonp([4],{
36109
  });
36110
 
36111
  Module.HeaderWidgetView = base.WidgetView.extend({
36112
- getTemplate: function() { return templates.headerInsertion; },
36113
  behaviors: {
36114
  DraggableBehavior: {
36115
  cloneOriginal: true,
@@ -36139,7 +36206,7 @@ webpackJsonp([4],{
36139
 
36140
  /***/ },
36141
 
36142
- /***/ 603:
36143
  /***/ function(module, exports, __webpack_require__) {
36144
 
36145
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -36151,31 +36218,31 @@ webpackJsonp([4],{
36151
  * block settings view.
36152
  */
36153
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36154
- __webpack_require__(574),
36155
- __webpack_require__(594),
36156
- __webpack_require__(596),
36157
- __webpack_require__(598),
36158
- __webpack_require__(579),
36159
- __webpack_require__(274),
36160
- __webpack_require__(564),
36161
- __webpack_require__(278),
36162
- __webpack_require__(273)
36163
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
36164
- App,
36165
- BaseBlock,
36166
- ButtonBlock,
36167
- DividerBlock,
36168
- CommunicationComponent,
36169
- MailPoet,
36170
- SuperModel,
36171
- _,
36172
- jQuery
36173
  ) {
36174
 
36175
  'use strict';
36176
 
36177
  var Module = {},
36178
- base = BaseBlock;
36179
 
36180
  Module.ALCSupervisor = SuperModel.extend({
36181
  initialize: function() {
@@ -36205,7 +36272,7 @@ webpackJsonp([4],{
36205
  _.zip(models, renderedBlocks),
36206
  function(args) {
36207
  var model = args[0],
36208
- contents = args[1];
36209
  model.trigger('refreshPosts', contents);
36210
  }
36211
  );
@@ -36279,7 +36346,7 @@ webpackJsonp([4],{
36279
  }
36280
  App.getChannel().on('replaceAllButtonStyles', replaceButtonStylesHandler.bind(this));
36281
  },
36282
- getTemplate: function() { return templates.automatedLatestContentBlock; },
36283
  regions: {
36284
  toolsRegion: '.mailpoet_tools',
36285
  postsRegion: '.mailpoet_automated_latest_content_block_posts'
@@ -36312,7 +36379,7 @@ webpackJsonp([4],{
36312
 
36313
  // Sidebar view container
36314
  Module.AutomatedLatestContentBlockSettingsView = base.BlockSettingsView.extend({
36315
- getTemplate: function() { return templates.automatedLatestContentBlockSettings; },
36316
  events: function() {
36317
  return {
36318
  'click .mailpoet_automated_latest_content_hide_display_options': 'toggleDisplayOptions',
@@ -36494,7 +36561,7 @@ webpackJsonp([4],{
36494
  },
36495
  _updateContentTypes: function(postTypes) {
36496
  var select = this.$('.mailpoet_automated_latest_content_content_type'),
36497
- selectedValue = this.model.get('contentType');
36498
 
36499
  select.find('option').remove();
36500
  _.each(postTypes, function(type) {
@@ -36508,7 +36575,7 @@ webpackJsonp([4],{
36508
  });
36509
 
36510
  Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({
36511
- getTemplate: function() { return templates.automatedLatestContentInsertion; },
36512
  behaviors: {
36513
  DraggableBehavior: {
36514
  cloneOriginal: true,
@@ -36547,7 +36614,7 @@ webpackJsonp([4],{
36547
 
36548
  /***/ },
36549
 
36550
- /***/ 604:
36551
  /***/ function(module, exports, __webpack_require__) {
36552
 
36553
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -36563,36 +36630,36 @@ webpackJsonp([4],{
36563
  * block settings view.
36564
  */
36565
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36566
- __webpack_require__(535),
36567
- __webpack_require__(562),
36568
- __webpack_require__(563),
36569
- __webpack_require__(278),
36570
- __webpack_require__(273),
36571
- __webpack_require__(274),
36572
- __webpack_require__(574),
36573
- __webpack_require__(579),
36574
- __webpack_require__(594),
36575
- __webpack_require__(596),
36576
- __webpack_require__(598),
36577
- __webpack_require__(287)
36578
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
36579
- Backbone,
36580
- Marionette,
36581
- Radio,
36582
- _,
36583
- jQuery,
36584
- MailPoet,
36585
- App,
36586
- CommunicationComponent,
36587
- BaseBlock,
36588
- ButtonBlock,
36589
- DividerBlock
36590
  ) {
36591
 
36592
  'use strict';
36593
 
36594
  var Module = {},
36595
- base = BaseBlock;
36596
 
36597
  Module.PostsBlockModel = base.BlockModel.extend({
36598
  stale: ['_selectedPosts', '_availablePosts', '_transformedPosts'],
@@ -36729,7 +36796,7 @@ webpackJsonp([4],{
36729
 
36730
  Module.PostsBlockView = base.BlockView.extend({
36731
  className: 'mailpoet_block mailpoet_posts_block mailpoet_droppable_block',
36732
- getTemplate: function() { return templates.postsBlock; },
36733
  modelEvents: {}, // Forcefully disable all events
36734
  regions: _.extend({
36735
  postsRegion: '.mailpoet_posts_block_posts'
@@ -36768,7 +36835,7 @@ webpackJsonp([4],{
36768
  });
36769
 
36770
  Module.PostsBlockSettingsView = base.BlockSettingsView.extend({
36771
- getTemplate: function() { return templates.postsBlockSettings; },
36772
  regions: {
36773
  selectionRegion: '.mailpoet_settings_posts_selection',
36774
  displayOptionsRegion: '.mailpoet_settings_posts_display_options'
@@ -36860,7 +36927,7 @@ webpackJsonp([4],{
36860
  });
36861
 
36862
  var PostSelectionSettingsView = Marionette.View.extend({
36863
- getTemplate: function() { return templates.postSelectionPostsBlockSettings; },
36864
  regions: {
36865
  posts: '.mailpoet_post_selection_container'
36866
  },
@@ -36937,7 +37004,6 @@ webpackJsonp([4],{
36937
  results: _.map(
36938
  data.terms,
36939
  function(item) {
36940
- console.log(item);
36941
  return _.defaults({
36942
  text: data.taxonomies[item.taxonomy].labels.singular_name + ': ' + item.name,
36943
  id: item.term_id
@@ -36967,7 +37033,7 @@ webpackJsonp([4],{
36967
  },
36968
  _updateContentTypes: function(postTypes) {
36969
  var select = this.$('.mailpoet_settings_posts_content_type'),
36970
- selectedValue = this.model.get('contentType');
36971
 
36972
  select.find('option').remove();
36973
  _.each(postTypes, function(type) {
@@ -36981,11 +37047,11 @@ webpackJsonp([4],{
36981
  });
36982
 
36983
  var EmptyPostSelectionSettingsView = Marionette.View.extend({
36984
- getTemplate: function() { return templates.emptyPostPostsBlockSettings; }
36985
  });
36986
 
36987
  var SinglePostSelectionSettingsView = Marionette.View.extend({
36988
- getTemplate: function() { return templates.singlePostPostsBlockSettings; },
36989
  events: function() {
36990
  return {
36991
  'change .mailpoet_select_post_checkbox': 'postSelectionChange'
@@ -37012,7 +37078,7 @@ webpackJsonp([4],{
37012
  });
37013
 
37014
  var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
37015
- getTemplate: function() { return templates.displayOptionsPostsBlockSettings; },
37016
  events: function() {
37017
  return {
37018
  'click .mailpoet_posts_select_button': 'showButtonSettings',
@@ -37117,7 +37183,7 @@ webpackJsonp([4],{
37117
  });
37118
 
37119
  Module.PostsWidgetView = base.WidgetView.extend({
37120
- getTemplate: function() { return templates.postsInsertion; },
37121
  behaviors: {
37122
  DraggableBehavior: {
37123
  cloneOriginal: true,
@@ -37147,30 +37213,30 @@ webpackJsonp([4],{
37147
 
37148
  /***/ },
37149
 
37150
- /***/ 605:
37151
  /***/ function(module, exports, __webpack_require__) {
37152
 
37153
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37154
  * Social icons content block
37155
  */
37156
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37157
- __webpack_require__(574),
37158
- __webpack_require__(594),
37159
- __webpack_require__(535),
37160
- __webpack_require__(562),
37161
- __webpack_require__(564),
37162
- __webpack_require__(278),
37163
- __webpack_require__(273)
37164
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, Backbone, Marionette, SuperModel, _, jQuery) {
37165
 
37166
  'use strict';
37167
 
37168
  var Module = {},
37169
- base = BaseBlock,
37170
- SocialBlockSettingsIconSelectorView,
37171
- SocialBlockSettingsIconView,
37172
- SocialBlockSettingsIconCollectionView,
37173
- SocialBlockSettingsStylesView;
37174
 
37175
  Module.SocialIconModel = SuperModel.extend({
37176
  defaults: function() {
@@ -37237,7 +37303,7 @@ webpackJsonp([4],{
37237
 
37238
  var SocialIconView = Marionette.View.extend({
37239
  tagName: 'span',
37240
- getTemplate: function() { return templates.socialIconBlock; },
37241
  modelEvents: {
37242
  change: 'render'
37243
  },
@@ -37257,7 +37323,7 @@ webpackJsonp([4],{
37257
 
37258
  Module.SocialBlockView = base.BlockView.extend({
37259
  className: 'mailpoet_block mailpoet_social_block mailpoet_droppable_block',
37260
- getTemplate: function() { return templates.socialBlock; },
37261
  regions: _.extend({}, base.BlockView.prototype.regions, {
37262
  icons: '.mailpoet_social'
37263
  }),
@@ -37283,7 +37349,7 @@ webpackJsonp([4],{
37283
 
37284
  // Sidebar view container
37285
  Module.SocialBlockSettingsView = base.BlockSettingsView.extend({
37286
- getTemplate: function() { return templates.socialBlockSettings; },
37287
  regions: {
37288
  iconRegion: '#mailpoet_social_icons_selection',
37289
  stylesRegion: '#mailpoet_social_icons_styles'
@@ -37307,7 +37373,7 @@ webpackJsonp([4],{
37307
 
37308
  // Single icon settings view, used by the selector view
37309
  SocialBlockSettingsIconView = Marionette.View.extend({
37310
- getTemplate: function() { return templates.socialSettingsIcon; },
37311
  events: function() {
37312
  return {
37313
  'click .mailpoet_delete_block': 'deleteIcon',
@@ -37364,7 +37430,7 @@ webpackJsonp([4],{
37364
 
37365
  // Select icons section container view
37366
  SocialBlockSettingsIconSelectorView = Marionette.View.extend({
37367
- getTemplate: function() { return templates.socialSettingsIconSelector; },
37368
  regions: {
37369
  icons: '#mailpoet_social_icon_selector_contents'
37370
  },
@@ -37387,7 +37453,7 @@ webpackJsonp([4],{
37387
  });
37388
 
37389
  SocialBlockSettingsStylesView = Marionette.View.extend({
37390
- getTemplate: function() { return templates.socialSettingsStyles; },
37391
  modelEvents: {
37392
  change: 'render'
37393
  },
@@ -37415,7 +37481,7 @@ webpackJsonp([4],{
37415
  });
37416
 
37417
  Module.SocialWidgetView = base.WidgetView.extend({
37418
- getTemplate: function() { return templates.socialInsertion; },
37419
  behaviors: {
37420
  DraggableBehavior: {
37421
  cloneOriginal: true,
4
  /***/ function(module, exports, __webpack_require__) {
5
 
6
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
7
+ __webpack_require__(574),
8
+ __webpack_require__(278),
9
+ __webpack_require__(274),
10
+ __webpack_require__(552)
11
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, _, MailPoet) {
12
 
13
  var Module = {};
14
 
34
  action: 'getPostTypes',
35
  options: {}
36
  }).then(function(response) {
 
37
  return _.values(response.data);
38
  });
39
  };
158
  __webpack_require__(602);
159
  __webpack_require__(603);
160
  __webpack_require__(604);
161
+ __webpack_require__(605);
162
+ module.exports = __webpack_require__(606);
163
 
164
 
165
  /***/ },
9432
  var MailPoet = mp;
9433
 
9434
  MailPoet.Ajax = {
9435
+ version: 0.5,
9436
+ options: {},
9437
+ defaults: {
9438
+ url: null,
9439
+ api_version: null,
9440
+ endpoint: null,
9441
+ action: null,
9442
+ token: null,
9443
+ data: {}
9444
+ },
9445
+ post: function(options) {
9446
+ return this.request('post', options);
9447
+ },
9448
+ init: function(options) {
9449
+ // merge options
9450
+ this.options = jQuery.extend({}, this.defaults, options);
9451
 
9452
+ // set default url
9453
+ if(this.options.url === null) {
9454
+ this.options.url = window.ajaxurl;
9455
+ }
9456
 
9457
+ // set default token
9458
+ if(this.options.token === null) {
9459
+ this.options.token = window.mailpoet_token;
9460
+ }
9461
+ },
9462
+ getParams: function() {
9463
+ return {
9464
+ action: 'mailpoet',
9465
+ api_version: this.options.api_version,
9466
+ token: this.options.token,
9467
+ endpoint: this.options.endpoint,
9468
+ method: this.options.action,
9469
+ data: this.options.data || {}
9470
+ };
9471
+ },
9472
+ request: function(method, options) {
9473
  // set options
9474
+ this.init(options);
9475
 
9476
  // set request params
9477
+ var params = this.getParams();
9478
 
9479
  // remove null values from the data object
9480
+ if (_.isObject(params.data)) {
9481
+ params.data = _.pick(params.data, function(value) {
9482
+ return (value !== null);
9483
+ });
9484
+ }
9485
 
9486
  // ajax request
9487
+ var deferred = jQuery.post(
9488
  this.options.url,
9489
  params,
9490
  null,
9494
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
9495
 
9496
  // clear options
9497
+ this.options = {};
9498
 
9499
+ return deferred;
9500
+ }
9501
  };
9502
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
9503
 
9620
  if(this.renderer === 'html') {
9621
  return function() { return template; };
9622
  } else {
9623
+ return window.Handlebars.compile(template);
9624
  }
 
9625
  },
9626
  init: function(options) {
9627
  if(this.initialized === true) {
9689
  initOverlay: function(toggle) {
9690
  if(jQuery('#mailpoet_modal_overlay').length === 0) {
9691
  // insert overlay into the DOM
9692
+ jQuery('body').append(this.templates.overlay);
9693
  // insert loading indicator into overlay
9694
+ jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
9695
+ }
9696
+ return this;
9697
+ },
9698
+ toggleOverlay: function(toggle) {
9699
+ if(toggle === true) {
9700
+ jQuery('#mailpoet_modal_overlay')
9701
  .removeClass('mailpoet_overlay_hidden');
9702
+ } else {
9703
+ jQuery('#mailpoet_modal_overlay')
9704
  .addClass('mailpoet_overlay_hidden');
9705
+ }
9706
 
9707
+ return this;
9708
+ },
9709
+ setupEvents: function() {
9710
  // close popup when user clicks on close button
9711
  jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
9712
 
9757
  loadTemplate: function() {
9758
  if(this.subpanels.length > 0) {
9759
  // hide panel
9760
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
9761
 
9762
  // add sub panel wrapper
9763
+ jQuery('#mailpoet_'+this.options.type)
9764
  .append(this.templates['subpanel']);
9765
 
9766
  // add sub panel content
9767
+ jQuery('.mailpoet_'+this.options.type+'_body').last()
9768
  .html(this.subpanels[(this.subpanels.length - 1)].element);
9769
 
9770
  // focus on sub panel
9771
+ if(this.options.focus) {
9772
+ this.focus();
9773
+ }
9774
+ } else if (this.options.element) {
9775
+ jQuery('.mailpoet_'+this.options.type+'_body').empty();
9776
+ jQuery('.mailpoet_'+this.options.type+'_body')
9777
  .append(this.options.element);
9778
+ } else {
9779
+ jQuery('.mailpoet_'+this.options.type+'_body')
9780
  .html(
9781
  this.options.body_template(
9782
  this.options.data
9783
  )
9784
  );
9785
+ }
9786
 
9787
+ return this;
9788
+ },
9789
+ loadUrl: function() {
9790
+ if(this.options.method === 'get') {
9791
  // make ajax request
9792
+ jQuery.getJSON(this.options.url,
9793
  function(data) {
9794
  this.options.data = jQuery.extend({}, this.options.data, data);
9795
  // load template using fetched data
9798
  this.showModal();
9799
  }.bind(this)
9800
  );
9801
+ } else if(this.options.method === 'post') {
9802
  // make ajax request
9803
+ jQuery.post(this.options.url, JSON.stringify(this.options.params),
9804
  function(data) {
9805
  this.options.data = jQuery.extend({}, this.options.data, data);
9806
  // load template using fetched data
9810
  }.bind(this),
9811
  'json'
9812
  );
9813
+ }
9814
 
9815
+ return this;
9816
+ },
9817
+ setDimensions: function() {
9818
+ switch(this.options.type) {
9819
+ case 'popup':
9820
  // set popup dimensions
9821
+ jQuery('#mailpoet_popup').css({
9822
+ width: this.options.width,
9823
+ height: this.options.height
9824
+ });
9825
  // set popup wrapper height
9826
+ jQuery('#mailpoet_popup_wrapper').css({
9827
+ height: this.options.height
9828
+ });
9829
  break;
9830
+ case 'panel':
9831
  // set dimensions
9832
+ if(this.options.position === 'right') {
9833
+ jQuery('#mailpoet_panel').css({
9834
+ width: this.options.width,
9835
+ right: 0,
9836
+ marginRight: '-' + this.options.width,
9837
+ left: 'auto'
9838
+ });
9839
+ } else if(this.options.position === 'left') {
9840
+ jQuery('#mailpoet_panel').css({
9841
+ width: this.options.width,
9842
+ left: 0,
9843
+ marginLeft: '-' + this.options.width,
9844
+ right: 'auto'
9845
+ });
9846
+ }
9847
+ jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
9848
  break;
9849
+ }
9850
 
9851
+ return this;
9852
+ },
9853
+ setPosition: function() {
9854
+ switch(this.options.type) {
9855
+ case 'popup':
9856
+ var screenWidth = jQuery(window).width(),
9857
  screenHeight = jQuery(window).height(),
9858
  modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
9859
  modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
9860
 
9861
+ var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
9862
  left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
9863
 
9864
  // set position of popup depending on screen dimensions.
9865
+ jQuery('#mailpoet_popup').css({
9866
+ top: top,
9867
+ left: left
9868
+ });
9869
  break;
9870
+ case 'panel':
9871
+ setTimeout(function() {
9872
  // set position of popup depending on screen dimensions.
9873
+ if(this.options.position === 'right') {
9874
+ jQuery('#mailpoet_panel').css({
9875
+ marginRight: 0
9876
+ });
9877
+ } else if(this.options.position === 'left') {
9878
+ jQuery('#mailpoet_panel').css({
9879
+ marginLeft: 0
9880
+ });
9881
+ }
9882
+ }.bind(this), 0);
9883
  break;
9884
+ }
9885
 
9886
+ return this;
9887
+ },
9888
+ showModal: function() {
9889
  // set modal dimensions
9890
+ this.setDimensions();
9891
 
9892
  // remember the previously focused element
9893
+ this.prevFocus = jQuery(':focus');
9894
 
9895
  // add a flag on the body so that we can prevent scrolling
9896
+ jQuery('body').addClass('mailpoet_modal_opened');
9897
 
9898
  // show popup
9899
+ jQuery('#mailpoet_'+this.options.type).show();
9900
 
9901
  // display overlay
9902
+ this.showOverlay();
9903
 
9904
  // set modal position
9905
+ this.setPosition();
9906
 
9907
  // add class on highlighted elements
9908
+ if(this.options.highlight !== null) {
9909
+ if(this.options.highlight.length > 0) {
9910
+ this.highlightOn(this.options.highlight);
 
9911
  }
9912
+ }
9913
 
9914
+ if(this.options.focus) {
9915
+ this.focus();
9916
+ }
9917
 
9918
  // set popup as opened
9919
+ this.opened = true;
9920
 
9921
  // trigger init event if specified
9922
+ if(this.options.onInit !== null) {
9923
+ this.options.onInit(this);
9924
+ }
9925
 
9926
+ return this;
9927
+ },
9928
+ focus: function() {
9929
+ if(this.options.type == 'popup') {
9930
+ jQuery('#mailpoet_'+this.options.type).focus();
9931
+ } else {
9932
  // panel and subpanel
9933
+ jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
9934
  .filter(':visible').focus();
9935
+ }
9936
+ return this;
9937
+ },
9938
+ highlightOn: function(element) {
9939
+ jQuery(element).addClass('mailpoet_modal_highlight');
9940
+ return this;
9941
+ },
9942
+ highlightOff: function() {
9943
+ jQuery('.mailpoet_modal_highlight')
9944
  .removeClass('mailpoet_modal_highlight');
9945
+ return this;
9946
+ },
9947
+ hideModal: function(callback) {
9948
  // set modal as closed
9949
+ this.opened = false;
9950
 
9951
  // hide modal
9952
+ jQuery('#mailpoet_'+this.options.type).hide();
9953
 
9954
  // remove class on highlighted elements
9955
+ this.highlightOff();
9956
 
9957
  // remove class from body to let it be scrollable
9958
+ jQuery('body').removeClass('mailpoet_modal_opened');
9959
 
9960
+ return this;
9961
+ },
9962
+ showOverlay: function(force) {
9963
+ jQuery('#mailpoet_modal_overlay').show();
9964
+ return this;
9965
+ },
9966
+ hideOverlay: function() {
9967
+ jQuery('#mailpoet_modal_overlay').hide();
9968
+ return this;
9969
+ },
9970
+ popup: function(opts) {
9971
  // get options
9972
+ var options = opts || {};
9973
  // set modal type
9974
+ options.type = 'popup';
9975
  // set overlay state
9976
+ options.overlay = options.overlay || true;
9977
  // initialize modal
9978
+ this.init(options);
9979
  // open modal
9980
+ this.open();
9981
 
9982
+ return this;
9983
+ },
9984
+ panel: function(opts) {
9985
  // get options
9986
+ var options = opts || {};
9987
  // reset subpanels
9988
+ this.subpanels = [];
9989
  // set modal type
9990
+ options.type = 'panel';
9991
  // set overlay state
9992
+ options.overlay = options.overlay || false;
9993
  // set highlighted element
9994
+ options.highlight = options.highlight || null;
9995
  // set modal dimensions
9996
+ options.width = options.width || '40%';
9997
+ options.height = options.height || 'auto';
9998
  // initialize modal
9999
+ this.init(options);
10000
  // open modal
10001
+ this.open();
10002
 
10003
+ return this;
10004
+ },
10005
+ subpanel: function(options) {
10006
+ if(this.opened === false) {
10007
  // if no panel is already opened, let's create one instead
10008
+ this.panel(options);
10009
+ } else {
10010
  // if a panel is already opened, add a sub panel to it
10011
+ this.subpanels.push(options);
10012
+ this.loadTemplate();
10013
+ }
10014
 
10015
+ return this;
10016
+ },
10017
+ loading: function(toggle) {
10018
  // make sure the overlay is initialized and that it's visible
10019
+ this.initOverlay(true);
10020
 
10021
+ if(toggle === true) {
10022
+ this.showLoading();
10023
+ } else {
10024
+ this.hideLoading();
10025
+ }
10026
 
10027
+ return this;
10028
+ },
10029
+ showLoading: function() {
10030
+ jQuery('#mailpoet_loading').show();
10031
 
10032
  // add loading class to overlay
10033
+ jQuery('#mailpoet_modal_overlay')
10034
  .addClass('mailpoet_overlay_loading');
10035
 
10036
+ return this;
10037
+ },
10038
+ hideLoading: function() {
10039
+ jQuery('#mailpoet_loading').hide();
10040
 
10041
  // remove loading class from overlay
10042
+ jQuery('#mailpoet_modal_overlay')
10043
  .removeClass('mailpoet_overlay_loading');
10044
 
10045
+ return this;
10046
+ },
10047
+ open: function() {
10048
  // load template if specified
10049
+ if(this.options.template !== null) {
10050
  // check if a url was specified to get extra data
10051
+ if(this.options.url !== null) {
10052
+ this.loadUrl();
10053
+ } else {
10054
  // load template
10055
+ this.loadTemplate();
10056
 
10057
  // show modal window
10058
+ this.showModal();
 
 
 
10059
  }
10060
+ } else {
10061
+ this.cancel();
10062
+ }
10063
 
10064
+ return this;
10065
+ },
10066
+ success: function() {
10067
+ if(this.subpanels.length > 0) {
10068
+ if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
10069
+ this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
 
 
 
 
 
10070
  }
10071
+ } else {
10072
+ if(this.options.onSuccess !== null) {
10073
+ this.options.onSuccess(this.options.data);
10074
+ }
10075
+ }
10076
+ this.close();
10077
 
10078
+ return this;
10079
+ },
10080
+ cancel: function() {
10081
+ if(this.subpanels.length > 0) {
10082
+ if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
10083
+ this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
 
 
 
 
 
10084
  }
10085
+ } else {
10086
+ if(this.options.onCancel !== null) {
10087
+ this.options.onCancel(this.options.data);
10088
+ }
10089
+ }
10090
+ this.close();
10091
 
10092
+ return this;
10093
+ },
10094
+ destroy: function() {
10095
+ this.hideOverlay();
10096
 
10097
  // remove extra modal
10098
+ if(jQuery('#mailpoet_'+this.options.type).length > 0) {
10099
+ jQuery('#mailpoet_'+this.options.type).remove();
10100
+ }
10101
 
10102
+ this.initialized = false;
10103
 
10104
+ return this;
10105
+ },
10106
+ close: function() {
10107
+ if(this.isLocked() === true) { return this; }
10108
 
10109
+ if(this.subpanels.length > 0) {
10110
  // close subpanel
10111
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
10112
 
10113
  // show previous panel
10114
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
10115
 
10116
  // remove last subpanels
10117
+ this.subpanels.pop();
10118
 
10119
  // focus on previous panel
10120
+ if(this.options.focus) {
10121
+ this.focus();
 
 
 
10122
  }
10123
 
10124
+ return this;
10125
+ }
10126
+
10127
  // remove event handlers
10128
+ this.removeEvents();
10129
 
10130
  // hide modal window
10131
+ this.hideModal();
10132
 
10133
  // destroy modal element
10134
+ this.destroy();
10135
 
10136
  // restore the previously focused element
10137
+ if(this.prevFocus !== undefined){
10138
+ this.prevFocus.focus();
10139
+ }
10140
 
10141
  // reset options
10142
+ this.options = {
10143
+ onSuccess: null,
10144
+ onCancel: null
10145
+ };
10146
 
10147
+ return this;
10148
+ }
10149
  };
10150
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
10151
 
10233
  // setup onClose callback
10234
  var onClose = null;
10235
  if (this.options.onClose !== null) {
10236
+ onClose = this.options.onClose;
10237
  }
10238
 
10239
  // listen to remove event
10241
  jQuery(this).fadeOut(200, function() {
10242
  // on close callback
10243
  if (onClose !== null) {
10244
+ onClose();
10245
  }
10246
  // remove notice
10247
  jQuery(this).remove();
10302
  switch (this.options.type) {
10303
  case 'success':
10304
  this.element.addClass('notice notice-success');
10305
+ break;
10306
  case 'system':
10307
  this.element.addClass('notice notice-warning');
10308
+ break;
10309
  case 'error':
10310
  this.element.addClass('notice notice-error');
10311
+ break;
10312
  }
10313
 
10314
  // make the notice appear
10325
  } else if (this.options.hideClose === false) {
10326
  this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
10327
  this.element.find('.mailpoet_notice_close').on('click', function() {
10328
+ jQuery(this).trigger('close');
10329
  });
10330
  }
10331
 
27607
  /***/ function(module, exports, __webpack_require__) {
27608
 
27609
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27610
+ __webpack_require__(535),
27611
+ __webpack_require__(562),
27612
+ __webpack_require__(563),
27613
+ __webpack_require__(273),
27614
+ __webpack_require__(278),
27615
+ __webpack_require__(543),
27616
+ __webpack_require__(575)
27617
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Backbone, Marionette, BackboneRadio, jQuery, _, Handlebars) {
27618
  var Radio = BackboneRadio;
27619
 
27620
  var AppView = Marionette.View.extend({
27658
  /***/ function(module, exports, __webpack_require__) {
27659
 
27660
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27661
+ __webpack_require__(574),
27662
+ __webpack_require__(564)
27663
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, SuperModel) {
27664
 
27665
  var Module = {};
27666
 
27702
  /***/ function(module, exports, __webpack_require__) {
27703
 
27704
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27705
+ __webpack_require__(574),
27706
+ __webpack_require__(562),
27707
+ __webpack_require__(564),
27708
+ __webpack_require__(278)
27709
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Marionette, SuperModel, _) {
27710
 
27711
  'use strict';
27712
 
27751
  });
27752
 
27753
  Module.StylesView = Marionette.View.extend({
27754
+ getTemplate: function() { return window.templates.styles; },
27755
  modelEvents: {
27756
  change: 'render'
27757
  },
27799
  /***/ function(module, exports, __webpack_require__) {
27800
 
27801
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
27802
+ __webpack_require__(574),
27803
+ __webpack_require__(579),
27804
+ __webpack_require__(274),
27805
+ __webpack_require__(535),
27806
+ __webpack_require__(562),
27807
+ __webpack_require__(564),
27808
+ __webpack_require__(278),
27809
+ __webpack_require__(273),
27810
+ __webpack_require__(567)
27811
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
27812
+ App,
27813
+ CommunicationComponent,
27814
+ MailPoet,
27815
+ Backbone,
27816
+ Marionette,
27817
+ SuperModel,
27818
+ _,
27819
+ jQuery,
27820
+ StickyKit
27821
  ) {
27822
 
27823
  'use strict';
27853
  Module.getLayoutWidgets = function() { return Module._layoutWidgets; };
27854
 
27855
  var SidebarView = Marionette.View.extend({
27856
+ getTemplate: function() { return window.templates.sidebar; },
27857
  regions: {
27858
  contentRegion: '.mailpoet_content_region',
27859
  layoutRegion: '.mailpoet_layout_region',
27947
  * Responsible for rendering draggable content widgets
27948
  */
27949
  Module.SidebarWidgetsView = Marionette.View.extend({
27950
+ getTemplate: function() { return window.templates.sidebarContent; },
27951
  regions: {
27952
  widgets: '.mailpoet_region_content'
27953
  },
27967
  * Responsible for rendering draggable layout widgets
27968
  */
27969
  Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({
27970
+ getTemplate: function() { return window.templates.sidebarLayout; }
27971
  });
27972
 
27973
  /**
27974
  * Responsible for managing global styles
27975
  */
27976
  Module.SidebarStylesView = Marionette.View.extend({
27977
+ getTemplate: function() { return window.templates.sidebarStyles; },
27978
  behaviors: {
27979
  ColorPickerBehavior: {}
27980
  },
28038
  });
28039
 
28040
  Module.SidebarPreviewView = Marionette.View.extend({
28041
+ getTemplate: function() { return window.templates.sidebarPreview; },
28042
  events: {
28043
  'click .mailpoet_show_preview': 'showPreview',
28044
  'click #mailpoet_send_preview': 'sendPreview'
28146
  });
28147
 
28148
  Module.NewsletterPreviewView = Marionette.View.extend({
28149
+ getTemplate: function() { return window.templates.newsletterPreview; },
28150
  initialize: function(options) {
28151
  this.previewUrl = options.previewUrl;
28152
  this.width = '100%';
28205
  /***/ function(module, exports, __webpack_require__) {
28206
 
28207
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28208
+ __webpack_require__(574),
28209
+ __webpack_require__(564),
28210
+ __webpack_require__(278),
28211
+ __webpack_require__(274)
28212
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, SuperModel, _, MailPoet) {
28213
  'use strict';
28214
 
28215
  var Module = {};
28221
  whitelisted: ['id', 'subject', 'preheader'],
28222
  initialize: function(options) {
28223
  this.on('change', function() {
28224
+ App.getChannel().trigger('autoSave');
28225
  });
28226
  },
28227
  toJSON: function() {
28265
  };
28266
 
28267
  Module.getNewsletter = function() {
28268
+ return Module.newsletter;
28269
  };
28270
 
28271
  Module.findModels = function(predicate) {
28319
  /***/ function(module, exports, __webpack_require__) {
28320
 
28321
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28322
+ __webpack_require__(574),
28323
+ __webpack_require__(535),
28324
+ __webpack_require__(562),
28325
+ __webpack_require__(278),
28326
+ __webpack_require__(273),
28327
+ __webpack_require__(274)
28328
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Backbone, Marionette, _, jQuery, MailPoet) {
28329
 
28330
  'use strict';
28331
 
28332
  var Module = {};
28333
 
28334
  Module.HeadingView = Marionette.View.extend({
28335
+ getTemplate: function() { return window.templates.heading; },
28336
  templateContext: function() {
28337
  return {
28338
  model: this.model.toJSON()
28372
  /***/ function(module, exports, __webpack_require__) {
28373
 
28374
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
28375
+ __webpack_require__(574),
28376
+ __webpack_require__(579),
28377
+ __webpack_require__(274),
28378
+ __webpack_require__(556),
28379
+ __webpack_require__(535),
28380
+ __webpack_require__(562),
28381
+ __webpack_require__(273),
28382
+ __webpack_require__(568),
28383
+ __webpack_require__(569),
28384
+ __webpack_require__(583),
28385
+ __webpack_require__(278),
28386
+ __webpack_require__(273)
28387
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
28388
+ App,
28389
+ CommunicationComponent,
28390
+ MailPoet,
28391
+ Notice,
28392
+ Backbone,
28393
+ Marionette,
28394
+ jQuery,
28395
+ Blob,
28396
+ FileSaver,
28397
+ html2canvas,
28398
+ _,
28399
+ $
28400
+ ) {
28401
 
28402
  'use strict';
28403
 
28404
  var Module = {},
28405
+ saveTimeout;
28406
 
28407
  // Save editor contents to server
28408
  Module.save = function() {
28450
  // Removes 1px left transparent border from resulting canvas.
28451
 
28452
  var oldContext = oldCanvas.getContext('2d'),
28453
+ newCanvas = document.createElement('canvas'),
28454
+ newContext = newCanvas.getContext('2d'),
28455
+ leftBorderWidth = 1;
28456
 
28457
  newCanvas.width = oldCanvas.width;
28458
  newCanvas.height = oldCanvas.height;
28469
 
28470
  Module.saveTemplate = function(options) {
28471
  var that = this,
28472
+ promise = jQuery.Deferred();
28473
 
28474
  promise.then(function(thumbnail) {
28475
  var data = _.extend(options || {}, {
28516
  };
28517
 
28518
  Module.SaveView = Marionette.View.extend({
28519
+ getTemplate: function() { return window.templates.save; },
28520
  events: {
28521
  'click .mailpoet_save_button': 'save',
28522
  'click .mailpoet_save_show_options': 'toggleSaveOptions',
28566
  },
28567
  saveAsTemplate: function() {
28568
  var templateName = this.$('.mailpoet_save_as_template_name').val(),
28569
+ templateDescription = this.$('.mailpoet_save_as_template_description').val(),
28570
+ that = this;
28571
 
28572
  if (templateName === '') {
28573
  MailPoet.Notice.error(
28622
  },
28623
  exportTemplate: function() {
28624
  var templateName = this.$('.mailpoet_export_template_name').val(),
28625
+ templateDescription = this.$('.mailpoet_export_template_description').val(),
28626
+ that = this;
28627
 
28628
  if (templateName === '') {
28629
  MailPoet.Notice.error(
33305
  * For more check: http://marionettejs.com/docs/marionette.behaviors.html#behaviorslookup
33306
  */
33307
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33308
+ __webpack_require__(562)
33309
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(BackboneMarionette) {
33310
  var Marionette = BackboneMarionette;
33311
  var BehaviorsLookup = {};
33312
  Marionette.Behaviors.behaviorsLookup = function() {
33330
  * Adds a color picker integration with the view
33331
  */
33332
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33333
+ __webpack_require__(562),
33334
+ __webpack_require__(585),
33335
+ __webpack_require__(274),
33336
+ __webpack_require__(566)
33337
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup, MailPoet, Spectrum) {
33338
  var BL = BehaviorsLookup;
33339
 
33340
  BL.ColorPickerBehavior = Marionette.Behavior.extend({
33341
  onRender: function() {
33342
+ var that = this,
33343
+ preferredFormat = 'hex6';
33344
+ this.view.$('.mailpoet_color').each(function () {
33345
+ var $input = that.view.$(this);
33346
+ var updateColorInput = function(color) {
33347
+ if(color && color.getAlpha() > 0) {
33348
+ $input.val(color.toString(preferredFormat));
33349
+ } else {
33350
+ $input.val('');
33351
+ }
33352
+ $input.trigger('change');
33353
+ };
33354
+ $input.spectrum({
33355
+ clickoutFiresChange: true,
33356
+ showInput: true,
33357
+ showInitial: true,
33358
+ showPalette: true,
33359
+ showSelectionPalette: true,
33360
+ palette: [],
33361
+ localStorageKey: 'newsletter_editor.spectrum.palette',
33362
+ preferredFormat: preferredFormat,
33363
+ allowEmpty: true,
33364
+ chooseText: MailPoet.I18n.t('selectColor'),
33365
+ cancelText: MailPoet.I18n.t('cancelColorSelection'),
33366
+ change: updateColorInput,
33367
+ move: updateColorInput,
33368
+ hide: updateColorInput
33369
+ });
33370
+ });
33371
  }
33372
  });
33373
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
33378
  /***/ 587:
33379
  /***/ function(module, exports, __webpack_require__) {
33380
 
33381
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
33382
+ /**
33383
  * ContainerDropZoneBehavior
33384
  *
33385
  * A receiving behavior for drag&drop.
33387
  * accept droppables
33388
  */
33389
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33390
+ __webpack_require__(562),
33391
+ __webpack_require__(278),
33392
+ __webpack_require__(273),
33393
+ __webpack_require__(585),
33394
+ __webpack_require__(565)
33395
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, jQuery, BL, interact) {
33396
  var BehaviorsLookup = BL;
33397
 
33398
  BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
33402
  onRender: function() {
33403
  var dragAndDropDisabled = _.isObject(this.view.options.renderOptions) && this.view.options.renderOptions.disableDragAndDrop === true;
33404
  if (!dragAndDropDisabled) {
33405
+ this.addDropZone();
33406
  }
33407
  },
33408
  addDropZone: function(_event) {
33576
 
33577
  if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') {
33578
  // Regular blocks always need to be inserted into columns - vertical containers
33579
+
33580
+ tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
33581
+ orientation: 'vertical'
33582
  });
33583
  tempCollection.get('blocks').add(droppableModel);
33584
  viewCollection.add(tempCollection, {at: index});
33592
  // and inserting dropModel into that
33593
  var tempModel = viewCollection.at(dropPosition.index);
33594
 
33595
+ tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
33596
+ orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical'
33597
  });
33598
 
33599
  viewCollection.remove(tempModel);
33600
 
33601
  if (tempCollection.get('orientation') === 'horizontal') {
33602
  if (dropPosition.position === 'before') {
33603
+ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
33604
  orientation: 'vertical'
33605
  });
33606
  tempCollection2.get('blocks').add(droppableModel);
33607
  tempCollection.get('blocks').add(tempCollection2);
33608
  }
33609
+ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
33610
  orientation: 'vertical'
33611
  });
33612
  tempCollection2.get('blocks').add(tempModel);
33613
  tempCollection.get('blocks').add(tempCollection2);
33614
  if (dropPosition.position === 'after') {
33615
+ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
33616
  orientation: 'vertical'
33617
  });
33618
  tempCollection2.get('blocks').add(droppableModel);
33673
 
33674
  insertionType, index, position, indexAndPosition;
33675
 
33676
+ var unsafe = !!is_unsafe;
33677
 
33678
  if (this.getCollection().length === 0) {
33679
  return {
33759
  if (eventOffset <= closeOffset + elementDimension / 2) {
33760
  // First half of the element
33761
  return {
33762
+ index: index,
33763
+ position: 'before'
33764
  };
33765
  } else {
33766
  // Second half of the element
33767
  return {
33768
+ index: index,
33769
+ position: 'after'
33770
  };
33771
  }
33772
  },
33834
  * Part of the drag&drop behavior.
33835
  */
33836
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33837
+ __webpack_require__(562),
33838
+ __webpack_require__(278),
33839
+ __webpack_require__(273),
33840
+ __webpack_require__(585),
33841
+ __webpack_require__(565)
33842
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, jQuery, BehaviorsLookup, interact) {
33843
  var BL = BehaviorsLookup;
33844
 
33845
  BL.DraggableBehavior = Marionette.Behavior.extend({
33862
  },
33863
  onRender: function() {
33864
  var that = this,
33865
+ interactable;
33866
 
33867
  // Give instances more control over whether Draggable should be applied
33868
  if (!this.options.testAttachToInstance(this.view.model, this.view)) return;
33869
 
33870
  interactable = interact(this.$el.get(0), {
33871
+ ignoreFrom: this.options.ignoreSelector
33872
  }).draggable({
33873
  // allow dragging of multple elements at the same time
33874
  max: Infinity,
33883
  // Use substitution instead of a clone
33884
  var tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined,
33885
  // Or use a clone
33886
+ clone = tempClone || event.target.cloneNode(true),
33887
 
33888
  $original = jQuery(event.target),
33889
  $clone = jQuery(clone),
33977
  /***/ },
33978
 
33979
  /***/ 589:
33980
+ /***/ function(module, exports, __webpack_require__) {
33981
+
33982
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
33983
+ * Highlight Container Behavior
33984
+ *
33985
+ * Highlights a container block when hovering over its tools
33986
+ */
33987
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
33988
+ __webpack_require__(562),
33989
+ __webpack_require__(585)
33990
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup) {
33991
+ var BL = BehaviorsLookup;
33992
+
33993
+ BL.HighlightContainerBehavior = Marionette.Behavior.extend({
33994
+ events: {
33995
+ 'mouseenter @ui.tools': 'enableHighlight',
33996
+ 'mouseleave @ui.tools': 'disableHighlight'
33997
+ },
33998
+ enableHighlight: function() {
33999
+ this.$el.addClass('mailpoet_highlight');
34000
+ },
34001
+ disableHighlight: function() {
34002
+ if (!this.view._isBeingEdited) {
34003
+ this.$el.removeClass('mailpoet_highlight');
34004
+ }
34005
+ }
34006
+ });
34007
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
34008
+
34009
+
34010
+ /***/ },
34011
+
34012
+ /***/ 590:
34013
  /***/ function(module, exports, __webpack_require__) {
34014
 
34015
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34018
  * Highlights a block that is being edited
34019
  */
34020
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34021
+ __webpack_require__(562),
34022
+ __webpack_require__(585)
34023
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup) {
34024
  var BL = BehaviorsLookup;
34025
 
34026
  BL.HighlightEditingBehavior = Marionette.Behavior.extend({
34029
  stopEditing: 'disableHighlight'
34030
  },
34031
  enableHighlight: function() {
34032
+ this.view._isBeingEdited = true;
34033
  this.$el.addClass('mailpoet_highlight');
34034
  },
34035
  disableHighlight: function() {
34036
+ this.view._isBeingEdited = false;
34037
  this.$el.removeClass('mailpoet_highlight');
34038
  }
34039
  });
34042
 
34043
  /***/ },
34044
 
34045
+ /***/ 591:
34046
  /***/ function(module, exports, __webpack_require__) {
34047
 
34048
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34051
  * Allows resizing elements within a block
34052
  */
34053
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34054
+ __webpack_require__(562),
34055
+ __webpack_require__(585),
34056
+ __webpack_require__(565)
34057
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, BehaviorsLookup, interact) {
34058
  var BL = BehaviorsLookup;
34059
 
34060
  BL.ResizableBehavior = Marionette.Behavior.extend({
34078
  },
34079
  attachResize: function() {
34080
  var domElement = (this.options.elementSelector === null) ? this.view.$el.get(0) : this.view.$(this.options.elementSelector).get(0),
34081
+ that = this;
34082
  interact(domElement).resizable({
34083
  //axis: 'y',
34084
  edges: {
34119
 
34120
  /***/ },
34121
 
34122
+ /***/ 592:
34123
  /***/ function(module, exports, __webpack_require__) {
34124
 
34125
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34128
  * Allows sorting elements within a collection
34129
  */
34130
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34131
+ __webpack_require__(562),
34132
+ __webpack_require__(278),
34133
+ __webpack_require__(585)
34134
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, BehaviorsLookup) {
34135
  var BL = BehaviorsLookup;
34136
 
34137
  BL.SortableBehavior = Marionette.Behavior.extend({
34167
 
34168
  /***/ },
34169
 
34170
+ /***/ 593:
34171
  /***/ function(module, exports, __webpack_require__) {
34172
 
34173
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34176
  * Opens up settings of a BlockView if contents are clicked upon
34177
  */
34178
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34179
+ __webpack_require__(562),
34180
+ __webpack_require__(273),
34181
+ __webpack_require__(585)
34182
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, jQuery, BehaviorsLookup) {
34183
  var BL = BehaviorsLookup;
34184
 
34185
  BL.ShowSettingsBehavior = Marionette.Behavior.extend({
34206
 
34207
  /***/ },
34208
 
34209
+ /***/ 594:
34210
  /***/ function(module, exports, __webpack_require__) {
34211
 
34212
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34215
  * Adds TinyMCE text editing capabilities to a view
34216
  */
34217
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34218
+ __webpack_require__(562),
34219
+ __webpack_require__(278),
34220
+ __webpack_require__(585)
34221
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Marionette, _, BehaviorsLookup) {
34222
  var BL = BehaviorsLookup;
34223
 
34224
  BL.TextEditorBehavior = Marionette.Behavior.extend({
34276
  editor.focus();
34277
  if (that._isActivationClick) {
34278
  editor.selection.setRng(
34279
+ window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
34280
  );
34281
  that._isActivationClick = false;
34282
  }
34284
 
34285
  editor.on('focus', function(e) {
34286
  that.view.triggerMethod('text:editor:focus');
34287
+ that._isActivationClick = true;
34288
  });
34289
 
34290
  editor.on('blur', function(e) {
34299
 
34300
  /***/ },
34301
 
34302
+ /***/ 595:
34303
  /***/ function(module, exports, __webpack_require__) {
34304
 
34305
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34309
  * BlockToolsView, BlockSettingsView and BlockWidgetView are optional.
34310
  */
34311
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34312
+ __webpack_require__(574),
34313
+ __webpack_require__(562),
34314
+ __webpack_require__(564),
34315
+ __webpack_require__(278),
34316
+ __webpack_require__(273),
34317
+ __webpack_require__(274),
34318
+ __webpack_require__(555)
34319
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, Marionette, SuperModel, _, jQuery, MailPoet, Modal) {
34320
 
34321
  'use strict';
34322
 
34323
  var Module = {},
34324
+ AugmentedView = Marionette.View.extend({});
34325
 
34326
  Module.BlockModel = SuperModel.extend({
34327
  stale: [], // Attributes to be removed upon saving
34482
  });
34483
 
34484
  Module.BlockToolsView = AugmentedView.extend({
34485
+ getTemplate: function() { return window.templates.genericBlockTools; },
34486
  events: {
34487
  'click .mailpoet_edit_block': 'changeSettings',
34488
  'click .mailpoet_delete_block_activate': 'showDeletionConfirmation',
34579
  this.model.set(field, jQuery(event.target).val() + suffix);
34580
  },
34581
  changeBoolField: function(field, event) {
34582
+ this.model.set(field, (jQuery(event.target).val() === 'true'));
34583
  },
34584
  changeBoolCheckboxField: function(field, event) {
34585
  this.model.set(field, (!!jQuery(event.target).prop('checked')));
34614
 
34615
  /***/ },
34616
 
34617
+ /***/ 596:
34618
  /***/ function(module, exports, __webpack_require__) {
34619
 
34620
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34623
  * as other containers.
34624
  */
34625
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34626
+ __webpack_require__(535),
34627
+ __webpack_require__(562),
34628
+ __webpack_require__(278),
34629
+ __webpack_require__(273),
34630
+ __webpack_require__(574),
34631
+ __webpack_require__(595)
34632
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(Backbone, Marionette, _, jQuery, App, BaseBlock) {
34633
 
34634
  'use strict';
34635
 
34636
  var Module = {},
34637
+ base = BaseBlock,
34638
+ BlockCollection;
34639
 
34640
  BlockCollection = Backbone.Collection.extend({
34641
  model: base.BlockModel,
34722
  }
34723
  }),
34724
  className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
34725
+ getTemplate: function() { return window.templates.containerBlock; },
34726
  events: _.extend({}, base.BlockView.prototype.events, {
34727
  'click .mailpoet_newsletter_layer_selector': 'toggleEditingLayer'
34728
  }),
34757
  // for root and column containers.
34758
  return view.renderOptions.depth === 1;
34759
  }
34760
+ },
34761
+ HighlightContainerBehavior: {}
34762
  }),
34763
  onDragSubstituteBy: function() {
34764
  // For two and three column layouts display their respective widgets,
34837
  });
34838
 
34839
  Module.ContainerBlockEmptyView = Marionette.View.extend({
34840
+ getTemplate: function() { return window.templates.containerEmpty; },
34841
  initialize: function(options) {
34842
  this.renderOptions = _.defaults(options.renderOptions || {}, {});
34843
  },
34854
  });
34855
 
34856
  Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
34857
+ getTemplate: function() { return window.templates.containerBlockSettings; },
34858
  events: function() {
34859
  return {
34860
  'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
34886
  });
34887
 
34888
  Module.ContainerBlockColumnSettingsView = Marionette.View.extend({
34889
+ getTemplate: function() { return window.templates.containerBlockColumnSettings; },
34890
  initialize: function(options) {
34891
  this.columnNumber = (options.columnIndex || 0) + 1;
34892
  },
34900
 
34901
  Module.OneColumnContainerWidgetView = base.WidgetView.extend({
34902
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34903
+ getTemplate: function() { return window.templates.oneColumnLayoutInsertion; },
34904
  behaviors: {
34905
  DraggableBehavior: {
34906
  cloneOriginal: true,
34918
 
34919
  Module.TwoColumnContainerWidgetView = base.WidgetView.extend({
34920
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34921
+ getTemplate: function() { return window.templates.twoColumnLayoutInsertion; },
34922
  behaviors: {
34923
  DraggableBehavior: {
34924
  cloneOriginal: true,
34937
 
34938
  Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({
34939
  className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
34940
+ getTemplate: function() { return window.templates.threeColumnLayoutInsertion; },
34941
  behaviors: {
34942
  DraggableBehavior: {
34943
  cloneOriginal: true,
34986
 
34987
  /***/ },
34988
 
34989
+ /***/ 597:
34990
  /***/ function(module, exports, __webpack_require__) {
34991
 
34992
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
34993
  * Button content block
34994
  */
34995
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
34996
+ __webpack_require__(574),
34997
+ __webpack_require__(595),
34998
+ __webpack_require__(274),
34999
+ __webpack_require__(278),
35000
+ __webpack_require__(273)
35001
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, MailPoet, _, jQuery) {
35002
 
35003
  'use strict';
35004
 
35005
  var Module = {},
35006
+ base = BaseBlock;
35007
 
35008
  Module.ButtonBlockModel = base.BlockModel.extend({
35009
  defaults: function() {
35033
 
35034
  Module.ButtonBlockView = base.BlockView.extend({
35035
  className: 'mailpoet_block mailpoet_button_block mailpoet_droppable_block',
35036
+ getTemplate: function() { return window.templates.buttonBlock; },
35037
  onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
35038
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
35039
  ShowSettingsBehavior: {}
35056
  });
35057
 
35058
  Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
35059
+ getTemplate: function() { return window.templates.buttonBlockSettings; },
35060
  events: function() {
35061
  return {
35062
  'input .mailpoet_field_button_text': _.partial(this.changeField, 'text'),
35112
  });
35113
 
35114
  Module.ButtonWidgetView = base.WidgetView.extend({
35115
+ getTemplate: function() { return window.templates.buttonInsertion; },
35116
  behaviors: {
35117
  DraggableBehavior: {
35118
  cloneOriginal: true,
35142
 
35143
  /***/ },
35144
 
35145
+ /***/ 598:
35146
  /***/ function(module, exports, __webpack_require__) {
35147
 
35148
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35149
  * Image content block
35150
  */
35151
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35152
+ __webpack_require__(574),
35153
+ __webpack_require__(595),
35154
+ __webpack_require__(278),
35155
+ __webpack_require__(274),
35156
+ __webpack_require__(273)
35157
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, MailPoet, jQuery) {
35158
 
35159
  'use strict';
35160
 
35161
  var Module = {},
35162
+ base = BaseBlock,
35163
+ ImageWidgetView;
35164
 
35165
  Module.ImageBlockModel = base.BlockModel.extend({
35166
  defaults: function() {
35183
 
35184
  Module.ImageBlockView = base.BlockView.extend({
35185
  className: 'mailpoet_block mailpoet_image_block mailpoet_droppable_block',
35186
+ getTemplate: function() { return window.templates.imageBlock; },
35187
  onDragSubstituteBy: function() { return Module.ImageWidgetView; },
35188
  templateContext: function() {
35189
  return _.extend({
35220
  tooltip: MailPoet.I18n.t('helpTooltipDesignerIdealWidth')
35221
  });
35222
  },
35223
+ getTemplate: function() { return window.templates.imageBlockSettings; },
35224
  events: function() {
35225
  return {
35226
  'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
35246
  return;
35247
  }
35248
 
35249
+ var MediaManager = window.wp.media.view.MediaFrame.Select.extend({
35250
 
35251
  initialize: function() {
35252
+ window.wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
35253
 
35254
  _.defaults(this.options, {
35255
  multiple: true,
35271
  },
35272
 
35273
  createQuery: function(options) {
35274
+ var query = window.wp.media.query(options);
35275
  return query;
35276
  },
35277
 
35281
  // Add the default states.
35282
  this.states.add([
35283
  // Main states.
35284
+ new window.wp.media.controller.Library({
35285
  id: 'insert',
35286
  title: 'Add images',
35287
  priority: 20,
35303
  })
35304
  ]);
35305
 
35306
+ if(window.wp.media.view.settings.post.featuredImageId) {
35307
+ this.states.add(new window.wp.media.controller.FeaturedImage());
35308
  }
35309
  },
35310
 
35324
  this.on('updateExcluded', this.browseContent, this);
35325
 
35326
  var handlers = {
35327
+ content: {
35328
+ embed: 'embedContent',
35329
+ 'edit-selection': 'editSelectionContent'
35330
+ },
35331
+ toolbar: {
35332
+ 'main-insert': 'mainInsertToolbar'
35333
+ }
35334
+ };
35335
 
35336
  _.each(handlers, function(regionHandlers, region) {
35337
  _.each(regionHandlers, function(callback, handler) {
35341
  },
35342
 
35343
  uploadContent: function() {
35344
+ window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
35345
  this.$el.addClass('hide-toolbar');
35346
  },
35347
 
35348
  // Content
35349
  embedContent: function() {
35350
+ var view = new window.wp.media.view.Embed({
35351
  controller: this,
35352
  model: this.state()
35353
  }).render();
35361
  selection = state.get('selection'),
35362
  view;
35363
 
35364
+ view = new window.wp.media.view.AttachmentsBrowser({
35365
  controller: this,
35366
  collection: selection,
35367
  selection: selection,
35370
  search: false,
35371
  dragInfo: true,
35372
 
35373
+ AttachmentView: window.wp.media.view.Attachment.EditSelection
35374
  }).render();
35375
 
35376
  view.toolbar.set('backToLibrary', {
35390
  selectionStatusToolbar: function(view) {
35391
  var editable = this.state().get('editable');
35392
 
35393
+ view.set('selection', new window.wp.media.view.Selection({
35394
  controller: this,
35395
  collection: this.state().get('selection'),
35396
  priority: -40,
35426
 
35427
  mainEmbedToolbar: function(toolbar) {
35428
  var tbar = toolbar;
35429
+ tbar.view = new window.wp.media.view.Toolbar.Embed({
35430
  controller: this,
35431
  text: 'Add images'
35432
  });
35449
  }
35450
  }),
35451
  that = this;
35452
+ this._mediaManager = theFrame;
35453
 
35454
+ this._mediaManager.on('insert', function() {
35455
  // Append media manager image selections to Images tab
35456
  var selection = theFrame.state().get('selection');
35457
  selection.each(function(attachment) {
35511
  });
35512
 
35513
  ImageWidgetView = base.WidgetView.extend({
35514
+ getTemplate: function() { return window.templates.imageInsertion; },
35515
  behaviors: {
35516
  DraggableBehavior: {
35517
  cloneOriginal: true,
35545
 
35546
  /***/ },
35547
 
35548
+ /***/ 599:
35549
  /***/ function(module, exports, __webpack_require__) {
35550
 
35551
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35552
  * Divider content block
35553
  */
35554
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35555
+ __webpack_require__(574),
35556
+ __webpack_require__(595),
35557
+ __webpack_require__(278),
35558
+ __webpack_require__(273),
35559
+ __webpack_require__(274)
35560
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, jQuery, MailPoet) {
35561
 
35562
  'use strict';
35563
 
35564
  var Module = {},
35565
+ base = BaseBlock;
35566
 
35567
  Module.DividerBlockModel = base.BlockModel.extend({
35568
  defaults: function() {
35583
 
35584
  Module.DividerBlockView = base.BlockView.extend({
35585
  className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
35586
+ getTemplate: function() { return window.templates.dividerBlock; },
35587
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
35588
  behaviors: _.defaults({
35589
  ResizableBehavior: {
35634
  });
35635
 
35636
  Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
35637
+ getTemplate: function() { return window.templates.dividerBlockSettings; },
35638
  events: function() {
35639
  return {
35640
  'click .mailpoet_field_divider_style': 'changeStyle',
35679
  });
35680
 
35681
  Module.DividerWidgetView = base.WidgetView.extend({
35682
+ getTemplate: function() { return window.templates.dividerInsertion; },
35683
  behaviors: {
35684
  DraggableBehavior: {
35685
  cloneOriginal: true,
35708
 
35709
  /***/ },
35710
 
35711
+ /***/ 600:
35712
  /***/ function(module, exports, __webpack_require__) {
35713
 
35714
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35715
  * Text content block
35716
  */
35717
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35718
+ __webpack_require__(574),
35719
+ __webpack_require__(595),
35720
+ __webpack_require__(278),
35721
+ __webpack_require__(274)
35722
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, MailPoet) {
35723
 
35724
  'use strict';
35725
 
35726
  var Module = {},
35727
+ base = BaseBlock;
35728
 
35729
  Module.TextBlockModel = base.BlockModel.extend({
35730
  defaults: function() {
35737
 
35738
  Module.TextBlockView = base.BlockView.extend({
35739
  className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
35740
+ getTemplate: function() { return window.templates.textBlock; },
35741
  modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
35742
  behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
35743
  TextEditorBehavior: {
35792
  });
35793
 
35794
  Module.TextBlockSettingsView = base.BlockSettingsView.extend({
35795
+ getTemplate: function() { return window.templates.textBlockSettings; }
35796
  });
35797
 
35798
  Module.TextWidgetView = base.WidgetView.extend({
35799
+ getTemplate: function() { return window.templates.textInsertion; },
35800
  behaviors: {
35801
  DraggableBehavior: {
35802
  cloneOriginal: true,
35827
 
35828
  /***/ },
35829
 
35830
+ /***/ 601:
35831
  /***/ function(module, exports, __webpack_require__) {
35832
 
35833
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35834
  * Spacer content block
35835
  */
35836
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35837
+ __webpack_require__(574),
35838
+ __webpack_require__(595),
35839
+ __webpack_require__(278)
35840
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _) {
35841
 
35842
  'use strict';
35843
 
35844
  var Module = {},
35845
+ base = BaseBlock;
35846
 
35847
  Module.SpacerBlockModel = base.BlockModel.extend({
35848
  defaults: function() {
35860
 
35861
  Module.SpacerBlockView = base.BlockView.extend({
35862
  className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
35863
+ getTemplate: function() { return window.templates.spacerBlock; },
35864
  behaviors: _.defaults({
35865
  ResizableBehavior: {
35866
  elementSelector: '.mailpoet_spacer',
35898
  });
35899
 
35900
  Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
35901
+ getTemplate: function() { return window.templates.spacerBlockSettings; },
35902
  events: function() {
35903
  return {
35904
  'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
35908
  });
35909
 
35910
  Module.SpacerWidgetView = base.WidgetView.extend({
35911
+ getTemplate: function() { return window.templates.spacerInsertion; },
35912
  behaviors: {
35913
  DraggableBehavior: {
35914
  cloneOriginal: true,
35938
 
35939
  /***/ },
35940
 
35941
+ /***/ 602:
35942
  /***/ function(module, exports, __webpack_require__) {
35943
 
35944
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
35945
  * Footer content block
35946
  */
35947
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35948
+ __webpack_require__(574),
35949
+ __webpack_require__(595),
35950
+ __webpack_require__(278),
35951
+ __webpack_require__(274)
35952
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, MailPoet) {
35953
 
35954
  'use strict';
35955
 
35956
  var Module = {},
35957
+ base = BaseBlock;
35958
 
35959
  Module.FooterBlockModel = base.BlockModel.extend({
35960
  defaults: function() {
35982
 
35983
  Module.FooterBlockView = base.BlockView.extend({
35984
  className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
35985
+ getTemplate: function() { return window.templates.footerBlock; },
35986
  modelEvents: _.extend({
35987
  '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'
35988
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36019
  });
36020
 
36021
  Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
36022
+ getTemplate: function() { return window.templates.footerBlockSettings; },
36023
  events: function() {
36024
  return {
36025
  'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36027
  'change .mailpoet_field_footer_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
36028
  'change #mailpoet_field_footer_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
36029
  'change #mailpoet_field_footer_link_underline': function(event) {
36030
+ this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
36031
+ },
36032
  'change .mailpoet_field_footer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
36033
  'change .mailpoet_field_footer_alignment': _.partial(this.changeField, 'styles.text.textAlign'),
36034
  'click .mailpoet_done_editing': 'close'
36042
  });
36043
 
36044
  Module.FooterWidgetView = base.WidgetView.extend({
36045
+ getTemplate: function() { return window.templates.footerInsertion; },
36046
  behaviors: {
36047
  DraggableBehavior: {
36048
  cloneOriginal: true,
36072
 
36073
  /***/ },
36074
 
36075
+ /***/ 603:
36076
  /***/ function(module, exports, __webpack_require__) {
36077
 
36078
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
36079
  * Header content block
36080
  */
36081
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36082
+ __webpack_require__(574),
36083
+ __webpack_require__(595),
36084
+ __webpack_require__(278),
36085
+ __webpack_require__(274)
36086
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, _, MailPoet) {
36087
 
36088
  'use strict';
36089
 
36090
  var Module = {},
36091
+ base = BaseBlock;
36092
 
36093
  Module.HeaderBlockModel = base.BlockModel.extend({
36094
  defaults: function() {
36116
 
36117
  Module.HeaderBlockView = base.BlockView.extend({
36118
  className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
36119
+ getTemplate: function() { return window.templates.headerBlock; },
36120
  modelEvents: _.extend({
36121
  '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'
36122
  }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
36153
  });
36154
 
36155
  Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
36156
+ getTemplate: function() { return window.templates.headerBlockSettings; },
36157
  events: function() {
36158
  return {
36159
  'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
36176
  });
36177
 
36178
  Module.HeaderWidgetView = base.WidgetView.extend({
36179
+ getTemplate: function() { return window.templates.headerInsertion; },
36180
  behaviors: {
36181
  DraggableBehavior: {
36182
  cloneOriginal: true,
36206
 
36207
  /***/ },
36208
 
36209
+ /***/ 604:
36210
  /***/ function(module, exports, __webpack_require__) {
36211
 
36212
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
36218
  * block settings view.
36219
  */
36220
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36221
+ __webpack_require__(574),
36222
+ __webpack_require__(595),
36223
+ __webpack_require__(597),
36224
+ __webpack_require__(599),
36225
+ __webpack_require__(579),
36226
+ __webpack_require__(274),
36227
+ __webpack_require__(564),
36228
+ __webpack_require__(278),
36229
+ __webpack_require__(273)
36230
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
36231
+ App,
36232
+ BaseBlock,
36233
+ ButtonBlock,
36234
+ DividerBlock,
36235
+ CommunicationComponent,
36236
+ MailPoet,
36237
+ SuperModel,
36238
+ _,
36239
+ jQuery
36240
  ) {
36241
 
36242
  'use strict';
36243
 
36244
  var Module = {},
36245
+ base = BaseBlock;
36246
 
36247
  Module.ALCSupervisor = SuperModel.extend({
36248
  initialize: function() {
36272
  _.zip(models, renderedBlocks),
36273
  function(args) {
36274
  var model = args[0],
36275
+ contents = args[1];
36276
  model.trigger('refreshPosts', contents);
36277
  }
36278
  );
36346
  }
36347
  App.getChannel().on('replaceAllButtonStyles', replaceButtonStylesHandler.bind(this));
36348
  },
36349
+ getTemplate: function() { return window.templates.automatedLatestContentBlock; },
36350
  regions: {
36351
  toolsRegion: '.mailpoet_tools',
36352
  postsRegion: '.mailpoet_automated_latest_content_block_posts'
36379
 
36380
  // Sidebar view container
36381
  Module.AutomatedLatestContentBlockSettingsView = base.BlockSettingsView.extend({
36382
+ getTemplate: function() { return window.templates.automatedLatestContentBlockSettings; },
36383
  events: function() {
36384
  return {
36385
  'click .mailpoet_automated_latest_content_hide_display_options': 'toggleDisplayOptions',
36561
  },
36562
  _updateContentTypes: function(postTypes) {
36563
  var select = this.$('.mailpoet_automated_latest_content_content_type'),
36564
+ selectedValue = this.model.get('contentType');
36565
 
36566
  select.find('option').remove();
36567
  _.each(postTypes, function(type) {
36575
  });
36576
 
36577
  Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({
36578
+ getTemplate: function() { return window.templates.automatedLatestContentInsertion; },
36579
  behaviors: {
36580
  DraggableBehavior: {
36581
  cloneOriginal: true,
36614
 
36615
  /***/ },
36616
 
36617
+ /***/ 605:
36618
  /***/ function(module, exports, __webpack_require__) {
36619
 
36620
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
36630
  * block settings view.
36631
  */
36632
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36633
+ __webpack_require__(535),
36634
+ __webpack_require__(562),
36635
+ __webpack_require__(563),
36636
+ __webpack_require__(278),
36637
+ __webpack_require__(273),
36638
+ __webpack_require__(274),
36639
+ __webpack_require__(574),
36640
+ __webpack_require__(579),
36641
+ __webpack_require__(595),
36642
+ __webpack_require__(597),
36643
+ __webpack_require__(599),
36644
+ __webpack_require__(287)
36645
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
36646
+ Backbone,
36647
+ Marionette,
36648
+ Radio,
36649
+ _,
36650
+ jQuery,
36651
+ MailPoet,
36652
+ App,
36653
+ CommunicationComponent,
36654
+ BaseBlock,
36655
+ ButtonBlock,
36656
+ DividerBlock
36657
  ) {
36658
 
36659
  'use strict';
36660
 
36661
  var Module = {},
36662
+ base = BaseBlock;
36663
 
36664
  Module.PostsBlockModel = base.BlockModel.extend({
36665
  stale: ['_selectedPosts', '_availablePosts', '_transformedPosts'],
36796
 
36797
  Module.PostsBlockView = base.BlockView.extend({
36798
  className: 'mailpoet_block mailpoet_posts_block mailpoet_droppable_block',
36799
+ getTemplate: function() { return window.templates.postsBlock; },
36800
  modelEvents: {}, // Forcefully disable all events
36801
  regions: _.extend({
36802
  postsRegion: '.mailpoet_posts_block_posts'
36835
  });
36836
 
36837
  Module.PostsBlockSettingsView = base.BlockSettingsView.extend({
36838
+ getTemplate: function() { return window.templates.postsBlockSettings; },
36839
  regions: {
36840
  selectionRegion: '.mailpoet_settings_posts_selection',
36841
  displayOptionsRegion: '.mailpoet_settings_posts_display_options'
36927
  });
36928
 
36929
  var PostSelectionSettingsView = Marionette.View.extend({
36930
+ getTemplate: function() { return window.templates.postSelectionPostsBlockSettings; },
36931
  regions: {
36932
  posts: '.mailpoet_post_selection_container'
36933
  },
37004
  results: _.map(
37005
  data.terms,
37006
  function(item) {
 
37007
  return _.defaults({
37008
  text: data.taxonomies[item.taxonomy].labels.singular_name + ': ' + item.name,
37009
  id: item.term_id
37033
  },
37034
  _updateContentTypes: function(postTypes) {
37035
  var select = this.$('.mailpoet_settings_posts_content_type'),
37036
+ selectedValue = this.model.get('contentType');
37037
 
37038
  select.find('option').remove();
37039
  _.each(postTypes, function(type) {
37047
  });
37048
 
37049
  var EmptyPostSelectionSettingsView = Marionette.View.extend({
37050
+ getTemplate: function() { return window.templates.emptyPostPostsBlockSettings; }
37051
  });
37052
 
37053
  var SinglePostSelectionSettingsView = Marionette.View.extend({
37054
+ getTemplate: function() { return window.templates.singlePostPostsBlockSettings; },
37055
  events: function() {
37056
  return {
37057
  'change .mailpoet_select_post_checkbox': 'postSelectionChange'
37078
  });
37079
 
37080
  var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
37081
+ getTemplate: function() { return window.templates.displayOptionsPostsBlockSettings; },
37082
  events: function() {
37083
  return {
37084
  'click .mailpoet_posts_select_button': 'showButtonSettings',
37183
  });
37184
 
37185
  Module.PostsWidgetView = base.WidgetView.extend({
37186
+ getTemplate: function() { return window.templates.postsInsertion; },
37187
  behaviors: {
37188
  DraggableBehavior: {
37189
  cloneOriginal: true,
37213
 
37214
  /***/ },
37215
 
37216
+ /***/ 606:
37217
  /***/ function(module, exports, __webpack_require__) {
37218
 
37219
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37220
  * Social icons content block
37221
  */
37222
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37223
+ __webpack_require__(574),
37224
+ __webpack_require__(595),
37225
+ __webpack_require__(535),
37226
+ __webpack_require__(562),
37227
+ __webpack_require__(564),
37228
+ __webpack_require__(278),
37229
+ __webpack_require__(273)
37230
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(App, BaseBlock, Backbone, Marionette, SuperModel, _, jQuery) {
37231
 
37232
  'use strict';
37233
 
37234
  var Module = {},
37235
+ base = BaseBlock,
37236
+ SocialBlockSettingsIconSelectorView,
37237
+ SocialBlockSettingsIconView,
37238
+ SocialBlockSettingsIconCollectionView,
37239
+ SocialBlockSettingsStylesView;
37240
 
37241
  Module.SocialIconModel = SuperModel.extend({
37242
  defaults: function() {
37303
 
37304
  var SocialIconView = Marionette.View.extend({
37305
  tagName: 'span',
37306
+ getTemplate: function() { return window.templates.socialIconBlock; },
37307
  modelEvents: {
37308
  change: 'render'
37309
  },
37323
 
37324
  Module.SocialBlockView = base.BlockView.extend({
37325
  className: 'mailpoet_block mailpoet_social_block mailpoet_droppable_block',
37326
+ getTemplate: function() { return window.templates.socialBlock; },
37327
  regions: _.extend({}, base.BlockView.prototype.regions, {
37328
  icons: '.mailpoet_social'
37329
  }),
37349
 
37350
  // Sidebar view container
37351
  Module.SocialBlockSettingsView = base.BlockSettingsView.extend({
37352
+ getTemplate: function() { return window.templates.socialBlockSettings; },
37353
  regions: {
37354
  iconRegion: '#mailpoet_social_icons_selection',
37355
  stylesRegion: '#mailpoet_social_icons_styles'
37373
 
37374
  // Single icon settings view, used by the selector view
37375
  SocialBlockSettingsIconView = Marionette.View.extend({
37376
+ getTemplate: function() { return window.templates.socialSettingsIcon; },
37377
  events: function() {
37378
  return {
37379
  'click .mailpoet_delete_block': 'deleteIcon',
37430
 
37431
  // Select icons section container view
37432
  SocialBlockSettingsIconSelectorView = Marionette.View.extend({
37433
+ getTemplate: function() { return window.templates.socialSettingsIconSelector; },
37434
  regions: {
37435
  icons: '#mailpoet_social_icon_selector_contents'
37436
  },
37453
  });
37454
 
37455
  SocialBlockSettingsStylesView = Marionette.View.extend({
37456
+ getTemplate: function() { return window.templates.socialSettingsStyles; },
37457
  modelEvents: {
37458
  change: 'render'
37459
  },
37481
  });
37482
 
37483
  Module.SocialWidgetView = base.WidgetView.extend({
37484
+ getTemplate: function() { return window.templates.socialInsertion; },
37485
  behaviors: {
37486
  DraggableBehavior: {
37487
  cloneOriginal: true,
assets/js/{public.17607eba.js → public.02e5f1af.js} RENAMED
@@ -76,25 +76,25 @@
76
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
77
  mp
78
  ) {
79
- 'use strict';
80
 
81
- var MailPoet = mp;
82
 
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
- };
96
 
97
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
98
 
99
 
100
  /***/ },
@@ -119,59 +119,59 @@
119
  var MailPoet = mp;
120
 
121
  MailPoet.Ajax = {
122
- version: 0.5,
123
- options: {},
124
- defaults: {
125
- url: null,
126
- api_version: null,
127
- endpoint: null,
128
- action: null,
129
- token: null,
130
- data: {}
131
- },
132
- post: function(options) {
133
- return this.request('post', options);
134
- },
135
- init: function(options) {
136
- // merge options
137
- this.options = jQuery.extend({}, this.defaults, options);
138
 
139
- // set default url
140
- if(this.options.url === null) {
141
- this.options.url = ajaxurl;
142
- }
143
 
144
- // set default token
145
- if(this.options.token === null) {
146
- this.options.token = window.mailpoet_token;
147
- }
148
- },
149
- getParams: function() {
150
- return {
151
- action: 'mailpoet',
152
- api_version: this.options.api_version,
153
- token: this.options.token,
154
- endpoint: this.options.endpoint,
155
- method: this.options.action,
156
- data: this.options.data || {}
157
- };
158
- },
159
- request: function(method, options) {
160
  // set options
161
- this.init(options);
162
 
163
  // set request params
164
- var params = this.getParams();
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
- }
172
 
173
  // ajax request
174
- var deferred = jQuery.post(
175
  this.options.url,
176
  params,
177
  null,
@@ -181,10 +181,10 @@
181
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
182
 
183
  // clear options
184
- this.options = {};
185
 
186
- return deferred;
187
- }
188
  };
189
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
190
 
@@ -1937,13 +1937,13 @@
1937
  form.parsley().on('form:submit', function(parsley) {
1938
  var form_data = form.serializeObject() || {};
1939
  // check if we're on the same domain
1940
- if(isSameDomain(MailPoetForm.ajax_url) === false) {
1941
  // non ajax post request
1942
  return true;
1943
  } else {
1944
  // ajax request
1945
  MailPoet.Ajax.post({
1946
- url: MailPoetForm.ajax_url,
1947
  token: form_data.token,
1948
  api_version: form_data.api_version,
1949
  endpoint: 'subscribers',
76
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function(
77
  mp
78
  ) {
79
+ 'use strict';
80
 
81
+ var MailPoet = mp;
82
 
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
+ };
96
 
97
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
98
 
99
 
100
  /***/ },
119
  var MailPoet = mp;
120
 
121
  MailPoet.Ajax = {
122
+ version: 0.5,
123
+ options: {},
124
+ defaults: {
125
+ url: null,
126
+ api_version: null,
127
+ endpoint: null,
128
+ action: null,
129
+ token: null,
130
+ data: {}
131
+ },
132
+ post: function(options) {
133
+ return this.request('post', options);
134
+ },
135
+ init: function(options) {
136
+ // merge options
137
+ this.options = jQuery.extend({}, this.defaults, options);
138
 
139
+ // set default url
140
+ if(this.options.url === null) {
141
+ this.options.url = window.ajaxurl;
142
+ }
143
 
144
+ // set default token
145
+ if(this.options.token === null) {
146
+ this.options.token = window.mailpoet_token;
147
+ }
148
+ },
149
+ getParams: function() {
150
+ return {
151
+ action: 'mailpoet',
152
+ api_version: this.options.api_version,
153
+ token: this.options.token,
154
+ endpoint: this.options.endpoint,
155
+ method: this.options.action,
156
+ data: this.options.data || {}
157
+ };
158
+ },
159
+ request: function(method, options) {
160
  // set options
161
+ this.init(options);
162
 
163
  // set request params
164
+ var params = this.getParams();
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
+ }
172
 
173
  // ajax request
174
+ var deferred = jQuery.post(
175
  this.options.url,
176
  params,
177
  null,
181
  }, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
182
 
183
  // clear options
184
+ this.options = {};
185
 
186
+ return deferred;
187
+ }
188
  };
189
  }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
190
 
1937
  form.parsley().on('form:submit', function(parsley) {
1938
  var form_data = form.serializeObject() || {};
1939
  // check if we're on the same domain
1940
+ if(isSameDomain(window.MailPoetForm.ajax_url) === false) {
1941
  // non ajax post request
1942
  return true;
1943
  } else {
1944
  // ajax request
1945
  MailPoet.Ajax.post({
1946
+ url: window.MailPoetForm.ajax_url,
1947
  token: form_data.token,
1948
  api_version: form_data.api_version,
1949
  endpoint: 'subscribers',
assets/js/{vendor.f8675e02.js → vendor.f4549608.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":"6527ae62","1":"77fc9795","2":"8b0c5294","3":"e52dab6e","4":"d11e861e"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
@@ -112,31 +112,31 @@
112
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(543)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) {
113
  // Handlebars helpers
114
  Handlebars.registerHelper('concat', function() {
115
- var size = (arguments.length - 1),
116
- output = '';
117
- for(var i = 0; i < size; i++) {
118
- output += arguments[i];
119
- }
120
- return output;
121
  });
122
 
123
  Handlebars.registerHelper('number_format', function(value, block) {
124
- return Number(value).toLocaleString();
125
  });
126
  Handlebars.registerHelper('date_format', function(timestamp, block) {
127
  if(window.moment) {
128
- if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) {
129
- return;
130
- }
131
 
132
  // set date format
133
- var f = block.hash.format || 'MMM Do, YYYY';
134
  // check if we passed a timestamp
135
- if(parseInt(timestamp, 10) == timestamp) {
136
- return moment.unix(timestamp).format(f);
137
- } else {
138
- return moment.utc(timestamp).format(f);
139
- }
140
  } else {
141
  return timestamp;
142
  }
@@ -148,81 +148,81 @@
148
  });
149
 
150
  Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
151
- switch (operator) {
152
- case '==':
153
- return (v1 == v2) ? options.fn(this) : options.inverse(this);
154
- case '===':
155
- return (v1 === v2) ? options.fn(this) : options.inverse(this);
156
- case '!=':
157
- return (v1 != v2) ? options.fn(this) : options.inverse(this);
158
- case '!==':
159
- return (v1 !== v2) ? options.fn(this) : options.inverse(this);
160
- case '<':
161
- return (v1 < v2) ? options.fn(this) : options.inverse(this);
162
- case '<=':
163
- return (v1 <= v2) ? options.fn(this) : options.inverse(this);
164
- case '>':
165
- return (v1 > v2) ? options.fn(this) : options.inverse(this);
166
- case '>=':
167
- return (v1 >= v2) ? options.fn(this) : options.inverse(this);
168
- case '&&':
169
- return (v1 && v2) ? options.fn(this) : options.inverse(this);
170
- case '||':
171
- return (v1 || v2) ? options.fn(this) : options.inverse(this);
172
- case 'in':
173
- var values = v2.split(',');
174
- return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this);
175
- default:
176
- return options.inverse(this);
177
- }
178
  });
179
 
180
  Handlebars.registerHelper('nl2br', function(value, block) {
181
- return value.gsub('\n', '<br />');
182
  });
183
 
184
  Handlebars.registerHelper('json_encode', function(value, block) {
185
- return JSON.stringify(value);
186
  });
187
 
188
  Handlebars.registerHelper('json_decode', function(value, block) {
189
- return JSON.parse(value);
190
  });
191
  Handlebars.registerHelper('url', function(value, block) {
192
- var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
193
 
194
- return url + value;
195
  });
196
  Handlebars.registerHelper('emailFromMailto', function(value) {
197
- var mailtoMatchingRegex = /^mailto\:/i;
198
- if (typeof value === 'string' && value.match(mailtoMatchingRegex)) {
199
- return value.replace(mailtoMatchingRegex, '');
200
- } else {
201
- return value;
202
- }
203
  });
204
  Handlebars.registerHelper('lookup', function(obj, field, options) {
205
- return obj && obj[field];
206
  });
207
 
208
 
209
  Handlebars.registerHelper('rsa_key', function(value, block) {
210
  // extract all lines into an array
211
- if(value === undefined) return '';
212
 
213
- var lines = value.trim().split('\n');
214
 
215
  // remove header & footer
216
- lines.shift();
217
- lines.pop();
218
 
219
  // return concatenated lines
220
- return lines.join('');
221
  });
222
 
223
  Handlebars.registerHelper('trim', function(value, block) {
224
- if(value === null || value === undefined) return '';
225
- return value.trim();
226
  });
227
 
228
  /**
@@ -236,20 +236,20 @@
236
  * @return {String} The truncated string.
237
  */
238
  Handlebars.registerHelper('ellipsis', function (str, limit, append) {
239
- var strAppend = append;
240
- if (strAppend === undefined) {
241
- strAppend = '';
242
- }
243
- var sanitized = str.replace(/(<([^>]+)>)/g, '');
244
- if (sanitized.length > limit) {
245
- return sanitized.substr(0, limit - strAppend.length) + strAppend;
246
- } else {
247
- return sanitized;
248
- }
249
  });
250
 
251
  Handlebars.registerHelper('getNumber', function (string) {
252
- return parseInt(string, 10);
253
  });
254
 
255
  Handlebars.registerHelper('fontWithFallback', function(font) {
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":"d091b681","1":"ee9853ec","2":"c0e36e82","3":"81b583ba","4":"cc3c87be"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
112
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(543)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) {
113
  // Handlebars helpers
114
  Handlebars.registerHelper('concat', function() {
115
+ var size = (arguments.length - 1),
116
+ output = '';
117
+ for(var i = 0; i < size; i++) {
118
+ output += arguments[i];
119
+ }
120
+ return output;
121
  });
122
 
123
  Handlebars.registerHelper('number_format', function(value, block) {
124
+ return Number(value).toLocaleString();
125
  });
126
  Handlebars.registerHelper('date_format', function(timestamp, block) {
127
  if(window.moment) {
128
+ if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) {
129
+ return;
130
+ }
131
 
132
  // set date format
133
+ var f = block.hash.format || 'MMM Do, YYYY';
134
  // check if we passed a timestamp
135
+ if(parseInt(timestamp, 10) == timestamp) {
136
+ return window.moment.unix(timestamp).format(f);
137
+ } else {
138
+ return window.moment.utc(timestamp).format(f);
139
+ }
140
  } else {
141
  return timestamp;
142
  }
148
  });
149
 
150
  Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
151
+ switch (operator) {
152
+ case '==':
153
+ return (v1 == v2) ? options.fn(this) : options.inverse(this);
154
+ case '===':
155
+ return (v1 === v2) ? options.fn(this) : options.inverse(this);
156
+ case '!=':
157
+ return (v1 != v2) ? options.fn(this) : options.inverse(this);
158
+ case '!==':
159
+ return (v1 !== v2) ? options.fn(this) : options.inverse(this);
160
+ case '<':
161
+ return (v1 < v2) ? options.fn(this) : options.inverse(this);
162
+ case '<=':
163
+ return (v1 <= v2) ? options.fn(this) : options.inverse(this);
164
+ case '>':
165
+ return (v1 > v2) ? options.fn(this) : options.inverse(this);
166
+ case '>=':
167
+ return (v1 >= v2) ? options.fn(this) : options.inverse(this);
168
+ case '&&':
169
+ return (v1 && v2) ? options.fn(this) : options.inverse(this);
170
+ case '||':
171
+ return (v1 || v2) ? options.fn(this) : options.inverse(this);
172
+ case 'in':
173
+ var values = v2.split(',');
174
+ return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this);
175
+ default:
176
+ return options.inverse(this);
177
+ }
178
  });
179
 
180
  Handlebars.registerHelper('nl2br', function(value, block) {
181
+ return value.gsub('\n', '<br />');
182
  });
183
 
184
  Handlebars.registerHelper('json_encode', function(value, block) {
185
+ return JSON.stringify(value);
186
  });
187
 
188
  Handlebars.registerHelper('json_decode', function(value, block) {
189
+ return JSON.parse(value);
190
  });
191
  Handlebars.registerHelper('url', function(value, block) {
192
+ var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
193
 
194
+ return url + value;
195
  });
196
  Handlebars.registerHelper('emailFromMailto', function(value) {
197
+ var mailtoMatchingRegex = /^mailto\:/i;
198
+ if (typeof value === 'string' && value.match(mailtoMatchingRegex)) {
199
+ return value.replace(mailtoMatchingRegex, '');
200
+ } else {
201
+ return value;
202
+ }
203
  });
204
  Handlebars.registerHelper('lookup', function(obj, field, options) {
205
+ return obj && obj[field];
206
  });
207
 
208
 
209
  Handlebars.registerHelper('rsa_key', function(value, block) {
210
  // extract all lines into an array
211
+ if(value === undefined) return '';
212
 
213
+ var lines = value.trim().split('\n');
214
 
215
  // remove header & footer
216
+ lines.shift();
217
+ lines.pop();
218
 
219
  // return concatenated lines
220
+ return lines.join('');
221
  });
222
 
223
  Handlebars.registerHelper('trim', function(value, block) {
224
+ if(value === null || value === undefined) return '';
225
+ return value.trim();
226
  });
227
 
228
  /**
236
  * @return {String} The truncated string.
237
  */
238
  Handlebars.registerHelper('ellipsis', function (str, limit, append) {
239
+ var strAppend = append;
240
+ if (strAppend === undefined) {
241
+ strAppend = '';
242
+ }
243
+ var sanitized = str.replace(/(<([^>]+)>)/g, '');
244
+ if (sanitized.length > limit) {
245
+ return sanitized.substr(0, limit - strAppend.length) + strAppend;
246
+ } else {
247
+ return sanitized;
248
+ }
249
  });
250
 
251
  Handlebars.registerHelper('getNumber', function (string) {
252
+ return parseInt(string, 10);
253
  });
254
 
255
  Handlebars.registerHelper('fontWithFallback', function(font) {
lang/mailpoet-da_DK.mo CHANGED
Binary file
lang/mailpoet-de_DE.mo CHANGED
Binary file
lang/mailpoet-es_ES.mo CHANGED
Binary file
lang/mailpoet-fr_CA.mo CHANGED
Binary file
lang/mailpoet-fr_FR.mo CHANGED
Binary file
lang/mailpoet-nl_NL.mo CHANGED
Binary file
lang/mailpoet-pt_BR.mo CHANGED
Binary file
lang/mailpoet-ru_RU.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: 2017-09-05 15:55:34+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -246,35 +246,35 @@ msgstr ""
246
  msgid "MailPoet Newsletter"
247
  msgstr ""
248
 
249
- #: lib/Config/Initializer.php:42
250
  msgid ""
251
  "Unable to connect to the database (the database is unable to open a file or "
252
  "folder), the connection is likely not configured correctly. Please read our "
253
  "[link] Knowledge Base article [/link] for steps how to resolve it."
254
  msgstr ""
255
 
256
- #: lib/Config/Initializer.php:130
257
  msgid "You do not have permission to activate/deactivate MailPoet plugin."
258
  msgstr ""
259
 
260
  #: lib/Config/MP2Migrator.php:151
261
- msgid "START IMPORT"
262
  msgstr ""
263
 
264
- #: lib/Config/MP2Migrator.php:168 views/mp2migration.html:67
265
- msgid "IMPORT COMPLETE"
266
  msgstr ""
267
 
268
  #: lib/Config/MP2Migrator.php:171
269
- msgid "END IMPORT"
270
  msgstr ""
271
 
272
  #: lib/Config/MP2Migrator.php:196
273
  msgid "MailPoet data erased"
274
  msgstr ""
275
 
276
- #: lib/Config/MP2Migrator.php:226 views/mp2migration.html:69
277
- msgid "IMPORT STOPPED BY USER"
278
  msgstr ""
279
 
280
  #: lib/Config/MP2Migrator.php:258
@@ -423,7 +423,7 @@ msgstr ""
423
  msgid "MailPoet"
424
  msgstr ""
425
 
426
- #: lib/Config/PluginActivatedHook.php:16
427
  msgid ""
428
  "We noticed that you're using an unsupported environment. While MailPoet "
429
  "might work within a MultiSite environment, we don’t support it."
@@ -514,7 +514,7 @@ msgid "News Day"
514
  msgstr ""
515
 
516
  #: lib/Config/PopulatorData/Templates/NewsDay.php:18
517
- msgid "Media ready template. "
518
  msgstr ""
519
 
520
  #: lib/Config/PopulatorData/Templates/NewsletterBlank121Column.php:17
@@ -629,7 +629,7 @@ msgstr ""
629
  #: lib/Config/PopulatorData/Templates/NewsletterBlank12Column.php:120
630
  msgid ""
631
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n"
632
- "<p></p>\n"
633
  "<p>It's time to design your newsletter! In the right sidebar, you'll find 4 "
634
  "menu items that will help you customize your newsletter:</p>\n"
635
  "<ol>\n"
@@ -669,7 +669,7 @@ msgstr ""
669
  #: lib/Config/PopulatorData/Templates/NewsletterBlank13Column.php:120
670
  msgid ""
671
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n"
672
- "<p></p>\n"
673
  "<p>It's time to design your newsletter! In the right sidebar, you'll find "
674
  "four menu items that will help you customize your newsletter:</p>\n"
675
  "<ol>\n"
@@ -721,7 +721,7 @@ msgstr ""
721
  #: lib/Config/PopulatorData/Templates/NewsletterBlank1Column.php:120
722
  msgid ""
723
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n"
724
- "<p></p>\n"
725
  "<p>It's time to design your newsletter! In the right sidebar, you'll find 4 "
726
  "menu items that will help you customize your newsletter:</p>\n"
727
  "<ol>\n"
@@ -752,7 +752,7 @@ msgstr ""
752
  msgid ""
753
  "<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! "
754
  "</strong></h1>\n"
755
- "<p></p>\n"
756
  "<p>MailPoet can <span style=\"line-height: 1.6em; background-color: "
757
  "inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; "
758
  "background-color: inherit;\">send your new blog posts to your "
@@ -832,7 +832,7 @@ msgstr ""
832
  #: lib/Config/PopulatorData/Templates/SimpleText.php:135
833
  msgid ""
834
  "<p>Thanks for reading. See you soon!</p>\n"
835
- "<p></p>\n"
836
  "<p><strong><em>The MailPoet Team</em></strong></p>"
837
  msgstr ""
838
 
@@ -863,9 +863,9 @@ msgstr ""
863
  #: lib/Config/PopulatorData/Templates/WelcomeBlank12Column.php:120
864
  msgid ""
865
  "<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n"
866
- "<p></p>\n"
867
  "<p>[subscriber:firstname | default:Subscriber],</p>\n"
868
- "<p></p>\n"
869
  "<p>You recently joined our list and we'd like to give you a warm "
870
  "welcome!</p>"
871
  msgstr ""
@@ -914,12 +914,12 @@ msgstr ""
914
  #: lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php:120
915
  msgid ""
916
  "<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n"
917
- "<p></p>\n"
918
  "<p>[subscriber:firstname | default:Subscriber],</p>\n"
919
- "<p></p>\n"
920
  "<p>You recently joined our list and we'd like to give you a warm "
921
  "welcome!</p>\n"
922
- "<p></p>\n"
923
  "<p>Want to get to know us better? Check out some of our most popular "
924
  "articles: </p>\n"
925
  "<ol>\n"
@@ -940,7 +940,7 @@ msgid "World Cup"
940
  msgstr ""
941
 
942
  #: lib/Config/PopulatorData/Templates/WorldCup.php:18
943
- msgid "Always a winner. "
944
  msgstr ""
945
 
946
  #: lib/Config/PopulatorData/Templates/YogaStudio.php:17
@@ -951,7 +951,7 @@ msgstr ""
951
  msgid "Salute the sun and your subscribers."
952
  msgstr ""
953
 
954
- #: lib/Config/Renderer.php:107
955
  msgid ""
956
  "Failed to render template \"%s\". Please ensure the template cache folder "
957
  "\"%s\" exists and has write permissions. Terminated with error: \"%s\""
@@ -1031,11 +1031,11 @@ msgstr ""
1031
  msgid "An error has happened while performing a request, please try again later."
1032
  msgstr ""
1033
 
1034
- #: lib/Cron/CronHelper.php:103
1035
  msgid "Site URL is unreachable."
1036
  msgstr ""
1037
 
1038
- #: lib/Cron/CronHelper.php:109
1039
  msgid "Maximum execution time has been reached."
1040
  msgstr ""
1041
 
@@ -1669,19 +1669,19 @@ msgstr ""
1669
  msgid "Accidentally unsubscribed?"
1670
  msgstr ""
1671
 
1672
- #: lib/Twig/Functions.php:99 views/settings/mta.html:1081
1673
  msgid "every minute"
1674
  msgstr ""
1675
 
1676
- #: lib/Twig/Functions.php:100 views/settings/mta.html:1082
1677
  msgid "every %1$d minutes"
1678
  msgstr ""
1679
 
1680
- #: lib/Twig/Functions.php:101 views/settings/mta.html:1083
1681
  msgid "every hour"
1682
  msgstr ""
1683
 
1684
- #: lib/Twig/Functions.php:102 views/settings/mta.html:1084
1685
  msgid "every %1$d hours"
1686
  msgstr ""
1687
 
@@ -2243,7 +2243,7 @@ msgid "Sorry, there was an error, please try again later."
2243
  msgstr ""
2244
 
2245
  #: views/index.html:5
2246
- msgid " %sSet up%s MailPoet and start sending."
2247
  msgstr ""
2248
 
2249
  #: views/invalidkey.html:6
@@ -2349,10 +2349,18 @@ msgstr ""
2349
  msgid "Log..."
2350
  msgstr ""
2351
 
 
 
 
 
2352
  #: views/mp2migration.html:68
2353
  msgid "Importing…"
2354
  msgstr ""
2355
 
 
 
 
 
2356
  #: views/newsletter/editor.html:233 views/newsletters.html:56
2357
  msgid "Select type"
2358
  msgstr ""
@@ -4349,7 +4357,7 @@ msgid ""
4349
  msgstr ""
4350
 
4351
  #: views/settings/mta.html:125
4352
- msgid "You\\'ll probably end up in spam."
4353
  msgstr ""
4354
 
4355
  #: views/settings/mta.html:126
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2017-09-12 12:27:59+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
246
  msgid "MailPoet Newsletter"
247
  msgstr ""
248
 
249
+ #: lib/Config/Initializer.php:43
250
  msgid ""
251
  "Unable to connect to the database (the database is unable to open a file or "
252
  "folder), the connection is likely not configured correctly. Please read our "
253
  "[link] Knowledge Base article [/link] for steps how to resolve it."
254
  msgstr ""
255
 
256
+ #: lib/Config/Initializer.php:156
257
  msgid "You do not have permission to activate/deactivate MailPoet plugin."
258
  msgstr ""
259
 
260
  #: lib/Config/MP2Migrator.php:151
261
+ msgid "Start import"
262
  msgstr ""
263
 
264
+ #: lib/Config/MP2Migrator.php:168
265
+ msgid "Import complete"
266
  msgstr ""
267
 
268
  #: lib/Config/MP2Migrator.php:171
269
+ msgid "End import"
270
  msgstr ""
271
 
272
  #: lib/Config/MP2Migrator.php:196
273
  msgid "MailPoet data erased"
274
  msgstr ""
275
 
276
+ #: lib/Config/MP2Migrator.php:226
277
+ msgid "Import stopped by user"
278
  msgstr ""
279
 
280
  #: lib/Config/MP2Migrator.php:258
423
  msgid "MailPoet"
424
  msgstr ""
425
 
426
+ #: lib/Config/PluginActivatedHook.php:14
427
  msgid ""
428
  "We noticed that you're using an unsupported environment. While MailPoet "
429
  "might work within a MultiSite environment, we don’t support it."
514
  msgstr ""
515
 
516
  #: lib/Config/PopulatorData/Templates/NewsDay.php:18
517
+ msgid "Media ready template."
518
  msgstr ""
519
 
520
  #: lib/Config/PopulatorData/Templates/NewsletterBlank121Column.php:17
629
  #: lib/Config/PopulatorData/Templates/NewsletterBlank12Column.php:120
630
  msgid ""
631
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n"
632
+ "<p>&nbsp;</p>\n"
633
  "<p>It's time to design your newsletter! In the right sidebar, you'll find 4 "
634
  "menu items that will help you customize your newsletter:</p>\n"
635
  "<ol>\n"
669
  #: lib/Config/PopulatorData/Templates/NewsletterBlank13Column.php:120
670
  msgid ""
671
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n"
672
+ "<p>&nbsp;</p>\n"
673
  "<p>It's time to design your newsletter! In the right sidebar, you'll find "
674
  "four menu items that will help you customize your newsletter:</p>\n"
675
  "<ol>\n"
721
  #: lib/Config/PopulatorData/Templates/NewsletterBlank1Column.php:120
722
  msgid ""
723
  "<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n"
724
+ "<p>&nbsp;</p>\n"
725
  "<p>It's time to design your newsletter! In the right sidebar, you'll find 4 "
726
  "menu items that will help you customize your newsletter:</p>\n"
727
  "<ol>\n"
752
  msgid ""
753
  "<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! "
754
  "</strong></h1>\n"
755
+ "<p>&nbsp;</p>\n"
756
  "<p>MailPoet can <span style=\"line-height: 1.6em; background-color: "
757
  "inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; "
758
  "background-color: inherit;\">send your new blog posts to your "
832
  #: lib/Config/PopulatorData/Templates/SimpleText.php:135
833
  msgid ""
834
  "<p>Thanks for reading. See you soon!</p>\n"
835
+ "<p>&nbsp;</p>\n"
836
  "<p><strong><em>The MailPoet Team</em></strong></p>"
837
  msgstr ""
838
 
863
  #: lib/Config/PopulatorData/Templates/WelcomeBlank12Column.php:120
864
  msgid ""
865
  "<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n"
866
+ "<p>&nbsp;</p>\n"
867
  "<p>[subscriber:firstname | default:Subscriber],</p>\n"
868
+ "<p>&nbsp;</p>\n"
869
  "<p>You recently joined our list and we'd like to give you a warm "
870
  "welcome!</p>"
871
  msgstr ""
914
  #: lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php:120
915
  msgid ""
916
  "<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n"
917
+ "<p>&nbsp;</p>\n"
918
  "<p>[subscriber:firstname | default:Subscriber],</p>\n"
919
+ "<p>&nbsp;</p>\n"
920
  "<p>You recently joined our list and we'd like to give you a warm "
921
  "welcome!</p>\n"
922
+ "<p>&nbsp;</p>\n"
923
  "<p>Want to get to know us better? Check out some of our most popular "
924
  "articles: </p>\n"
925
  "<ol>\n"
940
  msgstr ""
941
 
942
  #: lib/Config/PopulatorData/Templates/WorldCup.php:18
943
+ msgid "Always a winner."
944
  msgstr ""
945
 
946
  #: lib/Config/PopulatorData/Templates/YogaStudio.php:17
951
  msgid "Salute the sun and your subscribers."
952
  msgstr ""
953
 
954
+ #: lib/Config/Renderer.php:106
955
  msgid ""
956
  "Failed to render template \"%s\". Please ensure the template cache folder "
957
  "\"%s\" exists and has write permissions. Terminated with error: \"%s\""
1031
  msgid "An error has happened while performing a request, please try again later."
1032
  msgstr ""
1033
 
1034
+ #: lib/Cron/CronHelper.php:108
1035
  msgid "Site URL is unreachable."
1036
  msgstr ""
1037
 
1038
+ #: lib/Cron/CronHelper.php:114
1039
  msgid "Maximum execution time has been reached."
1040
  msgstr ""
1041
 
1669
  msgid "Accidentally unsubscribed?"
1670
  msgstr ""
1671
 
1672
+ #: lib/Twig/Functions.php:106 views/settings/mta.html:1081
1673
  msgid "every minute"
1674
  msgstr ""
1675
 
1676
+ #: lib/Twig/Functions.php:107 views/settings/mta.html:1082
1677
  msgid "every %1$d minutes"
1678
  msgstr ""
1679
 
1680
+ #: lib/Twig/Functions.php:108 views/settings/mta.html:1083
1681
  msgid "every hour"
1682
  msgstr ""
1683
 
1684
+ #: lib/Twig/Functions.php:109 views/settings/mta.html:1084
1685
  msgid "every %1$d hours"
1686
  msgstr ""
1687
 
2243
  msgstr ""
2244
 
2245
  #: views/index.html:5
2246
+ msgid "%sSet up%s MailPoet and start sending."
2247
  msgstr ""
2248
 
2249
  #: views/invalidkey.html:6
2349
  msgid "Log..."
2350
  msgstr ""
2351
 
2352
+ #: views/mp2migration.html:67
2353
+ msgid "IMPORT COMPLETE"
2354
+ msgstr ""
2355
+
2356
  #: views/mp2migration.html:68
2357
  msgid "Importing…"
2358
  msgstr ""
2359
 
2360
+ #: views/mp2migration.html:69
2361
+ msgid "IMPORT STOPPED BY USER"
2362
+ msgstr ""
2363
+
2364
  #: views/newsletter/editor.html:233 views/newsletters.html:56
2365
  msgid "Select type"
2366
  msgstr ""
4357
  msgstr ""
4358
 
4359
  #: views/settings/mta.html:125
4360
+ msgid "You'll probably end up in spam."
4361
  msgstr ""
4362
 
4363
  #: views/settings/mta.html:126
lib/Config/Activator.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace MailPoet\Config;
4
 
 
 
5
  if(!defined('ABSPATH')) exit;
6
 
7
  class Activator {
@@ -11,8 +13,7 @@ class Activator {
11
 
12
  $populator = new Populator();
13
  $populator->up();
14
-
15
- update_option('mailpoet_db_version', Env::$version);
16
  }
17
 
18
  function deactivate() {
2
 
3
  namespace MailPoet\Config;
4
 
5
+ use MailPoet\Models\Setting;
6
+
7
  if(!defined('ABSPATH')) exit;
8
 
9
  class Activator {
13
 
14
  $populator = new Populator();
15
  $populator->up();
16
+ Setting::setValue('db_version', Env::$version);
 
17
  }
18
 
19
  function deactivate() {
lib/Config/Initializer.php CHANGED
@@ -4,6 +4,7 @@ namespace MailPoet\Config;
4
 
5
  use MailPoet\API;
6
  use MailPoet\Cron\CronTrigger;
 
7
  use MailPoet\Router;
8
  use MailPoet\Util\ConflictResolver;
9
  use MailPoet\Util\Helpers;
@@ -61,12 +62,17 @@ class Initializer {
61
 
62
  add_action('init', array(
63
  $this,
64
- 'onInit'
65
  ), 0);
66
 
 
 
 
 
 
67
  add_action('wp_loaded', array(
68
  $this,
69
- 'setupHooks'
70
  ));
71
 
72
  add_action('admin_init', array(
@@ -90,7 +96,27 @@ class Initializer {
90
  $database->init();
91
  }
92
 
93
- function onInit() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  try {
95
  $this->setupAccessControl();
96
 
@@ -98,8 +124,6 @@ class Initializer {
98
  $this->setupInstaller();
99
  $this->setupUpdater();
100
 
101
- $this->setupRenderer();
102
- $this->setupWidget();
103
  $this->setupLocalizer();
104
  $this->setupMenu();
105
  $this->setupShortcodes();
@@ -109,8 +133,6 @@ class Initializer {
109
  $this->setupCronTrigger();
110
  $this->setupConflictResolver();
111
 
112
- $this->setupJSONAPI();
113
- $this->setupRouter();
114
  $this->setupPages();
115
 
116
  do_action('mailpoet_initialized', MAILPOET_VERSION);
@@ -122,7 +144,11 @@ class Initializer {
122
  }
123
 
124
  function maybeDbUpdate() {
125
- $current_db_version = get_option('mailpoet_db_version', false);
 
 
 
 
126
 
127
  // if current db version and plugin version differ
128
  if(version_compare($current_db_version, Env::$version) !== 0) {
@@ -158,19 +184,8 @@ class Initializer {
158
  $updater->init();
159
  }
160
 
161
- function setupRenderer() {
162
- $caching = !WP_DEBUG;
163
- $debugging = WP_DEBUG;
164
- $this->renderer = new Renderer($caching, $debugging);
165
- }
166
-
167
- function setupWidget() {
168
- $widget = new Widget($this->renderer);
169
- $widget->init();
170
- }
171
-
172
  function setupLocalizer() {
173
- $localizer = new Localizer($this->renderer);
174
  $localizer->init();
175
  }
176
 
@@ -206,6 +221,17 @@ class Initializer {
206
  $conflict_resolver->init();
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
209
  function setupJSONAPI() {
210
  $json_api = API\API::JSON($this->access_control);
211
  $json_api->init();
@@ -222,13 +248,8 @@ class Initializer {
222
  }
223
 
224
  function setupHooks() {
225
- if(!defined(self::INITIALIZED)) return;
226
- try {
227
- $hooks = new Hooks();
228
- $hooks->init();
229
- } catch(\Exception $e) {
230
- $this->handleFailedInitialization($e);
231
- }
232
  }
233
 
234
  function handleFailedInitialization($exception) {
4
 
5
  use MailPoet\API;
6
  use MailPoet\Cron\CronTrigger;
7
+ use MailPoet\Models\Setting;
8
  use MailPoet\Router;
9
  use MailPoet\Util\ConflictResolver;
10
  use MailPoet\Util\Helpers;
62
 
63
  add_action('init', array(
64
  $this,
65
+ 'preInitialize'
66
  ), 0);
67
 
68
+ add_action('init', array(
69
+ $this,
70
+ 'initialize'
71
+ ));
72
+
73
  add_action('wp_loaded', array(
74
  $this,
75
+ 'postInitialize'
76
  ));
77
 
78
  add_action('admin_init', array(
96
  $database->init();
97
  }
98
 
99
+ function preInitialize() {
100
+ try {
101
+ $this->setupRenderer();
102
+ $this->setupWidget();
103
+ } catch(\Exception $e) {
104
+ $this->handleFailedInitialization($e);
105
+ }
106
+ }
107
+
108
+ function setupRenderer() {
109
+ $caching = !WP_DEBUG;
110
+ $debugging = WP_DEBUG;
111
+ $this->renderer = new Renderer($caching, $debugging);
112
+ }
113
+
114
+ function setupWidget() {
115
+ $widget = new Widget($this->renderer);
116
+ $widget->init();
117
+ }
118
+
119
+ function initialize() {
120
  try {
121
  $this->setupAccessControl();
122
 
124
  $this->setupInstaller();
125
  $this->setupUpdater();
126
 
 
 
127
  $this->setupLocalizer();
128
  $this->setupMenu();
129
  $this->setupShortcodes();
133
  $this->setupCronTrigger();
134
  $this->setupConflictResolver();
135
 
 
 
136
  $this->setupPages();
137
 
138
  do_action('mailpoet_initialized', MAILPOET_VERSION);
144
  }
145
 
146
  function maybeDbUpdate() {
147
+ try {
148
+ $current_db_version = Setting::getValue('db_version');
149
+ } catch(\Exception $e) {
150
+ $current_db_version = null;
151
+ }
152
 
153
  // if current db version and plugin version differ
154
  if(version_compare($current_db_version, Env::$version) !== 0) {
184
  $updater->init();
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
187
  function setupLocalizer() {
188
+ $localizer = new Localizer();
189
  $localizer->init();
190
  }
191
 
221
  $conflict_resolver->init();
222
  }
223
 
224
+ function postInitialize() {
225
+ if(!defined(self::INITIALIZED)) return;
226
+ try {
227
+ $this->setupHooks();
228
+ $this->setupJSONAPI();
229
+ $this->setupRouter();
230
+ } catch(\Exception $e) {
231
+ $this->handleFailedInitialization($e);
232
+ }
233
+ }
234
+
235
  function setupJSONAPI() {
236
  $json_api = API\API::JSON($this->access_control);
237
  $json_api->init();
248
  }
249
 
250
  function setupHooks() {
251
+ $hooks = new Hooks();
252
+ $hooks->init();
 
 
 
 
 
253
  }
254
 
255
  function handleFailedInitialization($exception) {
lib/Config/Localizer.php CHANGED
@@ -1,32 +1,21 @@
1
  <?php
 
2
  namespace MailPoet\Config;
3
 
4
  if(!defined('ABSPATH')) exit;
5
 
6
  class Localizer {
7
- function __construct($renderer) {
8
- $this->renderer = $renderer;
9
- }
10
-
11
  function init() {
12
- add_action(
13
- 'init',
14
- array($this, 'setup')
15
- );
16
- }
17
-
18
- function setup() {
19
  $this->loadGlobalText();
20
  $this->loadPluginText();
21
- $this->setGlobalRtl();
22
  }
23
 
24
  function loadGlobalText() {
25
- $language_path =
26
- Env::$languages_path
27
- . '/'
28
- . $this->locale()
29
- . '.mo';
30
  load_textdomain(Env::$plugin_name, $language_path);
31
  }
32
 
@@ -38,10 +27,6 @@ class Localizer {
38
  );
39
  }
40
 
41
- function setGlobalRtl() {
42
- $this->renderer->addGlobal('is_rtl', is_rtl());
43
- }
44
-
45
  function locale() {
46
  $locale = apply_filters(
47
  'plugin_locale',
1
  <?php
2
+
3
  namespace MailPoet\Config;
4
 
5
  if(!defined('ABSPATH')) exit;
6
 
7
  class Localizer {
 
 
 
 
8
  function init() {
 
 
 
 
 
 
 
9
  $this->loadGlobalText();
10
  $this->loadPluginText();
 
11
  }
12
 
13
  function loadGlobalText() {
14
+ $language_path = sprintf(
15
+ '%s/%s.mo',
16
+ Env::$languages_path,
17
+ $this->locale()
18
+ );
19
  load_textdomain(Env::$plugin_name, $language_path);
20
  }
21
 
27
  );
28
  }
29
 
 
 
 
 
30
  function locale() {
31
  $locale = apply_filters(
32
  'plugin_locale',
lib/Config/MP2Migrator.php CHANGED
@@ -148,7 +148,7 @@ class MP2Migrator {
148
  }
149
  ob_start();
150
  $datetime = new \MailPoet\WP\DateTime();
151
- $this->log(sprintf('=== ' . __('START IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
152
  Setting::setValue('import_stopped', false); // Reset the stop import action
153
 
154
  if(!Setting::getValue('mailpoet_migration_started', false)) {
@@ -165,10 +165,10 @@ class MP2Migrator {
165
 
166
  if(!$this->importStopped()) {
167
  Setting::setValue('mailpoet_migration_complete', true);
168
- $this->log(__('IMPORT COMPLETE', 'mailpoet'));
169
  }
170
 
171
- $this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
172
  $result = ob_get_contents();
173
  ob_clean();
174
  return $result;
@@ -223,7 +223,7 @@ class MP2Migrator {
223
  */
224
  public function stopImport() {
225
  Setting::setValue('import_stopped', true);
226
- $this->log(__('IMPORT STOPPED BY USER', 'mailpoet'));
227
  }
228
 
229
  /**
@@ -486,7 +486,7 @@ class MP2Migrator {
486
  break;
487
 
488
  default:
489
- $params['date_format'] = strtoupper($params['date_order']);
490
  }
491
  unset($params['date_order']);
492
  }
@@ -1140,4 +1140,4 @@ class MP2Migrator {
1140
  }
1141
  return $emails_number;
1142
  }
1143
- }
148
  }
149
  ob_start();
150
  $datetime = new \MailPoet\WP\DateTime();
151
+ $this->log(sprintf('=== ' . mb_strtoupper(__('Start import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
152
  Setting::setValue('import_stopped', false); // Reset the stop import action
153
 
154
  if(!Setting::getValue('mailpoet_migration_started', false)) {
165
 
166
  if(!$this->importStopped()) {
167
  Setting::setValue('mailpoet_migration_complete', true);
168
+ $this->log(mb_strtoupper(__('Import complete', 'mailpoet'), 'UTF-8'));
169
  }
170
 
171
+ $this->log(sprintf('=== ' . mb_strtoupper(__('End import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
172
  $result = ob_get_contents();
173
  ob_clean();
174
  return $result;
223
  */
224
  public function stopImport() {
225
  Setting::setValue('import_stopped', true);
226
+ $this->log(mb_strtoupper(__('Import stopped by user', 'mailpoet'), 'UTF-8'));
227
  }
228
 
229
  /**
486
  break;
487
 
488
  default:
489
+ $params['date_format'] = mb_strtoupper($params['date_order'], 'UTF-8');
490
  }
491
  unset($params['date_order']);
492
  }
1140
  }
1141
  return $emails_number;
1142
  }
1143
+ }
lib/Config/Migrator.php CHANGED
@@ -172,7 +172,8 @@ class Migrator {
172
  'deleted_at TIMESTAMP NULL,',
173
  'unconfirmed_data longtext,',
174
  'PRIMARY KEY (id),',
175
- 'UNIQUE KEY email (email)'
 
176
  );
177
  return $this->sqlify(__FUNCTION__, $attributes);
178
  }
172
  'deleted_at TIMESTAMP NULL,',
173
  'unconfirmed_data longtext,',
174
  'PRIMARY KEY (id),',
175
+ 'UNIQUE KEY email (email),',
176
+ 'KEY wp_user_id (wp_user_id)',
177
  );
178
  return $this->sqlify(__FUNCTION__, $attributes);
179
  }
lib/Config/PluginActivatedHook.php CHANGED
@@ -3,8 +3,6 @@
3
  namespace MailPoet\Config;
4
 
5
  class PluginActivatedHook {
6
-
7
- /** @var DeferredAdminNotices */
8
  private $deferred_admin_notices;
9
 
10
  public function __construct(DeferredAdminNotices $deferred_admin_notices) {
@@ -13,8 +11,7 @@ class PluginActivatedHook {
13
 
14
  public function action($plugin, $network_wide) {
15
  if($plugin === plugin_basename(Env::$file) && $network_wide) {
16
- $this->deferred_admin_notices->addNetworkAdminNotice(__('We noticed that you\'re using an unsupported environment. While MailPoet might work within a MultiSite environment, we don’t support it.', 'mailpoet'));
17
  }
18
  }
19
-
20
  }
3
  namespace MailPoet\Config;
4
 
5
  class PluginActivatedHook {
 
 
6
  private $deferred_admin_notices;
7
 
8
  public function __construct(DeferredAdminNotices $deferred_admin_notices) {
11
 
12
  public function action($plugin, $network_wide) {
13
  if($plugin === plugin_basename(Env::$file) && $network_wide) {
14
+ $this->deferred_admin_notices->addNetworkAdminNotice(__("We noticed that you're using an unsupported environment. While MailPoet might work within a MultiSite environment, we don’t support it.", 'mailpoet'));
15
  }
16
  }
 
17
  }
lib/Config/Populator.php CHANGED
@@ -337,7 +337,7 @@ class Populator {
337
  function convertExistingDataToUTF8() {
338
  global $wpdb;
339
 
340
- if(!version_compare(get_option('mailpoet_db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) {
341
  // Data conversion should only be performed only once, when migrating from
342
  // older version
343
  return false;
@@ -402,7 +402,7 @@ class Populator {
402
  global $wpdb;
403
 
404
  // perform once for versions below 3.0.0-beta.36.2.1
405
- if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
406
  return false;
407
  }
408
 
@@ -455,7 +455,7 @@ class Populator {
455
  global $wpdb;
456
 
457
  // perform once for versions below 3.0.0-beta.36.2.1
458
- if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
459
  return false;
460
  }
461
 
337
  function convertExistingDataToUTF8() {
338
  global $wpdb;
339
 
340
+ if(!version_compare(Setting::getValue('db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) {
341
  // Data conversion should only be performed only once, when migrating from
342
  // older version
343
  return false;
402
  global $wpdb;
403
 
404
  // perform once for versions below 3.0.0-beta.36.2.1
405
+ if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
406
  return false;
407
  }
408
 
455
  global $wpdb;
456
 
457
  // perform once for versions below 3.0.0-beta.36.2.1
458
+ if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
459
  return false;
460
  }
461
 
lib/Config/PopulatorData/Templates/NewsDay.php CHANGED
@@ -15,7 +15,7 @@ class NewsDay {
15
  function get() {
16
  return array(
17
  'name' => __("News Day", 'mailpoet'),
18
- 'description' => __("Media ready template. ", 'mailpoet'),
19
  'readonly' => 1,
20
  'thumbnail' => $this->getThumbnail(),
21
  'body' => json_encode($this->getBody()),
@@ -552,4 +552,4 @@ class NewsDay {
552
  return $this->template_image_url . '/news-day.jpg';
553
  }
554
 
555
- }
15
  function get() {
16
  return array(
17
  'name' => __("News Day", 'mailpoet'),
18
+ 'description' => __("Media ready template.", 'mailpoet'),
19
  'readonly' => 1,
20
  'thumbnail' => $this->getThumbnail(),
21
  'body' => json_encode($this->getBody()),
552
  return $this->template_image_url . '/news-day.jpg';
553
  }
554
 
555
+ }
lib/Config/PopulatorData/Templates/NewsletterBlank12Column.php CHANGED
@@ -117,7 +117,7 @@ class NewsletterBlank12Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p>&nbsp;</p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
lib/Config/PopulatorData/Templates/NewsletterBlank13Column.php CHANGED
@@ -117,7 +117,7 @@ class NewsletterBlank13Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p>&nbsp;</p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
lib/Config/PopulatorData/Templates/NewsletterBlank1Column.php CHANGED
@@ -117,7 +117,7 @@ class NewsletterBlank1Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  )
122
  )
123
  )
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p>&nbsp;</p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
121
  )
122
  )
123
  )
lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php CHANGED
@@ -117,7 +117,7 @@ class PostNotificationsBlank1Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p></p>\n<p>MailPoet can <span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three recent posts, which are displayed automatically, thanks to the <em>Automatic Latest Content</em> widget, which can be found in the right sidebar, under <em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on a post below.</span></p>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p>&nbsp;</p>\n<p>MailPoet can <span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three recent posts, which are displayed automatically, thanks to the <em>Automatic Latest Content</em> widget, which can be found in the right sidebar, under <em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on a post below.</span></p>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
lib/Config/PopulatorData/Templates/SimpleText.php CHANGED
@@ -132,7 +132,7 @@ class SimpleText {
132
  ),
133
  array(
134
  "type" => "text",
135
- "text" => __("<p>Thanks for reading. See you soon!</p>\n<p></p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
136
  ),
137
  array(
138
  "type" => "footer",
132
  ),
133
  array(
134
  "type" => "text",
135
+ "text" => __("<p>Thanks for reading. See you soon!</p>\n<p>&nbsp;</p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
136
  ),
137
  array(
138
  "type" => "footer",
lib/Config/PopulatorData/Templates/WelcomeBlank12Column.php CHANGED
@@ -117,7 +117,7 @@ class WelcomeBlank12Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p>&nbsp;</p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p>&nbsp;</p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
121
  ),
122
  array(
123
  "type" => "divider",
lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php CHANGED
@@ -117,7 +117,7 @@ class WelcomeBlank1Column {
117
  ),
118
  array(
119
  "type" => "text",
120
- "text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>\n<p></p>\n<p>Want to get to know us better? Check out some of our most popular articles: </p>\n<ol>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ol>", 'mailpoet')
121
  )
122
  )
123
  )
117
  ),
118
  array(
119
  "type" => "text",
120
+ "text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p>&nbsp;</p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p>&nbsp;</p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>\n<p>&nbsp;</p>\n<p>Want to get to know us better? Check out some of our most popular articles: </p>\n<ol>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ol>", 'mailpoet')
121
  )
122
  )
123
  )
lib/Config/PopulatorData/Templates/WorldCup.php CHANGED
@@ -15,7 +15,7 @@ class WorldCup {
15
  function get() {
16
  return array(
17
  'name' => __("World Cup", 'mailpoet'),
18
- 'description' => __("Always a winner. ", 'mailpoet'),
19
  'readonly' => 1,
20
  'thumbnail' => $this->getThumbnail(),
21
  'body' => json_encode($this->getBody()),
@@ -782,4 +782,4 @@ class WorldCup {
782
  return $this->template_image_url . '/world-cup.jpg';
783
  }
784
 
785
- }
15
  function get() {
16
  return array(
17
  'name' => __("World Cup", 'mailpoet'),
18
+ 'description' => __("Always a winner.", 'mailpoet'),
19
  'readonly' => 1,
20
  'thumbnail' => $this->getThumbnail(),
21
  'body' => json_encode($this->getBody()),
782
  return $this->template_image_url . '/world-cup.jpg';
783
  }
784
 
785
+ }
lib/Config/Renderer.php CHANGED
@@ -34,7 +34,6 @@ class Renderer {
34
 
35
  $this->assets_manifest_js = $this->getAssetManifest(Env::$assets_path . '/js/manifest.json');
36
  $this->assets_manifest_css = $this->getAssetManifest(Env::$assets_path . '/css/manifest.json');
37
-
38
  $this->setupDebug();
39
  $this->setupTranslations();
40
  $this->setupFunctions();
@@ -112,10 +111,6 @@ class Renderer {
112
  }
113
  }
114
 
115
- function addGlobal($key, $value) {
116
- return $this->renderer->addGlobal($key, $value);
117
- }
118
-
119
  function getAssetManifest($manifest_file) {
120
  return (is_readable($manifest_file)) ?
121
  json_decode(file_get_contents($manifest_file), true) :
34
 
35
  $this->assets_manifest_js = $this->getAssetManifest(Env::$assets_path . '/js/manifest.json');
36
  $this->assets_manifest_css = $this->getAssetManifest(Env::$assets_path . '/css/manifest.json');
 
37
  $this->setupDebug();
38
  $this->setupTranslations();
39
  $this->setupFunctions();
111
  }
112
  }
113
 
 
 
 
 
114
  function getAssetManifest($manifest_file) {
115
  return (is_readable($manifest_file)) ?
116
  json_decode(file_get_contents($manifest_file), true) :
lib/Config/ServicesChecker.php CHANGED
@@ -40,7 +40,7 @@ class ServicesChecker {
40
  $date_time = new DateTime();
41
  $date = $date_time->formatDate(strtotime($mss_key['data']['expire_at']));
42
  $error = Helpers::replaceLinkTags(
43
- __('Your newsletters are awesome! Don\'t forget to [link]upgrade your MailPoet email plan[/link] by %s to keep sending them to your subscribers.', 'mailpoet'),
44
  'https://account.mailpoet.com?s=' . Subscriber::getTotalSubscribers(),
45
  array('target' => '_blank')
46
  );
@@ -93,7 +93,7 @@ class ServicesChecker {
93
  $date_time = new DateTime();
94
  $date = $date_time->formatDate(strtotime($premium_key['data']['expire_at']));
95
  $error = Helpers::replaceLinkTags(
96
- __('Your License Key is expiring! Don\'t forget to [link]renew your license[/link] by %s to keep enjoying automatic updates and Premium support.', 'mailpoet'),
97
  'https://account.mailpoet.com',
98
  array('target' => '_blank')
99
  );
40
  $date_time = new DateTime();
41
  $date = $date_time->formatDate(strtotime($mss_key['data']['expire_at']));
42
  $error = Helpers::replaceLinkTags(
43
+ __("Your newsletters are awesome! Don't forget to [link]upgrade your MailPoet email plan[/link] by %s to keep sending them to your subscribers.", 'mailpoet'),
44
  'https://account.mailpoet.com?s=' . Subscriber::getTotalSubscribers(),
45
  array('target' => '_blank')
46
  );
93
  $date_time = new DateTime();
94
  $date = $date_time->formatDate(strtotime($premium_key['data']['expire_at']));
95
  $error = Helpers::replaceLinkTags(
96
+ __("Your License Key is expiring! Don't forget to [link]renew your license[/link] by %s to keep enjoying automatic updates and Premium support.", 'mailpoet'),
97
  'https://account.mailpoet.com',
98
  array('target' => '_blank')
99
  );
lib/Cron/CronHelper.php CHANGED
@@ -1,10 +1,12 @@
1
  <?php
 
2
  namespace MailPoet\Cron;
3
 
4
  use MailPoet\Models\Setting;
5
  use MailPoet\Router\Endpoints\CronDaemon as CronDaemonEndpoint;
6
  use MailPoet\Router\Router;
7
  use MailPoet\Util\Security;
 
8
 
9
  if(!defined('ABSPATH')) exit;
10
 
@@ -59,7 +61,7 @@ class CronHelper {
59
  'user-agent' => 'MailPoet (www.mailpoet.com) Cron'
60
  );
61
  $result = wp_remote_get($url, $args);
62
- return wp_remote_retrieve_body($result) === 'pong';
63
  }
64
 
65
  static function accessDaemon($token, $timeout = self::DAEMON_REQUEST_TIMEOUT) {
@@ -83,6 +85,9 @@ class CronHelper {
83
  static function getSiteUrl($site_url = false) {
84
  // additional check for some sites running inside a virtual machine or behind
85
  // proxy where there could be different ports (e.g., host:8080 => guest:80)
 
 
 
86
  $site_url = ($site_url) ? $site_url : home_url();
87
  $parsed_url = parse_url($site_url);
88
  $scheme = '';
1
  <?php
2
+
3
  namespace MailPoet\Cron;
4
 
5
  use MailPoet\Models\Setting;
6
  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
 
61
  'user-agent' => 'MailPoet (www.mailpoet.com) Cron'
62
  );
63
  $result = wp_remote_get($url, $args);
64
+ return wp_remote_retrieve_body($result);
65
  }
66
 
67
  static function accessDaemon($token, $timeout = self::DAEMON_REQUEST_TIMEOUT) {
85
  static function getSiteUrl($site_url = false) {
86
  // additional check for some sites running inside a virtual machine or behind
87
  // proxy where there could be different ports (e.g., host:8080 => guest:80)
88
+ $custom_cron_url = WPHooks::applyFilters('mailpoet_cron_request_url', null);
89
+ if($custom_cron_url) return $custom_cron_url;
90
+
91
  $site_url = ($site_url) ? $site_url : home_url();
92
  $parsed_url = parse_url($site_url);
93
  $scheme = '';
lib/Segments/WP.php CHANGED
@@ -79,28 +79,109 @@ class WP {
79
  }
80
 
81
  static function synchronizeUsers() {
82
- // get wordpress users list
83
- $wp_segment = Segment::getWPSegment();
84
 
85
- // fetch all wp users id
86
- $wp_users = \get_users(array(
87
- 'count_total' => false,
88
- 'fields' => 'ID'
89
- ));
 
 
 
90
 
91
- // update data for each wp user
92
- foreach($wp_users as $wp_user_id) {
93
- static::synchronizeUser($wp_user_id);
94
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
 
 
 
 
 
 
 
 
 
 
96
  // remove orphaned wp segment subscribers (not having a matching wp user id),
97
  // e.g. if wp users were deleted directly from the database
98
- $wp_segment->subscribers()
99
- ->whereNotIn('wp_user_id', $wp_users)
 
 
 
100
  ->findResultSet()
101
  ->set('wp_user_id', null)
102
  ->delete();
103
 
104
- return true;
105
  }
106
  }
 
79
  }
80
 
81
  static function synchronizeUsers() {
 
 
82
 
83
+ self::updateSubscribersEmails();
84
+ self::insertSubscribers();
85
+ self::removeFromTrash();
86
+ self::updateFirstNames();
87
+ self::updateLastNames();
88
+ self::updateFristNameIfMissing();
89
+ self::insertUsersToSegment();
90
+ self::removeOrphanedSubscribers();
91
 
92
+ return true;
93
+ }
94
+
95
+ private static function updateSubscribersEmails() {
96
+ global $wpdb;
97
+ $subscribers_table = Subscriber::$_table;
98
+ Subscriber::raw_execute(sprintf('
99
+ UPDATE IGNORE %s
100
+ JOIN %susers as wu ON %s.wp_user_id = wu.id
101
+ SET email = user_email
102
+ WHERE %s.wp_user_id IS NOT NULL
103
+ ', $subscribers_table, $wpdb->prefix, $subscribers_table, $subscribers_table));
104
+ }
105
+
106
+ private static function insertSubscribers() {
107
+ global $wpdb;
108
+ $subscribers_table = Subscriber::$_table;
109
+ Subscriber::raw_execute(sprintf('
110
+ INSERT IGNORE INTO %s(wp_user_id, email, status, created_at)
111
+ SELECT wu.id, wu.user_email, "subscribed", CURRENT_TIMESTAMP() FROM %susers wu
112
+ LEFT JOIN %s mps ON wu.id = mps.wp_user_id
113
+ WHERE mps.wp_user_id IS NULL
114
+ ', $subscribers_table, $wpdb->prefix, $subscribers_table));
115
+ }
116
+
117
+ private static function updateFirstNames() {
118
+ global $wpdb;
119
+ $subscribers_table = Subscriber::$_table;
120
+ Subscriber::raw_execute(sprintf('
121
+ UPDATE %s
122
+ JOIN %susermeta as wpum ON %s.wp_user_id = wpum.user_id AND meta_key = "first_name"
123
+ SET first_name = meta_value
124
+ WHERE %s.first_name = ""
125
+ AND %s.wp_user_id IS NOT NULL
126
+ ', $subscribers_table, $wpdb->prefix, $subscribers_table, $subscribers_table, $subscribers_table));
127
+ }
128
+
129
+ private static function updateLastNames() {
130
+ global $wpdb;
131
+ $subscribers_table = Subscriber::$_table;
132
+ Subscriber::raw_execute(sprintf('
133
+ UPDATE %s
134
+ JOIN %susermeta as wpum ON %s.wp_user_id = wpum.user_id AND meta_key = "last_name"
135
+ SET last_name = meta_value
136
+ WHERE %s.last_name = ""
137
+ AND %s.wp_user_id IS NOT NULL
138
+ ', $subscribers_table, $wpdb->prefix, $subscribers_table, $subscribers_table, $subscribers_table));
139
+ }
140
+
141
+ private static function updateFristNameIfMissing() {
142
+ global $wpdb;
143
+ $subscribers_table = Subscriber::$_table;
144
+ Subscriber::raw_execute(sprintf('
145
+ UPDATE %s
146
+ JOIN %susers wu ON %s.wp_user_id = wu.id
147
+ SET first_name = display_name
148
+ WHERE %s.first_name = ""
149
+ AND %s.wp_user_id IS NOT NULL
150
+ ', $subscribers_table, $wpdb->prefix, $subscribers_table, $subscribers_table, $subscribers_table));
151
+ }
152
+
153
+ private static function insertUsersToSegment() {
154
+ $wp_segment = Segment::getWPSegment();
155
+ $subscribers_table = Subscriber::$_table;
156
+ $wp_mailpoet_subscriber_segment_table = SubscriberSegment::$_table;
157
+ Subscriber::raw_execute(sprintf('
158
+ INSERT IGNORE INTO %s(subscriber_id, segment_id, created_at)
159
+ SELECT mps.id, "%s", CURRENT_TIMESTAMP() FROM %s mps
160
+ WHERE mps.wp_user_id IS NOT NULL
161
+ ', $wp_mailpoet_subscriber_segment_table, $wp_segment->id, $subscribers_table));
162
+ }
163
 
164
+ private static function removeFromTrash() {
165
+ $subscribers_table = Subscriber::$_table;
166
+ Subscriber::raw_execute(sprintf('
167
+ UPDATE %s
168
+ SET deleted_at = NULL
169
+ WHERE %s.wp_user_id IS NOT NULL
170
+ ', $subscribers_table, $subscribers_table));
171
+ }
172
+
173
+ private static function removeOrphanedSubscribers() {
174
  // remove orphaned wp segment subscribers (not having a matching wp user id),
175
  // e.g. if wp users were deleted directly from the database
176
+ global $wpdb;
177
+
178
+ Subscriber::table_alias('wpms')
179
+ ->leftOuterJoin($wpdb->prefix . 'users', array('wpms.wp_user_id', '=', 'wu.id'), 'wu')
180
+ ->whereNull('wu.id')
181
  ->findResultSet()
182
  ->set('wp_user_id', null)
183
  ->delete();
184
 
 
185
  }
186
  }
187
+
lib/Twig/Functions.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
 
2
  namespace MailPoet\Twig;
 
3
  use MailPoet\Config\ServicesChecker;
4
 
5
  if(!defined('ABSPATH')) exit;
@@ -86,6 +88,11 @@ class Functions extends \Twig_Extension {
86
  'do_action',
87
  'do_action',
88
  array('is_safe' => array('all'))
 
 
 
 
 
89
  )
90
  );
91
  }
@@ -162,4 +169,8 @@ class Functions extends \Twig_Extension {
162
  $checker = new ServicesChecker();
163
  return $checker->isPremiumKeyValid(false);
164
  }
 
 
 
 
165
  }
1
  <?php
2
+
3
  namespace MailPoet\Twig;
4
+
5
  use MailPoet\Config\ServicesChecker;
6
 
7
  if(!defined('ABSPATH')) exit;
88
  'do_action',
89
  'do_action',
90
  array('is_safe' => array('all'))
91
+ ),
92
+ new \Twig_SimpleFunction(
93
+ 'is_rtl',
94
+ array($this, 'isRtl'),
95
+ array('is_safe' => array('all'))
96
  )
97
  );
98
  }
169
  $checker = new ServicesChecker();
170
  return $checker->isPremiumKeyValid(false);
171
  }
172
+
173
+ function isRtl() {
174
+ return is_rtl();
175
+ }
176
  }
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (new)
7
- * Version: 3.0.0-rc.2.0.2
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
@@ -21,7 +21,7 @@ if(!defined('ABSPATH')) exit;
21
  */
22
 
23
  $mailpoet_plugin = array(
24
- 'version' => '3.0.0-rc.2.0.2',
25
  'filename' => __FILE__,
26
  'path' => dirname(__FILE__),
27
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (new)
7
+ * Version: 3.0.0-rc.2.0.3
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
21
  */
22
 
23
  $mailpoet_plugin = array(
24
+ 'version' => '3.0.0-rc.2.0.3',
25
  'filename' => __FILE__,
26
  'path' => dirname(__FILE__),
27
  '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.6
5
  Tested up to: 4.8
6
  Requires PHP: 5.3
7
- Stable tag: 3.0.0-rc.2.0.2
8
  Create and send beautiful emails and newsletters from WordPress.
9
 
10
  == Description ==
@@ -94,6 +94,14 @@ Our [support site](https://beta.docs.mailpoet.com) has plenty of articles. You c
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
97
  = 3.0.0-rc.2.0.2 - 2017-09-05 =
98
  * Added: browser spellchecker in newsletter editor;
99
  * Improved: newsletter editor uses an optimized data object to display post types. Thanks Facundo;
4
  Requires at least: 4.6
5
  Tested up to: 4.8
6
  Requires PHP: 5.3
7
+ Stable tag: 3.0.0-rc.2.0.3
8
  Create and send beautiful emails and newsletters from WordPress.
9
 
10
  == Description ==
94
 
95
  == Changelog ==
96
 
97
+ = 3.0.0-rc.2.0.3 - 2017-09-12 =
98
+ * Added: hook to override default cron URL. Thanks Fred;
99
+ * Improved: WordPress user sync optimized for large membership sites; Thanks Nagui and @deltafactory!
100
+ * Improved: column blocks are highlighted when hovering over their tools in the newsletter editor. Now column blocks are easier to visualize;
101
+ * Improved: color picker in the the email designer got instant color previews and history of recent picks to help you design newsletter elements more rapidly;
102
+ * Fixed: Twig does not throw a deprecated notice. Thanks Pascal;
103
+ * Fixed: newsletter editor now longer hangs on Internet Explorer. Thanks Danielle;
104
+
105
  = 3.0.0-rc.2.0.2 - 2017-09-05 =
106
  * Added: browser spellchecker in newsletter editor;
107
  * Improved: newsletter editor uses an optimized data object to display post types. Thanks Facundo;
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit28c97880db181668489ce28e70c64309::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit93d8437952c2c647922399b465db986a::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit28c97880db181668489ce28e70c64309
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit28c97880db181668489ce28e70c64309
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit28c97880db181668489ce28e70c64309', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit28c97880db181668489ce28e70c64309', '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\ComposerStaticInit28c97880db181668489ce28e70c64309::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit28c97880db181668489ce28e70c64309
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit28c97880db181668489ce28e70c64309::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire28c97880db181668489ce28e70c64309($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire28c97880db181668489ce28e70c64309($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 ComposerAutoloaderInit93d8437952c2c647922399b465db986a
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit93d8437952c2c647922399b465db986a', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit93d8437952c2c647922399b465db986a', '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\ComposerStaticInit93d8437952c2c647922399b465db986a::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\ComposerStaticInit93d8437952c2c647922399b465db986a::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire93d8437952c2c647922399b465db986a($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire93d8437952c2c647922399b465db986a($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 ComposerStaticInit28c97880db181668489ce28e70c64309
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -835,10 +835,10 @@ class ComposerStaticInit28c97880db181668489ce28e70c64309
835
  public static function getInitializer(ClassLoader $loader)
836
  {
837
  return \Closure::bind(function () use ($loader) {
838
- $loader->prefixLengthsPsr4 = ComposerStaticInit28c97880db181668489ce28e70c64309::$prefixLengthsPsr4;
839
- $loader->prefixDirsPsr4 = ComposerStaticInit28c97880db181668489ce28e70c64309::$prefixDirsPsr4;
840
- $loader->prefixesPsr0 = ComposerStaticInit28c97880db181668489ce28e70c64309::$prefixesPsr0;
841
- $loader->classMap = ComposerStaticInit28c97880db181668489ce28e70c64309::$classMap;
842
 
843
  }, null, ClassLoader::class);
844
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit93d8437952c2c647922399b465db986a
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
835
  public static function getInitializer(ClassLoader $loader)
836
  {
837
  return \Closure::bind(function () use ($loader) {
838
+ $loader->prefixLengthsPsr4 = ComposerStaticInit93d8437952c2c647922399b465db986a::$prefixLengthsPsr4;
839
+ $loader->prefixDirsPsr4 = ComposerStaticInit93d8437952c2c647922399b465db986a::$prefixDirsPsr4;
840
+ $loader->prefixesPsr0 = ComposerStaticInit93d8437952c2c647922399b465db986a::$prefixesPsr0;
841
+ $loader->classMap = ComposerStaticInit93d8437952c2c647922399b465db986a::$classMap;
842
 
843
  }, null, ClassLoader::class);
844
  }
views/index.html CHANGED
@@ -2,7 +2,7 @@
2
 
3
  <% block content %>
4
  <h1><%= 'Welcome!' %></h1>
5
- <p><%= __(' %sSet up%s MailPoet and start sending.')
6
  | format('<a href="%s">', '</a>')
7
  | format(admin_url('admin.php?page=mailpoet-settings'))
8
  | raw
2
 
3
  <% block content %>
4
  <h1><%= 'Welcome!' %></h1>
5
+ <p><%= __('%sSet up%s MailPoet and start sending.')
6
  | format('<a href="%s">', '</a>')
7
  | format(admin_url('admin.php?page=mailpoet-settings'))
8
  | raw
views/layout.html CHANGED
@@ -35,7 +35,7 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
35
  <%= do_action('mailpoet_styles_admin_after') %>
36
 
37
  <!-- rtl specific stylesheet -->
38
- <% if is_rtl %>
39
  <%= stylesheet('rtl.css') %>
40
  <% endif %>
41
 
35
  <%= do_action('mailpoet_styles_admin_after') %>
36
 
37
  <!-- rtl specific stylesheet -->
38
+ <% if is_rtl() %>
39
  <%= stylesheet('rtl.css') %>
40
  <% endif %>
41
 
views/newsletter/editor.html CHANGED
@@ -1233,9 +1233,9 @@
1233
  data: {
1234
  newsletter_id: response.data.id
1235
  }
1236
- }).done(response =>
1237
  MailPoet.Notice.success(MailPoet.I18n.t('newsletterIsPaused'))
1238
- ).fail(function(response) {
1239
  if (response.errors.length > 0) {
1240
  MailPoet.Notice.error(
1241
  response.errors.map(function(error) { return error.message; }),
1233
  data: {
1234
  newsletter_id: response.data.id
1235
  }
1236
+ }).done(function(respose) {
1237
  MailPoet.Notice.success(MailPoet.I18n.t('newsletterIsPaused'))
1238
+ }).fail(function(response) {
1239
  if (response.errors.length > 0) {
1240
  MailPoet.Notice.error(
1241
  response.errors.map(function(error) { return error.message; }),
views/settings/mta.html CHANGED
@@ -122,7 +122,7 @@
122
  <br />
123
  <%= __('Choose to send emails through your website (not recommended) or a third party sender.') %>
124
  <ul class="sending-method-benefits mailpoet_error">
125
- <li class="mailpoet_error_item"><%= __('You\'ll probably end up in spam.') %>
126
  <li class="mailpoet_error_item"><%= __('Sending speed is limited by your web host.') %>
127
  <li class="mailpoet_error_item"><%= __('Manual configuration of SPF and DKIM required.') %>
128
  <li class="mailpoet_error_item"><%= __('Bounce handling is available, but only with an extra add-on.') %>
122
  <br />
123
  <%= __('Choose to send emails through your website (not recommended) or a third party sender.') %>
124
  <ul class="sending-method-benefits mailpoet_error">
125
+ <li class="mailpoet_error_item"><%= __("You'll probably end up in spam.") %>
126
  <li class="mailpoet_error_item"><%= __('Sending speed is limited by your web host.') %>
127
  <li class="mailpoet_error_item"><%= __('Manual configuration of SPF and DKIM required.') %>
128
  <li class="mailpoet_error_item"><%= __('Bounce handling is available, but only with an extra add-on.') %>
views/update.html CHANGED
@@ -89,10 +89,10 @@
89
  data: {
90
  analytics: { enabled: (is_enabled)}
91
  }
92
- }).fail((response) => {
93
  if (response.errors.length > 0) {
94
  MailPoet.Notice.error(
95
- response.errors.map((error) => { return error.message; }),
96
  { scroll: true }
97
  );
98
  }
89
  data: {
90
  analytics: { enabled: (is_enabled)}
91
  }
92
+ }).fail(function(response) {
93
  if (response.errors.length > 0) {
94
  MailPoet.Notice.error(
95
+ response.errors.map(function(error) { return error.message; }),
96
  { scroll: true }
97
  );
98
  }
views/welcome.html CHANGED
@@ -110,10 +110,10 @@ jQuery(function($) {
110
  data: {
111
  analytics: { enabled: (is_enabled)}
112
  }
113
- }).fail((response) => {
114
  if (response.errors.length > 0) {
115
  MailPoet.Notice.error(
116
- response.errors.map((error) => { return error.message; }),
117
  { scroll: true }
118
  );
119
  }
110
  data: {
111
  analytics: { enabled: (is_enabled)}
112
  }
113
+ }).fail(function(response) {
114
  if (response.errors.length > 0) {
115
  MailPoet.Notice.error(
116
+ response.errors.map(function(error) { return error.message; }),
117
  { scroll: true }
118
  );
119
  }