MailPoet Newsletters (New) - Version 3.6.7

Version Description

  • 2018-04-24 =
  • Fixed: Duplicates in the database will not stop scheduled newsletters anymore.
Download this release

Release Info

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

Code changes from version 3.6.6 to 3.6.7

assets/js/{admin.0a76985e.js → admin.914e9da8.js} RENAMED
@@ -455,205 +455,221 @@ webpackJsonp([0],{
455
  /***/ 293:
456
  /***/ function(module, exports, __webpack_require__) {
457
 
458
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
459
 
460
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(181), __webpack_require__(276), __webpack_require__(294), __webpack_require__(426)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, MailPoet, Form, ReactStringReplace) {
461
- var fields = [{
462
- name: 'email',
463
- label: MailPoet.I18n.t('email'),
464
- type: 'text',
465
- disabled: function disabled(subscriber) {
466
- return Number(subscriber.wp_user_id > 0);
467
- }
468
- }, {
469
- name: 'first_name',
470
- label: MailPoet.I18n.t('firstname'),
471
- type: 'text',
472
- disabled: function disabled(subscriber) {
473
- return Number(subscriber.wp_user_id > 0);
474
- }
475
- }, {
476
- name: 'last_name',
477
- label: MailPoet.I18n.t('lastname'),
478
- type: 'text',
479
- disabled: function disabled(subscriber) {
480
- return Number(subscriber.wp_user_id > 0);
481
- }
482
- }, {
483
- name: 'status',
484
- label: MailPoet.I18n.t('status'),
485
- type: 'select',
486
- values: {
487
- subscribed: MailPoet.I18n.t('subscribed'),
488
- unconfirmed: MailPoet.I18n.t('unconfirmed'),
489
- unsubscribed: MailPoet.I18n.t('unsubscribed'),
490
- bounced: MailPoet.I18n.t('bounced')
491
- },
492
- filter: function filter(subscriber, value) {
493
- if (Number(subscriber.wp_user_id) > 0 && value === 'unconfirmed') {
494
- return false;
495
- }
496
- return true;
497
- }
498
- }, {
499
- name: 'segments',
500
- label: MailPoet.I18n.t('lists'),
501
- type: 'selection',
502
- placeholder: MailPoet.I18n.t('selectList'),
503
- tip: MailPoet.I18n.t('welcomeEmailTip'),
504
- api_version: window.mailpoet_api_version,
505
- endpoint: 'segments',
506
- multiple: true,
507
- selected: function selected(subscriber) {
508
- if (Array.isArray(subscriber.subscriptions) === false) {
509
- return null;
510
- }
511
 
512
- return subscriber.subscriptions.filter(function (subscription) {
513
- return subscription.status === 'subscribed';
514
- }).map(function (subscription) {
515
- return subscription.segment_id;
516
- });
517
- },
518
- filter: function filter(segment) {
519
- return !segment.deleted_at && segment.type === 'default';
520
- },
521
- getLabel: function getLabel(segment) {
522
- return segment.name + ' (' + segment.subscribers + ')';
523
- },
524
- getSearchLabel: function getSearchLabel(segment, subscriber) {
525
- var label = '';
526
 
527
- if (subscriber.subscriptions !== undefined) {
528
- subscriber.subscriptions.forEach(function (subscription) {
529
- if (segment.id === subscription.segment_id) {
530
- label = segment.name;
531
 
532
- if (subscription.status === 'unsubscribed') {
533
- var unsubscribedAt = MailPoet.Date.format(subscription.updated_at);
534
- label += ' (%$1s)'.replace('%$1s', MailPoet.I18n.t('unsubscribedOn').replace('%$1s', unsubscribedAt));
535
- }
536
- }
537
- });
538
- }
539
- return label;
540
- }
541
- }];
542
 
543
- var customFields = window.mailpoet_custom_fields || [];
544
- customFields.forEach(function (customField) {
545
- var field = {
546
- name: 'cf_' + customField.id,
547
- label: customField.name,
548
- type: customField.type
549
- };
550
- if (customField.params) {
551
- field.params = customField.params;
552
- }
553
 
554
- if (customField.params.values) {
555
- field.values = customField.params.values;
556
- }
557
 
558
- // add placeholders for selects (date, select)
559
- switch (customField.type) {
560
- case 'date':
561
- field.year_placeholder = MailPoet.I18n.t('year');
562
- field.month_placeholder = MailPoet.I18n.t('month');
563
- field.day_placeholder = MailPoet.I18n.t('day');
564
- break;
565
 
566
- case 'select':
567
- field.placeholder = '-';
568
- break;
569
 
570
- default:
571
- field.placeholder = '';
572
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
 
575
- fields.push(field);
576
- });
 
 
 
 
 
 
 
 
 
 
 
 
577
 
578
- var messages = {
579
- onUpdate: function onUpdate() {
580
- MailPoet.Notice.success(MailPoet.I18n.t('subscriberUpdated'));
581
- },
582
- onCreate: function onCreate() {
583
- MailPoet.Notice.success(MailPoet.I18n.t('subscriberAdded'));
584
- MailPoet.trackEvent('Subscribers > Add new', {
585
- 'MailPoet Free version': window.mailpoet_version
 
 
586
  });
587
  }
 
 
 
 
 
 
 
 
 
 
588
  };
 
 
 
589
 
590
- function beforeFormContent(subscriber) {
591
- if (Number(subscriber.wp_user_id) > 0) {
592
- return React.createElement(
593
- 'p',
594
- { className: 'description' },
595
- ReactStringReplace(MailPoet.I18n.t('WPUserEditNotice'), /\[link\](.*?)\[\/link\]/g, function (match, i) {
596
- return React.createElement(
597
- 'a',
598
- {
599
- key: i,
600
- href: 'user-edit.php?user_id=' + subscriber.wp_user_id
601
- },
602
- match
603
- );
604
- })
605
- );
606
- }
607
- return undefined;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
  }
 
609
 
610
- function afterFormContent() {
611
- return React.createElement(
 
612
  'p',
613
  { className: 'description' },
614
- React.createElement(
615
- 'strong',
616
- null,
617
- MailPoet.I18n.t('tip')
618
- ),
619
- ' ',
620
- MailPoet.I18n.t('customFieldsTip')
 
 
 
621
  );
622
  }
 
 
623
 
624
- var Link = Router.Link;
 
 
 
 
 
 
 
 
 
 
 
 
625
 
626
- var SubscriberForm = React.createClass({
627
- displayName: 'SubscriberForm',
628
 
629
- render: function render() {
630
- return React.createElement(
631
- 'div',
632
- null,
633
- React.createElement(
634
- 'h1',
635
- { className: 'title' },
636
- MailPoet.I18n.t('subscriber'),
637
- React.createElement(
638
- Link,
639
- { className: 'page-title-action', to: '/' },
640
- MailPoet.I18n.t('backToList')
641
- )
642
- ),
643
- React.createElement(Form, {
644
- endpoint: 'subscribers',
645
- fields: fields,
646
- params: this.props.params,
647
- messages: messages,
648
- beforeFormContent: beforeFormContent,
649
- afterFormContent: afterFormContent
650
- })
651
- );
652
- }
653
- });
654
 
655
- return SubscriberForm;
656
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
657
 
658
  /***/ },
659
 
@@ -698,11 +714,11 @@ webpackJsonp([0],{
698
 
699
  var _newslettersSendJsx2 = _interopRequireDefault(_newslettersSendJsx);
700
 
701
- var _newslettersTypesStandardJsx = __webpack_require__(538);
702
 
703
  var _newslettersTypesStandardJsx2 = _interopRequireDefault(_newslettersTypesStandardJsx);
704
 
705
- var _newslettersTypesNotificationNotificationJsx = __webpack_require__(539);
706
 
707
  var _newslettersTypesNotificationNotificationJsx2 = _interopRequireDefault(_newslettersTypesNotificationNotificationJsx);
708
 
@@ -797,7 +813,8 @@ webpackJsonp([0],{
797
 
798
  routes = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_before_router', [].concat(_toConsumableArray(routes), _toConsumableArray(getAutomaticEmailsRoutes())));
799
 
800
- var mailpoetListing = _reactDom2['default'].render(_react2['default'].createElement(
 
801
  _reactRouter.Router,
802
  { history: history },
803
  _react2['default'].createElement(
@@ -823,210 +840,13 @@ webpackJsonp([0],{
823
  /***/ },
824
 
825
  /***/ 435:
826
- /***/ function(module, exports, __webpack_require__) {
827
-
828
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
829
-
830
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
831
-
832
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(276), __webpack_require__(433), __webpack_require__(181), __webpack_require__(436), __webpack_require__(281)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, MailPoet, Hooks, Router, Breadcrumb, _) {
833
- var NewsletterTypes = React.createClass({
834
- displayName: 'NewsletterTypes',
835
-
836
- contextTypes: {
837
- router: React.PropTypes.object.isRequired
838
- },
839
- setupNewsletter: function setupNewsletter(type) {
840
- if (type !== undefined) {
841
- this.context.router.push('/new/' + type);
842
- MailPoet.trackEvent('Emails > Type selected', {
843
- 'MailPoet Free version': window.mailpoet_version,
844
- 'Email type': type
845
- });
846
- }
847
- },
848
- createNewsletter: function createNewsletter(type) {
849
- var _this = this;
850
-
851
- MailPoet.trackEvent('Emails > Type selected', {
852
- 'MailPoet Free version': window.mailpoet_version,
853
- 'Email type': type
854
- });
855
- MailPoet.Ajax.post({
856
- api_version: window.mailpoet_api_version,
857
- endpoint: 'newsletters',
858
- action: 'create',
859
- data: {
860
- type: type,
861
- subject: MailPoet.I18n.t('draftNewsletterTitle')
862
- }
863
- }).done(function (response) {
864
- _this.context.router.push('/template/' + response.data.id);
865
- }).fail(function (response) {
866
- if (response.errors.length > 0) {
867
- MailPoet.Notice.error(response.errors.map(function (error) {
868
- return error.message;
869
- }), { scroll: true });
870
- }
871
- });
872
- },
873
- getAutomaticEmails: function getAutomaticEmails() {
874
- var _this2 = this;
875
-
876
- if (!window.mailpoet_automatic_emails) return [];
877
-
878
- return _.map(window.mailpoet_automatic_emails, function (automaticEmail) {
879
- var email = automaticEmail;
880
-
881
- email.action = (function () {
882
- return React.createElement(
883
- 'div',
884
- null,
885
- React.createElement(
886
- 'a',
887
- { className: 'button button-primary',
888
- onClick: _this2.setupNewsletter.bind(null, automaticEmail.slug),
889
- role: 'button',
890
- tabIndex: 0
891
- },
892
- MailPoet.I18n.t('setUp')
893
- )
894
- );
895
- })();
896
-
897
- return email;
898
- });
899
- },
900
- render: function render() {
901
- var defaultTypes = [{
902
- slug: 'standard',
903
- title: MailPoet.I18n.t('regularNewsletterTypeTitle'),
904
- description: MailPoet.I18n.t('regularNewsletterTypeDescription'),
905
- action: (function action() {
906
- return React.createElement(
907
- 'a',
908
- {
909
- className: 'button button-primary',
910
- 'data-automation-id': 'create_standard',
911
- onClick: this.createNewsletter.bind(null, 'standard'),
912
- role: 'button',
913
- tabIndex: 0
914
- },
915
- MailPoet.I18n.t('create')
916
- );
917
- }).bind(this)()
918
- }, {
919
- slug: 'welcome',
920
- title: MailPoet.I18n.t('welcomeNewsletterTypeTitle'),
921
- description: MailPoet.I18n.t('welcomeNewsletterTypeDescription'),
922
- action: (function action() {
923
- return React.createElement(
924
- 'div',
925
- null,
926
- React.createElement(
927
- 'a',
928
- { href: '?page=mailpoet-premium', target: '_blank' },
929
- MailPoet.I18n.t('premiumFeatureLink')
930
- )
931
- );
932
- })()
933
- }, {
934
- slug: 'notification',
935
- title: MailPoet.I18n.t('postNotificationNewsletterTypeTitle'),
936
- description: MailPoet.I18n.t('postNotificationNewsletterTypeDescription'),
937
- action: (function action() {
938
- return React.createElement(
939
- 'a',
940
- {
941
- className: 'button button-primary',
942
- 'data-automation-id': 'create_notification',
943
- onClick: this.setupNewsletter.bind(null, 'notification'),
944
- role: 'button',
945
- tabIndex: 0
946
- },
947
- MailPoet.I18n.t('setUp')
948
- );
949
- }).bind(this)()
950
- }];
951
-
952
- var types = Hooks.applyFilters('mailpoet_newsletters_types', [].concat(defaultTypes, _toConsumableArray(this.getAutomaticEmails())), this);
953
-
954
- return React.createElement(
955
- 'div',
956
- null,
957
- React.createElement(
958
- 'h1',
959
- null,
960
- MailPoet.I18n.t('pickCampaignType')
961
- ),
962
- React.createElement(Breadcrumb, { step: 'type' }),
963
- React.createElement(
964
- 'ul',
965
- { className: 'mailpoet_boxes clearfix' },
966
- types.map(function (type, index) {
967
- return React.createElement(
968
- 'li',
969
- { key: index, 'data-type': type.slug },
970
- React.createElement(
971
- 'div',
972
- null,
973
- React.createElement(
974
- 'div',
975
- { className: 'mailpoet_thumbnail' },
976
- type.thumbnailImage ? React.createElement('img', { src: type.thumbnailImage, alt: '' }) : null
977
- ),
978
- React.createElement(
979
- 'div',
980
- { className: 'mailpoet_description' },
981
- React.createElement(
982
- 'h3',
983
- null,
984
- type.title
985
- ),
986
- React.createElement(
987
- 'p',
988
- null,
989
- type.description
990
- )
991
- ),
992
- React.createElement(
993
- 'div',
994
- { className: 'mailpoet_actions' },
995
- type.action
996
- )
997
- )
998
- );
999
- }, this)
1000
- )
1001
- );
1002
- }
1003
- });
1004
-
1005
- return NewsletterTypes;
1006
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1007
-
1008
- /***/ },
1009
-
1010
- /***/ 438:
1011
  /***/ function(module, exports, __webpack_require__) {
1012
 
1013
  'use strict';
1014
 
1015
- Object.defineProperty(exports, '__esModule', {
1016
- value: true
1017
- });
1018
-
1019
- 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; };
1020
-
1021
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1022
-
1023
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
1024
-
1025
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1026
 
1027
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
1028
-
1029
- function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1030
 
1031
  var _react = __webpack_require__(2);
1032
 
@@ -1040,21 +860,243 @@ webpackJsonp([0],{
1040
 
1041
  var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
1042
 
1043
- var _commonLoadingJsx = __webpack_require__(439);
1044
-
1045
- var _commonLoadingJsx2 = _interopRequireDefault(_commonLoadingJsx);
1046
-
1047
- var _newslettersTemplatesTabsJsx = __webpack_require__(440);
1048
 
1049
- var _newslettersTemplatesTabsJsx2 = _interopRequireDefault(_newslettersTemplatesTabsJsx);
1050
 
1051
- var _newslettersTemplatesTemplate_boxJsx = __webpack_require__(441);
1052
 
1053
- var _newslettersTemplatesTemplate_boxJsx2 = _interopRequireDefault(_newslettersTemplatesTemplate_boxJsx);
1054
 
1055
- var _newslettersTemplatesImport_templateJsx = __webpack_require__(443);
1056
 
1057
- var _newslettersTemplatesImport_templateJsx2 = _interopRequireDefault(_newslettersTemplatesImport_templateJsx);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
 
1059
  var _wpJsHooks = __webpack_require__(433);
1060
 
@@ -1064,6 +1106,10 @@ webpackJsonp([0],{
1064
 
1065
  var _underscore2 = _interopRequireDefault(_underscore);
1066
 
 
 
 
 
1067
  var getEditorUrl = function getEditorUrl(id) {
1068
  return 'admin.php?page=mailpoet-newsletter-editor&id=' + id;
1069
  };
@@ -1295,7 +1341,7 @@ webpackJsonp([0],{
1295
  } else {
1296
  templates = templates.map(function (template, index) {
1297
  return _react2['default'].createElement(_newslettersTemplatesTemplate_boxJsx2['default'], _extends({
1298
- key: index,
1299
  index: index,
1300
  newsletterId: _this6.props.params.id,
1301
  beforeDelete: function () {
@@ -1342,6 +1388,12 @@ webpackJsonp([0],{
1342
  return NewsletterTemplates;
1343
  })(_react2['default'].Component);
1344
 
 
 
 
 
 
 
1345
  exports['default'] = NewsletterTemplates;
1346
  module.exports = exports['default'];
1347
 
@@ -1411,44 +1463,48 @@ webpackJsonp([0],{
1411
  /***/ 440:
1412
  /***/ function(module, exports, __webpack_require__) {
1413
 
1414
- "use strict";
1415
 
1416
- Object.defineProperty(exports, "__esModule", {
1417
  value: true
1418
  });
1419
 
1420
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1421
 
1422
  var _react = __webpack_require__(2);
1423
 
1424
  var _react2 = _interopRequireDefault(_react);
1425
 
 
 
 
 
1426
  var Tabs = function Tabs(_ref) {
1427
  var tabs = _ref.tabs;
1428
  var selected = _ref.selected;
1429
  var select = _ref.select;
1430
- return _react2["default"].createElement(
1431
- "div",
1432
- { className: "wp-filter hide-if-no-js" },
1433
- _react2["default"].createElement(
1434
- "ul",
1435
- { className: "filter-links" },
1436
  tabs.map(function (_ref2) {
1437
  var name = _ref2.name;
1438
  var label = _ref2.label;
1439
- return _react2["default"].createElement(
1440
- "li",
1441
  { key: name },
1442
- _react2["default"].createElement(
1443
- "a",
1444
  {
1445
- href: "javascript:",
1446
  className: selected === name ? 'current' : '',
1447
  onClick: function () {
1448
  return select(name);
1449
  }
1450
  },
1451
- " ",
1452
  label
1453
  )
1454
  );
@@ -1457,8 +1513,17 @@ webpackJsonp([0],{
1457
  );
1458
  };
1459
 
1460
- exports["default"] = Tabs;
1461
- module.exports = exports["default"];
 
 
 
 
 
 
 
 
 
1462
 
1463
  /***/ },
1464
 
@@ -1495,6 +1560,10 @@ webpackJsonp([0],{
1495
 
1496
  var _reactConfirmAlert = __webpack_require__(442);
1497
 
 
 
 
 
1498
  /**
1499
  * props = {
1500
  * index, id, newsletterId, name, description, thumbnail, readonly,
@@ -1690,6 +1759,21 @@ webpackJsonp([0],{
1690
  return TemplateBox;
1691
  })(_react2['default'].Component);
1692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1693
  exports['default'] = TemplateBox;
1694
  module.exports = exports['default'];
1695
 
@@ -1907,9 +1991,9 @@ webpackJsonp([0],{
1907
 
1908
  var _helpTooltipJsx2 = _interopRequireDefault(_helpTooltipJsx);
1909
 
1910
- /**
1911
- * props = {beforeImport, afterImport}
1912
- */
1913
 
1914
  var ImportTemplate = (function (_React$Component) {
1915
  _inherits(ImportTemplate, _React$Component);
@@ -2040,6 +2124,11 @@ webpackJsonp([0],{
2040
  return ImportTemplate;
2041
  })(_react2['default'].Component);
2042
 
 
 
 
 
 
2043
  exports['default'] = ImportTemplate;
2044
  module.exports = exports['default'];
2045
 
@@ -10853,960 +10942,856 @@ webpackJsonp([0],{
10853
  /***/ 526:
10854
  /***/ function(module, exports, __webpack_require__) {
10855
 
10856
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
10857
 
10858
  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; };
10859
 
10860
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(181), __webpack_require__(281), __webpack_require__(276), __webpack_require__(294), __webpack_require__(532), __webpack_require__(533), __webpack_require__(527), __webpack_require__(436), __webpack_require__(444), __webpack_require__(275), __webpack_require__(535), __webpack_require__(439), __webpack_require__(433)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, _, MailPoet, Form, StandardNewsletterFields, NotificationNewsletterFields, WelcomeNewsletterFields, Breadcrumb, HelpTooltip, jQuery, Thumbnail, Loading, Hooks) {
10861
- var NewsletterSend = React.createClass({
10862
- displayName: 'NewsletterSend',
10863
 
10864
- contextTypes: {
10865
- router: React.PropTypes.object.isRequired
10866
- },
10867
- getInitialState: function getInitialState() {
10868
- return {
10869
- fields: [],
10870
- item: {},
10871
- loading: true
10872
- };
10873
- },
10874
- getFieldsByNewsletter: function getFieldsByNewsletter(newsletter) {
10875
- var type = this.getSubtype(newsletter);
10876
- return type.getFields(newsletter);
10877
- },
10878
- getSendButtonOptions: function getSendButtonOptions() {
10879
- var type = this.getSubtype(this.state.item);
10880
- return type.getSendButtonOptions(this.state.item);
10881
- },
10882
- getSubtype: function getSubtype(newsletter) {
10883
- switch (newsletter.type) {
10884
- case 'notification':
10885
- return NotificationNewsletterFields;
10886
- case 'welcome':
10887
- return WelcomeNewsletterFields;
10888
- default:
10889
- return Hooks.applyFilters('mailpoet_newsletters_send_newsletter_fields', StandardNewsletterFields, newsletter);
10890
- }
10891
- },
10892
- isValid: function isValid() {
10893
- return jQuery('#mailpoet_newsletter').parsley().isValid();
10894
- },
10895
- componentDidMount: function componentDidMount() {
10896
- if (this.isMounted()) {
10897
- this.loadItem(this.props.params.id);
10898
- }
10899
- jQuery('#mailpoet_newsletter').parsley();
10900
- },
10901
- componentWillReceiveProps: function componentWillReceiveProps(props) {
10902
- this.loadItem(props.params.id);
10903
- },
10904
- loadItem: function loadItem(id) {
10905
- var _this = this;
10906
 
10907
- this.setState({ loading: true });
10908
 
10909
- MailPoet.Ajax.post({
10910
- api_version: window.mailpoet_api_version,
10911
- endpoint: 'newsletters',
10912
- action: 'get',
10913
- data: {
10914
- id: id
10915
- }
10916
- }).done(function (response) {
10917
- _this.setState({
10918
- loading: false,
10919
- item: response.data,
10920
- fields: _this.getFieldsByNewsletter(response.data)
10921
- });
10922
- }).fail(function () {
10923
- _this.setState({
10924
- loading: false,
10925
- item: {}
10926
- }, function () {
10927
- _this.context.router.push('/new');
10928
- });
10929
- });
10930
- },
10931
- saveTemplate: function saveTemplate(response, done) {
10932
- var _this2 = this;
10933
 
10934
- Thumbnail.fromUrl(response.meta.preview_url).then(function saveTemplateAjax(thumbnail) {
10935
- MailPoet.Ajax.post({
10936
- api_version: window.mailpoet_api_version,
10937
- endpoint: 'newsletterTemplates',
10938
- action: 'save',
10939
- data: {
10940
- newsletter_id: response.data.id,
10941
- name: response.data.subject,
10942
- description: response.data.preheader,
10943
- thumbnail: thumbnail,
10944
- body: JSON.stringify(response.data.body),
10945
- categories: '["recent"]'
10946
- }
10947
- }).then(done).fail(this.showError);
10948
- })['catch'](function (err) {
10949
- return _this2.showError({ errors: [err] });
10950
- });
10951
- },
10952
- handleSend: function handleSend(e) {
10953
- var _this3 = this;
10954
 
10955
- e.preventDefault();
10956
 
10957
- if (!this.isValid()) {
10958
- return jQuery('#mailpoet_newsletter').parsley().validate();
10959
- }
10960
 
10961
- MailPoet.Modal.loading(true);
10962
 
10963
- return this.saveNewsletter(e).done(function () {
10964
- _this3.setState({ loading: true });
10965
- }).done(function (response) {
10966
- switch (response.data.type) {
10967
- case 'notification':
10968
- case 'welcome':
10969
- return _this3.activateNewsletter(response);
10970
- default:
10971
- return _this3.sendNewsletter(response);
10972
- }
10973
- }).fail(function (err) {
10974
- _this3.showError(err);
10975
- _this3.setState({ loading: false });
10976
- MailPoet.Modal.loading(false);
10977
- });
10978
- },
10979
- sendNewsletter: function sendNewsletter(newsletter) {
10980
- var _this4 = this;
10981
 
10982
- return MailPoet.Ajax.post(Hooks.applyFilters('mailpoet_newsletters_send_server_request_parameters', {
10983
- api_version: window.mailpoet_api_version,
10984
- endpoint: 'sendingQueue',
10985
- action: 'add',
10986
- data: {
10987
- newsletter_id: this.state.item.id
10988
- }
10989
- }, this.state.item)).done(function (response) {
10990
- // save template in recently sent category
10991
- _this4.saveTemplate(newsletter, function () {
10992
- // redirect to listing based on newsletter type
10993
- _this4.context.router.push(Hooks.applyFilters('mailpoet_newsletters_send_server_request_response_redirect', '/' + (_this4.state.item.type || ''), _this4.state.item));
10994
- var customResponse = Hooks.applyFilters('mailpoet_newsletters_send_server_request_response', _this4.state.item, response);
10995
- if (_.isFunction(customResponse)) {
10996
- customResponse();
10997
- } else if (response.data.status === 'scheduled') {
10998
- MailPoet.Notice.success(MailPoet.I18n.t('newsletterHasBeenScheduled'));
10999
- MailPoet.trackEvent('Emails > Newsletter sent', {
11000
- scheduled: true,
11001
- 'MailPoet Free version': window.mailpoet_version
11002
- });
11003
- } else {
11004
- MailPoet.Notice.success(MailPoet.I18n.t('newsletterBeingSent'));
11005
- MailPoet.trackEvent('Emails > Newsletter sent', {
11006
- scheduled: false,
11007
- 'MailPoet Free version': window.mailpoet_version
11008
- });
11009
- }
11010
- MailPoet.Modal.loading(false);
11011
- });
11012
- }).fail(function (err) {
11013
- _this4.showError(err);
11014
- _this4.setState({ loading: false });
11015
- MailPoet.Modal.loading(false);
11016
- });
11017
- },
11018
- activateNewsletter: function activateEmail(newsletter) {
11019
- var _this5 = this;
11020
 
11021
- return MailPoet.Ajax.post({
11022
- api_version: window.mailpoet_api_version,
11023
- endpoint: 'newsletters',
11024
- action: 'setStatus',
11025
- data: {
11026
- id: this.props.params.id,
11027
- status: 'active'
11028
- }
11029
- }).done(function (response) {
11030
- // save template in recently sent category
11031
- _this5.saveTemplate(newsletter, function () {
11032
- // redirect to listing based on newsletter type
11033
- _this5.context.router.push('/' + (_this5.state.item.type || ''));
11034
- var opts = _this5.state.item.options;
11035
- // display success message depending on newsletter type
11036
- if (response.data.type === 'welcome') {
11037
- MailPoet.Notice.success(MailPoet.I18n.t('welcomeEmailActivated'));
11038
- MailPoet.trackEvent('Emails > Welcome email activated', {
11039
- 'MailPoet Free version': window.mailpoet_version,
11040
- 'List type': opts.event,
11041
- Delay: opts.afterTimeNumber + ' ' + opts.afterTimeType
11042
- });
11043
- } else if (response.data.type === 'notification') {
11044
- MailPoet.Notice.success(MailPoet.I18n.t('postNotificationActivated'));
11045
- MailPoet.trackEvent('Emails > Post notifications activated', {
11046
- 'MailPoet Free version': window.mailpoet_version,
11047
- Frequency: opts.intervalType
11048
- });
11049
- }
11050
- MailPoet.Modal.loading(false);
11051
- });
11052
- }).fail(function (err) {
11053
- _this5.showError(err);
11054
- _this5.setState({ loading: false });
11055
- MailPoet.Modal.loading(false);
11056
- });
11057
- },
11058
- handleResume: function handleResume(e) {
11059
- var _this6 = this;
11060
 
11061
- e.preventDefault();
11062
- if (!this.isValid()) {
11063
- jQuery('#mailpoet_newsletter').parsley().validate();
11064
- } else {
11065
- this.saveNewsletter(e).done(function () {
11066
- _this6.setState({ loading: true });
11067
- }).done(function () {
11068
- MailPoet.Ajax.post({
11069
- api_version: window.mailpoet_api_version,
11070
- endpoint: 'sendingQueue',
11071
- action: 'resume',
11072
- data: {
11073
- newsletter_id: _this6.state.item.id
11074
- }
11075
- }).done(function () {
11076
- _this6.context.router.push('/' + (_this6.state.item.type || ''));
11077
- MailPoet.Notice.success(MailPoet.I18n.t('newsletterSendingHasBeenResumed'));
11078
- }).fail(function (response) {
11079
- if (response.errors.length > 0) {
11080
- MailPoet.Notice.error(response.errors.map(function (error) {
11081
- return error.message;
11082
- }), { scroll: true });
11083
- }
11084
- });
11085
- }).fail(this.showError).always(function () {
11086
- _this6.setState({ loading: false });
11087
- });
11088
- }
11089
- return false;
11090
- },
11091
- handleSave: function handleSave(e) {
11092
- var _this7 = this;
11093
 
11094
- e.preventDefault();
11095
 
11096
- this.saveNewsletter(e).done(function () {
11097
- MailPoet.Notice.success(MailPoet.I18n.t('newsletterUpdated'));
11098
- }).done(function () {
11099
- _this7.context.router.push('/' + (_this7.state.item.type || ''));
11100
- }).fail(this.showError);
11101
- },
11102
- handleRedirectToDesign: function handleRedirectToDesign(e) {
11103
- e.preventDefault();
11104
- var redirectTo = e.target.href;
11105
 
11106
- this.saveNewsletter(e).done(function () {
11107
- MailPoet.Notice.success(MailPoet.I18n.t('newsletterUpdated'));
11108
- }).done(function () {
11109
- window.location = redirectTo;
11110
- }).fail(this.showError);
11111
- },
11112
- saveNewsletter: function saveNewsletter() {
11113
- var _this8 = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11114
 
11115
- var data = this.state.item;
11116
- data.queue = undefined;
11117
- this.setState({ loading: true });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11118
 
11119
- // Store only properties that can be changed on this page
11120
- var IGNORED_NEWSLETTER_PROPERTIES = ['preheader', 'body', 'created_at', 'deleted_at', 'hash', 'status', 'updated_at', 'type'];
11121
- var newsletterData = _.omit(data, IGNORED_NEWSLETTER_PROPERTIES);
11122
 
11123
- return MailPoet.Ajax.post({
11124
  api_version: window.mailpoet_api_version,
11125
- endpoint: 'newsletters',
11126
  action: 'save',
11127
- data: newsletterData
11128
- }).always(function () {
11129
- _this8.setState({ loading: false });
 
 
 
 
 
 
 
11130
  });
11131
- },
11132
- showError: function showError(response) {
11133
- if (response.errors.length > 0) {
11134
- MailPoet.Notice.error(response.errors.map(function (error) {
11135
- return error.message;
11136
- }), { scroll: true });
11137
- }
11138
- },
11139
- handleFormChange: function handleFormChange(e) {
11140
- var item = this.state.item;
11141
- var field = e.target.name;
11142
 
11143
- item[field] = e.target.value;
11144
 
11145
- this.setState({
11146
- item: item
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11147
  });
11148
- return true;
11149
- },
11150
- render: function render() {
11151
- var isPaused = this.state.item.status === 'sending' && this.state.item.queue && this.state.item.queue.status === 'paused';
11152
- var fields = this.state.fields.map(function (field) {
11153
- var newField = field;
11154
- if (field.name === 'segments' || field.name === 'options') {
11155
- newField.disabled = isPaused;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11156
  }
11157
- return newField;
11158
  });
11159
- var sendButtonOptions = this.getSendButtonOptions();
11160
- var breadcrumb = Hooks.applyFilters('mailpoet_newsletters_send_breadcrumb', React.createElement(Breadcrumb, { step: 'send' }), this.state.item.type, 'send');
 
 
 
 
 
 
11161
 
11162
- return React.createElement(
11163
- 'div',
11164
- null,
11165
- React.createElement(
11166
- 'h1',
11167
- null,
11168
- MailPoet.I18n.t('finalNewsletterStep')
11169
- ),
11170
- breadcrumb,
11171
- React.createElement(
11172
- Form,
11173
- {
11174
- id: 'mailpoet_newsletter',
11175
- fields: fields,
11176
- item: this.state.item,
11177
- loading: this.state.loading,
11178
- onChange: this.handleFormChange,
11179
- onSubmit: this.handleSave
11180
- },
11181
- React.createElement(
11182
- 'p',
11183
- { className: 'submit' },
11184
- isPaused ? React.createElement('input', {
11185
- className: 'button button-primary',
11186
- type: 'button',
11187
- onClick: this.handleResume,
11188
- value: MailPoet.I18n.t('resume')
11189
- }) : React.createElement('input', _extends({
11190
- className: 'button button-primary',
11191
- type: 'button',
11192
- onClick: this.handleSend,
11193
- value: MailPoet.I18n.t('send')
11194
- }, sendButtonOptions)),
11195
- ' ',
11196
- React.createElement('input', {
11197
- className: 'button button-secondary',
11198
- type: 'submit',
11199
- value: MailPoet.I18n.t('saveDraftAndClose')
11200
- }),
11201
- ' ',
11202
- MailPoet.I18n.t('orSimply'),
11203
- ' ',
11204
- React.createElement(
11205
- 'a',
11206
- {
11207
- href: '?page=mailpoet-newsletter-editor&id=' + this.props.params.id,
11208
- onClick: this.handleRedirectToDesign
11209
- },
11210
- MailPoet.I18n.t('goBackToDesign')
11211
- ),
11212
- '.'
11213
- ),
11214
- !isPaused && sendButtonOptions.disabled && sendButtonOptions.disabled === 'disabled' && React.createElement(HelpTooltip, {
11215
- tooltip: MailPoet.I18n.t('helpTooltipSendEmail'),
11216
- tooltipId: 'helpTooltipSendEmail'
11217
- })
11218
- )
11219
- );
11220
  }
11221
- });
 
 
 
11222
 
11223
- return NewsletterSend;
11224
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11225
 
11226
- /***/ },
 
 
 
 
 
 
 
 
 
11227
 
11228
- /***/ 527:
11229
- /***/ function(module, exports, __webpack_require__) {
11230
 
11231
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
 
 
 
 
 
 
11232
 
11233
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(433), __webpack_require__(528)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MailPoet, Hooks, Scheduling) {
11234
- var fields = [{
11235
- name: 'subject',
11236
- label: MailPoet.I18n.t('subjectLine'),
11237
- tip: MailPoet.I18n.t('subjectLineTip'),
11238
- type: 'text',
11239
- validation: {
11240
- 'data-parsley-required': true,
11241
- 'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
 
 
 
 
 
 
 
 
 
 
 
 
 
11242
  }
11243
- }, {
11244
- name: 'options',
11245
- label: MailPoet.I18n.t('sendWelcomeEmailWhen'),
11246
- type: 'reactComponent',
11247
- component: Scheduling
11248
- }, {
11249
- name: 'sender',
11250
- label: MailPoet.I18n.t('sender'),
11251
- tip: MailPoet.I18n.t('senderTip'),
11252
- fields: [{
11253
- name: 'sender_name',
11254
- type: 'text',
11255
- placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
11256
- validation: {
11257
- 'data-parsley-required': true
11258
- }
11259
- }, {
11260
- name: 'sender_address',
11261
- type: 'text',
11262
- placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
11263
- validation: {
11264
- 'data-parsley-required': true,
11265
- 'data-parsley-type': 'email'
11266
- }
11267
- }]
11268
- }, {
11269
- name: 'reply-to',
11270
- label: MailPoet.I18n.t('replyTo'),
11271
- tip: MailPoet.I18n.t('replyToTip'),
11272
- inline: true,
11273
- fields: [{
11274
- name: 'reply_to_name',
11275
- type: 'text',
11276
- placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
11277
- }, {
11278
- name: 'reply_to_address',
11279
- type: 'text',
11280
- placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
11281
- validation: {
11282
- 'data-parsley-type': 'email'
11283
  }
11284
- }]
11285
- }];
 
 
11286
 
11287
- fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11288
 
11289
- return {
11290
- getFields: function getFields() {
11291
- return fields;
11292
- },
11293
- getSendButtonOptions: function getSendButtonOptions() {
11294
- return {
11295
- value: MailPoet.I18n.t('activate')
11296
- };
11297
- }
11298
- };
11299
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11300
 
11301
  /***/ },
11302
 
11303
- /***/ 532:
11304
  /***/ function(module, exports, __webpack_require__) {
11305
 
11306
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
11307
 
11308
  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'); } }; })();
11309
 
11310
  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; };
11311
 
11312
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(275), __webpack_require__(281), __webpack_require__(276), __webpack_require__(433)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, jq, _, MailPoet, Hooks) {
11313
- var jQuery = jq;
11314
-
11315
- var currentTime = window.mailpoet_current_time || '00:00';
11316
- var defaultDateTime = window.mailpoet_current_date + ' 00:00:00';
11317
- var timeOfDayItems = window.mailpoet_schedule_time_of_day;
11318
- var dateDisplayFormat = window.mailpoet_date_display_format;
11319
- var dateStorageFormat = window.mailpoet_date_storage_format;
11320
-
11321
- var datepickerTranslations = {
11322
- closeText: MailPoet.I18n.t('close'),
11323
- currentText: MailPoet.I18n.t('today'),
11324
- nextText: MailPoet.I18n.t('next'),
11325
- prevText: MailPoet.I18n.t('previous'),
11326
- monthNames: [MailPoet.I18n.t('january'), MailPoet.I18n.t('february'), MailPoet.I18n.t('march'), MailPoet.I18n.t('april'), MailPoet.I18n.t('may'), MailPoet.I18n.t('june'), MailPoet.I18n.t('july'), MailPoet.I18n.t('august'), MailPoet.I18n.t('september'), MailPoet.I18n.t('october'), MailPoet.I18n.t('november'), MailPoet.I18n.t('december')],
11327
- monthNamesShort: [MailPoet.I18n.t('januaryShort'), MailPoet.I18n.t('februaryShort'), MailPoet.I18n.t('marchShort'), MailPoet.I18n.t('aprilShort'), MailPoet.I18n.t('mayShort'), MailPoet.I18n.t('juneShort'), MailPoet.I18n.t('julyShort'), MailPoet.I18n.t('augustShort'), MailPoet.I18n.t('septemberShort'), MailPoet.I18n.t('octoberShort'), MailPoet.I18n.t('novemberShort'), MailPoet.I18n.t('decemberShort')],
11328
- dayNames: [MailPoet.I18n.t('sunday'), MailPoet.I18n.t('monday'), MailPoet.I18n.t('tuesday'), MailPoet.I18n.t('wednesday'), MailPoet.I18n.t('thursday'), MailPoet.I18n.t('friday'), MailPoet.I18n.t('saturday')],
11329
- dayNamesShort: [MailPoet.I18n.t('sundayShort'), MailPoet.I18n.t('mondayShort'), MailPoet.I18n.t('tuesdayShort'), MailPoet.I18n.t('wednesdayShort'), MailPoet.I18n.t('thursdayShort'), MailPoet.I18n.t('fridayShort'), MailPoet.I18n.t('saturdayShort')],
11330
- dayNamesMin: [MailPoet.I18n.t('sundayMin'), MailPoet.I18n.t('mondayMin'), MailPoet.I18n.t('tuesdayMin'), MailPoet.I18n.t('wednesdayMin'), MailPoet.I18n.t('thursdayMin'), MailPoet.I18n.t('fridayMin'), MailPoet.I18n.t('saturdayMin')]
11331
- };
11332
 
11333
- var DateText = React.createClass({
11334
- displayName: 'DateText',
11335
 
11336
- onChange: function onChange(event) {
11337
- var changeEvent = event;
11338
- // Swap display format to storage format
11339
- var displayDate = changeEvent.target.value;
11340
- var storageDate = this.getStorageDate(displayDate);
11341
 
11342
- changeEvent.target.value = storageDate;
11343
- this.props.onChange(changeEvent);
11344
- },
11345
- componentDidMount: function componentDidMount() {
11346
- var $element = jQuery(this.dateInput);
11347
- var that = this;
11348
- if ($element.datepicker) {
11349
- // Override jQuery UI datepicker Date parsing and formatting
11350
- jQuery.datepicker.parseDate = function parseDate(format, value) {
11351
- // Transform string format to Date object
11352
- return MailPoet.Date.toDate(value, {
11353
- parseFormat: dateDisplayFormat,
11354
- format: format
11355
- });
11356
- };
11357
- jQuery.datepicker.formatDate = function formatDate(format, value) {
11358
- // Transform Date object to string format
11359
- var newValue = MailPoet.Date.format(value, {
11360
- format: format
11361
- });
11362
- return newValue;
11363
- };
11364
 
11365
- $element.datepicker(_.extend({
11366
- dateFormat: this.props.displayFormat,
11367
- isRTL: false,
11368
- onSelect: function onSelect(value) {
11369
- that.onChange({
11370
- target: {
11371
- name: that.getFieldName(),
11372
- value: value
11373
- }
11374
- });
11375
- }
11376
- }, datepickerTranslations));
11377
 
11378
- this.datepickerInitialized = true;
11379
- }
11380
- },
11381
- componentWillUnmount: function componentWillUnmount() {
11382
- if (this.datepickerInitialized) {
11383
- jQuery(this.dateInput).datepicker('destroy');
11384
- }
11385
- },
11386
- getFieldName: function getFieldName() {
11387
- return this.props.name || 'date';
11388
- },
11389
- getDisplayDate: function getDisplayDate(date) {
11390
- return MailPoet.Date.format(date, {
11391
- parseFormat: this.props.storageFormat,
11392
- format: this.props.displayFormat
11393
- });
11394
- },
11395
- getStorageDate: function getStorageDate(date) {
11396
- return MailPoet.Date.format(date, {
11397
- parseFormat: this.props.displayFormat,
11398
- format: this.props.storageFormat
11399
- });
11400
- },
11401
- render: function render() {
11402
- var _this = this;
11403
 
11404
- return React.createElement('input', _extends({
11405
- type: 'text',
11406
- size: '10',
11407
- name: this.getFieldName(),
11408
- value: this.getDisplayDate(this.props.value),
11409
- readOnly: true,
11410
- disabled: this.props.disabled,
11411
- onChange: this.onChange,
11412
- ref: function (c) {
11413
- _this.dateInput = c;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11414
  }
11415
- }, this.props.validation));
 
 
11416
  }
11417
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11418
 
11419
- var TimeSelect = React.createClass({
11420
- displayName: 'TimeSelect',
 
 
 
 
 
 
 
 
 
 
 
 
11421
 
11422
- render: function render() {
11423
- var options = Object.keys(timeOfDayItems).map(function (value, index) {
11424
- return React.createElement(
11425
- 'option',
11426
- {
11427
- key: 'option-' + index,
11428
- value: value
11429
- },
11430
- timeOfDayItems[value]
11431
- );
11432
- });
11433
 
11434
- return React.createElement(
11435
- 'select',
11436
- _extends({
11437
- name: this.props.name || 'time',
11438
- value: this.props.value,
11439
- disabled: this.props.disabled,
11440
- onChange: this.props.onChange
11441
- }, this.props.validation),
11442
- options
11443
  );
11444
- }
11445
- });
11446
 
11447
- var DateTime = React.createClass({
11448
- displayName: 'DateTime',
 
 
 
 
 
 
 
 
 
 
11449
 
11450
- DATE_TIME_SEPARATOR: ' ',
11451
- getInitialState: function getInitialState() {
11452
- return this.buildStateFromProps(this.props);
11453
- },
11454
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
11455
- this.setState(this.buildStateFromProps(nextProps));
11456
- },
11457
- buildStateFromProps: function buildStateFromProps(props) {
11458
- var value = props.value || defaultDateTime;
11459
 
11460
- var _value$split = value.split(this.DATE_TIME_SEPARATOR);
 
 
 
 
 
 
 
 
11461
 
11462
- var _value$split2 = _slicedToArray(_value$split, 2);
11463
 
11464
- var date = _value$split2[0];
11465
- var time = _value$split2[1];
11466
 
11467
- return {
11468
- date: date,
11469
- time: time
11470
- };
11471
- },
11472
- handleChange: function handleChange(event) {
11473
- var newState = {};
11474
- newState[event.target.name] = event.target.value;
11475
 
11476
- this.setState(newState, this.propagateChange);
11477
- },
11478
- propagateChange: function propagateChange() {
11479
- if (this.props.onChange) {
11480
- this.props.onChange({
11481
- target: {
11482
- name: this.props.name || '',
11483
- value: this.getDateTime()
11484
- }
11485
- });
11486
- }
11487
- },
11488
- getDateTime: function getDateTime() {
11489
- return [this.state.date, this.state.time].join(this.DATE_TIME_SEPARATOR);
11490
- },
11491
- render: function render() {
11492
- return React.createElement(
11493
- 'span',
11494
- null,
11495
- React.createElement(DateText, {
11496
- name: 'date',
11497
- value: this.state.date,
11498
- onChange: this.handleChange,
11499
- displayFormat: dateDisplayFormat,
11500
- storageFormat: dateStorageFormat,
11501
- disabled: this.props.disabled,
11502
- validation: this.props.dateValidation
11503
- }),
11504
- React.createElement(TimeSelect, {
11505
- name: 'time',
11506
- value: this.state.time,
11507
- onChange: this.handleChange,
11508
- disabled: this.props.disabled,
11509
- validation: this.props.timeValidation
11510
- })
11511
- );
11512
  }
11513
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11514
 
11515
- var StandardScheduling = React.createClass({
11516
- displayName: 'StandardScheduling',
11517
 
11518
- getCurrentValue: function getCurrentValue() {
11519
- return _.defaults(this.props.item[this.props.field.name] || {}, {
11520
- isScheduled: '0',
11521
- scheduledAt: defaultDateTime
11522
- });
11523
- },
11524
- handleValueChange: function handleValueChange(event) {
11525
- var oldValue = this.getCurrentValue();
11526
- var newValue = {};
11527
- newValue[event.target.name] = event.target.value;
11528
 
11529
- return this.props.onValueChange({
11530
- target: {
11531
- name: this.props.field.name,
11532
- value: _.extend({}, oldValue, newValue)
11533
- }
11534
- });
11535
- },
11536
- handleCheckboxChange: function handleCheckboxChange(event) {
11537
- var changeEvent = event;
11538
- changeEvent.target.value = this.isScheduledInput.checked ? '1' : '0';
11539
- return this.handleValueChange(changeEvent);
11540
- },
11541
- isScheduled: function isScheduled() {
11542
- return this.getCurrentValue().isScheduled === '1';
11543
- },
11544
- getDateValidation: function getDateValidation() {
11545
- return {
11546
- 'data-parsley-required': true,
11547
- 'data-parsley-required-message': MailPoet.I18n.t('noScheduledDateError'),
11548
- 'data-parsley-errors-container': '#mailpoet_scheduling'
11549
- };
11550
- },
11551
- render: function render() {
11552
- var _this2 = this;
11553
 
11554
- var schedulingOptions = undefined;
11555
 
11556
- if (this.isScheduled()) {
11557
- schedulingOptions = React.createElement(
 
 
 
 
 
 
 
 
 
 
 
11558
  'span',
11559
- { id: 'mailpoet_scheduling' },
11560
- React.createElement(DateTime, {
11561
- name: 'scheduledAt',
11562
- value: this.getCurrentValue().scheduledAt,
11563
- onChange: this.handleValueChange,
11564
- disabled: this.props.field.disabled,
11565
- dateValidation: this.getDateValidation()
11566
- }),
11567
- ' ',
11568
- React.createElement(
11569
- 'span',
11570
  null,
11571
- MailPoet.I18n.t('websiteTimeIs'),
11572
- ' ',
11573
- React.createElement(
11574
- 'code',
11575
- null,
11576
- currentTime
11577
- )
11578
  )
11579
- );
11580
- }
11581
- return React.createElement(
11582
- 'div',
11583
- null,
11584
- React.createElement('input', {
11585
- ref: function (c) {
11586
- _this2.isScheduledInput = c;
11587
- },
11588
- type: 'checkbox',
11589
- value: '1',
11590
- checked: this.isScheduled(),
11591
- disabled: this.props.field.disabled,
11592
- name: 'isScheduled',
11593
- onChange: this.handleCheckboxChange
11594
- }),
11595
- schedulingOptions
11596
  );
11597
  }
11598
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11599
 
11600
- var fields = [{
11601
- name: 'subject',
11602
- label: MailPoet.I18n.t('subjectLine'),
11603
- tip: MailPoet.I18n.t('subjectLineTip'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11604
  type: 'text',
 
11605
  validation: {
11606
- 'data-parsley-required': true,
11607
- 'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
11608
  }
11609
  }, {
11610
- name: 'segments',
11611
- label: MailPoet.I18n.t('segments'),
11612
- tip: MailPoet.I18n.t('segmentsTip'),
11613
- type: 'selection',
11614
- placeholder: MailPoet.I18n.t('selectSegmentPlaceholder'),
11615
- id: 'mailpoet_segments',
11616
- api_version: window.mailpoet_api_version,
11617
- endpoint: 'segments',
11618
- multiple: true,
11619
- filter: function filter(segment) {
11620
- return !segment.deleted_at;
11621
- },
11622
- getLabel: function getLabel(segment) {
11623
- return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
11624
- },
11625
- transformChangedValue: function transformChangedValue(segmentIds) {
11626
- var allSegments = this.getItems();
11627
- return _.map(segmentIds, function (id) {
11628
- return _.find(allSegments, function (segment) {
11629
- return segment.id === id;
11630
- });
11631
- });
11632
- },
11633
  validation: {
11634
  'data-parsley-required': true,
11635
- 'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
11636
  }
 
 
 
 
 
 
 
 
 
 
11637
  }, {
11638
- name: 'sender',
11639
- label: MailPoet.I18n.t('sender'),
11640
- tip: MailPoet.I18n.t('senderTip'),
11641
- fields: [{
11642
- name: 'sender_name',
11643
- type: 'text',
11644
- placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
11645
- validation: {
11646
- 'data-parsley-required': true
11647
- }
11648
- }, {
11649
- name: 'sender_address',
11650
- type: 'text',
11651
- placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
11652
- validation: {
11653
- 'data-parsley-required': true,
11654
- 'data-parsley-type': 'email'
11655
- }
11656
- }]
11657
- }, {
11658
- name: 'reply-to',
11659
- label: MailPoet.I18n.t('replyTo'),
11660
- tip: MailPoet.I18n.t('replyToTip'),
11661
- inline: true,
11662
- fields: [{
11663
- name: 'reply_to_name',
11664
- type: 'text',
11665
- placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
11666
- }, {
11667
- name: 'reply_to_address',
11668
- type: 'text',
11669
- placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
11670
- validation: {
11671
- 'data-parsley-type': 'email'
11672
- }
11673
- }]
11674
- }, {
11675
- name: 'options',
11676
- label: MailPoet.I18n.t('scheduleIt'),
11677
- type: 'reactComponent',
11678
- component: StandardScheduling
11679
- }];
11680
-
11681
- fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
11682
-
11683
- return {
11684
- getFields: function getFields() {
11685
- return fields;
11686
- },
11687
- getSendButtonOptions: function getSendButtonOptions(newsletter) {
11688
- var newsletterOptions = newsletter || {};
11689
-
11690
- var isScheduled = typeof newsletterOptions.options === 'object' && newsletterOptions.options.isScheduled === '1';
11691
- var options = {
11692
- value: isScheduled ? MailPoet.I18n.t('schedule') : MailPoet.I18n.t('send')
11693
- };
11694
-
11695
- if (newsletterOptions.status === 'sent' || newsletterOptions.status === 'sending') {
11696
- options.disabled = 'disabled';
11697
- }
11698
-
11699
- return options;
11700
  }
11701
- };
11702
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
11703
 
11704
- /***/ },
11705
 
11706
- /***/ 533:
11707
- /***/ function(module, exports, __webpack_require__) {
 
 
 
 
11708
 
11709
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
11710
 
11711
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(433), __webpack_require__(534), __webpack_require__(281)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MailPoet, Hooks, Scheduling, _) {
11712
- var fields = [{
11713
- name: 'subject',
11714
- label: MailPoet.I18n.t('subjectLine'),
11715
- tip: MailPoet.I18n.t('postNotificationSubjectLineTip'),
11716
- type: 'text',
11717
- validation: {
11718
- 'data-parsley-required': true,
11719
- 'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
11720
- }
11721
- }, {
11722
- name: 'options',
11723
- label: MailPoet.I18n.t('selectFrequency'),
11724
- type: 'reactComponent',
11725
- component: Scheduling
11726
- }, {
11727
- name: 'segments',
11728
- label: MailPoet.I18n.t('segments'),
11729
- tip: MailPoet.I18n.t('segmentsTip'),
11730
- type: 'selection',
11731
- placeholder: MailPoet.I18n.t('selectSegmentPlaceholder'),
11732
- id: 'mailpoet_segments',
11733
- api_version: window.mailpoet_api_version,
11734
- endpoint: 'segments',
11735
- multiple: true,
11736
- filter: function filter(segment) {
11737
- return !segment.deleted_at;
11738
- },
11739
- getLabel: function getLabel(segment) {
11740
- return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
11741
- },
11742
- transformChangedValue: function transformChangedValue(segmentIds) {
11743
- var allSegments = this.getItems();
11744
- return _.map(segmentIds, function (id) {
11745
- return _.find(allSegments, function (segment) {
11746
- return segment.id === id;
11747
- });
11748
- });
11749
- },
11750
- validation: {
11751
- 'data-parsley-required': true,
11752
- 'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
11753
  }
11754
- }, {
11755
- name: 'sender',
11756
- label: MailPoet.I18n.t('sender'),
11757
- tip: MailPoet.I18n.t('senderTip'),
11758
- fields: [{
11759
- name: 'sender_name',
11760
- type: 'text',
11761
- placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
11762
- validation: {
11763
- 'data-parsley-required': true
11764
- }
11765
- }, {
11766
- name: 'sender_address',
11767
- type: 'text',
11768
- placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
11769
- validation: {
11770
- 'data-parsley-required': true,
11771
- 'data-parsley-type': 'email'
11772
- }
11773
- }]
11774
- }, {
11775
- name: 'reply-to',
11776
- label: MailPoet.I18n.t('replyTo'),
11777
- tip: MailPoet.I18n.t('replyToTip'),
11778
- inline: true,
11779
- fields: [{
11780
- name: 'reply_to_name',
11781
- type: 'text',
11782
- placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
11783
- }, {
11784
- name: 'reply_to_address',
11785
- type: 'text',
11786
- placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
11787
- validation: {
11788
- 'data-parsley-type': 'email'
11789
- }
11790
- }]
11791
- }];
11792
 
11793
- fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
11794
-
11795
- return {
11796
- getFields: function getFields() {
11797
- return fields;
11798
- },
11799
- getSendButtonOptions: function getSendButtonOptions() {
11800
- return {
11801
- value: MailPoet.I18n.t('activate')
11802
- };
11803
- }
11804
- };
11805
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11806
 
11807
  /***/ },
11808
 
11809
- /***/ 534:
11810
  /***/ function(module, exports, __webpack_require__) {
11811
 
11812
  'use strict';
@@ -11817,135 +11802,203 @@ webpackJsonp([0],{
11817
 
11818
  var _underscore2 = _interopRequireDefault(_underscore);
11819
 
11820
- var _react = __webpack_require__(2);
11821
-
11822
- var _react2 = _interopRequireDefault(_react);
11823
-
11824
- var _formFieldsSelectJsx = __webpack_require__(301);
11825
-
11826
- var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
11827
-
11828
- var _newslettersSchedulingCommonJsx = __webpack_require__(530);
11829
-
11830
- var intervalField = {
11831
- name: 'intervalType',
11832
- values: _newslettersSchedulingCommonJsx.intervalValues
11833
- };
11834
-
11835
- var timeOfDayField = {
11836
- name: 'timeOfDay',
11837
- values: _newslettersSchedulingCommonJsx.timeOfDayValues
11838
- };
11839
-
11840
- var weekDayField = {
11841
- name: 'weekDay',
11842
- values: _newslettersSchedulingCommonJsx.weekDayValues
11843
- };
11844
 
11845
- var monthDayField = {
11846
- name: 'monthDay',
11847
- values: _newslettersSchedulingCommonJsx.monthDayValues
11848
- };
11849
 
11850
- var nthWeekDayField = {
11851
- name: 'nthWeekDay',
11852
- values: _newslettersSchedulingCommonJsx.nthWeekDayValues
11853
- };
11854
 
11855
- var NotificationScheduling = _react2['default'].createClass({
11856
- displayName: 'NotificationScheduling',
11857
 
11858
- getCurrentValue: function getCurrentValue() {
11859
- return this.props.item[this.props.field.name] || {};
11860
- },
11861
- handleValueChange: function handleValueChange(name, value) {
11862
- var oldValue = this.getCurrentValue();
11863
- var newValue = {};
11864
 
11865
- newValue[name] = value;
11866
 
11867
- return this.props.onValueChange({
11868
- target: {
11869
- name: this.props.field.name,
11870
- value: _underscore2['default'].extend({}, oldValue, newValue)
11871
- }
11872
- });
11873
- },
11874
- handleIntervalChange: function handleIntervalChange(event) {
11875
- return this.handleValueChange('intervalType', event.target.value);
11876
- },
11877
- handleTimeOfDayChange: function handleTimeOfDayChange(event) {
11878
- return this.handleValueChange('timeOfDay', event.target.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11879
  },
11880
- handleWeekDayChange: function handleWeekDayChange(event) {
11881
- return this.handleValueChange('weekDay', event.target.value);
11882
  },
11883
- handleMonthDayChange: function handleMonthDayChange(event) {
11884
- return this.handleValueChange('monthDay', event.target.value);
 
 
 
 
 
11885
  },
11886
- handleNthWeekDayChange: function handleNthWeekDayChange(event) {
11887
- return this.handleValueChange('nthWeekDay', event.target.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11888
  },
11889
- render: function render() {
11890
- var value = this.getCurrentValue();
11891
- var timeOfDaySelection = undefined;
11892
- var weekDaySelection = undefined;
11893
- var monthDaySelection = undefined;
11894
- var nthWeekDaySelection = undefined;
11895
 
11896
- if (value.intervalType !== 'immediately') {
11897
- timeOfDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
11898
- field: timeOfDayField,
11899
- item: this.getCurrentValue(),
11900
- onValueChange: this.handleTimeOfDayChange
11901
- });
11902
- }
11903
 
11904
- if (value.intervalType === 'weekly' || value.intervalType === 'nthWeekDay') {
11905
- weekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
11906
- field: weekDayField,
11907
- item: this.getCurrentValue(),
11908
- onValueChange: this.handleWeekDayChange
11909
- });
11910
- }
11911
 
11912
- if (value.intervalType === 'monthly') {
11913
- monthDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
11914
- field: monthDayField,
11915
- item: this.getCurrentValue(),
11916
- onValueChange: this.handleMonthDayChange
11917
- });
11918
- }
11919
 
11920
- if (value.intervalType === 'nthWeekDay') {
11921
- nthWeekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
11922
- field: nthWeekDayField,
11923
- item: this.getCurrentValue(),
11924
- onValueChange: this.handleNthWeekDayChange
11925
- });
11926
- }
11927
 
11928
- return _react2['default'].createElement(
11929
- 'div',
11930
- null,
11931
- _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
11932
- field: intervalField,
11933
- item: this.getCurrentValue(),
11934
- onValueChange: this.handleIntervalChange
11935
- }),
11936
- nthWeekDaySelection,
11937
- monthDaySelection,
11938
- weekDaySelection,
11939
- timeOfDaySelection
11940
- );
 
 
 
 
 
 
 
11941
  }
11942
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11943
 
11944
- module.exports = NotificationScheduling;
 
 
 
 
 
 
 
 
 
 
 
 
11945
 
11946
  /***/ },
11947
 
11948
- /***/ 535:
11949
  /***/ function(module, exports, __webpack_require__) {
11950
 
11951
  'use strict';
@@ -11964,7 +12017,7 @@ webpackJsonp([0],{
11964
 
11965
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
11966
 
11967
- var _html2canvas = __webpack_require__(536);
11968
 
11969
  var _html2canvas2 = _interopRequireDefault(_html2canvas);
11970
 
@@ -12049,15 +12102,15 @@ webpackJsonp([0],{
12049
 
12050
  /***/ },
12051
 
12052
- /***/ 536:
12053
  /***/ function(module, exports, __webpack_require__) {
12054
 
12055
- /* WEBPACK VAR INJECTION */(function(global) {module.exports = global["html2canvas"] = __webpack_require__(537);
12056
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
12057
 
12058
  /***/ },
12059
 
12060
- /***/ 537:
12061
  /***/ function(module, exports, __webpack_require__) {
12062
 
12063
  /*!
@@ -19311,157 +19364,328 @@ webpackJsonp([0],{
19311
  /******/ ]);
19312
  });
19313
 
19314
- /***/ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19315
 
19316
- /***/ 538:
19317
- /***/ function(module, exports, __webpack_require__) {
19318
 
19319
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
 
 
19320
 
19321
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(181), __webpack_require__(276), __webpack_require__(436)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, MailPoet, Breadcrumb) {
19322
- var NewsletterStandard = React.createClass({
19323
- displayName: 'NewsletterStandard',
19324
 
19325
- contextTypes: {
19326
- router: React.PropTypes.object.isRequired
19327
- },
19328
- showTemplateSelection: function showTemplateSelection(newsletterId) {
19329
- this.context.router.push('/template/' + newsletterId);
19330
- },
19331
- componentDidMount: function componentDidMount() {
19332
- var _this = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19333
 
19334
- // No options for this type, create a newsletter upon mounting
19335
- MailPoet.Ajax.post({
19336
- api_version: window.mailpoet_api_version,
19337
- endpoint: 'newsletters',
19338
- action: 'create',
19339
- data: {
19340
- type: 'standard'
19341
- }
19342
- }).done(function (response) {
19343
- _this.showTemplateSelection(response.data.id);
19344
- }).fail(function (response) {
19345
- if (response.errors.length > 0) {
19346
- MailPoet.Notice.error(response.errors.map(function (error) {
19347
- return error.message;
19348
- }), { scroll: true });
19349
- }
19350
  });
19351
- },
19352
- render: function render() {
19353
- return React.createElement(
19354
- 'div',
19355
- null,
19356
- React.createElement(
19357
- 'h1',
19358
- null,
19359
- MailPoet.I18n.t('regularNewsletterTypeTitle')
19360
- ),
19361
- React.createElement(Breadcrumb, { step: 'type' })
19362
- );
19363
  }
19364
- });
19365
-
19366
- return NewsletterStandard;
19367
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
19368
-
19369
- /***/ },
19370
-
19371
- /***/ 539:
19372
- /***/ function(module, exports, __webpack_require__) {
19373
-
19374
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
19375
-
19376
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(281), __webpack_require__(2), __webpack_require__(181), __webpack_require__(276), __webpack_require__(534), __webpack_require__(436)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, React, Router, MailPoet, Scheduling, Breadcrumb) {
19377
- var field = {
19378
- name: 'options',
19379
- type: 'reactComponent',
19380
- component: Scheduling
19381
- };
19382
 
19383
- var NewsletterNotification = React.createClass({
19384
- displayName: 'NewsletterNotification',
 
 
 
 
 
19385
 
19386
- contextTypes: {
19387
- router: React.PropTypes.object.isRequired
19388
- },
19389
- getInitialState: function getInitialState() {
19390
- return {
19391
- options: {
19392
- intervalType: 'daily',
19393
- timeOfDay: 0,
19394
- weekDay: 1,
19395
- monthDay: 0,
19396
- nthWeekDay: 1
19397
- }
19398
- };
19399
- },
19400
- handleValueChange: function handleValueChange(event) {
19401
- var state = this.state;
19402
- state[event.target.name] = event.target.value;
19403
- this.setState(state);
19404
- },
19405
- handleNext: function handleNext() {
19406
- var _this = this;
19407
 
19408
- MailPoet.Ajax.post({
19409
- api_version: window.mailpoet_api_version,
19410
- endpoint: 'newsletters',
19411
- action: 'create',
19412
- data: _.extend({}, this.state, {
19413
- type: 'notification',
19414
- subject: MailPoet.I18n.t('draftNewsletterTitle')
19415
- })
19416
- }).done(function (response) {
19417
- _this.showTemplateSelection(response.data.id);
19418
- }).fail(function (response) {
19419
- if (response.errors.length > 0) {
19420
- MailPoet.Notice.error(response.errors.map(function (error) {
19421
- return error.message;
19422
- }), { scroll: true });
19423
- }
19424
  });
19425
- },
19426
- showTemplateSelection: function showTemplateSelection(newsletterId) {
19427
- this.context.router.push('/template/' + newsletterId);
19428
- },
19429
- render: function render() {
19430
- return React.createElement(
19431
- 'div',
19432
- null,
19433
- React.createElement(
19434
- 'h1',
19435
- null,
19436
- MailPoet.I18n.t('postNotificationNewsletterTypeTitle')
19437
- ),
19438
- React.createElement(Breadcrumb, { step: 'type' }),
19439
- React.createElement(
19440
- 'h3',
19441
- null,
19442
- MailPoet.I18n.t('selectFrequency')
19443
- ),
19444
- React.createElement(Scheduling, {
19445
- item: this.state,
19446
- field: field,
19447
- onValueChange: this.handleValueChange
19448
- }),
19449
- React.createElement(
19450
- 'p',
19451
- { className: 'submit' },
19452
- React.createElement('input', {
19453
- className: 'button button-primary',
19454
- type: 'button',
19455
- onClick: this.handleNext,
19456
- value: MailPoet.I18n.t('next')
19457
- })
19458
- )
19459
- );
19460
  }
19461
- });
19462
 
19463
- return NewsletterNotification;
19464
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19465
 
19466
  /***/ },
19467
 
@@ -19695,7 +19919,9 @@ webpackJsonp([0],{
19695
  _mailpoet2['default'].I18n.t('pageTitle'),
19696
  _react2['default'].createElement(
19697
  _reactRouter.Link,
19698
- { className: 'page-title-action', to: '/new',
 
 
19699
  onClick: function () {
19700
  return _mailpoet2['default'].trackEvent('Emails > Add New', { 'MailPoet Free version': window.mailpoet_version });
19701
  },
@@ -20113,7 +20339,7 @@ webpackJsonp([0],{
20113
 
20114
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
20115
 
20116
- var _newslettersSchedulingCommonJsx = __webpack_require__(530);
20117
 
20118
  var messages = {
20119
  onTrash: function onTrash(response) {
@@ -20789,7 +21015,8 @@ webpackJsonp([0],{
20789
  'a',
20790
  {
20791
  href: 'http://docs.mailpoet.com/article/133-the-wordpress-users-list',
20792
- target: '_blank'
 
20793
  },
20794
  _mailpoet2['default'].I18n.t('readMore')
20795
  );
@@ -20989,63 +21216,87 @@ webpackJsonp([0],{
20989
  /***/ 558:
20990
  /***/ function(module, exports, __webpack_require__) {
20991
 
20992
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
20993
 
20994
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(181), __webpack_require__(276), __webpack_require__(294)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, MailPoet, Form) {
20995
- var fields = [{
20996
- name: 'name',
20997
- label: MailPoet.I18n.t('name'),
20998
- type: 'text'
20999
- }, {
21000
- name: 'description',
21001
- label: MailPoet.I18n.t('description'),
21002
- type: 'textarea',
21003
- tip: MailPoet.I18n.t('segmentDescriptionTip')
21004
- }];
21005
 
21006
- var messages = {
21007
- onUpdate: function onUpdate() {
21008
- MailPoet.Notice.success(MailPoet.I18n.t('segmentUpdated'));
21009
- },
21010
- onCreate: function onCreate() {
21011
- MailPoet.Notice.success(MailPoet.I18n.t('segmentAdded'));
21012
- MailPoet.trackEvent('Lists > Add new', {
21013
- 'MailPoet Free version': window.mailpoet_version
21014
- });
21015
- }
21016
- };
21017
 
21018
- var Link = Router.Link;
21019
 
21020
- var SegmentForm = React.createClass({
21021
- displayName: 'SegmentForm',
21022
 
21023
- render: function render() {
21024
- return React.createElement(
21025
- 'div',
21026
- null,
21027
- React.createElement(
21028
- 'h1',
21029
- { className: 'title' },
21030
- MailPoet.I18n.t('segment'),
21031
- React.createElement(
21032
- Link,
21033
- { className: 'page-title-action', to: '/' },
21034
- MailPoet.I18n.t('backToList')
21035
- )
21036
- ),
21037
- React.createElement(Form, {
21038
- endpoint: 'segments',
21039
- fields: fields,
21040
- params: this.props.params,
21041
- messages: messages
21042
- })
21043
- );
21044
- }
21045
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21046
 
21047
- return SegmentForm;
21048
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
21049
 
21050
  /***/ },
21051
 
@@ -23571,13 +23822,13 @@ webpackJsonp([0],{
23571
  }];
23572
 
23573
  function Tabs(props) {
23574
- var tabLinks = tabs.map(function (tab, index) {
23575
  var tabClasses = (0, _classnames2['default'])('nav-tab', { 'nav-tab-active': props.tab === tab.name });
23576
 
23577
  return _react2['default'].createElement(
23578
  _reactRouter.Link,
23579
  {
23580
- key: 'tab-' + index,
23581
  className: tabClasses,
23582
  to: tab.link
23583
  },
@@ -23709,7 +23960,7 @@ webpackJsonp([0],{
23709
  null,
23710
  _react2['default'].createElement(
23711
  'a',
23712
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/116-common-problems' },
23713
  'Common Problems'
23714
  )
23715
  ),
@@ -23718,7 +23969,7 @@ webpackJsonp([0],{
23718
  null,
23719
  _react2['default'].createElement(
23720
  'a',
23721
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/165-newsletters' },
23722
  'Newsletters'
23723
  )
23724
  ),
@@ -23727,7 +23978,7 @@ webpackJsonp([0],{
23727
  null,
23728
  _react2['default'].createElement(
23729
  'a',
23730
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/156-migration-questions' },
23731
  'Migration Questions'
23732
  )
23733
  ),
@@ -23736,7 +23987,7 @@ webpackJsonp([0],{
23736
  null,
23737
  _react2['default'].createElement(
23738
  'a',
23739
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/149-sending-methods' },
23740
  'Sending Methods'
23741
  )
23742
  ),
@@ -23745,7 +23996,7 @@ webpackJsonp([0],{
23745
  null,
23746
  _react2['default'].createElement(
23747
  'a',
23748
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/139-subscription-forms' },
23749
  'Subscription Forms'
23750
  )
23751
  ),
@@ -23754,7 +24005,7 @@ webpackJsonp([0],{
23754
  null,
23755
  _react2['default'].createElement(
23756
  'a',
23757
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/114-getting-started' },
23758
  'Getting Started'
23759
  )
23760
  ),
@@ -23763,7 +24014,7 @@ webpackJsonp([0],{
23763
  null,
23764
  _react2['default'].createElement(
23765
  'a',
23766
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/123-newsletter-designer' },
23767
  'Newsletter Designer'
23768
  )
23769
  ),
@@ -23772,14 +24023,14 @@ webpackJsonp([0],{
23772
  null,
23773
  _react2['default'].createElement(
23774
  'a',
23775
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/category/121-subscribers-and-lists' },
23776
  'Subscribers and Lists'
23777
  )
23778
  )
23779
  ),
23780
  _react2['default'].createElement(
23781
  'a',
23782
- { target: '_blank', href: 'http://beta.docs.mailpoet.com/', className: 'button button-primary' },
23783
  _mailpoet2['default'].I18n.t('knowledgeBaseButton')
23784
  )
23785
  );
@@ -23794,12 +24045,12 @@ webpackJsonp([0],{
23794
 
23795
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
23796
  __webpack_require__(276)
23797
- ], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
23798
  MailPoet
23799
  ) {
23800
  var element;
23801
  function eventHandler() {
23802
- if (confirm(MailPoet.I18n.t('reinstallConfirmation'))) {
23803
  MailPoet.trackEvent(
23804
  'User has reinstalled MailPoet via Settings',
23805
  { 'MailPoet Free version': window.mailpoet_version }
@@ -23810,14 +24061,14 @@ webpackJsonp([0],{
23810
  api_version: window.mailpoet_api_version,
23811
  endpoint: 'setup',
23812
  action: 'reset'
23813
- }).always(function () { // eslint-disable-line func-names
23814
  MailPoet.Modal.loading(false);
23815
- }).done(function () { // eslint-disable-line func-names
23816
  window.location = 'admin.php?page=mailpoet-newsletters';
23817
- }).fail(function (response) { // eslint-disable-line func-names
23818
  if (response.errors.length > 0) {
23819
  MailPoet.Notice.error(
23820
- response.errors.map(function (error) { // eslint-disable-line func-names
23821
  return error.message;
23822
  }),
23823
  { scroll: true }
@@ -24024,12 +24275,10 @@ webpackJsonp([0],{
24024
  complete: function (CSV) {
24025
  var email;
24026
  var emailAddress;
24027
- var column;
24028
- var rowCount;
24029
  var rowData;
24030
  var rowColumnCount;
24031
  var errorNotice;
24032
- for (rowCount in CSV.data) {
24033
  rowData = CSV.data[rowCount].map(function (el) {
24034
  return el.trim();
24035
  });
@@ -24047,7 +24296,7 @@ webpackJsonp([0],{
24047
  // determine position of email address inside an array; this is
24048
  // done once and then email regex is run just on that element for each row
24049
  if (emailColumnPosition === null) {
24050
- for (column in rowData) {
24051
  emailAddress = detectAndCleanupEmail(rowData[column]);
24052
  if (emailColumnPosition === null
24053
  && window.mailpoet_email_regex.test(emailAddress)) {
@@ -24057,32 +24306,29 @@ webpackJsonp([0],{
24057
  rowData[column] = emailAddress;
24058
  processedSubscribers[emailAddress] = rowData;
24059
  }
24060
- }
24061
  if (emailColumnPosition === null
24062
  && advancedOptionHeader
24063
- && parseInt(rowCount) === 0) {
24064
  isHeaderFound = true;
24065
  processedSubscribers[0] = rowData;
24066
  }
24067
- }
24068
- else if (rowData[emailColumnPosition] !== '') {
24069
  email = detectAndCleanupEmail(rowData[emailColumnPosition]);
24070
  if (_.has(parsedEmails, email)) {
24071
  duplicateEmails.push(email);
24072
- }
24073
- else if (!window.mailpoet_email_regex.test(email)) {
24074
  invalidEmails.push(rowData[emailColumnPosition]);
24075
- }
24076
- // if we haven't yet processed this e-mail and it passed
24077
- // the regex test, then process the row
24078
- else {
24079
  parsedEmails[email] = true;
24080
  rowData[emailColumnPosition] = email;
24081
  processedSubscribers[email] = rowData;
24082
  }
24083
  }
24084
  }
24085
- }
24086
  // reindex array to avoid non-numeric indices
24087
  processedSubscribers = _.values(processedSubscribers);
24088
  // if the header options is set, there should be at least
@@ -24111,8 +24357,7 @@ webpackJsonp([0],{
24111
  'MailPoet Free version': window.mailpoet_version
24112
  });
24113
  router.navigate('step2', { trigger: true });
24114
- }
24115
- else {
24116
  MailPoet.Modal.loading(false);
24117
  errorNotice = MailPoet.I18n.t('noValidRecords');
24118
  errorNotice = errorNotice.replace('[link]', MailPoet.I18n.t('csvKBLink'));
@@ -24128,8 +24373,7 @@ webpackJsonp([0],{
24128
  if (listSelectElement.data('select2')) {
24129
  listSelectElement.select2('data', data);
24130
  listSelectElement.trigger('change');
24131
- }
24132
- else {
24133
  listSelectElement
24134
  .select2({
24135
  data: data,
@@ -24144,8 +24388,7 @@ webpackJsonp([0],{
24144
  .change(function () {
24145
  if (jQuery(this).val() !== null) {
24146
  toggleNextStepButton(mailChimpProcessButtonElement, 'on');
24147
- }
24148
- else {
24149
  toggleNextStepButton(mailChimpProcessButtonElement, 'off');
24150
  }
24151
  })
@@ -24314,7 +24557,6 @@ webpackJsonp([0],{
24314
  var fillerPosition;
24315
  var importResults;
24316
  var duplicates;
24317
- var email;
24318
  if (typeof (window.importData.step1) === 'undefined') {
24319
  router.navigate('step1', { trigger: true });
24320
  return;
@@ -24361,14 +24603,13 @@ webpackJsonp([0],{
24361
  duplicates[subscriberEmail] = (duplicates[subscriberEmail] || 0) + 1;
24362
  });
24363
  subscribers.duplicate = [];
24364
- for (email in duplicates) {
24365
  if (duplicates[email] > 1) {
24366
  subscribers.duplicate.push(email + ' (x' + duplicates[email] + ')');
24367
- }
24368
- else {
24369
  subscribers.duplicate.push(email);
24370
  }
24371
- }
24372
 
24373
  importResults = {
24374
  notice: MailPoet.I18n.t('importNoticeSkipped').replace(
@@ -24404,8 +24645,7 @@ webpackJsonp([0],{
24404
  // show available segments
24405
  if (window.mailpoetSegments.length) {
24406
  jQuery('.mailpoet_segments').show();
24407
- }
24408
- else {
24409
  jQuery('.mailpoet_no_segments').show();
24410
  }
24411
 
@@ -24521,46 +24761,46 @@ webpackJsonp([0],{
24521
  function (helperSubscribers, options) {
24522
  var displayedColumns = [];
24523
  var displayedColumnsIds = [];
24524
- var i;
24525
  var columnData;
24526
  var columnId;
24527
  var headerName;
24528
  var headerNameMatch;
24529
  // go through all elements of the first row in subscribers data
24530
- for (i in helperSubscribers.subscribers[0]) {
24531
- columnData = helperSubscribers.subscribers[0][i];
24532
- columnId = 'ignore'; // set default column type
24533
- // if the column is not undefined and has a valid e-mail, set type as email
24534
- if (columnData % 1 !== 0 && window.mailpoet_email_regex.test(columnData)) {
24535
- columnId = 'email';
24536
- } else if (helperSubscribers.header) {
24537
- headerName = helperSubscribers.header[i];
24538
- headerNameMatch = window.mailpoetColumns.map(function (el) {
24539
- return el.name;
24540
- }).indexOf(headerName);
24541
- // set column type using header
24542
- if (headerNameMatch !== -1) {
24543
- columnId = window.mailpoetColumns[headerNameMatch].id;
24544
- }// set column type using header name
24545
- else if (headerName) {
24546
- if (/first|first name|given name/i.test(headerName)) {
24547
- columnId = 'first_name';
24548
- } else if (/last|last name/i.test(headerName)) {
24549
- columnId = 'last_name';
 
 
24550
  }
24551
  }
24552
- }
24553
- // make sure the column id has not been previously selected
24554
- // (e.g., subscriber_first_name shouldn't be autodetected twice),
24555
- // except for "ignore"
24556
- columnId =
24557
- (columnId !== 'ignore'
24558
- && displayedColumnsIds.indexOf(columnId) === -1)
24559
- ? columnId
24560
- : 'ignore';
24561
- displayedColumns[i] = { column_id: columnId };
24562
- displayedColumnsIds.push(columnId);
24563
- }
24564
  return options.fn(displayedColumns);
24565
  });
24566
 
@@ -24573,15 +24813,14 @@ webpackJsonp([0],{
24573
 
24574
  // start array index from 1
24575
  Handlebars.registerHelper('calculate_index', function (rawIndex) {
24576
- var index = parseInt(rawIndex);
24577
  // display filler data (e.g., ellipsis) if we've reached the maximum number of rows and
24578
  // subscribers count is greater than the maximum number of rows we're displaying
24579
  if (index === maxRowsToShow && subscribers.subscribersCount > (maxRowsToShow + 1)) {
24580
  fillerPosition = index;
24581
  return filler;
24582
- }
24583
  // if we're on the last line, show the total count of subscribers data
24584
- else if (index === (subscribers.subscribers.length - 1)) {
24585
  return subscribers.subscribersCount.toLocaleString();
24586
  }
24587
  return index + 1;
@@ -24621,7 +24860,6 @@ webpackJsonp([0],{
24621
  var firstRowData;
24622
  var validationRule;
24623
  var testedFormat;
24624
- var format;
24625
  var allowedDateFormats;
24626
  // check if the column id matches the selected id of one of the
24627
  // subscriber's data columns
@@ -24644,8 +24882,7 @@ webpackJsonp([0],{
24644
  id: 'invalidEmail'
24645
  });
24646
  }
24647
- }
24648
- else {
24649
  MailPoet.Notice.hide('invalidEmail');
24650
  }
24651
  }
@@ -24672,9 +24909,8 @@ webpackJsonp([0],{
24672
  + MailPoet.I18n.t('emptyFirstRowDate')
24673
  + '</span> ';
24674
  preventNextStep = true;
24675
- }
24676
- else {
24677
- for (format in allowedDateFormats) {
24678
  testedFormat = allowedDateFormats[format];
24679
  if (Moment(firstRowData, testedFormat, true).isValid()) {
24680
  validationRule = (typeof (testedFormat) === 'function') ?
@@ -24682,12 +24918,12 @@ webpackJsonp([0],{
24682
  testedFormat;
24683
  // set validation on the column element
24684
  jQuery(matchedColumn.element).data('validation-rule', validationRule);
24685
- break;
24686
  }
24687
  if (validationRule === 'datetime') {
24688
  validationRule = Moment.ISO_8601;
24689
  }
24690
- }
24691
  }
24692
  jQuery.map(subscribersClone.subscribers, function (dataSubscribers, index) {
24693
  var data = dataSubscribers;
@@ -24703,8 +24939,7 @@ webpackJsonp([0],{
24703
  + MailPoet.Date.format(date)
24704
  + '</span> '
24705
  );
24706
- }
24707
- else {
24708
  data[matchedColumn.index] = new Handlebars.SafeString(
24709
  Handlebars.Utils.escapeExpression(data[matchedColumn.index])
24710
  + '<span class="mailpoet_data_match mailpoet_import_error" title="'
@@ -24731,8 +24966,7 @@ webpackJsonp([0],{
24731
 
24732
  if (preventNextStep) {
24733
  toggleNextStepButton('off');
24734
- }
24735
- else if (!jQuery('.mailpoet_notice.error:visible').length
24736
  && segmentSelectElement.val()) {
24737
  toggleNextStepButton('on');
24738
  }
@@ -24822,9 +25056,8 @@ webpackJsonp([0],{
24822
  });
24823
  return false;
24824
  });
24825
- }
24826
  // CHANGE COLUMN
24827
- else {
24828
  // check for duplicate values in all select options
24829
  jQuery('select.mailpoet_subscribers_column_data_match')
24830
  .each(function () {
@@ -24834,10 +25067,9 @@ webpackJsonp([0],{
24834
  // prompt user
24835
  if (elementId === selectedOptionId
24836
  && elementId !== 'ignore') {
24837
- if (confirm(MailPoet.I18n.t('selectedValueAlreadyMatched') + ' ' + MailPoet.I18n.t('confirmCorrespondingColumn'))) {
24838
  jQuery(element).data('column-id', 'ignore');
24839
- }
24840
- else {
24841
  selectEvent.preventDefault();
24842
  jQuery(selectElement).select2('close');
24843
  }
@@ -24941,8 +25173,7 @@ webpackJsonp([0],{
24941
  ) {
24942
  MailPoet.Notice.error(_.flatten(clickImportResults.errors)
24943
  );
24944
- }
24945
- else {
24946
  window.mailpoetSegments = clickImportResults.segments;
24947
  clickImportResults.segments = _.map(segmentSelectElement.select2('data'),
24948
  function (data) {
@@ -25166,8 +25397,7 @@ webpackJsonp([0],{
25166
  var disabled = 'button-disabled';
25167
  if (condition === 'on') {
25168
  nextStepButton.removeClass(disabled);
25169
- }
25170
- else {
25171
  nextStepButton.addClass(disabled);
25172
  }
25173
  }
@@ -25188,12 +25418,12 @@ webpackJsonp([0],{
25188
  width: '20em',
25189
  templateResult: function templateResult(item) {
25190
  return (item.subscriberCount > 0)
25191
- ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
25192
  : item.name;
25193
  },
25194
  templateSelection: function templateSelection(item) {
25195
  return (item.subscriberCount > 0)
25196
- ? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
25197
  : item.name;
25198
  }
25199
  })
@@ -25227,8 +25457,7 @@ webpackJsonp([0],{
25227
  (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
25228
  ) {
25229
  toggleNextStepButton('on');
25230
- }
25231
- else {
25232
  toggleNextStepButton('off');
25233
  }
25234
  });
@@ -25265,7 +25494,7 @@ webpackJsonp([0],{
25265
  MailPoet.Modal.loading(false);
25266
  }).done(function done(response) {
25267
  var resultMessage = MailPoet.I18n.t('exportMessage')
25268
- .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
25269
  .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
25270
  .replace('[/link]', '</a>');
25271
  jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
455
  /***/ 293:
456
  /***/ function(module, exports, __webpack_require__) {
457
 
458
+ 'use strict';
459
 
460
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
 
462
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
463
 
464
+ var _react2 = _interopRequireDefault(_react);
 
 
 
465
 
466
+ var _reactRouter = __webpack_require__(181);
 
 
 
 
 
 
 
 
 
467
 
468
+ var _mailpoet = __webpack_require__(276);
 
 
 
 
 
 
 
 
 
469
 
470
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
 
 
471
 
472
+ var _formFormJsx = __webpack_require__(294);
 
 
 
 
 
 
473
 
474
+ var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
 
 
475
 
476
+ var _reactStringReplace = __webpack_require__(426);
477
+
478
+ var _reactStringReplace2 = _interopRequireDefault(_reactStringReplace);
479
+
480
+ var fields = [{
481
+ name: 'email',
482
+ label: _mailpoet2['default'].I18n.t('email'),
483
+ type: 'text',
484
+ disabled: function disabled(subscriber) {
485
+ return Number(subscriber.wp_user_id > 0);
486
+ }
487
+ }, {
488
+ name: 'first_name',
489
+ label: _mailpoet2['default'].I18n.t('firstname'),
490
+ type: 'text',
491
+ disabled: function disabled(subscriber) {
492
+ return Number(subscriber.wp_user_id > 0);
493
+ }
494
+ }, {
495
+ name: 'last_name',
496
+ label: _mailpoet2['default'].I18n.t('lastname'),
497
+ type: 'text',
498
+ disabled: function disabled(subscriber) {
499
+ return Number(subscriber.wp_user_id > 0);
500
+ }
501
+ }, {
502
+ name: 'status',
503
+ label: _mailpoet2['default'].I18n.t('status'),
504
+ type: 'select',
505
+ values: {
506
+ subscribed: _mailpoet2['default'].I18n.t('subscribed'),
507
+ unconfirmed: _mailpoet2['default'].I18n.t('unconfirmed'),
508
+ unsubscribed: _mailpoet2['default'].I18n.t('unsubscribed'),
509
+ bounced: _mailpoet2['default'].I18n.t('bounced')
510
+ },
511
+ filter: function filter(subscriber, value) {
512
+ if (Number(subscriber.wp_user_id) > 0 && value === 'unconfirmed') {
513
+ return false;
514
+ }
515
+ return true;
516
+ }
517
+ }, {
518
+ name: 'segments',
519
+ label: _mailpoet2['default'].I18n.t('lists'),
520
+ type: 'selection',
521
+ placeholder: _mailpoet2['default'].I18n.t('selectList'),
522
+ tip: _mailpoet2['default'].I18n.t('welcomeEmailTip'),
523
+ api_version: window.mailpoet_api_version,
524
+ endpoint: 'segments',
525
+ multiple: true,
526
+ selected: function selected(subscriber) {
527
+ if (Array.isArray(subscriber.subscriptions) === false) {
528
+ return null;
529
  }
530
 
531
+ return subscriber.subscriptions.filter(function (subscription) {
532
+ return subscription.status === 'subscribed';
533
+ }).map(function (subscription) {
534
+ return subscription.segment_id;
535
+ });
536
+ },
537
+ filter: function filter(segment) {
538
+ return !segment.deleted_at && segment.type === 'default';
539
+ },
540
+ getLabel: function getLabel(segment) {
541
+ return segment.name + ' (' + segment.subscribers + ')';
542
+ },
543
+ getSearchLabel: function getSearchLabel(segment, subscriber) {
544
+ var label = '';
545
 
546
+ if (subscriber.subscriptions !== undefined) {
547
+ subscriber.subscriptions.forEach(function (subscription) {
548
+ if (segment.id === subscription.segment_id) {
549
+ label = segment.name;
550
+
551
+ if (subscription.status === 'unsubscribed') {
552
+ var unsubscribedAt = _mailpoet2['default'].Date.format(subscription.updated_at);
553
+ label += ' (%$1s)'.replace('%$1s', _mailpoet2['default'].I18n.t('unsubscribedOn').replace('%$1s', unsubscribedAt));
554
+ }
555
+ }
556
  });
557
  }
558
+ return label;
559
+ }
560
+ }];
561
+
562
+ var customFields = window.mailpoet_custom_fields || [];
563
+ customFields.forEach(function (customField) {
564
+ var field = {
565
+ name: 'cf_' + customField.id,
566
+ label: customField.name,
567
+ type: customField.type
568
  };
569
+ if (customField.params) {
570
+ field.params = customField.params;
571
+ }
572
 
573
+ if (customField.params.values) {
574
+ field.values = customField.params.values;
575
+ }
576
+
577
+ // add placeholders for selects (date, select)
578
+ switch (customField.type) {
579
+ case 'date':
580
+ field.year_placeholder = _mailpoet2['default'].I18n.t('year');
581
+ field.month_placeholder = _mailpoet2['default'].I18n.t('month');
582
+ field.day_placeholder = _mailpoet2['default'].I18n.t('day');
583
+ break;
584
+
585
+ case 'select':
586
+ field.placeholder = '-';
587
+ break;
588
+
589
+ default:
590
+ field.placeholder = '';
591
+ break;
592
+ }
593
+
594
+ fields.push(field);
595
+ });
596
+
597
+ var messages = {
598
+ onUpdate: function onUpdate() {
599
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('subscriberUpdated'));
600
+ },
601
+ onCreate: function onCreate() {
602
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('subscriberAdded'));
603
+ _mailpoet2['default'].trackEvent('Subscribers > Add new', {
604
+ 'MailPoet Free version': window.mailpoet_version
605
+ });
606
  }
607
+ };
608
 
609
+ function beforeFormContent(subscriber) {
610
+ if (Number(subscriber.wp_user_id) > 0) {
611
+ return _react2['default'].createElement(
612
  'p',
613
  { className: 'description' },
614
+ (0, _reactStringReplace2['default'])(_mailpoet2['default'].I18n.t('WPUserEditNotice'), /\[link\](.*?)\[\/link\]/g, function (match, i) {
615
+ return _react2['default'].createElement(
616
+ 'a',
617
+ {
618
+ key: i,
619
+ href: 'user-edit.php?user_id=' + subscriber.wp_user_id
620
+ },
621
+ match
622
+ );
623
+ })
624
  );
625
  }
626
+ return undefined;
627
+ }
628
 
629
+ function afterFormContent() {
630
+ return _react2['default'].createElement(
631
+ 'p',
632
+ { className: 'description' },
633
+ _react2['default'].createElement(
634
+ 'strong',
635
+ null,
636
+ _mailpoet2['default'].I18n.t('tip')
637
+ ),
638
+ ' ',
639
+ _mailpoet2['default'].I18n.t('customFieldsTip')
640
+ );
641
+ }
642
 
643
+ var SubscriberForm = _react2['default'].createClass({
644
+ displayName: 'SubscriberForm',
645
 
646
+ render: function render() {
647
+ return _react2['default'].createElement(
648
+ 'div',
649
+ null,
650
+ _react2['default'].createElement(
651
+ 'h1',
652
+ { className: 'title' },
653
+ _mailpoet2['default'].I18n.t('subscriber'),
654
+ _react2['default'].createElement(
655
+ _reactRouter.Link,
656
+ { className: 'page-title-action', to: '/' },
657
+ _mailpoet2['default'].I18n.t('backToList')
658
+ )
659
+ ),
660
+ _react2['default'].createElement(_formFormJsx2['default'], {
661
+ endpoint: 'subscribers',
662
+ fields: fields,
663
+ params: this.props.params,
664
+ messages: messages,
665
+ beforeFormContent: beforeFormContent,
666
+ afterFormContent: afterFormContent
667
+ })
668
+ );
669
+ }
670
+ });
671
 
672
+ module.exports = SubscriberForm;
 
673
 
674
  /***/ },
675
 
714
 
715
  var _newslettersSendJsx2 = _interopRequireDefault(_newslettersSendJsx);
716
 
717
+ var _newslettersTypesStandardJsx = __webpack_require__(537);
718
 
719
  var _newslettersTypesStandardJsx2 = _interopRequireDefault(_newslettersTypesStandardJsx);
720
 
721
+ var _newslettersTypesNotificationNotificationJsx = __webpack_require__(538);
722
 
723
  var _newslettersTypesNotificationNotificationJsx2 = _interopRequireDefault(_newslettersTypesNotificationNotificationJsx);
724
 
813
 
814
  routes = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_before_router', [].concat(_toConsumableArray(routes), _toConsumableArray(getAutomaticEmailsRoutes())));
815
 
816
+ var mailpoetListing = _reactDom2['default'].render( // eslint-disable-line react/no-render-return-value
817
+ _react2['default'].createElement(
818
  _reactRouter.Router,
819
  { history: history },
820
  _react2['default'].createElement(
840
  /***/ },
841
 
842
  /***/ 435:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
843
  /***/ function(module, exports, __webpack_require__) {
844
 
845
  'use strict';
846
 
 
 
 
 
 
 
 
 
 
 
847
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
848
 
849
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
 
 
850
 
851
  var _react = __webpack_require__(2);
852
 
860
 
861
  var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
862
 
863
+ var _wpJsHooks = __webpack_require__(433);
 
 
 
 
864
 
865
+ var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
866
 
867
+ var _underscore = __webpack_require__(281);
868
 
869
+ var _underscore2 = _interopRequireDefault(_underscore);
870
 
871
+ __webpack_require__(181);
872
 
873
+ var NewsletterTypes = _react2['default'].createClass({
874
+ displayName: 'NewsletterTypes',
875
+
876
+ contextTypes: {
877
+ router: _react2['default'].PropTypes.object.isRequired
878
+ },
879
+ setupNewsletter: function setupNewsletter(type) {
880
+ if (type !== undefined) {
881
+ this.context.router.push('/new/' + type);
882
+ _mailpoet2['default'].trackEvent('Emails > Type selected', {
883
+ 'MailPoet Free version': window.mailpoet_version,
884
+ 'Email type': type
885
+ });
886
+ }
887
+ },
888
+ createNewsletter: function createNewsletter(type) {
889
+ var _this = this;
890
+
891
+ _mailpoet2['default'].trackEvent('Emails > Type selected', {
892
+ 'MailPoet Free version': window.mailpoet_version,
893
+ 'Email type': type
894
+ });
895
+ _mailpoet2['default'].Ajax.post({
896
+ api_version: window.mailpoet_api_version,
897
+ endpoint: 'newsletters',
898
+ action: 'create',
899
+ data: {
900
+ type: type,
901
+ subject: _mailpoet2['default'].I18n.t('draftNewsletterTitle')
902
+ }
903
+ }).done(function (response) {
904
+ _this.context.router.push('/template/' + response.data.id);
905
+ }).fail(function (response) {
906
+ if (response.errors.length > 0) {
907
+ _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
908
+ return error.message;
909
+ }), { scroll: true });
910
+ }
911
+ });
912
+ },
913
+ getAutomaticEmails: function getAutomaticEmails() {
914
+ var _this2 = this;
915
+
916
+ if (!window.mailpoet_automatic_emails) return [];
917
+
918
+ return _underscore2['default'].map(window.mailpoet_automatic_emails, function (automaticEmail) {
919
+ var email = automaticEmail;
920
+ var onClick = _underscore2['default'].partial(_this2.setupNewsletter, automaticEmail.slug);
921
+ email.action = (function () {
922
+ return _react2['default'].createElement(
923
+ 'div',
924
+ null,
925
+ _react2['default'].createElement(
926
+ 'a',
927
+ {
928
+ className: 'button button-primary',
929
+ onClick: onClick,
930
+ role: 'button',
931
+ tabIndex: 0
932
+ },
933
+ _mailpoet2['default'].I18n.t('setUp')
934
+ )
935
+ );
936
+ })();
937
+
938
+ return email;
939
+ });
940
+ },
941
+ render: function render() {
942
+ var createStandardNewsletter = _underscore2['default'].partial(this.createNewsletter, 'standard');
943
+ var createNotificationNewsletter = _underscore2['default'].partial(this.setupNewsletter, 'notification');
944
+ var defaultTypes = [{
945
+ slug: 'standard',
946
+ title: _mailpoet2['default'].I18n.t('regularNewsletterTypeTitle'),
947
+ description: _mailpoet2['default'].I18n.t('regularNewsletterTypeDescription'),
948
+ action: (function action() {
949
+ return _react2['default'].createElement(
950
+ 'a',
951
+ {
952
+ className: 'button button-primary',
953
+ 'data-automation-id': 'create_standard',
954
+ onClick: createStandardNewsletter,
955
+ role: 'button',
956
+ tabIndex: 0
957
+ },
958
+ _mailpoet2['default'].I18n.t('create')
959
+ );
960
+ })()
961
+ }, {
962
+ slug: 'welcome',
963
+ title: _mailpoet2['default'].I18n.t('welcomeNewsletterTypeTitle'),
964
+ description: _mailpoet2['default'].I18n.t('welcomeNewsletterTypeDescription'),
965
+ action: (function action() {
966
+ return _react2['default'].createElement(
967
+ 'div',
968
+ null,
969
+ _react2['default'].createElement(
970
+ 'a',
971
+ { href: '?page=mailpoet-premium', target: '_blank' },
972
+ _mailpoet2['default'].I18n.t('premiumFeatureLink')
973
+ )
974
+ );
975
+ })()
976
+ }, {
977
+ slug: 'notification',
978
+ title: _mailpoet2['default'].I18n.t('postNotificationNewsletterTypeTitle'),
979
+ description: _mailpoet2['default'].I18n.t('postNotificationNewsletterTypeDescription'),
980
+ action: (function action() {
981
+ return _react2['default'].createElement(
982
+ 'a',
983
+ {
984
+ className: 'button button-primary',
985
+ 'data-automation-id': 'create_notification',
986
+ onClick: createNotificationNewsletter,
987
+ role: 'button',
988
+ tabIndex: 0
989
+ },
990
+ _mailpoet2['default'].I18n.t('setUp')
991
+ );
992
+ })()
993
+ }];
994
+
995
+ var types = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_types', [].concat(defaultTypes, _toConsumableArray(this.getAutomaticEmails())), this);
996
+
997
+ return _react2['default'].createElement(
998
+ 'div',
999
+ null,
1000
+ _react2['default'].createElement(
1001
+ 'h1',
1002
+ null,
1003
+ _mailpoet2['default'].I18n.t('pickCampaignType')
1004
+ ),
1005
+ _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' }),
1006
+ _react2['default'].createElement(
1007
+ 'ul',
1008
+ { className: 'mailpoet_boxes clearfix' },
1009
+ types.map(function (type) {
1010
+ return _react2['default'].createElement(
1011
+ 'li',
1012
+ { key: type.slug, 'data-type': type.slug },
1013
+ _react2['default'].createElement(
1014
+ 'div',
1015
+ null,
1016
+ _react2['default'].createElement(
1017
+ 'div',
1018
+ { className: 'mailpoet_thumbnail' },
1019
+ type.thumbnailImage ? _react2['default'].createElement('img', { src: type.thumbnailImage, alt: '' }) : null
1020
+ ),
1021
+ _react2['default'].createElement(
1022
+ 'div',
1023
+ { className: 'mailpoet_description' },
1024
+ _react2['default'].createElement(
1025
+ 'h3',
1026
+ null,
1027
+ type.title
1028
+ ),
1029
+ _react2['default'].createElement(
1030
+ 'p',
1031
+ null,
1032
+ type.description
1033
+ )
1034
+ ),
1035
+ _react2['default'].createElement(
1036
+ 'div',
1037
+ { className: 'mailpoet_actions' },
1038
+ type.action
1039
+ )
1040
+ )
1041
+ );
1042
+ }, this)
1043
+ )
1044
+ );
1045
+ }
1046
+ });
1047
+
1048
+ module.exports = NewsletterTypes;
1049
+
1050
+ /***/ },
1051
+
1052
+ /***/ 438:
1053
+ /***/ function(module, exports, __webpack_require__) {
1054
+
1055
+ 'use strict';
1056
+
1057
+ Object.defineProperty(exports, '__esModule', {
1058
+ value: true
1059
+ });
1060
+
1061
+ 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; };
1062
+
1063
+ var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1064
+
1065
+ var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
1066
+
1067
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1068
+
1069
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
1070
+
1071
+ function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1072
+
1073
+ var _react = __webpack_require__(2);
1074
+
1075
+ var _react2 = _interopRequireDefault(_react);
1076
+
1077
+ var _mailpoet = __webpack_require__(276);
1078
+
1079
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
1080
+
1081
+ var _newslettersBreadcrumbJsx = __webpack_require__(436);
1082
+
1083
+ var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
1084
+
1085
+ var _commonLoadingJsx = __webpack_require__(439);
1086
+
1087
+ var _commonLoadingJsx2 = _interopRequireDefault(_commonLoadingJsx);
1088
+
1089
+ var _newslettersTemplatesTabsJsx = __webpack_require__(440);
1090
+
1091
+ var _newslettersTemplatesTabsJsx2 = _interopRequireDefault(_newslettersTemplatesTabsJsx);
1092
+
1093
+ var _newslettersTemplatesTemplate_boxJsx = __webpack_require__(441);
1094
+
1095
+ var _newslettersTemplatesTemplate_boxJsx2 = _interopRequireDefault(_newslettersTemplatesTemplate_boxJsx);
1096
+
1097
+ var _newslettersTemplatesImport_templateJsx = __webpack_require__(443);
1098
+
1099
+ var _newslettersTemplatesImport_templateJsx2 = _interopRequireDefault(_newslettersTemplatesImport_templateJsx);
1100
 
1101
  var _wpJsHooks = __webpack_require__(433);
1102
 
1106
 
1107
  var _underscore2 = _interopRequireDefault(_underscore);
1108
 
1109
+ var _propTypes = __webpack_require__(185);
1110
+
1111
+ var _propTypes2 = _interopRequireDefault(_propTypes);
1112
+
1113
  var getEditorUrl = function getEditorUrl(id) {
1114
  return 'admin.php?page=mailpoet-newsletter-editor&id=' + id;
1115
  };
1341
  } else {
1342
  templates = templates.map(function (template, index) {
1343
  return _react2['default'].createElement(_newslettersTemplatesTemplate_boxJsx2['default'], _extends({
1344
+ key: template.id,
1345
  index: index,
1346
  newsletterId: _this6.props.params.id,
1347
  beforeDelete: function () {
1388
  return NewsletterTemplates;
1389
  })(_react2['default'].Component);
1390
 
1391
+ NewsletterTemplates.propTypes = {
1392
+ params: _propTypes2['default'].shape({
1393
+ id: _propTypes2['default'].string.isRequired
1394
+ }).isRequired
1395
+ };
1396
+
1397
  exports['default'] = NewsletterTemplates;
1398
  module.exports = exports['default'];
1399
 
1463
  /***/ 440:
1464
  /***/ function(module, exports, __webpack_require__) {
1465
 
1466
+ 'use strict';
1467
 
1468
+ Object.defineProperty(exports, '__esModule', {
1469
  value: true
1470
  });
1471
 
1472
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1473
 
1474
  var _react = __webpack_require__(2);
1475
 
1476
  var _react2 = _interopRequireDefault(_react);
1477
 
1478
+ var _propTypes = __webpack_require__(185);
1479
+
1480
+ var _propTypes2 = _interopRequireDefault(_propTypes);
1481
+
1482
  var Tabs = function Tabs(_ref) {
1483
  var tabs = _ref.tabs;
1484
  var selected = _ref.selected;
1485
  var select = _ref.select;
1486
+ return _react2['default'].createElement(
1487
+ 'div',
1488
+ { className: 'wp-filter hide-if-no-js' },
1489
+ _react2['default'].createElement(
1490
+ 'ul',
1491
+ { className: 'filter-links' },
1492
  tabs.map(function (_ref2) {
1493
  var name = _ref2.name;
1494
  var label = _ref2.label;
1495
+ return _react2['default'].createElement(
1496
+ 'li',
1497
  { key: name },
1498
+ _react2['default'].createElement(
1499
+ 'a',
1500
  {
1501
+ href: 'javascript:',
1502
  className: selected === name ? 'current' : '',
1503
  onClick: function () {
1504
  return select(name);
1505
  }
1506
  },
1507
+ ' ',
1508
  label
1509
  )
1510
  );
1513
  );
1514
  };
1515
 
1516
+ Tabs.propTypes = {
1517
+ selected: _propTypes2['default'].string.isRequired,
1518
+ select: _propTypes2['default'].func.isRequired,
1519
+ tabs: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
1520
+ label: _propTypes2['default'].string.isRequired,
1521
+ name: _propTypes2['default'].string.isRequired
1522
+ }).isRequired).isRequired
1523
+ };
1524
+
1525
+ exports['default'] = Tabs;
1526
+ module.exports = exports['default'];
1527
 
1528
  /***/ },
1529
 
1560
 
1561
  var _reactConfirmAlert = __webpack_require__(442);
1562
 
1563
+ var _propTypes = __webpack_require__(185);
1564
+
1565
+ var _propTypes2 = _interopRequireDefault(_propTypes);
1566
+
1567
  /**
1568
  * props = {
1569
  * index, id, newsletterId, name, description, thumbnail, readonly,
1759
  return TemplateBox;
1760
  })(_react2['default'].Component);
1761
 
1762
+ TemplateBox.propTypes = {
1763
+ index: _propTypes2['default'].number.isRequired,
1764
+ id: _propTypes2['default'].string.isRequired,
1765
+ newsletterId: _propTypes2['default'].string.isRequired,
1766
+ name: _propTypes2['default'].string.isRequired,
1767
+ description: _propTypes2['default'].string.isRequired,
1768
+ thumbnail: _propTypes2['default'].string.isRequired,
1769
+ readonly: _propTypes2['default'].string.isRequired,
1770
+ beforeDelete: _propTypes2['default'].func.isRequired,
1771
+ afterDelete: _propTypes2['default'].func.isRequired,
1772
+ beforeSelect: _propTypes2['default'].func.isRequired,
1773
+ afterSelect: _propTypes2['default'].func.isRequired,
1774
+ body: _propTypes2['default'].object.isRequired };
1775
+
1776
+ // eslint-disable-line react/forbid-prop-types
1777
  exports['default'] = TemplateBox;
1778
  module.exports = exports['default'];
1779
 
1991
 
1992
  var _helpTooltipJsx2 = _interopRequireDefault(_helpTooltipJsx);
1993
 
1994
+ var _propTypes = __webpack_require__(185);
1995
+
1996
+ var _propTypes2 = _interopRequireDefault(_propTypes);
1997
 
1998
  var ImportTemplate = (function (_React$Component) {
1999
  _inherits(ImportTemplate, _React$Component);
2124
  return ImportTemplate;
2125
  })(_react2['default'].Component);
2126
 
2127
+ ImportTemplate.propTypes = {
2128
+ beforeImport: _propTypes2['default'].func.isRequired,
2129
+ afterImport: _propTypes2['default'].func.isRequired
2130
+ };
2131
+
2132
  exports['default'] = ImportTemplate;
2133
  module.exports = exports['default'];
2134
 
10942
  /***/ 526:
10943
  /***/ function(module, exports, __webpack_require__) {
10944
 
10945
+ 'use strict';
10946
 
10947
  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; };
10948
 
10949
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
10950
 
10951
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10952
 
10953
+ var _react2 = _interopRequireDefault(_react);
10954
 
10955
+ var _mailpoet = __webpack_require__(276);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10956
 
10957
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10958
 
10959
+ var _underscore = __webpack_require__(281);
10960
 
10961
+ var _underscore2 = _interopRequireDefault(_underscore);
 
 
10962
 
10963
+ var _newslettersBreadcrumbJsx = __webpack_require__(436);
10964
 
10965
+ var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10966
 
10967
+ var _formFormJsx = __webpack_require__(294);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10968
 
10969
+ var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10970
 
10971
+ var _newslettersSendStandardJsx = __webpack_require__(527);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10972
 
10973
+ var _newslettersSendStandardJsx2 = _interopRequireDefault(_newslettersSendStandardJsx);
10974
 
10975
+ var _newslettersSendNotificationJsx = __webpack_require__(528);
 
 
 
 
 
 
 
 
10976
 
10977
+ var _newslettersSendNotificationJsx2 = _interopRequireDefault(_newslettersSendNotificationJsx);
10978
+
10979
+ var _newslettersSendWelcomeJsx = __webpack_require__(533);
10980
+
10981
+ var _newslettersSendWelcomeJsx2 = _interopRequireDefault(_newslettersSendWelcomeJsx);
10982
+
10983
+ var _helpTooltipJsx = __webpack_require__(444);
10984
+
10985
+ var _helpTooltipJsx2 = _interopRequireDefault(_helpTooltipJsx);
10986
+
10987
+ var _jquery = __webpack_require__(275);
10988
+
10989
+ var _jquery2 = _interopRequireDefault(_jquery);
10990
+
10991
+ var _commonThumbnailJsx = __webpack_require__(534);
10992
+
10993
+ var _wpJsHooks = __webpack_require__(433);
10994
+
10995
+ var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
10996
+
10997
+ var NewsletterSend = _react2['default'].createClass({
10998
+ displayName: 'NewsletterSend',
10999
+
11000
+ contextTypes: {
11001
+ router: _react2['default'].PropTypes.object.isRequired
11002
+ },
11003
+ getInitialState: function getInitialState() {
11004
+ return {
11005
+ fields: [],
11006
+ item: {},
11007
+ loading: true
11008
+ };
11009
+ },
11010
+ getFieldsByNewsletter: function getFieldsByNewsletter(newsletter) {
11011
+ var type = this.getSubtype(newsletter);
11012
+ return type.getFields(newsletter);
11013
+ },
11014
+ getSendButtonOptions: function getSendButtonOptions() {
11015
+ var type = this.getSubtype(this.state.item);
11016
+ return type.getSendButtonOptions(this.state.item);
11017
+ },
11018
+ getSubtype: function getSubtype(newsletter) {
11019
+ switch (newsletter.type) {
11020
+ case 'notification':
11021
+ return _newslettersSendNotificationJsx2['default'];
11022
+ case 'welcome':
11023
+ return _newslettersSendWelcomeJsx2['default'];
11024
+ default:
11025
+ return _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_newsletter_fields', _newslettersSendStandardJsx2['default'], newsletter);
11026
+ }
11027
+ },
11028
+ isValid: function isValid() {
11029
+ return (0, _jquery2['default'])('#mailpoet_newsletter').parsley().isValid();
11030
+ },
11031
+ componentDidMount: function componentDidMount() {
11032
+ this.loadItem(this.props.params.id);
11033
+ (0, _jquery2['default'])('#mailpoet_newsletter').parsley();
11034
+ },
11035
+ componentWillReceiveProps: function componentWillReceiveProps(props) {
11036
+ this.loadItem(props.params.id);
11037
+ },
11038
+ loadItem: function loadItem(id) {
11039
+ var _this = this;
11040
 
11041
+ this.setState({ loading: true });
11042
+
11043
+ _mailpoet2['default'].Ajax.post({
11044
+ api_version: window.mailpoet_api_version,
11045
+ endpoint: 'newsletters',
11046
+ action: 'get',
11047
+ data: {
11048
+ id: id
11049
+ }
11050
+ }).done(function (response) {
11051
+ _this.setState({
11052
+ loading: false,
11053
+ item: response.data,
11054
+ fields: _this.getFieldsByNewsletter(response.data)
11055
+ });
11056
+ }).fail(function () {
11057
+ _this.setState({
11058
+ loading: false,
11059
+ item: {}
11060
+ }, function () {
11061
+ _this.context.router.push('/new');
11062
+ });
11063
+ });
11064
+ },
11065
+ saveTemplate: function saveTemplate(response, done) {
11066
+ var _this3 = this;
11067
 
11068
+ (0, _commonThumbnailJsx.fromUrl)(response.meta.preview_url).then(function saveTemplateAjax(thumbnail) {
11069
+ var _this2 = this;
 
11070
 
11071
+ _mailpoet2['default'].Ajax.post({
11072
  api_version: window.mailpoet_api_version,
11073
+ endpoint: 'newsletterTemplates',
11074
  action: 'save',
11075
+ data: {
11076
+ newsletter_id: response.data.id,
11077
+ name: response.data.subject,
11078
+ description: response.data.preheader,
11079
+ thumbnail: thumbnail,
11080
+ body: JSON.stringify(response.data.body),
11081
+ categories: '["recent"]'
11082
+ }
11083
+ }).then(done).fail(function (err) {
11084
+ _this2.showError(err);
11085
  });
11086
+ })['catch'](function (err) {
11087
+ _this3.showError({ errors: [err] });
11088
+ });
11089
+ },
11090
+ handleSend: function handleSend(e) {
11091
+ var _this4 = this;
 
 
 
 
 
11092
 
11093
+ e.preventDefault();
11094
 
11095
+ if (!this.isValid()) {
11096
+ return (0, _jquery2['default'])('#mailpoet_newsletter').parsley().validate();
11097
+ }
11098
+
11099
+ _mailpoet2['default'].Modal.loading(true);
11100
+
11101
+ return this.saveNewsletter(e).done(function () {
11102
+ _this4.setState({ loading: true });
11103
+ }).done(function (response) {
11104
+ switch (response.data.type) {
11105
+ case 'notification':
11106
+ case 'welcome':
11107
+ return _this4.activateNewsletter(response);
11108
+ default:
11109
+ return _this4.sendNewsletter(response);
11110
+ }
11111
+ }).fail(function (err) {
11112
+ _this4.showError(err);
11113
+ _this4.setState({ loading: false });
11114
+ _mailpoet2['default'].Modal.loading(false);
11115
+ });
11116
+ },
11117
+ sendNewsletter: function sendNewsletter(newsletter) {
11118
+ var _this5 = this;
11119
+
11120
+ return _mailpoet2['default'].Ajax.post(_wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_parameters', {
11121
+ api_version: window.mailpoet_api_version,
11122
+ endpoint: 'sendingQueue',
11123
+ action: 'add',
11124
+ data: {
11125
+ newsletter_id: this.state.item.id
11126
+ }
11127
+ }, this.state.item)).done(function (response) {
11128
+ // save template in recently sent category
11129
+ _this5.saveTemplate(newsletter, function () {
11130
+ // redirect to listing based on newsletter type
11131
+ _this5.context.router.push(_wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_response_redirect', '/' + (_this5.state.item.type || ''), _this5.state.item));
11132
+ var customResponse = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_response', _this5.state.item, response);
11133
+ if (_underscore2['default'].isFunction(customResponse)) {
11134
+ customResponse();
11135
+ } else if (response.data.status === 'scheduled') {
11136
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterHasBeenScheduled'));
11137
+ _mailpoet2['default'].trackEvent('Emails > Newsletter sent', {
11138
+ scheduled: true,
11139
+ 'MailPoet Free version': window.mailpoet_version
11140
+ });
11141
+ } else {
11142
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterBeingSent'));
11143
+ _mailpoet2['default'].trackEvent('Emails > Newsletter sent', {
11144
+ scheduled: false,
11145
+ 'MailPoet Free version': window.mailpoet_version
11146
+ });
11147
+ }
11148
+ _mailpoet2['default'].Modal.loading(false);
11149
  });
11150
+ }).fail(function (err) {
11151
+ _this5.showError(err);
11152
+ _this5.setState({ loading: false });
11153
+ _mailpoet2['default'].Modal.loading(false);
11154
+ });
11155
+ },
11156
+ activateNewsletter: function activateEmail(newsletter) {
11157
+ var _this6 = this;
11158
+
11159
+ return _mailpoet2['default'].Ajax.post({
11160
+ api_version: window.mailpoet_api_version,
11161
+ endpoint: 'newsletters',
11162
+ action: 'setStatus',
11163
+ data: {
11164
+ id: this.props.params.id,
11165
+ status: 'active'
11166
+ }
11167
+ }).done(function (response) {
11168
+ // save template in recently sent category
11169
+ _this6.saveTemplate(newsletter, function () {
11170
+ // redirect to listing based on newsletter type
11171
+ _this6.context.router.push('/' + (_this6.state.item.type || ''));
11172
+ var opts = _this6.state.item.options;
11173
+ // display success message depending on newsletter type
11174
+ if (response.data.type === 'welcome') {
11175
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('welcomeEmailActivated'));
11176
+ _mailpoet2['default'].trackEvent('Emails > Welcome email activated', {
11177
+ 'MailPoet Free version': window.mailpoet_version,
11178
+ 'List type': opts.event,
11179
+ Delay: opts.afterTimeNumber + ' ' + opts.afterTimeType
11180
+ });
11181
+ } else if (response.data.type === 'notification') {
11182
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('postNotificationActivated'));
11183
+ _mailpoet2['default'].trackEvent('Emails > Post notifications activated', {
11184
+ 'MailPoet Free version': window.mailpoet_version,
11185
+ Frequency: opts.intervalType
11186
+ });
11187
  }
11188
+ _mailpoet2['default'].Modal.loading(false);
11189
  });
11190
+ }).fail(function (err) {
11191
+ _this6.showError(err);
11192
+ _this6.setState({ loading: false });
11193
+ _mailpoet2['default'].Modal.loading(false);
11194
+ });
11195
+ },
11196
+ handleResume: function handleResume(e) {
11197
+ var _this7 = this;
11198
 
11199
+ e.preventDefault();
11200
+ if (!this.isValid()) {
11201
+ (0, _jquery2['default'])('#mailpoet_newsletter').parsley().validate();
11202
+ } else {
11203
+ this.saveNewsletter(e).done(function () {
11204
+ _this7.setState({ loading: true });
11205
+ }).done(function () {
11206
+ _mailpoet2['default'].Ajax.post({
11207
+ api_version: window.mailpoet_api_version,
11208
+ endpoint: 'sendingQueue',
11209
+ action: 'resume',
11210
+ data: {
11211
+ newsletter_id: _this7.state.item.id
11212
+ }
11213
+ }).done(function () {
11214
+ _this7.context.router.push('/' + (_this7.state.item.type || ''));
11215
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterSendingHasBeenResumed'));
11216
+ }).fail(function (response) {
11217
+ if (response.errors.length > 0) {
11218
+ _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
11219
+ return error.message;
11220
+ }), { scroll: true });
11221
+ }
11222
+ });
11223
+ }).fail(function (err) {
11224
+ _this7.showError(err);
11225
+ }).always(function () {
11226
+ _this7.setState({ loading: false });
11227
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11228
  }
11229
+ return false;
11230
+ },
11231
+ handleSave: function handleSave(e) {
11232
+ var _this8 = this;
11233
 
11234
+ e.preventDefault();
 
11235
 
11236
+ this.saveNewsletter(e).done(function () {
11237
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterUpdated'));
11238
+ }).done(function () {
11239
+ _this8.context.router.push('/' + (_this8.state.item.type || ''));
11240
+ }).fail(function (err) {
11241
+ _this8.showError(err);
11242
+ });
11243
+ },
11244
+ handleRedirectToDesign: function handleRedirectToDesign(e) {
11245
+ var _this9 = this;
11246
 
11247
+ e.preventDefault();
11248
+ var redirectTo = e.target.href;
11249
 
11250
+ this.saveNewsletter(e).done(function () {
11251
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterUpdated'));
11252
+ }).done(function () {
11253
+ window.location = redirectTo;
11254
+ }).fail(function (err) {
11255
+ _this9.showError(err);
11256
+ });
11257
+ },
11258
+ saveNewsletter: function saveNewsletter() {
11259
+ var _this10 = this;
11260
 
11261
+ var data = this.state.item;
11262
+ data.queue = undefined;
11263
+ this.setState({ loading: true });
11264
+
11265
+ // Store only properties that can be changed on this page
11266
+ var IGNORED_NEWSLETTER_PROPERTIES = ['preheader', 'body', 'created_at', 'deleted_at', 'hash', 'status', 'updated_at', 'type'];
11267
+ var newsletterData = _underscore2['default'].omit(data, IGNORED_NEWSLETTER_PROPERTIES);
11268
+
11269
+ return _mailpoet2['default'].Ajax.post({
11270
+ api_version: window.mailpoet_api_version,
11271
+ endpoint: 'newsletters',
11272
+ action: 'save',
11273
+ data: newsletterData
11274
+ }).always(function () {
11275
+ _this10.setState({ loading: false });
11276
+ });
11277
+ },
11278
+ showError: function showError(response) {
11279
+ if (response.errors.length > 0) {
11280
+ _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
11281
+ return error.message;
11282
+ }), { scroll: true });
11283
  }
11284
+ },
11285
+ handleFormChange: function handleFormChange(e) {
11286
+ var item = this.state.item;
11287
+ var field = e.target.name;
11288
+
11289
+ item[field] = e.target.value;
11290
+
11291
+ this.setState({
11292
+ item: item
11293
+ });
11294
+ return true;
11295
+ },
11296
+ render: function render() {
11297
+ var isPaused = this.state.item.status === 'sending' && this.state.item.queue && this.state.item.queue.status === 'paused';
11298
+ var fields = this.state.fields.map(function (field) {
11299
+ var newField = field;
11300
+ if (field.name === 'segments' || field.name === 'options') {
11301
+ newField.disabled = isPaused;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11302
  }
11303
+ return newField;
11304
+ });
11305
+ var sendButtonOptions = this.getSendButtonOptions();
11306
+ var breadcrumb = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_breadcrumb', _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'send' }), this.state.item.type, 'send');
11307
 
11308
+ return _react2['default'].createElement(
11309
+ 'div',
11310
+ null,
11311
+ _react2['default'].createElement(
11312
+ 'h1',
11313
+ null,
11314
+ _mailpoet2['default'].I18n.t('finalNewsletterStep')
11315
+ ),
11316
+ breadcrumb,
11317
+ _react2['default'].createElement(
11318
+ _formFormJsx2['default'],
11319
+ {
11320
+ id: 'mailpoet_newsletter',
11321
+ fields: fields,
11322
+ item: this.state.item,
11323
+ loading: this.state.loading,
11324
+ onChange: this.handleFormChange,
11325
+ onSubmit: this.handleSave
11326
+ },
11327
+ _react2['default'].createElement(
11328
+ 'p',
11329
+ { className: 'submit' },
11330
+ isPaused ? _react2['default'].createElement('input', {
11331
+ className: 'button button-primary',
11332
+ type: 'button',
11333
+ onClick: this.handleResume,
11334
+ value: _mailpoet2['default'].I18n.t('resume')
11335
+ }) : _react2['default'].createElement('input', _extends({
11336
+ className: 'button button-primary',
11337
+ type: 'button',
11338
+ onClick: this.handleSend,
11339
+ value: _mailpoet2['default'].I18n.t('send')
11340
+ }, sendButtonOptions)),
11341
+ ' ',
11342
+ _react2['default'].createElement('input', {
11343
+ className: 'button button-secondary',
11344
+ type: 'submit',
11345
+ value: _mailpoet2['default'].I18n.t('saveDraftAndClose')
11346
+ }),
11347
+ ' ',
11348
+ _mailpoet2['default'].I18n.t('orSimply'),
11349
+ ' ',
11350
+ _react2['default'].createElement(
11351
+ 'a',
11352
+ {
11353
+ href: '?page=mailpoet-newsletter-editor&id=' + this.props.params.id,
11354
+ onClick: this.handleRedirectToDesign
11355
+ },
11356
+ _mailpoet2['default'].I18n.t('goBackToDesign')
11357
+ ),
11358
+ '.'
11359
+ ),
11360
+ !isPaused && sendButtonOptions.disabled && sendButtonOptions.disabled === 'disabled' && _react2['default'].createElement(_helpTooltipJsx2['default'], {
11361
+ tooltip: _mailpoet2['default'].I18n.t('helpTooltipSendEmail'),
11362
+ tooltipId: 'helpTooltipSendEmail'
11363
+ })
11364
+ )
11365
+ );
11366
+ }
11367
+ });
11368
 
11369
+ module.exports = NewsletterSend;
 
 
 
 
 
 
 
 
 
 
11370
 
11371
  /***/ },
11372
 
11373
+ /***/ 527:
11374
  /***/ function(module, exports, __webpack_require__) {
11375
 
11376
+ 'use strict';
11377
 
11378
  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'); } }; })();
11379
 
11380
  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; };
11381
 
11382
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11383
 
11384
+ var _react = __webpack_require__(2);
 
11385
 
11386
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
11387
 
11388
+ var _jquery = __webpack_require__(275);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11389
 
11390
+ var _jquery2 = _interopRequireDefault(_jquery);
 
 
 
 
 
 
 
 
 
 
 
11391
 
11392
+ var _underscore = __webpack_require__(281);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11393
 
11394
+ var _underscore2 = _interopRequireDefault(_underscore);
11395
+
11396
+ var _mailpoet = __webpack_require__(276);
11397
+
11398
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
11399
+
11400
+ var _wpJsHooks = __webpack_require__(433);
11401
+
11402
+ var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
11403
+
11404
+ var currentTime = window.mailpoet_current_time || '00:00';
11405
+ var defaultDateTime = window.mailpoet_current_date + ' 00:00:00';
11406
+ var timeOfDayItems = window.mailpoet_schedule_time_of_day;
11407
+ var dateDisplayFormat = window.mailpoet_date_display_format;
11408
+ var dateStorageFormat = window.mailpoet_date_storage_format;
11409
+
11410
+ var datepickerTranslations = {
11411
+ closeText: _mailpoet2['default'].I18n.t('close'),
11412
+ currentText: _mailpoet2['default'].I18n.t('today'),
11413
+ nextText: _mailpoet2['default'].I18n.t('next'),
11414
+ prevText: _mailpoet2['default'].I18n.t('previous'),
11415
+ monthNames: [_mailpoet2['default'].I18n.t('january'), _mailpoet2['default'].I18n.t('february'), _mailpoet2['default'].I18n.t('march'), _mailpoet2['default'].I18n.t('april'), _mailpoet2['default'].I18n.t('may'), _mailpoet2['default'].I18n.t('june'), _mailpoet2['default'].I18n.t('july'), _mailpoet2['default'].I18n.t('august'), _mailpoet2['default'].I18n.t('september'), _mailpoet2['default'].I18n.t('october'), _mailpoet2['default'].I18n.t('november'), _mailpoet2['default'].I18n.t('december')],
11416
+ monthNamesShort: [_mailpoet2['default'].I18n.t('januaryShort'), _mailpoet2['default'].I18n.t('februaryShort'), _mailpoet2['default'].I18n.t('marchShort'), _mailpoet2['default'].I18n.t('aprilShort'), _mailpoet2['default'].I18n.t('mayShort'), _mailpoet2['default'].I18n.t('juneShort'), _mailpoet2['default'].I18n.t('julyShort'), _mailpoet2['default'].I18n.t('augustShort'), _mailpoet2['default'].I18n.t('septemberShort'), _mailpoet2['default'].I18n.t('octoberShort'), _mailpoet2['default'].I18n.t('novemberShort'), _mailpoet2['default'].I18n.t('decemberShort')],
11417
+ dayNames: [_mailpoet2['default'].I18n.t('sunday'), _mailpoet2['default'].I18n.t('monday'), _mailpoet2['default'].I18n.t('tuesday'), _mailpoet2['default'].I18n.t('wednesday'), _mailpoet2['default'].I18n.t('thursday'), _mailpoet2['default'].I18n.t('friday'), _mailpoet2['default'].I18n.t('saturday')],
11418
+ dayNamesShort: [_mailpoet2['default'].I18n.t('sundayShort'), _mailpoet2['default'].I18n.t('mondayShort'), _mailpoet2['default'].I18n.t('tuesdayShort'), _mailpoet2['default'].I18n.t('wednesdayShort'), _mailpoet2['default'].I18n.t('thursdayShort'), _mailpoet2['default'].I18n.t('fridayShort'), _mailpoet2['default'].I18n.t('saturdayShort')],
11419
+ dayNamesMin: [_mailpoet2['default'].I18n.t('sundayMin'), _mailpoet2['default'].I18n.t('mondayMin'), _mailpoet2['default'].I18n.t('tuesdayMin'), _mailpoet2['default'].I18n.t('wednesdayMin'), _mailpoet2['default'].I18n.t('thursdayMin'), _mailpoet2['default'].I18n.t('fridayMin'), _mailpoet2['default'].I18n.t('saturdayMin')]
11420
+ };
11421
+
11422
+ var DateText = _react2['default'].createClass({
11423
+ displayName: 'DateText',
11424
+
11425
+ onChange: function onChange(event) {
11426
+ var changeEvent = event;
11427
+ // Swap display format to storage format
11428
+ var displayDate = changeEvent.target.value;
11429
+ var storageDate = this.getStorageDate(displayDate);
11430
+
11431
+ changeEvent.target.value = storageDate;
11432
+ this.props.onChange(changeEvent);
11433
+ },
11434
+ componentDidMount: function componentDidMount() {
11435
+ var $element = (0, _jquery2['default'])(this.dateInput);
11436
+ var that = this;
11437
+ if ($element.datepicker) {
11438
+ // Override jQuery UI datepicker Date parsing and formatting
11439
+ _jquery2['default'].datepicker.parseDate = function parseDate(format, value) {
11440
+ // Transform string format to Date object
11441
+ return _mailpoet2['default'].Date.toDate(value, {
11442
+ parseFormat: dateDisplayFormat,
11443
+ format: format
11444
+ });
11445
+ };
11446
+ _jquery2['default'].datepicker.formatDate = function formatDate(format, value) {
11447
+ // Transform Date object to string format
11448
+ var newValue = _mailpoet2['default'].Date.format(value, {
11449
+ format: format
11450
+ });
11451
+ return newValue;
11452
+ };
11453
+
11454
+ $element.datepicker(_underscore2['default'].extend({
11455
+ dateFormat: this.props.displayFormat,
11456
+ isRTL: false,
11457
+ onSelect: function onSelect(value) {
11458
+ that.onChange({
11459
+ target: {
11460
+ name: that.getFieldName(),
11461
+ value: value
11462
+ }
11463
+ });
11464
  }
11465
+ }, datepickerTranslations));
11466
+
11467
+ this.datepickerInitialized = true;
11468
  }
11469
+ },
11470
+ componentWillUnmount: function componentWillUnmount() {
11471
+ if (this.datepickerInitialized) {
11472
+ (0, _jquery2['default'])(this.dateInput).datepicker('destroy');
11473
+ }
11474
+ },
11475
+ getFieldName: function getFieldName() {
11476
+ return this.props.name || 'date';
11477
+ },
11478
+ getDisplayDate: function getDisplayDate(date) {
11479
+ return _mailpoet2['default'].Date.format(date, {
11480
+ parseFormat: this.props.storageFormat,
11481
+ format: this.props.displayFormat
11482
+ });
11483
+ },
11484
+ getStorageDate: function getStorageDate(date) {
11485
+ return _mailpoet2['default'].Date.format(date, {
11486
+ parseFormat: this.props.displayFormat,
11487
+ format: this.props.storageFormat
11488
+ });
11489
+ },
11490
+ render: function render() {
11491
+ var _this = this;
11492
 
11493
+ return _react2['default'].createElement('input', _extends({
11494
+ type: 'text',
11495
+ size: '10',
11496
+ name: this.getFieldName(),
11497
+ value: this.getDisplayDate(this.props.value),
11498
+ readOnly: true,
11499
+ disabled: this.props.disabled,
11500
+ onChange: this.onChange,
11501
+ ref: function (c) {
11502
+ _this.dateInput = c;
11503
+ }
11504
+ }, this.props.validation));
11505
+ }
11506
+ });
11507
 
11508
+ var TimeSelect = _react2['default'].createClass({
11509
+ displayName: 'TimeSelect',
 
 
 
 
 
 
 
 
 
11510
 
11511
+ render: function render() {
11512
+ var options = Object.keys(timeOfDayItems).map(function (value) {
11513
+ return _react2['default'].createElement(
11514
+ 'option',
11515
+ {
11516
+ key: 'option-' + timeOfDayItems[value],
11517
+ value: value
11518
+ },
11519
+ timeOfDayItems[value]
11520
  );
11521
+ });
 
11522
 
11523
+ return _react2['default'].createElement(
11524
+ 'select',
11525
+ _extends({
11526
+ name: this.props.name || 'time',
11527
+ value: this.props.value,
11528
+ disabled: this.props.disabled,
11529
+ onChange: this.props.onChange
11530
+ }, this.props.validation),
11531
+ options
11532
+ );
11533
+ }
11534
+ });
11535
 
11536
+ var DateTime = _react2['default'].createClass({
11537
+ displayName: 'DateTime',
 
 
 
 
 
 
 
11538
 
11539
+ DATE_TIME_SEPARATOR: ' ',
11540
+ getInitialState: function getInitialState() {
11541
+ return this.buildStateFromProps(this.props);
11542
+ },
11543
+ componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
11544
+ this.setState(this.buildStateFromProps(nextProps));
11545
+ },
11546
+ buildStateFromProps: function buildStateFromProps(props) {
11547
+ var value = props.value || defaultDateTime;
11548
 
11549
+ var _value$split = value.split(this.DATE_TIME_SEPARATOR);
11550
 
11551
+ var _value$split2 = _slicedToArray(_value$split, 2);
 
11552
 
11553
+ var date = _value$split2[0];
11554
+ var time = _value$split2[1];
 
 
 
 
 
 
11555
 
11556
+ return {
11557
+ date: date,
11558
+ time: time
11559
+ };
11560
+ },
11561
+ handleChange: function handleChange(event) {
11562
+ var newState = {};
11563
+ newState[event.target.name] = event.target.value;
11564
+
11565
+ this.setState(newState, this.propagateChange);
11566
+ },
11567
+ propagateChange: function propagateChange() {
11568
+ if (this.props.onChange) {
11569
+ this.props.onChange({
11570
+ target: {
11571
+ name: this.props.name || '',
11572
+ value: this.getDateTime()
11573
+ }
11574
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11575
  }
11576
+ },
11577
+ getDateTime: function getDateTime() {
11578
+ return [this.state.date, this.state.time].join(this.DATE_TIME_SEPARATOR);
11579
+ },
11580
+ render: function render() {
11581
+ return _react2['default'].createElement(
11582
+ 'span',
11583
+ null,
11584
+ _react2['default'].createElement(DateText, {
11585
+ name: 'date',
11586
+ value: this.state.date,
11587
+ onChange: this.handleChange,
11588
+ displayFormat: dateDisplayFormat,
11589
+ storageFormat: dateStorageFormat,
11590
+ disabled: this.props.disabled,
11591
+ validation: this.props.dateValidation
11592
+ }),
11593
+ _react2['default'].createElement(TimeSelect, {
11594
+ name: 'time',
11595
+ value: this.state.time,
11596
+ onChange: this.handleChange,
11597
+ disabled: this.props.disabled,
11598
+ validation: this.props.timeValidation
11599
+ })
11600
+ );
11601
+ }
11602
+ });
11603
 
11604
+ var StandardScheduling = _react2['default'].createClass({
11605
+ displayName: 'StandardScheduling',
11606
 
11607
+ getCurrentValue: function getCurrentValue() {
11608
+ return _underscore2['default'].defaults(this.props.item[this.props.field.name] || {}, {
11609
+ isScheduled: '0',
11610
+ scheduledAt: defaultDateTime
11611
+ });
11612
+ },
11613
+ handleValueChange: function handleValueChange(event) {
11614
+ var oldValue = this.getCurrentValue();
11615
+ var newValue = {};
11616
+ newValue[event.target.name] = event.target.value;
11617
 
11618
+ return this.props.onValueChange({
11619
+ target: {
11620
+ name: this.props.field.name,
11621
+ value: _underscore2['default'].extend({}, oldValue, newValue)
11622
+ }
11623
+ });
11624
+ },
11625
+ handleCheckboxChange: function handleCheckboxChange(event) {
11626
+ var changeEvent = event;
11627
+ changeEvent.target.value = this.isScheduledInput.checked ? '1' : '0';
11628
+ return this.handleValueChange(changeEvent);
11629
+ },
11630
+ isScheduled: function isScheduled() {
11631
+ return this.getCurrentValue().isScheduled === '1';
11632
+ },
11633
+ getDateValidation: function getDateValidation() {
11634
+ return {
11635
+ 'data-parsley-required': true,
11636
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('noScheduledDateError'),
11637
+ 'data-parsley-errors-container': '#mailpoet_scheduling'
11638
+ };
11639
+ },
11640
+ render: function render() {
11641
+ var _this2 = this;
11642
 
11643
+ var schedulingOptions = undefined;
11644
 
11645
+ if (this.isScheduled()) {
11646
+ schedulingOptions = _react2['default'].createElement(
11647
+ 'span',
11648
+ { id: 'mailpoet_scheduling' },
11649
+ _react2['default'].createElement(DateTime, {
11650
+ name: 'scheduledAt',
11651
+ value: this.getCurrentValue().scheduledAt,
11652
+ onChange: this.handleValueChange,
11653
+ disabled: this.props.field.disabled,
11654
+ dateValidation: this.getDateValidation()
11655
+ }),
11656
+ ' ',
11657
+ _react2['default'].createElement(
11658
  'span',
11659
+ null,
11660
+ _mailpoet2['default'].I18n.t('websiteTimeIs'),
11661
+ ' ',
11662
+ _react2['default'].createElement(
11663
+ 'code',
 
 
 
 
 
 
11664
  null,
11665
+ currentTime
 
 
 
 
 
 
11666
  )
11667
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11668
  );
11669
  }
11670
+ return _react2['default'].createElement(
11671
+ 'div',
11672
+ null,
11673
+ _react2['default'].createElement('input', {
11674
+ ref: function (c) {
11675
+ _this2.isScheduledInput = c;
11676
+ },
11677
+ type: 'checkbox',
11678
+ value: '1',
11679
+ checked: this.isScheduled(),
11680
+ disabled: this.props.field.disabled,
11681
+ name: 'isScheduled',
11682
+ onChange: this.handleCheckboxChange
11683
+ }),
11684
+ schedulingOptions
11685
+ );
11686
+ }
11687
+ });
11688
 
11689
+ var fields = [{
11690
+ name: 'subject',
11691
+ label: _mailpoet2['default'].I18n.t('subjectLine'),
11692
+ tip: _mailpoet2['default'].I18n.t('subjectLineTip'),
11693
+ type: 'text',
11694
+ validation: {
11695
+ 'data-parsley-required': true,
11696
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
11697
+ }
11698
+ }, {
11699
+ name: 'segments',
11700
+ label: _mailpoet2['default'].I18n.t('segments'),
11701
+ tip: _mailpoet2['default'].I18n.t('segmentsTip'),
11702
+ type: 'selection',
11703
+ placeholder: _mailpoet2['default'].I18n.t('selectSegmentPlaceholder'),
11704
+ id: 'mailpoet_segments',
11705
+ api_version: window.mailpoet_api_version,
11706
+ endpoint: 'segments',
11707
+ multiple: true,
11708
+ filter: function filter(segment) {
11709
+ return !segment.deleted_at;
11710
+ },
11711
+ getLabel: function getLabel(segment) {
11712
+ return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
11713
+ },
11714
+ transformChangedValue: function transformChangedValue(segmentIds) {
11715
+ var allSegments = this.getItems();
11716
+ return _underscore2['default'].map(segmentIds, function (id) {
11717
+ return _underscore2['default'].find(allSegments, function (segment) {
11718
+ return segment.id === id;
11719
+ });
11720
+ });
11721
+ },
11722
+ validation: {
11723
+ 'data-parsley-required': true,
11724
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('noSegmentsSelectedError')
11725
+ }
11726
+ }, {
11727
+ name: 'sender',
11728
+ label: _mailpoet2['default'].I18n.t('sender'),
11729
+ tip: _mailpoet2['default'].I18n.t('senderTip'),
11730
+ fields: [{
11731
+ name: 'sender_name',
11732
  type: 'text',
11733
+ placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
11734
  validation: {
11735
+ 'data-parsley-required': true
 
11736
  }
11737
  }, {
11738
+ name: 'sender_address',
11739
+ type: 'text',
11740
+ placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11741
  validation: {
11742
  'data-parsley-required': true,
11743
+ 'data-parsley-type': 'email'
11744
  }
11745
+ }]
11746
+ }, {
11747
+ name: 'reply-to',
11748
+ label: _mailpoet2['default'].I18n.t('replyTo'),
11749
+ tip: _mailpoet2['default'].I18n.t('replyToTip'),
11750
+ inline: true,
11751
+ fields: [{
11752
+ name: 'reply_to_name',
11753
+ type: 'text',
11754
+ placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
11755
  }, {
11756
+ name: 'reply_to_address',
11757
+ type: 'text',
11758
+ placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
11759
+ validation: {
11760
+ 'data-parsley-type': 'email'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11761
  }
11762
+ }]
11763
+ }, {
11764
+ name: 'options',
11765
+ label: _mailpoet2['default'].I18n.t('scheduleIt'),
11766
+ type: 'reactComponent',
11767
+ component: StandardScheduling
11768
+ }];
11769
 
11770
+ fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
11771
 
11772
+ module.exports = {
11773
+ getFields: function getFields() {
11774
+ return fields;
11775
+ },
11776
+ getSendButtonOptions: function getSendButtonOptions(newsletter) {
11777
+ var newsletterOptions = newsletter || {};
11778
 
11779
+ var isScheduled = typeof newsletterOptions.options === 'object' && newsletterOptions.options.isScheduled === '1';
11780
+ var options = {
11781
+ value: isScheduled ? _mailpoet2['default'].I18n.t('schedule') : _mailpoet2['default'].I18n.t('send')
11782
+ };
11783
 
11784
+ if (newsletterOptions.status === 'sent' || newsletterOptions.status === 'sending') {
11785
+ options.disabled = 'disabled';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11786
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11787
 
11788
+ return options;
11789
+ }
11790
+ };
 
 
 
 
 
 
 
 
 
 
11791
 
11792
  /***/ },
11793
 
11794
+ /***/ 528:
11795
  /***/ function(module, exports, __webpack_require__) {
11796
 
11797
  'use strict';
11802
 
11803
  var _underscore2 = _interopRequireDefault(_underscore);
11804
 
11805
+ var _mailpoet = __webpack_require__(276);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11806
 
11807
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
 
 
 
11808
 
11809
+ var _wpJsHooks = __webpack_require__(433);
 
 
 
11810
 
11811
+ var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
 
11812
 
11813
+ var _newslettersTypesWelcomeSchedulingJsx = __webpack_require__(529);
 
 
 
 
 
11814
 
11815
+ var _newslettersTypesWelcomeSchedulingJsx2 = _interopRequireDefault(_newslettersTypesWelcomeSchedulingJsx);
11816
 
11817
+ var fields = [{
11818
+ name: 'subject',
11819
+ label: _mailpoet2['default'].I18n.t('subjectLine'),
11820
+ tip: _mailpoet2['default'].I18n.t('postNotificationSubjectLineTip'),
11821
+ type: 'text',
11822
+ validation: {
11823
+ 'data-parsley-required': true,
11824
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
11825
+ }
11826
+ }, {
11827
+ name: 'options',
11828
+ label: _mailpoet2['default'].I18n.t('selectFrequency'),
11829
+ type: 'reactComponent',
11830
+ component: _newslettersTypesWelcomeSchedulingJsx2['default']
11831
+ }, {
11832
+ name: 'segments',
11833
+ label: _mailpoet2['default'].I18n.t('segments'),
11834
+ tip: _mailpoet2['default'].I18n.t('segmentsTip'),
11835
+ type: 'selection',
11836
+ placeholder: _mailpoet2['default'].I18n.t('selectSegmentPlaceholder'),
11837
+ id: 'mailpoet_segments',
11838
+ api_version: window.mailpoet_api_version,
11839
+ endpoint: 'segments',
11840
+ multiple: true,
11841
+ filter: function filter(segment) {
11842
+ return !segment.deleted_at;
11843
  },
11844
+ getLabel: function getLabel(segment) {
11845
+ return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
11846
  },
11847
+ transformChangedValue: function transformChangedValue(segmentIds) {
11848
+ var allSegments = this.getItems();
11849
+ return _underscore2['default'].map(segmentIds, function (id) {
11850
+ return _underscore2['default'].find(allSegments, function (segment) {
11851
+ return segment.id === id;
11852
+ });
11853
+ });
11854
  },
11855
+ validation: {
11856
+ 'data-parsley-required': true,
11857
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('noSegmentsSelectedError')
11858
+ }
11859
+ }, {
11860
+ name: 'sender',
11861
+ label: _mailpoet2['default'].I18n.t('sender'),
11862
+ tip: _mailpoet2['default'].I18n.t('senderTip'),
11863
+ fields: [{
11864
+ name: 'sender_name',
11865
+ type: 'text',
11866
+ placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
11867
+ validation: {
11868
+ 'data-parsley-required': true
11869
+ }
11870
+ }, {
11871
+ name: 'sender_address',
11872
+ type: 'text',
11873
+ placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
11874
+ validation: {
11875
+ 'data-parsley-required': true,
11876
+ 'data-parsley-type': 'email'
11877
+ }
11878
+ }]
11879
+ }, {
11880
+ name: 'reply-to',
11881
+ label: _mailpoet2['default'].I18n.t('replyTo'),
11882
+ tip: _mailpoet2['default'].I18n.t('replyToTip'),
11883
+ inline: true,
11884
+ fields: [{
11885
+ name: 'reply_to_name',
11886
+ type: 'text',
11887
+ placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
11888
+ }, {
11889
+ name: 'reply_to_address',
11890
+ type: 'text',
11891
+ placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
11892
+ validation: {
11893
+ 'data-parsley-type': 'email'
11894
+ }
11895
+ }]
11896
+ }];
11897
+
11898
+ fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
11899
+
11900
+ module.exports = {
11901
+ getFields: function getFields() {
11902
+ return fields;
11903
  },
11904
+ getSendButtonOptions: function getSendButtonOptions() {
11905
+ return {
11906
+ value: _mailpoet2['default'].I18n.t('activate')
11907
+ };
11908
+ }
11909
+ };
11910
 
11911
+ /***/ },
 
 
 
 
 
 
11912
 
11913
+ /***/ 533:
11914
+ /***/ function(module, exports, __webpack_require__) {
 
 
 
 
 
11915
 
11916
+ /* WEBPACK VAR INJECTION */(function(module) {'use strict';
 
 
 
 
 
 
11917
 
11918
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
11919
 
11920
+ var _mailpoet = __webpack_require__(276);
11921
+
11922
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
11923
+
11924
+ var _wpJsHooks = __webpack_require__(433);
11925
+
11926
+ var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
11927
+
11928
+ var _newslettersTypesWelcomeSchedulingJsx = __webpack_require__(529);
11929
+
11930
+ var _newslettersTypesWelcomeSchedulingJsx2 = _interopRequireDefault(_newslettersTypesWelcomeSchedulingJsx);
11931
+
11932
+ var fields = [{
11933
+ name: 'subject',
11934
+ label: _mailpoet2['default'].I18n.t('subjectLine'),
11935
+ tip: _mailpoet2['default'].I18n.t('subjectLineTip'),
11936
+ type: 'text',
11937
+ validation: {
11938
+ 'data-parsley-required': true,
11939
+ 'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
11940
  }
11941
+ }, {
11942
+ name: 'options',
11943
+ label: _mailpoet2['default'].I18n.t('sendWelcomeEmailWhen'),
11944
+ type: 'reactComponent',
11945
+ component: _newslettersTypesWelcomeSchedulingJsx2['default']
11946
+ }, {
11947
+ name: 'sender',
11948
+ label: _mailpoet2['default'].I18n.t('sender'),
11949
+ tip: _mailpoet2['default'].I18n.t('senderTip'),
11950
+ fields: [{
11951
+ name: 'sender_name',
11952
+ type: 'text',
11953
+ placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
11954
+ validation: {
11955
+ 'data-parsley-required': true
11956
+ }
11957
+ }, {
11958
+ name: 'sender_address',
11959
+ type: 'text',
11960
+ placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
11961
+ validation: {
11962
+ 'data-parsley-required': true,
11963
+ 'data-parsley-type': 'email'
11964
+ }
11965
+ }]
11966
+ }, {
11967
+ name: 'reply-to',
11968
+ label: _mailpoet2['default'].I18n.t('replyTo'),
11969
+ tip: _mailpoet2['default'].I18n.t('replyToTip'),
11970
+ inline: true,
11971
+ fields: [{
11972
+ name: 'reply_to_name',
11973
+ type: 'text',
11974
+ placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
11975
+ }, {
11976
+ name: 'reply_to_address',
11977
+ type: 'text',
11978
+ placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
11979
+ validation: {
11980
+ 'data-parsley-type': 'email'
11981
+ }
11982
+ }]
11983
+ }];
11984
 
11985
+ fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
11986
+
11987
+ module['export'] = {
11988
+ getFields: function getFields() {
11989
+ return fields;
11990
+ },
11991
+ getSendButtonOptions: function getSendButtonOptions() {
11992
+ return {
11993
+ value: _mailpoet2['default'].I18n.t('activate')
11994
+ };
11995
+ }
11996
+ };
11997
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(306)(module)))
11998
 
11999
  /***/ },
12000
 
12001
+ /***/ 534:
12002
  /***/ function(module, exports, __webpack_require__) {
12003
 
12004
  'use strict';
12017
 
12018
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
12019
 
12020
+ var _html2canvas = __webpack_require__(535);
12021
 
12022
  var _html2canvas2 = _interopRequireDefault(_html2canvas);
12023
 
12102
 
12103
  /***/ },
12104
 
12105
+ /***/ 535:
12106
  /***/ function(module, exports, __webpack_require__) {
12107
 
12108
+ /* WEBPACK VAR INJECTION */(function(global) {module.exports = global["html2canvas"] = __webpack_require__(536);
12109
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
12110
 
12111
  /***/ },
12112
 
12113
+ /***/ 536:
12114
  /***/ function(module, exports, __webpack_require__) {
12115
 
12116
  /*!
19364
  /******/ ]);
19365
  });
19366
 
19367
+ /***/ },
19368
+
19369
+ /***/ 537:
19370
+ /***/ function(module, exports, __webpack_require__) {
19371
+
19372
+ 'use strict';
19373
+
19374
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
19375
+
19376
+ var _react = __webpack_require__(2);
19377
+
19378
+ var _react2 = _interopRequireDefault(_react);
19379
+
19380
+ var _mailpoet = __webpack_require__(276);
19381
+
19382
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
19383
+
19384
+ var _newslettersBreadcrumbJsx = __webpack_require__(436);
19385
+
19386
+ var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
19387
+
19388
+ var NewsletterStandard = _react2['default'].createClass({
19389
+ displayName: 'NewsletterStandard',
19390
+
19391
+ contextTypes: {
19392
+ router: _react2['default'].PropTypes.object.isRequired
19393
+ },
19394
+ showTemplateSelection: function showTemplateSelection(newsletterId) {
19395
+ this.context.router.push('/template/' + newsletterId);
19396
+ },
19397
+ componentDidMount: function componentDidMount() {
19398
+ var _this = this;
19399
+
19400
+ // No options for this type, create a newsletter upon mounting
19401
+ _mailpoet2['default'].Ajax.post({
19402
+ api_version: window.mailpoet_api_version,
19403
+ endpoint: 'newsletters',
19404
+ action: 'create',
19405
+ data: {
19406
+ type: 'standard'
19407
+ }
19408
+ }).done(function (response) {
19409
+ _this.showTemplateSelection(response.data.id);
19410
+ }).fail(function (response) {
19411
+ if (response.errors.length > 0) {
19412
+ _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
19413
+ return error.message;
19414
+ }), { scroll: true });
19415
+ }
19416
+ });
19417
+ },
19418
+ render: function render() {
19419
+ return _react2['default'].createElement(
19420
+ 'div',
19421
+ null,
19422
+ _react2['default'].createElement(
19423
+ 'h1',
19424
+ null,
19425
+ _mailpoet2['default'].I18n.t('regularNewsletterTypeTitle')
19426
+ ),
19427
+ _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' })
19428
+ );
19429
+ }
19430
+ });
19431
+
19432
+ module.exports = NewsletterStandard;
19433
+
19434
+ /***/ },
19435
+
19436
+ /***/ 538:
19437
+ /***/ function(module, exports, __webpack_require__) {
19438
+
19439
+ 'use strict';
19440
+
19441
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
19442
+
19443
+ var _react = __webpack_require__(2);
19444
+
19445
+ var _react2 = _interopRequireDefault(_react);
19446
+
19447
+ var _mailpoet = __webpack_require__(276);
19448
+
19449
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
19450
+
19451
+ var _newslettersBreadcrumbJsx = __webpack_require__(436);
19452
+
19453
+ var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
19454
+
19455
+ var _underscore = __webpack_require__(281);
19456
+
19457
+ var _underscore2 = _interopRequireDefault(_underscore);
19458
+
19459
+ var _newslettersTypesNotificationSchedulingJsx = __webpack_require__(539);
19460
+
19461
+ var _newslettersTypesNotificationSchedulingJsx2 = _interopRequireDefault(_newslettersTypesNotificationSchedulingJsx);
19462
+
19463
+ var field = {
19464
+ name: 'options',
19465
+ type: 'reactComponent',
19466
+ component: _newslettersTypesNotificationSchedulingJsx2['default']
19467
+ };
19468
+
19469
+ var NewsletterNotification = _react2['default'].createClass({
19470
+ displayName: 'NewsletterNotification',
19471
+
19472
+ contextTypes: {
19473
+ router: _react2['default'].PropTypes.object.isRequired
19474
+ },
19475
+ getInitialState: function getInitialState() {
19476
+ return {
19477
+ options: {
19478
+ intervalType: 'daily',
19479
+ timeOfDay: 0,
19480
+ weekDay: 1,
19481
+ monthDay: 0,
19482
+ nthWeekDay: 1
19483
+ }
19484
+ };
19485
+ },
19486
+ handleValueChange: function handleValueChange(event) {
19487
+ var state = this.state;
19488
+ state[event.target.name] = event.target.value;
19489
+ this.setState(state);
19490
+ },
19491
+ handleNext: function handleNext() {
19492
+ var _this = this;
19493
+
19494
+ _mailpoet2['default'].Ajax.post({
19495
+ api_version: window.mailpoet_api_version,
19496
+ endpoint: 'newsletters',
19497
+ action: 'create',
19498
+ data: _underscore2['default'].extend({}, this.state, {
19499
+ type: 'notification',
19500
+ subject: _mailpoet2['default'].I18n.t('draftNewsletterTitle')
19501
+ })
19502
+ }).done(function (response) {
19503
+ _this.showTemplateSelection(response.data.id);
19504
+ }).fail(function (response) {
19505
+ if (response.errors.length > 0) {
19506
+ _mailpoet2['default'].Notice.error(response.errors.map(function (error) {
19507
+ return error.message;
19508
+ }), { scroll: true });
19509
+ }
19510
+ });
19511
+ },
19512
+ showTemplateSelection: function showTemplateSelection(newsletterId) {
19513
+ this.context.router.push('/template/' + newsletterId);
19514
+ },
19515
+ render: function render() {
19516
+ return _react2['default'].createElement(
19517
+ 'div',
19518
+ null,
19519
+ _react2['default'].createElement(
19520
+ 'h1',
19521
+ null,
19522
+ _mailpoet2['default'].I18n.t('postNotificationNewsletterTypeTitle')
19523
+ ),
19524
+ _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' }),
19525
+ _react2['default'].createElement(
19526
+ 'h3',
19527
+ null,
19528
+ _mailpoet2['default'].I18n.t('selectFrequency')
19529
+ ),
19530
+ _react2['default'].createElement(_newslettersTypesNotificationSchedulingJsx2['default'], {
19531
+ item: this.state,
19532
+ field: field,
19533
+ onValueChange: this.handleValueChange
19534
+ }),
19535
+ _react2['default'].createElement(
19536
+ 'p',
19537
+ { className: 'submit' },
19538
+ _react2['default'].createElement('input', {
19539
+ className: 'button button-primary',
19540
+ type: 'button',
19541
+ onClick: this.handleNext,
19542
+ value: _mailpoet2['default'].I18n.t('next')
19543
+ })
19544
+ )
19545
+ );
19546
+ }
19547
+ });
19548
+
19549
+ module.exports = NewsletterNotification;
19550
+
19551
+ /***/ },
19552
+
19553
+ /***/ 539:
19554
+ /***/ function(module, exports, __webpack_require__) {
19555
+
19556
+ 'use strict';
19557
+
19558
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
19559
+
19560
+ var _underscore = __webpack_require__(281);
19561
+
19562
+ var _underscore2 = _interopRequireDefault(_underscore);
19563
+
19564
+ var _react = __webpack_require__(2);
19565
+
19566
+ var _react2 = _interopRequireDefault(_react);
19567
+
19568
+ var _formFieldsSelectJsx = __webpack_require__(301);
19569
+
19570
+ var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
19571
+
19572
+ var _newslettersSchedulingCommonJsx = __webpack_require__(531);
19573
+
19574
+ var intervalField = {
19575
+ name: 'intervalType',
19576
+ values: _newslettersSchedulingCommonJsx.intervalValues
19577
+ };
19578
+
19579
+ var timeOfDayField = {
19580
+ name: 'timeOfDay',
19581
+ values: _newslettersSchedulingCommonJsx.timeOfDayValues
19582
+ };
19583
+
19584
+ var weekDayField = {
19585
+ name: 'weekDay',
19586
+ values: _newslettersSchedulingCommonJsx.weekDayValues
19587
+ };
19588
+
19589
+ var monthDayField = {
19590
+ name: 'monthDay',
19591
+ values: _newslettersSchedulingCommonJsx.monthDayValues
19592
+ };
19593
+
19594
+ var nthWeekDayField = {
19595
+ name: 'nthWeekDay',
19596
+ values: _newslettersSchedulingCommonJsx.nthWeekDayValues
19597
+ };
19598
 
19599
+ var NotificationScheduling = _react2['default'].createClass({
19600
+ displayName: 'NotificationScheduling',
19601
 
19602
+ getCurrentValue: function getCurrentValue() {
19603
+ return this.props.item[this.props.field.name] || {};
19604
+ },
19605
+ handleValueChange: function handleValueChange(name, value) {
19606
+ var oldValue = this.getCurrentValue();
19607
+ var newValue = {};
19608
 
19609
+ newValue[name] = value;
 
 
19610
 
19611
+ return this.props.onValueChange({
19612
+ target: {
19613
+ name: this.props.field.name,
19614
+ value: _underscore2['default'].extend({}, oldValue, newValue)
19615
+ }
19616
+ });
19617
+ },
19618
+ handleIntervalChange: function handleIntervalChange(event) {
19619
+ return this.handleValueChange('intervalType', event.target.value);
19620
+ },
19621
+ handleTimeOfDayChange: function handleTimeOfDayChange(event) {
19622
+ return this.handleValueChange('timeOfDay', event.target.value);
19623
+ },
19624
+ handleWeekDayChange: function handleWeekDayChange(event) {
19625
+ return this.handleValueChange('weekDay', event.target.value);
19626
+ },
19627
+ handleMonthDayChange: function handleMonthDayChange(event) {
19628
+ return this.handleValueChange('monthDay', event.target.value);
19629
+ },
19630
+ handleNthWeekDayChange: function handleNthWeekDayChange(event) {
19631
+ return this.handleValueChange('nthWeekDay', event.target.value);
19632
+ },
19633
+ render: function render() {
19634
+ var value = this.getCurrentValue();
19635
+ var timeOfDaySelection = undefined;
19636
+ var weekDaySelection = undefined;
19637
+ var monthDaySelection = undefined;
19638
+ var nthWeekDaySelection = undefined;
19639
 
19640
+ if (value.intervalType !== 'immediately') {
19641
+ timeOfDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
19642
+ field: timeOfDayField,
19643
+ item: this.getCurrentValue(),
19644
+ onValueChange: this.handleTimeOfDayChange
 
 
 
 
 
 
 
 
 
 
 
19645
  });
 
 
 
 
 
 
 
 
 
 
 
 
19646
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19647
 
19648
+ if (value.intervalType === 'weekly' || value.intervalType === 'nthWeekDay') {
19649
+ weekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
19650
+ field: weekDayField,
19651
+ item: this.getCurrentValue(),
19652
+ onValueChange: this.handleWeekDayChange
19653
+ });
19654
+ }
19655
 
19656
+ if (value.intervalType === 'monthly') {
19657
+ monthDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
19658
+ field: monthDayField,
19659
+ item: this.getCurrentValue(),
19660
+ onValueChange: this.handleMonthDayChange
19661
+ });
19662
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19663
 
19664
+ if (value.intervalType === 'nthWeekDay') {
19665
+ nthWeekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
19666
+ field: nthWeekDayField,
19667
+ item: this.getCurrentValue(),
19668
+ onValueChange: this.handleNthWeekDayChange
 
 
 
 
 
 
 
 
 
 
 
19669
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19670
  }
 
19671
 
19672
+ return _react2['default'].createElement(
19673
+ 'div',
19674
+ null,
19675
+ _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
19676
+ field: intervalField,
19677
+ item: this.getCurrentValue(),
19678
+ onValueChange: this.handleIntervalChange
19679
+ }),
19680
+ nthWeekDaySelection,
19681
+ monthDaySelection,
19682
+ weekDaySelection,
19683
+ timeOfDaySelection
19684
+ );
19685
+ }
19686
+ });
19687
+
19688
+ module.exports = NotificationScheduling;
19689
 
19690
  /***/ },
19691
 
19919
  _mailpoet2['default'].I18n.t('pageTitle'),
19920
  _react2['default'].createElement(
19921
  _reactRouter.Link,
19922
+ {
19923
+ className: 'page-title-action',
19924
+ to: '/new',
19925
  onClick: function () {
19926
  return _mailpoet2['default'].trackEvent('Emails > Add New', { 'MailPoet Free version': window.mailpoet_version });
19927
  },
20339
 
20340
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
20341
 
20342
+ var _newslettersSchedulingCommonJsx = __webpack_require__(531);
20343
 
20344
  var messages = {
20345
  onTrash: function onTrash(response) {
21015
  'a',
21016
  {
21017
  href: 'http://docs.mailpoet.com/article/133-the-wordpress-users-list',
21018
+ target: '_blank',
21019
+ rel: 'noopener noreferrer'
21020
  },
21021
  _mailpoet2['default'].I18n.t('readMore')
21022
  );
21216
  /***/ 558:
21217
  /***/ function(module, exports, __webpack_require__) {
21218
 
21219
+ 'use strict';
21220
 
21221
+ Object.defineProperty(exports, '__esModule', {
21222
+ value: true
21223
+ });
 
 
 
 
 
 
 
 
21224
 
21225
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
 
 
 
 
21226
 
21227
+ var _react = __webpack_require__(2);
21228
 
21229
+ var _react2 = _interopRequireDefault(_react);
 
21230
 
21231
+ var _reactRouter = __webpack_require__(181);
21232
+
21233
+ var _mailpoet = __webpack_require__(276);
21234
+
21235
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
21236
+
21237
+ var _formFormJsx = __webpack_require__(294);
21238
+
21239
+ var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
21240
+
21241
+ var _propTypes = __webpack_require__(185);
21242
+
21243
+ var _propTypes2 = _interopRequireDefault(_propTypes);
21244
+
21245
+ var fields = [{
21246
+ name: 'name',
21247
+ label: _mailpoet2['default'].I18n.t('name'),
21248
+ type: 'text'
21249
+ }, {
21250
+ name: 'description',
21251
+ label: _mailpoet2['default'].I18n.t('description'),
21252
+ type: 'textarea',
21253
+ tip: _mailpoet2['default'].I18n.t('segmentDescriptionTip')
21254
+ }];
21255
+
21256
+ var messages = {
21257
+ onUpdate: function onUpdate() {
21258
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('segmentUpdated'));
21259
+ },
21260
+ onCreate: function onCreate() {
21261
+ _mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('segmentAdded'));
21262
+ _mailpoet2['default'].trackEvent('Lists > Add new', {
21263
+ 'MailPoet Free version': window.mailpoet_version
21264
+ });
21265
+ }
21266
+ };
21267
+
21268
+ var SegmentForm = function SegmentForm(_ref) {
21269
+ var params = _ref.params;
21270
+ return _react2['default'].createElement(
21271
+ 'div',
21272
+ null,
21273
+ _react2['default'].createElement(
21274
+ 'h1',
21275
+ { className: 'title' },
21276
+ _mailpoet2['default'].I18n.t('segment'),
21277
+ _react2['default'].createElement(
21278
+ _reactRouter.Link,
21279
+ { className: 'page-title-action', to: '/' },
21280
+ _mailpoet2['default'].I18n.t('backToList')
21281
+ )
21282
+ ),
21283
+ _react2['default'].createElement(_formFormJsx2['default'], {
21284
+ endpoint: 'segments',
21285
+ fields: fields,
21286
+ params: params,
21287
+ messages: messages
21288
+ })
21289
+ );
21290
+ };
21291
 
21292
+ SegmentForm.propTypes = {
21293
+ params: _propTypes2['default'].shape({
21294
+ id: _propTypes2['default'].string
21295
+ }).isRequired
21296
+ };
21297
+
21298
+ exports['default'] = SegmentForm;
21299
+ module.exports = exports['default'];
21300
 
21301
  /***/ },
21302
 
23822
  }];
23823
 
23824
  function Tabs(props) {
23825
+ var tabLinks = tabs.map(function (tab) {
23826
  var tabClasses = (0, _classnames2['default'])('nav-tab', { 'nav-tab-active': props.tab === tab.name });
23827
 
23828
  return _react2['default'].createElement(
23829
  _reactRouter.Link,
23830
  {
23831
+ key: 'tab-' + tab.name,
23832
  className: tabClasses,
23833
  to: tab.link
23834
  },
23960
  null,
23961
  _react2['default'].createElement(
23962
  'a',
23963
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/116-common-problems' },
23964
  'Common Problems'
23965
  )
23966
  ),
23969
  null,
23970
  _react2['default'].createElement(
23971
  'a',
23972
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/165-newsletters' },
23973
  'Newsletters'
23974
  )
23975
  ),
23978
  null,
23979
  _react2['default'].createElement(
23980
  'a',
23981
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/156-migration-questions' },
23982
  'Migration Questions'
23983
  )
23984
  ),
23987
  null,
23988
  _react2['default'].createElement(
23989
  'a',
23990
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/149-sending-methods' },
23991
  'Sending Methods'
23992
  )
23993
  ),
23996
  null,
23997
  _react2['default'].createElement(
23998
  'a',
23999
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/139-subscription-forms' },
24000
  'Subscription Forms'
24001
  )
24002
  ),
24005
  null,
24006
  _react2['default'].createElement(
24007
  'a',
24008
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/114-getting-started' },
24009
  'Getting Started'
24010
  )
24011
  ),
24014
  null,
24015
  _react2['default'].createElement(
24016
  'a',
24017
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/123-newsletter-designer' },
24018
  'Newsletter Designer'
24019
  )
24020
  ),
24023
  null,
24024
  _react2['default'].createElement(
24025
  'a',
24026
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/121-subscribers-and-lists' },
24027
  'Subscribers and Lists'
24028
  )
24029
  )
24030
  ),
24031
  _react2['default'].createElement(
24032
  'a',
24033
+ { target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/', className: 'button button-primary' },
24034
  _mailpoet2['default'].I18n.t('knowledgeBaseButton')
24035
  )
24036
  );
24045
 
24046
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
24047
  __webpack_require__(276)
24048
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function reinstallFromScratch(
24049
  MailPoet
24050
  ) {
24051
  var element;
24052
  function eventHandler() {
24053
+ if (confirm(MailPoet.I18n.t('reinstallConfirmation'))) { // eslint-disable-line no-alert
24054
  MailPoet.trackEvent(
24055
  'User has reinstalled MailPoet via Settings',
24056
  { 'MailPoet Free version': window.mailpoet_version }
24061
  api_version: window.mailpoet_api_version,
24062
  endpoint: 'setup',
24063
  action: 'reset'
24064
+ }).always(function alwaysCb() {
24065
  MailPoet.Modal.loading(false);
24066
+ }).done(function doneCb() {
24067
  window.location = 'admin.php?page=mailpoet-newsletters';
24068
+ }).fail(function failCb(response) {
24069
  if (response.errors.length > 0) {
24070
  MailPoet.Notice.error(
24071
+ response.errors.map(function responseMapCb(error) {
24072
  return error.message;
24073
  }),
24074
  { scroll: true }
24275
  complete: function (CSV) {
24276
  var email;
24277
  var emailAddress;
 
 
24278
  var rowData;
24279
  var rowColumnCount;
24280
  var errorNotice;
24281
+ Object.keys(CSV.data).forEach(function csvDataEach(rowCount) {
24282
  rowData = CSV.data[rowCount].map(function (el) {
24283
  return el.trim();
24284
  });
24296
  // determine position of email address inside an array; this is
24297
  // done once and then email regex is run just on that element for each row
24298
  if (emailColumnPosition === null) {
24299
+ Object.keys(rowData).forEach(function rowDataEach(column) {
24300
  emailAddress = detectAndCleanupEmail(rowData[column]);
24301
  if (emailColumnPosition === null
24302
  && window.mailpoet_email_regex.test(emailAddress)) {
24306
  rowData[column] = emailAddress;
24307
  processedSubscribers[emailAddress] = rowData;
24308
  }
24309
+ });
24310
  if (emailColumnPosition === null
24311
  && advancedOptionHeader
24312
+ && parseInt(rowCount, 10) === 0) {
24313
  isHeaderFound = true;
24314
  processedSubscribers[0] = rowData;
24315
  }
24316
+ } else if (rowData[emailColumnPosition] !== '') {
 
24317
  email = detectAndCleanupEmail(rowData[emailColumnPosition]);
24318
  if (_.has(parsedEmails, email)) {
24319
  duplicateEmails.push(email);
24320
+ } else if (!window.mailpoet_email_regex.test(email)) {
 
24321
  invalidEmails.push(rowData[emailColumnPosition]);
24322
+ } else {
24323
+ // if we haven't yet processed this e-mail and it passed
24324
+ // the regex test, then process the row
 
24325
  parsedEmails[email] = true;
24326
  rowData[emailColumnPosition] = email;
24327
  processedSubscribers[email] = rowData;
24328
  }
24329
  }
24330
  }
24331
+ });
24332
  // reindex array to avoid non-numeric indices
24333
  processedSubscribers = _.values(processedSubscribers);
24334
  // if the header options is set, there should be at least
24357
  'MailPoet Free version': window.mailpoet_version
24358
  });
24359
  router.navigate('step2', { trigger: true });
24360
+ } else {
 
24361
  MailPoet.Modal.loading(false);
24362
  errorNotice = MailPoet.I18n.t('noValidRecords');
24363
  errorNotice = errorNotice.replace('[link]', MailPoet.I18n.t('csvKBLink'));
24373
  if (listSelectElement.data('select2')) {
24374
  listSelectElement.select2('data', data);
24375
  listSelectElement.trigger('change');
24376
+ } else {
 
24377
  listSelectElement
24378
  .select2({
24379
  data: data,
24388
  .change(function () {
24389
  if (jQuery(this).val() !== null) {
24390
  toggleNextStepButton(mailChimpProcessButtonElement, 'on');
24391
+ } else {
 
24392
  toggleNextStepButton(mailChimpProcessButtonElement, 'off');
24393
  }
24394
  })
24557
  var fillerPosition;
24558
  var importResults;
24559
  var duplicates;
 
24560
  if (typeof (window.importData.step1) === 'undefined') {
24561
  router.navigate('step1', { trigger: true });
24562
  return;
24603
  duplicates[subscriberEmail] = (duplicates[subscriberEmail] || 0) + 1;
24604
  });
24605
  subscribers.duplicate = [];
24606
+ Object.keys(duplicates).forEach(function emailDuplicates(email) {
24607
  if (duplicates[email] > 1) {
24608
  subscribers.duplicate.push(email + ' (x' + duplicates[email] + ')');
24609
+ } else {
 
24610
  subscribers.duplicate.push(email);
24611
  }
24612
+ });
24613
 
24614
  importResults = {
24615
  notice: MailPoet.I18n.t('importNoticeSkipped').replace(
24645
  // show available segments
24646
  if (window.mailpoetSegments.length) {
24647
  jQuery('.mailpoet_segments').show();
24648
+ } else {
 
24649
  jQuery('.mailpoet_no_segments').show();
24650
  }
24651
 
24761
  function (helperSubscribers, options) {
24762
  var displayedColumns = [];
24763
  var displayedColumnsIds = [];
 
24764
  var columnData;
24765
  var columnId;
24766
  var headerName;
24767
  var headerNameMatch;
24768
  // go through all elements of the first row in subscribers data
24769
+ Object
24770
+ .keys(helperSubscribers.subscribers[0])
24771
+ .forEach(function helperSubscribersLoop(i) {
24772
+ columnData = helperSubscribers.subscribers[0][i];
24773
+ columnId = 'ignore'; // set default column type
24774
+ // if the column is not undefined and has a valid e-mail, set type as email
24775
+ if (columnData % 1 !== 0 && window.mailpoet_email_regex.test(columnData)) {
24776
+ columnId = 'email';
24777
+ } else if (helperSubscribers.header) {
24778
+ headerName = helperSubscribers.header[i];
24779
+ headerNameMatch = window.mailpoetColumns.map(function (el) {
24780
+ return el.name;
24781
+ }).indexOf(headerName);
24782
+ // set column type using header
24783
+ if (headerNameMatch !== -1) {
24784
+ columnId = window.mailpoetColumns[headerNameMatch].id;
24785
+ } else if (headerName) { // set column type using header name
24786
+ if (/first|first name|given name/i.test(headerName)) {
24787
+ columnId = 'first_name';
24788
+ } else if (/last|last name/i.test(headerName)) {
24789
+ columnId = 'last_name';
24790
+ }
24791
  }
24792
  }
24793
+ // make sure the column id has not been previously selected
24794
+ // (e.g., subscriber_first_name shouldn't be autodetected twice),
24795
+ // except for "ignore"
24796
+ columnId =
24797
+ (columnId !== 'ignore'
24798
+ && displayedColumnsIds.indexOf(columnId) === -1)
24799
+ ? columnId
24800
+ : 'ignore';
24801
+ displayedColumns[i] = { column_id: columnId };
24802
+ displayedColumnsIds.push(columnId);
24803
+ });
 
24804
  return options.fn(displayedColumns);
24805
  });
24806
 
24813
 
24814
  // start array index from 1
24815
  Handlebars.registerHelper('calculate_index', function (rawIndex) {
24816
+ var index = parseInt(rawIndex, 10);
24817
  // display filler data (e.g., ellipsis) if we've reached the maximum number of rows and
24818
  // subscribers count is greater than the maximum number of rows we're displaying
24819
  if (index === maxRowsToShow && subscribers.subscribersCount > (maxRowsToShow + 1)) {
24820
  fillerPosition = index;
24821
  return filler;
24822
+ } else if (index === (subscribers.subscribers.length - 1)) {
24823
  // if we're on the last line, show the total count of subscribers data
 
24824
  return subscribers.subscribersCount.toLocaleString();
24825
  }
24826
  return index + 1;
24860
  var firstRowData;
24861
  var validationRule;
24862
  var testedFormat;
 
24863
  var allowedDateFormats;
24864
  // check if the column id matches the selected id of one of the
24865
  // subscriber's data columns
24882
  id: 'invalidEmail'
24883
  });
24884
  }
24885
+ } else {
 
24886
  MailPoet.Notice.hide('invalidEmail');
24887
  }
24888
  }
24909
  + MailPoet.I18n.t('emptyFirstRowDate')
24910
  + '</span> ';
24911
  preventNextStep = true;
24912
+ } else {
24913
+ Object.keys(allowedDateFormats).forEach(function allowedDateFormatsLoop(format) {
 
24914
  testedFormat = allowedDateFormats[format];
24915
  if (Moment(firstRowData, testedFormat, true).isValid()) {
24916
  validationRule = (typeof (testedFormat) === 'function') ?
24918
  testedFormat;
24919
  // set validation on the column element
24920
  jQuery(matchedColumn.element).data('validation-rule', validationRule);
24921
+ return;
24922
  }
24923
  if (validationRule === 'datetime') {
24924
  validationRule = Moment.ISO_8601;
24925
  }
24926
+ });
24927
  }
24928
  jQuery.map(subscribersClone.subscribers, function (dataSubscribers, index) {
24929
  var data = dataSubscribers;
24939
  + MailPoet.Date.format(date)
24940
  + '</span> '
24941
  );
24942
+ } else {
 
24943
  data[matchedColumn.index] = new Handlebars.SafeString(
24944
  Handlebars.Utils.escapeExpression(data[matchedColumn.index])
24945
  + '<span class="mailpoet_data_match mailpoet_import_error" title="'
24966
 
24967
  if (preventNextStep) {
24968
  toggleNextStepButton('off');
24969
+ } else if (!jQuery('.mailpoet_notice.error:visible').length
 
24970
  && segmentSelectElement.val()) {
24971
  toggleNextStepButton('on');
24972
  }
25056
  });
25057
  return false;
25058
  });
25059
+ } else {
25060
  // CHANGE COLUMN
 
25061
  // check for duplicate values in all select options
25062
  jQuery('select.mailpoet_subscribers_column_data_match')
25063
  .each(function () {
25067
  // prompt user
25068
  if (elementId === selectedOptionId
25069
  && elementId !== 'ignore') {
25070
+ if (confirm(MailPoet.I18n.t('selectedValueAlreadyMatched') + ' ' + MailPoet.I18n.t('confirmCorrespondingColumn'))) { // eslint-disable-line no-alert
25071
  jQuery(element).data('column-id', 'ignore');
25072
+ } else {
 
25073
  selectEvent.preventDefault();
25074
  jQuery(selectElement).select2('close');
25075
  }
25173
  ) {
25174
  MailPoet.Notice.error(_.flatten(clickImportResults.errors)
25175
  );
25176
+ } else {
 
25177
  window.mailpoetSegments = clickImportResults.segments;
25178
  clickImportResults.segments = _.map(segmentSelectElement.select2('data'),
25179
  function (data) {
25397
  var disabled = 'button-disabled';
25398
  if (condition === 'on') {
25399
  nextStepButton.removeClass(disabled);
25400
+ } else {
 
25401
  nextStepButton.addClass(disabled);
25402
  }
25403
  }
25418
  width: '20em',
25419
  templateResult: function templateResult(item) {
25420
  return (item.subscriberCount > 0)
25421
+ ? item.name + ' (' + parseInt(item.subscriberCount, 10).toLocaleString() + ')'
25422
  : item.name;
25423
  },
25424
  templateSelection: function templateSelection(item) {
25425
  return (item.subscriberCount > 0)
25426
+ ? item.name + ' (' + parseInt(item.subscriberCount, 10).toLocaleString() + ')'
25427
  : item.name;
25428
  }
25429
  })
25457
  (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
25458
  ) {
25459
  toggleNextStepButton('on');
25460
+ } else {
 
25461
  toggleNextStepButton('off');
25462
  }
25463
  });
25494
  MailPoet.Modal.loading(false);
25495
  }).done(function done(response) {
25496
  var resultMessage = MailPoet.I18n.t('exportMessage')
25497
+ .replace('%1$s', '<strong>' + parseInt(response.data.totalExported, 133).toLocaleString() + '</strong>')
25498
  .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
25499
  .replace('[/link]', '</a>');
25500
  jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
assets/js/{admin_vendor.9fdf3dc7.js → admin_vendor.80f188f7.js} RENAMED
@@ -14,7 +14,7 @@ webpackJsonp([1],[
14
  __webpack_require__(547);
15
  __webpack_require__(540);
16
  __webpack_require__(542);
17
- __webpack_require__(528);
18
  __webpack_require__(575);
19
  __webpack_require__(244);
20
  module.exports = __webpack_require__(277);
@@ -30825,13 +30825,15 @@ webpackJsonp([1],[
30825
  if (action.name === 'trash') {
30826
  customAction = _react2['default'].createElement(
30827
  'span',
30828
- { key: 'action-' + index, className: 'trash' },
30829
  !isFirst ? ' | ' : '',
30830
  _react2['default'].createElement(
30831
  'a',
30832
  {
30833
  href: 'javascript:;',
30834
- onClick: _this.handleTrashItem.bind(null, _this.props.item.id)
 
 
30835
  },
30836
  _mailpoet2['default'].I18n.t('moveToTrash')
30837
  )
@@ -30841,7 +30843,8 @@ webpackJsonp([1],[
30841
  'span',
30842
  {
30843
  onClick: _this.props.onRefreshItems,
30844
- key: 'action-' + index, className: action.name,
 
30845
  role: 'button',
30846
  tabIndex: index
30847
  },
@@ -30852,7 +30855,8 @@ webpackJsonp([1],[
30852
  customAction = _react2['default'].createElement(
30853
  'span',
30854
  {
30855
- key: 'action-' + index, className: action.name
 
30856
  },
30857
  !isFirst ? ' | ' : '',
30858
  action.link(_this.props.item)
@@ -30861,12 +30865,17 @@ webpackJsonp([1],[
30861
  customAction = _react2['default'].createElement(
30862
  'span',
30863
  {
30864
- key: 'action-' + index, className: action.name
 
30865
  },
30866
  !isFirst ? ' | ' : '',
30867
  _react2['default'].createElement(
30868
  'a',
30869
- { href: 'javascript:;', onClick: action.onClick !== undefined ? action.onClick.bind(null, _this.props.item, _this.props.onRefreshItems) : false
 
 
 
 
30870
  },
30871
  action.label
30872
  )
@@ -30908,7 +30917,9 @@ webpackJsonp([1],[
30908
  'a',
30909
  {
30910
  href: 'javascript:;',
30911
- onClick: this.handleRestoreItem.bind(null, this.props.item.id)
 
 
30912
  },
30913
  _mailpoet2['default'].I18n.t('restore')
30914
  )
@@ -30922,7 +30933,9 @@ webpackJsonp([1],[
30922
  {
30923
  className: 'submitdelete',
30924
  href: 'javascript:;',
30925
- onClick: this.handleDeleteItem.bind(null, this.props.item.id)
 
 
30926
  },
30927
  _mailpoet2['default'].I18n.t('deletePermanently')
30928
  )
@@ -30931,8 +30944,11 @@ webpackJsonp([1],[
30931
  _react2['default'].createElement(
30932
  'button',
30933
  {
30934
- onClick: this.handleToggleItem.bind(null, this.props.item.id),
30935
- className: 'toggle-row', type: 'button'
 
 
 
30936
  },
30937
  _react2['default'].createElement(
30938
  'span',
@@ -30953,8 +30969,11 @@ webpackJsonp([1],[
30953
  _react2['default'].createElement(
30954
  'button',
30955
  {
30956
- onClick: this.handleToggleItem.bind(null, this.props.item.id),
30957
- className: 'toggle-row', type: 'button'
 
 
 
30958
  },
30959
  _react2['default'].createElement(
30960
  'span',
@@ -31032,7 +31051,7 @@ webpackJsonp([1],[
31032
  )
31033
  )
31034
  ),
31035
- this.props.items.map(function (item, index) {
31036
  var renderItem = item;
31037
  renderItem.id = parseInt(item.id, 10);
31038
  renderItem.selected = _this2.props.selected_ids.indexOf(renderItem.id) !== -1;
@@ -31049,7 +31068,7 @@ webpackJsonp([1],[
31049
  is_selectable: _this2.props.is_selectable,
31050
  item_actions: _this2.props.item_actions,
31051
  group: _this2.props.group,
31052
- key: 'item-' + renderItem.id + '-' + index,
31053
  item: renderItem
31054
  });
31055
  })
@@ -31216,17 +31235,19 @@ webpackJsonp([1],[
31216
  componentDidMount: function componentDidMount() {
31217
  var _this6 = this;
31218
 
31219
- if (this.isMounted()) {
31220
- var params = this.props.params || {};
31221
- this.initWithParams(params);
31222
 
31223
- if (this.props.auto_refresh) {
31224
- (0, _jquery2['default'])(document).on('heartbeat-tick.mailpoet', function () {
31225
- _this6.getItems();
31226
- });
31227
- }
31228
  }
31229
  },
 
 
 
31230
  componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
31231
  var params = nextProps.params || {};
31232
  this.initWithParams(params);
@@ -31234,7 +31255,7 @@ webpackJsonp([1],[
31234
  getItems: function getItems() {
31235
  var _this7 = this;
31236
 
31237
- if (this.isMounted()) {
31238
  this.setState({ loading: true });
31239
 
31240
  this.clearSelection();
@@ -33261,137 +33282,150 @@ webpackJsonp([1],[
33261
  /* 283 */
33262
  /***/ function(module, exports, __webpack_require__) {
33263
 
33264
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
33265
 
33266
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(276)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, MailPoet) {
33267
- var ListingBulkActions = React.createClass({
33268
- displayName: 'ListingBulkActions',
33269
 
33270
- getInitialState: function getInitialState() {
33271
- return {
33272
- action: false,
33273
- extra: false
33274
- };
33275
- },
33276
- handleChangeAction: function handleChangeAction(e) {
33277
- var _this = this;
33278
 
33279
- this.setState({
33280
- action: e.target.value,
33281
- extra: false
33282
- }, function () {
33283
- var action = _this.getSelectedAction();
33284
 
33285
- // action on select callback
33286
- if (action !== null && action.onSelect !== undefined) {
33287
- _this.setState({
33288
- extra: action.onSelect(e)
33289
- });
33290
- }
33291
- });
33292
- },
33293
- handleApplyAction: function handleApplyAction(e) {
33294
- e.preventDefault();
33295
 
33296
- var action = this.getSelectedAction();
33297
 
33298
- if (action === null) {
33299
- return;
33300
- }
33301
 
33302
- var selectedIds = this.props.selection !== 'all' ? this.props.selected_ids : [];
 
33303
 
33304
- var data = action.getData !== undefined ? action.getData() : {};
 
 
 
 
 
 
 
33305
 
33306
- data.action = this.state.action;
 
 
 
 
33307
 
33308
- var onSuccess = function onSuccess() {};
33309
- if (action.onSuccess !== undefined) {
33310
- onSuccess = action.onSuccess;
 
 
33311
  }
 
 
 
 
33312
 
33313
- if (data.action) {
33314
- var promise = this.props.onBulkAction(selectedIds, data);
33315
- if (promise !== false) {
33316
- promise.then(onSuccess);
33317
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33318
  }
 
33319
 
33320
- this.setState({
33321
- action: false,
33322
- extra: false
 
 
 
 
 
 
 
33323
  });
33324
- },
33325
- getSelectedAction: function getSelectedAction() {
33326
- var selectedAction = this.action.value;
33327
- if (selectedAction.length > 0) {
33328
- var action = this.props.bulk_actions.filter(function (act) {
33329
- return act.name === selectedAction;
33330
- });
33331
 
33332
- if (action.length > 0) {
33333
- return action[0];
33334
- }
33335
  }
33336
- return null;
33337
- },
33338
- render: function render() {
33339
- var _this2 = this;
 
33340
 
33341
- if (this.props.bulk_actions.length === 0) {
33342
- return null;
33343
- }
33344
 
33345
- return React.createElement(
33346
- 'div',
33347
- { className: 'alignleft actions bulkactions' },
33348
- React.createElement(
33349
- 'label',
33350
- {
33351
- className: 'screen-reader-text',
33352
- htmlFor: 'bulk-action-selector-top'
 
 
 
 
 
 
 
 
 
33353
  },
33354
- MailPoet.I18n.t('selectBulkAction')
 
 
 
 
 
 
33355
  ),
33356
- React.createElement(
33357
- 'select',
33358
- {
33359
- name: 'bulk_actions',
33360
- ref: function (c) {
33361
- _this2.action = c;
33362
- },
33363
- value: this.state.action,
33364
- onChange: this.handleChangeAction
33365
- },
33366
- React.createElement(
33367
  'option',
33368
- { value: '' },
33369
- MailPoet.I18n.t('bulkActions')
33370
- ),
33371
- this.props.bulk_actions.map(function (action, index) {
33372
- return React.createElement(
33373
- 'option',
33374
- {
33375
- value: action.name,
33376
- key: 'action-' + index
33377
- },
33378
- action.label
33379
- );
33380
- })
33381
- ),
33382
- React.createElement('input', {
33383
- onClick: this.handleApplyAction,
33384
- type: 'submit',
33385
- defaultValue: MailPoet.I18n.t('apply'),
33386
- className: 'button action'
33387
- }),
33388
- this.state.extra
33389
- );
33390
- }
33391
- });
33392
 
33393
- return ListingBulkActions;
33394
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
33395
 
33396
  /***/ },
33397
  /* 284 */
@@ -33429,7 +33463,7 @@ webpackJsonp([1],[
33429
  return _react2['default'].createElement(ListingColumn, {
33430
  onSort: _this.props.onSort,
33431
  sort_by: _this.props.sort_by,
33432
- key: 'column-' + index,
33433
  column: renderColumn
33434
  });
33435
  });
@@ -33519,274 +33553,327 @@ webpackJsonp([1],[
33519
  /* 285 */
33520
  /***/ function(module, exports, __webpack_require__) {
33521
 
33522
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
33523
 
33524
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(277), __webpack_require__(276)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, classNames, MailPoet) {
33525
- var ListingPages = React.createClass({
33526
- displayName: 'ListingPages',
33527
 
33528
- getInitialState: function getInitialState() {
33529
- return {
33530
- page: null
33531
- };
33532
- },
33533
- setPage: function setPage(page) {
33534
- var _this = this;
33535
 
33536
- this.setState({
33537
- page: null
33538
- }, function () {
33539
- _this.props.onSetPage(_this.constrainPage(page));
33540
- });
33541
- },
33542
- setFirstPage: function setFirstPage() {
33543
- this.setPage(1);
33544
- },
33545
- setLastPage: function setLastPage() {
33546
- this.setPage(this.getLastPage());
33547
- },
33548
- setPreviousPage: function setPreviousPage() {
33549
- this.setPage(this.constrainPage(parseInt(this.props.page, 10) - 1));
33550
- },
33551
- setNextPage: function setNextPage() {
33552
- this.setPage(this.constrainPage(parseInt(this.props.page, 10) + 1));
33553
- },
33554
- constrainPage: function constrainPage(page) {
33555
- return Math.min(Math.max(1, Math.abs(Number(page))), this.getLastPage());
33556
- },
33557
- handleSetManualPage: function handleSetManualPage(e) {
33558
- if (e.which === 13) {
33559
- this.setPage(this.state.page);
33560
- }
33561
- },
33562
- handleChangeManualPage: function handleChangeManualPage(e) {
33563
- this.setState({
33564
- page: e.target.value
33565
- });
33566
- },
33567
- handleBlurManualPage: function handleBlurManualPage(e) {
33568
- this.setPage(e.target.value);
33569
- },
33570
- getLastPage: function getLastPage() {
33571
- return Math.ceil(this.props.count / this.props.limit);
33572
- },
33573
- render: function render() {
33574
- if (this.props.count === 0) {
33575
- return false;
33576
- }
33577
- var pagination = false;
33578
- var firstPage = React.createElement(
33579
- 'span',
33580
- { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33581
- '«'
33582
- );
33583
- var previousPage = React.createElement(
33584
- 'span',
33585
- { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33586
- '‹'
33587
- );
33588
- var nextPage = React.createElement(
33589
- 'span',
33590
- { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33591
- '›'
33592
- );
33593
- var lastPage = React.createElement(
33594
- 'span',
33595
- { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33596
- '»'
33597
- );
33598
 
33599
- if (this.props.limit > 0 && this.props.count > this.props.limit) {
33600
- if (this.props.page > 1) {
33601
- previousPage = React.createElement(
33602
- 'a',
33603
- { href: 'javascript:;',
33604
- onClick: this.setPreviousPage,
33605
- className: 'prev-page'
33606
- },
33607
- React.createElement(
33608
- 'span',
33609
- { className: 'screen-reader-text' },
33610
- MailPoet.I18n.t('previousPage')
33611
- ),
33612
- React.createElement(
33613
- 'span',
33614
- { 'aria-hidden': 'true' },
33615
- '‹'
33616
- )
33617
- );
33618
- }
33619
 
33620
- if (this.props.page > 2) {
33621
- firstPage = React.createElement(
33622
- 'a',
33623
- { href: 'javascript:;',
33624
- onClick: this.setFirstPage,
33625
- className: 'first-page'
33626
- },
33627
- React.createElement(
33628
- 'span',
33629
- { className: 'screen-reader-text' },
33630
- MailPoet.I18n.t('firstPage')
33631
- ),
33632
- React.createElement(
33633
- 'span',
33634
- { 'aria-hidden': 'true' },
33635
- '«'
33636
- )
33637
- );
33638
- }
33639
 
33640
- if (this.props.page < this.getLastPage()) {
33641
- nextPage = React.createElement(
33642
- 'a',
33643
- { href: 'javascript:;',
33644
- onClick: this.setNextPage,
33645
- className: 'next-page'
33646
- },
33647
- React.createElement(
33648
- 'span',
33649
- { className: 'screen-reader-text' },
33650
- MailPoet.I18n.t('nextPage')
33651
- ),
33652
- React.createElement(
33653
- 'span',
33654
- { 'aria-hidden': 'true' },
33655
- '›'
33656
- )
33657
- );
33658
- }
33659
 
33660
- if (this.props.page < this.getLastPage() - 1) {
33661
- lastPage = React.createElement(
33662
- 'a',
33663
- { href: 'javascript:;',
33664
- onClick: this.setLastPage,
33665
- className: 'last-page'
33666
- },
33667
- React.createElement(
33668
- 'span',
33669
- { className: 'screen-reader-text' },
33670
- MailPoet.I18n.t('lastPage')
33671
- ),
33672
- React.createElement(
33673
- 'span',
33674
- { 'aria-hidden': 'true' },
33675
- '»'
33676
- )
33677
- );
33678
- }
33679
 
33680
- var pageValue = this.props.page;
33681
- if (this.state.page !== null) {
33682
- pageValue = this.state.page;
33683
- }
33684
 
33685
- pagination = React.createElement(
33686
- 'span',
33687
- { className: 'pagination-links' },
33688
- firstPage,
33689
- ' ',
33690
- previousPage,
33691
- ' ',
33692
- React.createElement(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33693
  'span',
33694
- { className: 'paging-input' },
33695
- React.createElement(
33696
- 'label',
33697
- {
33698
- className: 'screen-reader-text',
33699
- htmlFor: 'current-page-selector'
33700
- },
33701
- MailPoet.I18n.t('currentPage')
33702
- ),
33703
- React.createElement('input', {
33704
- type: 'text',
33705
- onChange: this.handleChangeManualPage,
33706
- onKeyUp: this.handleSetManualPage,
33707
- onBlur: this.handleBlurManualPage,
33708
- 'aria-describedby': 'table-paging',
33709
- size: '2',
33710
- value: pageValue,
33711
- name: 'paged',
33712
- id: 'current-page-selector',
33713
- className: 'current-page'
33714
- }),
33715
- MailPoet.I18n.t('pageOutOf'),
33716
- ' ',
33717
- React.createElement(
33718
- 'span',
33719
- { className: 'total-pages' },
33720
- Math.ceil(this.props.count / this.props.limit).toLocaleString()
33721
- )
33722
  ),
33723
- ' ',
33724
- nextPage,
33725
- ' ',
33726
- lastPage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33727
  );
33728
  }
33729
 
33730
- var classes = classNames('tablenav-pages', { 'one-page': this.props.count <= this.props.limit });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33731
 
33732
- var numberOfItemsLabel = undefined;
33733
- if (Number(this.props.count) === 1) {
33734
- numberOfItemsLabel = MailPoet.I18n.t('numberOfItemsSingular');
33735
- } else {
33736
- numberOfItemsLabel = MailPoet.I18n.t('numberOfItemsMultiple').replace('%$1d', parseInt(this.props.count, 10).toLocaleString());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33737
  }
33738
 
33739
- return React.createElement(
33740
- 'div',
33741
- { className: classes },
33742
- React.createElement(
 
 
 
 
 
 
 
 
 
33743
  'span',
33744
- { className: 'displaying-num' },
33745
- numberOfItemsLabel
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33746
  ),
33747
- pagination
 
 
 
33748
  );
33749
  }
33750
- });
33751
 
33752
- return ListingPages;
33753
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33754
 
33755
  /***/ },
33756
  /* 286 */
33757
  /***/ function(module, exports, __webpack_require__) {
33758
 
33759
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33760
 
33761
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(276), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MailPoet, React) {
33762
- var ListingSearch = React.createClass({
33763
- displayName: 'ListingSearch',
 
 
 
 
 
33764
 
33765
- handleSearch: function handleSearch(e) {
 
 
 
 
 
 
 
33766
  e.preventDefault();
33767
  this.props.onSearch(this.search.value.trim());
33768
- },
33769
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
33770
- this.search.value = nextProps.search;
33771
- },
33772
- render: function render() {
33773
  var _this = this;
33774
 
33775
  if (this.props.search === false) {
33776
  return false;
33777
  }
33778
- return React.createElement(
33779
  'form',
33780
  { name: 'search', onSubmit: this.handleSearch },
33781
- React.createElement(
33782
  'p',
33783
  { className: 'search-box' },
33784
- React.createElement(
33785
  'label',
33786
  { htmlFor: 'search_input', className: 'screen-reader-text' },
33787
- MailPoet.I18n.t('searchLabel')
33788
  ),
33789
- React.createElement('input', {
33790
  type: 'search',
33791
  id: 'search_input',
33792
  ref: function (c) {
@@ -33795,33 +33882,77 @@ webpackJsonp([1],[
33795
  name: 's',
33796
  defaultValue: this.props.search
33797
  }),
33798
- React.createElement('input', {
33799
  type: 'submit',
33800
- defaultValue: MailPoet.I18n.t('searchLabel'),
33801
  className: 'button'
33802
  })
33803
  )
33804
  );
33805
  }
33806
- });
33807
 
33808
  return ListingSearch;
33809
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
33810
 
33811
  /***/ },
33812
  /* 287 */
33813
  /***/ function(module, exports, __webpack_require__) {
33814
 
33815
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
33816
 
33817
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(277)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, classNames) {
33818
- var ListingGroups = React.createClass({
33819
- displayName: 'ListingGroups',
 
 
 
 
 
 
 
 
 
 
33820
 
33821
- handleSelect: function handleSelect(group) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33822
  return this.props.onSelectGroup(group);
33823
- },
33824
- render: function render() {
 
 
33825
  var _this = this;
33826
 
33827
  var groups = this.props.groups.map(function (group, index) {
@@ -33829,21 +33960,23 @@ webpackJsonp([1],[
33829
  return false;
33830
  }
33831
 
33832
- var classes = classNames({ current: group.name === _this.props.group });
33833
 
33834
- return React.createElement(
33835
  'li',
33836
- { key: index },
33837
  index > 0 ? ' |' : '',
33838
- React.createElement(
33839
  'a',
33840
  {
33841
  href: 'javascript:;',
33842
  className: classes,
33843
- onClick: _this.handleSelect.bind(_this, group.name)
 
 
33844
  },
33845
  group.label,
33846
- React.createElement(
33847
  'span',
33848
  { className: 'count' },
33849
  '(',
@@ -33854,119 +33987,148 @@ webpackJsonp([1],[
33854
  );
33855
  });
33856
 
33857
- return React.createElement(
33858
  'ul',
33859
  { className: 'subsubsub' },
33860
  groups
33861
  );
33862
  }
33863
- });
33864
 
33865
  return ListingGroups;
33866
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
33867
 
33868
  /***/ },
33869
  /* 288 */
33870
  /***/ function(module, exports, __webpack_require__) {
33871
 
33872
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
33873
 
33874
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(275), __webpack_require__(276)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, jQuery, MailPoet) {
33875
- var ListingFilters = React.createClass({
33876
- displayName: 'ListingFilters',
33877
 
33878
- handleFilterAction: function handleFilterAction() {
33879
- var _this = this;
33880
 
33881
- var filters = {};
33882
- this.getAvailableFilters().forEach(function (filter, i) {
33883
- filters[_this['filter-' + i].name] = _this['filter-' + i].value;
33884
- });
33885
- if (this.props.onBeforeSelectFilter) {
33886
- this.props.onBeforeSelectFilter(filters);
33887
- }
33888
- return this.props.onSelectFilter(filters);
33889
- },
33890
- handleEmptyTrash: function handleEmptyTrash() {
33891
- return this.props.onEmptyTrash();
33892
- },
33893
- getAvailableFilters: function getAvailableFilters() {
33894
- var filters = this.props.filters;
33895
- return Object.keys(filters).filter(function (filter) {
33896
- return !(filters[filter].length === 0 || filters[filter].length === 1 && !filters[filter][0].value);
33897
- });
33898
- },
33899
- componentDidUpdate: function componentDidUpdate() {
33900
- var _this2 = this;
33901
 
33902
- var selectedFilters = this.props.filter;
33903
- this.getAvailableFilters().forEach(function (filter, i) {
33904
- if (selectedFilters[filter] !== undefined && selectedFilters[filter]) {
33905
- jQuery(_this2['filter-' + i]).val(selectedFilters[filter]).trigger('change');
33906
- }
33907
- });
33908
- },
33909
- render: function render() {
33910
- var _this3 = this;
33911
 
33912
- var filters = this.props.filters;
33913
- var availableFilters = this.getAvailableFilters().map(function (filter, i) {
33914
- return React.createElement(
33915
- 'select',
33916
- {
33917
- ref: function (c) {
33918
- _this3['filter-' + i] = c;
33919
- },
33920
- key: 'filter-' + i,
33921
- name: filter
33922
- },
33923
- filters[filter].map(function (option, j) {
33924
- return React.createElement(
33925
- 'option',
33926
- {
33927
- value: option.value,
33928
- key: 'filter-option-' + j
33929
- },
33930
- option.label
33931
- );
33932
- })
33933
- );
33934
- });
33935
 
33936
- var button = undefined;
33937
 
33938
- if (availableFilters.length > 0) {
33939
- button = React.createElement('input', {
33940
- id: 'post-query-submit',
33941
- onClick: this.handleFilterAction,
33942
- type: 'submit',
33943
- defaultValue: MailPoet.I18n.t('filter'),
33944
- className: 'button'
33945
- });
33946
- }
33947
 
33948
- var emptyTrash = undefined;
33949
- if (this.props.group === 'trash') {
33950
- emptyTrash = React.createElement('input', {
33951
- onClick: this.handleEmptyTrash,
33952
- type: 'submit',
33953
- value: MailPoet.I18n.t('emptyTrash'),
33954
- className: 'button'
33955
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33956
  }
 
 
 
 
33957
 
33958
- return React.createElement(
33959
- 'div',
33960
- { className: 'alignleft actions actions' },
33961
- availableFilters,
33962
- button,
33963
- emptyTrash
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33964
  );
 
 
 
 
 
 
 
 
 
 
 
 
33965
  }
33966
- });
33967
 
33968
- return ListingFilters;
33969
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33970
 
33971
  /***/ },
33972
  /* 289 */
@@ -33982,260 +34144,281 @@ webpackJsonp([1],[
33982
  /* 290 */
33983
  /***/ function(module, exports, __webpack_require__) {
33984
 
33985
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
 
33986
 
33987
  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; };
33988
 
33989
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(34), __webpack_require__(275), __webpack_require__(281), __webpack_require__(291)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, ReactDOM, jQuery, _) {
33990
- var Selection = React.createClass({
33991
- displayName: 'Selection',
33992
 
33993
- allowMultipleValues: function allowMultipleValues() {
33994
- return this.props.field.multiple === true;
33995
- },
33996
- isSelect2Initialized: function isSelect2Initialized() {
33997
- return jQuery('#' + this.select.id).hasClass('select2-hidden-accessible') === true;
33998
- },
33999
- isSelect2Component: function isSelect2Component() {
34000
- return this.allowMultipleValues() || this.props.field.forceSelect2;
34001
- },
34002
- componentDidMount: function componentDidMount() {
34003
- if (this.isSelect2Component()) {
34004
- this.setupSelect2();
34005
- }
34006
- },
34007
- componentDidUpdate: function componentDidUpdate(prevProps) {
34008
- if (this.props.item !== undefined && prevProps.item !== undefined && this.props.item.id !== prevProps.item.id) {
34009
- jQuery('#' + this.select.id).val(this.getSelectedValues()).trigger('change');
34010
- }
34011
 
34012
- if (this.isSelect2Initialized() && this.getFieldId(this.props) !== this.getFieldId(prevProps) && this.props.field.resetSelect2OnUpdate !== undefined) {
34013
- this.resetSelect2();
34014
- }
34015
- },
34016
- componentWillUnmount: function componentWillUnmount() {
34017
- if (this.isSelect2Component()) {
34018
- this.destroySelect2();
34019
- }
34020
- },
34021
- getFieldId: function getFieldId(data) {
34022
- var props = data || this.props;
34023
- return props.field.id || props.field.name;
34024
- },
34025
- resetSelect2: function resetSelect2() {
34026
- this.destroySelect2();
 
 
 
 
 
 
 
 
 
 
 
 
 
34027
  this.setupSelect2();
34028
- },
34029
- destroySelect2: function destroySelect2() {
34030
- if (this.isSelect2Initialized()) {
34031
- jQuery('#' + this.select.id).select2('destroy');
34032
- this.cleanupAfterSelect2();
34033
- }
34034
- },
34035
- cleanupAfterSelect2: function cleanupAfterSelect2() {
34036
- // remove DOM elements created by Select2 that are not tracked by React
34037
- jQuery('#' + this.select.id).find('option:not(.default)').remove();
34038
 
34039
- // unbind events (https://select2.org/programmatic-control/methods#event-unbinding)
34040
- jQuery('#' + this.select.id).off('select2:unselecting').off('select2:opening');
34041
- },
34042
- setupSelect2: function setupSelect2() {
34043
- if (this.isSelect2Initialized()) {
34044
- return;
34045
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34046
 
34047
- var select2Options = {
34048
- disabled: this.props.disabled || false,
34049
- width: this.props.width || '',
34050
- placeholder: {
34051
- id: '', // the value of the option
34052
- text: this.props.field.placeholder
34053
- },
34054
- templateResult: function templateResult(item) {
34055
- if (item.element && item.element.selected) {
34056
- return null;
34057
- } else if (item.title) {
34058
- return item.title;
34059
- }
34060
- return item.text;
 
 
 
 
 
 
34061
  }
34062
- };
 
 
34063
 
34064
- var remoteQuery = this.props.field.remoteQuery || null;
34065
- if (remoteQuery) {
34066
- select2Options = Object.assign(select2Options, {
34067
- ajax: {
34068
- url: window.ajaxurl,
34069
- type: 'POST',
34070
- dataType: 'json',
34071
- data: function data(params) {
34072
- return {
34073
- action: 'mailpoet',
34074
- api_version: window.mailpoet_api_version,
34075
- token: window.mailpoet_token,
34076
- endpoint: remoteQuery.endpoint,
34077
- method: remoteQuery.method,
34078
- data: Object.assign(remoteQuery.data, { query: params.term })
34079
- };
34080
- },
34081
- processResults: function processResults(response) {
34082
- return {
34083
- results: response.data.map(function (item) {
34084
- return { id: item.id || item.value, text: item.name || item.text };
34085
- })
34086
- };
34087
- }
34088
  },
34089
- minimumInputLength: remoteQuery.minimumInputLength || 2
34090
- });
34091
- }
 
 
 
 
 
 
 
 
34092
 
34093
- if (this.props.field.extendSelect2Options !== undefined) {
34094
- select2Options = Object.assign(select2Options, this.props.field.extendSelect2Options);
34095
- }
34096
 
34097
- var select2 = jQuery('#' + this.select.id).select2(select2Options);
34098
 
34099
- var hasRemoved = false;
34100
- select2.on('select2:unselecting', function () {
34101
- hasRemoved = true;
34102
- });
34103
- select2.on('select2:opening', function (e) {
34104
- if (hasRemoved === true) {
34105
- hasRemoved = false;
34106
- e.preventDefault();
34107
- }
34108
- });
34109
 
34110
- select2.on('change', this.handleChange);
34111
- },
34112
- getSelectedValues: function getSelectedValues() {
34113
- if (this.props.field.selected !== undefined) {
34114
- return this.props.field.selected(this.props.item);
34115
- } else if (this.props.item !== undefined && this.props.field.name !== undefined) {
34116
- if (this.allowMultipleValues()) {
34117
- if (_.isArray(this.props.item[this.props.field.name])) {
34118
- return this.props.item[this.props.field.name].map(function (item) {
34119
- return item.id;
34120
- });
34121
- }
34122
- } else {
34123
- return this.props.item[this.props.field.name];
34124
  }
 
 
34125
  }
34126
- return null;
34127
- },
34128
- getItems: function getItems() {
34129
- var items = undefined;
34130
- if (typeof window['mailpoet_' + this.props.field.endpoint] !== 'undefined') {
34131
- items = window['mailpoet_' + this.props.field.endpoint];
34132
- } else if (this.props.field.values !== undefined) {
34133
- items = this.props.field.values;
34134
- }
 
34135
 
34136
- if (_.isArray(items)) {
34137
- if (this.props.field.filter !== undefined) {
34138
- items = items.filter(this.props.field.filter);
34139
- }
34140
  }
 
34141
 
34142
- return items;
34143
- },
34144
- handleChange: function handleChange(e) {
34145
- if (this.props.onValueChange === undefined) return;
34146
 
34147
- var valueTextPair = jQuery('#' + this.select.id).children(':selected').map(function element() {
34148
- return { id: jQuery(this).val(), text: jQuery(this).text() };
34149
- });
34150
- var value = this.props.field.multiple ? _.pluck(valueTextPair, 'id') : _.pluck(valueTextPair, 'id').toString();
34151
- var transformedValue = this.transformChangedValue(value, valueTextPair);
34152
 
34153
- this.props.onValueChange({
34154
- target: {
34155
- value: transformedValue,
34156
- name: this.props.field.name,
34157
- id: e.target.id
34158
- }
34159
- });
34160
- },
34161
- getLabel: function getLabel(item) {
34162
- if (this.props.field.getLabel !== undefined) {
34163
- return this.props.field.getLabel(item, this.props.item);
34164
- }
34165
- return item.name;
34166
- },
34167
- getSearchLabel: function getSearchLabel(item) {
34168
- if (this.props.field.getSearchLabel !== undefined) {
34169
- return this.props.field.getSearchLabel(item, this.props.item);
34170
- }
34171
- return null;
34172
- },
34173
- getValue: function getValue(item) {
34174
- if (this.props.field.getValue !== undefined) {
34175
- return this.props.field.getValue(item, this.props.item);
34176
- }
34177
- return item.id;
34178
- },
34179
- // When it's impossible to represent the desired value in DOM,
34180
- // this function may be used to transform the placeholder value into
34181
- // desired value.
34182
- transformChangedValue: function transformChangedValue(value, textValuePair) {
34183
- if (typeof this.props.field.transformChangedValue === 'function') {
34184
- return this.props.field.transformChangedValue.call(this, value, textValuePair);
34185
  }
34186
- return value;
34187
- },
34188
- insertEmptyOption: function insertEmptyOption() {
34189
- // https://select2.org/placeholders
34190
- // For single selects only, in order for the placeholder value to appear,
34191
- // we must have a blank <option> as the first option in the <select> control.
34192
- if (this.allowMultipleValues()) return undefined;
34193
- if (this.props.field.placeholder) return React.createElement('option', { className: 'default' });
34194
- return undefined;
34195
- },
34196
- render: function render() {
34197
- var _this = this;
34198
-
34199
- var items = this.getItems(this.props.field);
34200
- var selectedValues = this.getSelectedValues();
34201
- var options = items.map(function (item, index) {
34202
- var label = _this.getLabel(item);
34203
- var searchLabel = _this.getSearchLabel(item);
34204
- var value = _this.getValue(item);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34205
 
34206
- return React.createElement(
34207
- 'option',
34208
- {
34209
- key: 'option-' + index,
34210
- className: 'default',
34211
- value: value,
34212
- title: searchLabel,
34213
- selected: value === selectedValues
34214
- },
34215
- label
34216
- );
34217
- });
34218
 
34219
- return React.createElement(
34220
- 'select',
34221
- _extends({
34222
- id: this.getFieldId(),
34223
- ref: function (c) {
34224
- _this.select = c;
34225
- },
34226
- disabled: this.props.field.disabled,
34227
- 'data-placeholder': this.props.field.placeholder,
34228
- multiple: this.props.field.multiple,
34229
- defaultValue: selectedValues
34230
- }, this.props.field.validation),
34231
- this.insertEmptyOption(),
34232
- options
34233
  );
34234
- }
34235
- });
34236
 
34237
- return Selection;
34238
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34239
 
34240
  /***/ },
34241
  /* 291 */
@@ -40005,255 +40188,278 @@ webpackJsonp([1],[
40005
  /* 295 */
40006
  /***/ function(module, exports, __webpack_require__) {
40007
 
40008
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(setImmediate) {'use strict';
40009
 
40010
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(276), __webpack_require__(277), __webpack_require__(181), __webpack_require__(297), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, MailPoet, classNames, Router, FormField, jQuery) {
40011
- var Form = React.createClass({
40012
- displayName: 'Form',
40013
 
40014
- contextTypes: {
40015
- router: React.PropTypes.object.isRequired
40016
- },
40017
- getDefaultProps: function getDefaultProps() {
40018
- return {
40019
- params: {}
40020
- };
40021
- },
40022
- getInitialState: function getInitialState() {
40023
- return {
40024
- loading: false,
40025
- errors: [],
40026
- item: {}
40027
- };
40028
- },
40029
- getValues: function getValues() {
40030
- return this.props.item ? this.props.item : this.state.item;
40031
- },
40032
- getErrors: function getErrors() {
40033
- return this.props.errors ? this.props.errors : this.state.errors;
40034
- },
40035
- componentDidMount: function componentDidMount() {
40036
- var _this = this;
40037
 
40038
- if (this.isMounted()) {
40039
- if (this.props.params.id !== undefined) {
40040
- this.loadItem(this.props.params.id);
40041
- } else {
40042
- setImmediate(function () {
40043
- _this.setState({
40044
- item: jQuery('.mailpoet_form').mailpoetSerializeObject()
40045
- });
40046
- });
40047
- }
40048
- }
40049
- },
40050
- componentWillReceiveProps: function componentWillReceiveProps(props) {
40051
- var _this2 = this;
40052
 
40053
- if (props.params.id === undefined) {
40054
- setImmediate(function () {
40055
- _this2.setState({
40056
- loading: false,
40057
- item: {}
40058
- });
40059
- });
40060
- if (props.item === undefined) {
40061
- this.form.reset();
40062
- }
40063
- }
40064
- },
40065
- loadItem: function loadItem(id) {
40066
- var _this3 = this;
40067
 
40068
- this.setState({ loading: true });
40069
 
40070
- MailPoet.Ajax.post({
40071
- api_version: window.mailpoet_api_version,
40072
- endpoint: this.props.endpoint,
40073
- action: 'get',
40074
- data: {
40075
- id: id
40076
- }
40077
- }).done(function (response) {
40078
- _this3.setState({
40079
- loading: false,
40080
- item: response.data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40081
  });
40082
- if (typeof _this3.props.onItemLoad === 'function') {
40083
- _this3.props.onItemLoad(response.data);
40084
- }
40085
- }).fail(function () {
40086
- _this3.setState({
 
 
 
 
40087
  loading: false,
40088
  item: {}
40089
- }, function failSetStateCallback() {
40090
- this.context.router.push('/new');
40091
  });
40092
  });
40093
- },
40094
- handleSubmit: function handleSubmit(e) {
40095
- var _this4 = this;
40096
-
40097
- e.preventDefault();
40098
-
40099
- // handle validation
40100
- if (this.props.isValid !== undefined) {
40101
- if (this.props.isValid() === false) {
40102
- return;
40103
- }
40104
  }
 
 
 
 
40105
 
40106
- this.setState({ loading: true });
40107
 
40108
- // only get values from displayed fields
40109
- var item = {};
40110
- this.props.fields.forEach(function (field) {
40111
- if (field.fields !== undefined) {
40112
- field.fields.forEach(function (subfield) {
40113
- item[subfield.name] = _this4.state.item[subfield.name];
40114
- });
40115
- } else {
40116
- item[field.name] = _this4.state.item[field.name];
40117
- }
 
40118
  });
40119
- // set id if specified
40120
- if (this.props.params.id !== undefined) {
40121
- item.id = this.props.params.id;
40122
  }
 
 
 
 
 
 
 
 
 
 
 
40123
 
40124
- MailPoet.Ajax.post({
40125
- api_version: window.mailpoet_api_version,
40126
- endpoint: this.props.endpoint,
40127
- action: 'save',
40128
- data: item
40129
- }).always(function () {
40130
- _this4.setState({ loading: false });
40131
- }).done(function () {
40132
- if (_this4.props.onSuccess !== undefined) {
40133
- _this4.props.onSuccess();
40134
- } else {
40135
- _this4.context.router.push('/');
40136
- }
40137
 
40138
- if (_this4.props.params.id !== undefined) {
40139
- _this4.props.messages.onUpdate();
40140
- } else {
40141
- _this4.props.messages.onCreate();
40142
- }
40143
- }).fail(function (response) {
40144
- if (response.errors.length > 0) {
40145
- _this4.setState({ errors: response.errors });
40146
- }
40147
- });
40148
- },
40149
- handleValueChange: function handleValueChange(e) {
40150
- if (this.props.onChange) {
40151
- return this.props.onChange(e);
40152
  }
40153
- var item = this.state.item;
40154
- var field = e.target.name;
40155
-
40156
- item[field] = e.target.value;
40157
 
40158
- this.setState({
40159
- item: item
40160
- });
40161
- return true;
40162
- },
40163
- render: function render() {
40164
- var _this5 = this;
40165
 
40166
- var errors = undefined;
40167
- if (this.getErrors() !== undefined) {
40168
- errors = this.getErrors().map(function (error, index) {
40169
- return React.createElement(
40170
- 'div',
40171
- { className: 'mailpoet_notice notice inline error is-dismissible', key: 'error-' + index },
40172
- React.createElement(
40173
- 'p',
40174
- null,
40175
- error.message
40176
- )
40177
- );
40178
  });
 
 
40179
  }
 
 
 
 
 
40180
 
40181
- var formClasses = classNames('mailpoet_form', { mailpoet_form_loading: this.state.loading || this.props.loading });
40182
-
40183
- var beforeFormContent = false;
40184
- var afterFormContent = false;
40185
-
40186
- if (this.props.beforeFormContent !== undefined) {
40187
- beforeFormContent = this.props.beforeFormContent(this.getValues());
 
 
 
 
 
40188
  }
40189
 
40190
- if (this.props.afterFormContent !== undefined) {
40191
- afterFormContent = this.props.afterFormContent(this.getValues());
 
 
40192
  }
 
 
 
 
 
 
 
 
 
 
 
 
40193
 
40194
- var fields = this.props.fields.map(function (field, i) {
40195
- // Compose an onChange handler from the default and custom one
40196
- var onValueChange = _this5.handleValueChange;
40197
- if (field.onBeforeChange) {
40198
- onValueChange = function (e) {
40199
- field.onBeforeChange(e);
40200
- return _this5.handleValueChange(e);
40201
- };
40202
- }
40203
 
40204
- return React.createElement(FormField, {
40205
- field: field,
40206
- item: _this5.getValues(),
40207
- onValueChange: onValueChange,
40208
- key: 'field-' + i
40209
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40210
  });
 
40211
 
40212
- var actions = false;
40213
- if (this.props.children) {
40214
- actions = this.props.children;
40215
- } else {
40216
- actions = React.createElement('input', {
40217
- className: 'button button-primary',
40218
- type: 'submit',
40219
- value: MailPoet.I18n.t('save'),
40220
- disabled: this.state.loading
40221
- });
 
 
 
 
 
 
 
 
 
 
 
40222
  }
40223
 
40224
- return React.createElement(
40225
- 'div',
40226
- null,
40227
- beforeFormContent,
40228
- React.createElement(
40229
- 'form',
40230
- {
40231
- id: this.props.id,
40232
- ref: function (c) {
40233
- _this5.form = c;
40234
- },
40235
- className: formClasses,
40236
- onSubmit: this.props.onSubmit !== undefined ? this.props.onSubmit : this.handleSubmit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40237
  },
40238
- errors,
40239
- React.createElement(
40240
- 'table',
40241
- { className: 'form-table' },
40242
- React.createElement(
40243
- 'tbody',
40244
- null,
40245
- fields
40246
- )
40247
- ),
40248
- actions
 
40249
  ),
40250
- afterFormContent
40251
- );
40252
- }
40253
- });
 
 
40254
 
40255
- return Form;
40256
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
40257
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(296).setImmediate))
40258
 
40259
  /***/ },
@@ -40342,137 +40548,178 @@ webpackJsonp([1],[
40342
  /* 297 */
40343
  /***/ function(module, exports, __webpack_require__) {
40344
 
40345
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
40346
 
40347
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(298), __webpack_require__(300), __webpack_require__(301), __webpack_require__(302), __webpack_require__(303), __webpack_require__(289), __webpack_require__(304), __webpack_require__(275)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, FormFieldText, FormFieldTextarea, FormFieldSelect, FormFieldRadio, FormFieldCheckbox, FormFieldSelection, FormFieldDate, jQuery) {
40348
- var FormField = React.createClass({
40349
- displayName: 'FormField',
40350
 
40351
- renderField: function renderField(data) {
40352
- var inline = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
40353
 
40354
- var description = false;
40355
- if (data.field.description) {
40356
- description = React.createElement(
40357
- 'p',
40358
- { className: 'description' },
40359
- data.field.description
40360
- );
40361
- }
40362
 
40363
- var field = false;
40364
- var dataField = data.field;
40365
 
40366
- if (data.field.field !== undefined) {
40367
- dataField = jQuery.merge(dataField, data.field.field);
40368
- }
40369
 
40370
- switch (dataField.type) {
40371
- case 'text':
40372
- field = React.createElement(FormFieldText, data);
40373
- break;
40374
 
40375
- case 'textarea':
40376
- field = React.createElement(FormFieldTextarea, data);
40377
- break;
40378
 
40379
- case 'select':
40380
- field = React.createElement(FormFieldSelect, data);
40381
- break;
40382
 
40383
- case 'radio':
40384
- field = React.createElement(FormFieldRadio, data);
40385
- break;
40386
 
40387
- case 'checkbox':
40388
- field = React.createElement(FormFieldCheckbox, data);
40389
- break;
40390
 
40391
- case 'selection':
40392
- field = React.createElement(FormFieldSelection, data);
40393
- break;
40394
 
40395
- case 'date':
40396
- field = React.createElement(FormFieldDate, data);
40397
- break;
40398
 
40399
- case 'reactComponent':
40400
- field = React.createElement(data.field.component, data);
40401
- break;
40402
 
40403
- default:
40404
- field = 'invalid';
40405
- break;
40406
- }
40407
 
40408
- if (inline === true) {
40409
- return React.createElement(
40410
- 'span',
40411
- { key: 'field-' + (data.index || 0) },
40412
- field,
40413
- description
40414
- );
40415
- }
40416
- return React.createElement(
40417
- 'div',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40418
  { key: 'field-' + (data.index || 0) },
40419
  field,
40420
  description
40421
  );
40422
- },
40423
- render: function render() {
40424
- var _this = this;
 
 
 
 
 
 
 
40425
 
40426
- var field = false;
40427
 
40428
- if (this.props.field.fields !== undefined) {
40429
- field = this.props.field.fields.map(function (subfield, index) {
40430
- return _this.renderField({
40431
- index: index,
40432
- field: subfield,
40433
- item: _this.props.item,
40434
- onValueChange: _this.props.onValueChange || false
40435
- });
40436
  });
40437
- } else {
40438
- field = this.renderField(this.props);
40439
- }
40440
-
40441
- var tip = false;
40442
- if (this.props.field.tip) {
40443
- tip = React.createElement(
40444
- 'p',
40445
- { className: 'description' },
40446
- this.props.field.tip
40447
- );
40448
- }
40449
 
40450
- return React.createElement(
40451
- 'tr',
40452
- { className: 'form-field-row-' + this.props.field.name },
40453
- React.createElement(
40454
- 'th',
40455
- { scope: 'row' },
40456
- React.createElement(
40457
- 'label',
40458
- {
40459
- htmlFor: 'field_' + this.props.field.name
40460
- },
40461
- this.props.field.label,
40462
- tip
40463
- )
40464
- ),
40465
- React.createElement(
40466
- 'td',
40467
- null,
40468
- field
40469
- )
40470
  );
40471
  }
40472
- });
40473
 
40474
- return FormField;
40475
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40476
 
40477
  /***/ },
40478
  /* 298 */
@@ -40548,30 +40795,50 @@ webpackJsonp([1],[
40548
  /* 300 */
40549
  /***/ function(module, exports, __webpack_require__) {
40550
 
40551
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
 
 
 
 
40552
 
40553
  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; };
40554
 
40555
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React) {
40556
- var FormFieldTextarea = React.createClass({
40557
- displayName: "FormFieldTextarea",
40558
 
40559
- render: function render() {
40560
- return React.createElement("textarea", _extends({
40561
- type: "text",
40562
- className: "regular-text",
40563
- name: this.props.field.name,
40564
- id: "field_" + this.props.field.name,
40565
- value: this.props.item[this.props.field.name],
40566
- placeholder: this.props.field.placeholder,
40567
- defaultValue: this.props.field.defaultValue,
40568
- onChange: this.props.onValueChange
40569
- }, this.props.field.validation));
40570
- }
40571
- });
40572
 
40573
- return FormFieldTextarea;
40574
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40575
 
40576
  /***/ },
40577
  /* 301 */
@@ -40637,11 +40904,11 @@ webpackJsonp([1],[
40637
  var options = keys.filter(function (value) {
40638
  if (filter === false) return true;
40639
  return filter(_this.props.item, value);
40640
- }).map(function (value, index) {
40641
  return _react2['default'].createElement(
40642
  'option',
40643
  {
40644
- key: 'option-' + index,
40645
  value: value
40646
  },
40647
  _this.props.field.values[value]
@@ -40668,399 +40935,470 @@ webpackJsonp([1],[
40668
  /* 302 */
40669
  /***/ function(module, exports, __webpack_require__) {
40670
 
40671
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
40672
 
40673
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React) {
40674
- var FormFieldRadio = React.createClass({
40675
- displayName: "FormFieldRadio",
40676
 
40677
- render: function render() {
40678
- var _this = this;
40679
 
40680
- if (this.props.field.values === undefined) {
40681
- return false;
40682
- }
40683
 
40684
- var selectedValue = this.props.item[this.props.field.name];
40685
- var options = Object.keys(this.props.field.values).map(function (value, index) {
40686
- return React.createElement(
40687
- "p",
40688
- { key: "radio-" + index },
40689
- React.createElement(
40690
- "label",
40691
- { htmlFor: _this.props.field.name },
40692
- React.createElement("input", {
40693
- type: "radio",
40694
- checked: selectedValue === value,
40695
- value: value,
40696
- onChange: _this.props.onValueChange,
40697
- name: _this.props.field.name,
40698
- id: _this.props.field.name
40699
- }),
40700
- _this.props.field.values[value]
40701
- )
40702
- );
40703
- });
40704
 
40705
- return React.createElement(
40706
- "div",
40707
- null,
40708
- options
40709
- );
 
 
 
40710
  }
40711
- });
40712
 
40713
- return FormFieldRadio;
40714
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40715
 
40716
  /***/ },
40717
  /* 303 */
40718
  /***/ function(module, exports, __webpack_require__) {
40719
 
40720
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
40721
 
40722
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React) {
40723
- var FormFieldCheckbox = React.createClass({
40724
- displayName: 'FormFieldCheckbox',
40725
 
40726
- onValueChange: function onValueChange(e) {
40727
- e.target.value = this.checkbox.checked ? '1' : '0';
40728
- return this.props.onValueChange(e);
40729
- },
40730
- render: function render() {
40731
- var _this = this;
40732
 
40733
- if (this.props.field.values === undefined) {
40734
- return false;
40735
- }
40736
 
40737
- // isChecked will be true only if the value is "1"
40738
- // it will be false in case value is "0" or empty
40739
- var isChecked = !!Number(this.props.item[this.props.field.name]);
40740
- var options = Object.keys(this.props.field.values).map(function (value, index) {
40741
- return React.createElement(
40742
- 'p',
40743
- { key: 'checkbox-' + index },
40744
- React.createElement(
40745
- 'label',
40746
- { htmlFor: _this.props.field.name },
40747
- React.createElement('input', {
40748
- ref: function (c) {
40749
- _this.checkbox = c;
40750
- },
40751
- type: 'checkbox',
40752
- value: '1',
40753
- checked: isChecked,
40754
- onChange: _this.onValueChange,
40755
- name: _this.props.field.name,
40756
- id: _this.props.field.name
40757
- }),
40758
- _this.props.field.values[value]
40759
- )
40760
- );
40761
- });
40762
 
40763
- return React.createElement(
40764
- 'div',
40765
- null,
40766
- options
40767
- );
 
 
 
 
 
 
 
40768
  }
40769
- });
40770
 
40771
- return FormFieldCheckbox;
40772
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40773
 
40774
  /***/ },
40775
  /* 304 */
40776
  /***/ function(module, exports, __webpack_require__) {
40777
 
40778
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
 
 
 
 
40779
 
40780
  var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
40781
 
40782
  var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
40783
 
 
 
40784
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
40785
 
40786
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
40787
 
40788
  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
40789
 
40790
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(305)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Moment) {
40791
- function FormFieldDateYear(props) {
40792
- var yearsRange = 100;
40793
- var years = [];
40794
 
40795
- if (props.placeholder !== undefined) {
40796
- years.push(React.createElement(
40797
- 'option',
40798
- { value: '', key: 0 },
40799
- props.placeholder
40800
- ));
40801
- }
40802
 
40803
- var currentYear = Moment().year();
40804
- for (var i = currentYear; i >= currentYear - yearsRange; i -= 1) {
40805
- years.push(React.createElement(
40806
- 'option',
40807
- {
40808
- key: i,
40809
- value: i
40810
- },
40811
- i
40812
- ));
40813
- }
40814
- return React.createElement(
40815
- 'select',
 
 
 
 
 
 
 
 
 
 
 
40816
  {
40817
- name: props.name + '[year]',
40818
- value: props.year,
40819
- onChange: props.onValueChange
40820
  },
40821
- years
40822
- );
40823
  }
 
 
 
 
 
 
 
 
 
 
40824
 
40825
- function FormFieldDateMonth(props) {
40826
- var months = [];
 
 
 
 
40827
 
40828
- if (props.placeholder !== undefined) {
40829
- months.push(React.createElement(
40830
- 'option',
40831
- { value: '', key: 0 },
40832
- props.placeholder
40833
- ));
40834
- }
40835
 
40836
- for (var i = 1; i <= 12; i += 1) {
40837
- months.push(React.createElement(
40838
- 'option',
40839
- {
40840
- key: i,
40841
- value: i
40842
- },
40843
- props.monthNames[i - 1]
40844
- ));
40845
- }
40846
- return React.createElement(
40847
- 'select',
40848
  {
40849
- name: props.name + '[month]',
40850
- value: props.month,
40851
- onChange: props.onValueChange
40852
  },
40853
- months
40854
- );
40855
  }
 
 
 
 
 
 
 
 
 
 
40856
 
40857
- function FormFieldDateDay(props) {
40858
- var days = [];
 
 
 
 
 
40859
 
40860
- if (props.placeholder !== undefined) {
40861
- days.push(React.createElement(
40862
- 'option',
40863
- { value: '', key: 0 },
40864
- props.placeholder
40865
- ));
40866
- }
40867
 
40868
- for (var i = 1; i <= 31; i += 1) {
40869
- days.push(React.createElement(
40870
- 'option',
40871
- {
40872
- key: i,
40873
- value: i
40874
- },
40875
- i
40876
- ));
40877
- }
40878
 
40879
- return React.createElement(
40880
- 'select',
 
40881
  {
40882
- name: props.name + '[day]',
40883
- value: props.day,
40884
- onChange: props.onValueChange
40885
  },
40886
- days
40887
- );
40888
  }
40889
 
40890
- var FormFieldDate = (function (_React$Component) {
40891
- _inherits(FormFieldDate, _React$Component);
 
 
 
 
 
 
 
 
40892
 
40893
- function FormFieldDate(props) {
40894
- _classCallCheck(this, FormFieldDate);
 
 
 
 
40895
 
40896
- _get(Object.getPrototypeOf(FormFieldDate.prototype), 'constructor', this).call(this, props);
40897
- this.state = {
40898
- year: '',
40899
- month: '',
40900
- day: ''
40901
- };
40902
- }
 
 
 
 
 
40903
 
40904
- _createClass(FormFieldDate, [{
40905
- key: 'componentDidMount',
40906
- value: function componentDidMount() {
 
 
 
 
 
 
 
 
 
40907
  this.extractDateParts();
40908
  }
40909
- }, {
40910
- key: 'componentDidUpdate',
40911
- value: function componentDidUpdate(prevProps) {
40912
- if (this.props.item !== undefined && prevProps.item !== undefined && this.props.item.id !== prevProps.item.id) {
40913
- this.extractDateParts();
40914
- }
40915
- }
40916
- }, {
40917
- key: 'extractDateParts',
40918
- value: function extractDateParts() {
40919
- var value = this.props.item[this.props.field.name] !== undefined ? this.props.item[this.props.field.name].trim() : '';
40920
 
40921
- if (value === '') {
40922
- return;
40923
- }
 
40924
 
40925
- var dateTime = Moment(value);
 
 
40926
 
40927
- this.setState({
40928
- year: dateTime.format('YYYY'),
40929
- month: dateTime.format('M'),
40930
- day: dateTime.format('D')
 
 
 
 
 
40931
  });
40932
  }
40933
- }, {
40934
- key: 'formatValue',
40935
- value: function formatValue() {
40936
- var dateType = this.props.field.params.date_type;
40937
-
40938
- var value = undefined;
40939
-
40940
- switch (dateType) {
40941
- case 'year_month_day':
40942
- value = {
40943
- year: this.state.year,
40944
- month: this.state.month,
40945
- day: this.state.day
40946
- };
40947
- break;
40948
-
40949
- case 'year_month':
40950
- value = {
40951
- year: this.state.year,
40952
- month: this.state.month
40953
- };
40954
- break;
40955
 
40956
- case 'month':
40957
- value = {
40958
- month: this.state.month
40959
- };
40960
- break;
 
40961
 
40962
- case 'year':
40963
- value = {
40964
- year: this.state.year
40965
- };
40966
- break;
40967
- default:
40968
- value = {
40969
- value: 'invalid type'
40970
- };
40971
- break;
40972
- }
40973
 
40974
- return value;
 
 
 
 
 
 
 
 
 
40975
  }
40976
- }, {
40977
- key: 'onValueChange',
40978
- value: function onValueChange(e) {
40979
- var _this = this;
40980
-
40981
- // extract property from name
40982
- var matches = e.target.name.match(/(.*?)\[(.*?)\]/);
40983
- var field = null;
40984
- var property = null;
40985
-
40986
- if (matches !== null && matches.length === 3) {
40987
- field = matches[1];
40988
- property = matches[2];
40989
-
40990
- var value = Number(e.target.value);
40991
-
40992
- this.setState(_defineProperty({}, '' + property, value), function () {
40993
- _this.props.onValueChange({
40994
- target: {
40995
- name: field,
40996
- value: _this.formatValue()
40997
- }
40998
- });
40999
- });
41000
- }
41001
  }
41002
- }, {
41003
- key: 'render',
41004
- value: function render() {
41005
- var _this2 = this;
41006
-
41007
- var monthNames = window.mailpoet_month_names || [];
41008
- var dateFormats = window.mailpoet_date_formats || {};
41009
- var dateType = this.props.field.params.date_type;
41010
- var dateSelects = dateFormats[dateType][0].split('/');
41011
-
41012
- var fields = dateSelects.map(function (type) {
41013
- switch (type) {
41014
- case 'YYYY':
41015
- return React.createElement(FormFieldDateYear, {
41016
- onValueChange: _this2.onValueChange.bind(_this2),
41017
- key: 'year',
41018
- name: _this2.props.field.name,
41019
- year: _this2.state.year,
41020
- placeholder: _this2.props.field.year_placeholder
41021
- });
41022
 
41023
- case 'MM':
41024
- return React.createElement(FormFieldDateMonth, {
41025
- onValueChange: _this2.onValueChange.bind(_this2),
41026
- key: 'month',
41027
- name: _this2.props.field.name,
41028
- month: _this2.state.month,
41029
- monthNames: monthNames,
41030
- placeholder: _this2.props.field.month_placeholder
41031
- });
41032
 
41033
- case 'DD':
41034
- return React.createElement(FormFieldDateDay, {
41035
- onValueChange: _this2.onValueChange.bind(_this2),
41036
- key: 'day',
41037
- name: _this2.props.field.name,
41038
- day: _this2.state.day,
41039
- placeholder: _this2.props.field.day_placeholder
41040
- });
 
 
41041
 
41042
- default:
41043
- return React.createElement(
41044
- 'div',
41045
- null,
41046
- 'Invalid date type'
41047
- );
41048
- }
41049
- });
 
 
 
 
 
 
 
41050
 
41051
- return React.createElement(
41052
- 'div',
41053
- null,
41054
- fields
41055
- );
41056
- }
41057
- }]);
 
 
41058
 
41059
- return FormFieldDate;
41060
- })(React.Component);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41061
 
41062
  return FormFieldDate;
41063
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41064
 
41065
  /***/ },
41066
  /* 305 */
@@ -58115,72 +58453,84 @@ webpackJsonp([1],[
58115
  /* 437 */
58116
  /***/ function(module, exports, __webpack_require__) {
58117
 
58118
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
58119
 
58120
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(181), __webpack_require__(277), __webpack_require__(276)], __WEBPACK_AMD_DEFINE_RESULT__ = function (React, Router, classNames, MailPoet) {
58121
- var Link = Router.Link;
58122
 
58123
- var Breadcrumb = React.createClass({
58124
- displayName: 'Breadcrumb',
58125
 
58126
- getInitialState: function getInitialState() {
58127
- var steps = this.props.steps || [{
58128
- name: 'type',
58129
- label: MailPoet.I18n.t('selectType'),
58130
- link: '/new'
58131
- }, {
58132
- name: 'template',
58133
- label: MailPoet.I18n.t('template')
58134
- }, {
58135
- name: 'editor',
58136
- label: MailPoet.I18n.t('designer')
58137
- }, {
58138
- name: 'send',
58139
- label: MailPoet.I18n.t('send')
58140
- }];
58141
- return {
58142
- step: null,
58143
- steps: steps
58144
- };
58145
- },
58146
- render: function render() {
58147
- var _this = this;
58148
 
58149
- var steps = this.state.steps.map(function (step, index) {
58150
- var stepClasses = classNames({ mailpoet_current: _this.props.step === step.name });
58151
 
58152
- var label = step.label;
58153
 
58154
- if (step.link !== undefined && _this.props.step !== step.name) {
58155
- label = React.createElement(
58156
- Link,
58157
- { to: step.link },
58158
- step.label
58159
- );
58160
- }
58161
 
58162
- return React.createElement(
58163
- 'span',
58164
- { key: 'step-' + index },
58165
- React.createElement(
58166
- 'span',
58167
- { className: stepClasses },
58168
- label
58169
- ),
58170
- index < _this.state.steps.length - 1 ? ' > ' : ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58171
  );
58172
- });
58173
 
58174
- return React.createElement(
58175
- 'p',
58176
- { className: 'mailpoet_breadcrumb' },
58177
- steps
 
 
 
 
 
58178
  );
58179
- }
58180
- });
58181
 
58182
- return Breadcrumb;
58183
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 
 
 
 
 
 
 
58184
 
58185
  /***/ },
58186
  /* 438 */,
@@ -59647,17 +59997,18 @@ webpackJsonp([1],[
59647
  /* 525 */,
59648
  /* 526 */,
59649
  /* 527 */,
59650
- /* 528 */
 
59651
  /***/ function(module, exports, __webpack_require__) {
59652
 
59653
  /* WEBPACK VAR INJECTION */(function(global) {"use strict";
59654
 
59655
  if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
59656
- module.exports = global["MailPoetLib"]["NewsletterWelcomeNotificationScheduling"] = __webpack_require__(529);
59657
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
59658
 
59659
  /***/ },
59660
- /* 529 */
59661
  /***/ function(module, exports, __webpack_require__) {
59662
 
59663
  'use strict';
@@ -59684,7 +60035,7 @@ webpackJsonp([1],[
59684
 
59685
  var _formFieldsTextJsx2 = _interopRequireDefault(_formFieldsTextJsx);
59686
 
59687
- var _newslettersSchedulingCommonJsx = __webpack_require__(530);
59688
 
59689
  var availableRoles = window.mailpoet_roles || {};
59690
  var availableSegments = _underscore2['default'].filter(window.mailpoet_segments || [], function (segment) {
@@ -59835,17 +60186,17 @@ webpackJsonp([1],[
59835
  module.exports = WelcomeScheduling;
59836
 
59837
  /***/ },
59838
- /* 530 */
59839
  /***/ function(module, exports, __webpack_require__) {
59840
 
59841
  /* WEBPACK VAR INJECTION */(function(global) {"use strict";
59842
 
59843
  if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
59844
- module.exports = global["MailPoetLib"]["NewsletterSchedulingCommonOptions"] = __webpack_require__(531);
59845
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
59846
 
59847
  /***/ },
59848
- /* 531 */
59849
  /***/ function(module, exports, __webpack_require__) {
59850
 
59851
  'use strict';
@@ -59939,7 +60290,6 @@ webpackJsonp([1],[
59939
  exports.nthWeekDayValues = nthWeekDayValues;
59940
 
59941
  /***/ },
59942
- /* 532 */,
59943
  /* 533 */,
59944
  /* 534 */,
59945
  /* 535 */,
@@ -59988,6 +60338,10 @@ webpackJsonp([1],[
59988
 
59989
  var _underscore2 = _interopRequireDefault(_underscore);
59990
 
 
 
 
 
59991
  var AutomaticEmailEventsList = (function (_React$Component) {
59992
  _inherits(AutomaticEmailEventsList, _React$Component);
59993
 
@@ -60016,7 +60370,8 @@ webpackJsonp([1],[
60016
  if (_this.email.premium) {
60017
  action = _react2['default'].createElement(
60018
  'a',
60019
- { href: '?page=mailpoet-premium',
 
60020
  target: '_blank'
60021
  },
60022
  _mailpoet2['default'].I18n.t('premiumFeatureLink')
@@ -60026,7 +60381,8 @@ webpackJsonp([1],[
60026
 
60027
  action = _react2['default'].createElement(
60028
  'a',
60029
- { className: 'button button-primary',
 
60030
  disabled: disabled,
60031
  onClick: !disabled ? _this.eventsConfigurator.bind(null, event.slug) : null
60032
  },
@@ -60110,6 +60466,20 @@ webpackJsonp([1],[
60110
  return AutomaticEmailEventsList;
60111
  })(_react2['default'].Component);
60112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60113
  module.exports = AutomaticEmailEventsList;
60114
 
60115
  /***/ },
@@ -60142,6 +60512,10 @@ webpackJsonp([1],[
60142
 
60143
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
60144
 
 
 
 
 
60145
  function AutomaticEmailsBreadcrumb(props) {
60146
  var steps = [{
60147
  name: 'type',
@@ -60167,6 +60541,10 @@ webpackJsonp([1],[
60167
  return _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: props.step, steps: steps });
60168
  }
60169
 
 
 
 
 
60170
  module.exports = AutomaticEmailsBreadcrumb;
60171
 
60172
  /***/ },
@@ -60230,13 +60608,13 @@ webpackJsonp([1],[
60230
  render: function render() {
60231
  var _this = this;
60232
 
60233
- var tabs = this.state.tabs.map(function (tab, index) {
60234
  var tabClasses = (0, _classnames2['default'])('nav-tab', { 'nav-tab-active': _this.props.tab === tab.name });
60235
 
60236
  return _react2['default'].createElement(
60237
  _reactRouter.Link,
60238
  {
60239
- key: 'tab-' + index,
60240
  className: tabClasses,
60241
  to: tab.link,
60242
  onClick: function () {
@@ -60309,6 +60687,10 @@ webpackJsonp([1],[
60309
 
60310
  var _jquery2 = _interopRequireDefault(_jquery);
60311
 
 
 
 
 
60312
  var _wpJsHooks = __webpack_require__(433);
60313
 
60314
  var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
@@ -60393,6 +60775,7 @@ webpackJsonp([1],[
60393
  _mailpoet2['default'].I18n.t('newsletterQueueCompleted').replace('%$1d', parseInt(newsletter.queue.count_processed, 10).toLocaleString()).replace('%$2d', parseInt(newsletter.queue.count_total, 10).toLocaleString())
60394
  );
60395
  } else {
 
60396
  label = _react2['default'].createElement(
60397
  'span',
60398
  null,
@@ -60407,7 +60790,7 @@ webpackJsonp([1],[
60407
  className: 'button',
60408
  style: { display: newsletter.queue.status === 'paused' ? 'inline-block' : 'none' },
60409
  href: 'javascript:;',
60410
- onClick: this.resumeSending.bind(null, newsletter)
60411
  },
60412
  _mailpoet2['default'].I18n.t('resume')
60413
  ),
@@ -60418,7 +60801,7 @@ webpackJsonp([1],[
60418
  className: 'button mailpoet_pause',
60419
  style: { display: newsletter.queue.status === null ? 'inline-block' : 'none' },
60420
  href: 'javascript:;',
60421
- onClick: this.pauseSending.bind(null, newsletter)
60422
  },
60423
  _mailpoet2['default'].I18n.t('pause')
60424
  )
@@ -60756,7 +61139,8 @@ webpackJsonp([1],[
60756
  null,
60757
  _react2['default'].createElement(
60758
  'a',
60759
- { href: 'javascript:;',
 
60760
  className: 'button',
60761
  onClick: this.resumeMailerSending
60762
  },
@@ -60832,6 +61216,10 @@ webpackJsonp([1],[
60832
 
60833
  var _react2 = _interopRequireDefault(_react);
60834
 
 
 
 
 
60835
  var _badgeJsx = __webpack_require__(551);
60836
 
60837
  var _badgeJsx2 = _interopRequireDefault(_badgeJsx);
@@ -60940,6 +61328,17 @@ webpackJsonp([1],[
60940
  return StatsBadge;
60941
  })(_react2['default'].Component);
60942
 
 
 
 
 
 
 
 
 
 
 
 
60943
  exports['default'] = StatsBadge;
60944
  module.exports = exports['default'];
60945
 
@@ -60967,6 +61366,10 @@ webpackJsonp([1],[
60967
 
60968
  var _reactTooltip2 = _interopRequireDefault(_reactTooltip);
60969
 
 
 
 
 
60970
  function Badge(props) {
60971
  var badgeClasses = (0, _classnames2['default'])('mailpoet_badge', props.type ? 'mailpoet_badge_' + props.type : '');
60972
 
@@ -60994,6 +61397,19 @@ webpackJsonp([1],[
60994
  );
60995
  }
60996
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60997
  exports['default'] = Badge;
60998
  module.exports = exports['default'];
60999
 
14
  __webpack_require__(547);
15
  __webpack_require__(540);
16
  __webpack_require__(542);
17
+ __webpack_require__(529);
18
  __webpack_require__(575);
19
  __webpack_require__(244);
20
  module.exports = __webpack_require__(277);
30825
  if (action.name === 'trash') {
30826
  customAction = _react2['default'].createElement(
30827
  'span',
30828
+ { key: 'action-' + action.name, className: 'trash' },
30829
  !isFirst ? ' | ' : '',
30830
  _react2['default'].createElement(
30831
  'a',
30832
  {
30833
  href: 'javascript:;',
30834
+ onClick: function () {
30835
+ return _this.handleTrashItem(_this.props.item.id);
30836
+ }
30837
  },
30838
  _mailpoet2['default'].I18n.t('moveToTrash')
30839
  )
30843
  'span',
30844
  {
30845
  onClick: _this.props.onRefreshItems,
30846
+ key: 'action-' + action.name,
30847
+ className: action.name,
30848
  role: 'button',
30849
  tabIndex: index
30850
  },
30855
  customAction = _react2['default'].createElement(
30856
  'span',
30857
  {
30858
+ key: 'action-' + action.name,
30859
+ className: action.name
30860
  },
30861
  !isFirst ? ' | ' : '',
30862
  action.link(_this.props.item)
30865
  customAction = _react2['default'].createElement(
30866
  'span',
30867
  {
30868
+ key: 'action-' + action.name,
30869
+ className: action.name
30870
  },
30871
  !isFirst ? ' | ' : '',
30872
  _react2['default'].createElement(
30873
  'a',
30874
+ {
30875
+ href: 'javascript:;',
30876
+ onClick: action.onClick !== undefined ? function () {
30877
+ return action.onClick(_this.props.item, _this.props.onRefreshItems);
30878
+ } : false
30879
  },
30880
  action.label
30881
  )
30917
  'a',
30918
  {
30919
  href: 'javascript:;',
30920
+ onClick: function () {
30921
+ return _this.handleRestoreItem(_this.props.item.id);
30922
+ }
30923
  },
30924
  _mailpoet2['default'].I18n.t('restore')
30925
  )
30933
  {
30934
  className: 'submitdelete',
30935
  href: 'javascript:;',
30936
+ onClick: function () {
30937
+ return _this.handleDeleteItem(_this.props.item.id);
30938
+ }
30939
  },
30940
  _mailpoet2['default'].I18n.t('deletePermanently')
30941
  )
30944
  _react2['default'].createElement(
30945
  'button',
30946
  {
30947
+ onClick: function () {
30948
+ return _this.handleToggleItem(_this.props.item.id);
30949
+ },
30950
+ className: 'toggle-row',
30951
+ type: 'button'
30952
  },
30953
  _react2['default'].createElement(
30954
  'span',
30969
  _react2['default'].createElement(
30970
  'button',
30971
  {
30972
+ onClick: function () {
30973
+ return _this.handleToggleItem(_this.props.item.id);
30974
+ },
30975
+ className: 'toggle-row',
30976
+ type: 'button'
30977
  },
30978
  _react2['default'].createElement(
30979
  'span',
31051
  )
31052
  )
31053
  ),
31054
+ this.props.items.map(function (item) {
31055
  var renderItem = item;
31056
  renderItem.id = parseInt(item.id, 10);
31057
  renderItem.selected = _this2.props.selected_ids.indexOf(renderItem.id) !== -1;
31068
  is_selectable: _this2.props.is_selectable,
31069
  item_actions: _this2.props.item_actions,
31070
  group: _this2.props.group,
31071
+ key: 'item-' + renderItem.id + '-' + item.id,
31072
  item: renderItem
31073
  });
31074
  })
31235
  componentDidMount: function componentDidMount() {
31236
  var _this6 = this;
31237
 
31238
+ this.isComponentMounted = true;
31239
+ var params = this.props.params || {};
31240
+ this.initWithParams(params);
31241
 
31242
+ if (this.props.auto_refresh) {
31243
+ (0, _jquery2['default'])(document).on('heartbeat-tick.mailpoet', function () {
31244
+ _this6.getItems();
31245
+ });
 
31246
  }
31247
  },
31248
+ componentWillUnmount: function componentWillUnmount() {
31249
+ this.isComponentMounted = false;
31250
+ },
31251
  componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
31252
  var params = nextProps.params || {};
31253
  this.initWithParams(params);
31255
  getItems: function getItems() {
31256
  var _this7 = this;
31257
 
31258
+ if (this.isComponentMounted) {
31259
  this.setState({ loading: true });
31260
 
31261
  this.clearSelection();
33282
  /* 283 */
33283
  /***/ function(module, exports, __webpack_require__) {
33284
 
33285
+ 'use strict';
33286
 
33287
+ Object.defineProperty(exports, '__esModule', {
33288
+ value: true
33289
+ });
33290
 
33291
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
 
33292
 
33293
+ var _react = __webpack_require__(2);
 
 
 
 
33294
 
33295
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
33296
 
33297
+ var _mailpoet = __webpack_require__(276);
33298
 
33299
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
 
 
33300
 
33301
+ var ListingBulkActions = _react2['default'].createClass({
33302
+ displayName: 'ListingBulkActions',
33303
 
33304
+ getInitialState: function getInitialState() {
33305
+ return {
33306
+ action: false,
33307
+ extra: false
33308
+ };
33309
+ },
33310
+ handleChangeAction: function handleChangeAction(e) {
33311
+ var _this = this;
33312
 
33313
+ this.setState({
33314
+ action: e.target.value,
33315
+ extra: false
33316
+ }, function () {
33317
+ var action = _this.getSelectedAction();
33318
 
33319
+ // action on select callback
33320
+ if (action !== null && action.onSelect !== undefined) {
33321
+ _this.setState({
33322
+ extra: action.onSelect(e)
33323
+ });
33324
  }
33325
+ });
33326
+ },
33327
+ handleApplyAction: function handleApplyAction(e) {
33328
+ e.preventDefault();
33329
 
33330
+ var action = this.getSelectedAction();
33331
+
33332
+ if (action === null) {
33333
+ return;
33334
+ }
33335
+
33336
+ var selectedIds = this.props.selection !== 'all' ? this.props.selected_ids : [];
33337
+
33338
+ var data = action.getData !== undefined ? action.getData() : {};
33339
+
33340
+ data.action = this.state.action;
33341
+
33342
+ var onSuccess = function onSuccess() {};
33343
+ if (action.onSuccess !== undefined) {
33344
+ onSuccess = action.onSuccess;
33345
+ }
33346
+
33347
+ if (data.action) {
33348
+ var promise = this.props.onBulkAction(selectedIds, data);
33349
+ if (promise !== false) {
33350
+ promise.then(onSuccess);
33351
  }
33352
+ }
33353
 
33354
+ this.setState({
33355
+ action: false,
33356
+ extra: false
33357
+ });
33358
+ },
33359
+ getSelectedAction: function getSelectedAction() {
33360
+ var selectedAction = this.action.value;
33361
+ if (selectedAction.length > 0) {
33362
+ var action = this.props.bulk_actions.filter(function (act) {
33363
+ return act.name === selectedAction;
33364
  });
 
 
 
 
 
 
 
33365
 
33366
+ if (action.length > 0) {
33367
+ return action[0];
 
33368
  }
33369
+ }
33370
+ return null;
33371
+ },
33372
+ render: function render() {
33373
+ var _this2 = this;
33374
 
33375
+ if (this.props.bulk_actions.length === 0) {
33376
+ return null;
33377
+ }
33378
 
33379
+ return _react2['default'].createElement(
33380
+ 'div',
33381
+ { className: 'alignleft actions bulkactions' },
33382
+ _react2['default'].createElement(
33383
+ 'label',
33384
+ {
33385
+ className: 'screen-reader-text',
33386
+ htmlFor: 'bulk-action-selector-top'
33387
+ },
33388
+ _mailpoet2['default'].I18n.t('selectBulkAction')
33389
+ ),
33390
+ _react2['default'].createElement(
33391
+ 'select',
33392
+ {
33393
+ name: 'bulk_actions',
33394
+ ref: function (c) {
33395
+ _this2.action = c;
33396
  },
33397
+ value: this.state.action,
33398
+ onChange: this.handleChangeAction
33399
+ },
33400
+ _react2['default'].createElement(
33401
+ 'option',
33402
+ { value: '' },
33403
+ _mailpoet2['default'].I18n.t('bulkActions')
33404
  ),
33405
+ this.props.bulk_actions.map(function (action) {
33406
+ return _react2['default'].createElement(
 
 
 
 
 
 
 
 
 
33407
  'option',
33408
+ {
33409
+ value: action.name,
33410
+ key: 'action-' + action.name
33411
+ },
33412
+ action.label
33413
+ );
33414
+ })
33415
+ ),
33416
+ _react2['default'].createElement('input', {
33417
+ onClick: this.handleApplyAction,
33418
+ type: 'submit',
33419
+ defaultValue: _mailpoet2['default'].I18n.t('apply'),
33420
+ className: 'button action'
33421
+ }),
33422
+ this.state.extra
33423
+ );
33424
+ }
33425
+ });
 
 
 
 
 
 
33426
 
33427
+ exports['default'] = ListingBulkActions;
33428
+ module.exports = exports['default'];
33429
 
33430
  /***/ },
33431
  /* 284 */
33463
  return _react2['default'].createElement(ListingColumn, {
33464
  onSort: _this.props.onSort,
33465
  sort_by: _this.props.sort_by,
33466
+ key: 'column-' + column.name,
33467
  column: renderColumn
33468
  });
33469
  });
33553
  /* 285 */
33554
  /***/ function(module, exports, __webpack_require__) {
33555
 
33556
+ 'use strict';
33557
 
33558
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
33559
 
33560
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
33561
 
33562
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33563
 
33564
+ var _classnames = __webpack_require__(277);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33565
 
33566
+ var _classnames2 = _interopRequireDefault(_classnames);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33567
 
33568
+ var _mailpoet = __webpack_require__(276);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33569
 
33570
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33571
 
33572
+ var ListingPages = _react2['default'].createClass({
33573
+ displayName: 'ListingPages',
 
 
33574
 
33575
+ getInitialState: function getInitialState() {
33576
+ return {
33577
+ page: null
33578
+ };
33579
+ },
33580
+ setPage: function setPage(page) {
33581
+ var _this = this;
33582
+
33583
+ this.setState({
33584
+ page: null
33585
+ }, function () {
33586
+ _this.props.onSetPage(_this.constrainPage(page));
33587
+ });
33588
+ },
33589
+ setFirstPage: function setFirstPage() {
33590
+ this.setPage(1);
33591
+ },
33592
+ setLastPage: function setLastPage() {
33593
+ this.setPage(this.getLastPage());
33594
+ },
33595
+ setPreviousPage: function setPreviousPage() {
33596
+ this.setPage(this.constrainPage(parseInt(this.props.page, 10) - 1));
33597
+ },
33598
+ setNextPage: function setNextPage() {
33599
+ this.setPage(this.constrainPage(parseInt(this.props.page, 10) + 1));
33600
+ },
33601
+ constrainPage: function constrainPage(page) {
33602
+ return Math.min(Math.max(1, Math.abs(Number(page))), this.getLastPage());
33603
+ },
33604
+ handleSetManualPage: function handleSetManualPage(e) {
33605
+ if (e.which === 13) {
33606
+ this.setPage(this.state.page);
33607
+ }
33608
+ },
33609
+ handleChangeManualPage: function handleChangeManualPage(e) {
33610
+ this.setState({
33611
+ page: e.target.value
33612
+ });
33613
+ },
33614
+ handleBlurManualPage: function handleBlurManualPage(e) {
33615
+ this.setPage(e.target.value);
33616
+ },
33617
+ getLastPage: function getLastPage() {
33618
+ return Math.ceil(this.props.count / this.props.limit);
33619
+ },
33620
+ render: function render() {
33621
+ if (this.props.count === 0) {
33622
+ return false;
33623
+ }
33624
+ var pagination = false;
33625
+ var firstPage = _react2['default'].createElement(
33626
+ 'span',
33627
+ { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33628
+ '«'
33629
+ );
33630
+ var previousPage = _react2['default'].createElement(
33631
+ 'span',
33632
+ { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33633
+ '‹'
33634
+ );
33635
+ var nextPage = _react2['default'].createElement(
33636
+ 'span',
33637
+ { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33638
+ '›'
33639
+ );
33640
+ var lastPage = _react2['default'].createElement(
33641
+ 'span',
33642
+ { 'aria-hidden': 'true', className: 'tablenav-pages-navspan' },
33643
+ '»'
33644
+ );
33645
+
33646
+ if (this.props.limit > 0 && this.props.count > this.props.limit) {
33647
+ if (this.props.page > 1) {
33648
+ previousPage = _react2['default'].createElement(
33649
+ 'a',
33650
+ {
33651
+ href: 'javascript:;',
33652
+ onClick: this.setPreviousPage,
33653
+ className: 'prev-page'
33654
+ },
33655
+ _react2['default'].createElement(
33656
  'span',
33657
+ { className: 'screen-reader-text' },
33658
+ _mailpoet2['default'].I18n.t('previousPage')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33659
  ),
33660
+ _react2['default'].createElement(
33661
+ 'span',
33662
+ { 'aria-hidden': 'true' },
33663
+ '‹'
33664
+ )
33665
+ );
33666
+ }
33667
+
33668
+ if (this.props.page > 2) {
33669
+ firstPage = _react2['default'].createElement(
33670
+ 'a',
33671
+ {
33672
+ href: 'javascript:;',
33673
+ onClick: this.setFirstPage,
33674
+ className: 'first-page'
33675
+ },
33676
+ _react2['default'].createElement(
33677
+ 'span',
33678
+ { className: 'screen-reader-text' },
33679
+ _mailpoet2['default'].I18n.t('firstPage')
33680
+ ),
33681
+ _react2['default'].createElement(
33682
+ 'span',
33683
+ { 'aria-hidden': 'true' },
33684
+ '«'
33685
+ )
33686
  );
33687
  }
33688
 
33689
+ if (this.props.page < this.getLastPage()) {
33690
+ nextPage = _react2['default'].createElement(
33691
+ 'a',
33692
+ {
33693
+ href: 'javascript:;',
33694
+ onClick: this.setNextPage,
33695
+ className: 'next-page'
33696
+ },
33697
+ _react2['default'].createElement(
33698
+ 'span',
33699
+ { className: 'screen-reader-text' },
33700
+ _mailpoet2['default'].I18n.t('nextPage')
33701
+ ),
33702
+ _react2['default'].createElement(
33703
+ 'span',
33704
+ { 'aria-hidden': 'true' },
33705
+ '›'
33706
+ )
33707
+ );
33708
+ }
33709
 
33710
+ if (this.props.page < this.getLastPage() - 1) {
33711
+ lastPage = _react2['default'].createElement(
33712
+ 'a',
33713
+ {
33714
+ href: 'javascript:;',
33715
+ onClick: this.setLastPage,
33716
+ className: 'last-page'
33717
+ },
33718
+ _react2['default'].createElement(
33719
+ 'span',
33720
+ { className: 'screen-reader-text' },
33721
+ _mailpoet2['default'].I18n.t('lastPage')
33722
+ ),
33723
+ _react2['default'].createElement(
33724
+ 'span',
33725
+ { 'aria-hidden': 'true' },
33726
+ '»'
33727
+ )
33728
+ );
33729
  }
33730
 
33731
+ var pageValue = this.props.page;
33732
+ if (this.state.page !== null) {
33733
+ pageValue = this.state.page;
33734
+ }
33735
+
33736
+ pagination = _react2['default'].createElement(
33737
+ 'span',
33738
+ { className: 'pagination-links' },
33739
+ firstPage,
33740
+ ' ',
33741
+ previousPage,
33742
+ ' ',
33743
+ _react2['default'].createElement(
33744
  'span',
33745
+ { className: 'paging-input' },
33746
+ _react2['default'].createElement(
33747
+ 'label',
33748
+ {
33749
+ className: 'screen-reader-text',
33750
+ htmlFor: 'current-page-selector'
33751
+ },
33752
+ _mailpoet2['default'].I18n.t('currentPage')
33753
+ ),
33754
+ _react2['default'].createElement('input', {
33755
+ type: 'text',
33756
+ onChange: this.handleChangeManualPage,
33757
+ onKeyUp: this.handleSetManualPage,
33758
+ onBlur: this.handleBlurManualPage,
33759
+ 'aria-describedby': 'table-paging',
33760
+ size: '2',
33761
+ value: pageValue,
33762
+ name: 'paged',
33763
+ id: 'current-page-selector',
33764
+ className: 'current-page'
33765
+ }),
33766
+ _mailpoet2['default'].I18n.t('pageOutOf'),
33767
+ ' ',
33768
+ _react2['default'].createElement(
33769
+ 'span',
33770
+ { className: 'total-pages' },
33771
+ Math.ceil(this.props.count / this.props.limit).toLocaleString()
33772
+ )
33773
  ),
33774
+ ' ',
33775
+ nextPage,
33776
+ ' ',
33777
+ lastPage
33778
  );
33779
  }
 
33780
 
33781
+ var classes = (0, _classnames2['default'])('tablenav-pages', { 'one-page': this.props.count <= this.props.limit });
33782
+
33783
+ var numberOfItemsLabel = undefined;
33784
+ if (Number(this.props.count) === 1) {
33785
+ numberOfItemsLabel = _mailpoet2['default'].I18n.t('numberOfItemsSingular');
33786
+ } else {
33787
+ numberOfItemsLabel = _mailpoet2['default'].I18n.t('numberOfItemsMultiple').replace('%$1d', parseInt(this.props.count, 10).toLocaleString());
33788
+ }
33789
+
33790
+ return _react2['default'].createElement(
33791
+ 'div',
33792
+ { className: classes },
33793
+ _react2['default'].createElement(
33794
+ 'span',
33795
+ { className: 'displaying-num' },
33796
+ numberOfItemsLabel
33797
+ ),
33798
+ pagination
33799
+ );
33800
+ }
33801
+ });
33802
+
33803
+ module.exports = ListingPages;
33804
 
33805
  /***/ },
33806
  /* 286 */
33807
  /***/ function(module, exports, __webpack_require__) {
33808
 
33809
+ 'use strict';
33810
+
33811
+ Object.defineProperty(exports, '__esModule', {
33812
+ value: true
33813
+ });
33814
+
33815
+ var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
33816
+
33817
+ var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
33818
+
33819
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
33820
+
33821
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
33822
+
33823
+ function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
33824
+
33825
+ var _react = __webpack_require__(2);
33826
+
33827
+ var _react2 = _interopRequireDefault(_react);
33828
+
33829
+ var _mailpoet = __webpack_require__(276);
33830
+
33831
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
33832
+
33833
+ var _propTypes = __webpack_require__(185);
33834
+
33835
+ var _propTypes2 = _interopRequireDefault(_propTypes);
33836
 
33837
+ var ListingSearch = (function (_React$Component) {
33838
+ _inherits(ListingSearch, _React$Component);
33839
+
33840
+ function ListingSearch() {
33841
+ _classCallCheck(this, ListingSearch);
33842
+
33843
+ _get(Object.getPrototypeOf(ListingSearch.prototype), 'constructor', this).apply(this, arguments);
33844
+ }
33845
 
33846
+ _createClass(ListingSearch, [{
33847
+ key: 'componentWillReceiveProps',
33848
+ value: function componentWillReceiveProps(nextProps) {
33849
+ this.search.value = nextProps.search;
33850
+ }
33851
+ }, {
33852
+ key: 'handleSearch',
33853
+ value: function handleSearch(e) {
33854
  e.preventDefault();
33855
  this.props.onSearch(this.search.value.trim());
33856
+ }
33857
+ }, {
33858
+ key: 'render',
33859
+ value: function render() {
 
33860
  var _this = this;
33861
 
33862
  if (this.props.search === false) {
33863
  return false;
33864
  }
33865
+ return _react2['default'].createElement(
33866
  'form',
33867
  { name: 'search', onSubmit: this.handleSearch },
33868
+ _react2['default'].createElement(
33869
  'p',
33870
  { className: 'search-box' },
33871
+ _react2['default'].createElement(
33872
  'label',
33873
  { htmlFor: 'search_input', className: 'screen-reader-text' },
33874
+ _mailpoet2['default'].I18n.t('searchLabel')
33875
  ),
33876
+ _react2['default'].createElement('input', {
33877
  type: 'search',
33878
  id: 'search_input',
33879
  ref: function (c) {
33882
  name: 's',
33883
  defaultValue: this.props.search
33884
  }),
33885
+ _react2['default'].createElement('input', {
33886
  type: 'submit',
33887
+ defaultValue: _mailpoet2['default'].I18n.t('searchLabel'),
33888
  className: 'button'
33889
  })
33890
  )
33891
  );
33892
  }
33893
+ }]);
33894
 
33895
  return ListingSearch;
33896
+ })(_react2['default'].Component);
33897
+
33898
+ ListingSearch.propTypes = {
33899
+ search: _propTypes2['default'].string.isRequired,
33900
+ onSearch: _propTypes2['default'].func.isRequired
33901
+ };
33902
+
33903
+ exports['default'] = ListingSearch;
33904
+ module.exports = exports['default'];
33905
 
33906
  /***/ },
33907
  /* 287 */
33908
  /***/ function(module, exports, __webpack_require__) {
33909
 
33910
+ 'use strict';
33911
 
33912
+ Object.defineProperty(exports, '__esModule', {
33913
+ value: true
33914
+ });
33915
+
33916
+ var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
33917
+
33918
+ var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
33919
+
33920
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
33921
+
33922
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
33923
+
33924
+ function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
33925
 
33926
+ var _react = __webpack_require__(2);
33927
+
33928
+ var _react2 = _interopRequireDefault(_react);
33929
+
33930
+ var _classnames = __webpack_require__(277);
33931
+
33932
+ var _classnames2 = _interopRequireDefault(_classnames);
33933
+
33934
+ var _propTypes = __webpack_require__(185);
33935
+
33936
+ var _propTypes2 = _interopRequireDefault(_propTypes);
33937
+
33938
+ var ListingGroups = (function (_React$Component) {
33939
+ _inherits(ListingGroups, _React$Component);
33940
+
33941
+ function ListingGroups(props) {
33942
+ _classCallCheck(this, ListingGroups);
33943
+
33944
+ _get(Object.getPrototypeOf(ListingGroups.prototype), 'constructor', this).call(this, props);
33945
+ this.handleSelect = this.handleSelect.bind(this);
33946
+ }
33947
+
33948
+ _createClass(ListingGroups, [{
33949
+ key: 'handleSelect',
33950
+ value: function handleSelect(group) {
33951
  return this.props.onSelectGroup(group);
33952
+ }
33953
+ }, {
33954
+ key: 'render',
33955
+ value: function render() {
33956
  var _this = this;
33957
 
33958
  var groups = this.props.groups.map(function (group, index) {
33960
  return false;
33961
  }
33962
 
33963
+ var classes = (0, _classnames2['default'])({ current: group.name === _this.props.group });
33964
 
33965
+ return _react2['default'].createElement(
33966
  'li',
33967
+ { key: group.name },
33968
  index > 0 ? ' |' : '',
33969
+ _react2['default'].createElement(
33970
  'a',
33971
  {
33972
  href: 'javascript:;',
33973
  className: classes,
33974
+ onClick: function () {
33975
+ return _this.handleSelect(group.name);
33976
+ }
33977
  },
33978
  group.label,
33979
+ _react2['default'].createElement(
33980
  'span',
33981
  { className: 'count' },
33982
  '(',
33987
  );
33988
  });
33989
 
33990
+ return _react2['default'].createElement(
33991
  'ul',
33992
  { className: 'subsubsub' },
33993
  groups
33994
  );
33995
  }
33996
+ }]);
33997
 
33998
  return ListingGroups;
33999
+ })(_react2['default'].Component);
34000
+
34001
+ ListingGroups.propTypes = {
34002
+ onSelectGroup: _propTypes2['default'].func.isRequired,
34003
+ groups: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
34004
+ name: _propTypes2['default'].string,
34005
+ count: _propTypes2['default'].number
34006
+ })).isRequired,
34007
+ group: _propTypes2['default'].any.isRequired };
34008
+
34009
+ // eslint-disable-line react/forbid-prop-types
34010
+ exports['default'] = ListingGroups;
34011
+ module.exports = exports['default'];
34012
 
34013
  /***/ },
34014
  /* 288 */
34015
  /***/ function(module, exports, __webpack_require__) {
34016
 
34017
+ 'use strict';
34018
 
34019
+ Object.defineProperty(exports, '__esModule', {
34020
+ value: true
34021
+ });
34022
 
34023
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
34024
 
34025
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34026
 
34027
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
34028
 
34029
+ var _jquery = __webpack_require__(275);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34030
 
34031
+ var _jquery2 = _interopRequireDefault(_jquery);
34032
 
34033
+ var _mailpoet = __webpack_require__(276);
 
 
 
 
 
 
 
 
34034
 
34035
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
34036
+
34037
+ var ListingFilters = _react2['default'].createClass({
34038
+ displayName: 'ListingFilters',
34039
+
34040
+ handleFilterAction: function handleFilterAction() {
34041
+ var _this = this;
34042
+
34043
+ var filters = {};
34044
+ this.getAvailableFilters().forEach(function (filter, i) {
34045
+ filters[_this['filter-' + i].name] = _this['filter-' + i].value;
34046
+ });
34047
+ if (this.props.onBeforeSelectFilter) {
34048
+ this.props.onBeforeSelectFilter(filters);
34049
+ }
34050
+ return this.props.onSelectFilter(filters);
34051
+ },
34052
+ handleEmptyTrash: function handleEmptyTrash() {
34053
+ return this.props.onEmptyTrash();
34054
+ },
34055
+ getAvailableFilters: function getAvailableFilters() {
34056
+ var filters = this.props.filters;
34057
+ return Object.keys(filters).filter(function (filter) {
34058
+ return !(filters[filter].length === 0 || filters[filter].length === 1 && !filters[filter][0].value);
34059
+ });
34060
+ },
34061
+ componentDidUpdate: function componentDidUpdate() {
34062
+ var _this2 = this;
34063
+
34064
+ var selectedFilters = this.props.filter;
34065
+ this.getAvailableFilters().forEach(function (filter, i) {
34066
+ if (selectedFilters[filter] !== undefined && selectedFilters[filter]) {
34067
+ (0, _jquery2['default'])(_this2['filter-' + i]).val(selectedFilters[filter]).trigger('change');
34068
  }
34069
+ });
34070
+ },
34071
+ render: function render() {
34072
+ var _this3 = this;
34073
 
34074
+ var filters = this.props.filters;
34075
+ var availableFilters = this.getAvailableFilters().map(function (filter, i) {
34076
+ return _react2['default'].createElement(
34077
+ 'select',
34078
+ {
34079
+ ref: function (c) {
34080
+ _this3['filter-' + i] = c;
34081
+ },
34082
+ key: 'filter-' + filter,
34083
+ name: filter
34084
+ },
34085
+ filters[filter].map(function (option) {
34086
+ return _react2['default'].createElement(
34087
+ 'option',
34088
+ {
34089
+ value: option.value,
34090
+ key: 'filter-option-' + option.value
34091
+ },
34092
+ option.label
34093
+ );
34094
+ })
34095
  );
34096
+ });
34097
+
34098
+ var button = undefined;
34099
+
34100
+ if (availableFilters.length > 0) {
34101
+ button = _react2['default'].createElement('input', {
34102
+ id: 'post-query-submit',
34103
+ onClick: this.handleFilterAction,
34104
+ type: 'submit',
34105
+ defaultValue: _mailpoet2['default'].I18n.t('filter'),
34106
+ className: 'button'
34107
+ });
34108
  }
 
34109
 
34110
+ var emptyTrash = undefined;
34111
+ if (this.props.group === 'trash') {
34112
+ emptyTrash = _react2['default'].createElement('input', {
34113
+ onClick: this.handleEmptyTrash,
34114
+ type: 'submit',
34115
+ value: _mailpoet2['default'].I18n.t('emptyTrash'),
34116
+ className: 'button'
34117
+ });
34118
+ }
34119
+
34120
+ return _react2['default'].createElement(
34121
+ 'div',
34122
+ { className: 'alignleft actions actions' },
34123
+ availableFilters,
34124
+ button,
34125
+ emptyTrash
34126
+ );
34127
+ }
34128
+ });
34129
+
34130
+ exports['default'] = ListingFilters;
34131
+ module.exports = exports['default'];
34132
 
34133
  /***/ },
34134
  /* 289 */
34144
  /* 290 */
34145
  /***/ function(module, exports, __webpack_require__) {
34146
 
34147
+ 'use strict';
34148
+
34149
+ Object.defineProperty(exports, '__esModule', {
34150
+ value: true
34151
+ });
34152
 
34153
  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; };
34154
 
34155
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
34156
 
34157
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34158
 
34159
+ var _react2 = _interopRequireDefault(_react);
34160
+
34161
+ var _jquery = __webpack_require__(275);
34162
+
34163
+ var _jquery2 = _interopRequireDefault(_jquery);
34164
+
34165
+ var _underscore = __webpack_require__(281);
34166
+
34167
+ var _underscore2 = _interopRequireDefault(_underscore);
34168
+
34169
+ __webpack_require__(34);
34170
+
34171
+ __webpack_require__(291);
34172
+
34173
+ var Selection = _react2['default'].createClass({
34174
+ displayName: 'Selection',
34175
+
34176
+ allowMultipleValues: function allowMultipleValues() {
34177
+ return this.props.field.multiple === true;
34178
+ },
34179
+ isSelect2Initialized: function isSelect2Initialized() {
34180
+ return (0, _jquery2['default'])('#' + this.select.id).hasClass('select2-hidden-accessible') === true;
34181
+ },
34182
+ isSelect2Component: function isSelect2Component() {
34183
+ return this.allowMultipleValues() || this.props.field.forceSelect2;
34184
+ },
34185
+ componentDidMount: function componentDidMount() {
34186
+ if (this.isSelect2Component()) {
34187
  this.setupSelect2();
34188
+ }
34189
+ },
34190
+ componentDidUpdate: function componentDidUpdate(prevProps) {
34191
+ if (this.props.item !== undefined && prevProps.item !== undefined && this.props.item.id !== prevProps.item.id) {
34192
+ (0, _jquery2['default'])('#' + this.select.id).val(this.getSelectedValues()).trigger('change');
34193
+ }
 
 
 
 
34194
 
34195
+ if (this.isSelect2Initialized() && this.getFieldId(this.props) !== this.getFieldId(prevProps) && this.props.field.resetSelect2OnUpdate !== undefined) {
34196
+ this.resetSelect2();
34197
+ }
34198
+ },
34199
+ componentWillUnmount: function componentWillUnmount() {
34200
+ if (this.isSelect2Component()) {
34201
+ this.destroySelect2();
34202
+ }
34203
+ },
34204
+ getFieldId: function getFieldId(data) {
34205
+ var props = data || this.props;
34206
+ return props.field.id || props.field.name;
34207
+ },
34208
+ resetSelect2: function resetSelect2() {
34209
+ this.destroySelect2();
34210
+ this.setupSelect2();
34211
+ },
34212
+ destroySelect2: function destroySelect2() {
34213
+ if (this.isSelect2Initialized()) {
34214
+ (0, _jquery2['default'])('#' + this.select.id).select2('destroy');
34215
+ this.cleanupAfterSelect2();
34216
+ }
34217
+ },
34218
+ cleanupAfterSelect2: function cleanupAfterSelect2() {
34219
+ // remove DOM elements created by Select2 that are not tracked by React
34220
+ (0, _jquery2['default'])('#' + this.select.id).find('option:not(.default)').remove();
34221
 
34222
+ // unbind events (https://select2.org/programmatic-control/methods#event-unbinding)
34223
+ (0, _jquery2['default'])('#' + this.select.id).off('select2:unselecting').off('select2:opening');
34224
+ },
34225
+ setupSelect2: function setupSelect2() {
34226
+ if (this.isSelect2Initialized()) {
34227
+ return;
34228
+ }
34229
+
34230
+ var select2Options = {
34231
+ disabled: this.props.disabled || false,
34232
+ width: this.props.width || '',
34233
+ placeholder: {
34234
+ id: '', // the value of the option
34235
+ text: this.props.field.placeholder
34236
+ },
34237
+ templateResult: function templateResult(item) {
34238
+ if (item.element && item.element.selected) {
34239
+ return null;
34240
+ } else if (item.title) {
34241
+ return item.title;
34242
  }
34243
+ return item.text;
34244
+ }
34245
+ };
34246
 
34247
+ var remoteQuery = this.props.field.remoteQuery || null;
34248
+ if (remoteQuery) {
34249
+ select2Options = Object.assign(select2Options, {
34250
+ ajax: {
34251
+ url: window.ajaxurl,
34252
+ type: 'POST',
34253
+ dataType: 'json',
34254
+ data: function data(params) {
34255
+ return {
34256
+ action: 'mailpoet',
34257
+ api_version: window.mailpoet_api_version,
34258
+ token: window.mailpoet_token,
34259
+ endpoint: remoteQuery.endpoint,
34260
+ method: remoteQuery.method,
34261
+ data: Object.assign(remoteQuery.data, { query: params.term })
34262
+ };
 
 
 
 
 
 
 
 
34263
  },
34264
+ processResults: function processResults(response) {
34265
+ return {
34266
+ results: response.data.map(function (item) {
34267
+ return { id: item.id || item.value, text: item.name || item.text };
34268
+ })
34269
+ };
34270
+ }
34271
+ },
34272
+ minimumInputLength: remoteQuery.minimumInputLength || 2
34273
+ });
34274
+ }
34275
 
34276
+ if (this.props.field.extendSelect2Options !== undefined) {
34277
+ select2Options = Object.assign(select2Options, this.props.field.extendSelect2Options);
34278
+ }
34279
 
34280
+ var select2 = (0, _jquery2['default'])('#' + this.select.id).select2(select2Options);
34281
 
34282
+ var hasRemoved = false;
34283
+ select2.on('select2:unselecting', function () {
34284
+ hasRemoved = true;
34285
+ });
34286
+ select2.on('select2:opening', function (e) {
34287
+ if (hasRemoved === true) {
34288
+ hasRemoved = false;
34289
+ e.preventDefault();
34290
+ }
34291
+ });
34292
 
34293
+ select2.on('change', this.handleChange);
34294
+ },
34295
+ getSelectedValues: function getSelectedValues() {
34296
+ if (this.props.field.selected !== undefined) {
34297
+ return this.props.field.selected(this.props.item);
34298
+ } else if (this.props.item !== undefined && this.props.field.name !== undefined) {
34299
+ if (this.allowMultipleValues()) {
34300
+ if (_underscore2['default'].isArray(this.props.item[this.props.field.name])) {
34301
+ return this.props.item[this.props.field.name].map(function (item) {
34302
+ return item.id;
34303
+ });
 
 
 
34304
  }
34305
+ } else {
34306
+ return this.props.item[this.props.field.name];
34307
  }
34308
+ }
34309
+ return null;
34310
+ },
34311
+ getItems: function getItems() {
34312
+ var items = undefined;
34313
+ if (typeof window['mailpoet_' + this.props.field.endpoint] !== 'undefined') {
34314
+ items = window['mailpoet_' + this.props.field.endpoint];
34315
+ } else if (this.props.field.values !== undefined) {
34316
+ items = this.props.field.values;
34317
+ }
34318
 
34319
+ if (_underscore2['default'].isArray(items)) {
34320
+ if (this.props.field.filter !== undefined) {
34321
+ items = items.filter(this.props.field.filter);
 
34322
  }
34323
+ }
34324
 
34325
+ return items;
34326
+ },
34327
+ handleChange: function handleChange(e) {
34328
+ if (this.props.onValueChange === undefined) return;
34329
 
34330
+ var valueTextPair = (0, _jquery2['default'])('#' + this.select.id).children(':selected').map(function element() {
34331
+ return { id: (0, _jquery2['default'])(this).val(), text: (0, _jquery2['default'])(this).text() };
34332
+ });
34333
+ var value = this.props.field.multiple ? _underscore2['default'].pluck(valueTextPair, 'id') : _underscore2['default'].pluck(valueTextPair, 'id').toString();
34334
+ var transformedValue = this.transformChangedValue(value, valueTextPair);
34335
 
34336
+ this.props.onValueChange({
34337
+ target: {
34338
+ value: transformedValue,
34339
+ name: this.props.field.name,
34340
+ id: e.target.id
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34341
  }
34342
+ });
34343
+ },
34344
+ getLabel: function getLabel(item) {
34345
+ if (this.props.field.getLabel !== undefined) {
34346
+ return this.props.field.getLabel(item, this.props.item);
34347
+ }
34348
+ return item.name;
34349
+ },
34350
+ getSearchLabel: function getSearchLabel(item) {
34351
+ if (this.props.field.getSearchLabel !== undefined) {
34352
+ return this.props.field.getSearchLabel(item, this.props.item);
34353
+ }
34354
+ return null;
34355
+ },
34356
+ getValue: function getValue(item) {
34357
+ if (this.props.field.getValue !== undefined) {
34358
+ return this.props.field.getValue(item, this.props.item);
34359
+ }
34360
+ return item.id;
34361
+ },
34362
+ // When it's impossible to represent the desired value in DOM,
34363
+ // this function may be used to transform the placeholder value into
34364
+ // desired value.
34365
+ transformChangedValue: function transformChangedValue(value, textValuePair) {
34366
+ if (typeof this.props.field.transformChangedValue === 'function') {
34367
+ return this.props.field.transformChangedValue.call(this, value, textValuePair);
34368
+ }
34369
+ return value;
34370
+ },
34371
+ insertEmptyOption: function insertEmptyOption() {
34372
+ // https://select2.org/placeholders
34373
+ // For single selects only, in order for the placeholder value to appear,
34374
+ // we must have a blank <option> as the first option in the <select> control.
34375
+ if (this.allowMultipleValues()) return undefined;
34376
+ if (this.props.field.placeholder) return _react2['default'].createElement('option', { className: 'default' });
34377
+ return undefined;
34378
+ },
34379
+ render: function render() {
34380
+ var _this = this;
34381
 
34382
+ var items = this.getItems(this.props.field);
34383
+ var selectedValues = this.getSelectedValues();
34384
+ var options = items.map(function (item) {
34385
+ var label = _this.getLabel(item);
34386
+ var searchLabel = _this.getSearchLabel(item);
34387
+ var value = _this.getValue(item);
 
 
 
 
 
 
34388
 
34389
+ return _react2['default'].createElement(
34390
+ 'option',
34391
+ {
34392
+ key: 'option-' + item.id,
34393
+ className: 'default',
34394
+ value: value,
34395
+ title: searchLabel,
34396
+ selected: value === selectedValues
34397
+ },
34398
+ label
 
 
 
 
34399
  );
34400
+ });
 
34401
 
34402
+ return _react2['default'].createElement(
34403
+ 'select',
34404
+ _extends({
34405
+ id: this.getFieldId(),
34406
+ ref: function (c) {
34407
+ _this.select = c;
34408
+ },
34409
+ disabled: this.props.field.disabled,
34410
+ 'data-placeholder': this.props.field.placeholder,
34411
+ multiple: this.props.field.multiple,
34412
+ defaultValue: selectedValues
34413
+ }, this.props.field.validation),
34414
+ this.insertEmptyOption(),
34415
+ options
34416
+ );
34417
+ }
34418
+ });
34419
+
34420
+ exports['default'] = Selection;
34421
+ module.exports = exports['default'];
34422
 
34423
  /***/ },
34424
  /* 291 */
40188
  /* 295 */
40189
  /***/ function(module, exports, __webpack_require__) {
40190
 
40191
+ /* WEBPACK VAR INJECTION */(function(setImmediate) {'use strict';
40192
 
40193
+ Object.defineProperty(exports, '__esModule', {
40194
+ value: true
40195
+ });
40196
 
40197
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40198
 
40199
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
40200
 
40201
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
 
 
 
 
40202
 
40203
+ var _mailpoet = __webpack_require__(276);
40204
 
40205
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
40206
+
40207
+ var _classnames = __webpack_require__(277);
40208
+
40209
+ var _classnames2 = _interopRequireDefault(_classnames);
40210
+
40211
+ var _formFieldsFieldJsx = __webpack_require__(297);
40212
+
40213
+ var _formFieldsFieldJsx2 = _interopRequireDefault(_formFieldsFieldJsx);
40214
+
40215
+ var _jquery = __webpack_require__(275);
40216
+
40217
+ var _jquery2 = _interopRequireDefault(_jquery);
40218
+
40219
+ var Form = _react2['default'].createClass({
40220
+ displayName: 'Form',
40221
+
40222
+ contextTypes: {
40223
+ router: _react2['default'].PropTypes.object.isRequired
40224
+ },
40225
+ getDefaultProps: function getDefaultProps() {
40226
+ return {
40227
+ params: {}
40228
+ };
40229
+ },
40230
+ getInitialState: function getInitialState() {
40231
+ return {
40232
+ loading: false,
40233
+ errors: [],
40234
+ item: {}
40235
+ };
40236
+ },
40237
+ getValues: function getValues() {
40238
+ return this.props.item ? this.props.item : this.state.item;
40239
+ },
40240
+ getErrors: function getErrors() {
40241
+ return this.props.errors ? this.props.errors : this.state.errors;
40242
+ },
40243
+ componentDidMount: function componentDidMount() {
40244
+ var _this = this;
40245
+
40246
+ if (this.props.params.id !== undefined) {
40247
+ this.loadItem(this.props.params.id);
40248
+ } else {
40249
+ setImmediate(function () {
40250
+ _this.setState({
40251
+ item: (0, _jquery2['default'])('.mailpoet_form').mailpoetSerializeObject()
40252
  });
40253
+ });
40254
+ }
40255
+ },
40256
+ componentWillReceiveProps: function componentWillReceiveProps(props) {
40257
+ var _this2 = this;
40258
+
40259
+ if (props.params.id === undefined) {
40260
+ setImmediate(function () {
40261
+ _this2.setState({
40262
  loading: false,
40263
  item: {}
 
 
40264
  });
40265
  });
40266
+ if (props.item === undefined) {
40267
+ this.form.reset();
 
 
 
 
 
 
 
 
 
40268
  }
40269
+ }
40270
+ },
40271
+ loadItem: function loadItem(id) {
40272
+ var _this3 = this;
40273
 
40274
+ this.setState({ loading: true });
40275
 
40276
+ _mailpoet2['default'].Ajax.post({
40277
+ api_version: window.mailpoet_api_version,
40278
+ endpoint: this.props.endpoint,
40279
+ action: 'get',
40280
+ data: {
40281
+ id: id
40282
+ }
40283
+ }).done(function (response) {
40284
+ _this3.setState({
40285
+ loading: false,
40286
+ item: response.data
40287
  });
40288
+ if (typeof _this3.props.onItemLoad === 'function') {
40289
+ _this3.props.onItemLoad(response.data);
 
40290
  }
40291
+ }).fail(function () {
40292
+ _this3.setState({
40293
+ loading: false,
40294
+ item: {}
40295
+ }, function failSetStateCallback() {
40296
+ this.context.router.push('/new');
40297
+ });
40298
+ });
40299
+ },
40300
+ handleSubmit: function handleSubmit(e) {
40301
+ var _this4 = this;
40302
 
40303
+ e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
40304
 
40305
+ // handle validation
40306
+ if (this.props.isValid !== undefined) {
40307
+ if (this.props.isValid() === false) {
40308
+ return;
 
 
 
 
 
 
 
 
 
 
40309
  }
40310
+ }
 
 
 
40311
 
40312
+ this.setState({ loading: true });
 
 
 
 
 
 
40313
 
40314
+ // only get values from displayed fields
40315
+ var item = {};
40316
+ this.props.fields.forEach(function (field) {
40317
+ if (field.fields !== undefined) {
40318
+ field.fields.forEach(function (subfield) {
40319
+ item[subfield.name] = _this4.state.item[subfield.name];
 
 
 
 
 
 
40320
  });
40321
+ } else {
40322
+ item[field.name] = _this4.state.item[field.name];
40323
  }
40324
+ });
40325
+ // set id if specified
40326
+ if (this.props.params.id !== undefined) {
40327
+ item.id = this.props.params.id;
40328
+ }
40329
 
40330
+ _mailpoet2['default'].Ajax.post({
40331
+ api_version: window.mailpoet_api_version,
40332
+ endpoint: this.props.endpoint,
40333
+ action: 'save',
40334
+ data: item
40335
+ }).always(function () {
40336
+ _this4.setState({ loading: false });
40337
+ }).done(function () {
40338
+ if (_this4.props.onSuccess !== undefined) {
40339
+ _this4.props.onSuccess();
40340
+ } else {
40341
+ _this4.context.router.push('/');
40342
  }
40343
 
40344
+ if (_this4.props.params.id !== undefined) {
40345
+ _this4.props.messages.onUpdate();
40346
+ } else {
40347
+ _this4.props.messages.onCreate();
40348
  }
40349
+ }).fail(function (response) {
40350
+ if (response.errors.length > 0) {
40351
+ _this4.setState({ errors: response.errors });
40352
+ }
40353
+ });
40354
+ },
40355
+ handleValueChange: function handleValueChange(e) {
40356
+ if (this.props.onChange) {
40357
+ return this.props.onChange(e);
40358
+ }
40359
+ var item = this.state.item;
40360
+ var field = e.target.name;
40361
 
40362
+ item[field] = e.target.value;
 
 
 
 
 
 
 
 
40363
 
40364
+ this.setState({
40365
+ item: item
40366
+ });
40367
+ return true;
40368
+ },
40369
+ render: function render() {
40370
+ var _this5 = this;
40371
+
40372
+ var errors = undefined;
40373
+ if (this.getErrors() !== undefined) {
40374
+ errors = this.getErrors().map(function (error) {
40375
+ return _react2['default'].createElement(
40376
+ 'div',
40377
+ { className: 'mailpoet_notice notice inline error is-dismissible', key: 'error-' + error.message },
40378
+ _react2['default'].createElement(
40379
+ 'p',
40380
+ null,
40381
+ error.message
40382
+ )
40383
+ );
40384
  });
40385
+ }
40386
 
40387
+ var formClasses = (0, _classnames2['default'])('mailpoet_form', { mailpoet_form_loading: this.state.loading || this.props.loading });
40388
+
40389
+ var beforeFormContent = false;
40390
+ var afterFormContent = false;
40391
+
40392
+ if (this.props.beforeFormContent !== undefined) {
40393
+ beforeFormContent = this.props.beforeFormContent(this.getValues());
40394
+ }
40395
+
40396
+ if (this.props.afterFormContent !== undefined) {
40397
+ afterFormContent = this.props.afterFormContent(this.getValues());
40398
+ }
40399
+
40400
+ var fields = this.props.fields.map(function (field) {
40401
+ // Compose an onChange handler from the default and custom one
40402
+ var onValueChange = _this5.handleValueChange;
40403
+ if (field.onBeforeChange) {
40404
+ onValueChange = function (e) {
40405
+ field.onBeforeChange(e);
40406
+ return _this5.handleValueChange(e);
40407
+ };
40408
  }
40409
 
40410
+ return _react2['default'].createElement(_formFieldsFieldJsx2['default'], {
40411
+ field: field,
40412
+ item: _this5.getValues(),
40413
+ onValueChange: onValueChange,
40414
+ key: 'field-' + field.name
40415
+ });
40416
+ });
40417
+
40418
+ var actions = false;
40419
+ if (this.props.children) {
40420
+ actions = this.props.children;
40421
+ } else {
40422
+ actions = _react2['default'].createElement('input', {
40423
+ className: 'button button-primary',
40424
+ type: 'submit',
40425
+ value: _mailpoet2['default'].I18n.t('save'),
40426
+ disabled: this.state.loading
40427
+ });
40428
+ }
40429
+
40430
+ return _react2['default'].createElement(
40431
+ 'div',
40432
+ null,
40433
+ beforeFormContent,
40434
+ _react2['default'].createElement(
40435
+ 'form',
40436
+ {
40437
+ id: this.props.id,
40438
+ ref: function (c) {
40439
+ _this5.form = c;
40440
  },
40441
+ className: formClasses,
40442
+ onSubmit: this.props.onSubmit !== undefined ? this.props.onSubmit : this.handleSubmit
40443
+ },
40444
+ errors,
40445
+ _react2['default'].createElement(
40446
+ 'table',
40447
+ { className: 'form-table' },
40448
+ _react2['default'].createElement(
40449
+ 'tbody',
40450
+ null,
40451
+ fields
40452
+ )
40453
  ),
40454
+ actions
40455
+ ),
40456
+ afterFormContent
40457
+ );
40458
+ }
40459
+ });
40460
 
40461
+ exports['default'] = Form;
40462
+ module.exports = exports['default'];
40463
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(296).setImmediate))
40464
 
40465
  /***/ },
40548
  /* 297 */
40549
  /***/ function(module, exports, __webpack_require__) {
40550
 
40551
+ 'use strict';
40552
 
40553
+ Object.defineProperty(exports, '__esModule', {
40554
+ value: true
40555
+ });
40556
 
40557
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
40558
 
40559
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
40560
 
40561
+ var _react2 = _interopRequireDefault(_react);
 
40562
 
40563
+ var _formFieldsTextJsx = __webpack_require__(298);
 
 
40564
 
40565
+ var _formFieldsTextJsx2 = _interopRequireDefault(_formFieldsTextJsx);
 
 
 
40566
 
40567
+ var _formFieldsTextareaJsx = __webpack_require__(300);
 
 
40568
 
40569
+ var _formFieldsTextareaJsx2 = _interopRequireDefault(_formFieldsTextareaJsx);
 
 
40570
 
40571
+ var _formFieldsSelectJsx = __webpack_require__(301);
 
 
40572
 
40573
+ var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
 
 
40574
 
40575
+ var _formFieldsRadioJsx = __webpack_require__(302);
 
 
40576
 
40577
+ var _formFieldsRadioJsx2 = _interopRequireDefault(_formFieldsRadioJsx);
 
 
40578
 
40579
+ var _formFieldsCheckboxJsx = __webpack_require__(303);
 
 
40580
 
40581
+ var _formFieldsCheckboxJsx2 = _interopRequireDefault(_formFieldsCheckboxJsx);
 
 
 
40582
 
40583
+ var _formFieldsSelectionJsx = __webpack_require__(289);
40584
+
40585
+ var _formFieldsSelectionJsx2 = _interopRequireDefault(_formFieldsSelectionJsx);
40586
+
40587
+ var _formFieldsDateJsx = __webpack_require__(304);
40588
+
40589
+ var _formFieldsDateJsx2 = _interopRequireDefault(_formFieldsDateJsx);
40590
+
40591
+ var _jquery = __webpack_require__(275);
40592
+
40593
+ var _jquery2 = _interopRequireDefault(_jquery);
40594
+
40595
+ var FormField = _react2['default'].createClass({
40596
+ displayName: 'FormField',
40597
+
40598
+ renderField: function renderField(data) {
40599
+ var inline = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
40600
+
40601
+ var description = false;
40602
+ if (data.field.description) {
40603
+ description = _react2['default'].createElement(
40604
+ 'p',
40605
+ { className: 'description' },
40606
+ data.field.description
40607
+ );
40608
+ }
40609
+
40610
+ var field = false;
40611
+ var dataField = data.field;
40612
+
40613
+ if (data.field.field !== undefined) {
40614
+ dataField = _jquery2['default'].merge(dataField, data.field.field);
40615
+ }
40616
+
40617
+ switch (dataField.type) {
40618
+ case 'text':
40619
+ field = _react2['default'].createElement(_formFieldsTextJsx2['default'], data);
40620
+ break;
40621
+
40622
+ case 'textarea':
40623
+ field = _react2['default'].createElement(_formFieldsTextareaJsx2['default'], data);
40624
+ break;
40625
+
40626
+ case 'select':
40627
+ field = _react2['default'].createElement(_formFieldsSelectJsx2['default'], data);
40628
+ break;
40629
+
40630
+ case 'radio':
40631
+ field = _react2['default'].createElement(_formFieldsRadioJsx2['default'], data);
40632
+ break;
40633
+
40634
+ case 'checkbox':
40635
+ field = _react2['default'].createElement(_formFieldsCheckboxJsx2['default'], data);
40636
+ break;
40637
+
40638
+ case 'selection':
40639
+ field = _react2['default'].createElement(_formFieldsSelectionJsx2['default'], data);
40640
+ break;
40641
+
40642
+ case 'date':
40643
+ field = _react2['default'].createElement(_formFieldsDateJsx2['default'], data);
40644
+ break;
40645
+
40646
+ case 'reactComponent':
40647
+ field = _react2['default'].createElement(data.field.component, data);
40648
+ break;
40649
+
40650
+ default:
40651
+ field = 'invalid';
40652
+ break;
40653
+ }
40654
+
40655
+ if (inline === true) {
40656
+ return _react2['default'].createElement(
40657
+ 'span',
40658
  { key: 'field-' + (data.index || 0) },
40659
  field,
40660
  description
40661
  );
40662
+ }
40663
+ return _react2['default'].createElement(
40664
+ 'div',
40665
+ { key: 'field-' + (data.index || 0) },
40666
+ field,
40667
+ description
40668
+ );
40669
+ },
40670
+ render: function render() {
40671
+ var _this = this;
40672
 
40673
+ var field = false;
40674
 
40675
+ if (this.props.field.fields !== undefined) {
40676
+ field = this.props.field.fields.map(function (subfield, index) {
40677
+ return _this.renderField({
40678
+ index: index,
40679
+ field: subfield,
40680
+ item: _this.props.item,
40681
+ onValueChange: _this.props.onValueChange || false
 
40682
  });
40683
+ });
40684
+ } else {
40685
+ field = this.renderField(this.props);
40686
+ }
 
 
 
 
 
 
 
 
40687
 
40688
+ var tip = false;
40689
+ if (this.props.field.tip) {
40690
+ tip = _react2['default'].createElement(
40691
+ 'p',
40692
+ { className: 'description' },
40693
+ this.props.field.tip
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40694
  );
40695
  }
 
40696
 
40697
+ return _react2['default'].createElement(
40698
+ 'tr',
40699
+ { className: 'form-field-row-' + this.props.field.name },
40700
+ _react2['default'].createElement(
40701
+ 'th',
40702
+ { scope: 'row' },
40703
+ _react2['default'].createElement(
40704
+ 'label',
40705
+ {
40706
+ htmlFor: 'field_' + this.props.field.name
40707
+ },
40708
+ this.props.field.label,
40709
+ tip
40710
+ )
40711
+ ),
40712
+ _react2['default'].createElement(
40713
+ 'td',
40714
+ null,
40715
+ field
40716
+ )
40717
+ );
40718
+ }
40719
+ });
40720
+
40721
+ exports['default'] = FormField;
40722
+ module.exports = exports['default'];
40723
 
40724
  /***/ },
40725
  /* 298 */
40795
  /* 300 */
40796
  /***/ function(module, exports, __webpack_require__) {
40797
 
40798
+ 'use strict';
40799
+
40800
+ Object.defineProperty(exports, '__esModule', {
40801
+ value: true
40802
+ });
40803
 
40804
  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; };
40805
 
40806
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
40807
 
40808
+ var _react = __webpack_require__(2);
 
 
 
 
 
 
 
 
 
 
 
 
40809
 
40810
+ var _react2 = _interopRequireDefault(_react);
40811
+
40812
+ var _propTypes = __webpack_require__(185);
40813
+
40814
+ var _propTypes2 = _interopRequireDefault(_propTypes);
40815
+
40816
+ var FormFieldTextarea = function FormFieldTextarea(props) {
40817
+ return _react2['default'].createElement('textarea', _extends({
40818
+ type: 'text',
40819
+ className: 'regular-text',
40820
+ name: props.field.name,
40821
+ id: 'field_' + props.field.name,
40822
+ value: props.item[props.field.name],
40823
+ placeholder: props.field.placeholder,
40824
+ defaultValue: props.field.defaultValue,
40825
+ onChange: props.onValueChange
40826
+ }, props.field.validation));
40827
+ };
40828
+
40829
+ FormFieldTextarea.propTypes = {
40830
+ item: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
40831
+ field: _propTypes2['default'].shape({
40832
+ name: _propTypes2['default'].string,
40833
+ placeholder: _propTypes2['default'].string,
40834
+ defaultValue: _propTypes2['default'].string,
40835
+ validation: _propTypes2['default'].object }). // eslint-disable-line react/forbid-prop-types
40836
+ isRequired,
40837
+ onValueChange: _propTypes2['default'].func.isRequired
40838
+ };
40839
+
40840
+ exports['default'] = FormFieldTextarea;
40841
+ module.exports = exports['default'];
40842
 
40843
  /***/ },
40844
  /* 301 */
40904
  var options = keys.filter(function (value) {
40905
  if (filter === false) return true;
40906
  return filter(_this.props.item, value);
40907
+ }).map(function (value) {
40908
  return _react2['default'].createElement(
40909
  'option',
40910
  {
40911
+ key: 'option-' + value,
40912
  value: value
40913
  },
40914
  _this.props.field.values[value]
40935
  /* 302 */
40936
  /***/ function(module, exports, __webpack_require__) {
40937
 
40938
+ "use strict";
40939
 
40940
+ Object.defineProperty(exports, "__esModule", {
40941
+ value: true
40942
+ });
40943
 
40944
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
 
40945
 
40946
+ var _react = __webpack_require__(2);
 
 
40947
 
40948
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40949
 
40950
+ var FormFieldRadio = _react2["default"].createClass({
40951
+ displayName: "FormFieldRadio",
40952
+
40953
+ render: function render() {
40954
+ var _this = this;
40955
+
40956
+ if (this.props.field.values === undefined) {
40957
+ return false;
40958
  }
 
40959
 
40960
+ var selectedValue = this.props.item[this.props.field.name];
40961
+ var options = Object.keys(this.props.field.values).map(function (value) {
40962
+ return _react2["default"].createElement(
40963
+ "p",
40964
+ { key: "radio-" + value },
40965
+ _react2["default"].createElement(
40966
+ "label",
40967
+ { htmlFor: _this.props.field.name },
40968
+ _react2["default"].createElement("input", {
40969
+ type: "radio",
40970
+ checked: selectedValue === value,
40971
+ value: value,
40972
+ onChange: _this.props.onValueChange,
40973
+ name: _this.props.field.name,
40974
+ id: _this.props.field.name
40975
+ }),
40976
+ _this.props.field.values[value]
40977
+ )
40978
+ );
40979
+ });
40980
+
40981
+ return _react2["default"].createElement(
40982
+ "div",
40983
+ null,
40984
+ options
40985
+ );
40986
+ }
40987
+ });
40988
+
40989
+ exports["default"] = FormFieldRadio;
40990
+ module.exports = exports["default"];
40991
 
40992
  /***/ },
40993
  /* 303 */
40994
  /***/ function(module, exports, __webpack_require__) {
40995
 
40996
+ 'use strict';
40997
 
40998
+ Object.defineProperty(exports, '__esModule', {
40999
+ value: true
41000
+ });
41001
 
41002
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
 
 
 
 
41003
 
41004
+ var _react = __webpack_require__(2);
 
 
41005
 
41006
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41007
 
41008
+ var FormFieldCheckbox = _react2['default'].createClass({
41009
+ displayName: 'FormFieldCheckbox',
41010
+
41011
+ onValueChange: function onValueChange(e) {
41012
+ e.target.value = this.checkbox.checked ? '1' : '0';
41013
+ return this.props.onValueChange(e);
41014
+ },
41015
+ render: function render() {
41016
+ var _this = this;
41017
+
41018
+ if (this.props.field.values === undefined) {
41019
+ return false;
41020
  }
 
41021
 
41022
+ // isChecked will be true only if the value is "1"
41023
+ // it will be false in case value is "0" or empty
41024
+ var isChecked = !!Number(this.props.item[this.props.field.name]);
41025
+ var options = Object.keys(this.props.field.values).map(function (value) {
41026
+ return _react2['default'].createElement(
41027
+ 'p',
41028
+ { key: 'checkbox-' + value },
41029
+ _react2['default'].createElement(
41030
+ 'label',
41031
+ { htmlFor: _this.props.field.name },
41032
+ _react2['default'].createElement('input', {
41033
+ ref: function (c) {
41034
+ _this.checkbox = c;
41035
+ },
41036
+ type: 'checkbox',
41037
+ value: '1',
41038
+ checked: isChecked,
41039
+ onChange: _this.onValueChange,
41040
+ name: _this.props.field.name,
41041
+ id: _this.props.field.name
41042
+ }),
41043
+ _this.props.field.values[value]
41044
+ )
41045
+ );
41046
+ });
41047
+
41048
+ return _react2['default'].createElement(
41049
+ 'div',
41050
+ null,
41051
+ options
41052
+ );
41053
+ }
41054
+ });
41055
+
41056
+ exports['default'] = FormFieldCheckbox;
41057
+ module.exports = exports['default'];
41058
 
41059
  /***/ },
41060
  /* 304 */
41061
  /***/ function(module, exports, __webpack_require__) {
41062
 
41063
+ 'use strict';
41064
+
41065
+ Object.defineProperty(exports, '__esModule', {
41066
+ value: true
41067
+ });
41068
 
41069
  var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
41070
 
41071
  var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
41072
 
41073
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
41074
+
41075
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41076
 
41077
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
41078
 
41079
  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
41080
 
41081
+ var _react = __webpack_require__(2);
 
 
 
41082
 
41083
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
41084
 
41085
+ var _moment = __webpack_require__(305);
41086
+
41087
+ var _moment2 = _interopRequireDefault(_moment);
41088
+
41089
+ var _propTypes = __webpack_require__(185);
41090
+
41091
+ var _propTypes2 = _interopRequireDefault(_propTypes);
41092
+
41093
+ function FormFieldDateYear(props) {
41094
+ var yearsRange = 100;
41095
+ var years = [];
41096
+
41097
+ if (props.placeholder !== undefined) {
41098
+ years.push(_react2['default'].createElement(
41099
+ 'option',
41100
+ { value: '', key: 0 },
41101
+ props.placeholder
41102
+ ));
41103
+ }
41104
+
41105
+ var currentYear = (0, _moment2['default'])().year();
41106
+ for (var i = currentYear; i >= currentYear - yearsRange; i -= 1) {
41107
+ years.push(_react2['default'].createElement(
41108
+ 'option',
41109
  {
41110
+ key: i,
41111
+ value: i
 
41112
  },
41113
+ i
41114
+ ));
41115
  }
41116
+ return _react2['default'].createElement(
41117
+ 'select',
41118
+ {
41119
+ name: props.name + '[year]',
41120
+ value: props.year,
41121
+ onChange: props.onValueChange
41122
+ },
41123
+ years
41124
+ );
41125
+ }
41126
 
41127
+ FormFieldDateYear.propTypes = {
41128
+ name: _propTypes2['default'].string.isRequired,
41129
+ placeholder: _propTypes2['default'].string.isRequired,
41130
+ onValueChange: _propTypes2['default'].func.isRequired,
41131
+ year: _propTypes2['default'].string.isRequired
41132
+ };
41133
 
41134
+ function FormFieldDateMonth(props) {
41135
+ var months = [];
 
 
 
 
 
41136
 
41137
+ if (props.placeholder !== undefined) {
41138
+ months.push(_react2['default'].createElement(
41139
+ 'option',
41140
+ { value: '', key: 0 },
41141
+ props.placeholder
41142
+ ));
41143
+ }
41144
+
41145
+ for (var i = 1; i <= 12; i += 1) {
41146
+ months.push(_react2['default'].createElement(
41147
+ 'option',
 
41148
  {
41149
+ key: i,
41150
+ value: i
 
41151
  },
41152
+ props.monthNames[i - 1]
41153
+ ));
41154
  }
41155
+ return _react2['default'].createElement(
41156
+ 'select',
41157
+ {
41158
+ name: props.name + '[month]',
41159
+ value: props.month,
41160
+ onChange: props.onValueChange
41161
+ },
41162
+ months
41163
+ );
41164
+ }
41165
 
41166
+ FormFieldDateMonth.propTypes = {
41167
+ name: _propTypes2['default'].string.isRequired,
41168
+ placeholder: _propTypes2['default'].string.isRequired,
41169
+ onValueChange: _propTypes2['default'].func.isRequired,
41170
+ month: _propTypes2['default'].string.isRequired,
41171
+ monthNames: _propTypes2['default'].arrayOf(_propTypes2['default'].string).isRequired
41172
+ };
41173
 
41174
+ function FormFieldDateDay(props) {
41175
+ var days = [];
 
 
 
 
 
41176
 
41177
+ if (props.placeholder !== undefined) {
41178
+ days.push(_react2['default'].createElement(
41179
+ 'option',
41180
+ { value: '', key: 0 },
41181
+ props.placeholder
41182
+ ));
41183
+ }
 
 
 
41184
 
41185
+ for (var i = 1; i <= 31; i += 1) {
41186
+ days.push(_react2['default'].createElement(
41187
+ 'option',
41188
  {
41189
+ key: i,
41190
+ value: i
 
41191
  },
41192
+ i
41193
+ ));
41194
  }
41195
 
41196
+ return _react2['default'].createElement(
41197
+ 'select',
41198
+ {
41199
+ name: props.name + '[day]',
41200
+ value: props.day,
41201
+ onChange: props.onValueChange
41202
+ },
41203
+ days
41204
+ );
41205
+ }
41206
 
41207
+ FormFieldDateDay.propTypes = {
41208
+ name: _propTypes2['default'].string.isRequired,
41209
+ placeholder: _propTypes2['default'].string.isRequired,
41210
+ onValueChange: _propTypes2['default'].func.isRequired,
41211
+ day: _propTypes2['default'].string.isRequired
41212
+ };
41213
 
41214
+ var FormFieldDate = (function (_React$Component) {
41215
+ _inherits(FormFieldDate, _React$Component);
41216
+
41217
+ function FormFieldDate(props) {
41218
+ _classCallCheck(this, FormFieldDate);
41219
+
41220
+ _get(Object.getPrototypeOf(FormFieldDate.prototype), 'constructor', this).call(this, props);
41221
+ this.state = {
41222
+ year: '',
41223
+ month: '',
41224
+ day: ''
41225
+ };
41226
 
41227
+ this.onValueChange = this.onValueChange.bind(this);
41228
+ }
41229
+
41230
+ _createClass(FormFieldDate, [{
41231
+ key: 'componentDidMount',
41232
+ value: function componentDidMount() {
41233
+ this.extractDateParts();
41234
+ }
41235
+ }, {
41236
+ key: 'componentDidUpdate',
41237
+ value: function componentDidUpdate(prevProps) {
41238
+ if (this.props.item !== undefined && prevProps.item !== undefined && this.props.item.id !== prevProps.item.id) {
41239
  this.extractDateParts();
41240
  }
41241
+ }
41242
+ }, {
41243
+ key: 'onValueChange',
41244
+ value: function onValueChange(e) {
41245
+ var _this = this;
 
 
 
 
 
 
41246
 
41247
+ // extract property from name
41248
+ var matches = e.target.name.match(/(.*?)\[(.*?)\]/);
41249
+ var field = null;
41250
+ var property = null;
41251
 
41252
+ if (matches !== null && matches.length === 3) {
41253
+ field = matches[1];
41254
+ property = matches[2];
41255
 
41256
+ var value = Number(e.target.value);
41257
+
41258
+ this.setState(_defineProperty({}, '' + property, value), function () {
41259
+ _this.props.onValueChange({
41260
+ target: {
41261
+ name: field,
41262
+ value: _this.formatValue()
41263
+ }
41264
+ });
41265
  });
41266
  }
41267
+ }
41268
+ }, {
41269
+ key: 'formatValue',
41270
+ value: function formatValue() {
41271
+ var dateType = this.props.field.params.date_type;
41272
+
41273
+ var value = undefined;
41274
+
41275
+ switch (dateType) {
41276
+ case 'year_month_day':
41277
+ value = {
41278
+ year: this.state.year,
41279
+ month: this.state.month,
41280
+ day: this.state.day
41281
+ };
41282
+ break;
 
 
 
 
 
 
41283
 
41284
+ case 'year_month':
41285
+ value = {
41286
+ year: this.state.year,
41287
+ month: this.state.month
41288
+ };
41289
+ break;
41290
 
41291
+ case 'month':
41292
+ value = {
41293
+ month: this.state.month
41294
+ };
41295
+ break;
 
 
 
 
 
 
41296
 
41297
+ case 'year':
41298
+ value = {
41299
+ year: this.state.year
41300
+ };
41301
+ break;
41302
+ default:
41303
+ value = {
41304
+ value: 'invalid type'
41305
+ };
41306
+ break;
41307
  }
41308
+
41309
+ return value;
41310
+ }
41311
+ }, {
41312
+ key: 'extractDateParts',
41313
+ value: function extractDateParts() {
41314
+ var value = this.props.item[this.props.field.name] !== undefined ? this.props.item[this.props.field.name].trim() : '';
41315
+
41316
+ if (value === '') {
41317
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41318
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41319
 
41320
+ var dateTime = (0, _moment2['default'])(value);
 
 
 
 
 
 
 
 
41321
 
41322
+ this.setState({
41323
+ year: dateTime.format('YYYY'),
41324
+ month: dateTime.format('M'),
41325
+ day: dateTime.format('D')
41326
+ });
41327
+ }
41328
+ }, {
41329
+ key: 'render',
41330
+ value: function render() {
41331
+ var _this2 = this;
41332
 
41333
+ var monthNames = window.mailpoet_month_names || [];
41334
+ var dateFormats = window.mailpoet_date_formats || {};
41335
+ var dateType = this.props.field.params.date_type;
41336
+ var dateSelects = dateFormats[dateType][0].split('/');
41337
+
41338
+ var fields = dateSelects.map(function (type) {
41339
+ switch (type) {
41340
+ case 'YYYY':
41341
+ return _react2['default'].createElement(FormFieldDateYear, {
41342
+ onValueChange: _this2.onValueChange,
41343
+ key: 'year',
41344
+ name: _this2.props.field.name,
41345
+ year: _this2.state.year,
41346
+ placeholder: _this2.props.field.year_placeholder
41347
+ });
41348
 
41349
+ case 'MM':
41350
+ return _react2['default'].createElement(FormFieldDateMonth, {
41351
+ onValueChange: _this2.onValueChange,
41352
+ key: 'month',
41353
+ name: _this2.props.field.name,
41354
+ month: _this2.state.month,
41355
+ monthNames: monthNames,
41356
+ placeholder: _this2.props.field.month_placeholder
41357
+ });
41358
 
41359
+ case 'DD':
41360
+ return _react2['default'].createElement(FormFieldDateDay, {
41361
+ onValueChange: _this2.onValueChange,
41362
+ key: 'day',
41363
+ name: _this2.props.field.name,
41364
+ day: _this2.state.day,
41365
+ placeholder: _this2.props.field.day_placeholder
41366
+ });
41367
+
41368
+ default:
41369
+ return _react2['default'].createElement(
41370
+ 'div',
41371
+ null,
41372
+ 'Invalid date type'
41373
+ );
41374
+ }
41375
+ });
41376
+
41377
+ return _react2['default'].createElement(
41378
+ 'div',
41379
+ null,
41380
+ fields
41381
+ );
41382
+ }
41383
+ }]);
41384
 
41385
  return FormFieldDate;
41386
+ })(_react2['default'].Component);
41387
+
41388
+ FormFieldDate.propTypes = {
41389
+ item: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
41390
+ field: _propTypes2['default'].shape({
41391
+ name: _propTypes2['default'].string,
41392
+ day_placeholder: _propTypes2['default'].string,
41393
+ month_placeholder: _propTypes2['default'].string,
41394
+ year_placeholder: _propTypes2['default'].string,
41395
+ params: _propTypes2['default'].object }). // eslint-disable-line react/forbid-prop-types
41396
+ isRequired,
41397
+ onValueChange: _propTypes2['default'].func.isRequired
41398
+ };
41399
+
41400
+ exports['default'] = FormFieldDate;
41401
+ module.exports = exports['default'];
41402
 
41403
  /***/ },
41404
  /* 305 */
58453
  /* 437 */
58454
  /***/ function(module, exports, __webpack_require__) {
58455
 
58456
+ 'use strict';
58457
 
58458
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
58459
 
58460
+ var _react = __webpack_require__(2);
 
58461
 
58462
+ var _react2 = _interopRequireDefault(_react);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58463
 
58464
+ var _classnames = __webpack_require__(277);
 
58465
 
58466
+ var _classnames2 = _interopRequireDefault(_classnames);
58467
 
58468
+ var _reactRouter = __webpack_require__(181);
 
 
 
 
 
 
58469
 
58470
+ var _mailpoet = __webpack_require__(276);
58471
+
58472
+ var _mailpoet2 = _interopRequireDefault(_mailpoet);
58473
+
58474
+ var Breadcrumb = _react2['default'].createClass({
58475
+ displayName: 'Breadcrumb',
58476
+
58477
+ getInitialState: function getInitialState() {
58478
+ var steps = this.props.steps || [{
58479
+ name: 'type',
58480
+ label: _mailpoet2['default'].I18n.t('selectType'),
58481
+ link: '/new'
58482
+ }, {
58483
+ name: 'template',
58484
+ label: _mailpoet2['default'].I18n.t('template')
58485
+ }, {
58486
+ name: 'editor',
58487
+ label: _mailpoet2['default'].I18n.t('designer')
58488
+ }, {
58489
+ name: 'send',
58490
+ label: _mailpoet2['default'].I18n.t('send')
58491
+ }];
58492
+ return {
58493
+ step: null,
58494
+ steps: steps
58495
+ };
58496
+ },
58497
+ render: function render() {
58498
+ var _this = this;
58499
+
58500
+ var steps = this.state.steps.map(function (step, index) {
58501
+ var stepClasses = (0, _classnames2['default'])({ mailpoet_current: _this.props.step === step.name });
58502
+
58503
+ var label = step.label;
58504
+
58505
+ if (step.link !== undefined && _this.props.step !== step.name) {
58506
+ label = _react2['default'].createElement(
58507
+ _reactRouter.Link,
58508
+ { to: step.link },
58509
+ step.label
58510
  );
58511
+ }
58512
 
58513
+ return _react2['default'].createElement(
58514
+ 'span',
58515
+ { key: 'step-' + step.label },
58516
+ _react2['default'].createElement(
58517
+ 'span',
58518
+ { className: stepClasses },
58519
+ label
58520
+ ),
58521
+ index < _this.state.steps.length - 1 ? ' > ' : ''
58522
  );
58523
+ });
 
58524
 
58525
+ return _react2['default'].createElement(
58526
+ 'p',
58527
+ { className: 'mailpoet_breadcrumb' },
58528
+ steps
58529
+ );
58530
+ }
58531
+ });
58532
+
58533
+ module.exports = Breadcrumb;
58534
 
58535
  /***/ },
58536
  /* 438 */,
59997
  /* 525 */,
59998
  /* 526 */,
59999
  /* 527 */,
60000
+ /* 528 */,
60001
+ /* 529 */
60002
  /***/ function(module, exports, __webpack_require__) {
60003
 
60004
  /* WEBPACK VAR INJECTION */(function(global) {"use strict";
60005
 
60006
  if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
60007
+ module.exports = global["MailPoetLib"]["NewsletterWelcomeNotificationScheduling"] = __webpack_require__(530);
60008
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
60009
 
60010
  /***/ },
60011
+ /* 530 */
60012
  /***/ function(module, exports, __webpack_require__) {
60013
 
60014
  'use strict';
60035
 
60036
  var _formFieldsTextJsx2 = _interopRequireDefault(_formFieldsTextJsx);
60037
 
60038
+ var _newslettersSchedulingCommonJsx = __webpack_require__(531);
60039
 
60040
  var availableRoles = window.mailpoet_roles || {};
60041
  var availableSegments = _underscore2['default'].filter(window.mailpoet_segments || [], function (segment) {
60186
  module.exports = WelcomeScheduling;
60187
 
60188
  /***/ },
60189
+ /* 531 */
60190
  /***/ function(module, exports, __webpack_require__) {
60191
 
60192
  /* WEBPACK VAR INJECTION */(function(global) {"use strict";
60193
 
60194
  if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
60195
+ module.exports = global["MailPoetLib"]["NewsletterSchedulingCommonOptions"] = __webpack_require__(532);
60196
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
60197
 
60198
  /***/ },
60199
+ /* 532 */
60200
  /***/ function(module, exports, __webpack_require__) {
60201
 
60202
  'use strict';
60290
  exports.nthWeekDayValues = nthWeekDayValues;
60291
 
60292
  /***/ },
 
60293
  /* 533 */,
60294
  /* 534 */,
60295
  /* 535 */,
60338
 
60339
  var _underscore2 = _interopRequireDefault(_underscore);
60340
 
60341
+ var _propTypes = __webpack_require__(185);
60342
+
60343
+ var _propTypes2 = _interopRequireDefault(_propTypes);
60344
+
60345
  var AutomaticEmailEventsList = (function (_React$Component) {
60346
  _inherits(AutomaticEmailEventsList, _React$Component);
60347
 
60370
  if (_this.email.premium) {
60371
  action = _react2['default'].createElement(
60372
  'a',
60373
+ {
60374
+ href: '?page=mailpoet-premium',
60375
  target: '_blank'
60376
  },
60377
  _mailpoet2['default'].I18n.t('premiumFeatureLink')
60381
 
60382
  action = _react2['default'].createElement(
60383
  'a',
60384
+ {
60385
+ className: 'button button-primary',
60386
  disabled: disabled,
60387
  onClick: !disabled ? _this.eventsConfigurator.bind(null, event.slug) : null
60388
  },
60466
  return AutomaticEmailEventsList;
60467
  })(_react2['default'].Component);
60468
 
60469
+ AutomaticEmailEventsList.propTypes = {
60470
+
60471
+ route: _propTypes2['default'].shape({
60472
+ data: _propTypes2['default'].shape({
60473
+ email: _propTypes2['default'].string.isRequired
60474
+ }).isRequired
60475
+ }).isRequired,
60476
+
60477
+ router: _propTypes2['default'].shape({
60478
+ push: _propTypes2['default'].func.isRequired
60479
+ }).isRequired
60480
+
60481
+ };
60482
+
60483
  module.exports = AutomaticEmailEventsList;
60484
 
60485
  /***/ },
60512
 
60513
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
60514
 
60515
+ var _propTypes = __webpack_require__(185);
60516
+
60517
+ var _propTypes2 = _interopRequireDefault(_propTypes);
60518
+
60519
  function AutomaticEmailsBreadcrumb(props) {
60520
  var steps = [{
60521
  name: 'type',
60541
  return _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: props.step, steps: steps });
60542
  }
60543
 
60544
+ AutomaticEmailsBreadcrumb.propTypes = {
60545
+ step: _propTypes2['default'].string.isRequired
60546
+ };
60547
+
60548
  module.exports = AutomaticEmailsBreadcrumb;
60549
 
60550
  /***/ },
60608
  render: function render() {
60609
  var _this = this;
60610
 
60611
+ var tabs = this.state.tabs.map(function (tab) {
60612
  var tabClasses = (0, _classnames2['default'])('nav-tab', { 'nav-tab-active': _this.props.tab === tab.name });
60613
 
60614
  return _react2['default'].createElement(
60615
  _reactRouter.Link,
60616
  {
60617
+ key: 'tab-' + tab.label,
60618
  className: tabClasses,
60619
  to: tab.link,
60620
  onClick: function () {
60687
 
60688
  var _jquery2 = _interopRequireDefault(_jquery);
60689
 
60690
+ var _underscore = __webpack_require__(281);
60691
+
60692
+ var _underscore2 = _interopRequireDefault(_underscore);
60693
+
60694
  var _wpJsHooks = __webpack_require__(433);
60695
 
60696
  var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
60775
  _mailpoet2['default'].I18n.t('newsletterQueueCompleted').replace('%$1d', parseInt(newsletter.queue.count_processed, 10).toLocaleString()).replace('%$2d', parseInt(newsletter.queue.count_total, 10).toLocaleString())
60776
  );
60777
  } else {
60778
+ var resumeSendingClick = _underscore2['default'].partial(this.resumeSending, newsletter);
60779
  label = _react2['default'].createElement(
60780
  'span',
60781
  null,
60790
  className: 'button',
60791
  style: { display: newsletter.queue.status === 'paused' ? 'inline-block' : 'none' },
60792
  href: 'javascript:;',
60793
+ onClick: resumeSendingClick
60794
  },
60795
  _mailpoet2['default'].I18n.t('resume')
60796
  ),
60801
  className: 'button mailpoet_pause',
60802
  style: { display: newsletter.queue.status === null ? 'inline-block' : 'none' },
60803
  href: 'javascript:;',
60804
+ onClick: resumeSendingClick
60805
  },
60806
  _mailpoet2['default'].I18n.t('pause')
60807
  )
61139
  null,
61140
  _react2['default'].createElement(
61141
  'a',
61142
+ {
61143
+ href: 'javascript:;',
61144
  className: 'button',
61145
  onClick: this.resumeMailerSending
61146
  },
61216
 
61217
  var _react2 = _interopRequireDefault(_react);
61218
 
61219
+ var _propTypes = __webpack_require__(185);
61220
+
61221
+ var _propTypes2 = _interopRequireDefault(_propTypes);
61222
+
61223
  var _badgeJsx = __webpack_require__(551);
61224
 
61225
  var _badgeJsx2 = _interopRequireDefault(_badgeJsx);
61328
  return StatsBadge;
61329
  })(_react2['default'].Component);
61330
 
61331
+ StatsBadge.propTypes = {
61332
+ stat: _propTypes2['default'].string.isRequired,
61333
+ rate: _propTypes2['default'].number.isRequired,
61334
+ tooltipId: _propTypes2['default'].string.isRequired,
61335
+ headline: _propTypes2['default'].string
61336
+ };
61337
+
61338
+ StatsBadge.defaultProps = {
61339
+ headline: ''
61340
+ };
61341
+
61342
  exports['default'] = StatsBadge;
61343
  module.exports = exports['default'];
61344
 
61366
 
61367
  var _reactTooltip2 = _interopRequireDefault(_reactTooltip);
61368
 
61369
+ var _propTypes = __webpack_require__(185);
61370
+
61371
+ var _propTypes2 = _interopRequireDefault(_propTypes);
61372
+
61373
  function Badge(props) {
61374
  var badgeClasses = (0, _classnames2['default'])('mailpoet_badge', props.type ? 'mailpoet_badge_' + props.type : '');
61375
 
61397
  );
61398
  }
61399
 
61400
+ Badge.propTypes = {
61401
+ name: _propTypes2['default'].string.isRequired,
61402
+ tooltip: _propTypes2['default'].string,
61403
+ tooltipId: _propTypes2['default'].string,
61404
+ type: _propTypes2['default'].string
61405
+ };
61406
+
61407
+ Badge.defaultProps = {
61408
+ type: undefined,
61409
+ tooltipId: undefined,
61410
+ tooltip: undefined
61411
+ };
61412
+
61413
  exports['default'] = Badge;
61414
  module.exports = exports['default'];
61415
 
assets/js/{form_editor.20737db0.js → form_editor.ba96f4f2.js} RENAMED
@@ -593,7 +593,7 @@ webpackJsonp([2],{
593
  }
594
  // set position for button
595
  window.$(element).setStyle({
596
- left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px',
597
  top: relativeTop + 'px'
598
  });
599
  });
@@ -601,17 +601,17 @@ webpackJsonp([2],{
601
  initToolbarPosition: function () {
602
  if (WysijaForm.toolbar.top === null) {
603
  WysijaForm.toolbar.top =
604
- parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
605
  }
606
  if (WysijaForm.toolbar.y === null) {
607
- WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
608
  }
609
 
610
  if (window.isRtl) {
611
  if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
612
  } else if (WysijaForm.toolbar.left === null) {
613
  WysijaForm.toolbar.left =
614
- parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
615
  }
616
  if (WysijaForm.toolbar.x === null) {
617
  WysijaForm.toolbar.x =
@@ -647,7 +647,7 @@ webpackJsonp([2],{
647
  if (WysijaForm.toolbar.effect !== null) WysijaForm.toolbar.effect.cancel();
648
 
649
  if (WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
650
- WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top);
651
  // start effect
652
  WysijaForm.toolbar.effect = new window.Effect.Move(WysijaForm.options.toolbar, {
653
  x: WysijaForm.toolbar.x,
593
  }
594
  // set position for button
595
  window.$(element).setStyle({
596
+ left: parseInt((parentDim.width / 2) - (element.getWidth() / 2), 10) + 'px',
597
  top: relativeTop + 'px'
598
  });
599
  });
601
  initToolbarPosition: function () {
602
  if (WysijaForm.toolbar.top === null) {
603
  WysijaForm.toolbar.top =
604
+ parseInt(window.$(WysijaForm.options.container).positionedOffset().top, 10);
605
  }
606
  if (WysijaForm.toolbar.y === null) {
607
+ WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top, 10);
608
  }
609
 
610
  if (window.isRtl) {
611
  if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
612
  } else if (WysijaForm.toolbar.left === null) {
613
  WysijaForm.toolbar.left =
614
+ parseInt(window.$(WysijaForm.options.container).positionedOffset().left, 10);
615
  }
616
  if (WysijaForm.toolbar.x === null) {
617
  WysijaForm.toolbar.x =
647
  if (WysijaForm.toolbar.effect !== null) WysijaForm.toolbar.effect.cancel();
648
 
649
  if (WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
650
+ WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top, 10);
651
  // start effect
652
  WysijaForm.toolbar.effect = new window.Effect.Move(WysijaForm.options.toolbar, {
653
  x: WysijaForm.toolbar.x,
assets/js/lib/mailpoet_shortcodes/plugin.js CHANGED
@@ -10,27 +10,26 @@
10
 
11
  /* jshint unused:false */
12
  /* global tinymce:true */
13
- tinymce.PluginManager.add('mailpoet_shortcodes', function (editor) { // eslint-disable-line func-names
14
- var appendLabelAndClose = function (shortcode) { // eslint-disable-line func-names
15
  editor.insertContent(shortcode);
16
  editor.windowManager.close();
17
  };
18
- var generateOnClickFunc = function (shortcode) { // eslint-disable-line func-names
19
- return function () { // eslint-disable-line func-names
20
  appendLabelAndClose(shortcode);
21
  };
22
  };
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
- onclick: function () { // eslint-disable-line func-names
27
  var shortcodes = [];
28
  var configShortcodes = editor.settings.mailpoet_shortcodes;
29
- var segment;
30
  var i;
31
 
32
- for (segment in configShortcodes) {
33
- if (configShortcodes.hasOwnProperty(segment)) {
34
  shortcodes.push({
35
  type: 'label',
36
  text: segment
@@ -44,12 +43,12 @@ tinymce.PluginManager.add('mailpoet_shortcodes', function (editor) { // eslint-d
44
  });
45
  }
46
  }
47
- }
48
 
49
  // Open window
50
  editor.windowManager.open({
51
- height: parseInt(editor.getParam('plugin_mailpoet_shortcodes_height', 400)),
52
- width: parseInt(editor.getParam('plugin_mailpoet_shortcodes_width', 450)),
53
  autoScroll: true,
54
  title: editor.settings.mailpoet_shortcodes_window_title,
55
  body: shortcodes,
10
 
11
  /* jshint unused:false */
12
  /* global tinymce:true */
13
+ tinymce.PluginManager.add('mailpoet_shortcodes', function tinyMceAdd(editor) {
14
+ var appendLabelAndClose = function appendLabelAndCLose(shortcode) {
15
  editor.insertContent(shortcode);
16
  editor.windowManager.close();
17
  };
18
+ var generateOnClickFunc = function generateOnClickFunc(shortcode) {
19
+ return function appendAndClose() {
20
  appendLabelAndClose(shortcode);
21
  };
22
  };
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
+ onclick: function onClick() {
27
  var shortcodes = [];
28
  var configShortcodes = editor.settings.mailpoet_shortcodes;
 
29
  var i;
30
 
31
+ Object.keys(configShortcodes).forEach(function configShortcodesLoop(segment) {
32
+ if (Object.prototype.hasOwnProperty.call(configShortcodes, segment)) {
33
  shortcodes.push({
34
  type: 'label',
35
  text: segment
43
  });
44
  }
45
  }
46
+ });
47
 
48
  // Open window
49
  editor.windowManager.open({
50
+ height: parseInt(editor.getParam('plugin_mailpoet_shortcodes_height', 400), 10),
51
+ width: parseInt(editor.getParam('plugin_mailpoet_shortcodes_width', 450), 10),
52
  autoScroll: true,
53
  title: editor.settings.mailpoet_shortcodes_window_title,
54
  body: shortcodes,
assets/js/{mailpoet.273fb921.js → mailpoet.32d22471.js} RENAMED
@@ -50943,13 +50943,13 @@ webpackJsonp([3],[
50943
  case 'popup':
50944
  screenWidth = jQuery(window).width();
50945
  screenHeight = jQuery(window).height();
50946
- modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width();
50947
- modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
50948
 
50949
  // set position of popup depending on screen dimensions.
50950
  jQuery('#mailpoet_popup').css({
50951
- top: Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
50952
- left: Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)))
50953
  });
50954
  break;
50955
  case 'panel':
@@ -51417,15 +51417,14 @@ webpackJsonp([3],[
51417
  }
51418
  },
51419
  hide: function hide(all) {
51420
- var id;
51421
  if (all !== undefined && all === true) {
51422
  // all notices
51423
  jQuery('.mailpoet_notice:not([id])').trigger('close');
51424
  } else if (all !== undefined && jQuery.isArray(all)) {
51425
  // array of ids
51426
- for (id in all) {
51427
  jQuery('[data-id="' + all[id] + '"]').trigger('close');
51428
- }
51429
  } if (all !== undefined) {
51430
  // single id
51431
  jQuery('[data-id="' + all + '"]').trigger('close');
@@ -51544,10 +51543,13 @@ webpackJsonp([3],[
51544
 
51545
  // Coerce values.
51546
  if (coerce) {
51547
- val = val && !isNaN(val) ? +val // number
51548
- : val === 'undefined' ? undefined // undefined
51549
- : coerceTypes[val] !== undefined ? coerceTypes[val] // true, false, null
51550
- : val; // string
 
 
 
51551
  }
51552
 
51553
  if (keysLast) {
50943
  case 'popup':
50944
  screenWidth = jQuery(window).width();
50945
  screenHeight = jQuery(window).height();
50946
+ modalWidth = jQuery('.mailpoet_' + this.options.type + '_wrapper').width();
50947
+ modalHeight = jQuery('.mailpoet_' + this.options.type + '_wrapper').height();
50948
 
50949
  // set position of popup depending on screen dimensions.
50950
  jQuery('#mailpoet_popup').css({
50951
+ top: Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2), 10)),
50952
+ left: Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2), 10))
50953
  });
50954
  break;
50955
  case 'panel':
51417
  }
51418
  },
51419
  hide: function hide(all) {
 
51420
  if (all !== undefined && all === true) {
51421
  // all notices
51422
  jQuery('.mailpoet_notice:not([id])').trigger('close');
51423
  } else if (all !== undefined && jQuery.isArray(all)) {
51424
  // array of ids
51425
+ Object.keys(all).forEach(function close(id) {
51426
  jQuery('[data-id="' + all[id] + '"]').trigger('close');
51427
+ });
51428
  } if (all !== undefined) {
51429
  // single id
51430
  jQuery('[data-id="' + all + '"]').trigger('close');
51543
 
51544
  // Coerce values.
51545
  if (coerce) {
51546
+ if (val && !isNaN(val)) { // number
51547
+ val = +val;
51548
+ } else if (val === 'undefined') { // undefined
51549
+ val = undefined;
51550
+ } else if (coerceTypes[val] !== undefined) { // true, false, null
51551
+ val = coerceTypes[val];
51552
+ }
51553
  }
51554
 
51555
  if (keysLast) {
assets/js/manifest.json CHANGED
@@ -1,10 +1,10 @@
1
  {
2
- "mp2migrator.js": "mp2migrator.d90426c2.js",
3
- "public.js": "public.ec1bce32.js",
4
- "admin.js": "admin.0a76985e.js",
5
- "admin_vendor.js": "admin_vendor.9fdf3dc7.js",
6
- "form_editor.js": "form_editor.20737db0.js",
7
- "mailpoet.js": "mailpoet.273fb921.js",
8
- "newsletter_editor.js": "newsletter_editor.c65261cf.js",
9
- "vendor.js": "vendor.e6d02f27.js"
10
  }
1
  {
2
+ "mp2migrator.js": "mp2migrator.b51cde67.js",
3
+ "public.js": "public.e7370e60.js",
4
+ "admin.js": "admin.914e9da8.js",
5
+ "admin_vendor.js": "admin_vendor.80f188f7.js",
6
+ "form_editor.js": "form_editor.ba96f4f2.js",
7
+ "mailpoet.js": "mailpoet.32d22471.js",
8
+ "newsletter_editor.js": "newsletter_editor.637e880e.js",
9
+ "vendor.js": "vendor.05dc4a66.js"
10
  }
assets/js/{mp2migrator.d90426c2.js → mp2migrator.b51cde67.js} RENAMED
@@ -88,15 +88,13 @@
88
  var row = resultRow;
89
  if (row.substr(0, 7) === '[ERROR]' || row.substr(0, 9) === '[WARNING]' || row === MailPoet.I18n.t('import_stopped_by_user')) {
90
  row = '<span class="error_msg">' + row + '</span>'; // Mark the errors in red
91
- }
92
- // Test if the import is complete
93
- else if (row === MailPoet.I18n.t('import_complete')) {
94
  jQuery('#import-actions').hide();
95
  jQuery('#upgrade-completed').show();
96
  }
97
  jQuery('#logger').append(row + '<br />\n');
98
  });
99
- jQuery('#logger').append('<span class="error_msg">' + MailPoet.MP2Migrator.fatal_error + '</span>' + '<br />\n');
100
  }).always(function () {
101
  if (MailPoet.MP2Migrator.is_logging) {
102
  MailPoet.MP2Migrator.displayLogs_timeout = setTimeout(
88
  var row = resultRow;
89
  if (row.substr(0, 7) === '[ERROR]' || row.substr(0, 9) === '[WARNING]' || row === MailPoet.I18n.t('import_stopped_by_user')) {
90
  row = '<span class="error_msg">' + row + '</span>'; // Mark the errors in red
91
+ } else if (row === MailPoet.I18n.t('import_complete')) { // Test if the import is complete
 
 
92
  jQuery('#import-actions').hide();
93
  jQuery('#upgrade-completed').show();
94
  }
95
  jQuery('#logger').append(row + '<br />\n');
96
  });
97
+ jQuery('#logger').append('<span class="error_msg">' + MailPoet.MP2Migrator.fatal_error + '</span><br />\n');
98
  }).always(function () {
99
  if (MailPoet.MP2Migrator.is_logging) {
100
  MailPoet.MP2Migrator.displayLogs_timeout = setTimeout(
assets/js/{newsletter_editor.c65261cf.js → newsletter_editor.637e880e.js} RENAMED
@@ -7480,7 +7480,7 @@ webpackJsonp([4],{
7480
 
7481
  /***/ },
7482
 
7483
- /***/ 535:
7484
  /***/ function(module, exports, __webpack_require__) {
7485
 
7486
  'use strict';
@@ -7499,7 +7499,7 @@ webpackJsonp([4],{
7499
 
7500
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
7501
 
7502
- var _html2canvas = __webpack_require__(536);
7503
 
7504
  var _html2canvas2 = _interopRequireDefault(_html2canvas);
7505
 
@@ -7584,15 +7584,15 @@ webpackJsonp([4],{
7584
 
7585
  /***/ },
7586
 
7587
- /***/ 536:
7588
  /***/ function(module, exports, __webpack_require__) {
7589
 
7590
- /* WEBPACK VAR INJECTION */(function(global) {module.exports = global["html2canvas"] = __webpack_require__(537);
7591
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
7592
 
7593
  /***/ },
7594
 
7595
- /***/ 537:
7596
  /***/ function(module, exports, __webpack_require__) {
7597
 
7598
  /*!
@@ -17236,13 +17236,13 @@ webpackJsonp([4],{
17236
  case 'popup':
17237
  screenWidth = jQuery(window).width();
17238
  screenHeight = jQuery(window).height();
17239
- modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width();
17240
- modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
17241
 
17242
  // set position of popup depending on screen dimensions.
17243
  jQuery('#mailpoet_popup').css({
17244
- top: Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
17245
- left: Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)))
17246
  });
17247
  break;
17248
  case 'panel':
@@ -17711,15 +17711,14 @@ webpackJsonp([4],{
17711
  }
17712
  },
17713
  hide: function hide(all) {
17714
- var id;
17715
  if (all !== undefined && all === true) {
17716
  // all notices
17717
  jQuery('.mailpoet_notice:not([id])').trigger('close');
17718
  } else if (all !== undefined && jQuery.isArray(all)) {
17719
  // array of ids
17720
- for (id in all) {
17721
  jQuery('[data-id="' + all[id] + '"]').trigger('close');
17722
- }
17723
  } if (all !== undefined) {
17724
  // single id
17725
  jQuery('[data-id="' + all + '"]').trigger('close');
@@ -35733,7 +35732,7 @@ webpackJsonp([4],{
35733
  __webpack_require__(275),
35734
  __webpack_require__(597),
35735
  __webpack_require__(598),
35736
- __webpack_require__(535),
35737
  __webpack_require__(281),
35738
  __webpack_require__(275)
35739
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
@@ -38129,12 +38128,12 @@ webpackJsonp([4],{
38129
  callable(event);
38130
  },
38131
  updateMaxWidth: function () {
38132
- var maxWidth = parseInt(this.model.get('maxWidth'));
38133
  this.$('.mailpoet_field_image_width').attr('max', maxWidth);
38134
  this.$('.mailpoet_field_image_width_input').attr('max', maxWidth);
38135
  },
38136
  updateWidth: function () {
38137
- var width = parseInt(this.model.get('width'));
38138
  this.$('.mailpoet_field_image_width').val(width);
38139
  this.$('.mailpoet_field_image_width_input').val(width);
38140
  },
@@ -38520,7 +38519,7 @@ webpackJsonp([4],{
38520
  },
38521
  templateContext: function templateContext() {
38522
  return _.extend({
38523
- totalHeight: (parseInt(this.model.get('styles.block.padding'), 10) * 2) + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
38524
  }, base.BlockView.prototype.templateContext.apply(this));
38525
  },
38526
  onRender: function onRender() {
@@ -38534,7 +38533,7 @@ webpackJsonp([4],{
38534
  changePadding: function changePadding() {
38535
  this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
38536
  this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
38537
- this.$('.mailpoet_resize_handle_text').text((parseInt(this.model.get('styles.block.padding'), 10) * 2) + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
38538
  }
38539
  });
38540
 
7480
 
7481
  /***/ },
7482
 
7483
+ /***/ 534:
7484
  /***/ function(module, exports, __webpack_require__) {
7485
 
7486
  'use strict';
7499
 
7500
  var _mailpoet2 = _interopRequireDefault(_mailpoet);
7501
 
7502
+ var _html2canvas = __webpack_require__(535);
7503
 
7504
  var _html2canvas2 = _interopRequireDefault(_html2canvas);
7505
 
7584
 
7585
  /***/ },
7586
 
7587
+ /***/ 535:
7588
  /***/ function(module, exports, __webpack_require__) {
7589
 
7590
+ /* WEBPACK VAR INJECTION */(function(global) {module.exports = global["html2canvas"] = __webpack_require__(536);
7591
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
7592
 
7593
  /***/ },
7594
 
7595
+ /***/ 536:
7596
  /***/ function(module, exports, __webpack_require__) {
7597
 
7598
  /*!
17236
  case 'popup':
17237
  screenWidth = jQuery(window).width();
17238
  screenHeight = jQuery(window).height();
17239
+ modalWidth = jQuery('.mailpoet_' + this.options.type + '_wrapper').width();
17240
+ modalHeight = jQuery('.mailpoet_' + this.options.type + '_wrapper').height();
17241
 
17242
  // set position of popup depending on screen dimensions.
17243
  jQuery('#mailpoet_popup').css({
17244
+ top: Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2), 10)),
17245
+ left: Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2), 10))
17246
  });
17247
  break;
17248
  case 'panel':
17711
  }
17712
  },
17713
  hide: function hide(all) {
 
17714
  if (all !== undefined && all === true) {
17715
  // all notices
17716
  jQuery('.mailpoet_notice:not([id])').trigger('close');
17717
  } else if (all !== undefined && jQuery.isArray(all)) {
17718
  // array of ids
17719
+ Object.keys(all).forEach(function close(id) {
17720
  jQuery('[data-id="' + all[id] + '"]').trigger('close');
17721
+ });
17722
  } if (all !== undefined) {
17723
  // single id
17724
  jQuery('[data-id="' + all + '"]').trigger('close');
35732
  __webpack_require__(275),
35733
  __webpack_require__(597),
35734
  __webpack_require__(598),
35735
+ __webpack_require__(534),
35736
  __webpack_require__(281),
35737
  __webpack_require__(275)
35738
  ], __WEBPACK_AMD_DEFINE_RESULT__ = function (
38128
  callable(event);
38129
  },
38130
  updateMaxWidth: function () {
38131
+ var maxWidth = parseInt(this.model.get('maxWidth'), 10);
38132
  this.$('.mailpoet_field_image_width').attr('max', maxWidth);
38133
  this.$('.mailpoet_field_image_width_input').attr('max', maxWidth);
38134
  },
38135
  updateWidth: function () {
38136
+ var width = parseInt(this.model.get('width'), 10);
38137
  this.$('.mailpoet_field_image_width').val(width);
38138
  this.$('.mailpoet_field_image_width_input').val(width);
38139
  },
38519
  },
38520
  templateContext: function templateContext() {
38521
  return _.extend({
38522
+ totalHeight: (parseInt(this.model.get('styles.block.padding'), 10) * 2) + parseInt(this.model.get('styles.block.borderWidth'), 10) + 'px'
38523
  }, base.BlockView.prototype.templateContext.apply(this));
38524
  },
38525
  onRender: function onRender() {
38533
  changePadding: function changePadding() {
38534
  this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
38535
  this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
38536
+ this.$('.mailpoet_resize_handle_text').text((parseInt(this.model.get('styles.block.padding'), 10) * 2) + parseInt(this.model.get('styles.block.borderWidth'), 10) + 'px');
38537
  }
38538
  });
38539
 
assets/js/{public.ec1bce32.js → public.e7370e60.js} RENAMED
@@ -1849,10 +1849,13 @@
1849
 
1850
  // Coerce values.
1851
  if (coerce) {
1852
- val = val && !isNaN(val) ? +val // number
1853
- : val === 'undefined' ? undefined // undefined
1854
- : coerceTypes[val] !== undefined ? coerceTypes[val] // true, false, null
1855
- : val; // string
 
 
 
1856
  }
1857
 
1858
  if (keysLast) {
1849
 
1850
  // Coerce values.
1851
  if (coerce) {
1852
+ if (val && !isNaN(val)) { // number
1853
+ val = +val;
1854
+ } else if (val === 'undefined') { // undefined
1855
+ val = undefined;
1856
+ } else if (coerceTypes[val] !== undefined) { // true, false, null
1857
+ val = coerceTypes[val];
1858
+ }
1859
  }
1860
 
1861
  if (keysLast) {
assets/js/{vendor.e6d02f27.js → vendor.05dc4a66.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":"0a76985e","1":"9fdf3dc7","2":"20737db0","3":"273fb921","4":"c65261cf"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
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":"914e9da8","1":"80f188f7","2":"ba96f4f2","3":"32d22471","4":"637e880e"}[chunkId] + ".chunk.js";
80
  /******/ head.appendChild(script);
81
  /******/ }
82
  /******/ };
lang/mailpoet-ca.mo CHANGED
Binary file
lang/mailpoet-da_DK.mo CHANGED
Binary file
lang/mailpoet-de_DE.mo CHANGED
Binary file
lang/mailpoet-en_GB.mo DELETED
Binary file
lang/mailpoet-es_ES.mo CHANGED
Binary file
lang/mailpoet-fa_IR.mo CHANGED
Binary file
lang/mailpoet-fr_CA.mo CHANGED
Binary file
lang/mailpoet-fr_FR.mo CHANGED
Binary file
lang/mailpoet-it_IT.mo CHANGED
Binary file
lang/mailpoet-ja.mo CHANGED
Binary file
lang/mailpoet-nl_NL.mo CHANGED
Binary file
lang/mailpoet-pl_PL.mo CHANGED
Binary file
lang/mailpoet-pt_BR.mo CHANGED
Binary file
lang/mailpoet-pt_PT.mo CHANGED
Binary file
lang/mailpoet-ru_RU.mo CHANGED
Binary file
lang/mailpoet-sq.mo CHANGED
Binary file
lang/mailpoet-sv_SE.mo CHANGED
Binary file
lang/mailpoet-tr_TR.mo CHANGED
Binary file
lang/mailpoet.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
- "POT-Creation-Date: 2018-04-17 12:05:29+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2018-04-24 12:18:47+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
lib/Segments/SubscribersFinder.php CHANGED
@@ -85,7 +85,7 @@ class SubscribersFinder {
85
  private function addSubscribersToTaskFromStaticSegments(ScheduledTask $task, array $segments) {
86
  $segment_ids = Helpers::arrayColumn($segments, 'id');
87
  Subscriber::rawExecute(
88
- 'INSERT INTO ' . MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE . '
89
  (task_id, subscriber_id, processed)
90
  SELECT DISTINCT ? as task_id, subscribers.`id` as subscriber_id, ? as processed
91
  FROM ' . MP_SUBSCRIBER_SEGMENT_TABLE . ' relation
85
  private function addSubscribersToTaskFromStaticSegments(ScheduledTask $task, array $segments) {
86
  $segment_ids = Helpers::arrayColumn($segments, 'id');
87
  Subscriber::rawExecute(
88
+ 'INSERT IGNORE INTO ' . MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE . '
89
  (task_id, subscriber_id, processed)
90
  SELECT DISTINCT ? as task_id, subscribers.`id` as subscriber_id, ? as processed
91
  FROM ' . MP_SUBSCRIBER_SEGMENT_TABLE . ' relation
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
- * Version: 3.6.6
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
@@ -20,7 +20,7 @@ if(!defined('ABSPATH')) exit;
20
  */
21
 
22
  $mailpoet_plugin = array(
23
- 'version' => '3.6.6',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
+ * Version: 3.6.7
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
20
  */
21
 
22
  $mailpoet_plugin = array(
23
+ 'version' => '3.6.7',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: newsletter, email, welcome email, post notification, autoresponder, signup
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
- Stable tag: 3.6.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -116,6 +116,9 @@ Stop by our [support site](https://www.mailpoet.com/support).
116
 
117
  == Changelog ==
118
 
 
 
 
119
  = 3.6.6 - 2018-04-17 =
120
  * Fixed: missing database records no longer break the sending process. Thanks, Catalin;
121
 
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
+ Stable tag: 3.6.7
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 3.6.7 - 2018-04-24 =
120
+ * Fixed: Duplicates in the database will not stop scheduled newsletters anymore.
121
+
122
  = 3.6.6 - 2018-04-17 =
123
  * Fixed: missing database records no longer break the sending process. Thanks, Catalin;
124
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInite4409982b483a0bfcdd15f92941cec87::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e', '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\ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit683c9e96a2feac320233f10a1d68d14e
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire683c9e96a2feac320233f10a1d68d14e($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire683c9e96a2feac320233f10a1d68d14e($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 ComposerAutoloaderInite4409982b483a0bfcdd15f92941cec87
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInite4409982b483a0bfcdd15f92941cec87', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInite4409982b483a0bfcdd15f92941cec87', '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\ComposerStaticInite4409982b483a0bfcdd15f92941cec87::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\ComposerStaticInite4409982b483a0bfcdd15f92941cec87::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequiree4409982b483a0bfcdd15f92941cec87($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequiree4409982b483a0bfcdd15f92941cec87($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 ComposerStaticInit683c9e96a2feac320233f10a1d68d14e
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -991,10 +991,10 @@ class ComposerStaticInit683c9e96a2feac320233f10a1d68d14e
991
  public static function getInitializer(ClassLoader $loader)
992
  {
993
  return \Closure::bind(function () use ($loader) {
994
- $loader->prefixLengthsPsr4 = ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::$prefixLengthsPsr4;
995
- $loader->prefixDirsPsr4 = ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::$prefixDirsPsr4;
996
- $loader->prefixesPsr0 = ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::$prefixesPsr0;
997
- $loader->classMap = ComposerStaticInit683c9e96a2feac320233f10a1d68d14e::$classMap;
998
 
999
  }, null, ClassLoader::class);
1000
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInite4409982b483a0bfcdd15f92941cec87
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
991
  public static function getInitializer(ClassLoader $loader)
992
  {
993
  return \Closure::bind(function () use ($loader) {
994
+ $loader->prefixLengthsPsr4 = ComposerStaticInite4409982b483a0bfcdd15f92941cec87::$prefixLengthsPsr4;
995
+ $loader->prefixDirsPsr4 = ComposerStaticInite4409982b483a0bfcdd15f92941cec87::$prefixDirsPsr4;
996
+ $loader->prefixesPsr0 = ComposerStaticInite4409982b483a0bfcdd15f92941cec87::$prefixesPsr0;
997
+ $loader->classMap = ComposerStaticInite4409982b483a0bfcdd15f92941cec87::$classMap;
998
 
999
  }, null, ClassLoader::class);
1000
  }
vendor/composer/installed.json CHANGED
@@ -34,6 +34,64 @@
34
  ],
35
  "description": "CSSTidy is a CSS minifier"
36
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  {
38
  "name": "j4mie/idiorm",
39
  "version": "v1.5.3",
@@ -206,41 +264,40 @@
206
  ]
207
  },
208
  {
209
- "name": "symfony/polyfill-mbstring",
210
- "version": "v1.6.0",
211
- "version_normalized": "1.6.0.0",
212
  "source": {
213
  "type": "git",
214
- "url": "https://github.com/symfony/polyfill-mbstring.git",
215
- "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
216
  },
217
  "dist": {
218
  "type": "zip",
219
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
220
- "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
221
  "shasum": ""
222
  },
223
  "require": {
224
- "php": ">=5.3.3"
 
225
  },
226
- "suggest": {
227
- "ext-mbstring": "For best performance"
 
228
  },
229
- "time": "2017-10-11T12:05:26+00:00",
230
  "type": "library",
231
  "extra": {
232
  "branch-alias": {
233
- "dev-master": "1.6-dev"
234
  }
235
  },
236
  "installation-source": "dist",
237
  "autoload": {
238
  "psr-4": {
239
- "Symfony\\Polyfill\\Mbstring\\": ""
240
- },
241
- "files": [
242
- "bootstrap.php"
243
- ]
244
  },
245
  "notification-url": "https://packagist.org/downloads/",
246
  "license": [
@@ -248,124 +305,48 @@
248
  ],
249
  "authors": [
250
  {
251
- "name": "Nicolas Grekas",
252
- "email": "p@tchwork.com"
253
- },
254
- {
255
- "name": "Symfony Community",
256
- "homepage": "https://symfony.com/contributors"
257
  }
258
  ],
259
- "description": "Symfony polyfill for the Mbstring extension",
260
- "homepage": "https://symfony.com",
261
  "keywords": [
262
- "compatibility",
263
- "mbstring",
264
- "polyfill",
265
- "portable",
266
- "shim"
267
  ]
268
  },
269
  {
270
- "name": "symfony/translation",
271
- "version": "v2.8.32",
272
- "version_normalized": "2.8.32.0",
273
- "source": {
274
- "type": "git",
275
- "url": "https://github.com/symfony/translation.git",
276
- "reference": "0c63d56516c4c4c323228ca6348eadb7c91b1daf"
277
- },
278
- "dist": {
279
- "type": "zip",
280
- "url": "https://api.github.com/repos/symfony/translation/zipball/0c63d56516c4c4c323228ca6348eadb7c91b1daf",
281
- "reference": "0c63d56516c4c4c323228ca6348eadb7c91b1daf",
282
- "shasum": ""
283
- },
284
- "require": {
285
- "php": ">=5.3.9",
286
- "symfony/polyfill-mbstring": "~1.0"
287
- },
288
- "conflict": {
289
- "symfony/config": "<2.7"
290
- },
291
- "require-dev": {
292
- "psr/log": "~1.0",
293
- "symfony/config": "~2.8",
294
- "symfony/intl": "~2.7.25|^2.8.18|~3.2.5",
295
- "symfony/yaml": "~2.2|~3.0.0"
296
- },
297
- "suggest": {
298
- "psr/log": "To use logging capability in translator",
299
- "symfony/config": "",
300
- "symfony/yaml": ""
301
- },
302
- "time": "2017-11-07T14:08:47+00:00",
303
- "type": "library",
304
- "extra": {
305
- "branch-alias": {
306
- "dev-master": "2.8-dev"
307
- }
308
- },
309
- "installation-source": "dist",
310
- "autoload": {
311
- "psr-4": {
312
- "Symfony\\Component\\Translation\\": ""
313
- },
314
- "exclude-from-classmap": [
315
- "/Tests/"
316
- ]
317
- },
318
- "notification-url": "https://packagist.org/downloads/",
319
- "license": [
320
- "MIT"
321
- ],
322
- "authors": [
323
- {
324
- "name": "Fabien Potencier",
325
- "email": "fabien@symfony.com"
326
- },
327
- {
328
- "name": "Symfony Community",
329
- "homepage": "https://symfony.com/contributors"
330
- }
331
- ],
332
- "description": "Symfony Translation Component",
333
- "homepage": "https://symfony.com"
334
- },
335
- {
336
- "name": "nesbot/carbon",
337
- "version": "1.22.1",
338
- "version_normalized": "1.22.1.0",
339
  "source": {
340
  "type": "git",
341
- "url": "https://github.com/briannesbitt/Carbon.git",
342
- "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
343
  },
344
  "dist": {
345
  "type": "zip",
346
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
347
- "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
348
  "shasum": ""
349
  },
350
  "require": {
351
- "php": ">=5.3.0",
352
- "symfony/translation": "~2.6 || ~3.0"
353
- },
354
- "require-dev": {
355
- "friendsofphp/php-cs-fixer": "~2",
356
- "phpunit/phpunit": "~4.0 || ~5.0"
357
  },
358
- "time": "2017-01-16T07:55:07+00:00",
359
  "type": "library",
360
  "extra": {
361
  "branch-alias": {
362
- "dev-master": "1.23-dev"
363
  }
364
  },
365
  "installation-source": "dist",
366
  "autoload": {
367
  "psr-4": {
368
- "Carbon\\": "src/Carbon/"
369
  }
370
  },
371
  "notification-url": "https://packagist.org/downloads/",
@@ -374,17 +355,16 @@
374
  ],
375
  "authors": [
376
  {
377
- "name": "Brian Nesbitt",
378
- "email": "brian@nesbot.com",
379
- "homepage": "http://nesbot.com"
380
  }
381
  ],
382
- "description": "A simple API extension for DateTime.",
383
- "homepage": "http://carbon.nesbot.com",
384
  "keywords": [
385
- "date",
386
- "datetime",
387
- "time"
388
  ]
389
  },
390
  {
@@ -434,34 +414,38 @@
434
  ]
435
  },
436
  {
437
- "name": "psr/log",
438
- "version": "1.0.2",
439
- "version_normalized": "1.0.2.0",
440
  "source": {
441
  "type": "git",
442
- "url": "https://github.com/php-fig/log.git",
443
- "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
444
  },
445
  "dist": {
446
  "type": "zip",
447
- "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
448
- "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
449
  "shasum": ""
450
  },
451
  "require": {
452
- "php": ">=5.3.0"
 
453
  },
454
- "time": "2016-10-10T12:19:37+00:00",
 
 
 
455
  "type": "library",
456
  "extra": {
457
  "branch-alias": {
458
- "dev-master": "1.0.x-dev"
459
  }
460
  },
461
  "installation-source": "dist",
462
  "autoload": {
463
- "psr-4": {
464
- "Psr\\Log\\": "Psr/Log/"
465
  }
466
  },
467
  "notification-url": "https://packagist.org/downloads/",
@@ -470,57 +454,100 @@
470
  ],
471
  "authors": [
472
  {
473
- "name": "PHP-FIG",
474
- "homepage": "http://www.php-fig.org/"
475
  }
476
  ],
477
- "description": "Common interface for logging libraries",
478
- "homepage": "https://github.com/php-fig/log",
479
- "keywords": [
480
- "log",
481
- "psr",
482
- "psr-3"
483
- ]
484
  },
485
  {
486
- "name": "symfony/debug",
487
- "version": "v3.4.1",
488
- "version_normalized": "3.4.1.0",
489
  "source": {
490
  "type": "git",
491
- "url": "https://github.com/symfony/debug.git",
492
- "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd"
493
  },
494
  "dist": {
495
  "type": "zip",
496
- "url": "https://api.github.com/repos/symfony/debug/zipball/fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
497
- "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
498
  "shasum": ""
499
  },
500
  "require": {
501
- "php": "^5.5.9|>=7.0.8",
502
- "psr/log": "~1.0"
 
503
  },
504
- "conflict": {
505
- "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  },
507
  "require-dev": {
508
- "symfony/http-kernel": "~2.8|~3.0|~4.0"
 
509
  },
510
- "time": "2017-11-21T09:01:46+00:00",
511
  "type": "library",
512
  "extra": {
513
  "branch-alias": {
514
- "dev-master": "3.4-dev"
515
  }
516
  },
517
  "installation-source": "dist",
518
  "autoload": {
519
- "psr-4": {
520
- "Symfony\\Component\\Debug\\": ""
521
- },
522
- "exclude-from-classmap": [
523
- "/Tests/"
524
  ]
525
  },
526
  "notification-url": "https://packagist.org/downloads/",
@@ -529,16 +556,20 @@
529
  ],
530
  "authors": [
531
  {
532
- "name": "Fabien Potencier",
533
- "email": "fabien@symfony.com"
534
  },
535
  {
536
- "name": "Symfony Community",
537
- "homepage": "https://symfony.com/contributors"
538
  }
539
  ],
540
- "description": "Symfony Debug Component",
541
- "homepage": "https://symfony.com"
 
 
 
 
 
542
  },
543
  {
544
  "name": "symfony/console",
@@ -611,97 +642,45 @@
611
  "homepage": "https://symfony.com"
612
  },
613
  {
614
- "name": "composer/ca-bundle",
615
- "version": "1.1.0",
616
- "version_normalized": "1.1.0.0",
617
  "source": {
618
  "type": "git",
619
- "url": "https://github.com/composer/ca-bundle.git",
620
- "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288"
621
  },
622
  "dist": {
623
  "type": "zip",
624
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288",
625
- "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288",
626
  "shasum": ""
627
  },
628
  "require": {
629
- "ext-openssl": "*",
630
- "ext-pcre": "*",
631
- "php": "^5.3.2 || ^7.0"
 
 
632
  },
633
  "require-dev": {
634
- "phpunit/phpunit": "^4.8.35",
635
- "psr/log": "^1.0",
636
- "symfony/process": "^2.5 || ^3.0 || ^4.0"
637
  },
638
- "time": "2017-11-29T09:37:33+00:00",
639
  "type": "library",
640
  "extra": {
641
  "branch-alias": {
642
- "dev-master": "1.x-dev"
643
  }
644
  },
645
  "installation-source": "dist",
646
  "autoload": {
647
  "psr-4": {
648
- "Composer\\CaBundle\\": "src"
649
- }
650
- },
651
- "notification-url": "https://packagist.org/downloads/",
652
- "license": [
653
- "MIT"
654
- ],
655
- "authors": [
656
- {
657
- "name": "Jordi Boggiano",
658
- "email": "j.boggiano@seld.be",
659
- "homepage": "http://seld.be"
660
- }
661
- ],
662
- "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
663
- "keywords": [
664
- "cabundle",
665
- "cacert",
666
- "certificate",
667
- "ssl",
668
- "tls"
669
- ]
670
- },
671
- {
672
- "name": "sensiolabs/security-checker",
673
- "version": "v4.1.6",
674
- "version_normalized": "4.1.6.0",
675
- "source": {
676
- "type": "git",
677
- "url": "https://github.com/sensiolabs/security-checker.git",
678
- "reference": "387b6a3b723ba35588b33d5f8d14e28ed608bd30"
679
- },
680
- "dist": {
681
- "type": "zip",
682
- "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/387b6a3b723ba35588b33d5f8d14e28ed608bd30",
683
- "reference": "387b6a3b723ba35588b33d5f8d14e28ed608bd30",
684
- "shasum": ""
685
- },
686
- "require": {
687
- "composer/ca-bundle": "^1.0",
688
- "symfony/console": "~2.7|~3.0|~4.0"
689
- },
690
- "time": "2017-10-29T18:48:08+00:00",
691
- "bin": [
692
- "security-checker"
693
- ],
694
- "type": "library",
695
- "extra": {
696
- "branch-alias": {
697
- "dev-master": "4.1-dev"
698
- }
699
- },
700
- "installation-source": "dist",
701
- "autoload": {
702
- "psr-0": {
703
- "SensioLabs\\Security": ""
704
- }
705
  },
706
  "notification-url": "https://packagist.org/downloads/",
707
  "license": [
@@ -710,99 +689,51 @@
710
  "authors": [
711
  {
712
  "name": "Fabien Potencier",
713
- "email": "fabien.potencier@gmail.com"
714
- }
715
- ],
716
- "description": "A security checker for your composer.lock"
717
- },
718
- {
719
- "name": "soundasleep/html2text",
720
- "version": "dev-master",
721
- "version_normalized": "9999999-dev",
722
- "source": {
723
- "type": "git",
724
- "url": "https://github.com/mailpoet/html2text.git",
725
- "reference": "95c5f266e7ea1a79b3879555cf27289985b1e4c7"
726
- },
727
- "dist": {
728
- "type": "zip",
729
- "url": "https://api.github.com/repos/mailpoet/html2text/zipball/95c5f266e7ea1a79b3879555cf27289985b1e4c7",
730
- "reference": "95c5f266e7ea1a79b3879555cf27289985b1e4c7",
731
- "shasum": ""
732
- },
733
- "require": {
734
- "ext-dom": "*",
735
- "ext-libxml": "*",
736
- "php": ">=5.3.2"
737
- },
738
- "require-dev": {
739
- "phpunit/phpunit": ">=4.0",
740
- "soundasleep/component-tests": "dev-master"
741
- },
742
- "time": "2018-04-08T14:18:46+00:00",
743
- "type": "library",
744
- "installation-source": "dist",
745
- "autoload": {
746
- "psr-4": {
747
- "Html2Text\\": "src"
748
- }
749
- },
750
- "license": [
751
- "EPL-1.0"
752
- ],
753
- "authors": [
754
  {
755
- "name": "Jevon Wright",
756
- "homepage": "https://jevon.org",
757
- "role": "Developer"
758
  }
759
  ],
760
- "description": "A PHP script to convert HTML into a plain text format",
761
- "homepage": "https://github.com/soundasleep/html2text",
762
- "keywords": [
763
- "email",
764
- "html",
765
- "php",
766
- "text"
767
- ],
768
- "support": {
769
- "email": "support@jevon.org",
770
- "source": "https://github.com/mailpoet/html2text/tree/master"
771
- }
772
  },
773
  {
774
- "name": "swiftmailer/swiftmailer",
775
- "version": "v5.4.8",
776
- "version_normalized": "5.4.8.0",
777
  "source": {
778
  "type": "git",
779
- "url": "https://github.com/swiftmailer/swiftmailer.git",
780
- "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517"
781
  },
782
  "dist": {
783
  "type": "zip",
784
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/9a06dc570a0367850280eefd3f1dc2da45aef517",
785
- "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517",
786
  "shasum": ""
787
  },
788
  "require": {
789
  "php": ">=5.3.3"
790
  },
791
- "require-dev": {
792
- "mockery/mockery": "~0.9.1",
793
- "symfony/phpunit-bridge": "~3.2"
794
  },
795
- "time": "2017-05-01T15:54:03+00:00",
796
  "type": "library",
797
  "extra": {
798
  "branch-alias": {
799
- "dev-master": "5.4-dev"
800
  }
801
  },
802
  "installation-source": "dist",
803
  "autoload": {
 
 
 
804
  "files": [
805
- "lib/swift_required.php"
806
  ]
807
  },
808
  "notification-url": "https://packagist.org/downloads/",
@@ -811,19 +742,22 @@
811
  ],
812
  "authors": [
813
  {
814
- "name": "Chris Corbyn"
 
815
  },
816
  {
817
- "name": "Fabien Potencier",
818
- "email": "fabien@symfony.com"
819
  }
820
  ],
821
- "description": "Swiftmailer, free feature-rich PHP mailer",
822
- "homepage": "http://swiftmailer.org",
823
  "keywords": [
824
- "email",
825
- "mail",
826
- "mailer"
 
 
827
  ]
828
  },
829
  {
@@ -932,6 +866,72 @@
932
  "shim"
933
  ]
934
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
  {
936
  "name": "tburry/pquery",
937
  "version": "v1.1.1",
34
  ],
35
  "description": "CSSTidy is a CSS minifier"
36
  },
37
+ {
38
+ "name": "composer/ca-bundle",
39
+ "version": "1.1.0",
40
+ "version_normalized": "1.1.0.0",
41
+ "source": {
42
+ "type": "git",
43
+ "url": "https://github.com/composer/ca-bundle.git",
44
+ "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288"
45
+ },
46
+ "dist": {
47
+ "type": "zip",
48
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288",
49
+ "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288",
50
+ "shasum": ""
51
+ },
52
+ "require": {
53
+ "ext-openssl": "*",
54
+ "ext-pcre": "*",
55
+ "php": "^5.3.2 || ^7.0"
56
+ },
57
+ "require-dev": {
58
+ "phpunit/phpunit": "^4.8.35",
59
+ "psr/log": "^1.0",
60
+ "symfony/process": "^2.5 || ^3.0 || ^4.0"
61
+ },
62
+ "time": "2017-11-29T09:37:33+00:00",
63
+ "type": "library",
64
+ "extra": {
65
+ "branch-alias": {
66
+ "dev-master": "1.x-dev"
67
+ }
68
+ },
69
+ "installation-source": "dist",
70
+ "autoload": {
71
+ "psr-4": {
72
+ "Composer\\CaBundle\\": "src"
73
+ }
74
+ },
75
+ "notification-url": "https://packagist.org/downloads/",
76
+ "license": [
77
+ "MIT"
78
+ ],
79
+ "authors": [
80
+ {
81
+ "name": "Jordi Boggiano",
82
+ "email": "j.boggiano@seld.be",
83
+ "homepage": "http://seld.be"
84
+ }
85
+ ],
86
+ "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
87
+ "keywords": [
88
+ "cabundle",
89
+ "cacert",
90
+ "certificate",
91
+ "ssl",
92
+ "tls"
93
+ ]
94
+ },
95
  {
96
  "name": "j4mie/idiorm",
97
  "version": "v1.5.3",
264
  ]
265
  },
266
  {
267
+ "name": "nesbot/carbon",
268
+ "version": "1.22.1",
269
+ "version_normalized": "1.22.1.0",
270
  "source": {
271
  "type": "git",
272
+ "url": "https://github.com/briannesbitt/Carbon.git",
273
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
274
  },
275
  "dist": {
276
  "type": "zip",
277
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
278
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
279
  "shasum": ""
280
  },
281
  "require": {
282
+ "php": ">=5.3.0",
283
+ "symfony/translation": "~2.6 || ~3.0"
284
  },
285
+ "require-dev": {
286
+ "friendsofphp/php-cs-fixer": "~2",
287
+ "phpunit/phpunit": "~4.0 || ~5.0"
288
  },
289
+ "time": "2017-01-16T07:55:07+00:00",
290
  "type": "library",
291
  "extra": {
292
  "branch-alias": {
293
+ "dev-master": "1.23-dev"
294
  }
295
  },
296
  "installation-source": "dist",
297
  "autoload": {
298
  "psr-4": {
299
+ "Carbon\\": "src/Carbon/"
300
+ }
 
 
 
301
  },
302
  "notification-url": "https://packagist.org/downloads/",
303
  "license": [
305
  ],
306
  "authors": [
307
  {
308
+ "name": "Brian Nesbitt",
309
+ "email": "brian@nesbot.com",
310
+ "homepage": "http://nesbot.com"
 
 
 
311
  }
312
  ],
313
+ "description": "A simple API extension for DateTime.",
314
+ "homepage": "http://carbon.nesbot.com",
315
  "keywords": [
316
+ "date",
317
+ "datetime",
318
+ "time"
 
 
319
  ]
320
  },
321
  {
322
+ "name": "psr/log",
323
+ "version": "1.0.2",
324
+ "version_normalized": "1.0.2.0",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  "source": {
326
  "type": "git",
327
+ "url": "https://github.com/php-fig/log.git",
328
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
329
  },
330
  "dist": {
331
  "type": "zip",
332
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
333
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
334
  "shasum": ""
335
  },
336
  "require": {
337
+ "php": ">=5.3.0"
 
 
 
 
 
338
  },
339
+ "time": "2016-10-10T12:19:37+00:00",
340
  "type": "library",
341
  "extra": {
342
  "branch-alias": {
343
+ "dev-master": "1.0.x-dev"
344
  }
345
  },
346
  "installation-source": "dist",
347
  "autoload": {
348
  "psr-4": {
349
+ "Psr\\Log\\": "Psr/Log/"
350
  }
351
  },
352
  "notification-url": "https://packagist.org/downloads/",
355
  ],
356
  "authors": [
357
  {
358
+ "name": "PHP-FIG",
359
+ "homepage": "http://www.php-fig.org/"
 
360
  }
361
  ],
362
+ "description": "Common interface for logging libraries",
363
+ "homepage": "https://github.com/php-fig/log",
364
  "keywords": [
365
+ "log",
366
+ "psr",
367
+ "psr-3"
368
  ]
369
  },
370
  {
414
  ]
415
  },
416
  {
417
+ "name": "sensiolabs/security-checker",
418
+ "version": "v4.1.6",
419
+ "version_normalized": "4.1.6.0",
420
  "source": {
421
  "type": "git",
422
+ "url": "https://github.com/sensiolabs/security-checker.git",
423
+ "reference": "387b6a3b723ba35588b33d5f8d14e28ed608bd30"
424
  },
425
  "dist": {
426
  "type": "zip",
427
+ "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/387b6a3b723ba35588b33d5f8d14e28ed608bd30",
428
+ "reference": "387b6a3b723ba35588b33d5f8d14e28ed608bd30",
429
  "shasum": ""
430
  },
431
  "require": {
432
+ "composer/ca-bundle": "^1.0",
433
+ "symfony/console": "~2.7|~3.0|~4.0"
434
  },
435
+ "time": "2017-10-29T18:48:08+00:00",
436
+ "bin": [
437
+ "security-checker"
438
+ ],
439
  "type": "library",
440
  "extra": {
441
  "branch-alias": {
442
+ "dev-master": "4.1-dev"
443
  }
444
  },
445
  "installation-source": "dist",
446
  "autoload": {
447
+ "psr-0": {
448
+ "SensioLabs\\Security": ""
449
  }
450
  },
451
  "notification-url": "https://packagist.org/downloads/",
454
  ],
455
  "authors": [
456
  {
457
+ "name": "Fabien Potencier",
458
+ "email": "fabien.potencier@gmail.com"
459
  }
460
  ],
461
+ "description": "A security checker for your composer.lock"
 
 
 
 
 
 
462
  },
463
  {
464
+ "name": "soundasleep/html2text",
465
+ "version": "dev-master",
466
+ "version_normalized": "9999999-dev",
467
  "source": {
468
  "type": "git",
469
+ "url": "https://github.com/mailpoet/html2text.git",
470
+ "reference": "95c5f266e7ea1a79b3879555cf27289985b1e4c7"
471
  },
472
  "dist": {
473
  "type": "zip",
474
+ "url": "https://api.github.com/repos/mailpoet/html2text/zipball/95c5f266e7ea1a79b3879555cf27289985b1e4c7",
475
+ "reference": "95c5f266e7ea1a79b3879555cf27289985b1e4c7",
476
  "shasum": ""
477
  },
478
  "require": {
479
+ "ext-dom": "*",
480
+ "ext-libxml": "*",
481
+ "php": ">=5.3.2"
482
  },
483
+ "require-dev": {
484
+ "phpunit/phpunit": ">=4.0",
485
+ "soundasleep/component-tests": "dev-master"
486
+ },
487
+ "time": "2018-04-08T14:18:46+00:00",
488
+ "type": "library",
489
+ "installation-source": "dist",
490
+ "autoload": {
491
+ "psr-4": {
492
+ "Html2Text\\": "src"
493
+ }
494
+ },
495
+ "license": [
496
+ "EPL-1.0"
497
+ ],
498
+ "authors": [
499
+ {
500
+ "name": "Jevon Wright",
501
+ "homepage": "https://jevon.org",
502
+ "role": "Developer"
503
+ }
504
+ ],
505
+ "description": "A PHP script to convert HTML into a plain text format",
506
+ "homepage": "https://github.com/soundasleep/html2text",
507
+ "keywords": [
508
+ "email",
509
+ "html",
510
+ "php",
511
+ "text"
512
+ ],
513
+ "support": {
514
+ "email": "support@jevon.org",
515
+ "source": "https://github.com/mailpoet/html2text/tree/master"
516
+ }
517
+ },
518
+ {
519
+ "name": "swiftmailer/swiftmailer",
520
+ "version": "v5.4.8",
521
+ "version_normalized": "5.4.8.0",
522
+ "source": {
523
+ "type": "git",
524
+ "url": "https://github.com/swiftmailer/swiftmailer.git",
525
+ "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517"
526
+ },
527
+ "dist": {
528
+ "type": "zip",
529
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/9a06dc570a0367850280eefd3f1dc2da45aef517",
530
+ "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517",
531
+ "shasum": ""
532
+ },
533
+ "require": {
534
+ "php": ">=5.3.3"
535
  },
536
  "require-dev": {
537
+ "mockery/mockery": "~0.9.1",
538
+ "symfony/phpunit-bridge": "~3.2"
539
  },
540
+ "time": "2017-05-01T15:54:03+00:00",
541
  "type": "library",
542
  "extra": {
543
  "branch-alias": {
544
+ "dev-master": "5.4-dev"
545
  }
546
  },
547
  "installation-source": "dist",
548
  "autoload": {
549
+ "files": [
550
+ "lib/swift_required.php"
 
 
 
551
  ]
552
  },
553
  "notification-url": "https://packagist.org/downloads/",
556
  ],
557
  "authors": [
558
  {
559
+ "name": "Chris Corbyn"
 
560
  },
561
  {
562
+ "name": "Fabien Potencier",
563
+ "email": "fabien@symfony.com"
564
  }
565
  ],
566
+ "description": "Swiftmailer, free feature-rich PHP mailer",
567
+ "homepage": "http://swiftmailer.org",
568
+ "keywords": [
569
+ "email",
570
+ "mail",
571
+ "mailer"
572
+ ]
573
  },
574
  {
575
  "name": "symfony/console",
642
  "homepage": "https://symfony.com"
643
  },
644
  {
645
+ "name": "symfony/debug",
646
+ "version": "v3.4.1",
647
+ "version_normalized": "3.4.1.0",
648
  "source": {
649
  "type": "git",
650
+ "url": "https://github.com/symfony/debug.git",
651
+ "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd"
652
  },
653
  "dist": {
654
  "type": "zip",
655
+ "url": "https://api.github.com/repos/symfony/debug/zipball/fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
656
+ "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
657
  "shasum": ""
658
  },
659
  "require": {
660
+ "php": "^5.5.9|>=7.0.8",
661
+ "psr/log": "~1.0"
662
+ },
663
+ "conflict": {
664
+ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
665
  },
666
  "require-dev": {
667
+ "symfony/http-kernel": "~2.8|~3.0|~4.0"
 
 
668
  },
669
+ "time": "2017-11-21T09:01:46+00:00",
670
  "type": "library",
671
  "extra": {
672
  "branch-alias": {
673
+ "dev-master": "3.4-dev"
674
  }
675
  },
676
  "installation-source": "dist",
677
  "autoload": {
678
  "psr-4": {
679
+ "Symfony\\Component\\Debug\\": ""
680
+ },
681
+ "exclude-from-classmap": [
682
+ "/Tests/"
683
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  },
685
  "notification-url": "https://packagist.org/downloads/",
686
  "license": [
689
  "authors": [
690
  {
691
  "name": "Fabien Potencier",
692
+ "email": "fabien@symfony.com"
693
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  {
695
+ "name": "Symfony Community",
696
+ "homepage": "https://symfony.com/contributors"
 
697
  }
698
  ],
699
+ "description": "Symfony Debug Component",
700
+ "homepage": "https://symfony.com"
 
 
 
 
 
 
 
 
 
 
701
  },
702
  {
703
+ "name": "symfony/polyfill-mbstring",
704
+ "version": "v1.6.0",
705
+ "version_normalized": "1.6.0.0",
706
  "source": {
707
  "type": "git",
708
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
709
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
710
  },
711
  "dist": {
712
  "type": "zip",
713
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
714
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
715
  "shasum": ""
716
  },
717
  "require": {
718
  "php": ">=5.3.3"
719
  },
720
+ "suggest": {
721
+ "ext-mbstring": "For best performance"
 
722
  },
723
+ "time": "2017-10-11T12:05:26+00:00",
724
  "type": "library",
725
  "extra": {
726
  "branch-alias": {
727
+ "dev-master": "1.6-dev"
728
  }
729
  },
730
  "installation-source": "dist",
731
  "autoload": {
732
+ "psr-4": {
733
+ "Symfony\\Polyfill\\Mbstring\\": ""
734
+ },
735
  "files": [
736
+ "bootstrap.php"
737
  ]
738
  },
739
  "notification-url": "https://packagist.org/downloads/",
742
  ],
743
  "authors": [
744
  {
745
+ "name": "Nicolas Grekas",
746
+ "email": "p@tchwork.com"
747
  },
748
  {
749
+ "name": "Symfony Community",
750
+ "homepage": "https://symfony.com/contributors"
751
  }
752
  ],
753
+ "description": "Symfony polyfill for the Mbstring extension",
754
+ "homepage": "https://symfony.com",
755
  "keywords": [
756
+ "compatibility",
757
+ "mbstring",
758
+ "polyfill",
759
+ "portable",
760
+ "shim"
761
  ]
762
  },
763
  {
866
  "shim"
867
  ]
868
  },
869
+ {
870
+ "name": "symfony/translation",
871
+ "version": "v2.8.32",
872
+ "version_normalized": "2.8.32.0",
873
+ "source": {
874
+ "type": "git",
875
+ "url": "https://github.com/symfony/translation.git",
876
+ "reference": "0c63d56516c4c4c323228ca6348eadb7c91b1daf"
877
+ },
878
+ "dist": {
879
+ "type": "zip",
880
+ "url": "https://api.github.com/repos/symfony/translation/zipball/0c63d56516c4c4c323228ca6348eadb7c91b1daf",
881
+ "reference": "0c63d56516c4c4c323228ca6348eadb7c91b1daf",
882
+ "shasum": ""
883
+ },
884
+ "require": {
885
+ "php": ">=5.3.9",
886
+ "symfony/polyfill-mbstring": "~1.0"
887
+ },
888
+ "conflict": {
889
+ "symfony/config": "<2.7"
890
+ },
891
+ "require-dev": {
892
+ "psr/log": "~1.0",
893
+ "symfony/config": "~2.8",
894
+ "symfony/intl": "~2.7.25|^2.8.18|~3.2.5",
895
+ "symfony/yaml": "~2.2|~3.0.0"
896
+ },
897
+ "suggest": {
898
+ "psr/log": "To use logging capability in translator",
899
+ "symfony/config": "",
900
+ "symfony/yaml": ""
901
+ },
902
+ "time": "2017-11-07T14:08:47+00:00",
903
+ "type": "library",
904
+ "extra": {
905
+ "branch-alias": {
906
+ "dev-master": "2.8-dev"
907
+ }
908
+ },
909
+ "installation-source": "dist",
910
+ "autoload": {
911
+ "psr-4": {
912
+ "Symfony\\Component\\Translation\\": ""
913
+ },
914
+ "exclude-from-classmap": [
915
+ "/Tests/"
916
+ ]
917
+ },
918
+ "notification-url": "https://packagist.org/downloads/",
919
+ "license": [
920
+ "MIT"
921
+ ],
922
+ "authors": [
923
+ {
924
+ "name": "Fabien Potencier",
925
+ "email": "fabien@symfony.com"
926
+ },
927
+ {
928
+ "name": "Symfony Community",
929
+ "homepage": "https://symfony.com/contributors"
930
+ }
931
+ ],
932
+ "description": "Symfony Translation Component",
933
+ "homepage": "https://symfony.com"
934
+ },
935
  {
936
  "name": "tburry/pquery",
937
  "version": "v1.1.1",